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
875859f8
Commit
875859f8
authored
May 25, 2022
by
张新旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码永远在路上
parent
4afda118
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
277 additions
and
33 deletions
+277
-33
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
+7
-0
soss-admin/src/main/java/com/soss/web/controller/coffee/WeixinController.java
+7
-0
soss-admin/src/main/resources/application.yml
+2
-0
soss-admin/src/main/resources/province.json
+0
-0
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
+156
-12
soss-system/src/main/java/com/soss/system/domain/ShopRecommend.java
+10
-0
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/RecommendVo.java
+10
-0
soss-system/src/main/java/com/soss/system/jiguang/impl/JiGuangPushServiceImpl.java
+18
-0
soss-system/src/main/java/com/soss/system/mapper/ShopRecommendMapper.java
+1
-1
soss-system/src/main/java/com/soss/system/service/IOrderService.java
+2
-0
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
+1
-1
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
+19
-10
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
+14
-1
soss-system/src/main/java/com/soss/system/service/impl/OrderRefundServiceImpl.java
+2
-2
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+17
-2
soss-system/src/main/java/com/soss/system/service/impl/OrderTakingServiceImpl.java
+3
-2
soss-system/src/main/java/com/soss/system/service/impl/SpecServiceImpl.java
+1
-1
soss-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
+7
-1
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
View file @
875859f8
...
...
@@ -108,6 +108,13 @@ public class OrderController extends BaseController
{
return
toAjax
(
orderService
.
updateOrder
(
order
));
}
@RequestMapping
(
"/cancel"
)
public
AjaxResult
cancel
(
String
orderId
)
{
return
toAjax
(
orderService
.
cancel
(
orderId
));
}
}
soss-admin/src/main/java/com/soss/web/controller/coffee/WeixinController.java
View file @
875859f8
...
...
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
@RestController
...
...
@@ -65,6 +66,12 @@ public class WeixinController {
public
AjaxResult
getShop
(
@RequestParam
(
required
=
false
)
String
lng
,
@RequestParam
(
required
=
false
)
String
lat
){
return
AjaxResult
.
success
(
appService
.
getShop
(
lng
,
lat
));
}
@RequestMapping
(
"/getArea"
)
public
AjaxResult
getArea
(
@RequestParam
(
required
=
false
)
String
lng
,
@RequestParam
(
required
=
false
)
String
lat
){
List
<
JSONObject
>
area
=
weixinService
.
getArea
(
lng
,
lat
);
return
AjaxResult
.
success
(
area
);
}
@GetMapping
(
value
=
"/infoByShop"
)
...
...
soss-admin/src/main/resources/application.yml
View file @
875859f8
...
...
@@ -107,3 +107,5 @@ push:
secret
:
b58cb126f80ec9bf7577a213
machine
:
url
:
http://47.94.241.71:10003
json
:
path
:
D:\workspecs\soss\soss\soss-admin\src\main\resources/province.json
soss-admin/src/main/resources/province.json
0 → 100644
View file @
875859f8
This source diff could not be displayed because it is too large. You can
view the blob
instead.
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
View file @
875859f8
package
com
.
soss
.
framework
.
web
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONPath
;
import
com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse
;
import
com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult
;
import
com.github.binarywang.wxpay.bean.request.WxPayRefundRequest
;
...
...
@@ -21,15 +23,13 @@ import com.soss.common.utils.QRCodeUtil;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.ip.IpUtils
;
import
com.soss.common.utils.sign.Base64
;
import
com.soss.system.domain.Customer
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.OrderOperationLog
;
import
com.soss.system.domain.OrderRefund
;
import
com.soss.system.domain.*
;
import
com.soss.system.jiguang.impl.JiGuangPushServiceImpl
;
import
com.soss.system.mapper.CustomerMapper
;
import
com.soss.system.mapper.OrderMapper
;
import
com.soss.system.mapper.OrderRefundMapper
;
import
com.soss.system.mapper.ShopMapper
;
import
com.soss.system.service.impl.MachineApiServiceImpl
;
import
com.soss.system.service.impl.OrderOperationLogServiceImpl
;
import
com.soss.system.weixin.entity.OrderInfo
;
...
...
@@ -44,10 +44,16 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.web.JsonPath
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.PostConstruct
;
import
javax.crypto.Cipher
;
import
javax.crypto.spec.IvParameterSpec
;
import
javax.crypto.spec.SecretKeySpec
;
...
...
@@ -55,6 +61,7 @@ import javax.servlet.http.HttpServletRequest;
import
java.io.*
;
import
java.net.InetAddress
;
import
java.security.spec.AlgorithmParameterSpec
;
import
java.text.DecimalFormat
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.locks.ReentrantLock
;
...
...
@@ -83,6 +90,8 @@ public class WeixinServiceImpl {
private
OrderRefundMapper
orderRefundMapper
;
@Autowired
private
JiGuangPushServiceImpl
jiGuangPushService
;
@Autowired
private
ShopMapper
shopMapper
;
private
final
ReentrantLock
lock
=
new
ReentrantLock
();
...
...
@@ -110,6 +119,9 @@ public class WeixinServiceImpl {
private
String
certPath
;
@Value
(
"${weixin.refund-url}"
)
private
String
refundUrl
;
private
String
areaData
;
@Value
(
"${json.path}"
)
private
String
jsonPath
;
public
String
getSessionKeyOrOpenId
(
String
code
)
{
String
url
=
"https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code"
;
...
...
@@ -117,6 +129,23 @@ public class WeixinServiceImpl {
String
res
=
restTemplate
.
getForObject
(
replaceUrl
,
String
.
class
);
return
res
;
}
@PostConstruct
public
void
getData
(){
try
{
File
file
=
new
File
(
jsonPath
);
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
FileReader
(
file
));
StringBuilder
builder
=
new
StringBuilder
();
String
line
=
null
;
while
((
line
=
bufferedReader
.
readLine
())!=
null
){
builder
.
append
(
line
);
}
areaData
=
builder
.
toString
();
}
catch
(
Exception
e
){
log
.
error
(
""
,
e
);
}
}
public
String
login
(
String
code
,
String
encryptedData
,
String
iv
,
String
source
)
{
try
{
...
...
@@ -133,6 +162,7 @@ public class WeixinServiceImpl {
customer
.
setHeadSculpturePath
(
encDataInf
.
getString
(
"avatarUrl"
));
customer
.
setUserName
(
encDataInf
.
getString
(
"nickName"
));
customer
.
setPhone
(
encDataInf
.
getString
(
"phoneNumber"
));
customer
.
setUserName
(
"小呼噜"
+
customer
.
getPhone
().
substring
(
customer
.
getPhone
().
length
()-
4
));
customer
.
setCreateTime
(
new
Date
());
if
(
StringUtils
.
isNotEmpty
(
source
)){
customer
.
setSoucre
(
source
);
...
...
@@ -426,12 +456,10 @@ public class WeixinServiceImpl {
orderOperationLogService
.
insertOrderOperationLog
(
"已付款"
,
order
.
getId
(),
"付款成功"
,
order
.
getUserName
(),
"付款"
);
machineApiService
.
updateOrder
(
order
);
//极光推送
String
machineId
=
order
.
getMachineId
();
Map
map
=
new
HashMap
();
map
.
put
(
"type"
,
"2"
);
map
.
put
(
"orderId"
,
order
.
getId
());
map
.
put
(
"state"
,
order
.
getState
());
jiGuangPushService
.
pushMachine
(
machineId
,
map
);
jiGuangPushService
.
pushOrderState
(
order
);
}
}
finally
{
//要主动释放锁
...
...
@@ -494,14 +522,20 @@ public class WeixinServiceImpl {
return
WxPayNotifyResponse
.
fail
(
"退款失败"
);
}
OrderRefund
orderRefund1
=
orderRefunds
.
get
(
0
);
Order
order
=
orderMapper
.
selectOrderById
(
orderRefund1
.
getOrderId
());
if
(
"1"
.
equals
(
orderRefund1
.
getState
())){
orderRefund1
.
setState
(
"2"
);
orderRefundMapper
.
updateOrderRefund
(
orderRefund1
);
OrderOperationLog
orderOperationLog
=
new
OrderOperationLog
();
orderOperationLog
.
setOrderId
(
String
.
valueOf
(
orderRefund1
.
getOrderId
()));
order
.
setState
(
"11"
);
if
(
orderRefund1
.
getRefundAmount
().
compareTo
(
order
.
getAmount
())<
0
){
order
.
setState
(
"12"
);
}
orderMapper
.
updateOrder
(
order
);
orderOperationLogService
.
insertOrderOperationLog
(
"已退款"
,
Long
.
valueOf
(
orderRefund
.
getOrderId
()),
"用户退款成功,已到账"
,
"系统"
,
"退款"
);
machineApiService
.
updateOrder
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
return
WxPayNotifyResponse
.
success
(
"退款成功!"
);
}
...
...
@@ -519,4 +553,114 @@ public class WeixinServiceImpl {
}
return
WxPayNotifyResponse
.
fail
(
"回调有误!"
);
}
public
List
<
JSONObject
>
getArea
(
String
lng
,
String
lat
)
{
String
provinceString
=
"[value ='%s'][0].name"
;
String
cityString
=
"[value='%s'][0].children[value='%s'][0].name"
;
String
zoneString
=
"[value='%s'][0].children[value='%s'][0].children[value='%s'][0].name"
;
Shop
shop
=
new
Shop
();
shop
.
setState
(
"1"
);
List
<
Shop
>
shops
=
shopMapper
.
selectShopList
(
shop
);
List
<
JSONObject
>
proviceList
=
new
ArrayList
<>();
List
<
String
>
proString
=
new
ArrayList
<>();
for
(
Shop
shop1
:
shops
)
{
double
v
=
GetDistance
(
Double
.
parseDouble
(
lng
),
Double
.
parseDouble
(
lat
),
Double
.
parseDouble
(
shop1
.
getLng
()),
Double
.
parseDouble
(
shop1
.
getLat
()));
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
);
shop1
.
setDistance
(
df
.
format
(
v
));
String
province
=
shop1
.
getProvince
();
if
(
proString
.
contains
(
province
)){
for
(
JSONObject
provinceObject
:
proviceList
)
{
if
(
province
.
equals
(
provinceObject
.
getString
(
"value"
))){
JSONArray
cityChild
=
provinceObject
.
getJSONArray
(
"children"
);
boolean
cityboo
=
true
;
for
(
int
i
=
0
;
i
<
cityChild
.
size
();
i
++){
JSONObject
city
=
cityChild
.
getJSONObject
(
i
);
if
(
shop1
.
getCity
().
equals
(
city
.
getString
(
"value"
))){
cityboo
=
false
;
JSONArray
zooeObject
=
city
.
getJSONArray
(
"children"
);
boolean
zoneBoo
=
true
;
for
(
int
j
=
0
;
j
<
zooeObject
.
size
();
j
++){
JSONObject
zooe
=
zooeObject
.
getJSONObject
(
j
);
if
(
shop1
.
getZone
().
equals
(
zooe
.
getString
(
"value"
))){
zoneBoo
=
false
;
zooe
.
getJSONArray
(
"shops"
).
add
(
shop1
);
}
}
if
(
zoneBoo
){
JSONObject
zone
=
new
JSONObject
();
zone
.
put
(
"value"
,
shop1
.
getZone
());
zone
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
zoneString
,
province
,
shop1
.
getCity
(),
shop1
.
getZone
())));
zooeObject
.
add
(
zone
);
List
<
Shop
>
shopList
=
new
ArrayList
<>();
shopList
.
add
(
shop1
);
zone
.
put
(
"shops"
,
shopList
);
}
}
}
if
(
cityboo
){
JSONObject
city
=
new
JSONObject
();
city
.
put
(
"value"
,
shop1
.
getCity
());
city
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
cityString
,
province
,
shop1
.
getCity
())));
cityChild
.
add
(
city
);
}
}
}
}
else
{
proString
.
add
(
province
);
JSONObject
provice
=
new
JSONObject
();
provice
.
put
(
"value"
,
province
);
String
format
=
String
.
format
(
provinceString
,
province
);
provice
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
format
));
proviceList
.
add
(
provice
);
JSONObject
city
=
new
JSONObject
();
city
.
put
(
"value"
,
shop1
.
getCity
());
city
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
cityString
,
province
,
shop1
.
getCity
())));
List
<
JSONObject
>
citys
=
new
ArrayList
<>();
citys
.
add
(
city
);
provice
.
put
(
"children"
,
citys
);
JSONObject
zone
=
new
JSONObject
();
zone
.
put
(
"value"
,
shop1
.
getZone
());
zone
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
zoneString
,
province
,
shop1
.
getCity
(),
shop1
.
getZone
())));
List
<
Shop
>
shopList
=
new
ArrayList
<>();
shopList
.
add
(
shop1
);
zone
.
put
(
"shops"
,
shopList
);
List
<
JSONObject
>
zones
=
new
ArrayList
<>();
zones
.
add
(
zone
);
city
.
put
(
"children"
,
zones
);
}
}
return
proviceList
;
}
private
static
final
double
EARTH_RADIUS
=
6378137
;
/**
* 根据两点间经纬度坐标(double值),计算两点间距离,单位为米
* @param lng1
* @param lat1
* @param lng2
* @param lat2
* @return
*/
public
static
double
GetDistance
(
double
lng1
,
double
lat1
,
double
lng2
,
double
lat2
)
{
double
radLat1
=
rad
(
lat1
);
double
radLat2
=
rad
(
lat2
);
double
a
=
radLat1
-
radLat2
;
double
b
=
rad
(
lng1
)
-
rad
(
lng2
);
double
s
=
2
*
Math
.
asin
(
Math
.
sqrt
(
Math
.
pow
(
Math
.
sin
(
a
/
2
),
2
)
+
Math
.
cos
(
radLat1
)*
Math
.
cos
(
radLat2
)*
Math
.
pow
(
Math
.
sin
(
b
/
2
),
2
)));
s
=
s
*
EARTH_RADIUS
;
s
=
Math
.
round
(
s
*
10000
)
/
10000
;
return
s
;
}
private
static
double
rad
(
double
d
)
{
return
d
*
Math
.
PI
/
180.0
;
}
}
soss-system/src/main/java/com/soss/system/domain/ShopRecommend.java
View file @
875859f8
...
...
@@ -44,10 +44,20 @@ public class ShopRecommend extends BaseEntity
@Excel
(
name
=
"推荐排序"
)
private
String
turn
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
/** 描述 */
@Excel
(
name
=
"描述"
)
private
String
desc
;
private
String
name
;
/** 类型 1 点单屏推荐 2 今日特惠 */
@Excel
(
name
=
"类型 1 点单屏推荐 2 今日特惠"
)
private
String
type
;
...
...
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/RecommendVo.java
View file @
875859f8
...
...
@@ -7,6 +7,16 @@ public class RecommendVo implements Serializable {
private
String
goodsName
;
private
String
pic
;
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
private
String
title
;
public
String
getGoodsName
()
{
return
goodsName
;
}
...
...
soss-system/src/main/java/com/soss/system/jiguang/impl/JiGuangPushServiceImpl.java
View file @
875859f8
...
...
@@ -3,6 +3,7 @@ package com.soss.system.jiguang.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.Machine
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.PushBean
;
import
com.soss.system.jiguang.JiGuangPushService
;
import
com.soss.system.jiguang.MyJiGuangPushService
;
...
...
@@ -111,4 +112,21 @@ public class JiGuangPushServiceImpl implements JiGuangPushService {
pushAndroid
(
pushBean
,
machine
.
getRegister
());
}
}
public
void
pushOrderState
(
Order
order
)
{
Machine
machine
=
machineMapper
.
selectMachineById
(
order
.
getMachineId
());
if
(
StringUtils
.
isNotEmpty
(
machine
.
getRegister
())){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"ORDER_STATE_CHANGED"
);
jsonObject
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"orderId"
,
order
.
getId
());
data
.
put
(
"orderNo"
,
order
.
getOrderNo
());
data
.
put
(
"state"
,
order
.
getState
());
PushBean
pushBean
=
new
PushBean
();
pushBean
.
setMessageCount
(
jsonObject
);
pushAndroid
(
pushBean
,
machine
.
getRegister
());
}
}
}
soss-system/src/main/java/com/soss/system/mapper/ShopRecommendMapper.java
View file @
875859f8
...
...
@@ -67,5 +67,5 @@ public interface ShopRecommendMapper
List
<
Goods
>
selectShopRecommendGoods
(
@Param
(
"shopId"
)
String
shopId
,
@Param
(
"type"
)
String
type
);
void
deleteByShopIdGoods
(
Long
shopId
,
List
<
String
>
goodsIds
);
void
deleteByShopIdGoods
(
@Param
(
"shopId"
)
Long
shopId
,
@Param
(
"goodsIds"
)
List
<
String
>
goodsIds
);
}
soss-system/src/main/java/com/soss/system/service/IOrderService.java
View file @
875859f8
...
...
@@ -68,4 +68,6 @@ public interface IOrderService
AjaxResult
check
(
Order
order
);
List
<
Order
>
getMyOrder
(
String
openId
);
int
cancel
(
String
orderId
);
}
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
View file @
875859f8
...
...
@@ -15,7 +15,7 @@ public class AppServiceImpl {
@Autowired
private
ShopMapper
shopMapper
;
public
List
<
Shop
>
getShop
(
String
lng
,
String
lat
)
{
if
(
StringUtils
.
is
NotEmpty
(
lng
)||
StringUtils
.
isNot
Empty
(
lat
)){
if
(
StringUtils
.
is
Empty
(
lng
)||
StringUtils
.
is
Empty
(
lat
)){
Shop
shop
=
new
Shop
();
shop
.
setState
(
"1"
);
shop
.
setIsDefault
(
0L
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
View file @
875859f8
...
...
@@ -14,6 +14,7 @@ import com.soss.common.utils.StringUtils;
import
com.soss.system.domain.*
;
import
com.soss.system.service.IGoodsService
;
import
com.soss.system.mapper.*
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -43,6 +44,9 @@ public class GoodsServiceImpl implements IGoodsService
private
OrderMapper
orderMapper
;
@Autowired
private
GoodsCategoryMapper
goodsCategoryMapper
;
ThreadLocal
<
BigDecimal
>
discountThread
=
new
ThreadLocal
();
ThreadLocal
<
BigDecimal
>
priceThread
=
new
ThreadLocal
();
/**
* 查询商品
...
...
@@ -152,13 +156,18 @@ public class GoodsServiceImpl implements IGoodsService
private
void
createSku
(
List
<
RuleNode
>
ruleNodeList
,
long
goodsId
,
BigDecimal
discount
,
BigDecimal
price
)
{
for
(
RuleNode
<
SpecRule
>
ruleNode
:
ruleNodeList
)
{
List
<
SpecRule
>
specRuleList
=
new
ArrayList
<>();
BigDecimal
bigDecimal
=
new
BigDecimal
(
price
.
toString
());
BigDecimal
disCount
=
new
BigDecimal
(
discount
.
toString
());
RuleNode
<
SpecRule
>
parentRuleNode
=
ruleNode
.
getParentRuleNode
();
specRuleList
.
add
(
ruleNode
.
getRuleNode
());
bigDecimal
=
bigDecimal
.
add
(
ruleNode
.
getRuleNode
().
getAmount
());
priceThread
.
set
(
price
);
discountThread
.
set
(
discount
);
priceThread
.
set
(
priceThread
.
get
().
add
(
ruleNode
.
getRuleNode
().
getAmount
()));
discountThread
.
set
(
discountThread
.
get
().
add
(
ruleNode
.
getRuleNode
().
getAmount
()));
System
.
err
.
println
(
priceThread
.
get
());
System
.
err
.
println
(
discountThread
.
get
());
if
(
parentRuleNode
!=
null
){
findPartentRuleNode
(
parentRuleNode
,
specRuleList
,
bigDecimal
,
disCount
);
findPartentRuleNode
(
parentRuleNode
,
specRuleList
);
}
Collections
.
reverse
(
specRuleList
);
GoodsSku
goodsSku
=
new
GoodsSku
();
...
...
@@ -166,20 +175,20 @@ public class GoodsServiceImpl implements IGoodsService
goodsSku
.
setCreatedAt
(
new
Date
());
goodsSku
.
setIsDeleted
(
"0"
);
goodsSku
.
setUpdatedAt
(
new
Date
());
goodsSku
.
setPrice
(
bigDecimal
);
goodsSku
.
setDiscount
(
discount
);
goodsSku
.
setPrice
(
priceThread
.
get
()
);
goodsSku
.
setDiscount
(
discount
Thread
.
get
()
);
goodsSku
.
setRuleList
(
JSONArray
.
toJSONString
(
specRuleList
));
goodsSkuMapper
.
insertGoodsSku
(
goodsSku
);
}
}
private
void
findPartentRuleNode
(
RuleNode
<
SpecRule
>
ruleRuleNode
,
List
<
SpecRule
>
specRuleList
,
BigDecimal
bigDecimal
,
BigDecimal
disCount
)
{
private
void
findPartentRuleNode
(
RuleNode
<
SpecRule
>
ruleRuleNode
,
List
<
SpecRule
>
specRuleList
)
{
specRuleList
.
add
(
ruleRuleNode
.
getRuleNode
());
bigDecimal
=
bigDecimal
.
add
(
ruleRuleNode
.
getRuleNode
().
getAmount
(
));
dis
Count
=
disCount
.
add
(
ruleRuleNode
.
getRuleNode
().
getAmount
(
));
priceThread
.
set
(
priceThread
.
get
().
add
(
ruleRuleNode
.
getRuleNode
().
getAmount
()
));
dis
countThread
.
set
(
discountThread
.
get
().
add
(
ruleRuleNode
.
getRuleNode
().
getAmount
()
));
RuleNode
<
SpecRule
>
parentRuleNode
=
ruleRuleNode
.
getParentRuleNode
();
if
(
parentRuleNode
!=
null
){
findPartentRuleNode
(
parentRuleNode
,
specRuleList
,
bigDecimal
,
disCount
);
findPartentRuleNode
(
parentRuleNode
,
specRuleList
);
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
View file @
875859f8
...
...
@@ -6,6 +6,8 @@ import com.soss.common.exception.ServiceException;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.*
;
import
com.soss.system.domain.vo.ResultVo
;
import
com.soss.system.jiguang.JiGuangPushService
;
import
com.soss.system.jiguang.impl.JiGuangPushServiceImpl
;
import
com.soss.system.mapper.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -43,6 +45,8 @@ public class MachineApiServiceImpl {
private
StringRedisTemplate
stringRedisTemplate
;
@Autowired
private
GoodsMapper
goodsMapper
;
@Autowired
private
JiGuangPushServiceImpl
jiGuangPushService
;
public
String
shopGoodsUpdate
(
JSONObject
jsonObject
)
{
String
shopID
=
jsonObject
.
getString
(
"shopId"
);
...
...
@@ -79,7 +83,9 @@ public class MachineApiServiceImpl {
Order
order
=
new
Order
();
order
.
setId
(
orderID
);
order
.
setState
(
status
);
order
.
setUpdatedAt
(
new
Date
());
int
i
=
orderMapper
.
updateOrder
(
order
);
jiGuangPushService
.
pushOrderState
(
order
);
return
i
+
""
;
}
...
...
@@ -207,7 +213,14 @@ public class MachineApiServiceImpl {
}
public
void
updateOrder
(
Order
order
)
{
JSONObject
param
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
data
.
put
(
"state"
,
Integer
.
parseInt
(
order
.
getState
()));
data
.
put
(
"payTime"
,
order
.
getPayTime
());
data
.
put
(
"finishTime"
,
order
.
getFinishTime
());
param
.
put
(
"data"
,
data
.
toJSONString
());
param
.
put
(
"orderId"
,
order
.
getId
());
sendRequest
(
param
.
toJSONString
(),
"/v1/order/update"
);
}
public
Object
checkOrder
(
JSONObject
jsonObject
)
{
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderRefundServiceImpl.java
View file @
875859f8
...
...
@@ -86,10 +86,10 @@ public class OrderRefundServiceImpl implements IOrderRefundService
// 制作中、制作完成、聚餐中、已完成
String
state
=
order
.
getState
();
if
(
"2"
.
equals
(
state
)
||
"3"
.
equals
(
state
)
){
if
(
"2"
.
equals
(
state
)){
// 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成
}
else
if
(
"
4"
.
equals
(
state
)||
"5"
.
equals
(
state
)||
"6"
.
equals
(
state
)||
"7
"
.
equals
(
state
)){
}
else
if
(
"
3"
.
equals
(
state
)||
"4"
.
equals
(
state
)||
"5"
.
equals
(
state
)||
"6"
.
equals
(
state
)||
"13
"
.
equals
(
state
)){
String
desc
=
orderRefund
.
getDesc
();
if
(
StringUtils
.
isEmpty
(
desc
)){
return
AjaxResult
.
error
(
"请联系客服进行退款"
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
875859f8
...
...
@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.soss.common.constant.HttpStatus
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.spring.SpringUtils
;
import
com.soss.system.domain.*
;
...
...
@@ -138,7 +139,7 @@ public class OrderServiceImpl implements IOrderService
}
}
//发送数据给机器
//
machineApiService.createOrder(order);
machineApiService
.
createOrder
(
order
);
orderOperationLogService
.
insertOrderOperationLog
(
"待付款"
,
order
.
getId
(),
"创建了订单"
,
order
.
getUserName
(),
"创建订单"
);
orderSnapshotService
.
saveOrderSnapshot
(
order
);
return
AjaxResult
.
success
(
order
.
getOrderNo
());
...
...
@@ -208,7 +209,7 @@ public class OrderServiceImpl implements IOrderService
@Override
public
List
<
Order
>
getMyOrder
(
String
openId
)
{
List
<
Order
>
orders
=
orderMapper
.
selectByUserId
(
openId
);
List
<
Order
>
orders
=
orderMapper
.
selectByUserId
(
"oA0gy4xT7vFZ5SGI__x_ss7vNi8g"
);
for
(
Order
order
:
orders
)
{
order
.
setShop
(
shopMapper
.
selectShopById
(
order
.
getShopId
()));
OrderDetail
orderDetail
=
new
OrderDetail
();
...
...
@@ -222,6 +223,20 @@ public class OrderServiceImpl implements IOrderService
return
orders
;
}
@Override
public
int
cancel
(
String
orderId
)
{
Order
order
=
orderMapper
.
selectOrderById
(
orderId
);
if
(
"1"
.
equals
(
order
.
getState
())){
order
.
setState
(
"7"
);
order
.
setUpdatedAt
(
new
Date
());
orderMapper
.
updateOrder
(
order
);
}
else
{
throw
new
ServiceException
(
"该订单不允许取消"
);
}
return
0
;
}
/**
* 获取机器顺序号
* @param shopId
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderTakingServiceImpl.java
View file @
875859f8
...
...
@@ -108,6 +108,7 @@ public class OrderTakingServiceImpl {
shopRecommend
.
setGoodsId
(
goodsVo
.
getGoodsId
());
shopRecommend
.
setType
(
"1"
);
ShopRecommend
shopRecommend1
=
shopRecommendMapper
.
selectShopRecommendList
(
shopRecommend
).
get
(
0
);
recommendVo
.
setTitle
(
shopRecommend1
.
getName
());
recommendVo
.
setDesc
(
shopRecommend1
.
getDesc
());
recommendVo
.
setGoodsName
(
shopRecommend1
.
getGoodsName
());
recommendVo
.
setPic
(
shopRecommend1
.
getPic
());
...
...
@@ -152,9 +153,9 @@ public class OrderTakingServiceImpl {
goodsVo
.
setSpecs
(
buildGoodsSpec
(
good
.
getSpec
()));
goodsVo
.
setSpecString
(
null
);
if
(
recommendGoodsId
.
contains
(
String
.
valueOf
(
good
.
getId
()))){
goodsVo
.
setIsRecommend
(
"0"
);
}
else
{
goodsVo
.
setIsRecommend
(
"1"
);
}
else
{
goodsVo
.
setIsRecommend
(
"0"
);
}
GoodsTag
goodsTag
=
new
GoodsTag
();
goodsTag
.
setState
(
"1"
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/SpecServiceImpl.java
View file @
875859f8
...
...
@@ -150,7 +150,7 @@ public class SpecServiceImpl implements ISpecService
spec
.
setUpdatedAt
(
new
Date
());
int
i
=
specMapper
.
updateSpec
(
spec
);
List
<
SpecRule
>
specRules
=
spec
.
getSpecRules
();
if
(
specRules
==
null
||
specRules
.
size
()>
0
){
if
(
specRules
==
null
||
specRules
.
isEmpty
()
){
return
i
;
}
specRuleMapper
.
deleteSpecRuleBySpecId
(
spec
.
getId
());
...
...
soss-system/src/main/resources/mapper/system/ShopRecommendMapper.xml
View file @
875859f8
...
...
@@ -18,10 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"recDate"
column=
"rec_date"
/>
<result
property=
"createdAt"
column=
"created_at"
/>
<result
property=
"updatedAt"
column=
"updated_at"
/>
<result
property=
"name"
column=
"name"
/>
</resultMap>
<sql
id=
"selectShopRecommendVo"
>
select id, shop_id, machine_id, goods_id, goods_name, pic, turn, `desc`, type, state, rec_date, created_at, updated_at from shop_recommend
select id, shop_id, machine_id, goods_id, goods_name, pic, turn, `desc`, type, state, rec_date, created_at, updated_at
,name
from shop_recommend
</sql>
<select
id=
"selectShopRecommendList"
parameterType=
"ShopRecommend"
resultMap=
"ShopRecommendResult"
>
...
...
@@ -39,6 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"recDate != null "
>
and rec_date = #{recDate}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"name != null "
>
and name = #{updatedAt}
</if>
</where>
</select>
...
...
@@ -62,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"recDate != null"
>
rec_date,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"name != null"
>
name,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"shopId != null and shopId != ''"
>
#{shopId},
</if>
...
...
@@ -76,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"recDate != null"
>
#{recDate},
</if>
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"name != null"
>
#{name},
</if>
</trim>
</insert>
...
...
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