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
3a6a9b53
Commit
3a6a9b53
authored
Jun 26, 2022
by
张新旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
前进前进,继续上代码
parent
11922e0a
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
94 additions
and
5 deletions
+94
-5
soss-admin/src/main/java/com/soss/web/controller/coffee/AppController.java
+5
-0
soss-system/src/main/java/com/soss/system/mapper/OrderMapper.java
+2
-0
soss-system/src/main/java/com/soss/system/schedule/OrderSchedule.java
+14
-3
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
+20
-0
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+34
-1
soss-system/src/main/java/com/soss/system/service/impl/ShopRecommendServiceImpl.java
+1
-0
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+7
-0
soss-system/src/main/resources/mapper/system/OrderMapper.xml
+10
-0
soss-system/src/main/resources/mapper/system/ShopMapper.xml
+1
-1
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/AppController.java
View file @
3a6a9b53
...
...
@@ -77,6 +77,11 @@ public class AppController extends BaseController {
String
info
=
orderService
.
getWaitTime
(
order
);
return
AjaxResult
.
success
(
"操作成功"
,
info
);
}
@RequestMapping
(
"/getWaitTineByOrderId"
)
public
AjaxResult
getWaitTineByOrderId
(
Long
orderId
){
String
info
=
orderService
.
getWaitTimeByOrderId
(
orderId
);
return
AjaxResult
.
success
(
"操作成功"
,
info
);
}
...
...
soss-system/src/main/java/com/soss/system/mapper/OrderMapper.java
View file @
3a6a9b53
...
...
@@ -83,4 +83,6 @@ public interface OrderMapper
void
updateCancel
(
@Param
(
"status"
)
String
unpaid
,
@Param
(
"timeout"
)
int
i
);
List
<
Order
>
selectOrderByTime
(
@Param
(
"status"
)
String
unpaid
,
@Param
(
"timeout"
)
int
i
);
List
<
Order
>
selectBeforeOrder
(
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"orderId"
)
Long
orderId
);
}
soss-system/src/main/java/com/soss/system/schedule/OrderSchedule.java
View file @
3a6a9b53
...
...
@@ -5,6 +5,7 @@ import com.soss.system.domain.Order;
import
com.soss.system.domain.OrderOperationLog
;
import
com.soss.system.mapper.OrderMapper
;
import
com.soss.system.mapper.OrderOperationLogMapper
;
import
com.soss.system.service.impl.OrderServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Scheduled
;
...
...
@@ -18,15 +19,25 @@ public class OrderSchedule {
@Autowired
private
OrderMapper
orderMapper
;
@Value
(
"${timeout}"
)
private
String
timeout
;
private
Integer
timeout
;
@Autowired
private
OrderOperationLogMapper
operationLogMapper
;
@Autowired
private
OrderServiceImpl
orderService
;
@Scheduled
(
fixedDelay
=
60
*
1000
)
private
void
process
()
{
orderMapper
.
updateTimeOut
(
OrderStatusConstant
.
productionCompleted
,
timeout
);
//orderMapper.updateTimeOut(OrderStatusConstant.productionCompleted,timeout);
List
<
Order
>
orders1
=
orderMapper
.
selectOrderByTime
(
OrderStatusConstant
.
productionCompleted
,
timeout
);
if
(
orders1
!=
null
&&
orders1
.
size
()>
0
){
for
(
Order
order
:
orders1
)
{
order
.
setState
(
OrderStatusConstant
.
timeout
);
order
.
setUpdatedAt
(
new
Date
());
orderService
.
updateOrder
(
order
);
}
}
//orderMapper.updateCancel(OrderStatusConstant.Unpaid,15);
List
<
Order
>
orders
=
orderMapper
.
selectOrderByTime
(
OrderStatusConstant
.
Unpaid
,
15
);
List
<
Order
>
orders
=
orderMapper
.
selectOrderByTime
(
OrderStatusConstant
.
Unpaid
,
15
*
60
);
if
(
orders
!=
null
&&
orders
.
size
()>
0
){
for
(
Order
order
:
orders
)
{
order
.
setState
(
OrderStatusConstant
.
UnpaidCancel
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
View file @
3a6a9b53
...
...
@@ -5,10 +5,12 @@ import java.util.*;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.GenerateCode
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.*
;
import
com.soss.system.jiguang.impl.JiGuangPushServiceImpl
;
import
com.soss.system.service.IGoodsService
;
import
com.soss.system.mapper.*
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -45,6 +47,10 @@ public class GoodsServiceImpl implements IGoodsService
private
GoodsCategoryMapper
goodsCategoryMapper
;
@Autowired
private
ShopRecommendMapper
shopRecommendMapper
;
@Autowired
private
MachineMapper
machineMapper
;
@Autowired
private
JiGuangPushServiceImpl
jiGuangPushService
;
/**
...
...
@@ -312,10 +318,24 @@ public class GoodsServiceImpl implements IGoodsService
shopGoodsSkuMapper
.
deleteShopGoodsSkuByGoodsId
(
shopGoods1
.
getGoodsId
());
List
<
String
>
goodsIds
=
Arrays
.
asList
(
String
.
valueOf
(
shopGoods1
.
getGoodsId
()));
shopRecommendMapper
.
deleteByShopIdGoods
(
shopGoods1
.
getShopId
(),
goodsIds
);
updateApplication
(
shopGoods1
.
getShopId
());
}
return
i
+
""
;
}
public
void
updateApplication
(
long
shopId
){
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
shopId
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(!
machines
.
isEmpty
()){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"GOODS_CHANGED"
);
jsonObject
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
jiGuangPushService
.
push
(
machines
.
get
(
0
).
getCode
(),
jsonObject
);
}
}
@Override
public
String
deleteGoodsById
(
Long
id
,
boolean
boo
)
{
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
3a6a9b53
...
...
@@ -212,6 +212,9 @@ public class OrderServiceImpl implements IOrderService
case
OrderStatusConstant
.
completed
:
completedState
(
order
);
break
;
case
OrderStatusConstant
.
timeout
:
timeoutState
(
order
);
break
;
case
OrderStatusConstant
.
UnpaidCancel
:
case
OrderStatusConstant
.
PaidCancel
:
unpaidCancelState
(
order
);
...
...
@@ -229,6 +232,10 @@ public class OrderServiceImpl implements IOrderService
return
orderMapper
.
updateOrder
(
order
);
}
private
void
timeoutState
(
Order
order
)
{
jiGuangPushService
.
pushOrderState
(
order
);
}
/**
* 部分退款
* @param order
...
...
@@ -517,7 +524,7 @@ public class OrderServiceImpl implements IOrderService
orderDetail
.
setOrderId
(
order
.
getId
());
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
order
.
setOrderDetails
(
orderDetails
);
String
waitTime
=
getWaitTime
(
order
);
String
waitTime
=
getWaitTime
ByOrderId
(
order
.
getId
()
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"waitTime"
,
waitTime
);
map
.
put
(
"pickCode"
,
order
.
getPickCode
());
...
...
@@ -554,6 +561,32 @@ public class OrderServiceImpl implements IOrderService
}
public
String
getWaitTimeByOrderId
(
Long
orderId
)
{
List
<
String
>
status
=
Arrays
.
asList
(
OrderStatusConstant
.
Paid
,
OrderStatusConstant
.
production
);
List
<
Order
>
orders
=
orderMapper
.
selectBeforeOrder
(
status
,
orderId
);
List
<
OrderDetail
>
list
=
new
ArrayList
<>();
for
(
Order
order1
:
orders
)
{
OrderDetail
orderDetail
=
new
OrderDetail
();
orderDetail
.
setOrderId
(
order1
.
getId
());
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
if
(
CollectionUtils
.
isEmpty
(
orderDetails
)){
}
else
{
list
.
addAll
(
orderDetails
);
}
}
Long
takeTimeCount
=
0L
;
for
(
OrderDetail
orderDetail
:
list
)
{
Long
takeTime
=
goodsMapper
.
selectGoodsById
(
orderDetail
.
getGoodsId
()).
getTakeTime
();
takeTime
=
Integer
.
parseInt
(
orderDetail
.
getNum
())*
takeTime
;
takeTimeCount
+=
takeTime
;
}
return
String
.
valueOf
((
int
)(
takeTimeCount
/
60
));
}
public
List
<
GoodsVo
>
getNextOrder
(
String
orderId
,
String
shopId
)
{
OrderDetail
orderDetail
=
new
OrderDetail
();
orderDetail
.
setOrderId
(
Long
.
parseLong
(
orderId
));
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopRecommendServiceImpl.java
View file @
3a6a9b53
...
...
@@ -174,6 +174,7 @@ public class ShopRecommendServiceImpl implements IShopRecommendService
last
.
setTurn
(
turn
);
shopRecommendMapper
.
updateShopRecommend
(
frist
);
shopRecommendMapper
.
updateShopRecommend
(
last
);
updateApplication
(
Long
.
parseLong
(
shopRecommend
.
getShopId
()));
return
null
;
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
View file @
3a6a9b53
...
...
@@ -308,6 +308,13 @@ public class ShopServiceImpl implements IShopService
lastShopGoods
.
setTurn
(
turn
);
shopGoodsMapper
.
updateShopGoods
(
fristShopGoods
);
shopGoodsMapper
.
updateShopGoods
(
lastShopGoods
);
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
shopId
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(!
machines
.
isEmpty
()){
Machine
machine1
=
machines
.
get
(
0
);
updateApplication
(
machine1
.
getCode
());
}
return
null
;
}
...
...
soss-system/src/main/resources/mapper/system/OrderMapper.xml
View file @
3a6a9b53
...
...
@@ -244,6 +244,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include
refid=
"selectOrderVo"
/>
where state =#{status} and updated_at
<
DATE_SUB(NOW() ,interval #{timeout} SECOND)
</select>
<select
id=
"selectBeforeOrder"
resultType=
"com.soss.system.domain.Order"
>
select id, order_no, order_num, user_id, user_name, user_phone, pay_time, finish_time, amount, goods_num, pick_code, shop_id, machine_id, source, state, created_at, updated_at
from `order` o where o.id
<
#{orderId} and o.shop_id =(select DISTINCT a.shop_id from `order` a where a.id=#{orderId})
and state in
<foreach
item=
"item"
index=
"index"
collection=
"status"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</select>
<update
id=
"updateCancel"
>
update `order` set state='8' where state =#{status} and updated_at
<
DATE_SUB(NOW() ,interval #{timeout} SECOND)
</update>
...
...
soss-system/src/main/resources/mapper/system/ShopMapper.xml
View file @
3a6a9b53
...
...
@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createdAt != null "
>
and s.created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and s.updated_at = #{updatedAt}
</if>
<if
test=
"isDefault != null "
>
and s.is_default = #{isDefault}
</if>
<if
test=
"machineCode!=null"
>
and m.code =#{machineCode}
</if>
<if
test=
"machineCode!=null
and machineCode != ''
"
>
and m.code =#{machineCode}
</if>
</where>
</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