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
2608aa50
Commit
2608aa50
authored
Jun 09, 2022
by
张新旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
d3d00a1c
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
112 additions
and
52 deletions
+112
-52
soss-admin/src/main/java/com/soss/web/controller/coffee/ApplicationController.java
+7
-3
soss-admin/src/main/java/com/soss/web/controller/coffee/CustomerController.java
+4
-2
soss-admin/src/main/java/com/soss/web/controller/coffee/WeixinController.java
+4
-10
soss-admin/src/main/resources/application.yml
+4
-4
soss-framework/src/main/java/com/soss/framework/config/SecurityConfig.java
+1
-1
soss-system/src/main/java/com/soss/system/aspect/LoggerAspect.java
+2
-0
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
+5
-5
soss-system/src/main/java/com/soss/system/service/impl/CustomerServiceImpl.java
+1
-1
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
+51
-5
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+8
-8
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+19
-2
soss-system/src/main/resources/mapper/system/OrderMapper.xml
+6
-11
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/ApplicationController.java
View file @
2608aa50
...
...
@@ -3,6 +3,7 @@ package com.soss.web.controller.coffee;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.uuid.UUID
;
import
com.soss.system.domain.Machine
;
import
com.soss.system.domain.Shop
;
...
...
@@ -37,15 +38,18 @@ public class ApplicationController {
String
id
=
UUID
.
randomUUID
().
toString
();
String
key
=
machineCode
;
//+"_"+id;
stringRedisTemplate
.
opsForValue
().
set
(
key
,
body
);
stringRedisTemplate
.
expire
(
id
,
1
,
TimeUnit
.
HOUR
S
);
stringRedisTemplate
.
expire
(
key
,
60
,
TimeUnit
.
SECOND
S
);
return
AjaxResult
.
success
(
"处理成功"
,
key
);
}
@RequestMapping
(
"/getData"
)
public
AjaxResult
getApplicationData
(
String
body
){
public
AjaxResult
getApplicationData
(
@RequestBody
String
body
){
JSONObject
jj
=
JSONObject
.
parseObject
(
body
);
String
key
=
jj
.
getString
(
"key"
);
JSONObject
location
=
jj
.
getJSONObject
(
"location"
);
String
s
=
stringRedisTemplate
.
opsForValue
().
get
(
key
);
if
(
StringUtils
.
isEmpty
(
s
)){
throw
new
ServiceException
(
"该二维码已经过期"
);
}
JSONObject
info
=
JSONObject
.
parseObject
(
s
);
String
machineCode
=
info
.
getString
(
"machineCode"
);
Machine
machine
=
machineService
.
selectMachineByCode
(
machineCode
);
...
...
@@ -84,7 +88,7 @@ public class ApplicationController {
return
AjaxResult
.
success
(
orderService
.
getOrderInfo
(
machineCode
));
}
@RequestMapping
(
"/checkSku"
)
p
rivate
AjaxResult
checkSku
(
@RequestParam
(
required
=
false
)
String
shopId
,
String
skuId
,
@RequestParam
(
required
=
false
)
String
machineCode
){
p
ublic
AjaxResult
checkSku
(
@RequestParam
(
required
=
false
)
String
shopId
,
String
skuId
,
@RequestParam
(
required
=
false
)
String
machineCode
){
return
shopService
.
checkSku
(
shopId
,
skuId
,
machineCode
);
}
}
soss-admin/src/main/java/com/soss/web/controller/coffee/CustomerController.java
View file @
2608aa50
...
...
@@ -14,6 +14,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.service.ICustomerService
;
import
com.soss.system.service.impl.CustomerServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -39,10 +40,11 @@ public class CustomerController extends BaseController
@GetMapping
(
"/allow"
)
p
rivate
AjaxResult
allow
(
HttpServletRequest
request
,
String
allow
){
p
ublic
AjaxResult
allow
(
HttpServletRequest
request
,
String
allow
){
TokenService
bean
=
SpringUtils
.
getBean
(
TokenService
.
class
);
LoginUser
loginUser
=
bean
.
getLoginUser
(
request
);
return
AjaxResult
.
success
(
customerService
.
allow
(
loginUser
.
getOpenId
(),
allow
));
return
AjaxResult
.
success
(
SpringUtils
.
getBean
(
CustomerServiceImpl
.
class
).
allow
(
loginUser
.
getOpenId
(),
allow
));
}
/**
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/WeixinController.java
View file @
2608aa50
...
...
@@ -3,6 +3,7 @@ package com.soss.web.controller.coffee;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.constant.Constants
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.utils.spring.SpringUtils
;
import
com.soss.framework.web.service.WeixinServiceImpl
;
import
com.soss.system.domain.Order
;
import
com.soss.system.mapper.OrderMapper
;
...
...
@@ -72,18 +73,11 @@ public class WeixinController {
return
weixinService
.
wxNotify
(
request
);
}
@Autowired
private
SendMessageUtils
sendMessageUtils
;
@RequestMapping
(
"/test"
)
public
Map
<
String
,
String
>
test
(
HttpServletRequest
request
)
throws
Exception
{
Order
order
=
orderService
.
selectOrderById
(
"98"
);
sendMessageUtils
.
sendWxMsg
(
order
);
return
null
;
}
@RequestMapping
(
"/getShop"
)
public
AjaxResult
getShop
(){
return
AjaxResult
.
success
(
appService
.
getShop
());
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
){
...
...
soss-admin/src/main/resources/application.yml
View file @
2608aa50
...
...
@@ -50,8 +50,8 @@ spring:
token
:
header
:
Authorization
secret
:
abcdef
ghijklmnopqrstuvwxyz
expireTime
:
3
0
secret
:
hooloo
ghijklmnopqrstuvwxyz
expireTime
:
72
0
mybatis
:
typeAliasesPackage
:
com.soss.**.domain
...
...
@@ -105,8 +105,8 @@ sms:
accessKeySecret
:
signName
:
push
:
appkey
:
682a53c0cd0201792d45c469
secret
:
b58cb126f80ec9bf7577a213
appkey
:
59c9290134b359212290c075
secret
:
026756e7d5688089898db088
machine
:
url
:
http://47.94.241.71:10003
json
:
...
...
soss-framework/src/main/java/com/soss/framework/config/SecurityConfig.java
View file @
2608aa50
...
...
@@ -101,7 +101,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.
authorizeRequests
()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.
antMatchers
(
"/login"
,
"/register"
,
"/captchaImage"
,
"/weixin/**"
,
"/application/**"
,
"/v1/**"
,
"/tool/**"
).
permitAll
()
.
antMatchers
(
"/login"
,
"/register"
,
"/captchaImage"
,
"/weixin/**"
,
"/application/**"
,
"/v1/**"
,
"/tool/**"
,
"/app/getWaitTine"
).
permitAll
()
.
antMatchers
(
HttpMethod
.
GET
,
"/"
,
...
...
soss-system/src/main/java/com/soss/system/aspect/LoggerAspect.java
View file @
2608aa50
...
...
@@ -20,6 +20,8 @@ import java.net.URLDecoder;
import
java.util.HashMap
;
import
java.util.Map
;
@Aspect
@Configuration
@Slf4j
public
class
LoggerAspect
{
// 定义切点Pointcut
...
...
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
View file @
2608aa50
...
...
@@ -8,26 +8,26 @@ import org.springframework.stereotype.Service;
import
java.text.DecimalFormat
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
AppServiceImpl
{
@Autowired
private
ShopMapper
shopMapper
;
public
Shop
getShop
()
{
public
Shop
getShop
(
String
lng
,
String
lat
)
{
Shop
shop
=
new
Shop
();
shop
.
setState
(
"1"
);
shop
.
setIsDefault
(
1L
);
List
<
Shop
>
shops
=
shopMapper
.
selectShopList
(
shop
);
if
(
shops
!=
null
&&!
shops
.
isEmpty
()){
Shop
shop1
=
shops
.
get
(
0
);
if
(
StringUtils
.
isNotEmpty
(
lng
)&&
StringUtils
.
isNotEmpty
(
lat
)){
shop
.
setDistance
(
AppServiceImpl
.
GetDistance
(
Double
.
parseDouble
(
lng
),
Double
.
parseDouble
(
lat
),
Double
.
parseDouble
(
shop
.
getLng
()),
Double
.
parseDouble
(
shop
.
getLat
())));
}
return
shop1
;
}
else
{
return
new
Shop
();
}
//return shops.stream().sorted((x, y) -> x.getDistance().compareTo(y.getDistance())).collect(Collectors.toList());
}
...
...
@@ -63,7 +63,7 @@ public class AppServiceImpl {
}
else
{
Double
aDouble
=
s
;
return
aDouble
.
intValue
()+
"
公里
"
;
return
aDouble
.
intValue
()+
"
米
"
;
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/CustomerServiceImpl.java
View file @
2608aa50
...
...
@@ -132,7 +132,7 @@ public class CustomerServiceImpl implements ICustomerService
public
Integer
allow
(
String
openId
,
String
allow
)
{
Customer
customer
=
new
Customer
();
customer
.
setId
(
openId
);
customer
.
setAllow
(
allow
);
customer
.
setAllow
(
"1"
);
return
customerMapper
.
updateCustomer
(
customer
);
}
}
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
View file @
2608aa50
...
...
@@ -8,7 +8,6 @@ import com.soss.common.utils.StringUtils;
import
com.soss.system.constants.OrderStatusConstant
;
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
com.soss.system.weixin.util.SendMessageUtils
;
...
...
@@ -23,9 +22,7 @@ import org.springframework.http.ResponseEntity;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.*
;
@Service
@Slf4j
...
...
@@ -70,19 +67,68 @@ public class MachineApiServiceImpl {
}
ShopGoodsSku
shopGoodsSku
=
new
ShopGoodsSku
();
shopGoodsSku
.
setShopId
(
Long
.
parseLong
(
shopID
));
Map
<
Long
,
List
<
Long
>>
map
=
new
HashMap
<>();
for
(
String
skuId
:
skuIds
)
{
shopGoodsSku
.
setSkuId
(
Long
.
parseLong
(
skuId
));
List
<
ShopGoodsSku
>
shopGoodsSkus
=
shopGoodsSkuMapper
.
selectShopGoodsSkuList
(
shopGoodsSku
);
if
(
shopGoodsSkus
.
isEmpty
()){
throw
new
ServiceException
(
skuId
+
"不存在"
);
}
for
(
ShopGoodsSku
goodsSkus
:
shopGoodsSkus
)
{
Long
goodsId
=
goodsSkus
.
getGoodsId
();
List
<
Long
>
strings
=
map
.
get
(
goodsId
);
if
(
strings
==
null
){
strings
=
new
ArrayList
<>();
}
strings
.
add
(
goodsSkus
.
getSkuId
());
map
.
put
(
goodsId
,
strings
);
}
}
int
i
=
shopGoodsSkuMapper
.
updateSkuStatus
(
skuIds
,
robotID
,
shopID
,
status
);
//推送给极光
Machine
machine
=
machineMapper
.
selectMachineById
(
robotID
);
String
code
=
machine
.
getCode
();
this
.
push
(
code
,
status
,
map
);
return
""
+
i
;
}
/**
* {
* "action": "SKU_STATE_CHANGED",
* "timestamp": 1390010203013,
* "data": {
* "machineCode": "SN010293123",
* "goodsId": 100,
* "skuIds": [
* 200,
* 300
* ],
* "state": 2
* }
* }
* @param code
* @param status
* @param map
*/
private
void
push
(
String
code
,
String
status
,
Map
<
Long
,
List
<
Long
>>
map
){
for
(
Long
aLong
:
map
.
keySet
())
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"action"
,
"SKU_STATE_CHANGED"
);
jsonObject
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
JSONObject
data
=
new
JSONObject
();
jsonObject
.
put
(
"data"
,
data
);
data
.
put
(
"machineCode"
,
code
);
data
.
put
(
"goodsId"
,
aLong
);
data
.
put
(
"skuIds"
,
map
.
get
(
aLong
));
data
.
put
(
"state"
,
status
);
jiGuangPushService
.
push
(
code
,
jsonObject
);
}
}
public
String
updateOrder
(
JSONObject
jsonObject
)
{
Long
orderID
=
jsonObject
.
getLong
(
"orderId"
);
String
status
=
jsonObject
.
getString
(
"status"
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
2608aa50
...
...
@@ -158,14 +158,14 @@ public class OrderServiceImpl implements IOrderService
List
<
OrderDetail
>
orderDetails
=
order
.
getOrderDetails
();
if
(
orderDetails
!=
null
&&
!
orderDetails
.
isEmpty
()){
BigDecimal
bigDecimal
=
new
BigDecimal
(
0
);
for
(
OrderDetail
orderDetail
:
orderDetails
)
{
bigDecimal
=
bigDecimal
.
add
(
orderDetail
.
getRealAmount
().
multiply
(
new
BigDecimal
(
orderDetail
.
getNum
())));
}
if
(
order
.
getAmount
().
compareTo
(
bigDecimal
)!=
0
){
throw
new
ServiceException
(
"价格计算出现了问题,请重新计算"
+
bigDecimal
.
stripTrailingZeros
().
toString
()
);
}
order
.
setAmount
(
bigDecimal
);
//
BigDecimal bigDecimal = new BigDecimal(0);
//
for (OrderDetail orderDetail : orderDetails) {
//
bigDecimal = bigDecimal.add(orderDetail.getRealAmount().multiply( new BigDecimal(orderDetail.getNum())));
//
}
//
if(order.getAmount().compareTo(bigDecimal)!=0){
//
throw new ServiceException("价格计算出现了问题,请重新计算"+ bigDecimal.stripTrailingZeros().toString() );
//
}
//
order.setAmount(bigDecimal);
int
i
=
orderMapper
.
insertOrder
(
order
);
for
(
OrderDetail
orderDetail
:
orderDetails
)
{
orderDetail
.
setOrderId
(
order
.
getId
());
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
View file @
2608aa50
...
...
@@ -14,6 +14,7 @@ import com.soss.system.service.IShopService;
import
com.soss.system.mapper.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.core.CollectionUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -76,8 +77,8 @@ public class ShopServiceImpl implements IShopService
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
shop1
.
getId
());
shop1
.
setMachineCount
(
machineMapper
.
selectMachineList
(
machine
).
size
());
shop1
.
setSalesAmount
(
orderMapper
.
selectSalesAmount
(
shop
.
getId
()));
shop1
.
setSalesVolume
(
orderMapper
.
selectSalesVolume
(
shop
.
getId
(),
null
));
shop1
.
setSalesAmount
(
orderMapper
.
selectSalesAmount
(
shop
1
.
getId
()));
shop1
.
setSalesVolume
(
orderMapper
.
selectSalesVolume
(
shop
1
.
getId
(),
null
));
}
return
shops
;
...
...
@@ -201,6 +202,22 @@ public class ShopServiceImpl implements IShopService
List
<
Goods
>
goodsList
=
shopGoodsMapper
.
selectShopCategoryGoodsByCategoryId
(
shopId
,
category
.
getId
());
for
(
Goods
goods
:
goodsList
)
{
ShopGoodsSku
shopGoodsSku
=
new
ShopGoodsSku
();
shopGoodsSku
.
setShopId
(
shopId
);
shopGoodsSku
.
setGoodsId
(
goods
.
getId
());
List
<
ShopGoodsSku
>
shopGoodsSkus
=
shopGoodsSkuMapper
.
selectShopGoodsSkuList
(
shopGoodsSku
);
if
(!
shopGoodsSkus
.
isEmpty
()){
boolean
boo
=
true
;
for
(
ShopGoodsSku
goodsSkus
:
shopGoodsSkus
)
{
if
(
"2"
.
equals
(
goodsSkus
.
getState
())){
boo
=
false
;
}
}
if
(!
boo
){
goods
.
setState
(
"2"
);
}
}
ShopRecommend
shopRecommend
=
new
ShopRecommend
();
shopRecommend
.
setShopId
(
String
.
valueOf
(
shopId
));
shopRecommend
.
setGoodsId
(
String
.
valueOf
(
goods
.
getId
()));
...
...
soss-system/src/main/resources/mapper/system/OrderMapper.xml
View file @
2608aa50
...
...
@@ -130,29 +130,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select
id=
"selectSalesVolume"
resultType=
"integer"
>
select count(*) from (
select
select count(*) from (select
DISTINCT o.id
from
`order` o,
order_refund or2,
order_detail od
where
o.id = or2.order_id
and or2.state != '2'
and od.order_id = o.id
`order` o
join order_detail od on
o.id = od.order_id
<if
test=
"goodsId !=null"
>
and od.goods_id =#{goodsId}
</if>
<if
test=
"shopId !=null"
>
and o.shop_id=#{shopId}
</if>
) a
and o.state not in ('1', '8', '9', '10', '11')
) a
</select>
<select
id=
"selectSalesAmount"
resultType=
"java.math.BigDecimal"
>
select SUM(o.amount) from `order` o
where shop_id =#{shopId}
and state not in ()
and state not in (
'1','8','9','10','11'
)
</select>
<select
id=
"selectByUserId"
resultMap=
"OrderResult"
>
<include
refid=
"selectOrderVo"
/>
...
...
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