Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
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
hooloo
ms
soss
Commits
b0471a51
Commit
b0471a51
authored
Sep 03, 2022
by
caiyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
周度提交
parent
eb3d0943
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
29 deletions
+21
-29
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
+0
-1
soss-admin/src/main/java/com/soss/web/controller/coupon/CouponController.java
+4
-8
soss-admin/src/main/java/com/soss/web/controller/coupon/CouponUserController.java
+0
-1
soss-common/src/main/java/com/soss/common/utils/spring/SpringUtils.java
+1
-2
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+15
-16
soss-system/src/main/resources/mapper/system/GoodsCategoryMapper.xml
+1
-1
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
View file @
b0471a51
...
@@ -176,5 +176,4 @@ public class OrderController extends BaseController {
...
@@ -176,5 +176,4 @@ public class OrderController extends BaseController {
public
AjaxResult
cancel
(
Long
orderId
)
{
public
AjaxResult
cancel
(
Long
orderId
)
{
return
toAjax
(
orderService
.
cancel
(
orderId
));
return
toAjax
(
orderService
.
cancel
(
orderId
));
}
}
}
}
soss-admin/src/main/java/com/soss/web/controller/coupon/CouponController.java
View file @
b0471a51
...
@@ -52,7 +52,6 @@ public class CouponController extends BaseController {
...
@@ -52,7 +52,6 @@ public class CouponController extends BaseController {
* 查询优惠券列表
* 查询优惠券列表
*/
*/
@PreAuthorize
(
"@ss.hasPermi('coupon:list')"
)
@PreAuthorize
(
"@ss.hasPermi('coupon:list')"
)
@Log
(
title
=
"查询优惠券列表"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"list"
)
@PostMapping
(
"list"
)
@ApiOperation
(
"查询优惠券列表"
)
@ApiOperation
(
"查询优惠券列表"
)
public
TableDataInfo
listCoupon
(
@RequestBody
CouponListPo
couponListPo
)
{
public
TableDataInfo
listCoupon
(
@RequestBody
CouponListPo
couponListPo
)
{
...
@@ -105,7 +104,6 @@ public class CouponController extends BaseController {
...
@@ -105,7 +104,6 @@ public class CouponController extends BaseController {
* 获取优惠券详情
* 获取优惠券详情
*/
*/
@PreAuthorize
(
"@ss.hasPermi('coupon:detail')"
)
@PreAuthorize
(
"@ss.hasPermi('coupon:detail')"
)
@Log
(
title
=
"获取优惠券详情"
,
businessType
=
BusinessType
.
INSERT
)
@GetMapping
(
"/detail/{id}"
)
@GetMapping
(
"/detail/{id}"
)
@ApiOperation
(
"获取优惠券详情"
)
@ApiOperation
(
"获取优惠券详情"
)
public
AjaxResult
detail
(
@PathVariable
Integer
id
)
{
public
AjaxResult
detail
(
@PathVariable
Integer
id
)
{
...
@@ -136,7 +134,7 @@ public class CouponController extends BaseController {
...
@@ -136,7 +134,7 @@ public class CouponController extends BaseController {
* 更新优惠券
* 更新优惠券
*/
*/
@PreAuthorize
(
"@ss.hasPermi('coupon:update')"
)
@PreAuthorize
(
"@ss.hasPermi('coupon:update')"
)
@Log
(
title
=
"更新优惠券"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"更新优惠券"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
@PostMapping
@ApiOperation
(
"更新优惠券"
)
@ApiOperation
(
"更新优惠券"
)
public
AjaxResult
update
(
@RequestBody
CouponPo
couponPo
)
{
public
AjaxResult
update
(
@RequestBody
CouponPo
couponPo
)
{
...
@@ -148,7 +146,6 @@ public class CouponController extends BaseController {
...
@@ -148,7 +146,6 @@ public class CouponController extends BaseController {
* 更新优惠券预校验
* 更新优惠券预校验
*/
*/
@PreAuthorize
(
"@ss.hasPermi('coupon:update:check')"
)
@PreAuthorize
(
"@ss.hasPermi('coupon:update:check')"
)
@Log
(
title
=
"更新优惠券预校验"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"/update/check/{id}"
)
@PostMapping
(
"/update/check/{id}"
)
@ApiOperation
(
"更新优惠券预校验"
)
@ApiOperation
(
"更新优惠券预校验"
)
public
AjaxResult
checkPreUpdate
(
@PathVariable
Integer
id
)
{
public
AjaxResult
checkPreUpdate
(
@PathVariable
Integer
id
)
{
...
@@ -160,7 +157,7 @@ public class CouponController extends BaseController {
...
@@ -160,7 +157,7 @@ public class CouponController extends BaseController {
* 上架优惠券
* 上架优惠券
*/
*/
@PreAuthorize
(
"@ss.hasPermi('coupon:online')"
)
@PreAuthorize
(
"@ss.hasPermi('coupon:online')"
)
@Log
(
title
=
"上架优惠券"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"上架优惠券"
,
businessType
=
BusinessType
.
UPDATE
)
@GetMapping
(
"/online/{id}"
)
@GetMapping
(
"/online/{id}"
)
@ApiOperation
(
"上架优惠券"
)
@ApiOperation
(
"上架优惠券"
)
public
AjaxResult
onlineCoupon
(
@PathVariable
Integer
id
)
{
public
AjaxResult
onlineCoupon
(
@PathVariable
Integer
id
)
{
...
@@ -172,7 +169,7 @@ public class CouponController extends BaseController {
...
@@ -172,7 +169,7 @@ public class CouponController extends BaseController {
* 下架优惠券
* 下架优惠券
*/
*/
@PreAuthorize
(
"@ss.hasPermi('coupon:offline')"
)
@PreAuthorize
(
"@ss.hasPermi('coupon:offline')"
)
@Log
(
title
=
"下架优惠券"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"下架优惠券"
,
businessType
=
BusinessType
.
UPDATE
)
@GetMapping
(
"/offline/{id}"
)
@GetMapping
(
"/offline/{id}"
)
@ApiOperation
(
"下架优惠券"
)
@ApiOperation
(
"下架优惠券"
)
public
AjaxResult
offlineCoupon
(
@PathVariable
Integer
id
)
{
public
AjaxResult
offlineCoupon
(
@PathVariable
Integer
id
)
{
...
@@ -184,7 +181,7 @@ public class CouponController extends BaseController {
...
@@ -184,7 +181,7 @@ public class CouponController extends BaseController {
* 删除优惠券
* 删除优惠券
*/
*/
@PreAuthorize
(
"@ss.hasPermi('coupon:delete')"
)
@PreAuthorize
(
"@ss.hasPermi('coupon:delete')"
)
@Log
(
title
=
"删除优惠券"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"删除优惠券"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{id}"
)
@DeleteMapping
(
"/{id}"
)
@ApiOperation
(
"删除优惠券"
)
@ApiOperation
(
"删除优惠券"
)
public
AjaxResult
deleteCoupon
(
@PathVariable
Integer
id
)
{
public
AjaxResult
deleteCoupon
(
@PathVariable
Integer
id
)
{
...
@@ -196,7 +193,6 @@ public class CouponController extends BaseController {
...
@@ -196,7 +193,6 @@ public class CouponController extends BaseController {
* 获取当前有效的规则集合
* 获取当前有效的规则集合
*/
*/
@PreAuthorize
(
"@ss.hasPermi('coupon:list:effective')"
)
@PreAuthorize
(
"@ss.hasPermi('coupon:list:effective')"
)
@Log
(
title
=
"获取当前有效的规则集合"
,
businessType
=
BusinessType
.
INSERT
)
@GetMapping
(
"/list/effective"
)
@GetMapping
(
"/list/effective"
)
@ApiOperation
(
"获取当前有效的规则集合"
)
@ApiOperation
(
"获取当前有效的规则集合"
)
public
TableDataInfo
listEffective
()
{
public
TableDataInfo
listEffective
()
{
...
...
soss-admin/src/main/java/com/soss/web/controller/coupon/CouponUserController.java
View file @
b0471a51
...
@@ -61,7 +61,6 @@ public class CouponUserController extends BaseController {
...
@@ -61,7 +61,6 @@ public class CouponUserController extends BaseController {
* 查询用户领取优惠券列表
* 查询用户领取优惠券列表
*/
*/
@PreAuthorize
(
"@ss.hasPermi('coupon:user:list')"
)
@PreAuthorize
(
"@ss.hasPermi('coupon:user:list')"
)
@Log
(
title
=
"查询用户领取优惠券列表"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
(
"list"
)
@PostMapping
(
"list"
)
@ApiOperation
(
"查询用户领取优惠券列表"
)
@ApiOperation
(
"查询用户领取优惠券列表"
)
public
TableDataInfo
selectCouponUserList
(
@RequestBody
CouponUser
couponUser
)
{
public
TableDataInfo
selectCouponUserList
(
@RequestBody
CouponUser
couponUser
)
{
...
...
soss-common/src/main/java/com/soss/common/utils/spring/SpringUtils.java
View file @
b0471a51
...
@@ -59,8 +59,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
...
@@ -59,8 +59,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
*/
*/
public
static
<
T
>
T
getBean
(
Class
<
T
>
clz
)
throws
BeansException
public
static
<
T
>
T
getBean
(
Class
<
T
>
clz
)
throws
BeansException
{
{
T
result
=
(
T
)
beanFactory
.
getBean
(
clz
);
return
beanFactory
.
getBean
(
clz
);
return
result
;
}
}
/**
/**
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
b0471a51
...
@@ -7,6 +7,7 @@ import com.soss.common.core.domain.model.LoginUser;
...
@@ -7,6 +7,7 @@ import com.soss.common.core.domain.model.LoginUser;
import
com.soss.common.enums.CouponUserState
;
import
com.soss.common.enums.CouponUserState
;
import
com.soss.common.enums.MachineState
;
import
com.soss.common.enums.MachineState
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.DateUtils
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.spring.SpringUtils
;
import
com.soss.common.utils.spring.SpringUtils
;
import
com.soss.system.constants.OrderStatusConstant
;
import
com.soss.system.constants.OrderStatusConstant
;
...
@@ -32,7 +33,10 @@ import org.springframework.util.CollectionUtils;
...
@@ -32,7 +33,10 @@ import org.springframework.util.CollectionUtils;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -473,24 +477,19 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -473,24 +477,19 @@ public class OrderServiceImpl implements IOrderService {
String
format
=
simpleDateFormat
.
format
(
new
Date
());
String
format
=
simpleDateFormat
.
format
(
new
Date
());
String
redisKey
=
"shopId"
+
format
+
shopId
;
String
redisKey
=
"shopId"
+
format
+
shopId
;
RedisAtomicInteger
redisAtomicInteger
=
new
RedisAtomicInteger
(
redisKey
,
SpringUtils
.
getBean
(
StringRedisTemplate
.
class
).
getConnectionFactory
());
RedisAtomicInteger
redisAtomicInteger
=
new
RedisAtomicInteger
(
redisKey
,
SpringUtils
.
getBean
(
StringRedisTemplate
.
class
).
getConnectionFactory
());
int
randomValue
=
(
int
)
(
9
*
Math
.
random
());
if
(
redisAtomicInteger
.
get
()
==
0
)
{
while
(
randomValue
==
0
)
{
redisAtomicInteger
.
set
((
int
)
(
1000
*
Math
.
random
()));
randomValue
=
(
int
)
(
9
*
Math
.
random
());
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
expireTime
=
DateUtils
.
addDaysAndGetBegin
(
now
,
1
);
long
seconds
=
Duration
.
between
(
now
,
expireTime
).
getSeconds
();
redisAtomicInteger
.
expire
(
seconds
,
TimeUnit
.
SECONDS
);
}
}
int
orderNum
=
randomValue
;
int
orderNum
=
redisAtomicInteger
.
addAndGet
(
3
);
if
(
0
==
redisAtomicInteger
.
get
())
{
if
(
orderNum
%
999
==
0
)
{
redisAtomicInteger
.
set
(
randomValue
);
orderNum
=
redisAtomicInteger
.
addAndGet
(
1
);
}
else
{
orderNum
=
redisAtomicInteger
.
getAndAdd
(
randomValue
);
if
(
orderNum
%
999
==
0
)
{
orderNum
=
redisAtomicInteger
.
getAndAdd
(
randomValue
);
}
orderNum
%=
999
;
}
}
int
orderNumTail
=
(
int
)
(
Math
.
random
()
*
8
);
orderNum
%=
999
;
// redisAtomicInteger.expire(1, TimeUnit.DAYS);
return
key
+
String
.
format
(
"%03d"
,
orderNum
);
// int andIncrement = redisAtomicInteger.getAndAdd(3);
return
key
+
String
.
format
(
"%03d"
,
orderNum
)
+
(
orderNumTail
+
1
);
}
}
//获取订单号
//获取订单号
...
...
soss-system/src/main/resources/mapper/system/GoodsCategoryMapper.xml
View file @
b0471a51
...
@@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update goods_category
update goods_category
<trim
prefix=
"SET"
suffixOverrides=
","
>
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"name != null and name != ''"
>
name = #{name},
</if>
<if
test=
"name != null and name != ''"
>
name = #{name},
</if>
<if
test=
"icon != null
and icon != ''
"
>
icon = #{icon},
</if>
<if
test=
"icon != null"
>
icon = #{icon},
</if>
<if
test=
"remarks != null"
>
remarks = #{remarks},
</if>
<if
test=
"remarks != null"
>
remarks = #{remarks},
</if>
<if
test=
"turn != null and turn != ''"
>
turn = #{turn},
</if>
<if
test=
"turn != null and turn != ''"
>
turn = #{turn},
</if>
<if
test=
"state != null and state != ''"
>
state = #{state},
</if>
<if
test=
"state != null and state != ''"
>
state = #{state},
</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