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
f45e0f2a
Commit
f45e0f2a
authored
Jul 11, 2022
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单时校验订单中sku数量
parent
ff201708
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
43 deletions
+34
-43
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
+30
-43
soss-framework/src/main/java/com/soss/framework/web/service/TokenService.java
+4
-0
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+0
-0
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
View file @
f45e0f2a
package
com
.
soss
.
web
.
controller
.
coffee
;
package
com
.
soss
.
web
.
controller
.
coffee
;
import
java.util.List
;
import
com.soss.common.annotation.Log
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
com.soss.common.constant.HttpStatus
;
import
com.soss.common.constant.HttpStatus
;
import
com.soss.common.core.controller.BaseController
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.common.core.page.TableDataInfo
;
import
com.soss.common.enums.BusinessType
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.framework.web.service.TokenService
;
import
com.soss.framework.web.service.TokenService
;
import
com.soss.framework.web.service.WeixinServiceImpl
;
import
com.soss.framework.web.service.WeixinServiceImpl
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.OrderQuery
;
import
com.soss.system.domain.vo.OrderQuery
;
import
com.soss.system.service.impl.CustomerServiceImpl
;
import
com.soss.system.service.impl.OrderServiceImpl
;
import
com.soss.system.service.impl.OrderServiceImpl
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
java.util.List
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
java.util.Map
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.soss.common.annotation.Log
;
import
com.soss.common.core.controller.BaseController
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.enums.BusinessType
;
import
com.soss.system.domain.Order
;
import
com.soss.system.service.IOrderService
;
import
com.soss.common.core.page.TableDataInfo
;
/**
/**
* 订单Controller
* 订单Controller
...
@@ -37,8 +29,7 @@ import com.soss.common.core.page.TableDataInfo;
...
@@ -37,8 +29,7 @@ import com.soss.common.core.page.TableDataInfo;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/order"
)
@RequestMapping
(
"/order"
)
public
class
OrderController
extends
BaseController
public
class
OrderController
extends
BaseController
{
{
@Autowired
@Autowired
private
OrderServiceImpl
orderService
;
private
OrderServiceImpl
orderService
;
@Autowired
@Autowired
...
@@ -51,8 +42,7 @@ public class OrderController extends BaseController
...
@@ -51,8 +42,7 @@ public class OrderController extends BaseController
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:order:list')"
)
@PreAuthorize
(
"@ss.hasPermi('system:order:list')"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
OrderQuery
orderQuery
)
public
TableDataInfo
list
(
OrderQuery
orderQuery
)
{
{
startPage
();
startPage
();
List
<
Order
>
list
=
orderService
.
selectOrderList
(
orderQuery
);
List
<
Order
>
list
=
orderService
.
selectOrderList
(
orderQuery
);
return
getDataTable
(
list
);
return
getDataTable
(
list
);
...
@@ -63,15 +53,13 @@ public class OrderController extends BaseController
...
@@ -63,15 +53,13 @@ public class OrderController extends BaseController
* 获取订单详细信息
* 获取订单详细信息
*/
*/
@GetMapping
(
value
=
"/{id}"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
{
{
return
AjaxResult
.
success
(
orderService
.
selectOrderById
(
id
));
return
AjaxResult
.
success
(
orderService
.
selectOrderById
(
id
));
}
}
@PostMapping
(
"/check"
)
@PostMapping
(
"/check"
)
public
AjaxResult
check
(
@RequestBody
Order
order
)
public
AjaxResult
check
(
@RequestBody
Order
order
)
{
{
return
orderService
.
check
(
order
);
return
orderService
.
check
(
order
);
}
}
...
@@ -80,34 +68,34 @@ public class OrderController extends BaseController
...
@@ -80,34 +68,34 @@ public class OrderController extends BaseController
*/
*/
@Log
(
title
=
"订单"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"订单"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
@PostMapping
public
AjaxResult
add
(
HttpServletRequest
request
,
@RequestBody
Order
order
)
public
AjaxResult
add
(
HttpServletRequest
request
,
@RequestBody
Order
order
)
{
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
AjaxResult
ajaxResult
=
orderService
.
insertOrder
(
loginUser
,
order
);
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
ajaxResult
.
get
(
AjaxResult
.
CODE_TAG
)){
AjaxResult
ajaxResult
=
orderService
.
insertOrder
(
loginUser
,
order
);
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
ajaxResult
.
get
(
AjaxResult
.
CODE_TAG
))
{
return
ajaxResult
;
return
ajaxResult
;
}
}
int
amount
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
int
amount
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
Map
payInfo
=
weixinService
.
pay
(
request
,
"hooloo"
,
order
.
getOrderNo
(),
order
.
getUserId
(),
amount
);
Map
payInfo
=
weixinService
.
pay
(
request
,
"hooloo"
,
order
.
getOrderNo
(),
order
.
getUserId
(),
amount
);
if
(
payInfo
!=
null
)
{
if
(
payInfo
!=
null
)
{
payInfo
.
put
(
"orderId"
,
order
.
getId
());
payInfo
.
put
(
"orderId"
,
order
.
getId
());
return
AjaxResult
.
success
(
payInfo
);
return
AjaxResult
.
success
(
payInfo
);
}
else
{
}
else
{
throw
new
ServiceException
(
"微信支付发生异常"
);
throw
new
ServiceException
(
"微信支付发生异常"
);
}
}
}
}
@RequestMapping
(
"/payOrder"
)
@RequestMapping
(
"/payOrder"
)
public
AjaxResult
cancel
(
HttpServletRequest
request
,
String
orderId
)
public
AjaxResult
cancel
(
HttpServletRequest
request
,
String
orderId
)
{
{
Order
order
=
orderService
.
selectOrderById
(
orderId
);
Order
order
=
orderService
.
selectOrderById
(
orderId
);
order
.
setOrderNo
(
orderService
.
getOrderNo
(
order
.
getSource
()));
order
.
setOrderNo
(
orderService
.
getOrderNo
(
order
.
getSource
()));
orderService
.
updateOrder
(
order
);
orderService
.
updateOrder
(
order
);
int
amount
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
int
amount
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
Map
payInfo
=
weixinService
.
pay
(
request
,
"hooloo"
,
order
.
getOrderNo
(),
order
.
getUserId
(),
amount
);
Map
payInfo
=
weixinService
.
pay
(
request
,
"hooloo"
,
order
.
getOrderNo
(),
order
.
getUserId
(),
amount
);
if
(
payInfo
!=
null
)
{
if
(
payInfo
!=
null
)
{
return
AjaxResult
.
success
(
payInfo
);
return
AjaxResult
.
success
(
payInfo
);
}
else
{
}
else
{
throw
new
ServiceException
(
"微信支付发生异常"
);
throw
new
ServiceException
(
"微信支付发生异常"
);
}
}
}
}
...
@@ -119,13 +107,12 @@ public class OrderController extends BaseController
...
@@ -119,13 +107,12 @@ public class OrderController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:order:edit')"
)
@PreAuthorize
(
"@ss.hasPermi('system:order:edit')"
)
@Log
(
title
=
"订单"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"订单"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
@PutMapping
public
AjaxResult
edit
(
@RequestBody
Order
order
)
public
AjaxResult
edit
(
@RequestBody
Order
order
)
{
{
return
toAjax
(
orderService
.
updateOrder
(
order
));
return
toAjax
(
orderService
.
updateOrder
(
order
));
}
}
@RequestMapping
(
"/cancel"
)
@RequestMapping
(
"/cancel"
)
public
AjaxResult
cancel
(
String
orderId
)
public
AjaxResult
cancel
(
String
orderId
)
{
{
return
toAjax
(
orderService
.
cancel
(
orderId
));
return
toAjax
(
orderService
.
cancel
(
orderId
));
}
}
...
...
soss-framework/src/main/java/com/soss/framework/web/service/TokenService.java
View file @
f45e0f2a
...
@@ -4,6 +4,8 @@ import java.util.HashMap;
...
@@ -4,6 +4,8 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -26,6 +28,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
...
@@ -26,6 +28,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
* @author zxq
* @author zxq
*/
*/
@Component
@Component
@Slf4j
public
class
TokenService
public
class
TokenService
{
{
// 令牌自定义标识
// 令牌自定义标识
...
@@ -71,6 +74,7 @@ public class TokenService
...
@@ -71,6 +74,7 @@ public class TokenService
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
{
log
.
error
(
""
,
e
);
}
}
}
}
return
null
;
return
null
;
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
f45e0f2a
This diff is collapsed.
Click to expand it.
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