Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
afanti-open-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
java-ms
afanti-open-api
Commits
f93220b6
Commit
f93220b6
authored
Aug 18, 2025
by
潘志辉
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-0814-一汽大众查询留资互动列表接口' into 'master'
查询私信会话 See merge request
!77
parents
099f3578
f1e794c2
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
440 additions
and
1 deletion
+440
-1
ClueImMessageController.java
...car/afantiopenapi/controller/ClueImMessageController.java
+84
-0
LiveCrmCustomerChatMapper.java
...ticar/afantiopenapi/mapper/LiveCrmCustomerChatMapper.java
+14
-0
OpenApiClientPrincipalRelationMapper.java
...iopenapi/mapper/OpenApiClientPrincipalRelationMapper.java
+8
-0
ImMessageDataDto.java
...m/afanticar/afantiopenapi/model/dto/ImMessageDataDto.java
+17
-0
ImMessageRecordDto.java
...afanticar/afantiopenapi/model/dto/ImMessageRecordDto.java
+20
-0
ImMessageRequestDto.java
...fanticar/afantiopenapi/model/dto/ImMessageRequestDto.java
+18
-0
OpenIdDTO.java
...java/com/afanticar/afantiopenapi/model/dto/OpenIdDTO.java
+19
-0
LiveCrmCustomerChat.java
...ticar/afantiopenapi/model/entity/LiveCrmCustomerChat.java
+213
-0
LiveCrmCustomerChatService.java
...car/afantiopenapi/service/LiveCrmCustomerChatService.java
+12
-0
LiveCrmCustomerChatServiceImpl.java
...iopenapi/service/impl/LiveCrmCustomerChatServiceImpl.java
+20
-0
bootstrap.yml
src/main/resources/bootstrap.yml
+8
-1
OpenApiClientPrincipalRelationMapper.xml
...resources/mapper/OpenApiClientPrincipalRelationMapper.xml
+7
-0
No files found.
src/main/java/com/afanticar/afantiopenapi/controller/ClueImMessageController.java
0 → 100644
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
controller
;
import
com.afanticar.afantiopenapi.mapper.OpenApiClientPrincipalRelationMapper
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.dto.ImMessageDataDto
;
import
com.afanticar.afantiopenapi.model.dto.ImMessageRecordDto
;
import
com.afanticar.afantiopenapi.model.dto.ImMessageRequestDto
;
import
com.afanticar.afantiopenapi.model.dto.OpenIdDTO
;
import
com.afanticar.afantiopenapi.model.entity.LiveCrmCustomerChat
;
import
com.afanticar.afantiopenapi.service.BaseService
;
import
com.afanticar.afantiopenapi.service.LiveCrmCustomerChatService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.pagehelper.IPage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/clue/im/message"
)
public
class
ClueImMessageController
extends
BaseController
{
// 假设BaseService已经存在并被Spring管理
@Autowired
private
BaseService
baseService
;
@Autowired
private
LiveCrmCustomerChatService
liveCrmCustomerChatService
;
@Autowired
OpenApiClientPrincipalRelationMapper
openApiClientPrincipalRelationMapper
;
/**
* 查询互动列表
*/
@PostMapping
(
"/list"
)
public
BaseResponse
<
ImMessageDataDto
>
list
(
@RequestBody
ImMessageRequestDto
request
)
{
// 添加频率控制,使用日期类型、限制次数和限制周期参数
BaseResponse
check
=
baseService
.
baseLimit
(
"im_message_list"
,
100
,
60
);
if
(
check
!=
null
)
{
return
check
;
}
// 根据 request.getStoreCode()和request.getPhoneNo()找到AuthorOpenId和FansOpenId
List
<
OpenIdDTO
>
openIdDTOList
=
openApiClientPrincipalRelationMapper
.
getOpenIdByStoreCodeAndPhone
(
request
.
getStoreCode
(),
request
.
getPhoneNo
());
if
(
CollectionUtils
.
isEmpty
(
openIdDTOList
)){
return
success
(
new
ImMessageDataDto
());
}
// 使用分页查询表数据返回
Page
<
LiveCrmCustomerChat
>
page
=
new
Page
<>(
request
.
getCurrent
(),
request
.
getSize
());
LambdaQueryWrapper
<
LiveCrmCustomerChat
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
openIdDTOList
.
forEach
(
openIdDTO
->
{
queryWrapper
.
or
().
eq
(
LiveCrmCustomerChat:
:
getAuthorOpenId
,
openIdDTO
.
getAuthorOpenId
())
.
eq
(
LiveCrmCustomerChat:
:
getFansOpenId
,
openIdDTO
.
getUserOpenId
());
});
if
(
"desc"
.
equals
(
request
.
getTimeSort
()))
{
queryWrapper
.
orderByDesc
(
LiveCrmCustomerChat:
:
getPublishTime
);
}
Page
<
LiveCrmCustomerChat
>
iPageData
=
liveCrmCustomerChatService
.
page
(
page
,
queryWrapper
);
ImMessageDataDto
imMessageDataDto
=
new
ImMessageDataDto
();
imMessageDataDto
.
setTotal
(
iPageData
.
getTotal
());
imMessageDataDto
.
setCurrent
(
iPageData
.
getCurrent
());
imMessageDataDto
.
setSize
(
iPageData
.
getSize
());
imMessageDataDto
.
setPages
(
iPageData
.
getPages
());
List
<
ImMessageRecordDto
>
imMessageRecordDtos
=
new
ArrayList
<>();
iPageData
.
getRecords
().
forEach
(
liveCrmCustomerChat
->
{
ImMessageRecordDto
imMessageRecordDto
=
new
ImMessageRecordDto
();
imMessageRecordDto
.
setAuthorNickname
(
liveCrmCustomerChat
.
getAuthorNickname
());
imMessageRecordDto
.
setAuthorAvatar
(
liveCrmCustomerChat
.
getAuthorAvatar
());
imMessageRecordDto
.
setCustomerNickname
(
liveCrmCustomerChat
.
getFansNickname
());
imMessageRecordDto
.
setCustomerAvatar
(
liveCrmCustomerChat
.
getFansAvatar
());
imMessageRecordDto
.
setIsAuthorSend
(
liveCrmCustomerChat
.
getIsAuthorSend
());
imMessageRecordDto
.
setMessageTime
(
liveCrmCustomerChat
.
getPublishTime
());
imMessageRecordDto
.
setContent
(
liveCrmCustomerChat
.
getContent
());
imMessageRecordDtos
.
add
(
imMessageRecordDto
);
});
imMessageDataDto
.
setRecords
(
imMessageRecordDtos
);
return
success
(
imMessageDataDto
);
}
}
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/mapper/LiveCrmCustomerChatMapper.java
0 → 100644
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.entity.LiveCrmCustomerChat
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
/**
* @author liuyudong
* @desc
* @Date 2023/08/08
**/
@Repository
public
interface
LiveCrmCustomerChatMapper
extends
BaseMapper
<
LiveCrmCustomerChat
>
{
}
src/main/java/com/afanticar/afantiopenapi/mapper/OpenApiClientPrincipalRelationMapper.java
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
package
com
.
afanticar
.
afantiopenapi
.
mapper
;
import
com.afanticar.afantiopenapi.model.dto.OpenIdDTO
;
import
com.afanticar.afantiopenapi.model.entity.OpenApiClientPrincipalRelationEntity
;
import
com.afanticar.afantiopenapi.model.entity.OpenApiClientPrincipalRelationEntity
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -12,6 +14,7 @@ import java.util.List;
...
@@ -12,6 +14,7 @@ import java.util.List;
* @since 2025/4/24 9:47
* @since 2025/4/24 9:47
*/
*/
@Mapper
@Mapper
@DS
(
"master"
)
public
interface
OpenApiClientPrincipalRelationMapper
extends
BaseMapper
<
OpenApiClientPrincipalRelationEntity
>
{
public
interface
OpenApiClientPrincipalRelationMapper
extends
BaseMapper
<
OpenApiClientPrincipalRelationEntity
>
{
/**
/**
...
@@ -22,4 +25,9 @@ public interface OpenApiClientPrincipalRelationMapper extends BaseMapper<OpenApi
...
@@ -22,4 +25,9 @@ public interface OpenApiClientPrincipalRelationMapper extends BaseMapper<OpenApi
* @param clientId 客户端id
* @param clientId 客户端id
*/
*/
List
<
OpenApiClientPrincipalRelationEntity
>
selectByClientId
(
@Param
(
"clientId"
)
String
clientId
);
List
<
OpenApiClientPrincipalRelationEntity
>
selectByClientId
(
@Param
(
"clientId"
)
String
clientId
);
/**
* 查询留资主播和粉丝open_id
*/
List
<
OpenIdDTO
>
getOpenIdByStoreCodeAndPhone
(
@Param
(
"storeCode"
)
String
storeCode
,
@Param
(
"phone"
)
String
phone
);
}
}
src/main/java/com/afanticar/afantiopenapi/model/dto/ImMessageDataDto.java
0 → 100644
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
model
.
dto
;
import
com.fasterxml.jackson.databind.PropertyNamingStrategy
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.util.List
;
@Data
@JsonNaming
(
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
public
class
ImMessageDataDto
{
private
long
current
;
private
long
size
;
private
long
pages
;
private
long
total
;
private
List
<
ImMessageRecordDto
>
records
;
}
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/model/dto/ImMessageRecordDto.java
0 → 100644
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
model
.
dto
;
import
com.fasterxml.jackson.databind.PropertyNamingStrategy
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
lombok.Data
;
import
java.util.Date
;
@Data
@JsonNaming
(
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
public
class
ImMessageRecordDto
{
private
String
authorNickname
;
private
String
authorAvatar
;
private
String
customerNickname
;
private
String
customerAvatar
;
private
int
isAuthorSend
;
private
Date
messageTime
;
private
String
content
;
}
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/model/dto/ImMessageRequestDto.java
0 → 100644
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
model
.
dto
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.fasterxml.jackson.databind.PropertyNamingStrategy
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
@Data
@JsonNaming
(
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
ImMessageRequestDto
{
private
String
storeCode
;
private
String
phoneNo
;
private
String
timeSort
=
"desc"
;
private
int
current
=
1
;
private
int
size
=
10
;
}
\ No newline at end of file
src/main/java/com/afanticar/afantiopenapi/model/dto/OpenIdDTO.java
0 → 100644
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
model
.
dto
;
import
com.alibaba.fastjson.annotation.JSONType
;
import
com.fasterxml.jackson.databind.annotation.JsonNaming
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
@Data
@JsonNaming
(
value
=
com
.
fasterxml
.
jackson
.
databind
.
PropertyNamingStrategy
.
SnakeCaseStrategy
.
class
)
@JSONType
(
naming
=
com
.
alibaba
.
fastjson
.
PropertyNamingStrategy
.
SnakeCase
)
public
class
OpenIdDTO
{
private
String
authorOpenId
;
private
String
userOpenId
;
private
int
platform
;
}
src/main/java/com/afanticar/afantiopenapi/model/entity/LiveCrmCustomerChat.java
0 → 100644
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
model
.
entity
;
//import com.afanticar.marketing.onedata.domain.dto.MatrixMessageDto;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author liuyudong
* @desc
* @Date 2023/08/08
**/
@TableName
(
value
=
"live_crm_customer_chat_all"
)
@Data
public
class
LiveCrmCustomerChat
{
/**
* 私信历史记录主键id
*/
@TableId
(
type
=
IdType
.
INPUT
)
private
String
id
;
/**
* fans_open_id
*/
private
String
fansOpenId
;
/**
* fans_nickname
*/
private
String
fansNickname
;
/**
* author_open_id
*/
private
String
authorOpenId
;
/**
* author_id
*/
private
String
authorId
;
/**
* content
*/
private
String
content
;
/**
* 私信的发送者,0粉丝,1主播
*/
private
Integer
isAuthorSend
;
/**
* 是否已读,0未读,1已读
*/
private
Integer
isRead
;
/**
* 创建时间
*/
private
Date
ctime
;
/**
* 联系方式
*/
private
String
contact
;
/**
* 车型名称字符串拼接,以逗号分隔
*/
private
String
seriesId
;
/**
* fans_id
*/
private
String
fansId
;
/**
* fans_avatar
*/
private
String
fansAvatar
;
/**
* 抖音快手的code
*/
private
String
fansCode
;
/**
* author_nickname
*/
private
String
authorNickname
;
/**
* author_avatar
*/
private
String
authorAvatar
;
/**
* 实际私信时间
*/
private
Date
publishTime
;
/**
* 平台私信id
*/
private
String
msgId
;
/**
* 风火轮使用人名称
*/
private
String
userName
;
/**
* 会话id
*/
private
String
shortId
;
/**
* 进入私信回话 0-否 1-是
*/
private
String
isEnterDirect
;
/**
* 外部信息(包含:表情url、视频itemid、卡片信息)
*/
private
String
externalInfo
;
/**
* 消息类型(1:文本;2:图片;3:表情;4:视频;5:消息卡片;6:其他;) ) engine = distributed( default , marketing_rawdata , live_crm_customer_chat_local , hivehash(id)
*/
private
Integer
messageType
;
private
Integer
isDouyinSend
;
private
Integer
reachFunctionType
;
/**
* 主体id
*/
private
String
principalId
;
/**
* 主体名称
*/
private
String
principalName
;
/**
* 一级区域id
*/
private
String
regionId
;
/**
* 一级区域名称
*/
private
String
regionName
;
/**
* 二级区域id
*/
private
String
villageId
;
/**
* 二级区域名称
*/
private
String
villageName
;
/**
* 成员ID
*/
private
String
memberId
;
/**
* 成员编号
*/
private
String
memberCode
;
/**
* 成员名称
*/
private
String
memberName
;
/**
* 策略id
*/
private
String
sceneId
;
/**
* 策略名称
*/
private
String
sceneName
;
/**
* 触发抖音发送不成功错误描述记录
*/
private
String
errorMsg
;
private
Integer
functionType
=
0
;
// public void setMatrix(MatrixMessageDto dto){
// if(dto != null){
// this.principalId = dto.getPrincipalId();
// this.principalName = dto.getPrincipalName();
// this.regionId = dto.getRegionId();
// this.regionName = dto.getRegionName();
// this.villageId = dto.getVillageId();
// this.villageName = dto.getVillageName();
// this.memberId = dto.getMemberId();
// this.memberCode = dto.getMemberCode();
// this.memberName = dto.getMemberName();
// }
// }
}
src/main/java/com/afanticar/afantiopenapi/service/LiveCrmCustomerChatService.java
0 → 100644
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
service
;
import
com.afanticar.afantiopenapi.model.entity.LiveCrmCustomerChat
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* @author liuyudong
* @desc
* @Date 2023/08/08
**/
public
interface
LiveCrmCustomerChatService
extends
IService
<
LiveCrmCustomerChat
>
{
}
src/main/java/com/afanticar/afantiopenapi/service/impl/LiveCrmCustomerChatServiceImpl.java
0 → 100644
View file @
f93220b6
package
com
.
afanticar
.
afantiopenapi
.
service
.
impl
;
import
com.afanticar.afantiopenapi.mapper.LiveCrmCustomerChatMapper
;
import
com.afanticar.afantiopenapi.model.entity.LiveCrmCustomerChat
;
import
com.afanticar.afantiopenapi.service.LiveCrmCustomerChatService
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.stereotype.Service
;
/**
* @author liuyudong
* @desc
* @Date 2023/08/08
**/
@Service
@DS
(
"marketing"
)
public
class
LiveCrmCustomerChatServiceImpl
extends
ServiceImpl
<
LiveCrmCustomerChatMapper
,
LiveCrmCustomerChat
>
implements
LiveCrmCustomerChatService
{
}
src/main/resources/bootstrap.yml
View file @
f93220b6
...
@@ -15,6 +15,7 @@ spring:
...
@@ -15,6 +15,7 @@ spring:
-
data-id
:
dynamic-db-afanti-bi-app-vault.yml
-
data-id
:
dynamic-db-afanti-bi-app-vault.yml
-
data-id
:
dynamic-db-afanti-vault.yml
-
data-id
:
dynamic-db-afanti-vault.yml
-
data-id
:
dynamic-db-afanti-tmp-vault.yml
-
data-id
:
dynamic-db-afanti-tmp-vault.yml
-
data-id
:
dynamic-db-afanti-bsck-marketing.yml
-
data-id
:
common-redis.yml
-
data-id
:
common-redis.yml
-
data-id
:
afanti-open-api.yml
-
data-id
:
afanti-open-api.yml
vault
:
vault
:
...
@@ -52,6 +53,12 @@ spring:
...
@@ -52,6 +53,12 @@ spring:
role
:
external-role
role
:
external-role
username-property
:
spring.datasource.dynamic.datasource.tmp.username
username-property
:
spring.datasource.dynamic.datasource.tmp.username
password-property
:
spring.datasource.dynamic.datasource.tmp.password
password-property
:
spring.datasource.dynamic.datasource.tmp.password
marketing
:
enabled
:
true
backend
:
${spring.profiles.active}db
role
:
app-role
username-property
:
spring.datasource.dynamic.datasource.marketing.username
password-property
:
spring.datasource.dynamic.datasource.marketing.password
#
#
#
#
...
@@ -90,4 +97,4 @@ mybatis-plus:
...
@@ -90,4 +97,4 @@ mybatis-plus:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging
:
logging
:
level
:
level
:
com.afanticar.datacenter.http.mapper.*
:
debug
com.afanticar.afantiopenapi.mapper.*
:
debug
\ No newline at end of file
\ No newline at end of file
src/main/resources/mapper/OpenApiClientPrincipalRelationMapper.xml
View file @
f93220b6
...
@@ -5,4 +5,11 @@
...
@@ -5,4 +5,11 @@
resultType=
"com.afanticar.afantiopenapi.model.entity.OpenApiClientPrincipalRelationEntity"
>
resultType=
"com.afanticar.afantiopenapi.model.entity.OpenApiClientPrincipalRelationEntity"
>
select * from open_api_client_principal_relation where client_id = #{clientId} and is_deleted = 0
select * from open_api_client_principal_relation where client_id = #{clientId} and is_deleted = 0
</select>
</select>
<select
id=
"getOpenIdByStoreCodeAndPhone"
resultType=
"com.afanticar.afantiopenapi.model.dto.OpenIdDTO"
>
select distinct author_open_id ,user_open_id,platform from fhl_mkms_clue_follow_up lea
inner join base_dealer dea on lea.dealer_id = dea.id and dea.status=1 and dea.is_deleted =0 and dea.store_code =#{storeCode}
where lea.contact =#{phone} and lea.is_deleted = 0
</select>
</mapper>
</mapper>
\ No newline at end of file
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