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
eb82b202
Commit
eb82b202
authored
Jun 03, 2022
by
张新旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码什么时候是个头
parent
3f6f5969
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
299 additions
and
63 deletions
+299
-63
soss-admin/src/main/java/com/soss/web/controller/coffee/WeixinController.java
+1
-1
soss-admin/src/main/java/com/soss/web/controller/system/SysLoginController.java
+1
-1
soss-admin/src/main/java/com/soss/web/controller/system/SysMenuController.java
+1
-1
soss-admin/src/main/resources/application.yml
+2
-0
soss-common/src/main/java/com/soss/common/core/domain/entity/SysRole.java
+1
-1
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
+7
-14
soss-system/src/main/java/com/soss/system/domain/OrderRefund.java
+3
-3
soss-system/src/main/java/com/soss/system/domain/vo/customer/CustomerResultVo.java
+1
-0
soss-system/src/main/java/com/soss/system/service/impl/CustomerServiceImpl.java
+6
-0
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
+5
-13
soss-system/src/main/java/com/soss/system/service/impl/OrderOperationLogServiceImpl.java
+12
-0
soss-system/src/main/java/com/soss/system/service/impl/OrderRefundServiceImpl.java
+7
-11
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+169
-12
soss-system/src/main/java/com/soss/system/service/impl/SysMenuServiceImpl.java
+1
-1
soss-system/src/main/java/com/soss/system/service/impl/SysRoleServiceImpl.java
+0
-2
soss-system/src/main/java/com/soss/system/weixin/util/SendMessageUtils.java
+81
-2
soss-system/src/main/resources/mapper/system/SysMenuMapper.xml
+1
-1
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/WeixinController.java
View file @
eb82b202
...
...
@@ -76,7 +76,7 @@ public class WeixinController {
private
SendMessageUtils
sendMessageUtils
;
@RequestMapping
(
"/test"
)
public
Map
<
String
,
String
>
test
(
HttpServletRequest
request
)
throws
Exception
{
Order
order
=
orderService
.
selectOrderById
(
"
59
"
);
Order
order
=
orderService
.
selectOrderById
(
"
98
"
);
sendMessageUtils
.
sendWxMsg
(
order
);
return
null
;
}
...
...
soss-admin/src/main/java/com/soss/web/controller/system/SysLoginController.java
View file @
eb82b202
...
...
@@ -79,7 +79,7 @@ public class SysLoginController
@GetMapping
(
"getRouters"
)
public
AjaxResult
getRouters
()
{
Long
userId
=
SecurityUtils
.
getUserId
();
Long
userId
=
1L
;
SecurityUtils
.
getUserId
();
List
<
SysMenu
>
menus
=
menuService
.
selectMenuTreeByUserId
(
userId
);
return
AjaxResult
.
success
(
menuService
.
buildMenus
(
menus
));
}
...
...
soss-admin/src/main/java/com/soss/web/controller/system/SysMenuController.java
View file @
eb82b202
...
...
@@ -70,7 +70,7 @@ public class SysMenuController extends BaseController
@GetMapping
(
value
=
"/roleMenuTreeselect/{roleId}"
)
public
AjaxResult
roleMenuTreeselect
(
@PathVariable
(
"roleId"
)
Long
roleId
)
{
List
<
SysMenu
>
menus
=
menuService
.
selectMenuList
(
getUserId
()
);
List
<
SysMenu
>
menus
=
menuService
.
selectMenuList
(
1L
);
AjaxResult
ajax
=
AjaxResult
.
success
();
ajax
.
put
(
"checkedKeys"
,
menuService
.
selectMenuListByRoleId
(
roleId
));
ajax
.
put
(
"menus"
,
menuService
.
buildMenuTreeSelect
(
menus
));
...
...
soss-admin/src/main/resources/application.yml
View file @
eb82b202
...
...
@@ -112,3 +112,4 @@ machine:
json
:
path
:
D:\workspecs\soss\soss\soss-admin\src\main\resources/province.json
timeout
:
10
template
:
[{
\"status\"
:
\"2\"
,
\"templateId\"
:
\"1uErx-15S-3vuopXSvvsxCeM_Jd-1iZC-nXzd2yW3QU\"
,
\"param\"
:{
\"character_string1\"
:
\"$.orderNum\"
,
\"thing2\"
:
\"$.shop.name\"
,
\"thing12\"
:
\"$.shop.address\"
,
\"time7\"
:
\"now\"
,
\"thing6\"
:
\"您的订单已经下单成功了~\"
}},{
\"status\"
:
\"3\"
,
\"templateId\"
:
\"Q4HDwBEvpTXpwtZktqWm4SZOTEuQK1x48xjqjD2GqyM\"
,
\"param\"
:{
\"thing1\"
:
\"$.shop.name\"
,
\"date6\"
:
\"now\"
,
\"thing5\"
:
\"您的订单已经开始制作了,马上就可以享用美食了!\"
}},{
\"status\"
:
\"4\"
,
\"templateId\"
:
\"Fu_CPIXa0cnJ4EDdVKqFQ3qqKJccMqt2oorI5mfNq74\"
,
\"param\"
:{
\"character_string4\"
:
\"$.orderNum\"
,
\"thing2\"
:
\"$.shop.name\"
,
\"thing7\"
:
\"$.shop.address\"
,
\"time6\"
:
\"now\"
,
\"thing11\"
:
\"您的订单已经制作完成了,现在可以去取餐啦!\"
}}]
\ No newline at end of file
soss-common/src/main/java/com/soss/common/core/domain/entity/SysRole.java
View file @
eb82b202
...
...
@@ -121,7 +121,7 @@ public class SysRole extends BaseEntity
this
.
roleKey
=
roleKey
;
}
@NotBlank
(
message
=
"显示顺序不能为空"
)
public
String
getRoleSort
()
{
return
roleSort
;
...
...
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
View file @
eb82b202
...
...
@@ -35,6 +35,7 @@ import com.soss.system.service.IWechatMessageService;
import
com.soss.system.service.impl.AppServiceImpl
;
import
com.soss.system.service.impl.MachineApiServiceImpl
;
import
com.soss.system.service.impl.OrderOperationLogServiceImpl
;
import
com.soss.system.service.impl.OrderServiceImpl
;
import
com.soss.system.weixin.entity.OrderInfo
;
import
com.soss.system.weixin.entity.QueryReturnInfo
;
...
...
@@ -86,7 +87,7 @@ public class WeixinServiceImpl {
@Autowired
private
TokenService
tokenService
;
@Autowired
private
Order
Mapper
orderMapper
;
private
Order
ServiceImpl
orderService
;
@Autowired
private
OrderOperationLogServiceImpl
orderOperationLogService
;
@Autowired
...
...
@@ -424,7 +425,7 @@ public class WeixinServiceImpl {
String
orderNo
=
notifyMap
.
get
(
"out_trade_no"
);
Order
order
=
new
Order
();
order
.
setOrderNo
(
orderNo
);
List
<
Order
>
orders
=
order
Mapper
.
selectOrderList
(
order
);
List
<
Order
>
orders
=
order
Service
.
selectOrderList
(
order
);
if
(
orders
.
isEmpty
()){
returnMap
.
put
(
"return_code"
,
"FAIL"
);
returnMap
.
put
(
"return_msg"
,
"没有该订单"
);
...
...
@@ -461,13 +462,8 @@ public class WeixinServiceImpl {
stringRedisTemplate
.
expire
(
uid
,
1
,
TimeUnit
.
DAYS
);
jsonObject
.
put
(
"secret"
,
uid
);
order
.
setPickCode
(
jsonObject
.
toJSONString
());
orderMapper
.
updateOrder
(
order
);
orderOperationLogService
.
insertOrderOperationLog
(
order
);
machineApiService
.
updateOrder
(
order
);
//极光推送
jiGuangPushService
.
pushOrderState
(
order
);
wechatMessageService
.
insertWechatMessage
(
order
.
getUserId
(),
"下单成功,您已经下单成功了~"
);
sendMessageUtils
.
sendWxMsg
(
order
);
orderService
.
updateOrder
(
order
);
}
}
finally
{
//要主动释放锁
...
...
@@ -530,7 +526,7 @@ public class WeixinServiceImpl {
return
WxPayNotifyResponse
.
fail
(
"退款失败"
);
}
OrderRefund
orderRefund1
=
orderRefunds
.
get
(
0
);
Order
order
=
order
Mapper
.
selectOrder
ById
(
orderRefund1
.
getOrderId
());
Order
order
=
order
Service
.
select
ById
(
orderRefund1
.
getOrderId
());
if
(
"1"
.
equals
(
orderRefund1
.
getState
())){
orderRefund1
.
setState
(
"2"
);
orderRefundMapper
.
updateOrderRefund
(
orderRefund1
);
...
...
@@ -541,11 +537,8 @@ public class WeixinServiceImpl {
order
.
setState
(
OrderStatusConstant
.
PartialRefund
);
}
orderRefund1
.
setOrder
(
order
);
orderMapper
.
updateOrder
(
order
);
machineApiService
.
updateOrder
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
orderService
.
updateOrder
(
order
);
orderOperationLogService
.
insertOrderOperationLog
(
orderRefund1
);
return
WxPayNotifyResponse
.
success
(
"退款成功!"
);
}
...
...
soss-system/src/main/java/com/soss/system/domain/OrderRefund.java
View file @
eb82b202
...
...
@@ -38,8 +38,8 @@ public class OrderRefund extends BaseEntity
private
String
desc
;
/** 创建时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"创建时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
@Excel
(
name
=
"创建时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd
HH:mm:ss
"
)
private
Date
createdAt
;
private
String
createUserName
;
...
...
@@ -53,7 +53,7 @@ public class OrderRefund extends BaseEntity
}
/** 更新时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
private
Order
order
;
...
...
soss-system/src/main/java/com/soss/system/domain/vo/customer/CustomerResultVo.java
View file @
eb82b202
...
...
@@ -35,4 +35,5 @@ public class CustomerResultVo implements Serializable {
private
String
source
;
}
soss-system/src/main/java/com/soss/system/service/impl/CustomerServiceImpl.java
View file @
eb82b202
...
...
@@ -10,6 +10,7 @@ import com.soss.system.domain.Order;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
import
com.soss.system.domain.vo.customer.CustomerResultVo
;
import
com.soss.system.mapper.OrderMapper
;
import
com.soss.system.mapper.ShopMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.soss.system.mapper.CustomerMapper
;
...
...
@@ -29,6 +30,8 @@ public class CustomerServiceImpl implements ICustomerService
private
CustomerMapper
customerMapper
;
@Autowired
private
OrderMapper
orderMapper
;
@Autowired
private
ShopMapper
shopMapper
;
/**
* 查询用户信息
...
...
@@ -53,6 +56,9 @@ public class CustomerServiceImpl implements ICustomerService
}
else
{
orders
=
orderMapper
.
selectOrderByUserId
(
id
,
refundStatus
);
}
for
(
Order
order1
:
orders
)
{
order1
.
setShop
(
shopMapper
.
selectShopById
(
order1
.
getShopId
()));
}
return
orders
;
...
...
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
View file @
eb82b202
...
...
@@ -33,7 +33,7 @@ public class MachineApiServiceImpl {
@Autowired
private
ShopGoodsMapper
shopGoodsMapper
;
@Autowired
private
Order
Mapper
orderMapper
;
private
Order
ServiceImpl
orderService
;
@Autowired
private
ShopGoodsSkuMapper
shopGoodsSkuMapper
;
@Autowired
...
...
@@ -86,7 +86,7 @@ public class MachineApiServiceImpl {
public
String
updateOrder
(
JSONObject
jsonObject
)
{
Long
orderID
=
jsonObject
.
getLong
(
"orderId"
);
String
status
=
jsonObject
.
getString
(
"status"
);
Order
order1
=
order
Mapper
.
selectOrder
ById
(
String
.
valueOf
(
orderID
));
Order
order1
=
order
Service
.
select
ById
(
String
.
valueOf
(
orderID
));
if
(
order1
==
null
){
throw
new
ServiceException
(
"该订单不存在"
);
}
...
...
@@ -98,15 +98,8 @@ public class MachineApiServiceImpl {
order
.
setFinishTime
(
new
Date
());
}
int
i
=
orderMapper
.
updateOrder
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
if
(
OrderStatusConstant
.
production
.
equals
(
status
)){
wechatMessageService
.
insertWechatMessage
(
order
.
getUserId
(),
"制作提醒,您的订单已经开始制作,马上就能享受美味了!"
);
}
if
(
OrderStatusConstant
.
completed
.
equals
(
status
)){
wechatMessageService
.
insertWechatMessage
(
order
.
getUserId
(),
"制作完成,您的订单已经制作完成,现在可以去取餐啦!"
);
sendMessageUtils
.
sendWxMsg
(
order
);
}
int
i
=
orderService
.
updateOrder
(
order
);
return
i
+
""
;
}
...
...
@@ -116,7 +109,7 @@ public class MachineApiServiceImpl {
if
(
StringUtils
.
isEmpty
(
orderId
)){
orderId
=
"8"
;
}
Order
order
=
order
Mapper
.
selectOrder
ById
(
orderId
);
Order
order
=
order
Service
.
select
ById
(
orderId
);
OrderDetail
orderDetail
=
new
OrderDetail
();
orderDetail
.
setOrderId
(
order
.
getId
());
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
...
...
@@ -246,7 +239,6 @@ public class MachineApiServiceImpl {
param
.
put
(
"data"
,
data
.
toJSONString
());
param
.
put
(
"orderId"
,
order
.
getId
());
ResultVo
resultVo
=
sendRequest
(
param
.
toJSONString
(),
"/v1/order/update"
);
jiGuangPushService
.
pushOrderState
(
order
);
operationLogService
.
insertOrderOperationLog
(
order
,
resultVo
);
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderOperationLogServiceImpl.java
View file @
eb82b202
...
...
@@ -107,6 +107,18 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
operationLog
.
setOperationUser
(
"接口"
);
operationLog
.
setContent
(
"机器推送已完成"
);
break
;
case
OrderStatusConstant
.
refunding
:
operationLog
.
setStatus
(
"退款"
);
operationLog
.
setOperation
(
"退款中"
);
operationLog
.
setOperationUser
(
"接口"
);
operationLog
.
setContent
(
"正在退款中"
);
break
;
case
OrderStatusConstant
.
PartialRefund
:
operationLog
.
setStatus
(
"退款"
);
operationLog
.
setOperation
(
"微信退款"
);
operationLog
.
setOperationUser
(
"接口"
);
operationLog
.
setContent
(
"正在退款中"
);
break
;
}
return
orderOperationLogMapper
.
insertOrderOperationLog
(
operationLog
);
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderRefundServiceImpl.java
View file @
eb82b202
...
...
@@ -36,8 +36,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
private
OrderRefundMapper
orderRefundMapper
;
@Autowired
private
OrderServiceImpl
orderService
;
@Autowired
private
OrderMapper
orderMapper
;
@Autowired
private
OrderSnapshotMapper
orderSnapshotMapper
;
@Autowired
...
...
@@ -95,7 +94,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
@Override
public
AjaxResult
insertOrderRefund
(
OrderRefund
orderRefund
)
{
Order
order
=
order
Mapper
.
selectOrder
ById
(
orderRefund
.
getOrderId
());
Order
order
=
order
Service
.
select
ById
(
orderRefund
.
getOrderId
());
if
(
order
==
null
){
return
AjaxResult
.
error
(
"找不到该订单"
);
}
...
...
@@ -103,7 +102,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
String
state
=
order
.
getState
();
List
<
String
>
status
=
Arrays
.
asList
(
OrderStatusConstant
.
production
,
OrderStatusConstant
.
productionCompleted
,
OrderStatusConstant
.
completed
);
if
(
OrderStatusConstant
.
Paid
.
equals
(
state
)){
cancel
(
order
);
orderRefund
.
setRefundAmount
(
order
.
getAmount
()
);
// 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成
}
else
if
(
status
.
contains
(
state
)){
String
desc
=
orderRefund
.
getDesc
();
...
...
@@ -126,7 +125,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
}
int
i
=
orderRefundMapper
.
insertOrderRefund
(
orderRefund
);
order
.
setState
(
OrderStatusConstant
.
refunding
);
order
Mapper
.
updateOrder
(
order
);
order
Service
.
updateOrder
(
order
);
orderRefund
.
setOrder
(
order
);
return
AjaxResult
.
success
(
orderRefund
);
}
...
...
@@ -134,14 +133,11 @@ public class OrderRefundServiceImpl implements IOrderRefundService
if
(
OrderStatusConstant
.
Unpaid
.
equals
(
order
.
getState
())){
order
.
setState
(
OrderStatusConstant
.
UnpaidCancel
);
order
.
setUpdatedAt
(
new
Date
());
orderMapper
.
updateOrder
(
order
);
machineApiService
.
updateOrder
(
order
);
orderService
.
updateOrder
(
order
);
}
else
if
(
OrderStatusConstant
.
Paid
.
equals
(
order
.
getState
())){
order
.
setState
(
OrderStatusConstant
.
PaidCancel
);
order
.
setUpdatedAt
(
new
Date
());
orderMapper
.
updateOrder
(
order
);
machineApiService
.
updateOrder
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
orderService
.
updateOrder
(
order
);
}
else
{
throw
new
ServiceException
(
"该订单不允许退款"
);
}
...
...
@@ -190,7 +186,7 @@ public class OrderRefundServiceImpl implements IOrderRefundService
}
else
{
throw
new
ServiceException
(
"该状态不允许退款"
);
}
Order
order
=
order
Mapper
.
selectOrder
ById
(
orderRefund
.
getOrderId
());
Order
order
=
order
Service
.
select
ById
(
orderRefund
.
getOrderId
());
orderRefund
.
setTotalFee
(
order
.
getAmount
());
return
orderRefund
;
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
eb82b202
package
com
.
soss
.
system
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -19,6 +20,8 @@ import com.soss.system.jiguang.impl.JiGuangPushServiceImpl;
import
com.soss.system.service.IOrderService
;
import
com.soss.system.domain.vo.OrderQuery
;
import
com.soss.system.mapper.*
;
import
com.soss.system.weixin.util.SendMessageUtils
;
import
org.aspectj.weaver.ast.Or
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.support.atomic.RedisAtomicInteger
;
...
...
@@ -56,6 +59,10 @@ public class OrderServiceImpl implements IOrderService
private
OrderSnapshotServiceImpl
orderSnapshotService
;
@Autowired
private
JiGuangPushServiceImpl
jiGuangPushService
;
@Autowired
private
WechatMessageServiceImpl
wechatMessageService
;
@Autowired
private
SendMessageUtils
sendMessageUtils
;
...
...
@@ -77,6 +84,10 @@ public class OrderServiceImpl implements IOrderService
return
order
;
}
public
Order
selectById
(
String
id
){
return
orderMapper
.
selectOrderById
(
id
);
}
/**
* 查询订单列表
*
...
...
@@ -92,6 +103,12 @@ public class OrderServiceImpl implements IOrderService
}
return
orders
;
}
public
List
<
Order
>
selectOrderList
(
Order
order
)
{
List
<
Order
>
orders
=
orderMapper
.
selectOrderList
(
order
);
return
orders
;
}
/**
* 新增订单
...
...
@@ -132,9 +149,18 @@ public class OrderServiceImpl implements IOrderService
return
AjaxResult
.
error
(
"该店铺暂无绑定机器"
);
}
}
int
i
=
orderMapper
.
insertOrder
(
order
);
List
<
OrderDetail
>
orderDetails
=
order
.
getOrderDetails
();
if
(
orderDetails
!=
null
&&
!
orderDetails
.
isEmpty
()){
BigDecimal
bigDecimal
=
new
BigDecimal
(
0
);
for
(
OrderDetail
orderDetail
:
orderDetails
)
{
bigDecimal
.
add
(
orderDetail
.
getRealAmount
().
multiply
(
new
BigDecimal
(
orderDetail
.
getNum
())));
}
if
(
order
.
getAmount
().
compareTo
(
bigDecimal
)!=
0
){
throw
new
ServiceException
(
"价格计算出现了问题,请重新计算"
);
}
order
.
setAmount
(
bigDecimal
);
int
i
=
orderMapper
.
insertOrder
(
order
);
for
(
OrderDetail
orderDetail
:
orderDetails
)
{
orderDetail
.
setOrderId
(
order
.
getId
());
orderDetail
.
setCreatedAt
(
new
Date
());
...
...
@@ -144,6 +170,7 @@ public class OrderServiceImpl implements IOrderService
}
}
//发送数据给机器
machineApiService
.
createOrder
(
order
);
orderOperationLogService
.
insertOrderOperationLog
(
order
);
orderSnapshotService
.
saveOrderSnapshot
(
order
);
...
...
@@ -152,18 +179,152 @@ public class OrderServiceImpl implements IOrderService
}
/**
* 修改订单
*
* @param order 订单
* @return 结果
*订单重写从这里开始,这里要承担大部分的业务逻辑,逻辑集中化处理
*/
@Override
public
int
updateOrder
(
Order
order
)
{
String
state
=
order
.
getState
();
switch
(
state
){
case
OrderStatusConstant
.
Paid
:
paidState
(
order
);
break
;
case
OrderStatusConstant
.
production
:
productionState
(
order
);
break
;
case
OrderStatusConstant
.
productionCompleted
:
productionCompletedState
(
order
);
break
;
case
OrderStatusConstant
.
Taking
:
takingState
(
order
);
break
;
case
OrderStatusConstant
.
completed
:
completedState
(
order
);
break
;
case
OrderStatusConstant
.
UnpaidCancel
:
case
OrderStatusConstant
.
PaidCancel
:
unpaidCancelState
(
order
);
break
;
case
OrderStatusConstant
.
refunding
:
refundingState
(
order
);
break
;
case
OrderStatusConstant
.
PartialRefund
:
case
OrderStatusConstant
.
refund
:
partialRefundState
(
order
);
break
;
}
order
.
setUpdatedAt
(
new
Date
());
return
orderMapper
.
updateOrder
(
order
);
}
/**
* 部分退款
* @param order
*/
private
void
partialRefundState
(
Order
order
)
{
jiGuangPushService
.
pushOrderState
(
order
);
machineApiService
.
updateOrder
(
order
);
}
/**
* 制作完成 机器给我们
* 记录日志
* 极光推送
* @param order
*/
private
void
completedState
(
Order
order
)
{
order
.
setFinishTime
(
new
Date
());
orderOperationLogService
.
insertOrderOperationLog
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
}
/**
* 退款中
* 极光推送
* 推送给机器
* @param order
*/
private
void
refundingState
(
Order
order
)
{
jiGuangPushService
.
pushOrderState
(
order
);
machineApiService
.
updateOrder
(
order
);
}
/**
* 未支付取消 支付取消
* 记录日志
* 发送给机器
* 极光推送
* @param order
*/
private
void
unpaidCancelState
(
Order
order
)
{
orderOperationLogService
.
insertOrderOperationLog
(
order
);
machineApiService
.
updateOrder
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
}
/**
* 取餐中
* 极光推送
* @param order
*/
private
void
takingState
(
Order
order
)
{
orderOperationLogService
.
insertOrderOperationLog
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
}
/**
* 制作完成待取餐
* 记录日志
* 极光推送
* 消息记录
* 发送推送消息
* @param order
*/
private
void
productionCompletedState
(
Order
order
)
{
orderOperationLogService
.
insertOrderOperationLog
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
wechatMessageService
.
insertWechatMessage
(
order
.
getUserId
(),
"制作完成,您的订单已经制作完成,现在可以去取餐啦!"
);
sendMessageUtils
.
sendWxMsg
(
order
);
}
/**
* 制作中,机器推送给我们
* 记录日志
* 发送消息给安卓
* 消息记录
* 发送推送消息
* @param order
*/
private
void
productionState
(
Order
order
)
{
orderOperationLogService
.
insertOrderOperationLog
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
wechatMessageService
.
insertWechatMessage
(
order
.
getUserId
(),
"制作提醒,您的订单已经开始制作,马上就能享受美味了!"
);
sendMessageUtils
.
sendWxMsg
(
order
);
}
/**
* 已付款要干这四件事
* 记录日志,
* 发送给机器
* 发送给安卓
* 消息记录
* 发送推送消息
* @param order
*/
private
void
paidState
(
Order
order
)
{
orderOperationLogService
.
insertOrderOperationLog
(
order
);
machineApiService
.
updateOrder
(
order
);
//极光推送
jiGuangPushService
.
pushOrderState
(
order
);
wechatMessageService
.
insertWechatMessage
(
order
.
getUserId
(),
"下单成功,您已经下单成功了~"
);
sendMessageUtils
.
sendWxMsg
(
order
);
}
/**
* 批量删除订单
*
* @param ids 需要删除的订单主键
...
...
@@ -231,16 +392,12 @@ public class OrderServiceImpl implements IOrderService
if
(
OrderStatusConstant
.
Unpaid
.
equals
(
order
.
getState
())){
order
.
setState
(
"8"
);
order
.
setUpdatedAt
(
new
Date
());
orderMapper
.
updateOrder
(
order
);
orderOperationLogService
.
insertOrderOperationLog
(
order
);
machineApiService
.
updateOrder
(
order
);
this
.
updateOrder
(
order
);
}
else
if
(
OrderStatusConstant
.
Paid
.
equals
(
order
.
getState
())){
order
.
setState
(
"9"
);
order
.
setUpdatedAt
(
new
Date
());
orderMapper
.
updateOrder
(
order
);
orderOperationLogService
.
insertOrderOperationLog
(
order
);
machineApiService
.
updateOrder
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
this
.
updateOrder
(
order
);
}
else
{
throw
new
ServiceException
(
"该订单不允许取消"
);
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/SysMenuServiceImpl.java
View file @
eb82b202
...
...
@@ -154,7 +154,7 @@ public class SysMenuServiceImpl implements ISysMenuService
router
.
setQuery
(
menu
.
getQuery
());
router
.
setMeta
(
new
MetaVo
(
menu
.
getMenuName
(),
menu
.
getIcon
(),
StringUtils
.
equals
(
"1"
,
menu
.
getIsCache
()),
menu
.
getPath
()));
List
<
SysMenu
>
cMenus
=
menu
.
getChildren
();
if
(!
cMenus
.
isEmpty
()
&&
cMenus
.
size
()
>
0
&&
UserConstants
.
TYPE_DIR
.
equals
(
menu
.
getMenuType
(
)))
if
(!
cMenus
.
isEmpty
()
&&
cMenus
.
size
()
>
0
&&
(
UserConstants
.
TYPE_DIR
.
equals
(
menu
.
getMenuType
())||
UserConstants
.
TYPE_MENU
.
equals
(
menu
.
getMenuType
()
)))
{
router
.
setAlwaysShow
(
true
);
router
.
setRedirect
(
"noRedirect"
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/SysRoleServiceImpl.java
View file @
eb82b202
...
...
@@ -388,8 +388,6 @@ public class SysRoleServiceImpl implements ISysRoleService
}
// 删除角色与菜单关联
roleMenuMapper
.
deleteRoleMenu
(
roleIds
);
// 删除角色与部门关联
roleDeptMapper
.
deleteRoleDept
(
roleIds
);
return
roleMapper
.
deleteRoleByIds
(
roleIds
);
}
...
...
soss-system/src/main/java/com/soss/system/weixin/util/SendMessageUtils.java
View file @
eb82b202
...
...
@@ -2,18 +2,26 @@ package com.soss.system.weixin.util;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONPath
;
import
com.soss.common.utils.DateUtils
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.Shop
;
import
com.soss.system.mapper.ShopMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
org.aspectj.weaver.ast.Or
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
@Slf4j
public
class
SendMessageUtils
{
...
...
@@ -25,6 +33,36 @@ public class SendMessageUtils {
private
String
pagePath
;
@Autowired
private
ShopMapper
shopMapper
;
private
String
templateInfo
=
"[{"
+
"\"status\": \"2\","
+
"\"templateId\": \"1uErx-15S-3vuopXSvvsxCeM_Jd-1iZC-nXzd2yW3QU\","
+
"\"param\": {"
+
"\"character_string1\": \"$.orderNum\","
+
"\"thing2\": \"$.shop.name\","
+
"\"thing12\": \"$.shop.address\","
+
"\"time7\": \"now\","
+
"\"thing6\": \"您的订单已经下单成功了~\""
+
"}"
+
"}, {"
+
"\"status\": \"3\","
+
"\"templateId\": \"Q4HDwBEvpTXpwtZktqWm4SZOTEuQK1x48xjqjD2GqyM\","
+
"\"param\": {"
+
"\"thing1\": \"$.shop.name\","
+
"\"date6\": \"now\","
+
"\"thing5\": \"您的订单已经开始制作了,马上就可以享用美食了!\""
+
"}"
+
"}, {"
+
"\"status\": \"4\","
+
"\"templateId\": \"Fu_CPIXa0cnJ4EDdVKqFQ3qqKJccMqt2oorI5mfNq74\","
+
"\"param\": {"
+
"\"character_string4\": \"$.orderNum\","
+
"\"thing2\": \"$.shop.name\","
+
"\"thing7\": \"$.shop.address\","
+
"\"time6\": \"now\","
+
"\"thing11\": \"您的订单已经制作完成了,现在可以去取餐啦!\""
+
"}"
+
"}]"
;
/**
* 设置会议订阅消息
*
...
...
@@ -60,14 +98,21 @@ public class SendMessageUtils {
*/
public
void
sendWxMsg
(
Order
order
)
{
//骚操作在这里
try
{
Map
<
String
,
Object
>
tempalte
=
getTempalte
(
order
);
if
(
tempalte
==
null
){
return
;
}
WxMaSubscribeMessage
.
WxMaSubscribeMessageBuilder
builder
=
WxMaSubscribeMessage
.
builder
();
//发送人openid
builder
.
toUser
(
order
.
getUserId
());
//发送的模板id
builder
.
templateId
(
templateId
);
builder
.
templateId
(
(
String
)
tempalte
.
get
(
"tempalte"
)
);
//消息主体
builder
.
data
(
setMeetingMsg
(
order
));
builder
.
data
(
(
List
<
WxMaSubscribeMessage
.
MsgData
>)
tempalte
.
get
(
"dataList"
));
//点击订阅消息的跳转链接(默认是正式发布的小程序页面,当然也可以通过参数进行控制)
builder
.
page
(
pagePath
);
WxMaSubscribeMessage
msg
=
builder
.
build
();
...
...
@@ -81,4 +126,38 @@ public class SendMessageUtils {
}
public
Map
<
String
,
Object
>
getTempalte
(
Order
order
){
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
templateInfo
);
Shop
shop
=
shopMapper
.
selectShopById
(
order
.
getShopId
());
order
.
setShop
(
shop
);
String
orderState
=
order
.
getState
();
Map
<
String
,
Object
>
result
=
null
;
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++){
JSONObject
tempalte
=
jsonArray
.
getJSONObject
(
i
);
if
(
orderState
.
equals
(
tempalte
.
getString
(
"status"
))){
List
<
WxMaSubscribeMessage
.
MsgData
>
dataList
=
new
ArrayList
<>();
result
=
new
HashMap
();
result
.
put
(
"tempalte"
,
tempalte
.
getString
(
"templateId"
));
result
.
put
(
"dataList"
,
dataList
);
JSONObject
params
=
tempalte
.
getJSONObject
(
"param"
);
params
.
forEach
((
key
,
value
)->{
WxMaSubscribeMessage
.
MsgData
data
=
new
WxMaSubscribeMessage
.
MsgData
();
dataList
.
add
(
data
);
String
valueString
=
(
String
)
value
;
data
.
setName
(
key
);
if
(
"now"
.
equals
(
valueString
)){
valueString
=
DateUtils
.
getTime
();
}
else
if
(
valueString
.
startsWith
(
"$"
)){
valueString
=
(
String
)
JSONPath
.
eval
(
order
,
valueString
);
}
data
.
setValue
(
valueString
);
});
}
}
return
result
;
}
}
soss-system/src/main/resources/mapper/system/SysMenuMapper.xml
View file @
eb82b202
...
...
@@ -50,7 +50,7 @@
<select
id=
"selectMenuTreeAll"
resultMap=
"SysMenuResult"
>
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
from sys_menu m where m.menu_type in ('M', 'C'
,'F'
) and m.status = 0
order by m.parent_id, m.order_num
</select>
...
...
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