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
2b05019f
Commit
2b05019f
authored
Aug 08, 2022
by
caiyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复订单整个流程遇到的问题
parent
6d3c274f
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
349 additions
and
374 deletions
+349
-374
soss-admin/src/main/java/com/soss/web/controller/coffee/AppController.java
+1
-1
soss-admin/src/main/java/com/soss/web/controller/coffee/CustomerController.java
+11
-9
soss-admin/src/main/java/com/soss/web/controller/coffee/MachineApiController.java
+1
-1
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
+26
-24
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderLogController.java
+5
-5
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderRefundController.java
+22
-6
soss-admin/src/main/java/com/soss/web/controller/coffee/WechatMessageController.java
+16
-19
soss-framework/src/main/java/com/soss/framework/web/service/MachineSericeImpl.java
+1
-1
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
+1
-12
soss-system/src/main/java/com/soss/system/domain/Customer.java
+23
-9
soss-system/src/main/java/com/soss/system/domain/OrderDetail.java
+10
-6
soss-system/src/main/java/com/soss/system/domain/OrderOperationLog.java
+7
-69
soss-system/src/main/java/com/soss/system/domain/OrderRefund.java
+4
-1
soss-system/src/main/java/com/soss/system/mapper/CouponUserMapper.java
+1
-1
soss-system/src/main/java/com/soss/system/mapper/CustomerMapper.java
+9
-3
soss-system/src/main/java/com/soss/system/mapper/OrderDetailMapper.java
+5
-4
soss-system/src/main/java/com/soss/system/mapper/OrderMapper.java
+2
-2
soss-system/src/main/java/com/soss/system/schedule/OrderSchedule.java
+1
-1
soss-system/src/main/java/com/soss/system/service/ICouponUserService.java
+1
-3
soss-system/src/main/java/com/soss/system/service/ICustomerService.java
+5
-5
soss-system/src/main/java/com/soss/system/service/IOrderService.java
+4
-19
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
+39
-30
soss-system/src/main/java/com/soss/system/service/impl/CustomerServiceImpl.java
+19
-14
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
+5
-5
soss-system/src/main/java/com/soss/system/service/impl/OrderOperationLogServiceImpl.java
+3
-3
soss-system/src/main/java/com/soss/system/service/impl/OrderRefundServiceImpl.java
+45
-48
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+16
-34
soss-system/src/main/java/com/soss/system/service/impl/SysUserServiceImpl.java
+15
-17
soss-system/src/main/java/com/soss/system/service/impl/WechatMessageServiceImpl.java
+1
-1
soss-system/src/main/resources/mapper/system/CouponUserMapper.xml
+2
-2
soss-system/src/main/resources/mapper/system/CustomerMapper.xml
+27
-5
soss-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
+1
-1
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
+10
-5
soss-system/src/main/resources/mapper/system/OrderMapper.xml
+3
-1
soss-system/src/main/resources/mapper/system/OrderRefundMapper.xml
+7
-7
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/AppController.java
View file @
2b05019f
...
@@ -89,7 +89,7 @@ public class AppController extends BaseController {
...
@@ -89,7 +89,7 @@ public class AppController extends BaseController {
}
}
@RequestMapping
(
"/refundOrder"
)
@RequestMapping
(
"/refundOrder"
)
public
AjaxResult
refundOrder
(
Stri
ng
orderId
){
public
AjaxResult
refundOrder
(
Lo
ng
orderId
){
return
AjaxResult
.
success
(
orderService
.
refundOrder
(
orderId
));
return
AjaxResult
.
success
(
orderService
.
refundOrder
(
orderId
));
}
}
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/CustomerController.java
View file @
2b05019f
...
@@ -13,7 +13,6 @@ import com.soss.system.domain.Order;
...
@@ -13,7 +13,6 @@ import com.soss.system.domain.Order;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
import
com.soss.system.domain.vo.customer.CustomerResultVo
;
import
com.soss.system.domain.vo.customer.CustomerResultVo
;
import
com.soss.system.service.ICustomerService
;
import
com.soss.system.service.ICustomerService
;
import
com.soss.system.service.impl.CustomerServiceImpl
;
import
io.jsonwebtoken.lang.Assert
;
import
io.jsonwebtoken.lang.Assert
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -26,26 +25,29 @@ import java.util.Objects;
...
@@ -26,26 +25,29 @@ import java.util.Objects;
/**
/**
* 用户信息Controller
* 用户信息Controller
*
*
* @author zxq
* @author zxq
* @date 2022-05-01
* @date 2022-05-01
*/
*/
@RestController
@RestController
@RequestMapping
(
"/system/customer"
)
@RequestMapping
(
"/system/customer"
)
public
class
CustomerController
extends
BaseController
public
class
CustomerController
extends
BaseController
{
{
@Autowired
@Autowired
private
ICustomerService
customerService
;
private
ICustomerService
customerService
;
@Autowired
@Autowired
private
TokenService
tokenService
;
private
TokenService
tokenService
;
@PostMapping
(
"/allow"
)
@
GetMapping
(
"/allow
"
)
@
ApiOperation
(
"用户授权
"
)
public
AjaxResult
allow
(
HttpServletRequest
request
,
String
allow
)
{
public
AjaxResult
allow
(
HttpServletRequest
request
,
@RequestBody
Customer
customer
)
{
TokenService
bean
=
SpringUtils
.
getBean
(
TokenService
.
class
);
TokenService
bean
=
SpringUtils
.
getBean
(
TokenService
.
class
);
LoginUser
loginUser
=
bean
.
getLoginUser
(
request
);
LoginUser
loginUser
=
bean
.
getLoginUser
(
request
);
if
(
loginUser
==
null
)
{
return
AjaxResult
.
success
(
SpringUtils
.
getBean
(
CustomerServiceImpl
.
class
).
allow
(
loginUser
.
getOpenId
(),
allow
));
throw
new
ServiceException
(
"请先登录"
);
}
customer
.
setId
(
loginUser
.
getOpenId
());
customerService
.
updateSendMsgFlag
(
customer
);
return
AjaxResult
.
success
();
}
}
@GetMapping
(
"/detail"
)
@GetMapping
(
"/detail"
)
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/MachineApiController.java
View file @
2b05019f
...
@@ -56,7 +56,7 @@ public class MachineApiController {
...
@@ -56,7 +56,7 @@ public class MachineApiController {
}
}
@GetMapping
(
"/testOrder"
)
@GetMapping
(
"/testOrder"
)
public
void
testOrder
(
Stri
ng
orderId
){
public
void
testOrder
(
Lo
ng
orderId
){
machineApiService
.
testOrder
(
orderId
);
machineApiService
.
testOrder
(
orderId
);
}
}
@GetMapping
(
"/testOrderUpdate"
)
@GetMapping
(
"/testOrderUpdate"
)
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
View file @
2b05019f
...
@@ -60,7 +60,7 @@ public class OrderController extends BaseController {
...
@@ -60,7 +60,7 @@ public class OrderController extends BaseController {
* 获取订单详细信息
* 获取订单详细信息
*/
*/
@GetMapping
(
value
=
"/{id}"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Stri
ng
id
)
{
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Lo
ng
id
)
{
return
AjaxResult
.
success
(
orderService
.
selectOrderById
(
id
));
return
AjaxResult
.
success
(
orderService
.
selectOrderById
(
id
));
}
}
...
@@ -77,6 +77,9 @@ public class OrderController extends BaseController {
...
@@ -77,6 +77,9 @@ public class OrderController extends BaseController {
@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
);
if
(
loginUser
==
null
)
{
throw
new
ServiceException
(
"请先登录"
);
}
if
(
order
.
getLng
()
==
null
||
order
.
getLng
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
if
(
order
.
getLng
()
==
null
||
order
.
getLng
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
||
order
.
getLat
()
==
null
||
order
.
getLat
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
||
order
.
getLat
()
==
null
||
order
.
getLat
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
...
@@ -91,36 +94,35 @@ public class OrderController extends BaseController {
...
@@ -91,36 +94,35 @@ public class OrderController extends BaseController {
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
result
.
get
(
result
.
CODE_TAG
))
{
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
result
.
get
(
result
.
CODE_TAG
))
{
return
result
;
return
result
;
}
}
try
{
try
{
orderService
.
checkShopInfo
(
order
);
orderService
.
checkShopInfo
(
order
);
if
(
order
.
getCouponId
()
!=
null
)
{
List
<
CouponVo
>
couponVos
=
couponUserService
.
listCustAvailableCoupon
(
loginUser
.
getOpenId
(),
order
.
getCouponId
());
if
(
CollectionUtils
.
isEmpty
(
couponVos
))
{
return
AjaxResult
.
error
(
"未查询到匹配的优惠券信息"
);
}
couponUserService
.
resovleCouponFitable
(
couponVos
,
order
);
CouponVo
couponVo
=
couponVos
.
get
(
0
);
String
notFitableDesc
=
couponVo
.
getNotFitableDesc
();
if
(!
StringUtils
.
isEmpty
(
notFitableDesc
))
{
return
AjaxResult
.
error
(
notFitableDesc
);
}
order
.
setCouponAmount
(
couponVo
.
getCouponAmount
().
negate
());
order
.
setPaidAmount
(
order
.
getAmount
().
add
(
order
.
getCouponAmount
()));
order
.
getOrderDetails
().
forEach
(
orderDetail
->
{
orderDetail
.
setCouponAmount
(
couponVo
.
getCouponAmountMap
().
get
(
orderDetail
.
getSkuId
()).
negate
());
orderDetail
.
setRealAmount
(
orderDetail
.
getAmountShould
().
add
(
orderDetail
.
getCouponAmount
()));
});
couponUserService
.
useCoupon
(
couponVo
.
getId
());
}
}
catch
(
ServiceException
e
)
{
}
catch
(
ServiceException
e
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
return
AjaxResult
.
error
(
e
.
getMessage
());
}
}
AjaxResult
ajaxResult
=
orderService
.
insertOrder
(
loginUser
,
order
);
Integer
couponUserId
=
order
.
getCouponId
();
if
(
couponUserId
!=
null
)
{
List
<
CouponVo
>
couponVos
=
couponUserService
.
listCustAvailableCoupon
(
loginUser
.
getOpenId
(),
couponUserId
);
if
(
CollectionUtils
.
isEmpty
(
couponVos
))
{
return
AjaxResult
.
error
(
"未查询到匹配的优惠券信息"
);
}
couponUserService
.
resovleCouponFitable
(
couponVos
,
order
);
CouponVo
couponVo
=
couponVos
.
get
(
0
);
String
notFitableDesc
=
couponVo
.
getNotFitableDesc
();
if
(!
StringUtils
.
isEmpty
(
notFitableDesc
))
{
return
AjaxResult
.
error
(
notFitableDesc
);
}
order
.
setCouponAmount
(
couponVo
.
getCouponAmount
().
negate
());
order
.
setPaidAmount
(
order
.
getAmount
().
add
(
order
.
getCouponAmount
()));
order
.
setCouponId
(
couponVo
.
getCouponId
());
}
AjaxResult
ajaxResult
=
orderService
.
insertOrder
(
loginUser
,
order
,
couponUserId
);
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
ajaxResult
.
get
(
AjaxResult
.
CODE_TAG
))
{
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
ajaxResult
.
get
(
AjaxResult
.
CODE_TAG
))
{
return
ajaxResult
;
return
ajaxResult
;
}
}
int
amount
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
int
amount
=
order
.
get
Paid
Amount
().
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
());
...
@@ -131,7 +133,7 @@ public class OrderController extends BaseController {
...
@@ -131,7 +133,7 @@ public class OrderController extends BaseController {
}
}
@RequestMapping
(
"/payOrder"
)
@RequestMapping
(
"/payOrder"
)
public
AjaxResult
cancel
(
HttpServletRequest
request
,
Stri
ng
orderId
)
{
public
AjaxResult
cancel
(
HttpServletRequest
request
,
Lo
ng
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
);
...
@@ -156,7 +158,7 @@ public class OrderController extends BaseController {
...
@@ -156,7 +158,7 @@ public class OrderController extends BaseController {
}
}
@RequestMapping
(
"/cancel"
)
@RequestMapping
(
"/cancel"
)
public
AjaxResult
cancel
(
Stri
ng
orderId
)
{
public
AjaxResult
cancel
(
Lo
ng
orderId
)
{
return
toAjax
(
orderService
.
cancel
(
orderId
));
return
toAjax
(
orderService
.
cancel
(
orderId
));
}
}
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderLogController.java
View file @
2b05019f
package
com
.
soss
.
web
.
controller
.
coffee
;
package
com
.
soss
.
web
.
controller
.
coffee
;
import
java.util.List
;
import
com.soss.common.core.controller.BaseController
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.system.domain.OrderOperationLog
;
import
com.soss.system.domain.OrderOperationLog
;
import
com.soss.system.service.IOrderOperationLogService
;
import
com.soss.system.service.IOrderOperationLogService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.soss.common.core.controller.BaseController
;
import
com.soss.common.core.domain.AjaxResul
t
;
import
java.util.Lis
t
;
/**
/**
* 订单日志Controller
* 订单日志Controller
...
@@ -29,7 +29,7 @@ public class OrderLogController extends BaseController
...
@@ -29,7 +29,7 @@ public class OrderLogController extends BaseController
*/
*/
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
AjaxResult
list
(
Stri
ng
orderId
)
public
AjaxResult
list
(
Lo
ng
orderId
)
{
{
OrderOperationLog
orderOperationLog
=
new
OrderOperationLog
();
OrderOperationLog
orderOperationLog
=
new
OrderOperationLog
();
orderOperationLog
.
setOrderId
(
orderId
);
orderOperationLog
.
setOrderId
(
orderId
);
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderRefundController.java
View file @
2b05019f
...
@@ -7,6 +7,8 @@ import com.soss.common.core.domain.model.LoginUser;
...
@@ -7,6 +7,8 @@ import com.soss.common.core.domain.model.LoginUser;
import
com.soss.common.core.page.TableDataInfo
;
import
com.soss.common.core.page.TableDataInfo
;
import
com.soss.common.enums.BusinessType
;
import
com.soss.common.enums.BusinessType
;
import
com.soss.common.enums.RefundState
;
import
com.soss.common.enums.RefundState
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
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.Order
;
...
@@ -46,20 +48,29 @@ public class OrderRefundController extends BaseController
...
@@ -46,20 +48,29 @@ public class OrderRefundController extends BaseController
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:refund:list')"
)
@PreAuthorize
(
"@ss.hasPermi('system:refund:list')"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
OrderQuery
orderQuery
)
public
TableDataInfo
list
(
OrderQuery
orderQuery
)
{
{
startPage
();
startPage
();
List
<
OrderRefund
>
list
=
orderRefundService
.
selectOrderRefundList
(
orderQuery
);
List
<
OrderRefund
>
list
=
orderRefundService
.
selectOrderRefundList
(
orderQuery
);
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
/**
/**
* 查询订单退款列表
*/
@GetMapping
(
"/list/{orderId}"
)
public
AjaxResult
listByOrderId
(
@PathVariable
Long
orderId
)
{
OrderRefund
or
=
new
OrderRefund
();
or
.
setOrderId
(
orderId
);
List
<
OrderRefund
>
list
=
orderRefundService
.
selectOrderRefundList
(
or
);
return
AjaxResult
.
success
(
list
);
}
/**
* 获取订单退款详细信息
* 获取订单退款详细信息
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:refund:query')"
)
@PreAuthorize
(
"@ss.hasPermi('system:refund:query')"
)
@GetMapping
(
value
=
"/{id}"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
{
{
return
AjaxResult
.
success
(
orderRefundService
.
selectOrderRefundById
(
id
));
return
AjaxResult
.
success
(
orderRefundService
.
selectOrderRefundById
(
id
));
}
}
...
@@ -70,8 +81,13 @@ public class OrderRefundController extends BaseController
...
@@ -70,8 +81,13 @@ public class OrderRefundController extends BaseController
@PostMapping
@PostMapping
public
AjaxResult
add
(
HttpServletRequest
request
,
@RequestBody
OrderRefund
orderRefund
)
{
public
AjaxResult
add
(
HttpServletRequest
request
,
@RequestBody
OrderRefund
orderRefund
)
{
Assert
.
notNull
(
orderRefund
.
getRefundAmount
(),
"退款金额还未传递"
);
Assert
.
notNull
(
orderRefund
.
getRefundAmount
(),
"退款金额还未传递"
);
Assert
.
notEmpty
(
orderRefund
.
getOrderDetailIds
(),
"退款订单明细ID还未传递"
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
if
(
loginUser
==
null
)
{
throw
new
ServiceException
(
"请先登录"
);
}
if
(
StringUtils
.
isEmpty
(
loginUser
.
getOpenId
()))
{
Assert
.
notEmpty
(
orderRefund
.
getOrderDetailIds
(),
"退款订单明细ID还未传递"
);
}
orderRefund
.
setCreateUserName
(
loginUser
.
getUsername
());
orderRefund
.
setCreateUserName
(
loginUser
.
getUsername
());
AjaxResult
ajaxResult
=
orderRefundService
.
insertOrderRefund
(
orderRefund
);
AjaxResult
ajaxResult
=
orderRefundService
.
insertOrderRefund
(
orderRefund
);
...
@@ -92,7 +108,7 @@ public class OrderRefundController extends BaseController
...
@@ -92,7 +108,7 @@ public class OrderRefundController extends BaseController
@PostMapping
(
"/refund"
)
@PostMapping
(
"/refund"
)
public
void
refund
(){
public
void
refund
(){
Order
order
=
orderService
.
selectOrderById
(
"98"
);
Order
order
=
orderService
.
selectOrderById
(
98L
);
int
totalFee
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
int
totalFee
=
order
.
getAmount
().
movePointRight
(
2
).
intValue
();
weixinService
.
refund
(
order
.
getOrderNo
(),
order
.
getOrderNo
()+
"1"
,
totalFee
,
totalFee
);
weixinService
.
refund
(
order
.
getOrderNo
(),
order
.
getOrderNo
()+
"1"
,
totalFee
,
totalFee
);
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/WechatMessageController.java
View file @
2b05019f
package
com
.
soss
.
web
.
controller
.
coffee
;
package
com
.
soss
.
web
.
controller
.
coffee
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.soss.common.core.domain.BaseEntity
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.framework.web.service.TokenService
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.soss.common.annotation.Log
;
import
com.soss.common.annotation.Log
;
import
com.soss.common.core.controller.BaseController
;
import
com.soss.common.core.controller.BaseController
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.BaseEntity
;
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.enums.BusinessType
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.poi.ExcelUtil
;
import
com.soss.framework.web.service.TokenService
;
import
com.soss.system.domain.WechatMessage
;
import
com.soss.system.domain.WechatMessage
;
import
com.soss.system.service.IWechatMessageService
;
import
com.soss.system.service.IWechatMessageService
;
import
com.soss.common.utils.poi.ExcelUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.soss.common.core.page.TableDataInfo
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
/**
* 小程序信息发送Controller
* 小程序信息发送Controller
...
@@ -49,6 +43,9 @@ public class WechatMessageController extends BaseController
...
@@ -49,6 +43,9 @@ public class WechatMessageController extends BaseController
{
{
WechatMessage
wechatMessage
=
new
WechatMessage
();
WechatMessage
wechatMessage
=
new
WechatMessage
();
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
if
(
loginUser
==
null
)
{
throw
new
ServiceException
(
"请先登录"
);
}
wechatMessage
.
setUserId
(
loginUser
.
getOpenId
());
wechatMessage
.
setUserId
(
loginUser
.
getOpenId
());
startPage
();
startPage
();
...
...
soss-framework/src/main/java/com/soss/framework/web/service/MachineSericeImpl.java
View file @
2b05019f
...
@@ -36,7 +36,7 @@ public class MachineSericeImpl {
...
@@ -36,7 +36,7 @@ public class MachineSericeImpl {
jsonObjects
.
add
(
jsonObject
);
jsonObjects
.
add
(
jsonObject
);
Long
skuId
=
detail
.
getSkuId
();
Long
skuId
=
detail
.
getSkuId
();
String
num
=
detail
.
getNum
();
String
num
=
detail
.
getNum
();
String
amount
=
detail
.
get
View
Amount
().
stripTrailingZeros
().
toString
();
String
amount
=
detail
.
get
Ori
Amount
().
stripTrailingZeros
().
toString
();
String
realAmount
=
detail
.
getRealAmount
().
stripTrailingZeros
().
toString
();
String
realAmount
=
detail
.
getRealAmount
().
stripTrailingZeros
().
toString
();
jsonObject
.
put
(
"skuID"
,
skuId
);
jsonObject
.
put
(
"skuID"
,
skuId
);
jsonObject
.
put
(
"skuCount"
,
num
);
jsonObject
.
put
(
"skuCount"
,
num
);
...
...
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
View file @
2b05019f
...
@@ -185,17 +185,6 @@ public class WeixinServiceImpl {
...
@@ -185,17 +185,6 @@ public class WeixinServiceImpl {
return
new
String
(
cipher
.
doFinal
(
encData
),
"UTF-8"
);
return
new
String
(
cipher
.
doFinal
(
encData
),
"UTF-8"
);
}
}
public
Map
orderQuery
()
{
public
Map
orderQuery
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
@@ -475,7 +464,7 @@ public class WeixinServiceImpl {
...
@@ -475,7 +464,7 @@ public class WeixinServiceImpl {
try
{
try
{
wxPayRefundNotifyResult
=
wxPayService
.
parseRefundNotifyResult
(
xmlData
);
wxPayRefundNotifyResult
=
wxPayService
.
parseRefundNotifyResult
(
xmlData
);
}
catch
(
WxPayException
e
)
{
}
catch
(
WxPayException
e
)
{
log
.
error
(
"退款失败
,失败信息:{}
"
,
e
);
log
.
error
(
"退款失败"
,
e
);
return
WxPayNotifyResponse
.
fail
(
"退款失败"
);
return
WxPayNotifyResponse
.
fail
(
"退款失败"
);
}
}
//判断你返回状态信息是否正确
//判断你返回状态信息是否正确
...
...
soss-system/src/main/java/com/soss/system/domain/Customer.java
View file @
2b05019f
...
@@ -7,6 +7,7 @@ import lombok.Data;
...
@@ -7,6 +7,7 @@ import lombok.Data;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -54,20 +55,33 @@ public class Customer extends BaseEntity
...
@@ -54,20 +55,33 @@ public class Customer extends BaseEntity
private
List
<
Order
>
cancelOrder
;
private
List
<
Order
>
cancelOrder
;
private
String
allow
;
@ApiModelProperty
(
"用户授权发送消息1:0-未授权 1-授权"
)
private
Boolean
sendMsgFlag1
;
@ApiModelProperty
(
"用户授权发送消息2:0-未授权 1-授权"
)
private
Boolean
sendMsgFlag2
;
@ApiModelProperty
(
"用户授权发送消息3:0-未授权 1-授权"
)
private
Boolean
sendMsgFlag3
;
@ApiModelProperty
(
"记住标识:true-记住选择"
)
private
Boolean
rememberFlag
;
@ApiModelProperty
(
"用户授权有效期,空则永久有效"
)
private
LocalDateTime
flagExpireDate
;
private
List
<
Order
>
refundOrder
;
private
List
<
Order
>
refundOrder
;
private
List
<
Order
>
normalOrder
;
private
List
<
Order
>
normalOrder
;
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"id"
,
getId
())
.
append
(
"userName"
,
getUserName
())
.
append
(
"userName"
,
getUserName
())
.
append
(
"phone"
,
getPhone
())
.
append
(
"phone"
,
getPhone
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"headSculpturePath"
,
getHeadSculpturePath
())
.
append
(
"headSculpturePath"
,
getHeadSculpturePath
())
.
append
(
"soucre"
,
getSoucre
())
.
append
(
"soucre"
,
getSoucre
())
.
toString
();
.
toString
();
}
}
}
}
soss-system/src/main/java/com/soss/system/domain/OrderDetail.java
View file @
2b05019f
...
@@ -7,7 +7,6 @@ import lombok.Data;
...
@@ -7,7 +7,6 @@ import lombok.Data;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -18,12 +17,12 @@ import java.util.Date;
...
@@ -18,12 +17,12 @@ import java.util.Date;
* @date 2022-04-28
* @date 2022-04-28
*/
*/
@Data
@Data
public
class
OrderDetail
implements
Serializable
{
public
class
OrderDetail
{
/**
/**
* 主键
* 主键
*/
*/
private
Stri
ng
id
;
private
Lo
ng
id
;
/**
/**
* 订单ID
* 订单ID
...
@@ -56,9 +55,14 @@ public class OrderDetail implements Serializable {
...
@@ -56,9 +55,14 @@ public class OrderDetail implements Serializable {
private
String
num
;
private
String
num
;
/**
/**
*
展示金额
*
单价
*/
*/
private
BigDecimal
viewAmount
;
private
BigDecimal
unitPrice
;
/**
* 原价总额
*/
private
BigDecimal
oriAmount
;
/**
/**
* 应付金额
* 应付金额
...
@@ -133,7 +137,7 @@ public class OrderDetail implements Serializable {
...
@@ -133,7 +137,7 @@ public class OrderDetail implements Serializable {
.
append
(
"goodsName"
,
getGoodsName
())
.
append
(
"goodsName"
,
getGoodsName
())
.
append
(
"machineId"
,
getMachineId
())
.
append
(
"machineId"
,
getMachineId
())
.
append
(
"num"
,
getNum
())
.
append
(
"num"
,
getNum
())
.
append
(
"
viewAmount"
,
getView
Amount
())
.
append
(
"
oriPrice"
,
getOri
Amount
())
.
append
(
"amountShould"
,
getAmountShould
())
.
append
(
"amountShould"
,
getAmountShould
())
.
append
(
"couponAmount"
,
getCouponAmount
())
.
append
(
"couponAmount"
,
getCouponAmount
())
.
append
(
"realAmount"
,
getRealAmount
())
.
append
(
"realAmount"
,
getRealAmount
())
...
...
soss-system/src/main/java/com/soss/system/domain/OrderOperationLog.java
View file @
2b05019f
package
com
.
soss
.
system
.
domain
;
package
com
.
soss
.
system
.
domain
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.core.domain.BaseEntity
;
import
com.soss.common.core.domain.BaseEntity
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.util.Date
;
/**
/**
* 【请填写功能名称】对象 order_operation_log
* 【请填写功能名称】对象 order_operation_log
...
@@ -14,6 +15,7 @@ import com.soss.common.core.domain.BaseEntity;
...
@@ -14,6 +15,7 @@ import com.soss.common.core.domain.BaseEntity;
* @author zxq
* @author zxq
* @date 2022-05-17
* @date 2022-05-17
*/
*/
@Data
public
class
OrderOperationLog
extends
BaseEntity
public
class
OrderOperationLog
extends
BaseEntity
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -44,71 +46,7 @@ public class OrderOperationLog extends BaseEntity
...
@@ -44,71 +46,7 @@ public class OrderOperationLog extends BaseEntity
/** $column.columnComment */
/** $column.columnComment */
@Excel
(
name
=
"${comment}"
,
readConverterExp
=
"$column.readConverterExp()"
)
@Excel
(
name
=
"${comment}"
,
readConverterExp
=
"$column.readConverterExp()"
)
private
String
orderId
;
private
Long
orderId
;
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setOperation
(
String
operation
)
{
this
.
operation
=
operation
;
}
public
String
getOperation
()
{
return
operation
;
}
public
void
setCreateAt
(
Date
createAt
)
{
this
.
createAt
=
createAt
;
}
public
Date
getCreateAt
()
{
return
createAt
;
}
public
void
setOperationUser
(
String
operationUser
)
{
this
.
operationUser
=
operationUser
;
}
public
String
getOperationUser
()
{
return
operationUser
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setOrderId
(
String
orderId
)
{
this
.
orderId
=
orderId
;
}
public
String
getOrderId
()
{
return
orderId
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
...
...
soss-system/src/main/java/com/soss/system/domain/OrderRefund.java
View file @
2b05019f
...
@@ -28,7 +28,7 @@ public class OrderRefund extends BaseEntity
...
@@ -28,7 +28,7 @@ public class OrderRefund extends BaseEntity
/** 订单ID */
/** 订单ID */
@Excel
(
name
=
"订单ID"
)
@Excel
(
name
=
"订单ID"
)
private
Stri
ng
orderId
;
private
Lo
ng
orderId
;
/** 退款金额 */
/** 退款金额 */
@Excel
(
name
=
"退款金额"
)
@Excel
(
name
=
"退款金额"
)
...
@@ -67,6 +67,9 @@ public class OrderRefund extends BaseEntity
...
@@ -67,6 +67,9 @@ public class OrderRefund extends BaseEntity
@ApiModelProperty
(
"退款明细id集合"
)
@ApiModelProperty
(
"退款明细id集合"
)
private
List
<
Long
>
orderDetailIds
;
private
List
<
Long
>
orderDetailIds
;
@ApiModelProperty
(
"退款订单明细"
)
private
List
<
OrderDetail
>
orderDetails
;
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
soss-system/src/main/java/com/soss/system/mapper/CouponUserMapper.java
View file @
2b05019f
...
@@ -64,7 +64,7 @@ public interface CouponUserMapper {
...
@@ -64,7 +64,7 @@ public interface CouponUserMapper {
* @param nowTime
* @param nowTime
* @return
* @return
*/
*/
List
<
CouponVo
>
listCustAvailableCoupon
(
@Param
(
"custId"
)
String
custId
,
@Param
(
"coupon
Id"
)
Integer
coupon
Id
,
@Param
(
"nowTime"
)
LocalDateTime
nowTime
);
List
<
CouponVo
>
listCustAvailableCoupon
(
@Param
(
"custId"
)
String
custId
,
@Param
(
"coupon
UserId"
)
Integer
couponUser
Id
,
@Param
(
"nowTime"
)
LocalDateTime
nowTime
);
/**
/**
* 查询用户优惠券列表
* 查询用户优惠券列表
...
...
soss-system/src/main/java/com/soss/system/mapper/CustomerMapper.java
View file @
2b05019f
package
com
.
soss
.
system
.
mapper
;
package
com
.
soss
.
system
.
mapper
;
import
java.util.List
;
import
com.soss.system.domain.Customer
;
import
com.soss.system.domain.Customer
;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
import
com.soss.system.domain.vo.customer.CustomerResultVo
;
import
com.soss.system.domain.vo.customer.CustomerResultVo
;
import
java.util.List
;
/**
/**
* 用户信息Mapper接口
* 用户信息Mapper接口
*
*
...
@@ -39,15 +40,20 @@ public interface CustomerMapper
...
@@ -39,15 +40,20 @@ public interface CustomerMapper
/**
/**
* 修改用户信息
* 修改用户信息
*
*
* @param customer 用户信息
* @param customer 用户信息
* @return 结果
* @return 结果
*/
*/
public
int
updateCustomer
(
Customer
customer
);
public
int
updateCustomer
(
Customer
customer
);
/**
/**
* 修改用户授权信息
*/
int
updateSendMsgFlag
(
Customer
customer
);
/**
* 删除用户信息
* 删除用户信息
*
*
* @param id 用户信息主键
* @param id 用户信息主键
* @return 结果
* @return 结果
*/
*/
...
...
soss-system/src/main/java/com/soss/system/mapper/OrderDetailMapper.java
View file @
2b05019f
package
com
.
soss
.
system
.
mapper
;
package
com
.
soss
.
system
.
mapper
;
import
com.soss.system.domain.OrderDetail
;
import
com.soss.system.domain.OrderDetail
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -26,7 +27,7 @@ public interface OrderDetailMapper {
...
@@ -26,7 +27,7 @@ public interface OrderDetailMapper {
* @param ids
* @param ids
* @return
* @return
*/
*/
List
<
OrderDetail
>
listDetailByIds
(
List
<
Long
>
ids
);
List
<
OrderDetail
>
listDetailByIds
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
/**
/**
* 查询订单详情列表
* 查询订单详情列表
...
@@ -66,9 +67,9 @@ public interface OrderDetailMapper {
...
@@ -66,9 +67,9 @@ public interface OrderDetailMapper {
* @param ids 需要删除的数据主键集合
* @param ids 需要删除的数据主键集合
* @return 结果
* @return 结果
*/
*/
public
int
deleteOrderDetailByIds
(
String
[]
ids
);
int
deleteOrderDetailByIds
(
String
[]
ids
);
void
bindRefund
(
Long
refundId
,
List
<
Long
>
ids
);
void
bindRefund
(
@Param
(
"refundId"
)
Long
refundId
,
@Param
(
"ids"
)
List
<
Long
>
ids
);
void
updateRefundState
(
Long
refundId
,
Date
refundTime
);
void
updateRefundState
(
@Param
(
"refundId"
)
Long
refundId
,
@Param
(
"refundTime"
)
Date
refundTime
);
}
}
soss-system/src/main/java/com/soss/system/mapper/OrderMapper.java
View file @
2b05019f
...
@@ -21,7 +21,7 @@ public interface OrderMapper {
...
@@ -21,7 +21,7 @@ public interface OrderMapper {
* @param id 订单主键
* @param id 订单主键
* @return 订单
* @return 订单
*/
*/
public
Order
selectOrderById
(
Stri
ng
id
);
public
Order
selectOrderById
(
Lo
ng
id
);
/**
/**
* 查询订单列表
* 查询订单列表
...
@@ -53,7 +53,7 @@ public interface OrderMapper {
...
@@ -53,7 +53,7 @@ public interface OrderMapper {
* @param id 订单主键
* @param id 订单主键
* @return 结果
* @return 结果
*/
*/
public
int
deleteOrderById
(
Stri
ng
id
);
public
int
deleteOrderById
(
Lo
ng
id
);
/**
/**
* 批量删除订单
* 批量删除订单
...
...
soss-system/src/main/java/com/soss/system/schedule/OrderSchedule.java
View file @
2b05019f
...
@@ -46,7 +46,7 @@ public class OrderSchedule {
...
@@ -46,7 +46,7 @@ public class OrderSchedule {
OrderOperationLog
operationLog
=
new
OrderOperationLog
();
OrderOperationLog
operationLog
=
new
OrderOperationLog
();
operationLog
.
setOperationUser
(
"系统"
);
operationLog
.
setOperationUser
(
"系统"
);
operationLog
.
setStatus
(
"已取消"
);
operationLog
.
setStatus
(
"已取消"
);
operationLog
.
setOrderId
(
String
.
valueOf
(
order
.
getId
()
));
operationLog
.
setOrderId
(
order
.
getId
(
));
operationLog
.
setContent
(
"超时自动取消"
);
operationLog
.
setContent
(
"超时自动取消"
);
operationLog
.
setCreateAt
(
new
Date
());
operationLog
.
setCreateAt
(
new
Date
());
operationLog
.
setOperation
(
"取消订单"
);
operationLog
.
setOperation
(
"取消订单"
);
...
...
soss-system/src/main/java/com/soss/system/service/ICouponUserService.java
View file @
2b05019f
...
@@ -23,13 +23,11 @@ public interface ICouponUserService {
...
@@ -23,13 +23,11 @@ public interface ICouponUserService {
int
getCustAvailableCouponCnt
(
String
custId
);
int
getCustAvailableCouponCnt
(
String
custId
);
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
,
Integer
couponId
);
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
,
Integer
coupon
User
Id
);
List
<
CouponVo
>
listCustCoupons
(
String
custId
,
Boolean
effectiveFlag
);
List
<
CouponVo
>
listCustCoupons
(
String
custId
,
Boolean
effectiveFlag
);
List
<
CouponUserVo
>
selectCouponUserList
(
CouponUser
couponUser
);
List
<
CouponUserVo
>
selectCouponUserList
(
CouponUser
couponUser
);
void
resovleCouponFitable
(
List
<
CouponVo
>
couponVos
,
Order
order
);
void
resovleCouponFitable
(
List
<
CouponVo
>
couponVos
,
Order
order
);
void
useCoupon
(
Integer
id
);
}
}
soss-system/src/main/java/com/soss/system/service/ICustomerService.java
View file @
2b05019f
package
com
.
soss
.
system
.
service
;
package
com
.
soss
.
system
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.soss.system.domain.Customer
;
import
com.soss.system.domain.Customer
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
import
com.soss.system.domain.vo.customer.CustomerResultVo
;
import
com.soss.system.domain.vo.customer.CustomerResultVo
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 用户信息Service接口
* 用户信息Service接口
*
*
...
@@ -51,6 +51,8 @@ public interface ICustomerService
...
@@ -51,6 +51,8 @@ public interface ICustomerService
*/
*/
public
int
updateCustomer
(
Customer
customer
);
public
int
updateCustomer
(
Customer
customer
);
int
updateSendMsgFlag
(
Customer
customer
);
void
updateCustBirthday
(
Customer
customer
);
void
updateCustBirthday
(
Customer
customer
);
/**
/**
...
@@ -69,7 +71,5 @@ public interface ICustomerService
...
@@ -69,7 +71,5 @@ public interface ICustomerService
*/
*/
public
int
deleteCustomerById
(
Long
id
);
public
int
deleteCustomerById
(
Long
id
);
Integer
allow
(
String
openId
,
String
allow
);
Map
<
String
,
Object
>
getCustSimpleOrderStat
(
String
custId
);
Map
<
String
,
Object
>
getCustSimpleOrderStat
(
String
custId
);
}
}
soss-system/src/main/java/com/soss/system/service/IOrderService.java
View file @
2b05019f
...
@@ -21,7 +21,7 @@ public interface IOrderService
...
@@ -21,7 +21,7 @@ public interface IOrderService
* @param id 订单主键
* @param id 订单主键
* @return 订单
* @return 订单
*/
*/
public
Order
selectOrderById
(
Stri
ng
id
);
Order
selectOrderById
(
Lo
ng
id
);
/**
/**
* 查询订单列表
* 查询订单列表
...
@@ -37,9 +37,10 @@ public interface IOrderService
...
@@ -37,9 +37,10 @@ public interface IOrderService
*
*
* @param request
* @param request
* @param order 订单
* @param order 订单
* @param couponUserId
* @return 结果
* @return 结果
*/
*/
public
AjaxResult
insertOrder
(
LoginUser
request
,
Order
order
);
public
AjaxResult
insertOrder
(
LoginUser
request
,
Order
order
,
Integer
couponUserId
);
void
checkShopInfo
(
Order
order
);
void
checkShopInfo
(
Order
order
);
...
@@ -51,25 +52,9 @@ public interface IOrderService
...
@@ -51,25 +52,9 @@ public interface IOrderService
*/
*/
public
int
updateOrder
(
Order
order
);
public
int
updateOrder
(
Order
order
);
/**
* 批量删除订单
*
* @param ids 需要删除的订单主键集合
* @return 结果
*/
public
int
deleteOrderByIds
(
String
[]
ids
);
/**
* 删除订单信息
*
* @param id 订单主键
* @return 结果
*/
public
int
deleteOrderById
(
String
id
);
AjaxResult
check
(
Order
order
);
AjaxResult
check
(
Order
order
);
List
<
Order
>
getMyOrder
(
String
openId
);
List
<
Order
>
getMyOrder
(
String
openId
);
int
cancel
(
Stri
ng
orderId
);
int
cancel
(
Lo
ng
orderId
);
}
}
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
View file @
2b05019f
...
@@ -2,7 +2,6 @@ package com.soss.system.service.impl;
...
@@ -2,7 +2,6 @@ package com.soss.system.service.impl;
import
com.soss.common.enums.CouponCategoryType
;
import
com.soss.common.enums.CouponCategoryType
;
import
com.soss.common.enums.CouponState
;
import
com.soss.common.enums.CouponState
;
import
com.soss.common.enums.CouponUserState
;
import
com.soss.common.enums.CouponUserType
;
import
com.soss.common.enums.CouponUserType
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.DateUtils
;
import
com.soss.common.utils.DateUtils
;
...
@@ -23,6 +22,7 @@ import org.springframework.util.CollectionUtils;
...
@@ -23,6 +22,7 @@ import org.springframework.util.CollectionUtils;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -127,12 +127,12 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -127,12 +127,12 @@ public class CouponUserServiceImpl implements ICouponUserService {
* 查询用户可用优惠券列表
* 查询用户可用优惠券列表
*
*
* @param custId
* @param custId
* @param couponId
* @param coupon
User
Id
* @return
* @return
*/
*/
@Override
@Override
public
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
,
Integer
couponId
)
{
public
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
,
Integer
coupon
User
Id
)
{
List
<
CouponVo
>
couponVos
=
couponUserMapper
.
listCustAvailableCoupon
(
custId
,
couponId
,
LocalDateTime
.
now
());
List
<
CouponVo
>
couponVos
=
couponUserMapper
.
listCustAvailableCoupon
(
custId
,
coupon
User
Id
,
LocalDateTime
.
now
());
transferTabIds
(
couponVos
);
transferTabIds
(
couponVos
);
return
couponVos
;
return
couponVos
;
}
}
...
@@ -175,12 +175,6 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -175,12 +175,6 @@ public class CouponUserServiceImpl implements ICouponUserService {
checkGoodsFitable
(
couponVos
,
order
.
getOrderDetails
());
checkGoodsFitable
(
couponVos
,
order
.
getOrderDetails
());
}
}
@Override
public
void
useCoupon
(
Integer
id
)
{
CouponUser
couponUser
=
new
CouponUser
(
id
,
CouponUserState
.
USED
.
getState
());
couponUserMapper
.
updateCouponUser
(
couponUser
);
}
private
void
checkGoodsFitable
(
List
<
CouponVo
>
couponVos
,
List
<
OrderDetail
>
orderDetails
)
{
private
void
checkGoodsFitable
(
List
<
CouponVo
>
couponVos
,
List
<
OrderDetail
>
orderDetails
)
{
Assert
.
notEmpty
(
orderDetails
,
"商品明细还未传递"
);
Assert
.
notEmpty
(
orderDetails
,
"商品明细还未传递"
);
List
<
Long
>
skuIds
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getSkuId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
skuIds
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getSkuId
).
collect
(
Collectors
.
toList
());
...
@@ -192,10 +186,17 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -192,10 +186,17 @@ public class CouponUserServiceImpl implements ICouponUserService {
List
<
Goods
>
goods
=
goodsMapper
.
selectGoodsByIds
(
goodsIds
);
List
<
Goods
>
goods
=
goodsMapper
.
selectGoodsByIds
(
goodsIds
);
Assert
.
notEmpty
(
goods
,
"未查询到匹配的商品信息[id="
+
goodsIds
+
"]"
);
Assert
.
notEmpty
(
goods
,
"未查询到匹配的商品信息[id="
+
goodsIds
+
"]"
);
// sku的ID和价格字典
// sku的ID和价格字典
Map
<
Long
,
BigDecimal
>
skuIdPriceMap
=
goodsSkus
.
stream
().
collect
(
Collectors
.
toMap
(
GoodsSku:
:
getId
,
GoodsSku:
:
getDiscount
));
Map
<
Long
,
GoodsSku
>
skuMap
=
goodsSkus
.
stream
().
collect
(
Collectors
.
toMap
(
GoodsSku:
:
getId
,
Function
.
identity
()));
// 订单明细设置
orderDetails
.
forEach
(
orderDetail
->
{
GoodsSku
sku
=
skuMap
.
get
(
orderDetail
.
getSkuId
());
BigDecimal
skuNum
=
new
BigDecimal
(
orderDetail
.
getNum
());
orderDetail
.
setOriAmount
(
skuNum
.
multiply
(
sku
.
getPrice
()));
orderDetail
.
setUnitPrice
(
sku
.
getDiscount
());
orderDetail
.
setAmountShould
(
skuNum
.
multiply
(
sku
.
getDiscount
()));
});
// 订单总额
// 订单总额
BigDecimal
orderTotalAmount
=
orderDetails
.
stream
().
map
(
orderDetail
->
BigDecimal
orderTotalAmount
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getAmountShould
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
new
BigDecimal
(
orderDetail
.
getNum
()).
multiply
(
skuIdPriceMap
.
get
(
orderDetail
.
getSkuId
()))).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
couponVos
.
stream
().
filter
(
couponVo
->
StringUtils
.
isEmpty
(
couponVo
.
getNotFitableDesc
())).
forEach
(
couponVo
->
{
couponVos
.
stream
().
filter
(
couponVo
->
StringUtils
.
isEmpty
(
couponVo
.
getNotFitableDesc
())).
forEach
(
couponVo
->
{
/** 可用饮品范围的判断 */
/** 可用饮品范围的判断 */
List
<
Long
>
fitCouponGoodsIdList
=
goods
.
stream
().
filter
(
good
->
List
<
Long
>
fitCouponGoodsIdList
=
goods
.
stream
().
filter
(
good
->
...
@@ -218,9 +219,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -218,9 +219,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
couponVo
.
setCouponAmount
(
couponVo
.
getPriceDiscount
().
min
(
orderTotalAmount
));
couponVo
.
setCouponAmount
(
couponVo
.
getPriceDiscount
().
min
(
orderTotalAmount
));
}
else
{
}
else
{
List
<
OrderDetail
>
fitOrderDetails
=
orderDetails
.
stream
().
filter
(
orderDetail
->
fitCouponGoodsIdList
.
contains
(
orderDetail
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
List
<
OrderDetail
>
fitOrderDetails
=
orderDetails
.
stream
().
filter
(
orderDetail
->
fitCouponGoodsIdList
.
contains
(
orderDetail
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
Map
<
Long
,
BigDecimal
>
fitSkuMap
=
fitOrderDetails
.
stream
().
collect
(
Collectors
.
toMap
(
OrderDetail:
:
getSkuId
,
orderDetail
->
BigDecimal
fitGoodsAmount
=
fitOrderDetails
.
stream
().
map
(
OrderDetail:
:
getAmountShould
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
new
BigDecimal
(
orderDetail
.
getNum
()).
multiply
(
skuIdPriceMap
.
get
(
orderDetail
.
getSkuId
()))));
BigDecimal
fitGoodsAmount
=
fitSkuMap
.
values
().
stream
().
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
if
(
couponVo
.
getPriceLimit
()
!=
null
&&
couponVo
.
getPriceLimit
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
&&
couponVo
.
getPriceLimit
().
compareTo
(
fitGoodsAmount
)
>
0
)
{
if
(
couponVo
.
getPriceLimit
()
!=
null
&&
couponVo
.
getPriceLimit
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
&&
couponVo
.
getPriceLimit
().
compareTo
(
fitGoodsAmount
)
>
0
)
{
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
couponVo
.
setNotFitableDesc
(
"未达到满减要求"
);
couponVo
.
setNotFitableDesc
(
"未达到满减要求"
);
...
@@ -229,35 +228,40 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -229,35 +228,40 @@ public class CouponUserServiceImpl implements ICouponUserService {
}
}
}
}
this
.
wrapperCouponAmount
(
couponVo
,
fitOrderDetails
,
fitSkuMap
,
fitGoodsAmount
);
this
.
wrapperCouponAmount
(
couponVo
,
fitOrderDetails
,
fitGoodsAmount
);
Map
<
Long
,
BigDecimal
>
couponAmountMap
=
couponVo
.
getCouponAmountMap
();
orderDetails
.
forEach
(
orderDetail
->
{
BigDecimal
couponAmount
=
couponAmountMap
.
get
(
orderDetail
.
getSkuId
());
orderDetail
.
setCouponAmount
(
couponAmount
==
null
?
BigDecimal
.
ZERO
:
couponAmount
.
negate
());
orderDetail
.
setRealAmount
(
orderDetail
.
getAmountShould
().
add
(
orderDetail
.
getCouponAmount
()));
});
}
}
});
});
}
}
private
void
wrapperCouponAmount
(
CouponVo
couponVo
,
List
<
OrderDetail
>
fitOrderDetails
,
Map
<
Long
,
BigDecimal
>
fitSkuMap
,
BigDecimal
fitGoodsAmount
)
{
private
void
wrapperCouponAmount
(
CouponVo
couponVo
,
List
<
OrderDetail
>
fitOrderDetails
,
BigDecimal
fitGoodsAmount
)
{
Map
<
Long
,
BigDecimal
>
couponAmountMap
=
new
HashMap
<>();
Map
<
Long
,
BigDecimal
>
couponAmountMap
=
new
HashMap
<>();
if
(
couponVo
.
getOrderLimit
()
!=
null
&&
couponVo
.
getOrderLimit
())
{
// 单杯
if
(
couponVo
.
getOrderLimit
()
!=
null
&&
couponVo
.
getOrderLimit
())
{
// 单杯
BigDecimal
discountAmount
=
fitSkuMap
.
values
().
stream
().
max
(
BigDecimal:
:
compareTo
).
get
();
OrderDetail
orderDetail
=
fitOrderDetails
.
stream
().
max
(
Comparator
.
comparing
(
OrderDetail:
:
getUnitPrice
)
).
get
();
Long
couponSkuId
=
fitOrderDetails
.
stream
().
filter
(
orderDetail
->
fitSkuMap
.
get
(
orderDetail
.
getSkuId
()).
compareTo
(
BigDecimal
.
ZERO
)
==
0
).
findFirst
().
get
().
getSkuId
();
BigDecimal
discountAmount
=
orderDetail
.
getUnitPrice
();
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
couponVo
.
setCouponAmount
(
discountAmount
.
subtract
(
this
.
getDiscountAmount
(
discountAmount
,
couponVo
.
getPriceDiscount
())
));
discountAmount
=
this
.
getDiscountAmount
(
discountAmount
,
couponVo
.
getPriceDiscount
(
));
}
else
{
// 免单
}
/*
else { // 免单
couponVo
.
setCouponAmount
(
discountAmount
);
}*/
}
couponVo
.
setCouponAmount
(
discountAmount
);
couponAmountMap
.
put
(
couponSkuId
,
discountAmount
);
couponAmountMap
.
put
(
orderDetail
.
getSkuId
(),
couponVo
.
getCouponAmount
()
);
}
else
{
// 整单
}
else
{
// 整单
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
couponVo
.
setCouponAmount
(
this
.
getDiscountAmount
(
fitGoodsAmount
,
couponVo
.
getPriceDiscount
()));
couponVo
.
setCouponAmount
(
this
.
getDiscountAmount
(
fitGoodsAmount
,
couponVo
.
getPriceDiscount
()));
fitOrderDetails
.
forEach
(
orderDetail
->
orderDetail
.
setCouponAmount
(
this
.
getDiscountAmount
(
fitSkuMap
.
get
(
orderDetail
.
getSkuId
()
),
couponVo
.
getPriceDiscount
())));
fitOrderDetails
.
forEach
(
orderDetail
->
orderDetail
.
setCouponAmount
(
this
.
getDiscountAmount
(
orderDetail
.
getAmountShould
(
),
couponVo
.
getPriceDiscount
())));
// 订单明细优惠总和
// 订单明细优惠总和
BigDecimal
detailCouponSum
=
fitOrderDetails
.
stream
().
map
(
OrderDetail:
:
getCouponAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
detailCouponSum
=
fitOrderDetails
.
stream
().
map
(
OrderDetail:
:
getCouponAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
// 如果订单明细优惠总额大于订单总优惠金额,则将订单明细最后一条记录的优惠金额去掉差额
// 如果订单明细优惠总额大于订单总优惠金额,则将订单明细最后一条记录的优惠金额去掉差额
if
(
detailCouponSum
.
compareTo
(
couponVo
.
getCouponAmount
())
>
0
)
{
if
(
detailCouponSum
.
compareTo
(
couponVo
.
getCouponAmount
())
!=
0
)
{
OrderDetail
orderDetail
=
fitOrderDetails
.
get
(
fitOrderDetails
.
size
()
-
1
);
OrderDetail
orderDetail
=
fitOrderDetails
.
get
(
fitOrderDetails
.
size
()
-
1
);
orderDetail
.
setCouponAmount
(
orderDetail
.
getCouponAmount
().
add
(
couponVo
.
getCouponAmount
().
subtract
(
detailCouponSum
)));
orderDetail
.
setCouponAmount
(
orderDetail
.
getCouponAmount
().
add
(
couponVo
.
getCouponAmount
().
subtract
(
detailCouponSum
)));
}
}
fitOrderDetails
.
forEach
(
orderDetail
->
orderDetail
.
setCouponAmount
(
fitSkuMap
.
get
(
orderDetail
.
getSkuId
()).
subtract
(
orderDetail
.
getCouponAmount
())));
couponVo
.
setCouponAmount
(
fitGoodsAmount
.
subtract
(
couponVo
.
getCouponAmount
()));
}
else
{
// 免单
}
else
{
// 免单
couponVo
.
setCouponAmount
(
fitGoodsAmount
);
couponVo
.
setCouponAmount
(
fitGoodsAmount
);
}
}
...
@@ -299,6 +303,11 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -299,6 +303,11 @@ public class CouponUserServiceImpl implements ICouponUserService {
}
}
private
BigDecimal
getDiscountAmount
(
BigDecimal
amount
,
BigDecimal
priceDiscount
)
{
private
BigDecimal
getDiscountAmount
(
BigDecimal
amount
,
BigDecimal
priceDiscount
)
{
return
amount
.
multiply
(
priceDiscount
.
divide
(
BigDecimal
.
TEN
,
4
,
BigDecimal
.
ROUND_HALF_UP
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
min
(
amount
);
// 打折后的价格
BigDecimal
priceAfterDiscount
=
amount
.
multiply
(
priceDiscount
.
divide
(
BigDecimal
.
TEN
,
4
,
BigDecimal
.
ROUND_HALF_UP
)).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
// 跟原价比取最小值
priceAfterDiscount
=
priceAfterDiscount
.
min
(
amount
);
// 获取优惠金额
return
amount
.
subtract
(
priceAfterDiscount
);
}
}
}
}
soss-system/src/main/java/com/soss/system/service/impl/CustomerServiceImpl.java
View file @
2b05019f
...
@@ -11,9 +11,11 @@ import com.soss.system.mapper.CustomerMapper;
...
@@ -11,9 +11,11 @@ import com.soss.system.mapper.CustomerMapper;
import
com.soss.system.mapper.OrderMapper
;
import
com.soss.system.mapper.OrderMapper
;
import
com.soss.system.mapper.ShopMapper
;
import
com.soss.system.mapper.ShopMapper
;
import
com.soss.system.service.ICustomerService
;
import
com.soss.system.service.ICustomerService
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -51,17 +53,16 @@ public class CustomerServiceImpl implements ICustomerService
...
@@ -51,17 +53,16 @@ public class CustomerServiceImpl implements ICustomerService
{
{
Order
order
=
new
Order
();
Order
order
=
new
Order
();
order
.
setUserId
(
id
);
order
.
setUserId
(
id
);
List
<
String
>
normalStatus
=
Arrays
.
asList
(
OrderStatusConstant
.
PaidCancel
,
OrderStatusConstant
.
Unpaid
,
OrderStatusConstant
.
Paid
,
OrderStatusConstant
.
production
,
OrderStatusConstant
.
productionCompleted
,
OrderStatusConstant
.
Taking
,
OrderStatusConstant
.
completed
);
List
<
String
>
cancelStatus
=
Arrays
.
asList
(
OrderStatusConstant
.
PaidCancel
,
OrderStatusConstant
.
UnpaidCancel
,
OrderStatusConstant
.
productionCancel
,
OrderStatusConstant
.
productionCompletedCancel
);
List
<
String
>
refundStatus
=
Arrays
.
asList
(
OrderStatusConstant
.
refunding
,
OrderStatusConstant
.
refundFailed
,
OrderStatusConstant
.
PartialRefund
,
OrderStatusConstant
.
refund
);
List
<
Order
>
orders
=
null
;
List
<
Order
>
orders
=
null
;
List
<
String
>
statusList
;
if
(
"1"
.
equals
(
status
)){
if
(
"1"
.
equals
(
status
)){
orders
=
orderMapper
.
selectOrderByUserId
(
id
,
normalStatus
);
statusList
=
Arrays
.
asList
(
OrderStatusConstant
.
PaidCancel
,
OrderStatusConstant
.
Unpaid
,
OrderStatusConstant
.
Paid
,
OrderStatusConstant
.
production
,
OrderStatusConstant
.
productionCompleted
,
OrderStatusConstant
.
Taking
,
OrderStatusConstant
.
completed
);
}
else
if
(
"2"
.
equals
(
status
)){
}
else
if
(
"2"
.
equals
(
status
)){
orders
=
orderMapper
.
selectOrderByUserId
(
id
,
cancelStatus
);
statusList
=
Arrays
.
asList
(
OrderStatusConstant
.
PaidCancel
,
OrderStatusConstant
.
UnpaidCancel
,
OrderStatusConstant
.
productionCancel
,
OrderStatusConstant
.
productionCompletedCancel
);
}
else
{
}
else
{
orders
=
orderMapper
.
selectOrderByUserId
(
id
,
refundStatus
);
statusList
=
Arrays
.
asList
(
OrderStatusConstant
.
refunding
,
OrderStatusConstant
.
refundFailed
,
OrderStatusConstant
.
PartialRefund
,
OrderStatusConstant
.
refund
);
}
}
orders
=
orderMapper
.
selectOrderByUserId
(
id
,
statusList
);
for
(
Order
order1
:
orders
)
{
for
(
Order
order1
:
orders
)
{
order1
.
setShop
(
shopMapper
.
selectShopById
(
order1
.
getShopId
()));
order1
.
setShop
(
shopMapper
.
selectShopById
(
order1
.
getShopId
()));
}
}
...
@@ -106,6 +107,18 @@ public class CustomerServiceImpl implements ICustomerService
...
@@ -106,6 +107,18 @@ public class CustomerServiceImpl implements ICustomerService
return
customerMapper
.
updateCustomer
(
customer
);
return
customerMapper
.
updateCustomer
(
customer
);
}
}
/**
* 修改用户授权信息
*/
@Override
public
int
updateSendMsgFlag
(
Customer
customer
)
{
if
(!
BooleanUtils
.
isTrue
(
customer
.
getRememberFlag
()))
{
LocalDateTime
date
=
DateUtils
.
addDaysAndGetEnd
(
LocalDateTime
.
now
(),
6
);
customer
.
setFlagExpireDate
(
date
);
}
return
customerMapper
.
updateSendMsgFlag
(
customer
);
}
@Override
@Override
public
void
updateCustBirthday
(
Customer
customer
)
{
public
void
updateCustBirthday
(
Customer
customer
)
{
Customer
cust
=
customerMapper
.
selectCustomerById
(
customer
.
getId
());
Customer
cust
=
customerMapper
.
selectCustomerById
(
customer
.
getId
());
...
@@ -139,14 +152,6 @@ public class CustomerServiceImpl implements ICustomerService
...
@@ -139,14 +152,6 @@ public class CustomerServiceImpl implements ICustomerService
}
}
@Override
@Override
public
Integer
allow
(
String
openId
,
String
allow
)
{
Customer
customer
=
new
Customer
();
customer
.
setId
(
openId
);
customer
.
setAllow
(
"1"
);
return
customerMapper
.
updateCustomer
(
customer
);
}
@Override
public
Map
<
String
,
Object
>
getCustSimpleOrderStat
(
String
custId
)
{
public
Map
<
String
,
Object
>
getCustSimpleOrderStat
(
String
custId
)
{
return
orderMapper
.
getCustOrderSimpleStat
(
custId
);
return
orderMapper
.
getCustOrderSimpleStat
(
custId
);
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
View file @
2b05019f
...
@@ -135,7 +135,7 @@ public class MachineApiServiceImpl {
...
@@ -135,7 +135,7 @@ public class MachineApiServiceImpl {
public
String
updateOrder
(
JSONObject
jsonObject
)
{
public
String
updateOrder
(
JSONObject
jsonObject
)
{
Long
orderID
=
jsonObject
.
getLong
(
"orderId"
);
Long
orderID
=
jsonObject
.
getLong
(
"orderId"
);
String
status
=
jsonObject
.
getString
(
"status"
);
String
status
=
jsonObject
.
getString
(
"status"
);
Order
order1
=
orderService
.
selectById
(
String
.
valueOf
(
orderID
)
);
Order
order1
=
orderService
.
selectById
(
orderID
);
if
(
order1
==
null
){
if
(
order1
==
null
){
throw
new
ServiceException
(
"该订单不存在"
);
throw
new
ServiceException
(
"该订单不存在"
);
}
}
...
@@ -152,10 +152,10 @@ public class MachineApiServiceImpl {
...
@@ -152,10 +152,10 @@ public class MachineApiServiceImpl {
}
}
public
void
testOrder
(
Stri
ng
orderId
)
{
public
void
testOrder
(
Lo
ng
orderId
)
{
try
{
try
{
if
(
StringUtils
.
isEmpty
(
orderId
)
){
if
(
orderId
==
null
){
orderId
=
"8"
;
orderId
=
8L
;
}
}
Order
order
=
orderService
.
selectById
(
orderId
);
Order
order
=
orderService
.
selectById
(
orderId
);
OrderDetail
orderDetail
=
new
OrderDetail
();
OrderDetail
orderDetail
=
new
OrderDetail
();
...
@@ -194,7 +194,7 @@ public class MachineApiServiceImpl {
...
@@ -194,7 +194,7 @@ public class MachineApiServiceImpl {
jsonObject
.
put
(
"goodsId"
,
detail
.
getGoodsId
());
jsonObject
.
put
(
"goodsId"
,
detail
.
getGoodsId
());
jsonObject
.
put
(
"goodsName"
,
detail
.
getGoodsName
());
jsonObject
.
put
(
"goodsName"
,
detail
.
getGoodsName
());
jsonObject
.
put
(
"num"
,
Integer
.
parseInt
(
detail
.
getNum
()));
jsonObject
.
put
(
"num"
,
Integer
.
parseInt
(
detail
.
getNum
()));
jsonObject
.
put
(
"amount"
,
detail
.
get
View
Amount
());
jsonObject
.
put
(
"amount"
,
detail
.
get
Ori
Amount
());
jsonObject
.
put
(
"specRuleDetail"
,
detail
.
getSpecRuleDetail
());
jsonObject
.
put
(
"specRuleDetail"
,
detail
.
getSpecRuleDetail
());
jsonObject
.
put
(
"specRuleIds"
,
detail
.
getSpecRuleIds
());
jsonObject
.
put
(
"specRuleIds"
,
detail
.
getSpecRuleIds
());
jsonObject
.
put
(
"skuId"
,
detail
.
getSkuId
());
jsonObject
.
put
(
"skuId"
,
detail
.
getSkuId
());
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderOperationLogServiceImpl.java
View file @
2b05019f
...
@@ -60,7 +60,7 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
...
@@ -60,7 +60,7 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
public
int
insertOrderOperationLog
(
Order
order
)
public
int
insertOrderOperationLog
(
Order
order
)
{
{
OrderOperationLog
operationLog
=
new
OrderOperationLog
();
OrderOperationLog
operationLog
=
new
OrderOperationLog
();
operationLog
.
setOrderId
(
String
.
valueOf
(
order
.
getId
()
));
operationLog
.
setOrderId
(
order
.
getId
(
));
operationLog
.
setCreateAt
(
new
Date
());
operationLog
.
setCreateAt
(
new
Date
());
String
state
=
order
.
getState
();
String
state
=
order
.
getState
();
...
@@ -162,7 +162,7 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
...
@@ -162,7 +162,7 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
public
void
insertOrderOperationLog
(
OrderRefund
orderRefund
)
{
public
void
insertOrderOperationLog
(
OrderRefund
orderRefund
)
{
Order
order
=
orderRefund
.
getOrder
();
Order
order
=
orderRefund
.
getOrder
();
OrderOperationLog
operationLog
=
new
OrderOperationLog
();
OrderOperationLog
operationLog
=
new
OrderOperationLog
();
operationLog
.
setOrderId
(
String
.
valueOf
(
order
.
getId
()
));
operationLog
.
setOrderId
(
order
.
getId
(
));
operationLog
.
setCreateAt
(
new
Date
());
operationLog
.
setCreateAt
(
new
Date
());
if
(
StringUtils
.
isEmpty
(
orderRefund
.
getDesc
())){
if
(
StringUtils
.
isEmpty
(
orderRefund
.
getDesc
())){
operationLog
.
setStatus
(
"已退款"
);
operationLog
.
setStatus
(
"已退款"
);
...
@@ -182,7 +182,7 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
...
@@ -182,7 +182,7 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
public
void
insertOrderOperationLog
(
Order
order
,
ResultVo
resultVo
)
{
public
void
insertOrderOperationLog
(
Order
order
,
ResultVo
resultVo
)
{
OrderOperationLog
operationLog
=
new
OrderOperationLog
();
OrderOperationLog
operationLog
=
new
OrderOperationLog
();
operationLog
.
setOrderId
(
String
.
valueOf
(
order
.
getId
()
));
operationLog
.
setOrderId
(
order
.
getId
(
));
operationLog
.
setCreateAt
(
new
Date
());
operationLog
.
setCreateAt
(
new
Date
());
String
state
=
order
.
getState
();
String
state
=
order
.
getState
();
operationLog
.
setOperation
(
"同步消息"
);
operationLog
.
setOperation
(
"同步消息"
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderRefundServiceImpl.java
View file @
2b05019f
package
com
.
soss
.
system
.
service
.
impl
;
package
com
.
soss
.
system
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.enums.RefundState
;
import
com.soss.common.enums.RefundState
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.exception.ServiceException
;
...
@@ -10,11 +9,9 @@ import com.soss.system.constants.OrderStatusConstant;
...
@@ -10,11 +9,9 @@ import com.soss.system.constants.OrderStatusConstant;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.OrderDetail
;
import
com.soss.system.domain.OrderDetail
;
import
com.soss.system.domain.OrderRefund
;
import
com.soss.system.domain.OrderRefund
;
import
com.soss.system.domain.OrderSnapshot
;
import
com.soss.system.domain.vo.OrderQuery
;
import
com.soss.system.domain.vo.OrderQuery
;
import
com.soss.system.mapper.OrderDetailMapper
;
import
com.soss.system.mapper.OrderDetailMapper
;
import
com.soss.system.mapper.OrderRefundMapper
;
import
com.soss.system.mapper.OrderRefundMapper
;
import
com.soss.system.mapper.OrderSnapshotMapper
;
import
com.soss.system.service.IOrderRefundService
;
import
com.soss.system.service.IOrderRefundService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -25,6 +22,7 @@ import java.math.BigDecimal;
...
@@ -25,6 +22,7 @@ import java.math.BigDecimal;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -41,49 +39,47 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -41,49 +39,47 @@ public class OrderRefundServiceImpl implements IOrderRefundService
private
OrderRefundMapper
orderRefundMapper
;
private
OrderRefundMapper
orderRefundMapper
;
@Autowired
@Autowired
private
OrderServiceImpl
orderService
;
private
OrderServiceImpl
orderService
;
@Autowired
private
OrderSnapshotMapper
orderSnapshotMapper
;
@Autowired
@Autowired
private
OrderDetailMapper
orderDetailMapper
;
private
OrderDetailMapper
orderDetailMapper
;
/**
/**
* 查询订单退款
* 查询订单退款
*
*
* @param id 订单退款主键
* @param id 订单退款主键
* @return 订单退款
* @return 订单退款
*/
*/
@Override
@Override
public
OrderRefund
selectOrderRefundById
(
String
id
)
public
OrderRefund
selectOrderRefundById
(
String
id
)
{
{
OrderRefund
orderRefund
=
orderRefundMapper
.
selectOrderRefundById
(
id
);
OrderRefund
orderRefund
=
orderRefundMapper
.
selectOrderRefundById
(
id
);
this
.
wrapperOrderInfo
(
orderRefund
);
return
orderRefund
;
}
private
void
wrapperOrderInfo
(
OrderRefund
orderRefund
)
{
Order
order
=
orderService
.
selectOrderById
(
orderRefund
.
getOrderId
());
Order
order
=
orderService
.
selectOrderById
(
orderRefund
.
getOrderId
());
OrderSnapshot
orderSnapshot
=
orderSnapshotMapper
.
selectOrderSnapshotByOrderId
(
order
.
getId
());
OrderDetail
detail
=
new
OrderDetail
();
List
<
OrderDetail
>
orderDetails
=
JSONObject
.
parseArray
(
orderSnapshot
.
getSnapshot
(),
OrderDetail
.
class
);
detail
.
setRefundId
(
orderRefund
.
getId
());
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
detail
);
order
.
setOrderDetails
(
orderDetails
);
order
.
setOrderDetails
(
orderDetails
);
orderRefund
.
setOrder
(
order
);
orderRefund
.
setOrder
(
order
);
return
orderRefund
;
}
}
/**
/**
* 查询订单退款列表
* 查询订单退款列表
*
*
* @param orderRefund 订单退款
* @param orderRefund 订单退款
* @return 订单退款
* @return 订单退款
*/
*/
@Override
@Override
public
List
<
OrderRefund
>
selectOrderRefundList
(
OrderRefund
orderRefund
)
public
List
<
OrderRefund
>
selectOrderRefundList
(
OrderRefund
orderRefund
)
{
{
List
<
OrderRefund
>
orderRefunds
=
orderRefundMapper
.
selectOrderRefundList
(
orderRefund
);
List
<
OrderRefund
>
orderRefunds
=
orderRefundMapper
.
selectOrderRefundList
(
orderRefund
);
for
(
OrderRefund
refund
:
orderRefunds
)
{
for
(
OrderRefund
refund
:
orderRefunds
)
{
Order
order
=
orderService
.
selectOrderById
(
refund
.
getOrderId
());
OrderDetail
detail
=
new
OrderDetail
();
OrderSnapshot
orderSnapshot
=
orderSnapshotMapper
.
selectOrderSnapshotByOrderId
(
order
.
getId
());
detail
.
setRefundId
(
refund
.
getId
());
List
<
OrderDetail
>
orderDetails
=
JSONObject
.
parseArray
(
orderSnapshot
.
getSnapshot
(),
OrderDetail
.
class
);
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
detail
);
order
.
setOrderDetails
(
orderDetails
);
refund
.
setOrderDetails
(
orderDetails
);
refund
.
setOrder
(
order
);
}
}
return
orderRefunds
;
return
orderRefunds
;
}
}
/**
/**
...
@@ -114,15 +110,32 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -114,15 +110,32 @@ public class OrderRefundServiceImpl implements IOrderRefundService
}
else
{
}
else
{
return
AjaxResult
.
error
(
"该订单状态不允许退款"
);
return
AjaxResult
.
error
(
"该订单状态不允许退款"
);
}
}
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
listDetailByIds
(
orderRefund
.
getOrderDetailIds
());
List
<
String
>
illegalGoodNames
=
orderDetails
.
stream
().
filter
(
orderDetail
->
orderDetail
.
getRefundTime
()
!=
null
).
map
(
OrderDetail:
:
getGoodsName
).
collect
(
Collectors
.
toList
());
BigDecimal
orderDetailAmount
;
if
(!
CollectionUtils
.
isEmpty
(
illegalGoodNames
))
{
if
(!
CollectionUtils
.
isEmpty
(
orderRefund
.
getOrderDetailIds
()))
{
return
AjaxResult
.
error
(
"商品"
+
illegalGoodNames
+
"已退过款"
);
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
listDetailByIds
(
orderRefund
.
getOrderDetailIds
());
}
List
<
String
>
illegalGoodNames
=
orderDetails
.
stream
().
filter
(
orderDetail
->
!
Objects
.
equals
(
orderDetail
.
getOrderId
(),
order
.
getId
()))
BigDecimal
orderDetailAmount
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getRealAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
.
map
(
OrderDetail:
:
getGoodsName
).
collect
(
Collectors
.
toList
());
if
(
orderDetailAmount
.
compareTo
(
orderRefund
.
getRefundAmount
())
!=
0
)
{
if
(!
CollectionUtils
.
isEmpty
(
illegalGoodNames
))
{
log
.
warn
(
"退款金额[{}]与商品明细总额[{}]不符"
,
orderRefund
.
getRefundAmount
(),
orderDetailAmount
);
return
AjaxResult
.
error
(
"商品"
+
illegalGoodNames
+
"和订单不匹配"
);
return
AjaxResult
.
error
(
"退款金额与商品明细总额不符"
);
}
illegalGoodNames
=
orderDetails
.
stream
().
filter
(
orderDetail
->
orderDetail
.
getRefundId
()
!=
null
)
.
map
(
OrderDetail:
:
getGoodsName
).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
illegalGoodNames
))
{
return
AjaxResult
.
error
(
"商品"
+
illegalGoodNames
+
"已发起过退款"
);
}
orderDetailAmount
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getRealAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
if
(
orderDetailAmount
.
compareTo
(
orderRefund
.
getRefundAmount
())
!=
0
)
{
log
.
warn
(
"退款金额[{}]与商品明细总额[{}]不符"
,
orderRefund
.
getRefundAmount
(),
orderDetailAmount
);
return
AjaxResult
.
error
(
"退款金额与商品明细总额不符"
);
}
}
else
{
OrderDetail
detail
=
new
OrderDetail
();
detail
.
setOrderId
(
order
.
getId
());
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
detail
);
orderDetailAmount
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getRealAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
List
<
Long
>
orderDetailIds
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getId
).
collect
(
Collectors
.
toList
());
orderRefund
.
setOrderDetailIds
(
orderDetailIds
);
}
}
orderRefund
.
setCreatedAt
(
new
Date
());
orderRefund
.
setCreatedAt
(
new
Date
());
...
@@ -142,19 +155,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -142,19 +155,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
orderRefund
.
setOrder
(
order
);
orderRefund
.
setOrder
(
order
);
return
AjaxResult
.
success
(
orderRefund
);
return
AjaxResult
.
success
(
orderRefund
);
}
}
public
void
cancel
(
Order
order
)
{
if
(
OrderStatusConstant
.
Unpaid
.
equals
(
order
.
getState
())){
order
.
setState
(
OrderStatusConstant
.
UnpaidCancel
);
order
.
setUpdatedAt
(
new
Date
());
orderService
.
updateOrder
(
order
);
}
else
if
(
OrderStatusConstant
.
Paid
.
equals
(
order
.
getState
())){
order
.
setState
(
OrderStatusConstant
.
PaidCancel
);
order
.
setUpdatedAt
(
new
Date
());
orderService
.
updateOrder
(
order
);
}
else
{
throw
new
ServiceException
(
"该订单不允许退款"
);
}
}
/**
/**
* 修改订单退款
* 修改订单退款
*
*
...
@@ -208,11 +209,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -208,11 +209,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
public
List
<
OrderRefund
>
selectOrderRefundList
(
OrderQuery
orderQuery
)
{
public
List
<
OrderRefund
>
selectOrderRefundList
(
OrderQuery
orderQuery
)
{
List
<
OrderRefund
>
orderRefunds
=
orderRefundMapper
.
selectList
(
orderQuery
);
List
<
OrderRefund
>
orderRefunds
=
orderRefundMapper
.
selectList
(
orderQuery
);
for
(
OrderRefund
refund
:
orderRefunds
)
{
for
(
OrderRefund
refund
:
orderRefunds
)
{
Order
order
=
orderService
.
selectOrderById
(
refund
.
getOrderId
());
this
.
wrapperOrderInfo
(
refund
);
OrderSnapshot
orderSnapshot
=
orderSnapshotMapper
.
selectOrderSnapshotByOrderId
(
order
.
getId
());
List
<
OrderDetail
>
orderDetails
=
JSONObject
.
parseArray
(
orderSnapshot
.
getSnapshot
(),
OrderDetail
.
class
);
order
.
setOrderDetails
(
orderDetails
);
refund
.
setOrder
(
order
);
}
}
return
orderRefunds
;
return
orderRefunds
;
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
2b05019f
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.core.domain.AjaxResult
;
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.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.StringUtils
;
import
com.soss.common.utils.StringUtils
;
...
@@ -55,6 +56,8 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -55,6 +56,8 @@ public class OrderServiceImpl implements IOrderService {
@Autowired
@Autowired
private
ShopMapper
shopMapper
;
private
ShopMapper
shopMapper
;
@Autowired
@Autowired
private
CouponUserMapper
couponUserMapper
;
@Autowired
private
OrderOperationLogServiceImpl
orderOperationLogService
;
private
OrderOperationLogServiceImpl
orderOperationLogService
;
@Autowired
@Autowired
private
OrderSnapshotServiceImpl
orderSnapshotService
;
private
OrderSnapshotServiceImpl
orderSnapshotService
;
...
@@ -81,7 +84,7 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -81,7 +84,7 @@ public class OrderServiceImpl implements IOrderService {
* @return 订单
* @return 订单
*/
*/
@Override
@Override
public
Order
selectOrderById
(
Stri
ng
id
)
{
public
Order
selectOrderById
(
Lo
ng
id
)
{
Order
order
=
orderMapper
.
selectOrderById
(
id
);
Order
order
=
orderMapper
.
selectOrderById
(
id
);
order
.
setShop
(
shopMapper
.
selectShopById
(
order
.
getShopId
()));
order
.
setShop
(
shopMapper
.
selectShopById
(
order
.
getShopId
()));
OrderSnapshot
orderSnapshot
=
orderSnapshotService
.
selectOrderSnapshotByOrderId
(
order
.
getId
());
OrderSnapshot
orderSnapshot
=
orderSnapshotService
.
selectOrderSnapshotByOrderId
(
order
.
getId
());
...
@@ -91,7 +94,7 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -91,7 +94,7 @@ public class OrderServiceImpl implements IOrderService {
return
order
;
return
order
;
}
}
public
Order
selectById
(
Stri
ng
id
)
{
public
Order
selectById
(
Lo
ng
id
)
{
return
orderMapper
.
selectOrderById
(
id
);
return
orderMapper
.
selectOrderById
(
id
);
}
}
...
@@ -120,12 +123,18 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -120,12 +123,18 @@ public class OrderServiceImpl implements IOrderService {
* 新增订单
* 新增订单
*
*
* @param loginUser
* @param loginUser
* @param order 订单
* @param order 订单
* @param couponUserId
* @return 结果
* @return 结果
*/
*/
@Override
@Override
@Transactional
@Transactional
public
AjaxResult
insertOrder
(
LoginUser
loginUser
,
Order
order
)
{
public
AjaxResult
insertOrder
(
LoginUser
loginUser
,
Order
order
,
Integer
couponUserId
)
{
if
(
couponUserId
!=
null
)
{
CouponUser
couponUser
=
new
CouponUser
(
couponUserId
,
CouponUserState
.
USED
.
getState
());
couponUserMapper
.
updateCouponUser
(
couponUser
);
}
order
.
setState
(
OrderStatusConstant
.
Unpaid
);
order
.
setState
(
OrderStatusConstant
.
Unpaid
);
order
.
setUserId
(
loginUser
.
getOpenId
());
order
.
setUserId
(
loginUser
.
getOpenId
());
order
.
setUserName
(
loginUser
.
getUsername
());
order
.
setUserName
(
loginUser
.
getUsername
());
...
@@ -329,9 +338,6 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -329,9 +338,6 @@ public class OrderServiceImpl implements IOrderService {
wechatMessageService
.
insertWechatMessage
(
order
.
getUserId
(),
order
.
getId
(),
"制作完成,您的订单已经制作完成,现在可以去取餐啦!"
);
wechatMessageService
.
insertWechatMessage
(
order
.
getUserId
(),
order
.
getId
(),
"制作完成,您的订单已经制作完成,现在可以去取餐啦!"
);
if
(
BooleanUtils
.
isTrue
(
order
.
getSendMsgFlag2
()))
{
if
(
BooleanUtils
.
isTrue
(
order
.
getSendMsgFlag2
()))
{
sendMessageUtils
.
sendWxMsg
(
order
);
sendMessageUtils
.
sendWxMsg
(
order
);
}
Customer
customer
=
customerMapper
.
selectCustomerById
(
order
.
getUserId
());
if
(!
"1"
.
equals
(
customer
.
getAllow
()))
{
sendSmsUtil
.
sendSms
(
order
.
getUserPhone
(),
"SMS_243650242"
,
null
);
sendSmsUtil
.
sendSms
(
order
.
getUserPhone
(),
"SMS_243650242"
,
null
);
}
}
}
}
...
@@ -375,28 +381,6 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -375,28 +381,6 @@ public class OrderServiceImpl implements IOrderService {
}
}
}
}
/**
* 批量删除订单
*
* @param ids 需要删除的订单主键
* @return 结果
*/
@Override
public
int
deleteOrderByIds
(
String
[]
ids
)
{
return
orderMapper
.
deleteOrderByIds
(
ids
);
}
/**
* 删除订单信息
*
* @param id 订单主键
* @return 结果
*/
@Override
public
int
deleteOrderById
(
String
id
)
{
return
orderMapper
.
deleteOrderById
(
id
);
}
@Override
@Override
public
AjaxResult
check
(
Order
order
)
{
public
AjaxResult
check
(
Order
order
)
{
//验证订单状态
//验证订单状态
...
@@ -442,7 +426,7 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -442,7 +426,7 @@ public class OrderServiceImpl implements IOrderService {
@Override
@Override
@Transactional
@Transactional
public
int
cancel
(
Stri
ng
orderId
)
{
public
int
cancel
(
Lo
ng
orderId
)
{
Order
order
=
orderMapper
.
selectOrderById
(
orderId
);
Order
order
=
orderMapper
.
selectOrderById
(
orderId
);
if
(
OrderStatusConstant
.
Unpaid
.
equals
(
order
.
getState
()))
{
if
(
OrderStatusConstant
.
Unpaid
.
equals
(
order
.
getState
()))
{
order
.
setState
(
"8"
);
order
.
setState
(
"8"
);
...
@@ -544,7 +528,7 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -544,7 +528,7 @@ public class OrderServiceImpl implements IOrderService {
}
}
public
String
refundOrder
(
Stri
ng
orderId
)
{
public
String
refundOrder
(
Lo
ng
orderId
)
{
Order
order
=
orderMapper
.
selectOrderById
(
orderId
);
Order
order
=
orderMapper
.
selectOrderById
(
orderId
);
List
<
String
>
status
=
Arrays
.
asList
(
"2"
,
"3"
);
List
<
String
>
status
=
Arrays
.
asList
(
"2"
,
"3"
);
if
(
status
.
contains
(
order
.
getState
()))
{
if
(
status
.
contains
(
order
.
getState
()))
{
...
@@ -586,9 +570,7 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -586,9 +570,7 @@ public class OrderServiceImpl implements IOrderService {
OrderDetail
orderDetail
=
new
OrderDetail
();
OrderDetail
orderDetail
=
new
OrderDetail
();
orderDetail
.
setOrderId
(
order1
.
getId
());
orderDetail
.
setOrderId
(
order1
.
getId
());
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
if
(
CollectionUtils
.
isEmpty
(
orderDetails
))
{
if
(!
CollectionUtils
.
isEmpty
(
orderDetails
))
{
}
else
{
list
.
addAll
(
orderDetails
);
list
.
addAll
(
orderDetails
);
}
}
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/SysUserServiceImpl.java
View file @
2b05019f
package
com
.
soss
.
system
.
service
.
impl
;
package
com
.
soss
.
system
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
javax.validation.Validator
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
com.soss.common.annotation.DataScope
;
import
com.soss.common.annotation.DataScope
;
import
com.soss.common.constant.UserConstants
;
import
com.soss.common.constant.UserConstants
;
import
com.soss.common.core.domain.entity.SysRole
;
import
com.soss.common.core.domain.entity.SysRole
;
...
@@ -19,16 +9,24 @@ import com.soss.common.utils.SecurityUtils;
...
@@ -19,16 +9,24 @@ import com.soss.common.utils.SecurityUtils;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.bean.BeanValidators
;
import
com.soss.common.utils.bean.BeanValidators
;
import
com.soss.common.utils.spring.SpringUtils
;
import
com.soss.common.utils.spring.SpringUtils
;
import
com.soss.system.domain.SysPost
;
import
com.soss.system.domain.SysUserPost
;
import
com.soss.system.domain.SysUserPost
;
import
com.soss.system.domain.SysUserRole
;
import
com.soss.system.domain.SysUserRole
;
import
com.soss.system.mapper.SysPostMapper
;
import
com.soss.system.mapper.SysRoleMapper
;
import
com.soss.system.mapper.SysRoleMapper
;
import
com.soss.system.mapper.SysUserMapper
;
import
com.soss.system.mapper.SysUserMapper
;
import
com.soss.system.mapper.SysUserPostMapper
;
import
com.soss.system.mapper.SysUserRoleMapper
;
import
com.soss.system.mapper.SysUserRoleMapper
;
import
com.soss.system.service.ISysConfigService
;
import
com.soss.system.service.ISysConfigService
;
import
com.soss.system.service.ISysUserService
;
import
com.soss.system.service.ISysUserService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
javax.validation.Validator
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 用户 业务层处理
* 用户 业务层处理
...
@@ -275,9 +273,9 @@ public class SysUserServiceImpl implements ISysUserService
...
@@ -275,9 +273,9 @@ public class SysUserServiceImpl implements ISysUserService
*/
*/
@Override
@Override
@Transactional
@Transactional
public
int
updateUser
(
SysUser
user
)
public
int
updateUser
(
SysUser
user
)
{
{
// if(user.getRoles() ==null||user.getRoles().isEmpty())
{
if
(
user
.
getRoles
()
==
null
||
user
.
getRoles
().
isEmpty
())
{
if
(
user
.
getRoleIds
()
==
null
||
user
.
getRoleIds
().
length
==
0
)
{
return
userMapper
.
updateUser
(
user
);
return
userMapper
.
updateUser
(
user
);
}
}
Long
userId
=
user
.
getUserId
();
Long
userId
=
user
.
getUserId
();
...
@@ -376,7 +374,7 @@ public class SysUserServiceImpl implements ISysUserService
...
@@ -376,7 +374,7 @@ public class SysUserServiceImpl implements ISysUserService
if
(
StringUtils
.
isNotNull
(
roles
))
if
(
StringUtils
.
isNotNull
(
roles
))
{
{
// 新增用户与角色管理
// 新增用户与角色管理
List
<
SysUserRole
>
list
=
new
ArrayList
<
SysUserRole
>();
List
<
SysUserRole
>
list
=
new
ArrayList
<>();
for
(
Long
roleId
:
roles
)
for
(
Long
roleId
:
roles
)
{
{
SysUserRole
ur
=
new
SysUserRole
();
SysUserRole
ur
=
new
SysUserRole
();
...
...
soss-system/src/main/java/com/soss/system/service/impl/WechatMessageServiceImpl.java
View file @
2b05019f
...
@@ -48,7 +48,7 @@ public class WechatMessageServiceImpl implements IWechatMessageService
...
@@ -48,7 +48,7 @@ public class WechatMessageServiceImpl implements IWechatMessageService
for
(
WechatMessage
message
:
wechatMessages
)
{
for
(
WechatMessage
message
:
wechatMessages
)
{
String
[]
split
=
message
.
getMessage
().
split
(
","
);
String
[]
split
=
message
.
getMessage
().
split
(
","
);
message
.
setTitle
(
split
[
0
]);
message
.
setTitle
(
split
[
0
]);
message
.
set
Titl
e
(
split
[
1
]);
message
.
set
Messag
e
(
split
[
1
]);
}
}
return
wechatMessages
;
return
wechatMessages
;
}
}
...
...
soss-system/src/main/resources/mapper/system/CouponUserMapper.xml
View file @
2b05019f
...
@@ -69,8 +69,8 @@
...
@@ -69,8 +69,8 @@
left join coupon_rule cr on c.rule_id = cr.id
left join coupon_rule cr on c.rule_id = cr.id
where cu.cust_id = #{custId} and cr.use_start_time
<
#{nowTime} and cu.expired_time > #{nowTime}
where cu.cust_id = #{custId} and cr.use_start_time
<
#{nowTime} and cu.expired_time > #{nowTime}
and cu.state = ${@com.soss.common.enums.CouponUserState @EFFECTIVE.getState}
and cu.state = ${@com.soss.common.enums.CouponUserState @EFFECTIVE.getState}
<if
test=
"couponId != null"
>
<if
test=
"coupon
User
Id != null"
>
and c
.id = #{coupon
Id}
and c
u.id = #{couponUser
Id}
</if>
</if>
</sql>
</sql>
...
...
soss-system/src/main/resources/mapper/system/CustomerMapper.xml
View file @
2b05019f
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.soss.system.mapper.CustomerMapper"
>
<mapper
namespace=
"com.soss.system.mapper.CustomerMapper"
>
<resultMap
type=
"Customer"
id=
"CustomerResult"
>
<resultMap
type=
"Customer"
id=
"CustomerResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"userName"
column=
"user_name"
/>
<result
property=
"userName"
column=
"user_name"
/>
...
@@ -13,10 +13,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -13,10 +13,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"sex"
column=
"sex"
/>
<result
property=
"sex"
column=
"sex"
/>
<result
property=
"birthday"
column=
"birthday"
/>
<result
property=
"birthday"
column=
"birthday"
/>
<result
property=
"soucre"
column=
"soucre"
/>
<result
property=
"soucre"
column=
"soucre"
/>
<result
property=
"sendMsgFlag1"
column=
"send_msg_flag1"
/>
<result
property=
"sendMsgFlag2"
column=
"send_msg_flag2"
/>
<result
property=
"sendMsgFlag3"
column=
"send_msg_flag3"
/>
<result
property=
"flagExpireDate"
column=
"flag_expire_date"
/>
</resultMap>
</resultMap>
<sql
id=
"selectCustomerVo"
>
<sql
id=
"selectCustomerVo"
>
select
id, user_name, phone, create_time, head_sculpture_path, sex, birthday, soucre
from customer
select
*
from customer
</sql>
</sql>
<select
id=
"selectCustomerList"
parameterType=
"Customer"
resultMap=
"CustomerResult"
>
<select
id=
"selectCustomerList"
parameterType=
"Customer"
resultMap=
"CustomerResult"
>
...
@@ -45,6 +49,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -45,6 +49,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"sex != null"
>
sex,
</if>
<if
test=
"sex != null"
>
sex,
</if>
<if
test=
"birthday != null"
>
birthday,
</if>
<if
test=
"birthday != null"
>
birthday,
</if>
<if
test=
"soucre != null"
>
soucre,
</if>
<if
test=
"soucre != null"
>
soucre,
</if>
<if
test=
"sendMsgFlag1 != null"
>
send_msg_flag1,
</if>
<if
test=
"sendMsgFlag2 != null"
>
send_msg_flag2,
</if>
<if
test=
"sendMsgFlag3 != null"
>
send_msg_flag3,
</if>
<if
test=
"flagExpireDate != null"
>
flag_expire_date,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"id != null"
>
#{id},
</if>
...
@@ -55,6 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -55,6 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"sex != null"
>
#{sex},
</if>
<if
test=
"sex != null"
>
#{sex},
</if>
<if
test=
"birthday != null"
>
#{birthday},
</if>
<if
test=
"birthday != null"
>
#{birthday},
</if>
<if
test=
"soucre != null"
>
#{soucre},
</if>
<if
test=
"soucre != null"
>
#{soucre},
</if>
<if
test=
"sendMsgFlag1 != null"
>
#{sendMsgFlag1},
</if>
<if
test=
"sendMsgFlag2 != null"
>
#{sendMsgFlag2},
</if>
<if
test=
"sendMsgFlag3 != null"
>
#{sendMsgFlag3},
</if>
<if
test=
"flagExpireDate != null"
>
#{flagExpireDate},
</if>
</trim>
</trim>
</insert>
</insert>
...
@@ -68,16 +80,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -68,16 +80,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"birthday != null"
>
birthday = #{birthday},
</if>
<if
test=
"birthday != null"
>
birthday = #{birthday},
</if>
<if
test=
"soucre != null"
>
soucre = #{soucre},
</if>
<if
test=
"soucre != null"
>
soucre = #{soucre},
</if>
<if
test=
"allow != null"
>
allow = #{soucre},
</if>
<if
test=
"allow != null"
>
allow = #{soucre},
</if>
<if
test=
"sendMsgFlag1 != null"
>
send_msg_flag1 = #{sendMsgFlag1},
</if>
<if
test=
"sendMsgFlag2 != null"
>
send_msg_flag2 = #{sendMsgFlag2},
</if>
<if
test=
"sendMsgFlag3 != null"
>
send_msg_flag3 = #{sendMsgFlag3},
</if>
<if
test=
"flagExpireDate != null"
>
flag_expire_date = #{flagExpireDate},
</if>
</trim>
</trim>
where id = #{id}
where id = #{id}
</update>
</update>
<update
id=
"updateSendMsgFlag"
>
update customer set send_msg_flag1 = #{sendMsgFlag1}, send_msg_flag2 = #{sendMsgFlag2},
send_msg_flag3 = #{sendMsgFlag3}, flag_expire_date = #{flagExpireDate}
where id = #{id}
</update>
<delete
id=
"deleteCustomerById"
parameterType=
"Long"
>
<delete
id=
"deleteCustomerById"
parameterType=
"Long"
>
delete from customer where id = #{id}
delete from customer where id = #{id}
</delete>
</delete>
<delete
id=
"deleteCustomerByIds"
parameterType=
"String"
>
<delete
id=
"deleteCustomerByIds"
parameterType=
"String"
>
delete from customer where id in
delete from customer where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
#{id}
</foreach>
</foreach>
...
...
soss-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
View file @
2b05019f
...
@@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
</sql>
<select
id=
"selectSkuListForOrder"
resultMap=
"GoodsSkuResult"
>
<select
id=
"selectSkuListForOrder"
resultMap=
"GoodsSkuResult"
>
select id, goods_id, discount from goods_sku where id in
select id, goods_id,
price,
discount from goods_sku where id in
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
</select>
</select>
...
...
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
View file @
2b05019f
...
@@ -11,7 +11,8 @@
...
@@ -11,7 +11,8 @@
<result
property=
"goodsName"
column=
"goods_name"
/>
<result
property=
"goodsName"
column=
"goods_name"
/>
<result
property=
"machineId"
column=
"machine_id"
/>
<result
property=
"machineId"
column=
"machine_id"
/>
<result
property=
"num"
column=
"num"
/>
<result
property=
"num"
column=
"num"
/>
<result
property=
"viewAmount"
column=
"view_amount"
/>
<result
property=
"unitPrice"
column=
"unit_price"
/>
<result
property=
"oriAmount"
column=
"ori_amount"
/>
<result
property=
"amountShould"
column=
"amount_should"
/>
<result
property=
"amountShould"
column=
"amount_should"
/>
<result
property=
"couponAmount"
column=
"coupon_amount"
/>
<result
property=
"couponAmount"
column=
"coupon_amount"
/>
<result
property=
"realAmount"
column=
"real_amount"
/>
<result
property=
"realAmount"
column=
"real_amount"
/>
...
@@ -37,7 +38,8 @@
...
@@ -37,7 +38,8 @@
<if
test=
"goodsName != null and goodsName != ''"
>
and goods_name like concat('%', #{goodsName}, '%')
</if>
<if
test=
"goodsName != null and goodsName != ''"
>
and goods_name like concat('%', #{goodsName}, '%')
</if>
<if
test=
"machineId != null and machineId != ''"
>
and machine_id = #{machineId}
</if>
<if
test=
"machineId != null and machineId != ''"
>
and machine_id = #{machineId}
</if>
<if
test=
"num != null and num != ''"
>
and num = #{num}
</if>
<if
test=
"num != null and num != ''"
>
and num = #{num}
</if>
<if
test=
"viewAmount != null "
>
and view_amount = #{viewAmount}
</if>
<if
test=
"oriAmount != null "
>
and ori_amount = #{oriAmount}
</if>
<if
test=
"unitPrice != null "
>
and unit_price = #{unitPrice}
</if>
<if
test=
"amountShould != null "
>
and amount_should = #{amountShould}
</if>
<if
test=
"amountShould != null "
>
and amount_should = #{amountShould}
</if>
<if
test=
"couponAmount != null "
>
and coupon_amount = #{couponAmount}
</if>
<if
test=
"couponAmount != null "
>
and coupon_amount = #{couponAmount}
</if>
<if
test=
"realAmount != null "
>
and real_amount = #{realAmount}
</if>
<if
test=
"realAmount != null "
>
and real_amount = #{realAmount}
</if>
...
@@ -71,7 +73,8 @@
...
@@ -71,7 +73,8 @@
<if
test=
"goodsName != null and goodsName != ''"
>
goods_name,
</if>
<if
test=
"goodsName != null and goodsName != ''"
>
goods_name,
</if>
<if
test=
"machineId != null and machineId != ''"
>
machine_id,
</if>
<if
test=
"machineId != null and machineId != ''"
>
machine_id,
</if>
<if
test=
"num != null and num != ''"
>
num,
</if>
<if
test=
"num != null and num != ''"
>
num,
</if>
<if
test=
"viewAmount != null"
>
view_amount,
</if>
<if
test=
"unitPrice != null"
>
unit_price,
</if>
<if
test=
"oriAmount != null"
>
ori_amount,
</if>
<if
test=
"amountShould != null"
>
amount_should,
</if>
<if
test=
"amountShould != null"
>
amount_should,
</if>
<if
test=
"couponAmount != null"
>
coupon_amount,
</if>
<if
test=
"couponAmount != null"
>
coupon_amount,
</if>
<if
test=
"realAmount != null"
>
real_amount,
</if>
<if
test=
"realAmount != null"
>
real_amount,
</if>
...
@@ -90,7 +93,8 @@
...
@@ -90,7 +93,8 @@
<if
test=
"goodsName != null and goodsName != ''"
>
#{goodsName},
</if>
<if
test=
"goodsName != null and goodsName != ''"
>
#{goodsName},
</if>
<if
test=
"machineId != null and machineId != ''"
>
#{machineId},
</if>
<if
test=
"machineId != null and machineId != ''"
>
#{machineId},
</if>
<if
test=
"num != null and num != ''"
>
#{num},
</if>
<if
test=
"num != null and num != ''"
>
#{num},
</if>
<if
test=
"viewAmount != null"
>
#{viewAmount},
</if>
<if
test=
"unitPrice != null"
>
#{unitPrice},
</if>
<if
test=
"oriAmount != null"
>
#{oriAmount},
</if>
<if
test=
"amountShould != null"
>
#{amountShould},
</if>
<if
test=
"amountShould != null"
>
#{amountShould},
</if>
<if
test=
"couponAmount != null"
>
#{couponAmount},
</if>
<if
test=
"couponAmount != null"
>
#{couponAmount},
</if>
<if
test=
"realAmount != null"
>
#{realAmount},
</if>
<if
test=
"realAmount != null"
>
#{realAmount},
</if>
...
@@ -113,7 +117,8 @@
...
@@ -113,7 +117,8 @@
<if
test=
"goodsName != null and goodsName != ''"
>
goods_name = #{goodsName},
</if>
<if
test=
"goodsName != null and goodsName != ''"
>
goods_name = #{goodsName},
</if>
<if
test=
"machineId != null and machineId != ''"
>
machine_id = #{machineId},
</if>
<if
test=
"machineId != null and machineId != ''"
>
machine_id = #{machineId},
</if>
<if
test=
"num != null and num != ''"
>
num = #{num},
</if>
<if
test=
"num != null and num != ''"
>
num = #{num},
</if>
<if
test=
"viewAmount != null"
>
view_amount = #{viewAmount},
</if>
<if
test=
"unitPrice != null"
>
unit_price = #{unitPrice},
</if>
<if
test=
"oriAmount != null"
>
ori_amount = #{oriAmount},
</if>
<if
test=
"amountShould != null"
>
amount_should = #{amountShould},
</if>
<if
test=
"amountShould != null"
>
amount_should = #{amountShould},
</if>
<if
test=
"couponAmount != null"
>
coupon_amount = #{couponAmount},
</if>
<if
test=
"couponAmount != null"
>
coupon_amount = #{couponAmount},
</if>
<if
test=
"realAmount != null"
>
real_amount = #{realAmount},
</if>
<if
test=
"realAmount != null"
>
real_amount = #{realAmount},
</if>
...
...
soss-system/src/main/resources/mapper/system/OrderMapper.xml
View file @
2b05019f
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
</where>
</where>
</select>
</select>
<select
id=
"selectOrderById"
parameterType=
"
Stri
ng"
resultMap=
"OrderResult"
>
<select
id=
"selectOrderById"
parameterType=
"
Lo
ng"
resultMap=
"OrderResult"
>
<include
refid=
"selectOrderVo"
/>
<include
refid=
"selectOrderVo"
/>
where id = #{id}
where id = #{id}
</select>
</select>
...
@@ -116,6 +116,8 @@
...
@@ -116,6 +116,8 @@
<if
test=
"pickCode != null and pickCode != ''"
>
#{pickCode},
</if>
<if
test=
"pickCode != null and pickCode != ''"
>
#{pickCode},
</if>
<if
test=
"shopId != null and shopId != ''"
>
#{shopId},
</if>
<if
test=
"shopId != null and shopId != ''"
>
#{shopId},
</if>
<if
test=
"machineId != null and machineId != ''"
>
#{machineId},
</if>
<if
test=
"machineId != null and machineId != ''"
>
#{machineId},
</if>
<if
test=
"lng != null"
>
#{lng},
</if>
<if
test=
"lat != null"
>
#{lat},
</if>
<if
test=
"source != null and source != ''"
>
#{source},
</if>
<if
test=
"source != null and source != ''"
>
#{source},
</if>
<if
test=
"state != null and state != ''"
>
#{state},
</if>
<if
test=
"state != null and state != ''"
>
#{state},
</if>
<if
test=
"sendMsgFlag1 != null"
>
#{sendMsgFlag1},
</if>
<if
test=
"sendMsgFlag1 != null"
>
#{sendMsgFlag1},
</if>
...
...
soss-system/src/main/resources/mapper/system/OrderRefundMapper.xml
View file @
2b05019f
...
@@ -24,9 +24,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -24,9 +24,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectOrderRefundList"
parameterType=
"OrderRefund"
resultMap=
"OrderRefundResult"
>
<select
id=
"selectOrderRefundList"
parameterType=
"OrderRefund"
resultMap=
"OrderRefundResult"
>
<include
refid=
"selectOrderRefundVo"
/>
<include
refid=
"selectOrderRefundVo"
/>
<where>
<where>
<if
test=
"orderId != null
and orderId != ''
"
>
and order_id = #{orderId}
</if>
<if
test=
"orderId != null"
>
and order_id = #{orderId}
</if>
<if
test=
"refundAmount != null "
>
and refund_amount = #{refundAmount}
</if>
<if
test=
"refundAmount != null "
>
and refund_amount = #{refundAmount}
</if>
<if
test=
"state != null
and state != ''
"
>
and state = #{state}
</if>
<if
test=
"state != null"
>
and state = #{state}
</if>
<if
test=
"desc != null and desc != ''"
>
and `desc` = #{desc}
</if>
<if
test=
"desc != null and desc != ''"
>
and `desc` = #{desc}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
...
@@ -43,9 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -43,9 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert
id=
"insertOrderRefund"
parameterType=
"OrderRefund"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insertOrderRefund"
parameterType=
"OrderRefund"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into order_refund
insert into order_refund
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"orderId != null
and orderId != ''
"
>
order_id,
</if>
<if
test=
"orderId != null"
>
order_id,
</if>
<if
test=
"refundAmount != null"
>
refund_amount,
</if>
<if
test=
"refundAmount != null"
>
refund_amount,
</if>
<if
test=
"state != null
and state != ''
"
>
state,
</if>
<if
test=
"state != null"
>
state,
</if>
<if
test=
"desc != null"
>
`desc`,
</if>
<if
test=
"desc != null"
>
`desc`,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
...
@@ -54,9 +54,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -54,9 +54,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createUserName != null"
>
create_user_name,
</if>
<if
test=
"createUserName != null"
>
create_user_name,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"orderId != null
and orderId != ''
"
>
#{orderId},
</if>
<if
test=
"orderId != null"
>
#{orderId},
</if>
<if
test=
"refundAmount != null"
>
#{refundAmount},
</if>
<if
test=
"refundAmount != null"
>
#{refundAmount},
</if>
<if
test=
"state != null
and state != ''
"
>
#{state},
</if>
<if
test=
"state != null"
>
#{state},
</if>
<if
test=
"desc != null"
>
#{desc},
</if>
<if
test=
"desc != null"
>
#{desc},
</if>
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
...
@@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update
id=
"updateOrderRefund"
parameterType=
"OrderRefund"
>
<update
id=
"updateOrderRefund"
parameterType=
"OrderRefund"
>
update order_refund
update order_refund
<trim
prefix=
"SET"
suffixOverrides=
","
>
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"orderId != null
and orderId != ''
"
>
order_id = #{orderId},
</if>
<if
test=
"orderId != null"
>
order_id = #{orderId},
</if>
<if
test=
"refundAmount != null"
>
refund_amount = #{refundAmount},
</if>
<if
test=
"refundAmount != null"
>
refund_amount = #{refundAmount},
</if>
<if
test=
"state != null and state != ''"
>
state = #{state},
</if>
<if
test=
"state != null and state != ''"
>
state = #{state},
</if>
<if
test=
"desc != null"
>
`desc` = #{desc},
</if>
<if
test=
"desc != null"
>
`desc` = #{desc},
</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