Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
33e0970b
Commit
33e0970b
authored
Feb 20, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
判断团购是否在线
parent
f6e9d86e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
29 deletions
+31
-29
SCouponServiceImpl.java
...in/java/share/system/service/impl/SCouponServiceImpl.java
+31
-29
No files found.
share-system/src/main/java/share/system/service/impl/SCouponServiceImpl.java
View file @
33e0970b
...
...
@@ -287,35 +287,37 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
JSONArray
products
=
entries
.
getJSONArray
(
"products"
);
products
.
stream
().
forEach
(
item
->
{
JSONObject
jsonObject
=
(
JSONObject
)
item
;
JSONObject
sku
=
jsonObject
.
getJSONObject
(
"sku"
);
JSONObject
product
=
jsonObject
.
getJSONObject
(
"product"
);
JSONArray
pois
=
product
.
getJSONArray
(
"pois"
);
SCoupon
sCoupon1
=
sCouponList
.
get
(
sku
.
getStr
(
"sku_id"
));
if
(
ObjectUtils
.
isEmpty
(
sCoupon1
))
{
SCoupon
sCoupon
=
new
SCoupon
();
sCoupon
.
setSkuId
(
sku
.
getStr
(
"sku_id"
));
sCoupon
.
setName
(
sku
.
getStr
(
"sku_name"
));
sCoupon
.
setStartDate
(
new
Date
(
product
.
getInt
(
"sold_start_time"
)
*
1000L
));
sCoupon
.
setEndDate
(
new
Date
(
product
.
getInt
(
"sold_end_time"
)
*
1000L
));
sCoupon
.
setSubPrice
(
jsonObject
.
getBigDecimal
(
"origin_amount"
).
divide
(
new
BigDecimal
(
"100"
)));
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
sCoupon
.
setValidEndTime
(
DEFAULT_END_TIME
);
sCoupon
.
setMinDuration
(
DEFAULT_DURATION
);
sCoupon
.
setMaxDuration
(
DEFAULT_MAX_DURATION
);
sCoupon
.
setMinPrice
(
new
BigDecimal
(
"0.00"
));
sCoupon
.
setCouponType
(
CouponTypeEnum
.
CASH
.
getCode
());
pois
.
stream
().
forEach
(
poi
->
{
JSONObject
jsonObject1
=
(
JSONObject
)
poi
;
sCoupon
.
setStoreIds
(
sCoupon
.
getStoreIds
()
+
","
+
sStores
.
stream
().
filter
(
store
->
store
.
getPoiId
().
equals
(
jsonObject1
.
getStr
(
"poi_id"
))).
findFirst
().
get
().
getId
());
});
sCouponList
.
put
(
sku
.
getStr
(
"sku_id"
),
sCoupon
);
}
else
{
pois
.
stream
().
forEach
(
poi
->
{
JSONObject
jsonObject1
=
(
JSONObject
)
poi
;
sCoupon1
.
setStoreIds
(
sCoupon1
.
getStoreIds
()
+
","
+
sStores
.
stream
().
filter
(
store
->
store
.
getPoiId
().
equals
(
jsonObject1
.
getStr
(
"poi_id"
))).
findFirst
().
get
().
getId
());
});
if
(
jsonObject
.
getInt
(
"online_status"
).
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
JSONObject
sku
=
jsonObject
.
getJSONObject
(
"sku"
);
JSONObject
product
=
jsonObject
.
getJSONObject
(
"product"
);
JSONArray
pois
=
product
.
getJSONArray
(
"pois"
);
SCoupon
sCoupon1
=
sCouponList
.
get
(
sku
.
getStr
(
"sku_id"
));
if
(
ObjectUtils
.
isEmpty
(
sCoupon1
))
{
SCoupon
sCoupon
=
new
SCoupon
();
sCoupon
.
setSkuId
(
sku
.
getStr
(
"sku_id"
));
sCoupon
.
setName
(
sku
.
getStr
(
"sku_name"
));
sCoupon
.
setStartDate
(
new
Date
(
product
.
getInt
(
"sold_start_time"
)
*
1000L
));
sCoupon
.
setEndDate
(
new
Date
(
product
.
getInt
(
"sold_end_time"
)
*
1000L
));
sCoupon
.
setSubPrice
(
jsonObject
.
getBigDecimal
(
"origin_amount"
).
divide
(
new
BigDecimal
(
"100"
)));
sCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sCoupon
.
setValidStartTime
(
DEFAULT_START_TIME
);
sCoupon
.
setValidEndTime
(
DEFAULT_END_TIME
);
sCoupon
.
setMinDuration
(
DEFAULT_DURATION
);
sCoupon
.
setMaxDuration
(
DEFAULT_MAX_DURATION
);
sCoupon
.
setMinPrice
(
new
BigDecimal
(
"0.00"
));
sCoupon
.
setCouponType
(
CouponTypeEnum
.
CASH
.
getCode
());
pois
.
stream
().
forEach
(
poi
->
{
JSONObject
jsonObject1
=
(
JSONObject
)
poi
;
sCoupon
.
setStoreIds
(
sCoupon
.
getStoreIds
()
+
","
+
sStores
.
stream
().
filter
(
store
->
store
.
getPoiId
().
equals
(
jsonObject1
.
getStr
(
"poi_id"
))).
findFirst
().
get
().
getId
());
});
sCouponList
.
put
(
sku
.
getStr
(
"sku_id"
),
sCoupon
);
}
else
{
pois
.
stream
().
forEach
(
poi
->
{
JSONObject
jsonObject1
=
(
JSONObject
)
poi
;
sCoupon1
.
setStoreIds
(
sCoupon1
.
getStoreIds
()
+
","
+
sStores
.
stream
().
filter
(
store
->
store
.
getPoiId
().
equals
(
jsonObject1
.
getStr
(
"poi_id"
))).
findFirst
().
get
().
getId
());
});
}
}
});
return
new
ArrayList
<>(
sCouponList
.
values
());
...
...
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