Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
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
徐少华
midjourney-proxy
Commits
c2628714
Commit
c2628714
authored
Oct 30, 2020
by
郑勇
Committed by
郑勇
Oct 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
还原抛异常处理
parent
b617b8aa
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
18 deletions
+29
-18
BookBizException.java
...java/com/pcloud/book/base/exception/BookBizException.java
+12
-1
GiftCouponPackageBiz.java
.../com/pcloud/book/giftcoupon/biz/GiftCouponPackageBiz.java
+1
-1
GiftCouponPackageBizImpl.java
...ud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
+14
-7
GiftCouponPackageFacade.java
...cloud/book/giftcoupon/facade/GiftCouponPackageFacade.java
+1
-5
GiftCategory.xml
...ook/src/main/resources/mapper/giftConpon/GiftCategory.xml
+1
-2
GiftCouplePackageDao.xml
...main/resources/mapper/giftConpon/GiftCouplePackageDao.xml
+0
-2
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/base/exception/BookBizException.java
View file @
c2628714
...
...
@@ -35,7 +35,18 @@ public class BookBizException extends BizException{
* 参数为空
*/
public
static
final
int
PARAM_IS_NULL
=
20210002
;
/**
* 库存为空
*/
public
static
final
int
STOCK_IS_EMPTY
=
20210111
;
/**
* 已经领取过
*/
public
static
final
int
HAS_RECEIVED
=
20210112
;
/**
* 时间格式错误
*/
...
...
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/GiftCouponPackageBiz.java
View file @
c2628714
...
...
@@ -20,7 +20,7 @@ public interface GiftCouponPackageBiz {
void
deleteGiftPackage
(
Long
id
);
void
createGiftReceive
(
GiftReceive
giftReceive
)
throws
BookBizException
;
void
createGiftReceive
(
GiftReceive
giftReceive
);
PageBeanNew
<
GiftPackageDTO
>
list4GiftPackage
(
String
title
,
Integer
state
,
Integer
couponType
,
Integer
currentPage
,
Integer
numPerPage
,
Long
agentId
,
Boolean
onShelves
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
View file @
c2628714
package
com
.
pcloud
.
book
.
giftcoupon
.
biz
.
impl
;
import
com.google.common.collect.Lists
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletThirdResourcesBiz
;
...
...
@@ -30,7 +29,6 @@ import com.pcloud.book.giftcoupon.dto.BatchUpdateDTO;
import
com.pcloud.book.giftcoupon.dto.GiftCategoryDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.ServeInfoDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftCategory
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
...
...
@@ -49,7 +47,6 @@ import com.pcloud.common.page.PageParam;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -330,7 +327,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
value
=
"新增专享礼包"
,
isAfterReturn
=
false
)
@Override
public
void
createGiftReceive
(
GiftReceive
giftReceive
)
throws
BookBizException
{
public
void
createGiftReceive
(
GiftReceive
giftReceive
){
giftParamCheck
.
checkGiftReceiveAddParam
(
giftReceive
);
GiftCouponPackage
giftCouponPackage
=
giftCouponPackageDao
.
getById
(
giftReceive
.
getGiftPackageId
());
if
(
null
==
giftCouponPackage
){
...
...
@@ -339,11 +336,11 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
Integer
giftReceiveCount
=
giftReceiveDao
.
getGiftReceiveCount
(
giftReceive
.
getWechatUserId
(),
giftReceive
.
getGiftPackageId
());
//库存减一
if
(
giftCouponPackage
.
getStock
()<
1
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"库存不够
"
);
throw
new
BookBizException
(
BookBizException
.
STOCK_IS_EMPTY
,
"今日库存已用完
"
);
}
//超过单个奖券领取上限
if
(
giftReceiveCount
>=
giftCouponPackage
.
getReceiveLimit
()){
throw
new
BookBizException
(
BookBizException
.
SUCCESS
,
"该类型的兑换券您已经领取过,请前往“我的券库”使用吧"
);
throw
new
BookBizException
(
BookBizException
.
HAS_RECEIVED
,
"该类型的兑换券您已经领取过,请前往“我的券库”使用吧"
);
}
//超过券库总领取上限
Integer
giftAllReceiveCount
=
giftReceiveDao
.
getGiftAllReceiveCount
(
giftReceive
.
getWechatUserId
());
...
...
@@ -589,8 +586,9 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
List
<
Long
>
list
=
giftCategoryDao
.
getByParams
(
map
);
Random
index
=
new
Random
();
List
<
Long
>
resultIds
=
new
ArrayList
<>();
List
<
Integer
>
indexList
=
new
ArrayList
<>();
if
(
list
.
size
()>=
COUPON_MAX_SHOW_SIZE
){
List
<
Integer
>
indexList
=
new
ArrayList
<>();
for
(
int
i
=
0
,
j
;
i
<
COUPON_MAX_SHOW_SIZE
;
i
++){
//获取在 list.size 返回内的随机数
j
=
index
.
nextInt
(
list
.
size
());
...
...
@@ -604,10 +602,19 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
}
}
}
else
{
List
<
Integer
>
indexList
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
list
)){
resultIds
.
addAll
(
list
);
}
List
<
Long
>
list1
=
giftCategoryDao
.
getOtherByParams
(
map
);
if
(
ListUtils
.
isEmpty
(
list1
)){
return
resultIds
;
}
if
(
list1
.
size
()+
resultIds
.
size
()<=
COUPON_MAX_SHOW_SIZE
){
resultIds
.
addAll
(
list1
);
return
resultIds
;
}
for
(
int
i
=
0
,
j
;
i
<
COUPON_MAX_SHOW_SIZE
-
list
.
size
();
i
++){
//获取在 list.size 返回内的随机数
j
=
index
.
nextInt
(
list1
.
size
());
...
...
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/facade/GiftCouponPackageFacade.java
View file @
c2628714
...
...
@@ -129,11 +129,7 @@ public class GiftCouponPackageFacade {
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
GiftReceive
.
setWechatUserId
(
wechatUserId
);
try
{
giftCouponPackageBiz
.
createGiftReceive
(
GiftReceive
);
}
catch
(
BookBizException
e
){
return
new
ResponseDto
<>(
e
.
getCode
(),
e
.
getMsg
(),
new
ExceptionDTO
(
e
.
getMsg
()));
}
giftCouponPackageBiz
.
createGiftReceive
(
GiftReceive
);
return
new
ResponseDto
<>();
}
...
...
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftCategory.xml
View file @
c2628714
...
...
@@ -141,7 +141,6 @@
)t on a.id=t.gift_package_id
where a.is_delete=0
and a.stock>0
and a.on_shelves=1
and a.rec_to_page=1
and now()
<![CDATA[ < ]]>
a.valid_date_end
...
...
@@ -153,8 +152,8 @@
from
gift_coupon_package a
where a.is_delete=0
and a.stock>0
and a.on_shelves=1
and a.rec_to_page=1
and now()
<![CDATA[ < ]]>
a.valid_date_end
and a.id not in
(
...
...
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftCouplePackageDao.xml
View file @
c2628714
...
...
@@ -234,7 +234,6 @@
from
gift_coupon_package a
where a.is_delete=0
and a.stock>0
<if
test=
"title !=null and title !=''"
>
and (a.title like concat('%',#{title},'%') or a.resource_number like concat('%',#{title},'%'))
</if>
...
...
@@ -378,7 +377,6 @@
from
gift_coupon_package a
where a.is_delete=0
and a.stock>0
<if
test=
"title !=null and title !=''"
>
and (a.title like concat('%',#{title},'%') or a.url_number like concat('%',#{title},'%'))
</if>
...
...
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