记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
3cdd5002
Commit
3cdd5002
authored
Sep 01, 2021
by
张国柄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台管理:发放券;
parent
f9bf9bee
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
228 additions
and
23 deletions
+228
-23
CandyMgtCouponAdminController.java
...troller/zhengzai/candy/CandyMgtCouponAdminController.java
+175
-0
add.html
...in/resources/templates/zhengzai/candy/coupon/mgt/add.html
+29
-0
coupon1.html
...esources/templates/zhengzai/candy/coupon/mgt/coupon1.html
+6
-5
coupon2.html
...esources/templates/zhengzai/candy/coupon/mgt/coupon2.html
+6
-6
coupon3.html
...esources/templates/zhengzai/candy/coupon/mgt/coupon3.html
+6
-6
coupon4.html
...esources/templates/zhengzai/candy/coupon/mgt/coupon4.html
+6
-6
No files found.
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/java/com/liquidnet/client/admin/web/controller/zhengzai/candy/CandyMgtCouponAdminController.java
0 → 100644
View file @
3cdd5002
package
com
.
liquidnet
.
client
.
admin
.
web
.
controller
.
zhengzai
.
candy
;
import
com.liquidnet.client.admin.common.annotation.Log
;
import
com.liquidnet.client.admin.common.core.controller.BaseController
;
import
com.liquidnet.client.admin.common.core.domain.AjaxResult
;
import
com.liquidnet.client.admin.common.core.page.TableDataInfo
;
import
com.liquidnet.client.admin.common.enums.BusinessType
;
import
com.liquidnet.client.admin.common.utils.DateUtils
;
import
com.liquidnet.client.admin.common.utils.ShiroUtils
;
import
com.liquidnet.client.admin.zhengzai.candy.service.ICandyCouponAdminService
;
import
com.liquidnet.client.admin.zhengzai.candy.service.ICandyMgtCouponAdminService
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
import
com.liquidnet.service.candy.dto.admin.CandyCouponRuleBuildParam
;
import
com.liquidnet.service.candy.dto.admin.CandyMgtCouponBuildParam
;
import
com.liquidnet.service.candy.dto.admin.CandyMgtCouponInfoDto
;
import
com.liquidnet.service.candy.dto.admin.CandyMgtCouponListParam
;
import
com.liquidnet.service.candy.entity.CandyCoupon
;
import
com.liquidnet.service.candy.entity.CandyCouponRule
;
import
com.liquidnet.service.candy.entity.CandyMgtCoupon
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
@Api
(
tags
=
"券发放管理"
)
@Controller
@RequestMapping
(
"candy/coupon/mgt"
)
public
class
CandyMgtCouponAdminController
extends
BaseController
{
private
final
String
prefix
=
"zhengzai/candy/coupon/mgt"
;
@Autowired
private
ICandyMgtCouponAdminService
candyMgtCouponAdminService
;
@RequiresPermissions
(
"candy:coupon:mgt:view"
)
@GetMapping
()
public
String
coupon
(
@RequestParam
int
couType
)
{
return
prefix
+
"/coupon"
+
couType
;
}
@RequiresPermissions
(
"candy:coupon:mgt:list"
)
@PostMapping
(
"list"
)
@ResponseBody
public
TableDataInfo
list
(
CandyMgtCouponListParam
listParam
)
{
startPage
();
List
<
CandyMgtCouponInfoDto
>
list
=
candyMgtCouponAdminService
.
listForMgtCouponInfoDto
(
listParam
);
return
getDataTable
(
list
);
}
@GetMapping
(
"add/{couType}"
)
public
String
add
(
@PathVariable
(
"couType"
)
String
couType
,
ModelMap
mmap
)
{
mmap
.
put
(
"couType"
,
couType
);
return
prefix
+
"/add"
;
}
@ApiOperation
(
value
=
"新建券"
)
@RequiresPermissions
(
"candy:coupon:mgt:add"
)
@Log
(
title
=
"券发放管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"add"
)
@ResponseBody
public
AjaxResult
addSave
(
@Validated
CandyMgtCouponBuildParam
buildParam
)
{
BigDecimal
discount
=
null
,
valFace
=
null
,
valOver
=
null
,
valMinus
=
null
;
Integer
couType
=
buildParam
.
getCouType
(),
validity
=
buildParam
.
getValidity
(),
redeemValidity
=
buildParam
.
getRedeemValidity
();
LocalDateTime
nowTime
=
LocalDateTime
.
now
(),
redeemStart
=
null
,
redeemStop
=
null
,
effectAt
,
expireAt
,
eventAt
=
LocalDateTime
.
parse
(
buildParam
.
getEventAt
(),
DateTimeFormatter
.
ofPattern
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
));
switch
(
couType
)
{
// TODO: 2021/8/20 校验
case
1
:
// 代金券
valFace
=
buildParam
.
getValFace
();
break
;
case
2
:
// 满减券
valOver
=
buildParam
.
getValOver
();
valMinus
=
buildParam
.
getValMinus
();
break
;
case
3
:
// 兑换券
redeemStart
=
eventAt
.
with
(
LocalTime
.
MIN
);
redeemStop
=
eventAt
.
plusDays
(
redeemValidity
).
withHour
(
23
).
withMinute
(
59
).
withSecond
(
59
);
break
;
case
4
:
// 折扣券
discount
=
buildParam
.
getDiscount
();
break
;
default
:
logger
.
warn
(
"Invalid operation[buildParam.couType={}]"
,
couType
);
return
this
.
error
(
AjaxResult
.
Type
.
WARN
,
"券类型无效"
);
}
effectAt
=
eventAt
.
with
(
LocalTime
.
MIN
);
expireAt
=
eventAt
.
plusDays
(
validity
).
withHour
(
23
).
withMinute
(
59
).
withSecond
(
59
);
StringBuilder
eventLimit
=
new
StringBuilder
();
String
operator
=
ShiroUtils
.
getLoginName
();
if
(
buildParam
.
getEventType
()
==
2
)
{
// 指定用户手机号
String
eventLimitStr
=
buildParam
.
getEventLimit
().
trim
();
// TODO: 2021/8/20 正则校验手机号字符串
if
(
StringUtils
.
isEmpty
(
eventLimitStr
))
{
return
this
.
error
(
AjaxResult
.
Type
.
WARN
,
"请指定手机号"
);
}
Set
<
String
>
eventLimitSet
=
Stream
.
of
(
eventLimitStr
.
split
(
","
)).
collect
(
Collectors
.
toSet
());
for
(
String
l
:
eventLimitSet
)
{
eventLimit
.
append
(
l
).
append
(
","
);
}
}
CandyCoupon
initCoupon
=
new
CandyCoupon
();
initCoupon
.
setCouponId
(
IDGenerator
.
nextMilliId
());
initCoupon
.
setState
(
1
);
initCoupon
.
setTitle
(
buildParam
.
getTitle
());
initCoupon
.
setLabel
(
buildParam
.
getLabel
());
initCoupon
.
setNotice
(
buildParam
.
getNotice
());
initCoupon
.
setExclusive
(
0
);
initCoupon
.
setBusiType
(
buildParam
.
getBusiType
());
initCoupon
.
setCouType
(
couType
);
initCoupon
.
setBindType
(
buildParam
.
getBindType
());
initCoupon
.
setDiscount
(
discount
);
initCoupon
.
setValFace
(
valFace
);
initCoupon
.
setValOver
(
valOver
);
initCoupon
.
setValMinus
(
valMinus
);
initCoupon
.
setOverlay
(
buildParam
.
getOverlay
());
initCoupon
.
setValidity
(
validity
);
initCoupon
.
setRedeemValidity
(
redeemValidity
);
initCoupon
.
setRedeemStart
(
redeemStart
);
initCoupon
.
setRedeemStop
(
redeemStop
);
initCoupon
.
setEffectAt
(
effectAt
);
initCoupon
.
setExpireAt
(
expireAt
);
initCoupon
.
setOperator
(
operator
);
initCoupon
.
setCreatedAt
(
nowTime
);
List
<
CandyCouponRuleBuildParam
>
couponRuleList
=
buildParam
.
getCouponRuleList
();
List
<
CandyCouponRule
>
initCouponRuleList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
couponRuleList
))
{
couponRuleList
.
forEach
(
r
->
{
CandyCouponRule
initCouponRule
=
new
CandyCouponRule
();
initCouponRule
.
setCruleId
(
IDGenerator
.
nextMilliId
());
initCouponRule
.
setCouponId
(
initCoupon
.
getCouponId
());
initCouponRule
.
setUseScope
(
r
.
getUseScope
());
initCouponRule
.
setBusiName
(
r
.
getBusiName
());
initCouponRule
.
setBusiId
(
r
.
getBusiId
());
initCouponRule
.
setState
(
1
);
initCouponRuleList
.
add
(
initCouponRule
);
});
}
CandyMgtCoupon
initMgtCoupon
=
new
CandyMgtCoupon
();
initMgtCoupon
.
setMcouponId
(
IDGenerator
.
nextMilliId
());
initMgtCoupon
.
setCouponId
(
initCoupon
.
getCouponId
());
initMgtCoupon
.
setState
(
0
);
initMgtCoupon
.
setEventAmt
(
buildParam
.
getEventAmt
());
initMgtCoupon
.
setEventType
(
buildParam
.
getEventType
());
initMgtCoupon
.
setEventLimit
(
eventLimit
.
toString
());
initMgtCoupon
.
setEventAt
(
eventAt
);
initMgtCoupon
.
setOperator
(
operator
);
initMgtCoupon
.
setCreatedAt
(
nowTime
);
candyMgtCouponAdminService
.
saveMgtCouponInfo
(
initCoupon
,
initMgtCoupon
,
initCouponRuleList
);
return
toAjax
(
true
);
}
}
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/resources/templates/zhengzai/candy/coupon/mgt/add.html
0 → 100644
View file @
3cdd5002
<!DOCTYPE html>
<html
lang=
"zh"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<th:block
th:include=
"include :: header('添加代金券')"
/>
<th:block
th:include=
"include :: select2-css"
/>
</head>
<body>
<div
class=
"main-content"
>
<form
id=
"form-coupon-mgt-add"
class=
"form-horizontal"
>
<input
name=
"couType"
type=
"text"
th:value=
"${couType}"
readonly
/>
</form>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-offset-5 col-sm-10"
>
<button
type=
"button"
class=
"btn btn-sm btn-primary"
onclick=
"submitHandler()"
><i
class=
"fa fa-check"
></i>
保 存
</button>
<button
type=
"button"
class=
"btn btn-sm btn-danger"
onclick=
"closeItem()"
><i
class=
"fa fa-reply-all"
></i>
关 闭
</button>
</div>
</div>
<th:block
th:include=
"include :: footer"
/>
<th:block
th:include=
"include :: select2-js"
/>
<script>
var
couType
=
[[
$
{
couType
}]];
var
prefix
=
ctx
+
"candy/coupon/mgt"
;
</script>
</body>
</html>
\ No newline at end of file
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/resources/templates/zhengzai/candy/coupon/mgt/coupon1.html
View file @
3cdd5002
...
...
@@ -10,6 +10,7 @@
<form
id=
"coupon-form"
>
<div
class=
"select-list"
>
<ul>
<input
type=
"hidden"
name=
"couType"
value=
"1"
/>
<li>
<input
type=
"text"
name=
"keyword"
placeholder=
"搜索"
/>
</li>
...
...
@@ -35,8 +36,8 @@
</div>
<div
class=
"btn-group-sm"
id=
"toolbar"
role=
"group"
>
<a
class=
"btn btn-success"
onclick=
"$.operate.addTab(
''
)"
shiro:hasPermission=
"candy:coupon:mgt:add"
>
<i
class=
"fa fa-plus"
></i>
新增
<a
class=
"btn btn-success"
onclick=
"$.operate.addTab(
1
)"
shiro:hasPermission=
"candy:coupon:mgt:add"
>
<i
class=
"fa fa-plus"
></i>
添加
</a>
</div>
...
...
@@ -48,17 +49,17 @@
<th:block
th:include=
"include :: footer"
/>
<script
th:inline=
"javascript"
>
var
couponCodeListFlag
=
[[
$
{@
permission
.
hasPermi
(
'system:role:edit'
)}]];
var
prefix
=
ctx
+
"candy/coupon
1
/mgt"
;
var
prefix
=
ctx
+
"candy/coupon/mgt"
;
$
(
function
()
{
var
options
=
{
url
:
prefix
+
"/list"
,
createUrl
:
prefix
+
"/add"
,
createUrl
:
prefix
+
"/add
/{id}
"
,
// updateUrl: prefix + "/edit/{id}",
// removeUrl: prefix + "/remove",
// exportUrl: prefix + "/export",
sortName
:
"createdAt"
,
modalName
:
"
发放记录
"
,
modalName
:
"
代金券
"
,
columns
:
[{
checkbox
:
true
},
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/resources/templates/zhengzai/candy/coupon/mgt/coupon2.html
View file @
3cdd5002
...
...
@@ -10,7 +10,7 @@
<form
id=
"coupon-form"
>
<div
class=
"select-list"
>
<ul>
<input
type=
"
text"
name=
"couType"
value=
"2"
hidden=
"hidden"
/>
<input
type=
"
hidden"
name=
"couType"
value=
"2"
/>
<li>
<input
type=
"text"
name=
"keyword"
placeholder=
"搜索"
/>
</li>
...
...
@@ -36,8 +36,8 @@
</div>
<div
class=
"btn-group-sm"
id=
"toolbar"
role=
"group"
>
<a
class=
"btn btn-success"
onclick=
"$.operate.add()"
shiro:hasPermission=
"candy:coupon:mgt:add"
>
<i
class=
"fa fa-plus"
></i>
新增
<a
class=
"btn btn-success"
onclick=
"$.operate.add(
2
)"
shiro:hasPermission=
"candy:coupon:mgt:add"
>
<i
class=
"fa fa-plus"
></i>
添加
</a>
</div>
...
...
@@ -49,17 +49,17 @@
<th:block
th:include=
"include :: footer"
/>
<script
th:inline=
"javascript"
>
var
couponCodeListFlag
=
[[
$
{@
permission
.
hasPermi
(
'system:role:edit'
)}]];
var
prefix
=
ctx
+
"candy/coupon
2
/mgt"
;
var
prefix
=
ctx
+
"candy/coupon/mgt"
;
$
(
function
()
{
var
options
=
{
url
:
prefix
+
"/list"
,
createUrl
:
prefix
+
"/add"
,
createUrl
:
prefix
+
"/add
/{id}
"
,
// updateUrl: prefix + "/edit/{id}",
// removeUrl: prefix + "/remove",
// exportUrl: prefix + "/export",
sortName
:
"createdAt"
,
modalName
:
"
发放记录
"
,
modalName
:
"
满减券
"
,
columns
:
[{
checkbox
:
true
},
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/resources/templates/zhengzai/candy/coupon/mgt/coupon3.html
View file @
3cdd5002
...
...
@@ -10,7 +10,7 @@ coupon1.html<!DOCTYPE html>
<form
id=
"coupon-form"
>
<div
class=
"select-list"
>
<ul>
<input
type=
"
text"
name=
"couType"
value=
"3"
hidden=
"hidden"
/>
<input
type=
"
hidden"
name=
"couType"
value=
"3"
/>
<li>
<input
type=
"text"
name=
"keyword"
placeholder=
"搜索"
/>
</li>
...
...
@@ -36,8 +36,8 @@ coupon1.html<!DOCTYPE html>
</div>
<div
class=
"btn-group-sm"
id=
"toolbar"
role=
"group"
>
<a
class=
"btn btn-success"
onclick=
"$.operate.add()"
shiro:hasPermission=
"candy:coupon:mgt:add"
>
<i
class=
"fa fa-plus"
></i>
新增
<a
class=
"btn btn-success"
onclick=
"$.operate.add(
3
)"
shiro:hasPermission=
"candy:coupon:mgt:add"
>
<i
class=
"fa fa-plus"
></i>
添加
</a>
</div>
...
...
@@ -49,17 +49,17 @@ coupon1.html<!DOCTYPE html>
<th:block
th:include=
"include :: footer"
/>
<script
th:inline=
"javascript"
>
var
couponCodeListFlag
=
[[
$
{@
permission
.
hasPermi
(
'system:role:edit'
)}]];
var
prefix
=
ctx
+
"candy/coupon
3
/mgt"
;
var
prefix
=
ctx
+
"candy/coupon/mgt"
;
$
(
function
()
{
var
options
=
{
url
:
prefix
+
"/list"
,
createUrl
:
prefix
+
"/add"
,
createUrl
:
prefix
+
"/add
/{id}
"
,
// updateUrl: prefix + "/edit/{id}",
// removeUrl: prefix + "/remove",
// exportUrl: prefix + "/export",
sortName
:
"createdAt"
,
modalName
:
"
发放记录
"
,
modalName
:
"
兑换券
"
,
columns
:
[{
checkbox
:
true
},
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/resources/templates/zhengzai/candy/coupon/mgt/coupon4.html
View file @
3cdd5002
...
...
@@ -10,7 +10,7 @@ coupon1.html<!DOCTYPE html>
<form
id=
"coupon-form"
>
<div
class=
"select-list"
>
<ul>
<input
type=
"
text"
name=
"couType"
value=
"4"
hidden=
"hidden"
/>
<input
type=
"
hidden"
name=
"couType"
value=
"4"
/>
<li>
<input
type=
"text"
name=
"keyword"
placeholder=
"搜索"
/>
</li>
...
...
@@ -36,8 +36,8 @@ coupon1.html<!DOCTYPE html>
</div>
<div
class=
"btn-group-sm"
id=
"toolbar"
role=
"group"
>
<a
class=
"btn btn-success"
onclick=
"$.operate.add()"
shiro:hasPermission=
"candy:coupon:mgt:add"
>
<i
class=
"fa fa-plus"
></i>
新增
<a
class=
"btn btn-success"
onclick=
"$.operate.add(
4
)"
shiro:hasPermission=
"candy:coupon:mgt:add"
>
<i
class=
"fa fa-plus"
></i>
添加
</a>
</div>
...
...
@@ -49,17 +49,17 @@ coupon1.html<!DOCTYPE html>
<th:block
th:include=
"include :: footer"
/>
<script
th:inline=
"javascript"
>
var
couponCodeListFlag
=
[[
$
{@
permission
.
hasPermi
(
'system:role:edit'
)}]];
var
prefix
=
ctx
+
"candy/coupon
4
/mgt"
;
var
prefix
=
ctx
+
"candy/coupon/mgt"
;
$
(
function
()
{
var
options
=
{
url
:
prefix
+
"/list"
,
createUrl
:
prefix
+
"/add"
,
createUrl
:
prefix
+
"/add
/{id}
"
,
// updateUrl: prefix + "/edit/{id}",
// removeUrl: prefix + "/remove",
// exportUrl: prefix + "/export",
sortName
:
"createdAt"
,
modalName
:
"
发放记录
"
,
modalName
:
"
折扣券
"
,
columns
:
[{
checkbox
:
true
},
...
...
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