Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
38b3cc2e
Commit
38b3cc2e
authored
Mar 21, 2025
by
王祖波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
潜客周报/月报数据
parent
6caf0a3a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
35 deletions
+31
-35
WeekMonthDataAdaptor.java
...service/service/content/adaptor/WeekMonthDataAdaptor.java
+31
-35
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/content/adaptor/WeekMonthDataAdaptor.java
View file @
38b3cc2e
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
content
.
adaptor
;
import
cn.hutool.core.date.DateTime
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.ServiceResponse
;
...
...
@@ -64,14 +65,9 @@ public class WeekMonthDataAdaptor {
/**
* 潜客雷达 周报
* 潜客雷达 周报
/月报
*/
private
static
final
String
POTENTIAL_WEEK_DATA
=
"data_cms_clerk_week_report_list"
;
/**
* 潜客雷达 月报
*/
private
static
final
String
POTENTIAL_MONTH_DATA
=
"data_cms_store_month_report_total"
;
private
static
final
String
POTENTIAL_WEEK_MONTH_DATA
=
"data_mkt_pos_cut_haoban_overview"
;
@Autowired
private
ContentMaterialApiService
contentMaterialApiService
;
...
...
@@ -167,17 +163,9 @@ public class WeekMonthDataAdaptor {
if
(
jsonObject
.
isEmpty
())
{
return
null
;
}
int
useMatlNum
=
jsonObject
.
getIntValue
(
"useMatlNum"
);
BigDecimal
useMatlNum
=
jsonObject
.
getBigDecimal
(
"useMatlNum"
);
BigDecimal
convSalesAmt
=
Optional
.
ofNullable
(
jsonObject
.
getBigDecimal
(
"omniConvSalesAmt"
)).
orElse
(
BigDecimal
.
ZERO
);
String
amountUnit
=
""
;
if
(
convSalesAmt
.
compareTo
(
new
BigDecimal
(
10000
))
>=
0
)
{
convSalesAmt
=
convSalesAmt
.
divide
(
BigDecimal
.
valueOf
(
10000
),
2
,
RoundingMode
.
HALF_UP
);
amountUnit
=
"万"
;
}
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#,###,###.##"
);
String
formatAmount
=
decimalFormat
.
format
(
convSalesAmt
);
String
numFormat
=
decimalFormat
.
format
(
useMatlNum
);
return
new
MaterialDataResult
(
numFormat
,
(
formatAmount
+
amountUnit
));
return
formatDecimal
(
useMatlNum
,
convSalesAmt
);
}
...
...
@@ -219,15 +207,7 @@ public class WeekMonthDataAdaptor {
BigDecimal
dayAvgUseMatlNum
=
jsonObject
.
getBigDecimal
(
"dayAvgUseMatlNum"
);
BigDecimal
convSalesAmt
=
Optional
.
ofNullable
(
jsonObject
.
getBigDecimal
(
"convSalesAmt"
)).
orElse
(
BigDecimal
.
ZERO
);
convSalesAmt
=
convSalesAmt
.
add
(
Optional
.
ofNullable
(
jsonObject
.
getBigDecimal
(
"offlineConvSalesAmt"
)).
orElse
(
BigDecimal
.
ZERO
));
String
amountUnit
=
""
;
if
(
convSalesAmt
.
compareTo
(
new
BigDecimal
(
10000
))
>=
0
)
{
convSalesAmt
=
convSalesAmt
.
divide
(
BigDecimal
.
valueOf
(
10000
),
2
,
RoundingMode
.
HALF_UP
);
amountUnit
=
"万"
;
}
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#,###,###.##"
);
String
formatAmount
=
decimalFormat
.
format
(
convSalesAmt
);
String
numFormat
=
decimalFormat
.
format
(
dayAvgUseMatlNum
);
return
new
MaterialDataResult
(
numFormat
,
(
formatAmount
+
amountUnit
));
return
formatDecimal
(
dayAvgUseMatlNum
,
convSalesAmt
);
}
...
...
@@ -241,9 +221,16 @@ public class WeekMonthDataAdaptor {
*/
public
MaterialDataResult
queryReportDataPotential
(
String
enterpriseId
,
String
clerkId
,
List
<
String
>
storeIds
,
Integer
reportType
,
String
bizDate
)
{
String
apolloKey
=
POTENTIAL_WEEK_DATA
;
String
apolloKey
=
POTENTIAL_WEEK_MONTH_DATA
;
String
endDate
=
bizDate
;
String
beginDate
=
bizDate
;
if
(
MaterialReportType
.
MONTH
.
getCode
().
equals
(
reportType
))
{
apolloKey
=
POTENTIAL_MONTH_DATA
;
DateTime
date
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
parse
(
"yyyy-MM"
);
beginDate
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
beginOfMonth
(
date
),
"yyyy-MM-dd"
);
endDate
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
endOfMonth
(
date
),
"yyyy-MM-dd"
);
}
else
{
DateTime
date
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
parse
(
"yyyy-MM-dd"
);
endDate
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
endOfWeek
(
date
),
"yyyy-MM-dd"
);
}
Map
<
String
,
Object
>
inlineParams
=
new
HashMap
<>();
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
clerkId
))
{
...
...
@@ -253,19 +240,28 @@ public class WeekMonthDataAdaptor {
inlineParams
.
put
(
"storeId"
,
StringUtils
.
join
(
storeIds
,
","
));
}
inlineParams
.
put
(
"enterpriseId"
,
enterpriseId
);
inlineParams
.
put
(
"bizDate"
,
bizDate
);
inlineParams
.
put
(
"startDate"
,
beginDate
);
inlineParams
.
put
(
"endDate"
,
endDate
);
// 1 门店维度 2 导购维度 3 合计
inlineParams
.
put
(
"potGroup"
,
3
);
inlineParams
.
put
(
"reportType"
,
reportType
);
inlineParams
.
put
(
"orderByFields"
,
2
);
inlineParams
.
put
(
"orderByType"
,
1
);
Map
<
String
,
Object
>
result
=
DataApiUtils
.
http
(
JSON
.
toJSONString
(
inlineParams
),
apolloKey
);
if
(
result
.
get
(
"data"
)
==
null
)
{
return
null
;
}
JSONObject
jsonObject
=
DataApiUtils
.
getPageOne
(
result
);
if
(
jsonObject
.
isEmpty
(
))
{
List
<
JSONObject
>
dataList
=
DataApiUtils
.
getDataList
(
result
);
if
(
CollectionUtils
.
isEmpty
(
dataList
))
{
return
null
;
}
int
useMatlNum
=
jsonObject
.
getIntValue
(
"useMatlNum"
);
BigDecimal
convSalesAmt
=
Optional
.
ofNullable
(
jsonObject
.
getBigDecimal
(
"omniConvSalesAmt"
)).
orElse
(
BigDecimal
.
ZERO
);
JSONObject
jsonObject
=
dataList
.
get
(
0
);
BigDecimal
potCusConnRate
=
Optional
.
ofNullable
(
jsonObject
.
getBigDecimal
(
"potCusConnRate"
)).
orElse
(
BigDecimal
.
ZERO
);
BigDecimal
convSalesAmt
=
Optional
.
ofNullable
(
jsonObject
.
getBigDecimal
(
"connConvsAmt"
)).
orElse
(
BigDecimal
.
ZERO
);
return
formatDecimal
(
potCusConnRate
,
convSalesAmt
);
}
private
MaterialDataResult
formatDecimal
(
BigDecimal
potCusConnRate
,
BigDecimal
convSalesAmt
)
{
String
amountUnit
=
""
;
if
(
convSalesAmt
.
compareTo
(
new
BigDecimal
(
10000
))
>=
0
)
{
convSalesAmt
=
convSalesAmt
.
divide
(
BigDecimal
.
valueOf
(
10000
),
2
,
RoundingMode
.
HALF_UP
);
...
...
@@ -273,8 +269,8 @@ public class WeekMonthDataAdaptor {
}
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#,###,###.##"
);
String
formatAmount
=
decimalFormat
.
format
(
convSalesAmt
);
String
numFormat
=
decimalFormat
.
format
(
useMatlNum
);
return
new
MaterialDataResult
(
numFormat
,
(
formatAmount
+
amountUnit
));
String
potCusConnRateStr
=
decimalFormat
.
format
(
potCusConnRate
);
return
new
MaterialDataResult
(
potCusConnRateStr
,
(
formatAmount
+
amountUnit
));
}
private
Map
<
String
,
Object
>
doHttp
(
String
jsonParam
,
String
apolloKey
)
{
...
...
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