Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-riskmanage
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 25094df4
authored
Jan 20, 2026
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:策略中心代码
1 parent
89ba8767
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
328 additions
and
1 deletions
rpc-dj-riskmanage-api/src/main/java/cn/com/glsx/dj/riskmanage/dto/MerchantServiceAndBrandDTO.java
rpc-dj-riskmanage-api/src/main/java/cn/com/glsx/dj/riskmanage/dto/YqMerchantConfigDTO.java
rpc-dj-riskmanage-api/src/main/java/cn/com/glsx/dj/riskmanage/remote/CommonRemote.java
rpc-dj-riskmanage/pom.xml
rpc-dj-riskmanage/src/main/java/cn/com/glsx/dj/riskmanage/mapper/ActivityMapper.java
rpc-dj-riskmanage/src/main/java/cn/com/glsx/dj/riskmanage/remote/CommonRemoteImpl.java
rpc-dj-riskmanage/src/main/java/cn/com/glsx/dj/riskmanage/service/CommonService.java
rpc-dj-riskmanage/src/main/resources/META-INF/orm/ActivityMapper.xml
rpc-dj-riskmanage-api/src/main/java/cn/com/glsx/dj/riskmanage/dto/MerchantServiceAndBrandDTO.java
0 → 100644
View file @
25094df
package
cn
.
com
.
glsx
.
dj
.
riskmanage
.
dto
;
import
cn.com.glsx.dj.smartcarlife.response.CarBrandResponse
;
import
com.google.common.collect.Lists
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 门店服务商以及主营品牌
* @author yangwei
* @version 1.0
* @since 2026/01/19 15:13
*/
@Data
@Accessors
(
chain
=
true
)
public
class
MerchantServiceAndBrandDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
7354687620167780507L
;
/**
* 商户编号
*/
private
Integer
merchantNo
;
/**
* 品牌名称
*/
private
List
<
CarBrandResponse
>
brands
=
Lists
.
newArrayList
();
/**
* 主服务名称
*/
private
String
mainServiceName
;
/**
* 主服务编号
*/
private
Integer
mainServiceMerchantNo
;
/**
* 是否直营 0 否 1 是
*/
private
Integer
directSaleFlag
;
}
rpc-dj-riskmanage-api/src/main/java/cn/com/glsx/dj/riskmanage/dto/YqMerchantConfigDTO.java
0 → 100644
View file @
25094df
package
cn
.
com
.
glsx
.
dj
.
riskmanage
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author yangwei
* @version 1.0
* @since 2026/01/19 16:42
*/
@Data
public
class
YqMerchantConfigDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3025440434854123324L
;
/**
* 4s店商户ID
*/
private
Integer
merchantId
;
/**
* 主服务商商户id
*/
private
Integer
partnerMerchantId
;
/**
* 主服务商商户名称
*/
private
String
partnerMerchantName
;
}
rpc-dj-riskmanage-api/src/main/java/cn/com/glsx/dj/riskmanage/remote/CommonRemote.java
0 → 100644
View file @
25094df
package
cn
.
com
.
glsx
.
dj
.
riskmanage
.
remote
;
import
cn.com.glsx.dj.riskmanage.dto.MerchantServiceAndBrandDTO
;
import
cn.com.glsx.framework.core.annotation.ApiMethod
;
import
cn.com.glsx.framework.core.annotation.ApiParam
;
import
cn.com.glsx.framework.core.annotation.ApiResponse
;
import
cn.com.glsx.framework.core.annotation.ApiService
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
java.util.List
;
/**
* 公共的远程接口
* @author yangwei
* @version 1.0
* @since 2026/01/19 15:02
*/
@ApiService
(
value
=
"公共的远程接口"
,
owner
=
"yangwei"
)
public
interface
CommonRemote
{
@ApiMethod
(
"获取门店服务商以及主营品牌"
)
@ApiParam
(
name
=
"merchantNos"
,
notes
=
"门店编号列表"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)
@ApiResponse
(
"门店服务商列表"
)
RpcResponse
<
List
<
MerchantServiceAndBrandDTO
>>
findMerchantListServiceAndBrand
(
List
<
Integer
>
merchantNos
,
String
scene
);
}
rpc-dj-riskmanage/pom.xml
View file @
25094df
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
<dependency>
<dependency>
<groupId>
cn.com.glsx.merchants
</groupId>
<groupId>
cn.com.glsx.merchants
</groupId>
<artifactId>
platform-merchants-api
</artifactId>
<artifactId>
platform-merchants-api
</artifactId>
<version>
5.
5.0
-SNAPSHOT
</version>
<version>
5.
6.1
-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<groupId>
com.google.code.gson
</groupId>
...
...
rpc-dj-riskmanage/src/main/java/cn/com/glsx/dj/riskmanage/mapper/ActivityMapper.java
View file @
25094df
package
cn
.
com
.
glsx
.
dj
.
riskmanage
.
mapper
;
package
cn
.
com
.
glsx
.
dj
.
riskmanage
.
mapper
;
import
cn.com.glsx.dj.riskmanage.dto.YqMerchantConfigDTO
;
import
cn.com.glsx.dj.riskmanage.dto.activity.ActivityQryDTO
;
import
cn.com.glsx.dj.riskmanage.dto.activity.ActivityQryDTO
;
import
cn.com.glsx.dj.riskmanage.dto.activity.ActivityRespDTO
;
import
cn.com.glsx.dj.riskmanage.dto.activity.ActivityRespDTO
;
import
cn.com.glsx.dj.riskmanage.model.Activity
;
import
cn.com.glsx.dj.riskmanage.model.Activity
;
...
@@ -15,4 +16,9 @@ public interface ActivityMapper extends OreMapper<Activity> {
...
@@ -15,4 +16,9 @@ public interface ActivityMapper extends OreMapper<Activity> {
List
<
ActivityRespDTO
>
queryList
(
ActivityQryDTO
condition
);
List
<
ActivityRespDTO
>
queryList
(
ActivityQryDTO
condition
);
Integer
getSceneType
(
@Param
(
"merchantId"
)
Integer
merchantId
,
@Param
(
"sceneType"
)
Integer
sceneType
);
Integer
getSceneType
(
@Param
(
"merchantId"
)
Integer
merchantId
,
@Param
(
"sceneType"
)
Integer
sceneType
);
List
<
YqMerchantConfigDTO
>
getServiceByMerchantId
(
@Param
(
"merchantNos"
)
List
<
Integer
>
merchantNos
,
@Param
(
"scene"
)
String
scene
);
}
}
\ No newline at end of file
\ No newline at end of file
rpc-dj-riskmanage/src/main/java/cn/com/glsx/dj/riskmanage/remote/CommonRemoteImpl.java
0 → 100644
View file @
25094df
package
cn
.
com
.
glsx
.
dj
.
riskmanage
.
remote
;
import
cn.com.glsx.dj.riskmanage.dto.MerchantServiceAndBrandDTO
;
import
cn.com.glsx.dj.riskmanage.service.CommonService
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
java.util.List
;
/**
* @author yangwei
* @version 1.0
* @since 2026/01/19 15:02
*/
@Slf4j
@DubboService
@RequiredArgsConstructor
public
class
CommonRemoteImpl
implements
CommonRemote
{
private
final
CommonService
commonService
;
@Override
public
RpcResponse
<
List
<
MerchantServiceAndBrandDTO
>>
findMerchantListServiceAndBrand
(
List
<
Integer
>
merchantNos
,
String
scene
)
{
try
{
List
<
MerchantServiceAndBrandDTO
>
merchantServiceAndBrandDTOList
=
commonService
.
findMerchantListServiceAndBrand
(
merchantNos
,
scene
);
return
RpcResponse
.
success
(
merchantServiceAndBrandDTOList
);
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
"查询商户服务品牌 RpcServiceException"
,
e
);
return
RpcResponse
.
error
(
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"查询商户服务品牌 Exception"
,
e
);
return
RpcResponse
.
error
(
e
);
}
}
}
rpc-dj-riskmanage/src/main/java/cn/com/glsx/dj/riskmanage/service/CommonService.java
0 → 100644
View file @
25094df
package
cn
.
com
.
glsx
.
dj
.
riskmanage
.
service
;
import
cn.com.glsx.dj.riskmanage.consts.ConfigCenterConstants
;
import
cn.com.glsx.dj.riskmanage.dto.MerchantServiceAndBrandDTO
;
import
cn.com.glsx.dj.riskmanage.dto.YqMerchantConfigDTO
;
import
cn.com.glsx.dj.riskmanage.mapper.ActivityMapper
;
import
cn.com.glsx.dj.smartcarlife.response.CarBrandResponse
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.merchants.model.response.MerchantBrandDTO
;
import
cn.com.glsx.merchants.remote.MerchantRemote
;
import
cn.com.glsx.scrm.proxy.enums.ProxyRequestSourceEnum
;
import
cn.com.glsx.scrm.proxy.model.CommonProxyRequest
;
import
cn.com.glsx.scrm.proxy.model.ProxyBaseResponse
;
import
cn.com.glsx.scrm.proxy.remote.CommonProxyRemote
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.google.common.collect.Lists
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.task.TaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.LinkedMultiValueMap
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* @author yangwei
* @version 1.0
* @since 2026/01/19 15:21
*/
@Slf4j
@Service
@RequiredArgsConstructor
public
class
CommonService
{
private
final
Environment
env
;
private
final
TaskExecutor
taskExecutor
;
private
final
MerchantRemote
merchantRemote
;
private
final
ActivityMapper
activityMapper
;
private
final
CommonProxyRemote
commonProxyRemote
;
/**
* 查询商户列表服务和品牌
* @author yangwei
* @since 2026/1/19 16:25
* @param merchantNos 商户号列表
* @param scene 场景 0 延保,权益 1 轻改
* @return java.util.List<cn.com.glsx.dj.riskmanage.dto.MerchantServiceAndBrandDTO>
*/
public
List
<
MerchantServiceAndBrandDTO
>
findMerchantListServiceAndBrand
(
List
<
Integer
>
merchantNos
,
String
scene
)
{
// 主服务商
Integer
mainMerchantId
=
env
.
getProperty
(
ConfigCenterConstants
.
DIRECT_SALE_MERCHANT_ID
,
Integer
.
class
,
44217690
);
// 查询商户服务配置
CompletableFuture
<
Map
<
Integer
,
List
<
YqMerchantConfigDTO
>>>
merchantConfigFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
try
{
List
<
YqMerchantConfigDTO
>
yqMerchantConfig
=
activityMapper
.
getServiceByMerchantId
(
merchantNos
,
scene
);
return
yqMerchantConfig
.
stream
().
collect
(
Collectors
.
groupingBy
(
YqMerchantConfigDTO:
:
getMerchantId
));
}
catch
(
Exception
e
)
{
log
.
error
(
"查询商户服务配置失败"
,
e
);
return
MapUtil
.<
Integer
,
List
<
YqMerchantConfigDTO
>>
builder
().
build
();
}
},
taskExecutor
);
// 查询门店主营品牌
CompletableFuture
<
Map
<
Integer
,
List
<
MerchantBrandDTO
>>>
merchantBrandFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
try
{
RpcResponse
<
List
<
MerchantBrandDTO
>>
brandByMerchantIdsResp
=
merchantRemote
.
getBrandByMerchantIds
(
merchantNos
);
if
(
brandByMerchantIdsResp
.
isFailed
())
{
log
.
error
(
"查询门店主营品牌失败: {}"
,
brandByMerchantIdsResp
.
getMessage
());
return
MapUtil
.<
Integer
,
List
<
MerchantBrandDTO
>>
builder
().
build
();
}
return
Optional
.
ofNullable
(
brandByMerchantIdsResp
.
getResult
())
.
orElseGet
(
ArrayList:
:
new
)
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
MerchantBrandDTO:
:
getMerchantId
));
}
catch
(
Exception
e
)
{
log
.
error
(
"查询门店主营品牌异常"
,
e
);
return
MapUtil
.<
Integer
,
List
<
MerchantBrandDTO
>>
builder
().
build
();
}
},
taskExecutor
);
// 查询车品牌树
CompletableFuture
<
Map
<
Integer
,
CarBrandResponse
>>
carBrandFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
try
{
return
Optional
.
ofNullable
(
getCarBrandTree
())
.
orElseGet
(
Lists:
:
newArrayList
)
.
stream
()
.
collect
(
Collectors
.
toMap
(
CarBrandResponse:
:
getId
,
Function
.
identity
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"查询车品牌树异常"
,
e
);
return
MapUtil
.<
Integer
,
CarBrandResponse
>
builder
().
build
();
}
},
taskExecutor
);
CompletableFuture
<
Void
>
allFutures
=
CompletableFuture
.
allOf
(
merchantConfigFuture
,
merchantBrandFuture
,
carBrandFuture
);
return
allFutures
.
thenApply
(
v
->
{
Map
<
Integer
,
List
<
YqMerchantConfigDTO
>>
merchantIdGroup
=
merchantConfigFuture
.
join
();
Map
<
Integer
,
List
<
MerchantBrandDTO
>>
merchantIdGroupBrand
=
merchantBrandFuture
.
join
();
Map
<
Integer
,
CarBrandResponse
>
firstBrandMap
=
carBrandFuture
.
join
();
return
merchantNos
.
stream
().
map
(
merchantNo
->
{
MerchantServiceAndBrandDTO
merchantServiceAndBrandDTO
=
new
MerchantServiceAndBrandDTO
().
setMerchantNo
(
merchantNo
);
// 处理服务商
List
<
YqMerchantConfigDTO
>
yqMerchantConfigDTOList
=
merchantIdGroup
.
get
(
merchantNo
);
if
(
CollUtil
.
isNotEmpty
(
yqMerchantConfigDTOList
))
{
YqMerchantConfigDTO
yqMerchantConfigDTO
=
yqMerchantConfigDTOList
.
get
(
0
);
merchantServiceAndBrandDTO
.
setMainServiceName
(
yqMerchantConfigDTO
.
getPartnerMerchantName
());
merchantServiceAndBrandDTO
.
setMainServiceMerchantNo
(
yqMerchantConfigDTO
.
getPartnerMerchantId
());
merchantServiceAndBrandDTO
.
setDirectSaleFlag
(
Objects
.
equals
(
mainMerchantId
,
yqMerchantConfigDTO
.
getPartnerMerchantId
())
?
1
:
0
);
}
// 处理品牌
Optional
.
ofNullable
(
merchantIdGroupBrand
.
get
(
merchantNo
))
.
orElseGet
(
ArrayList:
:
new
)
.
forEach
(
merchantBrandDTO
->
{
CarBrandResponse
carBrandResponse
=
firstBrandMap
.
get
(
merchantBrandDTO
.
getFirstBrandId
());
merchantServiceAndBrandDTO
.
getBrands
().
add
(
carBrandResponse
);
});
return
merchantServiceAndBrandDTO
;
}).
collect
(
Collectors
.
toList
());
}).
join
();
}
/**
* 查询车品牌树
* @author yangwei
* @since 2026/1/19 18:25
* @return java.util.List<cn.com.glsx.scrm.proxy.model.CarBrandResponse>
*/
public
List
<
CarBrandResponse
>
getCarBrandTree
()
{
final
String
requestMethod
=
"merchants.api.merchantCommon.getCarbrandTree"
;
CommonProxyRequest
proxyRequest
=
new
CommonProxyRequest
();
LinkedMultiValueMap
<
String
,
String
>
params
=
new
LinkedMultiValueMap
<>();
proxyRequest
.
setRequestMethod
(
requestMethod
);
proxyRequest
.
setRequestSource
(
ProxyRequestSourceEnum
.
MERCHANT
.
getSource
());
proxyRequest
.
setParams
(
params
);
RpcResponse
<
ProxyBaseResponse
>
response
=
commonProxyRemote
.
proxyRequest
(
proxyRequest
);
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"查询车品牌返回:{}"
,
response
);
}
if
(
response
.
isFailed
())
{
log
.
error
(
"查询车品牌失败, message:{}"
,
response
.
getMessage
());
return
Lists
.
newArrayList
();
}
return
response
.
getResult
().
getList
(
CarBrandResponse
.
class
);
}
}
rpc-dj-riskmanage/src/main/resources/META-INF/orm/ActivityMapper.xml
View file @
25094df
...
@@ -99,4 +99,21 @@
...
@@ -99,4 +99,21 @@
AND scene_type = #{sceneType}
AND scene_type = #{sceneType}
</select>
</select>
<select
id=
"getServiceByMerchantId"
resultType=
"cn.com.glsx.dj.riskmanage.dto.YqMerchantConfigDTO"
>
select
t1.partner_merchant_id as partnerMerchantId,
t1.partner_merchant_name as partnerMerchantName
from dj_car_life_yqmerchant_config t1
inner join dj_car_life_scene_merchant_ref t2 on t1.merchant_id = t2.sub_merchant_id
where t1.deleted_flag = 'N' and t2.deleted_flag = 'N'
<if
test=
"merchantNos != null and merchantNos.size() > 0"
>
and t2.main_merchant_id in
<foreach
item=
"merchantNo"
collection=
"merchantNos"
separator=
","
open=
"("
close=
")"
>
#{merchantNo}
</foreach>
</if>
and scene = #{scene}
and t2.sub_merchant_type in ('6', '8')
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment