Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
ba38045c
Commit
ba38045c
authored
Oct 25, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询ai列表
parent
eb9fd413
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
10 deletions
+16
-10
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserDao.java
+1
-1
ch-dao/src/main/java/com/wwdz/ch/db/impl/UserDaoImpl.java
ch-dao/src/main/java/com/wwdz/ch/db/impl/UserDaoImpl.java
+3
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/AiAssistantServiceImpl.java
...main/java/com/wwdz/ch/wx/impl/AiAssistantServiceImpl.java
+4
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
.../src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
+2
-2
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/ChatApiTest.java
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/ChatApiTest.java
+5
-4
No files found.
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserDao.java
View file @
ba38045c
...
@@ -53,7 +53,7 @@ public interface UserDao {
...
@@ -53,7 +53,7 @@ public interface UserDao {
* @param user
* @param user
* @return
* @return
*/
*/
int
insert
(
User
user
);
long
insert
(
User
user
);
/**
/**
* 更新记录
* 更新记录
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/UserDaoImpl.java
View file @
ba38045c
...
@@ -52,8 +52,9 @@ public class UserDaoImpl implements UserDao {
...
@@ -52,8 +52,9 @@ public class UserDaoImpl implements UserDao {
}
}
@Override
@Override
public
int
insert
(
User
user
)
{
public
long
insert
(
User
user
)
{
return
userMapper
.
insert
(
user
);
userMapper
.
insert
(
user
);
return
user
.
getId
();
}
}
@Override
@Override
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/AiAssistantServiceImpl.java
View file @
ba38045c
...
@@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory;
...
@@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -64,6 +65,9 @@ public class AiAssistantServiceImpl implements AiAssistantService {
...
@@ -64,6 +65,9 @@ public class AiAssistantServiceImpl implements AiAssistantService {
return
Result
.
failed
(
"获取列表失败"
);
return
Result
.
failed
(
"获取列表失败"
);
}
}
List
<
IMChatVo
>
imChatVoList
=
chatResult
.
getData
().
getDataList
();
List
<
IMChatVo
>
imChatVoList
=
chatResult
.
getData
().
getDataList
();
if
(
CollectionUtils
.
isEmpty
(
imChatVoList
))
{
isContinue
=
false
;
}
List
<
String
>
ids
=
imChatVoList
.
stream
().
map
(
IMChatVo:
:
getOrginalToAccount
).
collect
(
Collectors
.
toList
());
List
<
String
>
ids
=
imChatVoList
.
stream
().
map
(
IMChatVo:
:
getOrginalToAccount
).
collect
(
Collectors
.
toList
());
converstionUserIdList
.
addAll
(
ids
);
converstionUserIdList
.
addAll
(
ids
);
if
(
chatResult
.
getData
().
getCompleteFlag
()
==
1
)
{
if
(
chatResult
.
getData
().
getCompleteFlag
()
==
1
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
ba38045c
...
@@ -530,7 +530,7 @@ public class UserServiceImpl implements UserService {
...
@@ -530,7 +530,7 @@ public class UserServiceImpl implements UserService {
user
.
setLastLoginTime
(
now
);
user
.
setLastLoginTime
(
now
);
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
user
.
setShareUserId
(
0L
);
user
.
setShareUserId
(
0L
);
int
userId
=
userDao
.
insert
(
user
);
long
userId
=
userDao
.
insert
(
user
);
//把新增用户同步到IM
//把新增用户同步到IM
Result
synUserResult
=
chatUserApi
.
importUser
(
user
);
Result
synUserResult
=
chatUserApi
.
importUser
(
user
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
View file @
ba38045c
...
@@ -60,14 +60,14 @@ public class WxLoginManager {
...
@@ -60,14 +60,14 @@ public class WxLoginManager {
* @return
* @return
*/
*/
public
String
getWxOpenId
(
String
loginCode
)
{
public
String
getWxOpenId
(
String
loginCode
)
{
logger
.
info
(
"开始获取openId-----------------------"
);
String
openId
=
""
;
String
openId
=
""
;
try
{
try
{
logger
.
info
(
">>>>>>>>> 获取微信openid, 参数loginCode:{}"
,
loginCode
);
WxMaJscode2SessionResult
result
=
this
.
wxMaService
.
getUserService
().
getSessionInfo
(
loginCode
);
WxMaJscode2SessionResult
result
=
this
.
wxMaService
.
getUserService
().
getSessionInfo
(
loginCode
);
//实际获取的是unionid,为了和公众号订阅用户关联
//实际获取的是unionid,为了和公众号订阅用户关联
openId
=
result
.
getUnionid
();
openId
=
result
.
getUnionid
();
logger
.
info
(
"获取WxMaJscode2SessionResult :{}"
,
result
);
logger
.
info
(
"获取WxMaJscode2SessionResult :{}"
,
result
);
logger
.
info
(
"loginCode:{},获取openId成功
openI
d :{}"
,
loginCode
,
openId
);
logger
.
info
(
"loginCode:{},获取openId成功
unioni
d :{}"
,
loginCode
,
openId
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"loginCode:{}, 获取微信登录用户的openId失败:{}"
,
loginCode
,
e
);
logger
.
error
(
"loginCode:{}, 获取微信登录用户的openId失败:{}"
,
loginCode
,
e
);
}
}
...
...
ch-wx-api/src/test/java/com/wwdz/ch/wx/api/ChatApiTest.java
View file @
ba38045c
...
@@ -90,11 +90,12 @@ public class ChatApiTest {
...
@@ -90,11 +90,12 @@ public class ChatApiTest {
@Test
@Test
public
void
sendChatMsg
()
{
public
void
sendChatMsg
()
{
SendChatMsgRequestDto
sendChatMsgRequestDto
=
new
SendChatMsgRequestDto
();
SendChatMsgRequestDto
sendChatMsgRequestDto
=
new
SendChatMsgRequestDto
();
sendChatMsgRequestDto
.
setToAccount
(
"2
41
"
);
sendChatMsgRequestDto
.
setToAccount
(
"2
85
"
);
sendChatMsgRequestDto
.
setFromAccount
(
"ai10001"
);
sendChatMsgRequestDto
.
setFromAccount
(
"ai10001"
);
sendChatMsgRequestDto
.
setMsgType
(
IMEnum
.
MsgTypeEnum
.
TIMTextElem
.
getCode
());
sendChatMsgRequestDto
.
setMsgType
(
IMEnum
.
MsgTypeEnum
.
TIMTextElem
.
getCode
());
long
timestamp
=
System
.
currentTimeMillis
();
long
timestamp
=
System
.
currentTimeMillis
();
String
msgContent
=
timestamp
+
" >> ai测试消息的数据, 是否可以接收到"
;
// String msgContent = timestamp + " >> ai测试消息的数据, 是否可以接收到";
String
msgContent
=
"Hi,欢迎来到小藏的世界"
;
sendChatMsgRequestDto
.
setMsgContent
(
msgContent
);
sendChatMsgRequestDto
.
setMsgContent
(
msgContent
);
Result
<
String
>
result
=
conversationApi
.
sendChatMsg
(
sendChatMsgRequestDto
);
Result
<
String
>
result
=
conversationApi
.
sendChatMsg
(
sendChatMsgRequestDto
);
String
msgKey
=
result
.
getData
();
String
msgKey
=
result
.
getData
();
...
@@ -115,7 +116,7 @@ public class ChatApiTest {
...
@@ -115,7 +116,7 @@ public class ChatApiTest {
sendChatMsgRequestDto
.
setFromAccount
(
"ai10000"
);
sendChatMsgRequestDto
.
setFromAccount
(
"ai10000"
);
sendChatMsgRequestDto
.
setMsgType
(
IMEnum
.
MsgTypeEnum
.
TIMTextElem
.
getCode
());
sendChatMsgRequestDto
.
setMsgType
(
IMEnum
.
MsgTypeEnum
.
TIMTextElem
.
getCode
());
long
timestamp
=
System
.
currentTimeMillis
();
long
timestamp
=
System
.
currentTimeMillis
();
String
msgContent
=
timestamp
+
" >> ai测试消息的数据, 是否可以接收到
"
;
String
msgContent
=
"Hi,欢迎来到小藏的世界
"
;
sendChatMsgRequestDto
.
setMsgContent
(
msgContent
);
sendChatMsgRequestDto
.
setMsgContent
(
msgContent
);
conversationApi
.
sendChatMsg
(
sendChatMsgRequestDto
);
conversationApi
.
sendChatMsg
(
sendChatMsgRequestDto
);
});
});
...
@@ -127,7 +128,7 @@ public class ChatApiTest {
...
@@ -127,7 +128,7 @@ public class ChatApiTest {
@Test
@Test
public
void
getChatList
()
{
public
void
getChatList
()
{
IMChatRequestDto
imChatRequestDto
=
new
IMChatRequestDto
();
IMChatRequestDto
imChatRequestDto
=
new
IMChatRequestDto
();
imChatRequestDto
.
setUserId
(
24
2
L
);
imChatRequestDto
.
setUserId
(
24
3
L
);
conversationApi
.
getChatList
(
imChatRequestDto
);
conversationApi
.
getChatList
(
imChatRequestDto
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment