Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shouzhouServer
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
chenjinjing
shouzhouServer
Commits
a2b78e4f
Commit
a2b78e4f
authored
Jul 25, 2024
by
Leo Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改右侧接口的返回格式
parent
acd7876c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
18 deletions
+26
-18
paymentMethodAnalysisStrategy.ts
...biz/map2/strategies/left/paymentMethodAnalysisStrategy.ts
+4
-3
businessStatusStrategy.ts
src/biz/map2/strategies/right/businessStatusStrategy.ts
+3
-3
merchantBusinessStatisticsStrategy.ts
...p2/strategies/right/merchantBusinessStatisticsStrategy.ts
+9
-4
storeTypeDistributionStrategy.ts
...iz/map2/strategies/right/storeTypeDistributionStrategy.ts
+5
-6
visitorAgeProfileStrategy.ts
src/biz/map2/strategies/right/visitorAgeProfileStrategy.ts
+0
-1
visitorGenderProfileStrategy.ts
...biz/map2/strategies/right/visitorGenderProfileStrategy.ts
+2
-0
visitorHomeProfileStrategy.ts
src/biz/map2/strategies/right/visitorHomeProfileStrategy.ts
+3
-1
No files found.
src/biz/map2/strategies/left/paymentMethodAnalysisStrategy.ts
View file @
a2b78e4f
...
...
@@ -15,10 +15,10 @@ export default class paymentMethodAnalysisStrategy extends abstractDataStrategyL
}
processData
(
data
:
any
,
timeFrame
:
string
,
type
:
string
,
ticketCategory
:
string
):
any
{
return
this
.
processPaymentMethodData
(
data
,
timeFrame
);
return
this
.
processPaymentMethodData
(
data
,
timeFrame
,
type
);
}
private
processPaymentMethodData
(
data
:
any
,
timeFrame
:
string
):
any
{
private
processPaymentMethodData
(
data
:
any
,
timeFrame
:
string
,
type
:
string
):
any
{
const
currentDate
=
new
Date
();
let
startDate
=
new
Date
();
if
(
timeFrame
===
'12month'
)
{
...
...
@@ -70,7 +70,8 @@ export default class paymentMethodAnalysisStrategy extends abstractDataStrategyL
return
{
paymentMethod
:
key
,
amount
:
parseFloat
(
amount
.
toFixed
(
2
)),
percentage
:
`
${
percentage
}
%`
percentage
:
`
${
percentage
}
%`
,
unit
:
type
===
'amount'
?
'元'
:
'张'
};
});
...
...
src/biz/map2/strategies/right/businessStatusStrategy.ts
View file @
a2b78e4f
...
...
@@ -11,9 +11,9 @@ export default class businessStatusStrategy implements dataStrategy{
const
closedStores
=
totalStores
-
openStores
;
const
result
=
[
{
key
:
'门店数'
,
value
:
totalStores
},
{
key
:
'开店数'
,
value
:
openStores
},
{
key
:
'关店数'
,
value
:
closedStores
}
{
key
:
'门店数'
,
value
:
totalStores
,
unit
:
'家'
},
{
key
:
'开店数'
,
value
:
openStores
,
unit
:
'家'
},
{
key
:
'关店数'
,
value
:
closedStores
,
unit
:
'家'
}
];
result
.
sort
((
a
,
b
)
=>
b
.
value
-
a
.
value
);
...
...
src/biz/map2/strategies/right/merchantBusinessStatisticsStrategy.ts
View file @
a2b78e4f
...
...
@@ -8,20 +8,25 @@ export default class merchantBusinessStatisticsStrategy extends abstractMerchant
processData
():
any
{
const
totalBusinesses
=
Math
.
floor
(
Math
.
random
()
*
2000
)
+
1000
;
const
totalShops
=
Math
.
floor
(
Math
.
random
()
*
2500
)
+
1500
;
const
businessActivityRate
=
Math
.
floor
(
Math
.
random
()
*
50
)
+
50
;
// Random percentage between 50% and 100%
const
businessActivityRate
=
Math
.
floor
(
Math
.
random
()
*
50
)
+
50
;
const
result
=
[
{
key
:
'营业商家数'
,
value
:
totalBusinesses
value
:
totalBusinesses
,
unit
:
'家'
},
{
key
:
'营业店铺数'
,
value
:
totalShops
value
:
totalShops
,
unit
:
'家'
},
{
key
:
'商家动销率'
,
value
:
businessActivityRate
value
:
businessActivityRate
,
unit
:
'%'
}
];
...
...
src/biz/map2/strategies/right/storeTypeDistributionStrategy.ts
View file @
a2b78e4f
...
...
@@ -4,8 +4,6 @@ export default class storeTypeDistributionStrategy {
}
private
generateStoreTypeData
():
any
{
const
totalStores
=
1000
;
// Total number of stores to be randomly distributed
const
storeTypes
=
[
'文化创意'
,
'特色餐饮'
,
...
...
@@ -16,13 +14,14 @@ export default class storeTypeDistributionStrategy {
'体验式商铺'
];
const
randomValues
=
Array
.
from
({
length
:
storeTypes
.
length
-
1
},
()
=>
Math
.
floor
(
Math
.
random
()
*
totalStores
*
0.3
)
);
const
remainingValue
=
totalStores
-
randomValues
.
reduce
((
a
,
b
)
=>
a
+
b
,
0
);
randomValues
.
push
(
remainingValue
);
const
randomValues
=
Array
.
from
({
length
:
storeTypes
.
length
},
()
=>
Math
.
floor
(
Math
.
random
()
*
300
)
+
1
);
const
totalStores
=
randomValues
.
reduce
((
sum
,
value
)
=>
sum
+
value
,
0
);
const
result
=
randomValues
.
map
((
value
,
index
)
=>
({
key
:
storeTypes
[
index
],
value
:
value
value
:
value
,
percent
:
((
value
/
totalStores
)
*
100
).
toFixed
(
2
)
+
'%'
}));
result
.
sort
((
a
,
b
)
=>
b
.
value
-
a
.
value
);
...
...
src/biz/map2/strategies/right/visitorAgeProfileStrategy.ts
View file @
a2b78e4f
...
...
@@ -10,7 +10,6 @@ export default class visitorAgeProfileStrategy extends abstractCustomerProfileSt
processData
(
type
:
string
):
any
{
const
total
=
type
===
'ticket'
?
1000
:
3429
;
// Generate random values for each age group ensuring they sum up to total
const
children
=
Math
.
floor
(
Math
.
random
()
*
(
total
*
0.2
));
const
teenagers
=
Math
.
floor
(
Math
.
random
()
*
(
total
*
0.2
));
const
youngAdults
=
Math
.
floor
(
Math
.
random
()
*
(
total
*
0.5
));
...
...
src/biz/map2/strategies/right/visitorGenderProfileStrategy.ts
View file @
a2b78e4f
...
...
@@ -36,6 +36,8 @@ export default class visitorGenderProfileStrategy extends abstractCustomerProfil
unit
:
'人'
},
sexRatio
:
{
maleName
:
type
===
'ticket'
?
'男性游客'
:
'男性会员'
,
femaleName
:
type
===
'ticket'
?
'女性游客'
:
'女性会员'
,
male
:
maleCount
,
maleRatio
:
maleRatio
,
female
:
femaleCount
,
...
...
src/biz/map2/strategies/right/visitorHomeProfileStrategy.ts
View file @
a2b78e4f
...
...
@@ -23,8 +23,9 @@ export default class visitorHomeProfileStrategy extends abstractCustomerProfileS
const
totalVisitors
=
Object
.
values
(
cityCounts
).
reduce
((
a
,
b
)
=>
a
+
b
,
0
);
const
scaleFactor
=
total
/
totalVisitors
;
let
count
=
0
;
cons
t
result
=
Object
.
entries
(
cityCounts
).
map
(([
key
,
count
])
=>
{
le
t
result
=
Object
.
entries
(
cityCounts
).
map
(([
key
,
count
])
=>
{
const
scaledCount
=
Math
.
floor
(
count
*
scaleFactor
);
return
{
key
,
...
...
@@ -38,6 +39,7 @@ export default class visitorHomeProfileStrategy extends abstractCustomerProfileS
result
[
0
].
value
+=
difference
;
}
result
=
result
.
slice
(
0
,
10
);
return
result
;
}
}
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