Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rop-dj-pe-analysis
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 3070a7c6
authored
Apr 01, 2026
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]新增品牌查询,新增白名单
1 parent
c525a7df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
5 deletions
src/main/java/cn/com/glsx/dj/controller/ReportSubscribeController.java
src/main/java/cn/com/glsx/dj/controller/ReportSubscribeController.java
View file @
3070a7c
...
@@ -9,6 +9,7 @@ import cn.com.glsx.dj.mindworkplate.remote.MonitoringRemote;
...
@@ -9,6 +9,7 @@ import cn.com.glsx.dj.mindworkplate.remote.MonitoringRemote;
import
cn.com.glsx.dj.peanalysis.model.DjReportSubscribeConfig
;
import
cn.com.glsx.dj.peanalysis.model.DjReportSubscribeConfig
;
import
cn.com.glsx.dj.request.biAnalyse.MerchantRequestRop
;
import
cn.com.glsx.dj.request.biAnalyse.MerchantRequestRop
;
import
cn.com.glsx.dj.request.biAnalyse.MonitorBaseRequestRop
;
import
cn.com.glsx.dj.request.biAnalyse.MonitorBaseRequestRop
;
import
cn.com.glsx.dj.request.biAnalyse.PhoneRequestRop
;
import
cn.com.glsx.dj.util.CommonUtil
;
import
cn.com.glsx.dj.util.CommonUtil
;
import
cn.com.glsx.merchants.dto.merchant.CarBrandProvinceRequestDTO
;
import
cn.com.glsx.merchants.dto.merchant.CarBrandProvinceRequestDTO
;
import
cn.com.glsx.merchants.model.response.MerchantProvinceDTO
;
import
cn.com.glsx.merchants.model.response.MerchantProvinceDTO
;
...
@@ -24,10 +25,12 @@ import java.util.ArrayList;
...
@@ -24,10 +25,12 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.env.Environment
;
import
cn.com.glsx.dj.request.report.GetSubscribeConfigRequest
;
import
cn.com.glsx.dj.request.report.GetSubscribeConfigRequest
;
import
cn.com.glsx.dj.request.report.UpdateMonthlyReportSubscribeRequest
;
import
cn.com.glsx.dj.request.report.UpdateMonthlyReportSubscribeRequest
;
...
@@ -40,12 +43,14 @@ import cn.com.glsx.framework.rop.response.RopResponse;
...
@@ -40,12 +43,14 @@ import cn.com.glsx.framework.rop.response.RopResponse;
import
com.rop.annotation.NeedInSessionType
;
import
com.rop.annotation.NeedInSessionType
;
import
com.rop.annotation.ServiceMethod
;
import
com.rop.annotation.ServiceMethod
;
import
com.rop.annotation.ServiceMethodBean
;
import
com.rop.annotation.ServiceMethodBean
;
import
org.springframework.core.env.Environment
;
/**
/**
* 数据报告订阅控制器
* 数据报告订阅控制器
*/
*/
@ServiceMethodBean
(
version
=
"1.0.0"
,
needInSession
=
NeedInSessionType
.
NO
)
@ServiceMethodBean
(
version
=
"1.0.0"
,
needInSession
=
NeedInSessionType
.
NO
)
@Api
(
"数据报告订阅接口"
)
@Api
(
"数据报告订阅接口"
)
@Slf4j
public
class
ReportSubscribeController
{
public
class
ReportSubscribeController
{
/**
/**
...
@@ -66,6 +71,9 @@ public class ReportSubscribeController {
...
@@ -66,6 +71,9 @@ public class ReportSubscribeController {
private
MerchantRemote
merchantRemote
;
private
MerchantRemote
merchantRemote
;
@Autowired
@Autowired
private
Environment
environment
;
@Autowired
private
GopCarInfoRemote
gopCarInfoRemote
;
private
GopCarInfoRemote
gopCarInfoRemote
;
/**
/**
...
@@ -245,6 +253,7 @@ public class ReportSubscribeController {
...
@@ -245,6 +253,7 @@ public class ReportSubscribeController {
public
RopResponse
<
List
<
CarInfoResponse
>>
getAllBrandIds
(
public
RopResponse
<
List
<
CarInfoResponse
>>
getAllBrandIds
(
MerchantRequestRop
request
)
{
MerchantRequestRop
request
)
{
try
{
try
{
List
<
CarInfoResponse
>
filteredBrands
=
new
ArrayList
<>();
// 从缓存获取品牌列表
// 从缓存获取品牌列表
List
<
CarInfoResponse
>
brandList
=
BRAND_CACHE
.
get
(
"brandList"
);
List
<
CarInfoResponse
>
brandList
=
BRAND_CACHE
.
get
(
"brandList"
);
if
(
CollectionUtils
.
isEmpty
(
brandList
))
{
if
(
CollectionUtils
.
isEmpty
(
brandList
))
{
...
@@ -259,13 +268,13 @@ public class ReportSubscribeController {
...
@@ -259,13 +268,13 @@ public class ReportSubscribeController {
// 根据品牌名称进行模糊匹配
// 根据品牌名称进行模糊匹配
String
brandName
=
request
.
getBrandName
();
String
brandName
=
request
.
getBrandName
();
if
(
brandName
!=
null
&&
!
brandName
.
isEmpty
()
&&
CollectionUtils
.
isNotEmpty
(
brandList
))
{
if
(
brandName
!=
null
&&
!
brandName
.
isEmpty
()
&&
CollectionUtils
.
isNotEmpty
(
brandList
))
{
List
<
CarInfoResponse
>
filteredBrands
=
new
ArrayList
<>();
for
(
CarInfoResponse
brand
:
brandList
)
{
for
(
CarInfoResponse
brand
:
brandList
)
{
// 检查子品牌是否匹配
// 检查子品牌是否匹配
try
{
try
{
// 尝试获取子品牌列表
// 尝试获取子品牌列表
List
<
CarInfoResponse
>
childs
=
brand
.
getChilds
();
List
<
CarInfoResponse
>
childs
=
brand
.
getChilds
();
log
.
info
(
"子品牌列表: {}"
,
childs
);
if
(
CollectionUtils
.
isNotEmpty
(
childs
))
{
if
(
CollectionUtils
.
isNotEmpty
(
childs
))
{
for
(
CarInfoResponse
child
:
childs
)
{
for
(
CarInfoResponse
child
:
childs
)
{
...
@@ -279,14 +288,39 @@ public class ReportSubscribeController {
...
@@ -279,14 +288,39 @@ public class ReportSubscribeController {
logger
.
debug
(
"CarInfoResponse没有childs字段"
,
e
);
logger
.
debug
(
"CarInfoResponse没有childs字段"
,
e
);
}
}
}
}
brandList
=
filteredBrands
;
}
}
return
RopResponse
.
success
(
brandList
);
return
RopResponse
.
success
(
filteredBrands
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"根据品牌名称查询品牌失败: {}"
,
e
);
logger
.
error
(
"根据品牌名称查询品牌失败: {}"
,
e
);
return
RopResponse
.
error
(
"根据品牌名称查询品牌失败"
);
return
RopResponse
.
error
(
"根据品牌名称查询品牌失败"
);
}
}
}
}
@ServiceMethod
(
method
=
"org.ore.api.report.subscribe.checkPhoneInWhitelist"
,
needInSession
=
NeedInSessionType
.
NO
)
@ApiOperation
(
"检查手机号是否在白名单内"
)
public
RopResponse
<
Boolean
>
checkPhoneInWhitelist
(
PhoneRequestRop
request
)
{
try
{
// 从钻石配置中获取白名单,格式为逗号分隔的手机号列表
String
whitelistStr
=
environment
.
getProperty
(
"report.subscribe.phone.whitelist"
);
// 检查手机号是否在白名单内
boolean
inWhitelist
=
false
;
if
(
whitelistStr
!=
null
&&
!
whitelistStr
.
isEmpty
()
&&
request
.
getPhone
()
!=
null
)
{
String
[]
whitelistPhones
=
whitelistStr
.
split
(
","
);
for
(
String
phone
:
whitelistPhones
)
{
if
(
request
.
getPhone
().
equals
(
phone
.
trim
()))
{
inWhitelist
=
true
;
break
;
}
}
}
return
RopResponse
.
success
(
inWhitelist
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"检查手机号白名单失败: {}"
,
e
);
return
RopResponse
.
error
(
"检查手机号白名单失败"
);
}
}
}
}
\ 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