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
059709dc
Commit
059709dc
authored
May 25, 2022
by
张新旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码永远在路上
parent
875859f8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
32 deletions
+41
-32
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
+26
-23
soss-system/src/main/java/com/soss/system/service/impl/OrderRefundServiceImpl.java
+7
-1
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+7
-7
soss-system/src/main/resources/mapper/system/OrderSnapshotMapper.xml
+1
-1
No files found.
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
View file @
059709dc
...
@@ -47,6 +47,8 @@ public class MachineApiServiceImpl {
...
@@ -47,6 +47,8 @@ public class MachineApiServiceImpl {
private
GoodsMapper
goodsMapper
;
private
GoodsMapper
goodsMapper
;
@Autowired
@Autowired
private
JiGuangPushServiceImpl
jiGuangPushService
;
private
JiGuangPushServiceImpl
jiGuangPushService
;
@Autowired
private
GoodsCategoryMapper
goodsCategoryMapper
;
public
String
shopGoodsUpdate
(
JSONObject
jsonObject
)
{
public
String
shopGoodsUpdate
(
JSONObject
jsonObject
)
{
String
shopID
=
jsonObject
.
getString
(
"shopId"
);
String
shopID
=
jsonObject
.
getString
(
"shopId"
);
...
@@ -103,15 +105,29 @@ public class MachineApiServiceImpl {
...
@@ -103,15 +105,29 @@ public class MachineApiServiceImpl {
Goods
goods
=
goodsMapper
.
selectGoodsById
(
detail
.
getGoodsId
());
Goods
goods
=
goodsMapper
.
selectGoodsById
(
detail
.
getGoodsId
());
detail
.
setGoods
(
goods
);
detail
.
setGoods
(
goods
);
}
}
order
.
setOrderDetails
(
orderDetails
);
createOrder
(
order
);
}
catch
(
Exception
e
){
log
.
error
(
""
,
e
);
}
}
public
ResultVo
createOrder
(
Order
order
){
String
orderInfo
=
null
;
JSONObject
orderJson
=
null
;
try
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
ObjectMapper
objectMapper
=
new
ObjectMapper
();
String
orderInfo
=
objectMapper
.
writeValueAsString
(
order
);
orderInfo
=
objectMapper
.
writeValueAsString
(
order
);
JSONObject
orderJson
=
JSONObject
.
parseObject
(
orderInfo
);
log
.
info
(
"创建订单数据为:【{}】"
,
orderInfo
);
orderJson
=
JSONObject
.
parseObject
(
orderInfo
);
orderJson
.
put
(
"goodsNum"
,
orderJson
.
getLong
(
"goodsNum"
));
orderJson
.
put
(
"goodsNum"
,
orderJson
.
getLong
(
"goodsNum"
));
orderJson
.
put
(
"machineId"
,
orderJson
.
getLong
(
"machineId"
));
orderJson
.
put
(
"machineId"
,
orderJson
.
getLong
(
"machineId"
));
orderJson
.
put
(
"shopId"
,
orderJson
.
getLong
(
"shopId"
));
orderJson
.
put
(
"shopId"
,
orderJson
.
getLong
(
"shopId"
));
orderJson
.
put
(
"state"
,
orderJson
.
getLong
(
"state"
));
orderJson
.
put
(
"state"
,
orderJson
.
getLong
(
"state"
));
List
<
JSONObject
>
goodsList
=
new
ArrayList
<>();
List
<
JSONObject
>
goodsList
=
new
ArrayList
<>();
orderJson
.
put
(
"goodsList"
,
goodsList
);
orderJson
.
put
(
"goodsList"
,
goodsList
);
List
<
OrderDetail
>
orderDetails
=
order
.
getOrderDetails
();
for
(
OrderDetail
detail
:
orderDetails
)
{
for
(
OrderDetail
detail
:
orderDetails
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
goodsList
.
add
(
jsonObject
);
goodsList
.
add
(
jsonObject
);
...
@@ -122,33 +138,20 @@ public class MachineApiServiceImpl {
...
@@ -122,33 +138,20 @@ public class MachineApiServiceImpl {
jsonObject
.
put
(
"specRuleDetail"
,
detail
.
getSpecRuleDetail
());
jsonObject
.
put
(
"specRuleDetail"
,
detail
.
getSpecRuleDetail
());
jsonObject
.
put
(
"specRuleIds"
,
detail
.
getSpecRuleIds
());
jsonObject
.
put
(
"specRuleIds"
,
detail
.
getSpecRuleIds
());
jsonObject
.
put
(
"skuId"
,
Long
.
parseLong
(
detail
.
getSkuId
()));
jsonObject
.
put
(
"skuId"
,
Long
.
parseLong
(
detail
.
getSkuId
()));
jsonObject
.
put
(
"goodsCategory"
,
detail
.
getGoods
().
getCategoryName
());
if
(
"0"
.
equals
(
detail
.
getGoodsCategory
())){
}
jsonObject
.
put
(
"goodsCategory"
,
"今日特惠"
);
}
else
{
GoodsCategory
goodsCategory
=
goodsCategoryMapper
.
selectGoodsCategoryById
(
detail
.
getGoodsCategory
());
jsonObject
.
put
(
"goodsCategory"
,
goodsCategory
.
getName
());
}
ResultVo
resultVo
=
sendRequest
(
orderJson
.
toJSONString
(),
"/v1/order"
);
String
code
=
resultVo
.
getCode
();
if
(
"2001"
.
equals
(
code
)){
throw
new
ServiceException
(
"库存不足"
);
}
else
if
(
"3001"
.
equals
(
code
)){
throw
new
ServiceException
(
"机器繁忙"
);
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
error
(
""
,
e
);
log
.
error
(
"初始化订单发生异常"
,
e
);
}
}
public
ResultVo
createOrder
(
Order
order
){
String
orderInfo
=
null
;
try
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
orderInfo
=
objectMapper
.
writeValueAsString
(
order
);
}
catch
(
Exception
e
){
throw
new
ServiceException
(
"初始订单数据异常,请重试"
);
throw
new
ServiceException
(
"初始订单数据异常,请重试"
);
}
}
ResultVo
resultVo
=
sendRequest
(
order
Info
,
"/v1/order"
);
ResultVo
resultVo
=
sendRequest
(
order
Json
.
toJSONString
()
,
"/v1/order"
);
String
code
=
resultVo
.
getCode
();
String
code
=
resultVo
.
getCode
();
if
(
"2001"
.
equals
(
code
)){
if
(
"2001"
.
equals
(
code
)){
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderRefundServiceImpl.java
View file @
059709dc
...
@@ -46,7 +46,13 @@ public class OrderRefundServiceImpl implements IOrderRefundService
...
@@ -46,7 +46,13 @@ public class OrderRefundServiceImpl implements IOrderRefundService
@Override
@Override
public
OrderRefund
selectOrderRefundById
(
String
id
)
public
OrderRefund
selectOrderRefundById
(
String
id
)
{
{
return
orderRefundMapper
.
selectOrderRefundById
(
id
);
OrderRefund
orderRefund
=
orderRefundMapper
.
selectOrderRefundById
(
id
);
Order
order
=
orderService
.
selectOrderById
(
orderRefund
.
getOrderId
());
OrderSnapshot
orderSnapshot
=
orderSnapshotMapper
.
selectOrderSnapshotByOrderId
(
order
.
getId
());
List
<
OrderDetail
>
orderDetails
=
JSONObject
.
parseArray
(
orderSnapshot
.
getSnapshot
(),
OrderDetail
.
class
);
order
.
setOrderDetails
(
orderDetails
);
orderRefund
.
setOrder
(
order
);
return
orderRefund
;
}
}
/**
/**
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
059709dc
...
@@ -63,13 +63,10 @@ public class OrderServiceImpl implements IOrderService
...
@@ -63,13 +63,10 @@ public class OrderServiceImpl implements IOrderService
{
{
Order
order
=
orderMapper
.
selectOrderById
(
id
);
Order
order
=
orderMapper
.
selectOrderById
(
id
);
order
.
setShop
(
shopMapper
.
selectShopById
(
order
.
getShopId
()));
order
.
setShop
(
shopMapper
.
selectShopById
(
order
.
getShopId
()));
OrderDetail
orderDetail
=
new
OrderDetail
();
OrderSnapshot
orderSnapshot
=
orderSnapshotService
.
selectOrderSnapshotByOrderId
(
order
.
getId
());
orderDetail
.
setOrderId
(
order
.
getId
());
String
snapshot
=
orderSnapshot
.
getSnapshot
();
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
List
<
OrderDetail
>
orderDetails1
=
JSONObject
.
parseArray
(
snapshot
,
OrderDetail
.
class
);
for
(
OrderDetail
detail
:
orderDetails
)
{
order
.
setOrderDetails
(
orderDetails1
);
detail
.
setGoods
(
goodsMapper
.
selectGoodsById
(
detail
.
getGoodsId
()));
}
order
.
setOrderDetails
(
orderDetails
);
return
order
;
return
order
;
}
}
...
@@ -111,6 +108,7 @@ public class OrderServiceImpl implements IOrderService
...
@@ -111,6 +108,7 @@ public class OrderServiceImpl implements IOrderService
order
.
setCreatedAt
(
new
Date
());
order
.
setCreatedAt
(
new
Date
());
order
.
setOrderNum
(
getOrderNum
(
order
.
getShopId
()));
order
.
setOrderNum
(
getOrderNum
(
order
.
getShopId
()));
order
.
setOrderNo
(
getOrderNo
(
order
.
getSource
()));
order
.
setOrderNo
(
getOrderNo
(
order
.
getSource
()));
order
.
setUpdatedAt
(
new
Date
());
String
machineId
=
null
;
String
machineId
=
null
;
if
(
StringUtils
.
isEmpty
(
order
.
getMachineId
())){
if
(
StringUtils
.
isEmpty
(
order
.
getMachineId
())){
Machine
machine
=
new
Machine
();
Machine
machine
=
new
Machine
();
...
@@ -224,12 +222,14 @@ public class OrderServiceImpl implements IOrderService
...
@@ -224,12 +222,14 @@ public class OrderServiceImpl implements IOrderService
}
}
@Override
@Override
@Transactional
public
int
cancel
(
String
orderId
)
{
public
int
cancel
(
String
orderId
)
{
Order
order
=
orderMapper
.
selectOrderById
(
orderId
);
Order
order
=
orderMapper
.
selectOrderById
(
orderId
);
if
(
"1"
.
equals
(
order
.
getState
())){
if
(
"1"
.
equals
(
order
.
getState
())){
order
.
setState
(
"7"
);
order
.
setState
(
"7"
);
order
.
setUpdatedAt
(
new
Date
());
order
.
setUpdatedAt
(
new
Date
());
orderMapper
.
updateOrder
(
order
);
orderMapper
.
updateOrder
(
order
);
machineApiService
.
updateOrder
(
order
);
}
else
{
}
else
{
throw
new
ServiceException
(
"该订单不允许取消"
);
throw
new
ServiceException
(
"该订单不允许取消"
);
}
}
...
...
soss-system/src/main/resources/mapper/system/OrderSnapshotMapper.xml
View file @
059709dc
...
@@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</where>
</select>
</select>
<select
id=
"selectOrderSnapshotByOrderId"
parameterType=
"String"
resultMap=
"OrderSnapshotResult"
>
<select
id=
"selectOrderSnapshotByOrderId"
resultMap=
"OrderSnapshotResult"
>
<include
refid=
"selectOrderSnapshotVo"
/>
<include
refid=
"selectOrderSnapshotVo"
/>
where order_id = #{orderId}
where order_id = #{orderId}
</select>
</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