Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ufo
/
ufo-platform
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
wujiexiang
5 years ago
Commit
47c6a774f2a1fc5466c3025fc9b54ca4cab936d7
1 parent
e272ae8a
add log
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
coupon/src/main/java/com/yoho/ufo/coupon/service/impl/CouponServiceImpl.java
dal/src/main/java/com/yoho/ufo/dal/CouponProductLimitMapper.java
coupon/src/main/java/com/yoho/ufo/coupon/service/impl/CouponServiceImpl.java
View file @
47c6a77
...
...
@@ -305,20 +305,19 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
private
void
saveProductLimitItems
(
Integer
couponId
,
List
<
ProductCondition
>
productConditions
)
{
// 清理之前的记录
couponProductLimitMapper
.
deleteByCouponId
(
couponId
);
int
itemCount
=
0
;
int
deletedCount
=
couponProductLimitMapper
.
deleteByCouponId
(
couponId
);
int
updateCount
=
0
;
// 重新插入
if
(
CollectionUtils
.
isNotEmpty
(
productConditions
))
{
// productIds 可能超过500个 每500个插入一次
//Iterable<List<Integer>> productIdBatch = Iterables.partition(productIds, 1000);
for
(
ProductCondition
pc
:
productConditions
)
{
if
(
CollectionUtils
.
isNotEmpty
(
pc
.
getProductIds
()))
{
couponProductLimitMapper
.
insertBatchByProductIds
(
pc
.
getProductIds
(),
pc
.
getProductConditionType
(),
couponId
);
itemCount
+=
pc
.
getProductIds
().
size
();
updateCount
+=
couponProductLimitMapper
.
insertBatchByProductIds
(
pc
.
getProductIds
(),
pc
.
getProductConditionType
(),
couponId
);
}
}
}
LOGGER
.
info
(
"{} saveProductLimitItems
count is {}"
,
couponId
,
item
Count
);
LOGGER
.
info
(
"{} saveProductLimitItems
, deletedCount:{}, updateCount:{}"
,
couponId
,
deletedCount
,
update
Count
);
}
private
List
<
Integer
>
getProductIdsAndCheckProductLimitParam
(
int
productLimitType
,
String
productLimitValue
)
{
...
...
@@ -383,6 +382,8 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
//排除商品
jsonObject
.
put
(
"excludeProductIds"
,
Strings
.
listToDelimitedString
(
findProductIds
(
ProductLimitType
.
Exclude_Product
.
getLimitType
(),
productLimitList
)));
//jsonObject.put("productLimits",productLimitList);
LOGGER
.
info
(
"{} coupon info:{}"
,
id
,
jsonObject
);
return
new
ApiResponse
.
ApiResponseBuilder
().
data
(
jsonObject
).
build
();
}
...
...
dal/src/main/java/com/yoho/ufo/dal/CouponProductLimitMapper.java
View file @
47c6a77
...
...
@@ -9,9 +9,9 @@ import java.util.List;
* Created by shengguo.cai on 2018/11/20.
*/
public
interface
CouponProductLimitMapper
{
void
deleteByCouponId
(
@Param
(
"id"
)
Integer
id
);
int
deleteByCouponId
(
@Param
(
"id"
)
Integer
id
);
void
insertBatchByProductIds
(
@Param
(
"productIds"
)
List
<
Integer
>
productIds
,
@Param
(
"limitType"
)
int
limitType
,
@Param
(
"couponId"
)
int
couponId
);
int
insertBatchByProductIds
(
@Param
(
"productIds"
)
List
<
Integer
>
productIds
,
@Param
(
"limitType"
)
int
limitType
,
@Param
(
"couponId"
)
int
couponId
);
List
<
CouponProductLimit
>
selectByCouponId
(
@Param
(
"id"
)
Integer
id
);
...
...
Please
register
or
login
to post a comment