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
b0288c32
Commit
b0288c32
authored
Aug 03, 2022
by
caiyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善需求功能及修复bug
parent
968b4136
Show whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
420 additions
and
525 deletions
+420
-525
soss-admin/src/main/java/com/soss/web/controller/coffee/AppController.java
+17
-21
soss-admin/src/main/java/com/soss/web/controller/coffee/ApplicationController.java
+1
-1
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
+8
-1
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderRefundController.java
+12
-19
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopController.java
+40
-11
soss-common/src/main/java/com/soss/common/enums/CouponState.java
+2
-1
soss-common/src/main/java/com/soss/common/enums/CouponUserState.java
+2
-2
soss-common/src/main/java/com/soss/common/enums/ShopState.java
+32
-0
soss-system/src/main/java/com/soss/system/domain/CouponUser.java
+6
-1
soss-system/src/main/java/com/soss/system/domain/Machine.java
+7
-85
soss-system/src/main/java/com/soss/system/domain/Order.java
+15
-2
soss-system/src/main/java/com/soss/system/domain/Shop.java
+9
-199
soss-system/src/main/java/com/soss/system/domain/po/CouponPo.java
+1
-1
soss-system/src/main/java/com/soss/system/domain/vo/CouponVo.java
+3
-0
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/ImagesVo.java
+5
-19
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/OrderTakingVo.java
+4
-51
soss-system/src/main/java/com/soss/system/mapper/CouponMapper.java
+5
-0
soss-system/src/main/java/com/soss/system/mapper/CouponUserMapper.java
+14
-1
soss-system/src/main/java/com/soss/system/mapper/MachineMapper.java
+4
-1
soss-system/src/main/java/com/soss/system/mapper/OrderMapper.java
+1
-1
soss-system/src/main/java/com/soss/system/mapper/ShopMapper.java
+1
-1
soss-system/src/main/java/com/soss/system/schedule/CouponSchedule.java
+25
-0
soss-system/src/main/java/com/soss/system/service/ICouponUserService.java
+4
-0
soss-system/src/main/java/com/soss/system/service/IOrderService.java
+3
-3
soss-system/src/main/java/com/soss/system/service/IShopService.java
+10
-12
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
+1
-1
soss-system/src/main/java/com/soss/system/service/impl/CouponServiceImpl.java
+4
-4
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
+26
-5
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
+1
-1
soss-system/src/main/java/com/soss/system/service/impl/MachineServiceImpl.java
+18
-13
soss-system/src/main/java/com/soss/system/service/impl/OrderOperationLogServiceImpl.java
+10
-16
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+19
-9
soss-system/src/main/java/com/soss/system/service/impl/OrderTakingServiceImpl.java
+5
-5
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+43
-18
soss-system/src/main/resources/mapper/system/CouponMapper.xml
+7
-0
soss-system/src/main/resources/mapper/system/CouponUserMapper.xml
+33
-4
soss-system/src/main/resources/mapper/system/GoodsMapper.xml
+2
-2
soss-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
+1
-1
soss-system/src/main/resources/mapper/system/MachineMapper.xml
+12
-6
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
+1
-1
soss-system/src/main/resources/mapper/system/OrderMapper.xml
+1
-1
soss-system/src/main/resources/mapper/system/ShopMapper.xml
+5
-5
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/AppController.java
View file @
b0288c32
...
@@ -14,15 +14,11 @@ import com.soss.system.domain.OrderDetail;
...
@@ -14,15 +14,11 @@ import com.soss.system.domain.OrderDetail;
import
com.soss.system.domain.vo.CouponVo
;
import
com.soss.system.domain.vo.CouponVo
;
import
com.soss.system.service.ICouponRuleService
;
import
com.soss.system.service.ICouponRuleService
;
import
com.soss.system.service.ICouponUserService
;
import
com.soss.system.service.ICouponUserService
;
import
com.soss.system.service.impl.AppServiceImpl
;
import
com.soss.system.service.impl.OrderServiceImpl
;
import
com.soss.system.service.impl.OrderServiceImpl
;
import
com.soss.system.service.impl.WechatMessageServiceImpl
;
import
com.soss.system.service.impl.WechatMessageServiceImpl
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -37,8 +33,6 @@ public class AppController extends BaseController {
...
@@ -37,8 +33,6 @@ public class AppController extends BaseController {
@Autowired
@Autowired
private
TokenService
tokenService
;
private
TokenService
tokenService
;
@Autowired
@Autowired
private
AppServiceImpl
appService
;
@Autowired
private
OrderServiceImpl
orderService
;
private
OrderServiceImpl
orderService
;
@Autowired
@Autowired
private
WechatMessageServiceImpl
wechatMessageService
;
private
WechatMessageServiceImpl
wechatMessageService
;
...
@@ -74,7 +68,7 @@ public class AppController extends BaseController {
...
@@ -74,7 +68,7 @@ public class AppController extends BaseController {
public
AjaxResult
getWaitTime
(
@RequestBody
String
body
){
public
AjaxResult
getWaitTime
(
@RequestBody
String
body
){
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
Order
order
=
new
Order
();
Order
order
=
new
Order
();
order
.
setShopId
(
jsonObject
.
get
Stri
ng
(
"shopId"
));
order
.
setShopId
(
jsonObject
.
get
Lo
ng
(
"shopId"
));
JSONArray
goods
=
jsonObject
.
getJSONArray
(
"goods"
);
JSONArray
goods
=
jsonObject
.
getJSONArray
(
"goods"
);
List
<
OrderDetail
>
orderDetails
=
new
ArrayList
<>();
List
<
OrderDetail
>
orderDetails
=
new
ArrayList
<>();
order
.
setOrderDetails
(
orderDetails
);
order
.
setOrderDetails
(
orderDetails
);
...
@@ -83,7 +77,6 @@ public class AppController extends BaseController {
...
@@ -83,7 +77,6 @@ public class AppController extends BaseController {
orderDetail
.
setGoodsId
(
goods
.
getJSONObject
(
i
).
getLong
(
"goodsId"
));
orderDetail
.
setGoodsId
(
goods
.
getJSONObject
(
i
).
getLong
(
"goodsId"
));
orderDetail
.
setNum
(
goods
.
getJSONObject
(
i
).
getString
(
"num"
));
orderDetail
.
setNum
(
goods
.
getJSONObject
(
i
).
getString
(
"num"
));
orderDetails
.
add
(
orderDetail
);
orderDetails
.
add
(
orderDetail
);
}
}
String
info
=
orderService
.
getWaitTime
(
order
);
String
info
=
orderService
.
getWaitTime
(
order
);
return
AjaxResult
.
success
(
"操作成功"
,
info
);
return
AjaxResult
.
success
(
"操作成功"
,
info
);
...
@@ -111,30 +104,33 @@ public class AppController extends BaseController {
...
@@ -111,30 +104,33 @@ public class AppController extends BaseController {
return
AjaxResult
.
success
(
""
,
wechatMessageService
.
getMessageCount
(
loginUser
.
getOpenId
()));
return
AjaxResult
.
success
(
""
,
wechatMessageService
.
getMessageCount
(
loginUser
.
getOpenId
()));
}
}
@GetMapping
(
"/coupon/
available/count
"
)
@GetMapping
(
"/coupon/
list/{effectiveFlag}
"
)
@ApiOperation
(
"查询用户
可用优惠券数量
"
)
@ApiOperation
(
"查询用户
优惠券列表
"
)
public
AjaxResult
getUserAvailableCouponCnt
(
HttpServletRequest
request
)
{
public
TableDataInfo
listUserCoupon
(
HttpServletRequest
request
,
@PathVariable
Boolean
effectiveFlag
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
if
(
loginUser
==
null
)
{
if
(
loginUser
==
null
)
{
throw
new
ServiceException
(
"请先登录"
);
throw
new
ServiceException
(
"请先登录"
);
}
}
int
userAvailableCouponCnt
=
couponUserService
.
getCustAvailableCouponCnt
(
loginUser
.
getOpenId
());
startPage
();
return
AjaxResult
.
success
(
userAvailableCouponCnt
);
List
<
CouponVo
>
couponVos
=
couponUserService
.
listCustCoupons
(
loginUser
.
getOpenId
(),
effectiveFlag
);
couponRuleService
.
translateUseLimit
(
couponVos
);
return
getDataTable
(
couponVos
);
}
}
@
GetMapping
(
"/coupon/available/lis
t"
)
@
PostMapping
(
"/order/coupon/fitable-coun
t"
)
@ApiOperation
(
"查询用户可用优惠券
列表
"
)
@ApiOperation
(
"查询用户可用优惠券
数量
"
)
public
TableDataInfo
listUserAvailableCoupon
(
HttpServletRequest
request
)
{
public
AjaxResult
getUserAvailableCouponCnt
(
HttpServletRequest
request
,
@RequestBody
Order
order
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
if
(
loginUser
==
null
)
{
if
(
loginUser
==
null
)
{
throw
new
ServiceException
(
"请先登录"
);
throw
new
ServiceException
(
"请先登录"
);
}
}
List
<
CouponVo
>
couponVoList
=
couponUserService
.
listCustAvailableCoupon
(
loginUser
.
getOpenId
(),
null
);
List
<
CouponVo
>
couponVos
=
couponUserService
.
listCustAvailableCoupon
(
loginUser
.
getOpenId
(),
null
);
couponRuleService
.
translateUseLimit
(
couponVoList
);
couponUserService
.
resovleCouponFitable
(
couponVos
,
order
);
return
getDataTable
(
couponVoList
);
long
fitableCount
=
couponVos
.
stream
().
filter
(
couponVo
->
StringUtils
.
isEmpty
(
couponVo
.
getNotFitableDesc
())).
count
();
return
AjaxResult
.
success
(
fitableCount
);
}
}
@
Ge
tMapping
(
"/order/coupon/info"
)
@
Pos
tMapping
(
"/order/coupon/info"
)
@ApiOperation
(
"下单页面查询用户可用优惠券信息"
)
@ApiOperation
(
"下单页面查询用户可用优惠券信息"
)
public
AjaxResult
listUserAvailableCoupon
(
HttpServletRequest
request
,
@RequestBody
Order
order
)
{
public
AjaxResult
listUserAvailableCoupon
(
HttpServletRequest
request
,
@RequestBody
Order
order
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/ApplicationController.java
View file @
b0288c32
...
@@ -53,7 +53,7 @@ public class ApplicationController {
...
@@ -53,7 +53,7 @@ public class ApplicationController {
JSONObject
info
=
JSONObject
.
parseObject
(
s
);
JSONObject
info
=
JSONObject
.
parseObject
(
s
);
String
machineCode
=
info
.
getString
(
"machineCode"
);
String
machineCode
=
info
.
getString
(
"machineCode"
);
Machine
machine
=
machineService
.
selectMachineByCode
(
machineCode
);
Machine
machine
=
machineService
.
selectMachineByCode
(
machineCode
);
Shop
shop
=
shopService
.
selectShopById
(
String
.
valueOf
(
machine
.
getShopId
()
));
Shop
shop
=
shopService
.
selectShopById
(
machine
.
getShopId
(
));
shop
.
setDistance
(
AppServiceImpl
.
GetDistance
(
Double
.
parseDouble
(
shop
.
getLng
()),
Double
.
parseDouble
(
shop
.
getLat
()),
Double
.
parseDouble
(
location
.
getString
(
"lng"
)),
Double
.
parseDouble
(
location
.
getString
(
"lat"
))));
shop
.
setDistance
(
AppServiceImpl
.
GetDistance
(
Double
.
parseDouble
(
shop
.
getLng
()),
Double
.
parseDouble
(
shop
.
getLat
()),
Double
.
parseDouble
(
location
.
getString
(
"lng"
)),
Double
.
parseDouble
(
location
.
getString
(
"lat"
))));
info
.
put
(
"shop"
,
shop
);
info
.
put
(
"shop"
,
shop
);
String
[]
keys
=
key
.
split
(
"_"
);
String
[]
keys
=
key
.
split
(
"_"
);
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
View file @
b0288c32
...
@@ -22,6 +22,7 @@ import org.springframework.util.StringUtils;
...
@@ -22,6 +22,7 @@ import org.springframework.util.StringUtils;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -77,6 +78,11 @@ public class OrderController extends BaseController {
...
@@ -77,6 +78,11 @@ public class OrderController extends BaseController {
public
AjaxResult
add
(
HttpServletRequest
request
,
@RequestBody
Order
order
)
{
public
AjaxResult
add
(
HttpServletRequest
request
,
@RequestBody
Order
order
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
if
(
order
.
getLng
()
==
null
||
order
.
getLng
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
||
order
.
getLat
()
==
null
||
order
.
getLat
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
return
AjaxResult
.
error
(
"未授权地理位置不允许下单"
);
}
AjaxResult
result
=
check
(
order
);
AjaxResult
result
=
check
(
order
);
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
result
.
get
(
result
.
CODE_TAG
))
{
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
result
.
get
(
result
.
CODE_TAG
))
{
return
result
;
return
result
;
...
@@ -98,8 +104,9 @@ public class OrderController extends BaseController {
...
@@ -98,8 +104,9 @@ public class OrderController extends BaseController {
order
.
setPaidAmount
(
order
.
getAmount
().
add
(
order
.
getCouponAmount
()));
order
.
setPaidAmount
(
order
.
getAmount
().
add
(
order
.
getCouponAmount
()));
order
.
getOrderDetails
().
forEach
(
orderDetail
->
{
order
.
getOrderDetails
().
forEach
(
orderDetail
->
{
orderDetail
.
setCouponAmount
(
couponVo
.
getCouponAmountMap
().
get
(
orderDetail
.
getSkuId
()).
negate
());
orderDetail
.
setCouponAmount
(
couponVo
.
getCouponAmountMap
().
get
(
orderDetail
.
getSkuId
()).
negate
());
orderDetail
.
setRealAmount
(
orderDetail
.
get
ViewAmount
().
add
(
orderDetail
.
getCouponAmount
()));
orderDetail
.
setRealAmount
(
orderDetail
.
get
AmountShould
().
add
(
orderDetail
.
getCouponAmount
()));
});
});
couponUserService
.
useCoupon
(
couponVo
.
getId
());
}
}
}
catch
(
ServiceException
e
)
{
}
catch
(
ServiceException
e
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
return
AjaxResult
.
error
(
e
.
getMessage
());
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderRefundController.java
View file @
b0288c32
package
com
.
soss
.
web
.
controller
.
coffee
;
package
com
.
soss
.
web
.
controller
.
coffee
;
import
java.util.List
;
import
com.soss.common.annotation.Log
;
import
com.soss.common.core.controller.BaseController
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.common.core.page.TableDataInfo
;
import
com.soss.common.enums.BusinessType
;
import
com.soss.framework.web.service.TokenService
;
import
com.soss.framework.web.service.TokenService
;
import
com.soss.framework.web.service.WeixinServiceImpl
;
import
com.soss.framework.web.service.WeixinServiceImpl
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.OrderRefund
;
import
com.soss.system.domain.vo.OrderQuery
;
import
com.soss.system.domain.vo.OrderQuery
;
import
com.soss.system.service.IOrderRefundService
;
import
com.soss.system.service.impl.OrderServiceImpl
;
import
com.soss.system.service.impl.OrderServiceImpl
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.soss.common.annotation.Log
;
import
com.soss.common.core.controller.BaseController
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.enums.BusinessType
;
import
com.soss.system.domain.OrderRefund
;
import
com.soss.system.service.IOrderRefundService
;
import
com.soss.common.core.page.TableDataInfo
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
/**
/**
* 订单退款Controller
* 订单退款Controller
...
@@ -75,8 +68,8 @@ public class OrderRefundController extends BaseController
...
@@ -75,8 +68,8 @@ public class OrderRefundController extends BaseController
@PostMapping
@PostMapping
public
AjaxResult
add
(
HttpServletRequest
request
,
@RequestBody
OrderRefund
orderRefund
)
public
AjaxResult
add
(
HttpServletRequest
request
,
@RequestBody
OrderRefund
orderRefund
)
{
{
//
LoginUser loginUser = tokenService.getLoginUser(request);
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
//
orderRefund.setCreateUserName(loginUser.getUsername());
orderRefund
.
setCreateUserName
(
loginUser
.
getUsername
());
AjaxResult
ajaxResult
=
orderRefundService
.
insertOrderRefund
(
orderRefund
);
AjaxResult
ajaxResult
=
orderRefundService
.
insertOrderRefund
(
orderRefund
);
Object
obejct
=
ajaxResult
.
get
(
AjaxResult
.
DATA_TAG
);
Object
obejct
=
ajaxResult
.
get
(
AjaxResult
.
DATA_TAG
);
...
...
soss-admin/src/main/java/com/soss/web/controller/coffee/ShopController.java
View file @
b0288c32
...
@@ -10,6 +10,7 @@ import com.soss.common.enums.BusinessType;
...
@@ -10,6 +10,7 @@ import com.soss.common.enums.BusinessType;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.Shop
;
import
com.soss.system.domain.Shop
;
import
com.soss.system.service.IShopService
;
import
com.soss.system.service.IShopService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -37,9 +38,6 @@ public class ShopController extends BaseController
...
@@ -37,9 +38,6 @@ public class ShopController extends BaseController
return
AjaxResult
.
success
(
shopService
.
turn
(
shopId
,
goodsId
,
pointer
));
return
AjaxResult
.
success
(
shopService
.
turn
(
shopId
,
goodsId
,
pointer
));
}
}
/**
/**
* 查询店铺列表
* 查询店铺列表
*/
*/
...
@@ -56,32 +54,63 @@ public class ShopController extends BaseController
...
@@ -56,32 +54,63 @@ public class ShopController extends BaseController
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:shop:query')"
)
@PreAuthorize
(
"@ss.hasPermi('system:shop:query')"
)
@GetMapping
(
value
=
"/{id}"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
String
id
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
{
return
AjaxResult
.
success
(
shopService
.
selectShopById
(
id
));
return
AjaxResult
.
success
(
shopService
.
selectShopById
(
id
));
}
}
/**
/**
* 新增店铺
* 新增店铺
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:shop:add')"
)
@PreAuthorize
(
"@ss.hasPermi('system:shop:add')"
)
@Log
(
title
=
"店铺"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"店铺"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
@PostMapping
public
AjaxResult
add
(
@RequestBody
Shop
shop
)
public
AjaxResult
add
(
@RequestBody
Shop
shop
)
{
{
return
AjaxResult
.
success
(
shopService
.
insertShop
(
shop
));
return
AjaxResult
.
success
(
shopService
.
insertShop
(
shop
));
}
}
/**
/**
* 开始测试
*/
@PreAuthorize
(
"@ss.hasPermi('system:shop:test:start')"
)
@Log
(
title
=
"店铺"
,
businessType
=
BusinessType
.
UPDATE
)
@GetMapping
(
"/test/start/{shopId}"
)
@ApiOperation
(
"开始测试"
)
public
AjaxResult
testStart
(
@PathVariable
Long
shopId
)
{
shopService
.
testStart
(
shopId
);
return
AjaxResult
.
success
();
}
/**
* 完成测试
*/
@PreAuthorize
(
"@ss.hasPermi('system:shop:test:finish')"
)
@Log
(
title
=
"店铺"
,
businessType
=
BusinessType
.
UPDATE
)
@GetMapping
(
"/test/finish/{shopId}"
)
@ApiOperation
(
"完成测试"
)
public
AjaxResult
testFinish
(
@PathVariable
Long
shopId
)
{
shopService
.
testFinish
(
shopId
);
return
AjaxResult
.
success
();
}
/**
* 开始营业
*/
@PreAuthorize
(
"@ss.hasPermi('system:shop:open')"
)
@Log
(
title
=
"店铺"
,
businessType
=
BusinessType
.
UPDATE
)
@GetMapping
(
"/open/{shopId}"
)
@ApiOperation
(
"开始营业"
)
public
AjaxResult
open
(
@PathVariable
Long
shopId
)
{
shopService
.
open
(
shopId
);
return
AjaxResult
.
success
();
}
/**
* 修改店铺
* 修改店铺
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:shop:edit')"
)
@PreAuthorize
(
"@ss.hasPermi('system:shop:edit')"
)
@Log
(
title
=
"店铺"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"店铺"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
@PutMapping
public
AjaxResult
edit
(
@RequestBody
Shop
shop
)
public
AjaxResult
edit
(
@RequestBody
Shop
shop
)
{
{
return
toAjax
(
shopService
.
updateShop
(
shop
));
return
toAjax
(
shopService
.
updateShop
(
shop
));
}
}
...
...
soss-common/src/main/java/com/soss/common/enums/CouponState.java
View file @
b0288c32
...
@@ -4,7 +4,8 @@ public enum CouponState {
...
@@ -4,7 +4,8 @@ public enum CouponState {
DEFAULT
(
0
,
"默认"
),
DEFAULT
(
0
,
"默认"
),
ONLINE
(
1
,
"生效中"
),
ONLINE
(
1
,
"生效中"
),
OFFLINE
(
2
,
"未生效"
),
OFFLINE
(
2
,
"未生效"
),
DELETE
(
3
,
"已删除"
);
EXPIRED
(
3
,
"已失效"
),
DELETE
(
4
,
"已删除"
);
private
Integer
state
;
private
Integer
state
;
private
String
desc
;
private
String
desc
;
...
...
soss-common/src/main/java/com/soss/common/enums/CouponUserState.java
View file @
b0288c32
...
@@ -2,8 +2,8 @@ package com.soss.common.enums;
...
@@ -2,8 +2,8 @@ package com.soss.common.enums;
public
enum
CouponUserState
{
public
enum
CouponUserState
{
EFFECTIVE
(
0
,
"有效"
),
EFFECTIVE
(
0
,
"有效"
),
USED
(
1
,
"
被
使用"
),
USED
(
1
,
"
已
使用"
),
EXPIRED
(
2
,
"
过期
失效"
);
EXPIRED
(
2
,
"
已
失效"
);
private
Integer
state
;
private
Integer
state
;
private
String
desc
;
private
String
desc
;
...
...
soss-common/src/main/java/com/soss/common/enums/ShopState.java
0 → 100644
View file @
b0288c32
package
com
.
soss
.
common
.
enums
;
/**
* 店铺状态枚举类
*/
public
enum
ShopState
{
TESTING
(
0
,
"测试中"
),
OPEN
(
1
,
"正常营业"
),
CLOSE
(
2
,
"暂停营业"
),
DELETE
(
3
,
"已关闭"
);
private
Integer
state
;
private
String
desc
;
ShopState
(
Integer
state
,
String
desc
)
{
this
.
state
=
state
;
this
.
desc
=
desc
;
}
public
Integer
getState
()
{
return
state
;
}
public
static
String
getDesc
(
Integer
state
)
{
for
(
ShopState
categoryType
:
ShopState
.
values
())
{
if
(
categoryType
.
state
.
equals
(
state
))
{
return
categoryType
.
desc
;
}
}
return
null
;
}
}
soss-system/src/main/java/com/soss/system/domain/CouponUser.java
View file @
b0288c32
...
@@ -3,6 +3,7 @@ package com.soss.system.domain;
...
@@ -3,6 +3,7 @@ package com.soss.system.domain;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.soss.common.core.domain.BaseEntity
;
import
com.soss.common.core.domain.BaseEntity
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -16,6 +17,7 @@ import java.time.LocalDateTime;
...
@@ -16,6 +17,7 @@ import java.time.LocalDateTime;
* @since 2022-07-21
* @since 2022-07-21
*/
*/
@Data
@Data
@NoArgsConstructor
public
class
CouponUser
extends
BaseEntity
{
public
class
CouponUser
extends
BaseEntity
{
/**
/**
* 主键
* 主键
...
@@ -97,5 +99,8 @@ public class CouponUser extends BaseEntity {
...
@@ -97,5 +99,8 @@ public class CouponUser extends BaseEntity {
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
updatedAt
;
private
LocalDateTime
updatedAt
;
public
CouponUser
(
Integer
id
,
Integer
state
)
{
this
.
id
=
id
;
this
.
state
=
state
;
}
}
}
soss-system/src/main/java/com/soss/system/domain/Machine.java
View file @
b0288c32
package
com
.
soss
.
system
.
domain
;
package
com
.
soss
.
system
.
domain
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.core.domain.BaseEntity
;
import
com.soss.common.core.domain.BaseEntity
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.util.Date
;
/**
/**
* 机器对象 machine
* 机器对象 machine
...
@@ -13,6 +15,7 @@ import com.soss.common.core.domain.BaseEntity;
...
@@ -13,6 +15,7 @@ import com.soss.common.core.domain.BaseEntity;
* @author zxq
* @author zxq
* @date 2022-04-28
* @date 2022-04-28
*/
*/
@Data
public
class
Machine
extends
BaseEntity
public
class
Machine
extends
BaseEntity
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -34,7 +37,7 @@ public class Machine extends BaseEntity
...
@@ -34,7 +37,7 @@ public class Machine extends BaseEntity
/** 状态 1 正常 2 故障 3 关停 */
/** 状态 1 正常 2 故障 3 关停 */
@Excel
(
name
=
"状态 1 正常 2 故障 3 关停 11忙碌 99离线"
)
@Excel
(
name
=
"状态 1 正常 2 故障 3 关停 11忙碌 99离线"
)
private
String
state
;
private
Integer
state
;
/** 绑定时间 */
/** 绑定时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
...
@@ -51,89 +54,8 @@ public class Machine extends BaseEntity
...
@@ -51,89 +54,8 @@ public class Machine extends BaseEntity
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
private
Date
updatedAt
;
public
String
getRegister
()
{
return
register
;
}
public
void
setRegister
(
String
register
)
{
this
.
register
=
register
;
}
private
String
register
;
private
String
register
;
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
void
setShopId
(
Long
shopId
)
{
this
.
shopId
=
shopId
;
}
public
Long
getShopId
()
{
return
shopId
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getType
()
{
return
type
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getState
()
{
return
state
;
}
public
void
setBindTime
(
Date
bindTime
)
{
this
.
bindTime
=
bindTime
;
}
public
Date
getBindTime
()
{
return
bindTime
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
public
Date
getUpdatedAt
()
{
return
updatedAt
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
soss-system/src/main/java/com/soss/system/domain/Order.java
View file @
b0288c32
...
@@ -2,6 +2,7 @@ package com.soss.system.domain;
...
@@ -2,6 +2,7 @@ package com.soss.system.domain;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.annotation.Excel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
...
@@ -109,7 +110,7 @@ public class Order implements Serializable {
...
@@ -109,7 +110,7 @@ public class Order implements Serializable {
* 店铺ID
* 店铺ID
*/
*/
@Excel
(
name
=
"店铺ID"
)
@Excel
(
name
=
"店铺ID"
)
private
Stri
ng
shopId
;
private
Lo
ng
shopId
;
/**
/**
* 机器ID
* 机器ID
...
@@ -140,13 +141,25 @@ public class Order implements Serializable {
...
@@ -140,13 +141,25 @@ public class Order implements Serializable {
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
private
Date
updatedAt
;
/**
* 下单时用户所在地的经度
*/
@ApiModelProperty
(
"下单时用户所在地的经度"
)
private
BigDecimal
lng
;
/**
* 下单时用户所在地的纬度
*/
@ApiModelProperty
(
"下单时用户所在地的纬度"
)
private
BigDecimal
lat
;
private
Shop
shop
;
private
Shop
shop
;
private
List
<
OrderDetail
>
orderDetails
;
private
List
<
OrderDetail
>
orderDetails
;
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"id"
,
getId
())
.
append
(
"orderNo"
,
getOrderNo
())
.
append
(
"orderNo"
,
getOrderNo
())
.
append
(
"orderNum"
,
getOrderNum
())
.
append
(
"orderNum"
,
getOrderNum
())
...
...
soss-system/src/main/java/com/soss/system/domain/Shop.java
View file @
b0288c32
...
@@ -3,6 +3,7 @@ package com.soss.system.domain;
...
@@ -3,6 +3,7 @@ package com.soss.system.domain;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.annotation.Excel
;
import
com.soss.common.core.domain.BaseEntity
;
import
com.soss.common.core.domain.BaseEntity
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
...
@@ -15,6 +16,7 @@ import java.util.Date;
...
@@ -15,6 +16,7 @@ import java.util.Date;
* @author zxq
* @author zxq
* @date 2022-04-28
* @date 2022-04-28
*/
*/
@Data
public
class
Shop
extends
BaseEntity
public
class
Shop
extends
BaseEntity
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -66,25 +68,9 @@ public class Shop extends BaseEntity
...
@@ -66,25 +68,9 @@ public class Shop extends BaseEntity
@Excel
(
name
=
"${comment}"
,
readConverterExp
=
"$column.readConverterExp()"
)
@Excel
(
name
=
"${comment}"
,
readConverterExp
=
"$column.readConverterExp()"
)
private
String
zone
;
private
String
zone
;
public
String
getDistance
()
{
return
distance
;
}
public
void
setDistance
(
String
distance
)
{
this
.
distance
=
distance
;
}
/** 店铺状态 1 正常 2 暂停营业 3 关闭 */
/** 店铺状态 1 正常 2 暂停营业 3 关闭 */
@Excel
(
name
=
"店铺状态 1 正常 2 暂停营业 3 关闭"
)
@Excel
(
name
=
"店铺状态 1 正常 2 暂停营业 3 关闭"
)
private
String
state
;
private
Integer
state
;
public
String
getMachieStatus
()
{
return
machieStatus
;
}
public
void
setMachieStatus
(
String
machieStatus
)
{
this
.
machieStatus
=
machieStatus
;
}
private
String
distance
;
private
String
distance
;
...
@@ -102,47 +88,14 @@ public class Shop extends BaseEntity
...
@@ -102,47 +88,14 @@ public class Shop extends BaseEntity
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
private
Date
updatedAt
;
public
String
getMachineCode
()
{
return
machineCode
;
}
public
void
setMachineCode
(
String
machineCode
)
{
this
.
machineCode
=
machineCode
;
}
private
String
machineCode
;
private
String
machineCode
;
public
int
getMachineCount
()
{
return
machineCount
;
}
public
void
setMachineCount
(
int
machineCount
)
{
this
.
machineCount
=
machineCount
;
}
public
BigDecimal
getSalesAmount
()
{
return
salesAmount
;
}
public
void
setSalesAmount
(
BigDecimal
salesAmount
)
{
this
.
salesAmount
=
salesAmount
;
}
public
Integer
getSalesVolume
()
{
return
salesVolume
;
}
public
void
setSalesVolume
(
Integer
salesVolume
)
{
this
.
salesVolume
=
salesVolume
;
}
/** 是否默认 0否1是 */
/** 是否默认 0否1是 */
@Excel
(
name
=
"是否默认 0否1是"
)
@Excel
(
name
=
"是否默认 0否1是"
)
private
Long
isDefault
;
private
Long
isDefault
;
private
int
machineCount
;
private
int
machineCount
;
/**
/**
*
*
*/
*/
...
@@ -154,160 +107,17 @@ public class Shop extends BaseEntity
...
@@ -154,160 +107,17 @@ public class Shop extends BaseEntity
super
();
super
();
}
}
public
Shop
(
long
id
,
String
code
,
String
name
)
{
public
Shop
(
long
id
,
Integer
state
)
{
this
();
this
.
id
=
id
;
this
.
id
=
id
;
this
.
code
=
code
;
this
.
state
=
state
;
this
.
name
=
name
;
}
}
public
void
setId
(
long
id
)
{
public
Shop
(
long
id
,
String
code
,
String
name
)
{
this
();
this
.
id
=
id
;
this
.
id
=
id
;
}
public
long
getId
()
{
return
id
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
this
.
name
=
name
;
public
String
getCode
()
{
return
code
;
}
public
void
setLng
(
String
lng
)
{
this
.
lng
=
lng
;
}
public
String
getLng
()
{
return
lng
;
}
public
void
setLat
(
String
lat
)
{
this
.
lat
=
lat
;
}
public
String
getLat
()
{
return
lat
;
}
public
void
setRemarks
(
String
remarks
)
{
this
.
remarks
=
remarks
;
}
public
String
getRemarks
()
{
return
remarks
;
}
public
void
setStartTime
(
String
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getStartTime
()
{
return
startTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
String
getAddress
()
{
return
address
;
}
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
public
String
getProvince
()
{
return
province
;
}
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
public
String
getCity
()
{
return
city
;
}
public
void
setZone
(
String
zone
)
{
this
.
zone
=
zone
;
}
public
String
getZone
()
{
return
zone
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getState
()
{
return
state
;
}
public
void
setCreatedAt
(
Date
createdAt
)
{
this
.
createdAt
=
createdAt
;
}
public
Date
getCreatedAt
()
{
return
createdAt
;
}
public
void
setUpdatedAt
(
Date
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
}
public
Date
getUpdatedAt
()
{
return
updatedAt
;
}
public
void
setIsDefault
(
Long
isDefault
)
{
this
.
isDefault
=
isDefault
;
}
public
Long
getIsDefault
()
{
return
isDefault
;
}
public
double
getRealDistance
()
{
return
realDistance
;
}
public
void
setRealDistance
(
double
realDistance
)
{
this
.
realDistance
=
realDistance
;
}
}
@Override
@Override
...
...
soss-system/src/main/java/com/soss/system/domain/po/CouponPo.java
View file @
b0288c32
...
@@ -78,7 +78,7 @@ public class CouponPo {
...
@@ -78,7 +78,7 @@ public class CouponPo {
@ApiModelProperty
(
"短信模板ID"
)
@ApiModelProperty
(
"短信模板ID"
)
private
Integer
msgId
;
private
Integer
msgId
;
public
void
couponUseLimitCheck
()
{
public
void
couponUse
Area
LimitCheck
()
{
int
limitDim
=
0
;
int
limitDim
=
0
;
if
(
province
!=
null
&&
province
.
length
>
0
)
{
if
(
province
!=
null
&&
province
.
length
>
0
)
{
limitDim
+=
1
;
limitDim
+=
1
;
...
...
soss-system/src/main/java/com/soss/system/domain/vo/CouponVo.java
View file @
b0288c32
...
@@ -12,6 +12,9 @@ import java.util.Map;
...
@@ -12,6 +12,9 @@ import java.util.Map;
@Data
@Data
public
class
CouponVo
extends
CouponPo
{
public
class
CouponVo
extends
CouponPo
{
@ApiModelProperty
(
"优惠券id"
)
private
Integer
couponId
;
@ApiModelProperty
(
"优惠券规则id"
)
@ApiModelProperty
(
"优惠券规则id"
)
private
Integer
ruleId
;
private
Integer
ruleId
;
...
...
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/ImagesVo.java
View file @
b0288c32
package
com
.
soss
.
system
.
domain
.
vo
.
orderTaking
;
package
com
.
soss
.
system
.
domain
.
vo
.
orderTaking
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONArray
;
import
lombok.Data
;
@Data
public
class
ImagesVo
{
public
class
ImagesVo
{
private
String
left
;
private
JSONArray
left
;
public
String
getLeft
()
{
// private JSONObject right;
return
left
;
}
public
void
setLeft
(
String
left
)
{
this
.
left
=
left
;
}
public
JSONObject
getRight
()
{
return
right
;
}
public
void
setRight
(
JSONObject
right
)
{
this
.
right
=
right
;
}
private
JSONObject
right
;
}
}
soss-system/src/main/java/com/soss/system/domain/vo/orderTaking/OrderTakingVo.java
View file @
b0288c32
package
com
.
soss
.
system
.
domain
.
vo
.
orderTaking
;
package
com
.
soss
.
system
.
domain
.
vo
.
orderTaking
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.List
;
@Data
public
class
OrderTakingVo
implements
Serializable
{
public
class
OrderTakingVo
implements
Serializable
{
private
ImagesVo
images
;
private
ImagesVo
images
;
public
ImagesVo
getImages
()
{
return
images
;
}
public
void
setImages
(
ImagesVo
images
)
{
this
.
images
=
images
;
}
public
String
getTips
()
{
return
tips
;
}
public
void
setTips
(
String
tips
)
{
this
.
tips
=
tips
;
}
public
String
getCountOfOrder
()
{
return
countOfOrder
;
}
public
void
setCountOfOrder
(
String
countOfOrder
)
{
this
.
countOfOrder
=
countOfOrder
;
}
public
List
<
CategoryVo
>
getCategorys
()
{
return
categorys
;
}
public
void
setCategorys
(
List
<
CategoryVo
>
categorys
)
{
this
.
categorys
=
categorys
;
}
public
List
<
RecommendVo
>
getRecommends
()
{
return
recommends
;
}
public
void
setRecommends
(
List
<
RecommendVo
>
recommends
)
{
this
.
recommends
=
recommends
;
}
private
String
tips
;
private
String
tips
;
public
String
getShopState
()
{
return
shopState
;
}
public
void
setShopState
(
String
shopState
)
{
this
.
shopState
=
shopState
;
}
private
String
countOfOrder
;
private
String
countOfOrder
;
private
List
<
CategoryVo
>
categorys
;
private
List
<
CategoryVo
>
categorys
;
private
List
<
RecommendVo
>
recommends
;
private
List
<
RecommendVo
>
recommends
;
private
String
shopState
;
private
Integer
shopState
;
}
}
soss-system/src/main/java/com/soss/system/mapper/CouponMapper.java
View file @
b0288c32
...
@@ -55,4 +55,9 @@ public interface CouponMapper {
...
@@ -55,4 +55,9 @@ public interface CouponMapper {
* @return
* @return
*/
*/
List
<
Coupon
>
getEffectiveCoupon
();
List
<
Coupon
>
getEffectiveCoupon
();
/**
* 到期的优惠券状态置为失效
*/
void
expireCoupon
();
}
}
soss-system/src/main/java/com/soss/system/mapper/CouponUserMapper.java
View file @
b0288c32
...
@@ -23,7 +23,7 @@ public interface CouponUserMapper {
...
@@ -23,7 +23,7 @@ public interface CouponUserMapper {
* @param couponId
* @param couponId
* @return
* @return
*/
*/
int
getCouponReceiveCount
(
@Param
(
"couponId"
)
Integer
couponId
);
long
getCouponReceiveCount
(
@Param
(
"couponId"
)
Integer
couponId
);
/**
/**
* 查询用户的优惠券信息
* 查询用户的优惠券信息
...
@@ -67,10 +67,23 @@ public interface CouponUserMapper {
...
@@ -67,10 +67,23 @@ public interface CouponUserMapper {
List
<
CouponVo
>
listCustAvailableCoupon
(
@Param
(
"custId"
)
String
custId
,
@Param
(
"couponId"
)
Integer
couponId
,
@Param
(
"nowTime"
)
LocalDateTime
nowTime
);
List
<
CouponVo
>
listCustAvailableCoupon
(
@Param
(
"custId"
)
String
custId
,
@Param
(
"couponId"
)
Integer
couponId
,
@Param
(
"nowTime"
)
LocalDateTime
nowTime
);
/**
/**
* 查询用户优惠券列表
*
* @param custId 用户id
* @param effectiveFlag 有效标识 true-有效 false-已使用/已失效
*/
List
<
CouponVo
>
listCustCoupons
(
@Param
(
"custId"
)
String
custId
,
@Param
(
"effectiveFlag"
)
Boolean
effectiveFlag
);
/**
* 查询用户领取优惠券列表
* 查询用户领取优惠券列表
*
*
* @param couponUser
* @param couponUser
* @return
* @return
*/
*/
List
<
CouponUserVo
>
selectCouponUserList
(
CouponUser
couponUser
);
List
<
CouponUserVo
>
selectCouponUserList
(
CouponUser
couponUser
);
/**
* 用户优惠券到期失效
*/
void
expireCouponUser
();
}
}
soss-system/src/main/java/com/soss/system/mapper/MachineMapper.java
View file @
b0288c32
package
com
.
soss
.
system
.
mapper
;
package
com
.
soss
.
system
.
mapper
;
import
java.util.List
;
import
com.soss.system.domain.Machine
;
import
com.soss.system.domain.Machine
;
import
java.util.List
;
/**
/**
* 机器Mapper接口
* 机器Mapper接口
*
*
...
@@ -19,6 +20,8 @@ public interface MachineMapper
...
@@ -19,6 +20,8 @@ public interface MachineMapper
*/
*/
public
Machine
selectMachineById
(
String
id
);
public
Machine
selectMachineById
(
String
id
);
List
<
Machine
>
selectMachineByShopId
(
Long
shopId
);
public
Machine
selectMachineByCode
(
String
code
);
public
Machine
selectMachineByCode
(
String
code
);
/**
/**
...
...
soss-system/src/main/java/com/soss/system/mapper/OrderMapper.java
View file @
b0288c32
...
@@ -73,7 +73,7 @@ public interface OrderMapper {
...
@@ -73,7 +73,7 @@ public interface OrderMapper {
List
<
Order
>
selectOrder
(
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"machineId"
)
String
machineCode
);
List
<
Order
>
selectOrder
(
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"machineId"
)
String
machineCode
);
List
<
Order
>
selectOrderByShopId
(
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"shopId"
)
Stri
ng
shopId
);
List
<
Order
>
selectOrderByShopId
(
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"shopId"
)
Lo
ng
shopId
);
Order
selectHomeByUserId
(
@Param
(
"userId"
)
String
openId
,
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"shopId"
)
String
shopId
);
Order
selectHomeByUserId
(
@Param
(
"userId"
)
String
openId
,
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"shopId"
)
String
shopId
);
...
...
soss-system/src/main/java/com/soss/system/mapper/ShopMapper.java
View file @
b0288c32
...
@@ -18,7 +18,7 @@ public interface ShopMapper {
...
@@ -18,7 +18,7 @@ public interface ShopMapper {
* @param id 店铺主键
* @param id 店铺主键
* @return 店铺
* @return 店铺
*/
*/
public
Shop
selectShopById
(
Stri
ng
id
);
Shop
selectShopById
(
Lo
ng
id
);
/**
/**
* 查询店铺列表,为翻译用
* 查询店铺列表,为翻译用
...
...
soss-system/src/main/java/com/soss/system/schedule/CouponSchedule.java
0 → 100644
View file @
b0288c32
package
com
.
soss
.
system
.
schedule
;
import
com.soss.system.mapper.CouponMapper
;
import
com.soss.system.mapper.CouponUserMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
@Component
public
class
CouponSchedule
{
@Autowired
private
CouponMapper
couponMapper
;
@Autowired
private
CouponUserMapper
couponUserMapper
;
@Scheduled
(
cron
=
"0 0 0 * * ?"
)
private
void
expireCoupon
()
{
couponMapper
.
expireCoupon
();
}
@Scheduled
(
cron
=
"0 0 0 * * ?"
)
private
void
expireCouponUser
()
{
couponUserMapper
.
expireCouponUser
();
}
}
soss-system/src/main/java/com/soss/system/service/ICouponUserService.java
View file @
b0288c32
...
@@ -25,7 +25,11 @@ public interface ICouponUserService {
...
@@ -25,7 +25,11 @@ public interface ICouponUserService {
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
,
Integer
couponId
);
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
,
Integer
couponId
);
List
<
CouponVo
>
listCustCoupons
(
String
custId
,
Boolean
effectiveFlag
);
List
<
CouponUserVo
>
selectCouponUserList
(
CouponUser
couponUser
);
List
<
CouponUserVo
>
selectCouponUserList
(
CouponUser
couponUser
);
void
resovleCouponFitable
(
List
<
CouponVo
>
couponVos
,
Order
order
);
void
resovleCouponFitable
(
List
<
CouponVo
>
couponVos
,
Order
order
);
void
useCoupon
(
Integer
id
);
}
}
soss-system/src/main/java/com/soss/system/service/IOrderService.java
View file @
b0288c32
package
com
.
soss
.
system
.
service
;
package
com
.
soss
.
system
.
service
;
import
java.util.List
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.OrderQuery
;
import
com.soss.system.domain.vo.OrderQuery
;
import
java.util.List
;
/**
/**
* 订单Service接口
* 订单Service接口
*
*
...
@@ -41,7 +41,7 @@ public interface IOrderService
...
@@ -41,7 +41,7 @@ public interface IOrderService
*/
*/
public
AjaxResult
insertOrder
(
LoginUser
request
,
Order
order
);
public
AjaxResult
insertOrder
(
LoginUser
request
,
Order
order
);
void
checkBusinessTime
(
Stri
ng
shopId
);
void
checkBusinessTime
(
Lo
ng
shopId
);
/**
/**
* 修改订单
* 修改订单
...
...
soss-system/src/main/java/com/soss/system/service/IShopService.java
View file @
b0288c32
package
com
.
soss
.
system
.
service
;
package
com
.
soss
.
system
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.GoodsCategory
;
import
com.soss.system.domain.GoodsCategory
;
import
com.soss.system.domain.GoodsSku
;
import
com.soss.system.domain.GoodsSku
;
import
com.soss.system.domain.Shop
;
import
com.soss.system.domain.Shop
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 店铺Service接口
* 店铺Service接口
*
*
...
@@ -23,7 +23,7 @@ public interface IShopService
...
@@ -23,7 +23,7 @@ public interface IShopService
* @param id 店铺主键
* @param id 店铺主键
* @return 店铺
* @return 店铺
*/
*/
public
Shop
selectShopById
(
Stri
ng
id
);
public
Shop
selectShopById
(
Lo
ng
id
);
/**
/**
* 查询店铺列表
* 查询店铺列表
...
@@ -33,6 +33,12 @@ public interface IShopService
...
@@ -33,6 +33,12 @@ public interface IShopService
*/
*/
public
List
<
Shop
>
selectShopList
(
Shop
shop
);
public
List
<
Shop
>
selectShopList
(
Shop
shop
);
void
testFinish
(
Long
shopId
);
void
testStart
(
Long
shopId
);
void
open
(
Long
shopId
);
/**
/**
* 新增店铺
* 新增店铺
*
*
...
@@ -57,14 +63,6 @@ public interface IShopService
...
@@ -57,14 +63,6 @@ public interface IShopService
*/
*/
public
int
deleteShopByIds
(
String
[]
ids
);
public
int
deleteShopByIds
(
String
[]
ids
);
/**
* 删除店铺信息
*
* @param id 店铺主键
* @return 结果
*/
public
int
deleteShopById
(
String
id
);
String
addGoods
(
long
shopId
,
String
goodsIds
);
String
addGoods
(
long
shopId
,
String
goodsIds
);
List
<
GoodsCategory
>
getCategoryGoods
(
long
shopId
);
List
<
GoodsCategory
>
getCategoryGoods
(
long
shopId
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/AppServiceImpl.java
View file @
b0288c32
...
@@ -15,7 +15,7 @@ public class AppServiceImpl {
...
@@ -15,7 +15,7 @@ public class AppServiceImpl {
private
ShopMapper
shopMapper
;
private
ShopMapper
shopMapper
;
public
Shop
getShop
(
String
lng
,
String
lat
)
{
public
Shop
getShop
(
String
lng
,
String
lat
)
{
Shop
shop
=
new
Shop
();
Shop
shop
=
new
Shop
();
shop
.
setState
(
"1"
);
shop
.
setState
(
1
);
shop
.
setIsDefault
(
1L
);
shop
.
setIsDefault
(
1L
);
List
<
Shop
>
shops
=
shopMapper
.
selectShopList
(
shop
);
List
<
Shop
>
shops
=
shopMapper
.
selectShopList
(
shop
);
if
(
shops
!=
null
&&!
shops
.
isEmpty
()){
if
(
shops
!=
null
&&!
shops
.
isEmpty
()){
...
...
soss-system/src/main/java/com/soss/system/service/impl/CouponServiceImpl.java
View file @
b0288c32
...
@@ -82,7 +82,7 @@ public class CouponServiceImpl implements ICouponService {
...
@@ -82,7 +82,7 @@ public class CouponServiceImpl implements ICouponService {
public
void
update
(
CouponPo
couponPo
)
{
public
void
update
(
CouponPo
couponPo
)
{
Assert
.
notNull
(
couponPo
.
getId
(),
"要修改的优惠券ID还未传递"
);
Assert
.
notNull
(
couponPo
.
getId
(),
"要修改的优惠券ID还未传递"
);
Coupon
coupon
=
this
.
detail
(
couponPo
.
getId
());
Coupon
coupon
=
this
.
detail
(
couponPo
.
getId
());
int
couponReceiveCount
=
couponUserMapper
.
getCouponReceiveCount
(
coupon
.
getId
());
long
couponReceiveCount
=
couponUserMapper
.
getCouponReceiveCount
(
coupon
.
getId
());
if
(
couponReceiveCount
>
0
)
{
if
(
couponReceiveCount
>
0
)
{
throw
new
ServiceException
(
"优惠券已被领取,无法编辑,只可下线"
);
throw
new
ServiceException
(
"优惠券已被领取,无法编辑,只可下线"
);
}
else
if
(!
coupon
.
getState
().
equals
(
CouponState
.
OFFLINE
.
getState
()))
{
}
else
if
(!
coupon
.
getState
().
equals
(
CouponState
.
OFFLINE
.
getState
()))
{
...
@@ -96,7 +96,7 @@ public class CouponServiceImpl implements ICouponService {
...
@@ -96,7 +96,7 @@ public class CouponServiceImpl implements ICouponService {
@Override
@Override
public
void
updateCheckPre
(
Integer
id
)
{
public
void
updateCheckPre
(
Integer
id
)
{
int
couponReceiveCount
=
couponUserMapper
.
getCouponReceiveCount
(
id
);
Long
couponReceiveCount
=
couponUserMapper
.
getCouponReceiveCount
(
id
);
if
(
couponReceiveCount
>
0
)
{
if
(
couponReceiveCount
>
0
)
{
throw
new
ServiceException
(
"优惠券已被领取,无法编辑,只可下线"
);
throw
new
ServiceException
(
"优惠券已被领取,无法编辑,只可下线"
);
}
}
...
@@ -122,7 +122,7 @@ public class CouponServiceImpl implements ICouponService {
...
@@ -122,7 +122,7 @@ public class CouponServiceImpl implements ICouponService {
Assert
.
notNull
(
couponPo
.
getPriceDiscount
(),
"打折数还未设置"
);
Assert
.
notNull
(
couponPo
.
getPriceDiscount
(),
"打折数还未设置"
);
Assert
.
notNull
(
couponPo
.
getOrderLimit
(),
"订单限制还未设置"
);
Assert
.
notNull
(
couponPo
.
getOrderLimit
(),
"订单限制还未设置"
);
couponPo
.
setPriceLimit
(
BigDecimal
.
ZERO
);
couponPo
.
setPriceLimit
(
BigDecimal
.
ZERO
);
ruleName
=
couponPo
.
get
OrderLimi
t
()
+
"折"
;
ruleName
=
couponPo
.
get
PriceDiscoun
t
()
+
"折"
;
ruleDesc
=
couponPo
.
getOrderLimit
()
?
"单杯"
:
"整单"
;
ruleDesc
=
couponPo
.
getOrderLimit
()
?
"单杯"
:
"整单"
;
}
else
{
}
else
{
Assert
.
notNull
(
couponPo
.
getPriceLimit
(),
"价格门槛还未设置"
);
Assert
.
notNull
(
couponPo
.
getPriceLimit
(),
"价格门槛还未设置"
);
...
@@ -148,7 +148,7 @@ public class CouponServiceImpl implements ICouponService {
...
@@ -148,7 +148,7 @@ public class CouponServiceImpl implements ICouponService {
if
(!
ArrayUtil
.
isEmpty
(
couponPo
.
getCategoryIds
())
&&
!
ArrayUtil
.
isEmpty
(
couponPo
.
getGoodsIds
()))
{
if
(!
ArrayUtil
.
isEmpty
(
couponPo
.
getCategoryIds
())
&&
!
ArrayUtil
.
isEmpty
(
couponPo
.
getGoodsIds
()))
{
throw
new
ServiceException
(
"品类范围和商品范围不能重叠选择"
);
throw
new
ServiceException
(
"品类范围和商品范围不能重叠选择"
);
}
}
couponPo
.
couponUseLimitCheck
();
couponPo
.
couponUse
Area
LimitCheck
();
Assert
.
notEmpty
(
couponPo
.
getWeekLimit
(),
"每周几的限制还未传递"
);
Assert
.
notEmpty
(
couponPo
.
getWeekLimit
(),
"每周几的限制还未传递"
);
Integer
maxWeekVal
=
Arrays
.
stream
(
couponPo
.
getWeekLimit
()).
max
(
Integer:
:
compareTo
).
get
();
Integer
maxWeekVal
=
Arrays
.
stream
(
couponPo
.
getWeekLimit
()).
max
(
Integer:
:
compareTo
).
get
();
Integer
minWeekVal
=
Arrays
.
stream
(
couponPo
.
getWeekLimit
()).
min
(
Integer:
:
compareTo
).
get
();
Integer
minWeekVal
=
Arrays
.
stream
(
couponPo
.
getWeekLimit
()).
min
(
Integer:
:
compareTo
).
get
();
...
...
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
View file @
b0288c32
...
@@ -2,6 +2,7 @@ package com.soss.system.service.impl;
...
@@ -2,6 +2,7 @@ package com.soss.system.service.impl;
import
com.soss.common.enums.CouponCategoryType
;
import
com.soss.common.enums.CouponCategoryType
;
import
com.soss.common.enums.CouponState
;
import
com.soss.common.enums.CouponState
;
import
com.soss.common.enums.CouponUserState
;
import
com.soss.common.enums.CouponUserType
;
import
com.soss.common.enums.CouponUserType
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.DateUtils
;
import
com.soss.common.utils.DateUtils
;
...
@@ -132,6 +133,11 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -132,6 +133,11 @@ public class CouponUserServiceImpl implements ICouponUserService {
@Override
@Override
public
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
,
Integer
couponId
)
{
public
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
,
Integer
couponId
)
{
List
<
CouponVo
>
couponVos
=
couponUserMapper
.
listCustAvailableCoupon
(
custId
,
couponId
,
LocalDateTime
.
now
());
List
<
CouponVo
>
couponVos
=
couponUserMapper
.
listCustAvailableCoupon
(
custId
,
couponId
,
LocalDateTime
.
now
());
transferTabIds
(
couponVos
);
return
couponVos
;
}
private
void
transferTabIds
(
List
<
CouponVo
>
couponVos
)
{
couponVos
.
forEach
(
couponVo
->
{
couponVos
.
forEach
(
couponVo
->
{
couponVo
.
setCategoryIds
(
ArrayUtil
.
transStrToCodeList
(
couponVo
.
getCategoryIdStr
()));
couponVo
.
setCategoryIds
(
ArrayUtil
.
transStrToCodeList
(
couponVo
.
getCategoryIdStr
()));
couponVo
.
setGoodsIds
(
ArrayUtil
.
transStrToLongList
(
couponVo
.
getGoodsIdStr
()));
couponVo
.
setGoodsIds
(
ArrayUtil
.
transStrToLongList
(
couponVo
.
getGoodsIdStr
()));
...
@@ -141,6 +147,12 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -141,6 +147,12 @@ public class CouponUserServiceImpl implements ICouponUserService {
couponVo
.
setShopIds
(
ArrayUtil
.
transStrToLongList
(
couponVo
.
getShopIdStr
()));
couponVo
.
setShopIds
(
ArrayUtil
.
transStrToLongList
(
couponVo
.
getShopIdStr
()));
couponVo
.
setWeekLimit
(
ArrayUtil
.
transStrToIntList
(
couponVo
.
getWeekLimitStr
()));
couponVo
.
setWeekLimit
(
ArrayUtil
.
transStrToIntList
(
couponVo
.
getWeekLimitStr
()));
});
});
}
@Override
public
List
<
CouponVo
>
listCustCoupons
(
String
custId
,
Boolean
effectiveFlag
)
{
List
<
CouponVo
>
couponVos
=
couponUserMapper
.
listCustCoupons
(
custId
,
effectiveFlag
);
transferTabIds
(
couponVos
);
return
couponVos
;
return
couponVos
;
}
}
...
@@ -163,6 +175,12 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -163,6 +175,12 @@ public class CouponUserServiceImpl implements ICouponUserService {
checkGoodsFitable
(
couponVos
,
order
.
getOrderDetails
());
checkGoodsFitable
(
couponVos
,
order
.
getOrderDetails
());
}
}
@Override
public
void
useCoupon
(
Integer
id
)
{
CouponUser
couponUser
=
new
CouponUser
(
id
,
CouponUserState
.
USED
.
getState
());
couponUserMapper
.
updateCouponUser
(
couponUser
);
}
private
void
checkGoodsFitable
(
List
<
CouponVo
>
couponVos
,
List
<
OrderDetail
>
orderDetails
)
{
private
void
checkGoodsFitable
(
List
<
CouponVo
>
couponVos
,
List
<
OrderDetail
>
orderDetails
)
{
Assert
.
notEmpty
(
orderDetails
,
"商品明细还未传递"
);
Assert
.
notEmpty
(
orderDetails
,
"商品明细还未传递"
);
List
<
Long
>
skuIds
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getSkuId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
skuIds
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getSkuId
).
collect
(
Collectors
.
toList
());
...
@@ -222,7 +240,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -222,7 +240,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
BigDecimal
discountAmount
=
fitSkuMap
.
values
().
stream
().
max
(
BigDecimal:
:
compareTo
).
get
();
BigDecimal
discountAmount
=
fitSkuMap
.
values
().
stream
().
max
(
BigDecimal:
:
compareTo
).
get
();
Long
couponSkuId
=
fitOrderDetails
.
stream
().
filter
(
orderDetail
->
fitSkuMap
.
get
(
orderDetail
.
getSkuId
()).
compareTo
(
BigDecimal
.
ZERO
)
==
0
).
findFirst
().
get
().
getSkuId
();
Long
couponSkuId
=
fitOrderDetails
.
stream
().
filter
(
orderDetail
->
fitSkuMap
.
get
(
orderDetail
.
getSkuId
()).
compareTo
(
BigDecimal
.
ZERO
)
==
0
).
findFirst
().
get
().
getSkuId
();
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
couponVo
.
setCouponAmount
(
this
.
getDiscountAmount
(
discountAmount
,
couponVo
.
getPriceDiscount
(
)));
couponVo
.
setCouponAmount
(
discountAmount
.
subtract
(
this
.
getDiscountAmount
(
discountAmount
,
couponVo
.
getPriceDiscount
()
)));
}
else
{
// 免单
}
else
{
// 免单
couponVo
.
setCouponAmount
(
discountAmount
);
couponVo
.
setCouponAmount
(
discountAmount
);
}
}
...
@@ -238,6 +256,8 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -238,6 +256,8 @@ public class CouponUserServiceImpl implements ICouponUserService {
OrderDetail
orderDetail
=
fitOrderDetails
.
get
(
fitOrderDetails
.
size
()
-
1
);
OrderDetail
orderDetail
=
fitOrderDetails
.
get
(
fitOrderDetails
.
size
()
-
1
);
orderDetail
.
setCouponAmount
(
orderDetail
.
getCouponAmount
().
add
(
couponVo
.
getCouponAmount
().
subtract
(
detailCouponSum
)));
orderDetail
.
setCouponAmount
(
orderDetail
.
getCouponAmount
().
add
(
couponVo
.
getCouponAmount
().
subtract
(
detailCouponSum
)));
}
}
fitOrderDetails
.
forEach
(
orderDetail
->
orderDetail
.
setCouponAmount
(
fitSkuMap
.
get
(
orderDetail
.
getSkuId
()).
subtract
(
orderDetail
.
getCouponAmount
())));
couponVo
.
setCouponAmount
(
fitGoodsAmount
.
subtract
(
couponVo
.
getCouponAmount
()));
}
else
{
// 免单
}
else
{
// 免单
couponVo
.
setCouponAmount
(
fitGoodsAmount
);
couponVo
.
setCouponAmount
(
fitGoodsAmount
);
}
}
...
@@ -246,7 +266,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -246,7 +266,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
couponVo
.
setCouponAmountMap
(
couponAmountMap
);
couponVo
.
setCouponAmountMap
(
couponAmountMap
);
}
}
private
void
checkShopAndWeeklyFitable
(
List
<
CouponVo
>
couponVos
,
Stri
ng
shopId
)
{
private
void
checkShopAndWeeklyFitable
(
List
<
CouponVo
>
couponVos
,
Lo
ng
shopId
)
{
Assert
.
notNull
(
shopId
,
"商店id还未传递"
);
Assert
.
notNull
(
shopId
,
"商店id还未传递"
);
Shop
shop
=
shopMapper
.
selectShopById
(
shopId
);
Shop
shop
=
shopMapper
.
selectShopById
(
shopId
);
Assert
.
notNull
(
shop
,
"未查询到匹配的商店[id="
+
shopId
+
"]"
);
Assert
.
notNull
(
shop
,
"未查询到匹配的商店[id="
+
shopId
+
"]"
);
...
@@ -254,15 +274,16 @@ public class CouponUserServiceImpl implements ICouponUserService {
...
@@ -254,15 +274,16 @@ public class CouponUserServiceImpl implements ICouponUserService {
int
dayOfWeek
=
Calendar
.
getInstance
().
get
(
Calendar
.
DAY_OF_WEEK
);
int
dayOfWeek
=
Calendar
.
getInstance
().
get
(
Calendar
.
DAY_OF_WEEK
);
couponVos
.
forEach
(
couponVo
->
{
couponVos
.
forEach
(
couponVo
->
{
/** 可用门店的判断 */
/** 可用门店的判断 */
if
(!
ArrayUtil
.
isAllAvailable
(
couponVo
.
getProvince
())
&&
!
ArrayUtil
.
contains
(
couponVo
.
getProvince
(),
shop
.
getProvince
()))
{
if
(!
ArrayUtil
.
isAllAvailable
(
couponVo
.
getProvince
())
&&
ArrayUtil
.
hasContents
(
couponVo
.
getProvince
())
&&
!
ArrayUtil
.
contains
(
couponVo
.
getProvince
(),
shop
.
getProvince
()))
{
couponVo
.
setNotFitableDesc
(
"限定区域使用"
);
couponVo
.
setNotFitableDesc
(
"限定区域使用"
);
return
;
return
;
}
}
if
(!
ArrayUtil
.
isEmpty
(
couponVo
.
getCity
())
&&
!
ArrayUtil
.
contains
(
couponVo
.
getCity
(),
shop
.
getCity
()))
{
if
(!
ArrayUtil
.
isEmpty
(
couponVo
.
getCity
())
&&
ArrayUtil
.
hasContents
(
couponVo
.
getCity
())
&&
!
ArrayUtil
.
contains
(
couponVo
.
getCity
(),
shop
.
getCity
()))
{
couponVo
.
setNotFitableDesc
(
"限定区域使用"
);
couponVo
.
setNotFitableDesc
(
"限定区域使用"
);
return
;
return
;
}
}
if
(!
ArrayUtil
.
isEmpty
(
couponVo
.
getArea
())
&&
!
ArrayUtil
.
contains
(
couponVo
.
getArea
(),
shop
.
getZone
()))
{
if
(!
ArrayUtil
.
isEmpty
(
couponVo
.
getArea
())
&&
ArrayUtil
.
hasContents
(
couponVo
.
getArea
())
&&
!
ArrayUtil
.
contains
(
couponVo
.
getArea
(),
shop
.
getZone
()))
{
couponVo
.
setNotFitableDesc
(
"限定区域使用"
);
couponVo
.
setNotFitableDesc
(
"限定区域使用"
);
return
;
return
;
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
View file @
b0288c32
...
@@ -260,7 +260,7 @@ public class MachineApiServiceImpl {
...
@@ -260,7 +260,7 @@ public class MachineApiServiceImpl {
public
Object
robotUpdate
(
JSONObject
jsonObject
)
{
public
Object
robotUpdate
(
JSONObject
jsonObject
)
{
String
robotID
=
jsonObject
.
getString
(
"robotId"
);
String
robotID
=
jsonObject
.
getString
(
"robotId"
);
String
status
=
jsonObject
.
getString
(
"status"
);
Integer
status
=
jsonObject
.
getInteger
(
"status"
);
Long
shopID
=
jsonObject
.
getLong
(
"shopId"
);
Long
shopID
=
jsonObject
.
getLong
(
"shopId"
);
Machine
machine
=
new
Machine
();
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
shopID
);
machine
.
setShopId
(
shopID
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/MachineServiceImpl.java
View file @
b0288c32
package
com
.
soss
.
system
.
service
.
impl
;
package
com
.
soss
.
system
.
service
.
impl
;
import
java.util.Date
;
import
com.soss.common.enums.ShopState
;
import
java.util.List
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.system.domain.Machine
;
import
com.soss.system.domain.Shop
;
import
com.soss.system.mapper.MachineMapper
;
import
com.soss.system.mapper.ShopMapper
;
import
com.soss.system.service.IMachineService
;
import
com.soss.system.service.IMachineService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.soss.system.mapper.MachineMapper
;
import
com.soss.system.domain.Machine
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* 机器Service业务层处理
* 机器Service业务层处理
...
@@ -17,10 +20,11 @@ import com.soss.system.domain.Machine;
...
@@ -17,10 +20,11 @@ import com.soss.system.domain.Machine;
* @date 2022-04-28
* @date 2022-04-28
*/
*/
@Service
@Service
public
class
MachineServiceImpl
implements
IMachineService
public
class
MachineServiceImpl
implements
IMachineService
{
{
@Autowired
@Autowired
private
MachineMapper
machineMapper
;
private
MachineMapper
machineMapper
;
@Autowired
private
ShopMapper
shopMapper
;
/**
/**
* 查询机器
* 查询机器
...
@@ -29,8 +33,7 @@ public class MachineServiceImpl implements IMachineService
...
@@ -29,8 +33,7 @@ public class MachineServiceImpl implements IMachineService
* @return 机器
* @return 机器
*/
*/
@Override
@Override
public
Machine
selectMachineById
(
String
id
)
public
Machine
selectMachineById
(
String
id
)
{
{
return
machineMapper
.
selectMachineById
(
id
);
return
machineMapper
.
selectMachineById
(
id
);
}
}
...
@@ -103,20 +106,22 @@ public class MachineServiceImpl implements IMachineService
...
@@ -103,20 +106,22 @@ public class MachineServiceImpl implements IMachineService
throw
new
ServiceException
(
"目前只允许一个店铺绑定一台机器"
);
throw
new
ServiceException
(
"目前只允许一个店铺绑定一台机器"
);
}
}
Machine
machine1
=
machineMapper
.
selectMachineByCode
(
code
);
Machine
machine1
=
machineMapper
.
selectMachineByCode
(
code
);
if
(
machine1
==
null
)
{
if
(
machine1
==
null
)
{
machine
.
setCode
(
code
);
machine
.
setCode
(
code
);
machine
.
setBindTime
(
new
Date
());
machine
.
setBindTime
(
new
Date
());
machine
.
setCreatedAt
(
new
Date
());
machine
.
setCreatedAt
(
new
Date
());
machine
.
setUpdatedAt
(
new
Date
());
machine
.
setUpdatedAt
(
new
Date
());
machine
.
setState
(
"1"
);
machine
.
setState
(
1
);
return
machineMapper
.
insertMachine
(
machine
)+
""
;
return
machineMapper
.
insertMachine
(
machine
)
+
""
;
}
}
if
(
machine1
.
getShopId
()!=
null
)
{
if
(
machine1
.
getShopId
()
!=
null
)
{
throw
new
ServiceException
(
"该机器已经被绑定,请先解绑再绑定"
);
throw
new
ServiceException
(
"该机器已经被绑定,请先解绑再绑定"
);
}
}
machine1
.
setCode
(
code
);
machine1
.
setCode
(
code
);
machine1
.
setShopId
(
shopId
);
machine1
.
setShopId
(
shopId
);
machineMapper
.
updateMachine
(
machine1
);
machineMapper
.
updateMachine
(
machine1
);
// 重新绑定机器后店铺进入测试中状态重新完成运营测试
shopMapper
.
updateShop
(
new
Shop
(
shopId
,
ShopState
.
TESTING
.
getState
()));
return
"1"
;
return
"1"
;
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderOperationLogServiceImpl.java
View file @
b0288c32
package
com
.
soss
.
system
.
service
.
impl
;
package
com
.
soss
.
system
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.constants.OrderStatusConstant
;
import
com.soss.system.constants.OrderStatusConstant
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.OrderOperationLog
;
import
com.soss.system.domain.OrderRefund
;
import
com.soss.system.domain.OrderRefund
;
import
com.soss.system.domain.vo.ResultVo
;
import
com.soss.system.domain.vo.ResultVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.soss.system.mapper.OrderOperationLogMapper
;
import
com.soss.system.mapper.OrderOperationLogMapper
;
import
com.soss.system.domain.OrderOperationLog
;
import
com.soss.system.service.IOrderOperationLogService
;
import
com.soss.system.service.IOrderOperationLogService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* 【请填写功能名称】Service业务层处理
* 【请填写功能名称】Service业务层处理
...
@@ -187,22 +187,16 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
...
@@ -187,22 +187,16 @@ public class OrderOperationLogServiceImpl implements IOrderOperationLogService
String
state
=
order
.
getState
();
String
state
=
order
.
getState
();
operationLog
.
setOperation
(
"同步消息"
);
operationLog
.
setOperation
(
"同步消息"
);
operationLog
.
setOperationUser
(
"接口"
);
operationLog
.
setOperationUser
(
"接口"
);
String
result
=
"成功"
;
String
result
=
"0"
.
equals
(
resultVo
.
getCode
())
?
"成功"
:
"失败"
;
if
(!
"0"
.
equals
(
resultVo
.
getCode
())){
result
=
"失败"
;
}
switch
(
state
){
switch
(
state
){
case
OrderStatusConstant
.
UnpaidCancel
:
case
OrderStatusConstant
.
UnpaidCancel
:
case
OrderStatusConstant
.
PaidCancel
:
operationLog
.
setStatus
(
"已取消"
);
operationLog
.
setStatus
(
"已取消"
);
operationLog
.
setContent
(
"取消订单
同步"
+
result
);
operationLog
.
setContent
(
"取消订单
信息同步【"
+
result
+
"】"
);
break
;
break
;
case
OrderStatusConstant
.
Paid
:
case
OrderStatusConstant
.
Paid
:
operationLog
.
setStatus
(
"已付款"
);
operationLog
.
setStatus
(
"已付款"
);
operationLog
.
setContent
(
"付款状态信息"
+
result
);
operationLog
.
setContent
(
"付款信息同步【"
+
result
+
"】"
);
break
;
case
OrderStatusConstant
.
PaidCancel
:
operationLog
.
setStatus
(
"已取消"
);
operationLog
.
setContent
(
"取消订单同步"
+
result
);
break
;
break
;
default
:
default
:
return
;
return
;
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
b0288c32
...
@@ -28,7 +28,6 @@ import org.springframework.util.CollectionUtils;
...
@@ -28,7 +28,6 @@ import org.springframework.util.CollectionUtils;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -136,7 +135,7 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -136,7 +135,7 @@ public class OrderServiceImpl implements IOrderService {
String
machineId
=
null
;
String
machineId
=
null
;
if
(
StringUtils
.
isEmpty
(
order
.
getMachineId
()))
{
if
(
StringUtils
.
isEmpty
(
order
.
getMachineId
()))
{
Machine
machine
=
new
Machine
();
Machine
machine
=
new
Machine
();
machine
.
setShopId
(
Long
.
parseLong
(
order
.
getShopId
()
));
machine
.
setShopId
(
order
.
getShopId
(
));
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
List
<
Machine
>
machines
=
machineMapper
.
selectMachineList
(
machine
);
if
(
machines
!=
null
&&
!
machines
.
isEmpty
())
{
if
(
machines
!=
null
&&
!
machines
.
isEmpty
())
{
Machine
machine1
=
machines
.
get
(
0
);
Machine
machine1
=
machines
.
get
(
0
);
...
@@ -179,7 +178,7 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -179,7 +178,7 @@ public class OrderServiceImpl implements IOrderService {
}
}
@Override
@Override
public
void
checkBusinessTime
(
Stri
ng
shopId
)
{
public
void
checkBusinessTime
(
Lo
ng
shopId
)
{
Shop
shop
=
shopMapper
.
selectShopById
(
shopId
);
Shop
shop
=
shopMapper
.
selectShopById
(
shopId
);
String
startTime
=
shop
.
getStartTime
();
String
startTime
=
shop
.
getStartTime
();
String
endTime
=
shop
.
getEndTime
();
String
endTime
=
shop
.
getEndTime
();
...
@@ -456,19 +455,30 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -456,19 +455,30 @@ public class OrderServiceImpl implements IOrderService {
* @param shopId
* @param shopId
* @return
* @return
*/
*/
private
String
getOrderNum
(
Stri
ng
shopId
)
{
private
String
getOrderNum
(
Lo
ng
shopId
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
String
key
=
calendar
.
getTime
().
toString
().
substring
(
0
,
3
);
String
key
=
calendar
.
getTime
().
toString
().
substring
(
0
,
3
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
format
=
simpleDateFormat
.
format
(
new
Date
());
String
format
=
simpleDateFormat
.
format
(
new
Date
());
String
redisKey
=
"shopId"
+
format
+
shopId
;
String
redisKey
=
"shopId"
+
format
+
shopId
;
RedisAtomicInteger
redisAtomicInteger
=
new
RedisAtomicInteger
(
redisKey
,
SpringUtils
.
getBean
(
StringRedisTemplate
.
class
).
getConnectionFactory
());
RedisAtomicInteger
redisAtomicInteger
=
new
RedisAtomicInteger
(
redisKey
,
SpringUtils
.
getBean
(
StringRedisTemplate
.
class
).
getConnectionFactory
());
int
randomValue
=
(
int
)
(
9
*
Math
.
random
());
while
(
randomValue
==
0
)
{
randomValue
=
(
int
)
(
9
*
Math
.
random
());
}
int
orderNum
=
randomValue
;
if
(
0
==
redisAtomicInteger
.
get
())
{
if
(
0
==
redisAtomicInteger
.
get
())
{
redisAtomicInteger
.
set
((
int
)
(
1000
*
Math
.
random
()));
redisAtomicInteger
.
set
(
randomValue
);
}
else
{
orderNum
=
redisAtomicInteger
.
getAndAdd
(
randomValue
);
if
(
orderNum
%
999
==
0
)
{
orderNum
=
redisAtomicInteger
.
getAndAdd
(
randomValue
);
}
orderNum
%=
999
;
}
}
redisAtomicInteger
.
expire
(
1
,
TimeUnit
.
DAYS
);
//
redisAtomicInteger.expire(1, TimeUnit.DAYS);
int
andIncrement
=
redisAtomicInteger
.
getAndAdd
(
3
);
//
int andIncrement = redisAtomicInteger.getAndAdd(3);
return
key
+
String
.
format
(
"%03d"
,
andIncrement
);
return
key
+
String
.
format
(
"%03d"
,
orderNum
);
}
}
//获取订单号
//获取订单号
...
@@ -555,7 +565,7 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -555,7 +565,7 @@ public class OrderServiceImpl implements IOrderService {
}
}
public
String
getWaitTime
(
Order
order
)
{
public
String
getWaitTime
(
Order
order
)
{
Stri
ng
shopId
=
order
.
getShopId
();
Lo
ng
shopId
=
order
.
getShopId
();
List
<
String
>
status
=
Arrays
.
asList
(
OrderStatusConstant
.
Paid
,
OrderStatusConstant
.
production
);
List
<
String
>
status
=
Arrays
.
asList
(
OrderStatusConstant
.
Paid
,
OrderStatusConstant
.
production
);
List
<
Order
>
orders
=
orderMapper
.
selectOrderByShopId
(
status
,
shopId
);
List
<
Order
>
orders
=
orderMapper
.
selectOrderByShopId
(
status
,
shopId
);
List
<
OrderDetail
>
list
=
new
ArrayList
<>();
List
<
OrderDetail
>
list
=
new
ArrayList
<>();
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderTakingServiceImpl.java
View file @
b0288c32
...
@@ -58,15 +58,15 @@ public class OrderTakingServiceImpl {
...
@@ -58,15 +58,15 @@ public class OrderTakingServiceImpl {
public
OrderTakingVo
getOrderTakingInfo
(
Long
shopId
){
public
OrderTakingVo
getOrderTakingInfo
(
Long
shopId
){
OrderTakingVo
orderTakingVo
=
new
OrderTakingVo
();
OrderTakingVo
orderTakingVo
=
new
OrderTakingVo
();
Shop
shop
=
shopMapper
.
selectShopById
(
String
.
valueOf
(
shopId
)
);
Shop
shop
=
shopMapper
.
selectShopById
(
shopId
);
if
(
shop
==
null
)
{
if
(
shop
==
null
)
{
return
orderTakingVo
;
return
orderTakingVo
;
}
}
orderTakingVo
.
setShopState
(
shop
.
getState
());
orderTakingVo
.
setShopState
(
shop
.
getState
());
ImagesVo
imagesVo
=
new
ImagesVo
();
ImagesVo
imagesVo
=
new
ImagesVo
();
orderTakingVo
.
setImages
(
imagesVo
);
orderTakingVo
.
setImages
(
imagesVo
);
imagesVo
.
setLeft
(
sysConfigService
.
selectConfigByKey
(
"menu.left"
));
imagesVo
.
setLeft
(
JSONArray
.
parseArray
(
sysConfigService
.
selectConfigByKey
(
"menu.left"
)
));
imagesVo
.
setRight
(
JSONObject
.
parseObject
(
sysConfigService
.
selectConfigByKey
(
"menu.right"
)));
//
imagesVo.setRight(JSONObject.parseObject(sysConfigService.selectConfigByKey("menu.right")));
orderTakingVo
.
setCountOfOrder
(
sysConfigService
.
selectConfigByKey
(
"goods.limit"
));
orderTakingVo
.
setCountOfOrder
(
sysConfigService
.
selectConfigByKey
(
"goods.limit"
));
orderTakingVo
.
setTips
(
sysConfigService
.
selectConfigByKey
(
"tips.address"
));
orderTakingVo
.
setTips
(
sysConfigService
.
selectConfigByKey
(
"tips.address"
));
List
<
CategoryVo
>
categoryVos
=
new
ArrayList
<>();
List
<
CategoryVo
>
categoryVos
=
new
ArrayList
<>();
...
@@ -75,7 +75,7 @@ public class OrderTakingServiceImpl {
...
@@ -75,7 +75,7 @@ public class OrderTakingServiceImpl {
preferentialCategoryVo
.
setId
(
0L
);
preferentialCategoryVo
.
setId
(
0L
);
preferentialCategoryVo
.
setName
(
"今日特惠"
);
preferentialCategoryVo
.
setName
(
"今日特惠"
);
//查询出该店铺今日特惠的商品
//查询出该店铺今日特惠的商品
List
<
GoodsVo
>
goodsVos
=
shopRecommendMapper
.
selectShopGoodsByTyepe
(
"2"
,
shopId
);
List
<
GoodsVo
>
goodsVos
=
shopRecommendMapper
.
selectShopGoodsByTyepe
(
"2"
,
shopId
);
preferentialCategoryVo
.
setGoods
(
goodsVos
);
preferentialCategoryVo
.
setGoods
(
goodsVos
);
if
(!
CollectionUtils
.
isEmpty
(
goodsVos
)){
if
(!
CollectionUtils
.
isEmpty
(
goodsVos
)){
for
(
GoodsVo
goodsVo
:
goodsVos
)
{
for
(
GoodsVo
goodsVo
:
goodsVos
)
{
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
View file @
b0288c32
...
@@ -3,6 +3,7 @@ package com.soss.system.service.impl;
...
@@ -3,6 +3,7 @@ package com.soss.system.service.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.enums.ShopState
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.*
;
import
com.soss.system.domain.*
;
...
@@ -14,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -14,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.util.*
;
import
java.util.*
;
...
@@ -63,7 +65,7 @@ public class ShopServiceImpl implements IShopService
...
@@ -63,7 +65,7 @@ public class ShopServiceImpl implements IShopService
* @return 店铺
* @return 店铺
*/
*/
@Override
@Override
public
Shop
selectShopById
(
Stri
ng
id
)
public
Shop
selectShopById
(
Lo
ng
id
)
{
{
return
shopMapper
.
selectShopById
(
id
);
return
shopMapper
.
selectShopById
(
id
);
}
}
...
@@ -83,7 +85,7 @@ public class ShopServiceImpl implements IShopService
...
@@ -83,7 +85,7 @@ public class ShopServiceImpl implements IShopService
machine
.
setShopId
(
shop1
.
getId
());
machine
.
setShopId
(
shop1
.
getId
());
shop1
.
setMachineCount
(
machineMapper
.
selectMachineList
(
machine
).
size
());
shop1
.
setMachineCount
(
machineMapper
.
selectMachineList
(
machine
).
size
());
shop1
.
setSalesAmount
(
orderMapper
.
selectSalesAmount
(
shop1
.
getId
()));
shop1
.
setSalesAmount
(
orderMapper
.
selectSalesAmount
(
shop1
.
getId
()));
shop1
.
setSalesVolume
(
orderMapper
.
selectSalesVolume
(
shop1
.
getId
(),
null
));
shop1
.
setSalesVolume
(
orderMapper
.
selectSalesVolume
(
shop1
.
getId
(),
null
));
//shop1.setMachieStatus(machineMapper.selectMachineList(machine).get(0).getState());
//shop1.setMachieStatus(machineMapper.selectMachineList(machine).get(0).getState());
}
}
...
@@ -91,6 +93,42 @@ public class ShopServiceImpl implements IShopService
...
@@ -91,6 +93,42 @@ public class ShopServiceImpl implements IShopService
return
shops
;
return
shops
;
}
}
@Override
public
void
testStart
(
Long
shopId
)
{
Shop
shop
=
shopMapper
.
selectShopById
(
shopId
);
Assert
.
notNull
(
shop
,
"未查询到匹配的店铺信息[id="
+
shopId
+
"]"
);
if
(!
Objects
.
equals
(
shop
.
getState
(),
ShopState
.
CLOSE
.
getState
()))
{
throw
new
ServiceException
(
"需暂停营业状态才可以开始测试"
);
}
this
.
updateShop
(
new
Shop
(
shopId
,
ShopState
.
TESTING
.
getState
()));
}
@Override
public
void
testFinish
(
Long
shopId
)
{
List
<
Machine
>
machines
=
machineMapper
.
selectMachineByShopId
(
shopId
);
if
(
CollectionUtils
.
isEmpty
(
machines
))
{
throw
new
ServiceException
(
"需绑定机器后才可完成测试"
);
}
// 完成测试后的校验 todo 逻辑待定
long
unFinishTestMachineCount
=
machines
.
stream
().
filter
(
machine
->
!
machine
.
getState
().
equals
(
1
)).
count
();
if
(
unFinishTestMachineCount
>
0
)
{
throw
new
ServiceException
(
"需机器完成运营测试后才可完成测试"
);
}
Shop
shop
=
new
Shop
(
shopId
,
ShopState
.
CLOSE
.
getState
());
this
.
updateShop
(
shop
);
}
@Override
public
void
open
(
Long
shopId
)
{
Shop
shop
=
shopMapper
.
selectShopById
(
shopId
);
Assert
.
notNull
(
shop
,
"未查询到匹配的店铺信息[id="
+
shopId
+
"]"
);
// 判断店铺绑定机器是否输入组件属性对应经验值 todo
/*if () {
throw new ServiceException("店铺绑定机器还未输入组件属性对应经验值");
}*/
this
.
updateShop
(
new
Shop
(
shopId
,
ShopState
.
OPEN
.
getState
()));
}
/**
/**
* 新增店铺
* 新增店铺
*
*
...
@@ -98,11 +136,11 @@ public class ShopServiceImpl implements IShopService
...
@@ -98,11 +136,11 @@ public class ShopServiceImpl implements IShopService
* @return 结果
* @return 结果
*/
*/
@Override
@Override
public
long
insertShop
(
Shop
shop
)
public
long
insertShop
(
Shop
shop
)
{
{
shop
.
setCreatedAt
(
new
Date
());
shop
.
setCreatedAt
(
new
Date
());
shop
.
setUpdatedAt
(
new
Date
());
shop
.
setUpdatedAt
(
new
Date
());
shop
.
setIsDefault
(
0L
);
shop
.
setIsDefault
(
0L
);
shop
.
setState
(
ShopState
.
TESTING
.
getState
());
shopMapper
.
insertShop
(
shop
);
shopMapper
.
insertShop
(
shop
);
return
shop
.
getId
();
return
shop
.
getId
();
}
}
...
@@ -135,23 +173,10 @@ public class ShopServiceImpl implements IShopService
...
@@ -135,23 +173,10 @@ public class ShopServiceImpl implements IShopService
for
(
String
id
:
ids
)
{
for
(
String
id
:
ids
)
{
Shop
shop
=
new
Shop
();
Shop
shop
=
new
Shop
();
shop
.
setId
(
Long
.
parseLong
(
id
));
shop
.
setId
(
Long
.
parseLong
(
id
));
shop
.
setState
(
"3"
);
shop
.
setState
(
ShopState
.
DELETE
.
getState
()
);
shopMapper
.
updateShop
(
shop
);
shopMapper
.
updateShop
(
shop
);
}
}
return
1
;
return
1
;
}
/**
* 删除店铺信息
*
* @param id 店铺主键
* @return 结果
*/
@Override
public
int
deleteShopById
(
String
id
)
{
return
shopMapper
.
deleteShopById
(
id
);
}
}
@Override
@Override
...
...
soss-system/src/main/resources/mapper/system/CouponMapper.xml
View file @
b0288c32
...
@@ -84,4 +84,11 @@
...
@@ -84,4 +84,11 @@
left join coupon c on c.rule_id = cr.id
left join coupon c on c.rule_id = cr.id
where cr.use_start_time > now() and cr.use_end_time
<
now()
where cr.use_start_time > now() and cr.use_end_time
<
now()
</select>
</select>
<update
id=
"expireCoupon"
>
update coupon c
left join coupon_rule cr on c.rule_id = cr.id
set c.state = ${@com.soss.common.enums.CouponState @EXPIRED.getState}
where cr.use_end_time
<
now()
</update>
</mapper>
</mapper>
soss-system/src/main/resources/mapper/system/CouponUserMapper.xml
View file @
b0288c32
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<result
column=
"updated_at"
property=
"updatedAt"
/>
<result
column=
"updated_at"
property=
"updatedAt"
/>
</resultMap>
</resultMap>
<select
id=
"getCouponReceiveCount"
>
<select
id=
"getCouponReceiveCount"
resultType=
"Long"
>
select count(*)
select count(*)
from coupon_user
from coupon_user
where coupon_id = #{couponId}
where coupon_id = #{couponId}
...
@@ -31,13 +31,36 @@
...
@@ -31,13 +31,36 @@
<include
refid=
"selectCustAvailableCoupon"
/>
<include
refid=
"selectCustAvailableCoupon"
/>
</select>
</select>
<select
id=
"listCustCoupons"
resultType=
"com.soss.system.domain.vo.CouponVo"
>
<include
refid=
"selectCouponVo"
/>
from coupon_user cu
left join coupon c on cu.coupon_id = c.id
left join coupon_category cc on c.category_id = cc.id
left join coupon_rule cr on c.rule_id = cr.id
where cu.cust_id = #{custId}
<choose>
<when
test=
"effectiveFlag != null and effectiveFlag"
>
and cu.state = ${@com.soss.common.enums.CouponUserState @EFFECTIVE.getState}
</when>
<otherwise>
and cu.state in (${@com.soss.common.enums.CouponUserState @USED.getState},
${@com.soss.common.enums.CouponUserState @EXPIRED.getState})
</otherwise>
</choose>
</select>
<select
id=
"listCustAvailableCoupon"
resultType=
"com.soss.system.domain.vo.CouponVo"
>
<select
id=
"listCustAvailableCoupon"
resultType=
"com.soss.system.domain.vo.CouponVo"
>
<include
refid=
"selectCouponVo"
/>
<include
refid=
"selectCustAvailableCoupon"
/>
</select>
<sql
id=
"selectCouponVo"
>
select cu.id, cc.`type`, cc.name categoryName, cr.name ruleName, cr.`desc` ruleDesc, c.name, cr.use_start_time
select cu.id, cc.`type`, cc.name categoryName, cr.name ruleName, cr.`desc` ruleDesc, c.name, cr.use_start_time
useStartTime, cu.expired_time useEndTime, cc.`desc` categoryDesc, cr.category_ids categoryIdStr, cr.goods_ids
useStartTime, cu.expired_time useEndTime, cc.`desc` categoryDesc, cr.category_ids categoryIdStr, cr.goods_ids
goodsIdStr, cr.province provinceStr, cr.city cityStr, cr.area areaStr, cr.shop_ids shopIdStr,
goodsIdStr, cr.province provinceStr, cr.city cityStr, cr.area areaStr, cr.shop_ids shopIdStr,
cr.week_limit weekLimitStr
cr.week_limit weekLimitStr
, cr.price_discount priceDiscount, c.id couponId, cr.price_limit priceLimit,
<include
refid=
"selectCustAvailableCoupon"
/>
cr.order_limit orderLimit
</s
elect
>
</s
ql
>
<sql
id=
"selectCustAvailableCoupon"
>
<sql
id=
"selectCustAvailableCoupon"
>
from coupon_user cu
from coupon_user cu
...
@@ -132,4 +155,10 @@
...
@@ -132,4 +155,10 @@
</trim>
</trim>
where id = #{id}
where id = #{id}
</update>
</update>
<update
id=
"expireCouponUser"
>
update coupon_user
set state = ${@com.soss.common.enums.CouponUserState @EXPIRED.getState}
where expired_time
<
now()
</update>
</mapper>
</mapper>
soss-system/src/main/resources/mapper/system/GoodsMapper.xml
View file @
b0288c32
...
@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
</sql>
<select
id=
"selectGoodsByIds"
resultMap=
"GoodsResult"
>
<select
id=
"selectGoodsByIds"
resultMap=
"GoodsResult"
>
select id, name from goods where id in
select id, name
, category
from goods where id in
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
</select>
</select>
...
@@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by created_at desc
order by created_at desc
</select>
</select>
<select
id=
"selectGoodsById"
parameterType=
"
Stri
ng"
resultMap=
"GoodsResult"
>
<select
id=
"selectGoodsById"
parameterType=
"
Lo
ng"
resultMap=
"GoodsResult"
>
select
select
g.id,
g.id,
g.name,
g.name,
...
...
soss-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
View file @
b0288c32
...
@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</where>
</select>
</select>
<select
id=
"selectGoodsSkuById"
parameterType=
"
Stri
ng"
resultMap=
"GoodsSkuResult"
>
<select
id=
"selectGoodsSkuById"
parameterType=
"
Lo
ng"
resultMap=
"GoodsSkuResult"
>
<include
refid=
"selectGoodsSkuVo"
/>
<include
refid=
"selectGoodsSkuVo"
/>
where id = #{id}
where id = #{id}
</select>
</select>
...
...
soss-system/src/main/resources/mapper/system/MachineMapper.xml
View file @
b0288c32
...
@@ -24,12 +24,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -24,12 +24,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include
refid=
"selectMachineVo"
/>
<include
refid=
"selectMachineVo"
/>
<where>
<where>
<if
test=
"shopId != null and shopId != ''"
>
and shop_id = #{shopId}
</if>
<if
test=
"shopId != null and shopId != ''"
>
and shop_id = #{shopId}
</if>
<if
test=
"code != null and code != ''"
>
and code = #{code}
</if>
<if
test=
"code != null and code != ''"
>
and code = #{code}
</if>
<if
test=
"type != null and type != ''"
>
and type = #{type}
</if>
<if
test=
"type != null and type != ''"
>
and type = #{type}
</if>
<if
test=
"state != null and state != ''"
>
and state = #{state}
</if>
<if
test=
"state != null and state != ''"
>
and state = #{state}
</if>
<if
test=
"bindTime != null "
>
and bind_time = #{bindTime}
</if>
<if
test=
"bindTime != null "
>
and bind_time = #{bindTime}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
</where>
</where>
</select>
</select>
...
@@ -37,6 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -37,6 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include
refid=
"selectMachineVo"
/>
<include
refid=
"selectMachineVo"
/>
where id = #{id}
where id = #{id}
</select>
</select>
<select
id=
"selectMachineByShopId"
parameterType=
"Long"
resultMap=
"MachineResult"
>
<include
refid=
"selectMachineVo"
/>
where shop_id = #{shopId}
</select>
<select
id=
"selectMachineByCode"
parameterType=
"String"
resultMap=
"MachineResult"
>
<select
id=
"selectMachineByCode"
parameterType=
"String"
resultMap=
"MachineResult"
>
<include
refid=
"selectMachineVo"
/>
<include
refid=
"selectMachineVo"
/>
where code = #{code}
where code = #{code}
...
...
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
View file @
b0288c32
...
@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
</resultMap>
<sql
id=
"selectOrderDetailVo"
>
<sql
id=
"selectOrderDetailVo"
>
select id, order_id, goods_id, goods_name, machine_id, num, amount, real_amount, spec_rule_detail, spec_rule_ids, sku_id, goods_category, created_at, updated_at from order_detail
select id, order_id, goods_id, goods_name, machine_id, num,
view_amount, amount_should, coupon_
amount, real_amount, spec_rule_detail, spec_rule_ids, sku_id, goods_category, created_at, updated_at from order_detail
</sql>
</sql>
<select
id=
"selectOrderDetailList"
parameterType=
"OrderDetail"
resultMap=
"OrderDetailResult"
>
<select
id=
"selectOrderDetailList"
parameterType=
"OrderDetail"
resultMap=
"OrderDetailResult"
>
...
...
soss-system/src/main/resources/mapper/system/OrderMapper.xml
View file @
b0288c32
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
</resultMap>
</resultMap>
<sql
id=
"selectOrderVo"
>
<sql
id=
"selectOrderVo"
>
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`
select id, order_no, order_num, user_id, user_name, user_phone, pay_time, finish_time, amount,
coupon_id, coupon_amount, paid_amount,
goods_num, pick_code, shop_id, machine_id, source, state, created_at, updated_at from `order`
</sql>
</sql>
<select
id=
"selectOrderList"
parameterType=
"Order"
resultMap=
"OrderResult"
>
<select
id=
"selectOrderList"
parameterType=
"Order"
resultMap=
"OrderResult"
>
...
...
soss-system/src/main/resources/mapper/system/ShopMapper.xml
View file @
b0288c32
...
@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"province != null and province != ''"
>
and s.province = #{province}
</if>
<if
test=
"province != null and province != ''"
>
and s.province = #{province}
</if>
<if
test=
"city != null and city != ''"
>
and s.city = #{city}
</if>
<if
test=
"city != null and city != ''"
>
and s.city = #{city}
</if>
<if
test=
"zone != null and zone != ''"
>
and s.zone = #{zone}
</if>
<if
test=
"zone != null and zone != ''"
>
and s.zone = #{zone}
</if>
<if
test=
"state != null
and state != ''
"
>
and s.state = #{state}
</if>
<if
test=
"state != null"
>
and s.state = #{state}
</if>
<if
test=
"createdAt != null "
>
and s.created_at = #{createdAt}
</if>
<if
test=
"createdAt != null "
>
and s.created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and s.updated_at = #{updatedAt}
</if>
<if
test=
"updatedAt != null "
>
and s.updated_at = #{updatedAt}
</if>
<if
test=
"isDefault != null "
>
and s.is_default = #{isDefault}
</if>
<if
test=
"isDefault != null "
>
and s.is_default = #{isDefault}
</if>
...
@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -53,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</where>
</select>
</select>
<select
id=
"selectShopById"
parameterType=
"
Stri
ng"
resultMap=
"ShopResult"
>
<select
id=
"selectShopById"
parameterType=
"
Lo
ng"
resultMap=
"ShopResult"
>
<include
refid=
"selectShopVo"
/>
<include
refid=
"selectShopVo"
/>
where id = #{id}
where id = #{id}
</select>
</select>
...
@@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"province != null and province != ''"
>
province,
</if>
<if
test=
"province != null and province != ''"
>
province,
</if>
<if
test=
"city != null and city != ''"
>
city,
</if>
<if
test=
"city != null and city != ''"
>
city,
</if>
<if
test=
"zone != null"
>
zone,
</if>
<if
test=
"zone != null"
>
zone,
</if>
<if
test=
"state != null
and state != ''
"
>
state,
</if>
<if
test=
"state != null"
>
state,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"updatedAt != null"
>
updated_at,
</if>
<if
test=
"isDefault != null"
>
is_default,
</if>
<if
test=
"isDefault != null"
>
is_default,
</if>
...
@@ -94,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -94,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"province != null and province != ''"
>
#{province},
</if>
<if
test=
"province != null and province != ''"
>
#{province},
</if>
<if
test=
"city != null and city != ''"
>
#{city},
</if>
<if
test=
"city != null and city != ''"
>
#{city},
</if>
<if
test=
"zone != null"
>
#{zone},
</if>
<if
test=
"zone != null"
>
#{zone},
</if>
<if
test=
"state != null
and state != ''
"
>
#{state},
</if>
<if
test=
"state != null"
>
#{state},
</if>
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"createdAt != null"
>
#{createdAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"updatedAt != null"
>
#{updatedAt},
</if>
<if
test=
"isDefault != null"
>
#{isDefault},
</if>
<if
test=
"isDefault != null"
>
#{isDefault},
</if>
...
@@ -115,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -115,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"province != null and province != ''"
>
province = #{province},
</if>
<if
test=
"province != null and province != ''"
>
province = #{province},
</if>
<if
test=
"city != null and city != ''"
>
city = #{city},
</if>
<if
test=
"city != null and city != ''"
>
city = #{city},
</if>
<if
test=
"zone != null"
>
zone = #{zone},
</if>
<if
test=
"zone != null"
>
zone = #{zone},
</if>
<if
test=
"state != null
and state != ''
"
>
state = #{state},
</if>
<if
test=
"state != null"
>
state = #{state},
</if>
<if
test=
"updatedAt != null"
>
updated_at = #{updatedAt},
</if>
<if
test=
"updatedAt != null"
>
updated_at = #{updatedAt},
</if>
<if
test=
"isDefault != null"
>
is_default = #{isDefault},
</if>
<if
test=
"isDefault != null"
>
is_default = #{isDefault},
</if>
</trim>
</trim>
...
...
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