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
968b4136
Commit
968b4136
authored
Aug 01, 2022
by
caiyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加小程序下单的优惠券功能
parent
6abd00e5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
550 additions
and
635 deletions
+550
-635
soss-admin/src/main/java/com/soss/web/controller/coffee/AppController.java
+24
-11
soss-admin/src/main/java/com/soss/web/controller/coffee/CustomerController.java
+9
-11
soss-admin/src/main/java/com/soss/web/controller/coffee/GoodsController.java
+21
-15
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
+33
-0
soss-admin/src/main/java/com/soss/web/controller/coupon/CouponController.java
+8
-7
soss-common/src/main/java/com/soss/common/enums/CouponUserState.java
+3
-4
soss-framework/src/main/java/com/soss/framework/web/service/MachineSericeImpl.java
+2
-2
soss-system/src/main/java/com/soss/system/constants/SystemConstant.java
+8
-0
soss-system/src/main/java/com/soss/system/domain/GoodsSku.java
+7
-76
soss-system/src/main/java/com/soss/system/domain/Order.java
+75
-194
soss-system/src/main/java/com/soss/system/domain/OrderDetail.java
+65
-160
soss-system/src/main/java/com/soss/system/domain/po/CouponPo.java
+5
-11
soss-system/src/main/java/com/soss/system/domain/po/OrderCouponPo.java
+17
-0
soss-system/src/main/java/com/soss/system/domain/vo/CouponVo.java
+18
-12
soss-system/src/main/java/com/soss/system/mapper/CouponUserMapper.java
+1
-1
soss-system/src/main/java/com/soss/system/mapper/GoodsMapper.java
+1
-1
soss-system/src/main/java/com/soss/system/mapper/GoodsSkuMapper.java
+12
-3
soss-system/src/main/java/com/soss/system/mapper/OrderMapper.java
+19
-10
soss-system/src/main/java/com/soss/system/service/ICouponUserService.java
+4
-1
soss-system/src/main/java/com/soss/system/service/ICustomerService.java
+4
-0
soss-system/src/main/java/com/soss/system/service/IGoodsService.java
+4
-1
soss-system/src/main/java/com/soss/system/service/IOrderService.java
+2
-0
soss-system/src/main/java/com/soss/system/service/impl/CouponRuleServiceImpl.java
+42
-29
soss-system/src/main/java/com/soss/system/service/impl/CouponServiceImpl.java
+10
-0
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
+0
-0
soss-system/src/main/java/com/soss/system/service/impl/CustomerServiceImpl.java
+12
-7
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
+17
-22
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
+3
-3
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+5
-18
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
+3
-3
soss-system/src/main/java/com/soss/system/utils/AreaUtil.java
+19
-14
soss-system/src/main/java/com/soss/system/utils/ArrayUtil.java
+40
-1
soss-system/src/main/resources/mapper/system/CouponUserMapper.xml
+6
-2
soss-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
+14
-9
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
+15
-5
soss-system/src/main/resources/mapper/system/OrderMapper.xml
+22
-2
No files found.
soss-admin/src/main/java/com/soss/web/controller/coffee/AppController.java
View file @
968b4136
...
...
@@ -7,6 +7,7 @@ import com.soss.common.core.domain.AjaxResult;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.common.core.page.TableDataInfo
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.common.utils.StringUtils
;
import
com.soss.framework.web.service.TokenService
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.OrderDetail
;
...
...
@@ -16,7 +17,6 @@ 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.WechatMessageServiceImpl
;
import
com.soss.system.utils.CollectionUtil
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -26,8 +26,10 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@RestController
@RequestMapping
(
"/app"
)
...
...
@@ -78,7 +80,7 @@ public class AppController extends BaseController {
order
.
setOrderDetails
(
orderDetails
);
for
(
int
i
=
0
;
i
<
goods
.
size
();
i
++){
OrderDetail
orderDetail
=
new
OrderDetail
();
orderDetail
.
setGoodsId
(
goods
.
getJSONObject
(
i
).
get
Stri
ng
(
"goodsId"
));
orderDetail
.
setGoodsId
(
goods
.
getJSONObject
(
i
).
get
Lo
ng
(
"goodsId"
));
orderDetail
.
setNum
(
goods
.
getJSONObject
(
i
).
getString
(
"num"
));
orderDetails
.
add
(
orderDetail
);
...
...
@@ -127,16 +129,27 @@ public class AppController extends BaseController {
if
(
loginUser
==
null
)
{
throw
new
ServiceException
(
"请先登录"
);
}
List
<
CouponVo
>
couponVoList
=
couponUserService
.
listCustAvailableCoupon
(
loginUser
.
getOpenId
());
couponVoList
.
forEach
(
couponVo
->
{
couponVo
.
setCategoryIds
(
CollectionUtil
.
transStrToCodeList
(
couponVo
.
getCategoryIdStr
()));
couponVo
.
setGoodsIds
(
CollectionUtil
.
transStrToLongList
(
couponVo
.
getGoodsIdStr
()));
couponVo
.
setProvince
(
CollectionUtil
.
transStrToCodeList
(
couponVo
.
getProvinceStr
()));
couponVo
.
setCity
(
CollectionUtil
.
transStrToCodeList
(
couponVo
.
getCityStr
()));
couponVo
.
setArea
(
CollectionUtil
.
transStrToCodeList
(
couponVo
.
getAreaStr
()));
couponVo
.
setShopIds
(
CollectionUtil
.
transStrToLongList
(
couponVo
.
getShopIdStr
()));
});
List
<
CouponVo
>
couponVoList
=
couponUserService
.
listCustAvailableCoupon
(
loginUser
.
getOpenId
(),
null
);
couponRuleService
.
translateUseLimit
(
couponVoList
);
return
getDataTable
(
couponVoList
);
}
@GetMapping
(
"/order/coupon/info"
)
@ApiOperation
(
"下单页面查询用户可用优惠券信息"
)
public
AjaxResult
listUserAvailableCoupon
(
HttpServletRequest
request
,
@RequestBody
Order
order
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
if
(
loginUser
==
null
)
{
throw
new
ServiceException
(
"请先登录"
);
}
List
<
CouponVo
>
couponVos
=
couponUserService
.
listCustAvailableCoupon
(
loginUser
.
getOpenId
(),
null
);
couponUserService
.
resovleCouponFitable
(
couponVos
,
order
);
couponRuleService
.
translateUseLimit
(
couponVos
);
List
<
CouponVo
>
fitableList
=
couponVos
.
stream
().
filter
(
couponVo
->
StringUtils
.
isEmpty
(
couponVo
.
getNotFitableDesc
()))
.
sorted
(
Comparator
.
comparing
(
CouponVo:
:
getCouponAmount
).
reversed
()).
collect
(
Collectors
.
toList
());
List
<
CouponVo
>
notFitableList
=
couponVos
.
stream
().
filter
(
couponVo
->
!
StringUtils
.
isEmpty
(
couponVo
.
getNotFitableDesc
())).
collect
(
Collectors
.
toList
());
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"fitable"
,
fitableList
);
result
.
put
(
"notfitable"
,
notFitableList
);
return
AjaxResult
.
success
(
result
);
}
}
soss-admin/src/main/java/com/soss/web/controller/coffee/CustomerController.java
View file @
968b4136
package
com
.
soss
.
web
.
controller
.
coffee
;
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.page.TableDataInfo
;
import
com.soss.common.enums.BusinessType
;
import
com.soss.common.utils.poi.ExcelUtil
;
import
com.soss.common.utils.spring.SpringUtils
;
import
com.soss.framework.web.service.TokenService
;
import
com.soss.system.domain.Customer
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
import
com.soss.system.domain.vo.customer.CustomerResultVo
;
import
com.soss.system.service.ICustomerService
;
import
com.soss.system.service.impl.CustomerServiceImpl
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
/**
...
...
@@ -60,19 +56,21 @@ public class CustomerController extends BaseController
}
/**
* 获取用户信息详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:customer:query')"
)
@GetMapping
public
TableDataInfo
getInfo
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
String
status
)
{
public
TableDataInfo
getInfo
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
String
status
)
{
startPage
();
List
<
Order
>
orders
=
customerService
.
selectCustomerById
(
id
,
status
);
List
<
Order
>
orders
=
customerService
.
selectCustomerById
(
id
,
status
);
return
getDataTable
(
orders
);
}
@PreAuthorize
(
"@ss.hasPermi('system:customer:order-simple-stat')"
)
@GetMapping
(
"/order-simple-stat/{custId}"
)
@ApiOperation
(
"查询用户的下单基本信息:下单总量和下单总额"
)
public
AjaxResult
getCustOrderSimpleStat
(
@PathVariable
String
custId
)
{
return
AjaxResult
.
success
(
customerService
.
getCustSimpleOrderStat
(
custId
));
}
}
soss-admin/src/main/java/com/soss/web/controller/coffee/GoodsController.java
View file @
968b4136
package
com
.
soss
.
web
.
controller
.
coffee
;
import
java.util.List
;
import
com.soss.common.exception.ServiceException
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
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.page.TableDataInfo
;
import
com.soss.common.enums.BusinessType
;
import
com.soss.common.exception.ServiceException
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.service.IGoodsService
;
import
com.soss.common.core.page.TableDataInfo
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 商品Controller
...
...
@@ -66,15 +67,12 @@ public class GoodsController extends BaseController
return
AjaxResult
.
success
(
goodsService
.
offShop
(
goodsId
,
boo
));
}
/**
* 获取商品详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:goods:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Stri
ng
id
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Lo
ng
id
)
{
return
AjaxResult
.
success
(
goodsService
.
selectGoodsById
(
id
));
}
...
...
@@ -106,10 +104,18 @@ public class GoodsController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('system:goods:remove')"
)
@Log
(
title
=
"商品"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/remove"
)
public
AjaxResult
remove
(
@RequestParam
(
"goodsId"
)
Long
goodsId
,
@RequestParam
(
required
=
false
)
boolean
boo
)
{
return
AjaxResult
.
success
(
goodsService
.
deleteGoodsById
(
goodsId
,
boo
));
@DeleteMapping
(
"/remove"
)
public
AjaxResult
remove
(
@RequestParam
(
"goodsId"
)
Long
goodsId
,
@RequestParam
(
required
=
false
)
boolean
boo
)
{
return
AjaxResult
.
success
(
goodsService
.
deleteGoodsById
(
goodsId
,
boo
));
}
/**
* 根据商品id获取sku列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:goods:sku:list')"
)
@GetMapping
(
"/sku/list/{goodsId}"
)
@ApiOperation
(
"根据商品id获取sku列表"
)
public
AjaxResult
getGoodsSkuList
(
@PathVariable
(
"goodsId"
)
Long
goodsId
)
{
return
AjaxResult
.
success
(
goodsService
.
getGoodsSkus
(
goodsId
));
}
}
soss-admin/src/main/java/com/soss/web/controller/coffee/OrderController.java
View file @
968b4136
...
...
@@ -11,10 +11,14 @@ import com.soss.common.exception.ServiceException;
import
com.soss.framework.web.service.TokenService
;
import
com.soss.framework.web.service.WeixinServiceImpl
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.CouponVo
;
import
com.soss.system.domain.vo.OrderQuery
;
import
com.soss.system.service.ICouponUserService
;
import
com.soss.system.service.impl.OrderServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -36,6 +40,8 @@ public class OrderController extends BaseController {
private
TokenService
tokenService
;
@Autowired
private
WeixinServiceImpl
weixinService
;
@Autowired
private
ICouponUserService
couponUserService
;
/**
* 查询订单列表
...
...
@@ -71,6 +77,33 @@ public class OrderController extends BaseController {
public
AjaxResult
add
(
HttpServletRequest
request
,
@RequestBody
Order
order
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
(
request
);
AjaxResult
result
=
check
(
order
);
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
result
.
get
(
result
.
CODE_TAG
))
{
return
result
;
}
try
{
orderService
.
checkBusinessTime
(
order
.
getShopId
());
if
(
order
.
getCouponId
()
!=
null
)
{
List
<
CouponVo
>
couponVos
=
couponUserService
.
listCustAvailableCoupon
(
loginUser
.
getOpenId
(),
order
.
getCouponId
());
if
(
CollectionUtils
.
isEmpty
(
couponVos
))
{
return
AjaxResult
.
error
(
"未查询到匹配的优惠券信息"
);
}
couponUserService
.
resovleCouponFitable
(
couponVos
,
order
);
CouponVo
couponVo
=
couponVos
.
get
(
0
);
String
notFitableDesc
=
couponVo
.
getNotFitableDesc
();
if
(!
StringUtils
.
isEmpty
(
notFitableDesc
))
{
return
AjaxResult
.
error
(
notFitableDesc
);
}
order
.
setCouponAmount
(
couponVo
.
getCouponAmount
().
negate
());
order
.
setPaidAmount
(
order
.
getAmount
().
add
(
order
.
getCouponAmount
()));
order
.
getOrderDetails
().
forEach
(
orderDetail
->
{
orderDetail
.
setCouponAmount
(
couponVo
.
getCouponAmountMap
().
get
(
orderDetail
.
getSkuId
()).
negate
());
orderDetail
.
setRealAmount
(
orderDetail
.
getViewAmount
().
add
(
orderDetail
.
getCouponAmount
()));
});
}
}
catch
(
ServiceException
e
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
}
AjaxResult
ajaxResult
=
orderService
.
insertOrder
(
loginUser
,
order
);
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
ajaxResult
.
get
(
AjaxResult
.
CODE_TAG
))
{
...
...
soss-admin/src/main/java/com/soss/web/controller/coupon/CouponController.java
View file @
968b4136
...
...
@@ -16,7 +16,7 @@ import com.soss.system.domain.po.CouponPo;
import
com.soss.system.domain.vo.CouponVo
;
import
com.soss.system.service.ICouponRuleService
;
import
com.soss.system.service.ICouponService
;
import
com.soss.system.utils.
Collection
Util
;
import
com.soss.system.utils.
Array
Util
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -85,12 +85,13 @@ public class CouponController extends BaseController {
private
void
transLimitToArrStyle
(
CouponVo
couponVo
,
CouponRule
couponRule
)
{
BeanUtils
.
copyProperties
(
couponRule
,
couponVo
,
"name"
,
"state"
,
"categoryIds"
,
"goodsIds"
,
"province"
,
"city"
,
"area"
,
"shopIds"
);
couponVo
.
setCategoryIds
(
CollectionUtil
.
transStrToCodeList
(
couponRule
.
getCategoryIds
()));
couponVo
.
setGoodsIds
(
CollectionUtil
.
transStrToLongList
(
couponRule
.
getGoodsIds
()));
couponVo
.
setProvince
(
CollectionUtil
.
transStrToCodeList
(
couponRule
.
getProvince
()));
couponVo
.
setCity
(
CollectionUtil
.
transStrToCodeList
(
couponRule
.
getCity
()));
couponVo
.
setArea
(
CollectionUtil
.
transStrToCodeList
(
couponRule
.
getArea
()));
couponVo
.
setShopIds
(
CollectionUtil
.
transStrToLongList
(
couponRule
.
getShopIds
()));
couponVo
.
setCategoryIds
(
ArrayUtil
.
transStrToCodeList
(
couponRule
.
getCategoryIds
()));
couponVo
.
setGoodsIds
(
ArrayUtil
.
transStrToLongList
(
couponRule
.
getGoodsIds
()));
couponVo
.
setProvince
(
ArrayUtil
.
transStrToCodeList
(
couponRule
.
getProvince
()));
couponVo
.
setCity
(
ArrayUtil
.
transStrToCodeList
(
couponRule
.
getCity
()));
couponVo
.
setArea
(
ArrayUtil
.
transStrToCodeList
(
couponRule
.
getArea
()));
couponVo
.
setShopIds
(
ArrayUtil
.
transStrToLongList
(
couponRule
.
getShopIds
()));
couponVo
.
setWeekLimit
(
ArrayUtil
.
transStrToIntList
(
couponRule
.
getWeekLimit
()));
}
/**
...
...
soss-common/src/main/java/com/soss/common/enums/CouponUserState.java
View file @
968b4136
package
com
.
soss
.
common
.
enums
;
public
enum
CouponUserState
{
DEFAULT
(
0
,
"默认"
),
USED
(
1
,
"已使用"
),
EXPIRED
(
2
,
"已过期"
),
FORBIDDEN
(
3
,
"已禁用"
);
EFFECTIVE
(
0
,
"有效"
),
USED
(
1
,
"被使用"
),
EXPIRED
(
2
,
"过期失效"
);
private
Integer
state
;
private
String
desc
;
...
...
soss-framework/src/main/java/com/soss/framework/web/service/MachineSericeImpl.java
View file @
968b4136
...
...
@@ -34,9 +34,9 @@ public class MachineSericeImpl {
for
(
OrderDetail
detail
:
orderDetails
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObjects
.
add
(
jsonObject
);
Stri
ng
skuId
=
detail
.
getSkuId
();
Lo
ng
skuId
=
detail
.
getSkuId
();
String
num
=
detail
.
getNum
();
String
amount
=
detail
.
getAmount
().
stripTrailingZeros
().
toString
();
String
amount
=
detail
.
get
View
Amount
().
stripTrailingZeros
().
toString
();
String
realAmount
=
detail
.
getRealAmount
().
stripTrailingZeros
().
toString
();
jsonObject
.
put
(
"skuID"
,
skuId
);
jsonObject
.
put
(
"skuCount"
,
num
);
...
...
soss-system/src/main/java/com/soss/system/constants/SystemConstant.java
0 → 100644
View file @
968b4136
package
com
.
soss
.
system
.
constants
;
public
class
SystemConstant
{
/**
* 周几
*/
public
final
static
String
[]
WEEK_DESC
=
new
String
[]{
"周日"
,
"周一"
,
"周二"
,
"周三"
,
"周四"
,
"周五"
,
"周六"
};
}
soss-system/src/main/java/com/soss/system/domain/GoodsSku.java
View file @
968b4136
package
com
.
soss
.
system
.
domain
;
import
java.math.BigDecimal
;
import
java.util.Date
;
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.core.domain.BaseEntity
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 由规格选项组合生成商品sku对象 goods_sku
...
...
@@ -14,6 +16,7 @@ import com.soss.common.core.domain.BaseEntity;
* @author zxq
* @date 2022-04-28
*/
@Data
public
class
GoodsSku
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -47,80 +50,8 @@ public class GoodsSku extends BaseEntity
@Excel
(
name
=
"价格"
)
private
BigDecimal
price
;
public
BigDecimal
getDiscount
()
{
return
discount
;
}
public
void
setDiscount
(
BigDecimal
discount
)
{
this
.
discount
=
discount
;
}
private
BigDecimal
discount
;
public
void
setId
(
long
id
)
{
this
.
id
=
id
;
}
public
long
getId
()
{
return
id
;
}
public
void
setGoodsId
(
long
goodsId
)
{
this
.
goodsId
=
goodsId
;
}
public
long
getGoodsId
()
{
return
goodsId
;
}
public
void
setRuleList
(
String
ruleList
)
{
this
.
ruleList
=
ruleList
;
}
public
String
getRuleList
()
{
return
ruleList
;
}
public
void
setIsDeleted
(
String
isDeleted
)
{
this
.
isDeleted
=
isDeleted
;
}
public
String
getIsDeleted
()
{
return
isDeleted
;
}
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
setPrice
(
BigDecimal
price
)
{
this
.
price
=
price
;
}
public
BigDecimal
getPrice
()
{
return
price
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
soss-system/src/main/java/com/soss/system/domain/Order.java
View file @
968b4136
package
com
.
soss
.
system
.
domain
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.soss.common.annotation.Excel
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
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
;
/**
* 订单对象 order
*
*
* @author zxq
* @date 2022-04-28
*/
public
class
Order
implements
Serializable
{
@Data
public
class
Order
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
/**
* 主键
*/
private
Long
id
;
/** 订单号 */
/**
* 订单号
*/
@Excel
(
name
=
"订单号"
)
private
String
orderNo
;
/** 订单顺序号 */
/**
* 订单顺序号
*/
@Excel
(
name
=
"订单顺序号"
)
private
String
orderNum
;
/** 用户ID */
/**
* 用户ID
*/
@Excel
(
name
=
"用户ID"
)
private
String
userId
;
/** 冗余 */
/**
* 冗余
*/
@Excel
(
name
=
"冗余"
)
private
String
userName
;
/** 冗余 */
/**
* 冗余
*/
@Excel
(
name
=
"冗余"
)
private
String
userPhone
;
/** 支付时间 */
/**
* 支付时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"支付时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
payTime
;
/** 完成时间 */
/**
* 完成时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"完成时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
finishTime
;
/** 订单金额 */
/**
* 订单金额
*/
@Excel
(
name
=
"订单金额"
)
private
BigDecimal
amount
;
/** 商品数量 */
/**
* 优惠券id
*/
private
Integer
couponId
;
/**
* 优惠金额
*/
@Excel
(
name
=
"优惠金额"
)
private
BigDecimal
couponAmount
;
/**
* 实付金额
*/
@Excel
(
name
=
"实付金额"
)
private
BigDecimal
paidAmount
;
/**
* 商品数量
*/
@Excel
(
name
=
"商品数量"
)
private
String
goodsNum
;
/** 取餐码 */
/**
* 取餐码
*/
@Excel
(
name
=
"取餐码"
)
private
String
pickCode
;
/** 店铺ID */
/**
* 店铺ID
*/
@Excel
(
name
=
"店铺ID"
)
private
String
shopId
;
/** 机器ID */
/**
* 机器ID
*/
@Excel
(
name
=
"机器ID"
)
private
String
machineId
;
/** 点单屏序号 */
/**
* 点单屏序号
*/
@Excel
(
name
=
"点单屏序号"
)
private
Integer
source
;
@Excel
(
name
=
"订单状态 0 未支付取消 1 未支付 2 已支付 3 待制作 4 支付制作中 5 制作完成未取 6 取餐中 7 取餐完成 8 支付后制作前取消 9 制作中取消 10 制作完成取消 11 已退款 12 部分退款 50 其他人工干预状态"
)
private
String
state
;
/** 创建时间 */
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"创建时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
createdAt
;
/** 更新时间 */
/**
* 更新时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
private
Shop
shop
;
public
Shop
getShop
()
{
return
shop
;
}
public
void
setShop
(
Shop
shop
)
{
this
.
shop
=
shop
;
}
private
List
<
OrderDetail
>
orderDetails
;
public
List
<
OrderDetail
>
getOrderDetails
()
{
return
orderDetails
;
}
public
void
setOrderDetails
(
List
<
OrderDetail
>
orderDetails
)
{
this
.
orderDetails
=
orderDetails
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
void
setOrderNo
(
String
orderNo
)
{
this
.
orderNo
=
orderNo
;
}
public
String
getOrderNo
()
{
return
orderNo
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
}
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserPhone
(
String
userPhone
)
{
this
.
userPhone
=
userPhone
;
}
public
String
getUserPhone
()
{
return
userPhone
;
}
public
void
setPayTime
(
Date
payTime
)
{
this
.
payTime
=
payTime
;
}
public
Date
getPayTime
()
{
return
payTime
;
}
public
void
setFinishTime
(
Date
finishTime
)
{
this
.
finishTime
=
finishTime
;
}
public
Date
getFinishTime
()
{
return
finishTime
;
}
public
void
setAmount
(
BigDecimal
amount
)
{
this
.
amount
=
amount
;
}
public
BigDecimal
getAmount
()
{
return
amount
;
}
public
void
setGoodsNum
(
String
goodsNum
)
{
this
.
goodsNum
=
goodsNum
;
}
public
String
getGoodsNum
()
{
return
goodsNum
;
}
public
void
setPickCode
(
String
pickCode
)
{
this
.
pickCode
=
pickCode
;
}
public
String
getPickCode
()
{
return
pickCode
;
}
public
void
setShopId
(
String
shopId
)
{
this
.
shopId
=
shopId
;
}
public
String
getShopId
()
{
return
shopId
;
}
public
void
setMachineId
(
String
machineId
)
{
this
.
machineId
=
machineId
;
}
public
String
getMachineId
()
{
return
machineId
;
}
public
void
setSource
(
Integer
source
)
{
this
.
source
=
source
;
}
public
Integer
getSource
()
{
return
source
;
}
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
;
}
private
List
<
OrderDetail
>
orderDetails
;
@Override
public
String
toString
()
{
...
...
soss-system/src/main/java/com/soss/system/domain/OrderDetail.java
View file @
968b4136
package
com
.
soss
.
system
.
domain
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.soss.common.annotation.Excel
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
com.soss.common.annotation.Excel
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 订单详情对象 order_detail
*
*
* @author zxq
* @date 2022-04-28
*/
public
class
OrderDetail
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@Data
public
class
OrderDetail
implements
Serializable
{
/** 主键 */
/**
* 主键
*/
private
String
id
;
/** 订单ID */
/**
* 订单ID
*/
@Excel
(
name
=
"订单ID"
)
private
long
orderId
;
/** 商品ID */
/**
* 商品ID
*/
@Excel
(
name
=
"商品ID"
)
private
Stri
ng
goodsId
;
private
Lo
ng
goodsId
;
/** 商品名称 */
/**
* 商品名称
*/
@Excel
(
name
=
"商品名称"
)
private
String
goodsName
;
/** 机器ID */
/**
* 机器ID
*/
@Excel
(
name
=
"机器ID"
)
private
String
machineId
;
/** 数量 */
/**
* 数量
*/
@Excel
(
name
=
"数量"
)
private
String
num
;
/** 应付金额 */
/**
* 展示金额
*/
private
BigDecimal
viewAmount
;
/**
* 应付金额
*/
@Excel
(
name
=
"应付金额"
)
private
BigDecimal
amount
;
private
BigDecimal
amount
Should
;
/** 实付金额 */
/**
* 优惠券优惠金额
*/
@Excel
(
name
=
"优惠券优惠金额"
)
private
BigDecimal
couponAmount
;
/**
* 实付金额
*/
@Excel
(
name
=
"实付金额"
)
private
BigDecimal
realAmount
;
/** 规格选项详情 */
/**
* 规格选项详情
*/
@Excel
(
name
=
"规格选项详情"
)
private
String
specRuleDetail
;
/** 规格选项id集合 */
/**
* 规格选项id集合
*/
@Excel
(
name
=
"规格选项id集合"
)
private
String
specRuleIds
;
/** sku ID */
/**
* sku ID
*/
@Excel
(
name
=
"sku ID"
)
private
Stri
ng
skuId
;
private
Lo
ng
skuId
;
/** 商品分类 */
/**
* 商品分类
*/
@Excel
(
name
=
"商品分类"
)
private
String
goodsCategory
;
public
Goods
getGoods
()
{
return
goods
;
}
public
void
setGoods
(
Goods
goods
)
{
this
.
goods
=
goods
;
}
private
Goods
goods
;
/** 创建时间 */
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd "
)
@Excel
(
name
=
"创建时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
createdAt
;
...
...
@@ -85,133 +115,6 @@ public class OrderDetail implements Serializable
@Excel
(
name
=
"更新时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
updatedAt
;
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getId
()
{
return
id
;
}
public
void
setOrderId
(
long
orderId
)
{
this
.
orderId
=
orderId
;
}
public
long
getOrderId
()
{
return
orderId
;
}
public
void
setGoodsId
(
String
goodsId
)
{
this
.
goodsId
=
goodsId
;
}
public
String
getGoodsId
()
{
return
goodsId
;
}
public
void
setGoodsName
(
String
goodsName
)
{
this
.
goodsName
=
goodsName
;
}
public
String
getGoodsName
()
{
return
goodsName
;
}
public
void
setMachineId
(
String
machineId
)
{
this
.
machineId
=
machineId
;
}
public
String
getMachineId
()
{
return
machineId
;
}
public
void
setNum
(
String
num
)
{
this
.
num
=
num
;
}
public
String
getNum
()
{
return
num
;
}
public
void
setAmount
(
BigDecimal
amount
)
{
this
.
amount
=
amount
;
}
public
BigDecimal
getAmount
()
{
return
amount
;
}
public
void
setRealAmount
(
BigDecimal
realAmount
)
{
this
.
realAmount
=
realAmount
;
}
public
BigDecimal
getRealAmount
()
{
return
realAmount
;
}
public
void
setSpecRuleDetail
(
String
specRuleDetail
)
{
this
.
specRuleDetail
=
specRuleDetail
;
}
public
String
getSpecRuleDetail
()
{
return
specRuleDetail
;
}
public
void
setSpecRuleIds
(
String
specRuleIds
)
{
this
.
specRuleIds
=
specRuleIds
;
}
public
String
getSpecRuleIds
()
{
return
specRuleIds
;
}
public
void
setSkuId
(
String
skuId
)
{
this
.
skuId
=
skuId
;
}
public
String
getSkuId
()
{
return
skuId
;
}
public
void
setGoodsCategory
(
String
goodsCategory
)
{
this
.
goodsCategory
=
goodsCategory
;
}
public
String
getGoodsCategory
()
{
return
goodsCategory
;
}
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
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
@@ -221,7 +124,9 @@ public class OrderDetail implements Serializable
.
append
(
"goodsName"
,
getGoodsName
())
.
append
(
"machineId"
,
getMachineId
())
.
append
(
"num"
,
getNum
())
.
append
(
"amount"
,
getAmount
())
.
append
(
"viewAmount"
,
getViewAmount
())
.
append
(
"amountShould"
,
getAmountShould
())
.
append
(
"couponAmount"
,
getCouponAmount
())
.
append
(
"realAmount"
,
getRealAmount
())
.
append
(
"specRuleDetail"
,
getSpecRuleDetail
())
.
append
(
"specRuleIds"
,
getSpecRuleIds
())
...
...
soss-system/src/main/java/com/soss/system/domain/po/CouponPo.java
View file @
968b4136
...
...
@@ -8,7 +8,6 @@ import lombok.Data;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.util.List
;
@Data
@ApiModel
(
"优惠券请求类"
)
...
...
@@ -64,8 +63,8 @@ public class CouponPo {
@ApiModelProperty
(
"订单限制 false 整单 true 单杯"
)
private
Boolean
orderLimit
;
@ApiModelProperty
(
"周几限制
1,2,3
"
)
private
List
<
Integer
>
weekLimit
;
@ApiModelProperty
(
"周几限制
0表示不限 1-7表示周日到周六
"
)
private
Integer
[]
weekLimit
;
@ApiModelProperty
(
"用户可领取次数之次数限制0无限制,即每N天M次对应的次数"
)
private
Integer
userLimit
;
...
...
@@ -93,16 +92,11 @@ public class CouponPo {
if
(
shopIds
!=
null
&&
shopIds
.
length
>
0
)
{
limitDim
+=
1
;
}
if
(
limitDim
==
0
)
{
throw
new
ServiceException
(
"适用范围之地区/门店还未传递"
);
}
if
(
limitDim
>
1
)
{
throw
new
ServiceException
(
"适用范围之地区/门店不能跨级"
);
}
}
public
boolean
isAllCategory
()
{
return
categoryIds
!=
null
&&
categoryIds
.
length
==
1
&&
categoryIds
[
0
].
equals
(
"0"
);
}
public
boolean
isAllProvs
()
{
return
province
!=
null
&&
province
.
length
==
1
&&
province
[
0
].
equals
(
"0"
);
}
}
soss-system/src/main/java/com/soss/system/domain/po/OrderCouponPo.java
0 → 100644
View file @
968b4136
package
com
.
soss
.
system
.
domain
.
po
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
@ApiModel
(
"下单时的优惠券请求类"
)
public
class
OrderCouponPo
{
@ApiModelProperty
(
"店铺ID"
)
private
Long
shopId
;
@ApiModelProperty
(
"商品skuID"
)
private
List
<
Long
>
skuIds
;
}
soss-system/src/main/java/com/soss/system/domain/vo/CouponVo.java
View file @
968b4136
...
...
@@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Map
;
@ApiModel
@Data
public
class
CouponVo
extends
CouponPo
{
...
...
@@ -36,23 +39,23 @@ public class CouponVo extends CouponPo {
@ApiModelProperty
(
"优惠券类别名"
)
private
String
categoryName
;
@ApiModelProperty
(
"可用商品
类别
描述"
)
private
String
category
Desc
;
@ApiModelProperty
(
"可用商品
范围
描述"
)
private
String
goodLimit
Desc
;
@ApiModelProperty
(
"可用
商品
描述"
)
private
String
goods
Desc
;
@ApiModelProperty
(
"可用
区域/门店
描述"
)
private
String
areaLimit
Desc
;
@ApiModelProperty
(
"
可用省份
描述"
)
private
String
province
Desc
;
@ApiModelProperty
(
"
每周几可用
描述"
)
private
String
weekLimit
Desc
;
@ApiModelProperty
(
"可用城市描述
"
)
private
String
city
Desc
;
@ApiModelProperty
(
value
=
"不可用原因,小程序端展示优惠券列表用
"
)
private
String
notFitable
Desc
;
@ApiModelProperty
(
"
可用区域描述
"
)
private
String
areaDesc
;
@ApiModelProperty
(
"
优惠金额
"
)
private
BigDecimal
couponAmount
;
@ApiModelProperty
(
"
可用店铺描述
"
)
private
String
shopDesc
;
@ApiModelProperty
(
"
每个商品优惠金额字典:skuId为key,减免金额为value
"
)
private
Map
<
Long
,
BigDecimal
>
couponAmountMap
;
@ApiModelProperty
(
value
=
"可用商品类别列表字符串,全品类传 [0]"
,
hidden
=
true
)
private
String
categoryIdStr
;
...
...
@@ -71,4 +74,7 @@ public class CouponVo extends CouponPo {
@ApiModelProperty
(
value
=
"可用店铺ID列表字符串"
,
hidden
=
true
)
private
String
shopIdStr
;
@ApiModelProperty
(
value
=
"每周几可用字符串"
,
hidden
=
true
)
private
String
weekLimitStr
;
}
soss-system/src/main/java/com/soss/system/mapper/CouponUserMapper.java
View file @
968b4136
...
...
@@ -64,7 +64,7 @@ public interface CouponUserMapper {
* @param nowTime
* @return
*/
List
<
CouponVo
>
listCustAvailableCoupon
(
@Param
(
"custId"
)
String
custId
,
@Param
(
"nowTime"
)
LocalDateTime
nowTime
);
List
<
CouponVo
>
listCustAvailableCoupon
(
@Param
(
"custId"
)
String
custId
,
@Param
(
"
couponId"
)
Integer
couponId
,
@Param
(
"
nowTime"
)
LocalDateTime
nowTime
);
/**
* 查询用户领取优惠券列表
...
...
soss-system/src/main/java/com/soss/system/mapper/GoodsMapper.java
View file @
968b4136
...
...
@@ -19,7 +19,7 @@ public interface GoodsMapper
* @param id 商品主键
* @return 商品
*/
public
Goods
selectGoodsById
(
Stri
ng
id
);
public
Goods
selectGoodsById
(
Lo
ng
id
);
/**
* 查询商品列表
...
...
soss-system/src/main/java/com/soss/system/mapper/GoodsSkuMapper.java
View file @
968b4136
package
com
.
soss
.
system
.
mapper
;
import
java.util.List
;
import
com.soss.system.domain.GoodsSku
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* 由规格选项组合生成商品skuMapper接口
*
...
...
@@ -22,15 +23,23 @@ public interface GoodsSkuMapper
/**
* 查询由规格选项组合生成商品sku列表
*
*
* @param goodsSku 由规格选项组合生成商品sku
* @return 由规格选项组合生成商品sku集合
*/
public
List
<
GoodsSku
>
selectGoodsSkuList
(
GoodsSku
goodsSku
);
/**
* 下单时查询sku列表信息
*
* @param ids
* @return
*/
List
<
GoodsSku
>
selectSkuListForOrder
(
@Param
(
"ids"
)
List
<
Long
>
ids
);
/**
* 新增由规格选项组合生成商品sku
*
*
* @param goodsSku 由规格选项组合生成商品sku
* @return 结果
*/
...
...
soss-system/src/main/java/com/soss/system/mapper/OrderMapper.java
View file @
968b4136
package
com
.
soss
.
system
.
mapper
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.OrderQuery
;
import
org.apache.ibatis.annotations.Param
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* 订单Mapper接口
*
*
* @author zxq
* @date 2022-04-28
*/
public
interface
OrderMapper
{
public
interface
OrderMapper
{
/**
* 查询订单
*
*
* @param id 订单主键
* @return 订单
*/
...
...
@@ -76,13 +77,21 @@ public interface OrderMapper
Order
selectHomeByUserId
(
@Param
(
"userId"
)
String
openId
,
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"shopId"
)
String
shopId
);
void
updateTimeOut
(
@Param
(
"status"
)
String
productionCompleted
,
@Param
(
"timeout"
)
String
timeout
);
void
updateTimeOut
(
@Param
(
"status"
)
String
productionCompleted
,
@Param
(
"timeout"
)
String
timeout
);
List
<
Order
>
selectOrderByUserId
(
@Param
(
"userId"
)
String
openId
,
@Param
(
"status"
)
List
<
String
>
status
);
List
<
Order
>
selectOrderByUserId
(
@Param
(
"userId"
)
String
openId
,
@Param
(
"status"
)
List
<
String
>
status
);
void
updateCancel
(
@Param
(
"status"
)
String
unpaid
,
@Param
(
"timeout"
)
int
i
);
List
<
Order
>
selectOrderByTime
(
@Param
(
"status"
)
String
unpaid
,
@Param
(
"timeout"
)
int
i
);
List
<
Order
>
selectOrderByTime
(
@Param
(
"status"
)
String
unpaid
,
@Param
(
"timeout"
)
int
i
);
List
<
Order
>
selectBeforeOrder
(
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"orderId"
)
Long
orderId
);
List
<
Order
>
selectBeforeOrder
(
@Param
(
"status"
)
List
<
String
>
status
,
@Param
(
"orderId"
)
Long
orderId
);
/**
* 查询用户订单简单统计数据
*
* @param custId
* @return 返回用户下单数,下单金额
*/
Map
<
String
,
Object
>
getCustOrderSimpleStat
(
@Param
(
"custId"
)
String
custId
);
}
soss-system/src/main/java/com/soss/system/service/ICouponUserService.java
View file @
968b4136
package
com
.
soss
.
system
.
service
;
import
com.soss.system.domain.CouponUser
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.CouponUserVo
;
import
com.soss.system.domain.vo.CouponVo
;
...
...
@@ -22,7 +23,9 @@ public interface ICouponUserService {
int
getCustAvailableCouponCnt
(
String
custId
);
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
);
List
<
CouponVo
>
listCustAvailableCoupon
(
String
custId
,
Integer
couponId
);
List
<
CouponUserVo
>
selectCouponUserList
(
CouponUser
couponUser
);
void
resovleCouponFitable
(
List
<
CouponVo
>
couponVos
,
Order
order
);
}
soss-system/src/main/java/com/soss/system/service/ICustomerService.java
View file @
968b4136
package
com
.
soss
.
system
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.soss.system.domain.Customer
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
...
...
@@ -64,4 +66,6 @@ public interface ICustomerService
public
int
deleteCustomerById
(
Long
id
);
Integer
allow
(
String
openId
,
String
allow
);
Map
<
String
,
Object
>
getCustSimpleOrderStat
(
String
custId
);
}
soss-system/src/main/java/com/soss/system/service/IGoodsService.java
View file @
968b4136
...
...
@@ -2,6 +2,7 @@ package com.soss.system.service;
import
java.util.List
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.GoodsSku
;
/**
* 商品Service接口
...
...
@@ -17,7 +18,7 @@ public interface IGoodsService
* @param id 商品主键
* @return 商品
*/
public
Goods
selectGoodsById
(
Stri
ng
id
);
public
Goods
selectGoodsById
(
Lo
ng
id
);
/**
* 查询商品列表
...
...
@@ -64,4 +65,6 @@ public interface IGoodsService
String
offShop
(
Long
goodsId
,
boolean
boo
);
String
deleteGoodsById
(
Long
goodsId
,
boolean
boo
);
List
<
GoodsSku
>
getGoodsSkus
(
long
goodsId
);
}
soss-system/src/main/java/com/soss/system/service/IOrderService.java
View file @
968b4136
...
...
@@ -41,6 +41,8 @@ public interface IOrderService
*/
public
AjaxResult
insertOrder
(
LoginUser
request
,
Order
order
);
void
checkBusinessTime
(
String
shopId
);
/**
* 修改订单
*
...
...
soss-system/src/main/java/com/soss/system/service/impl/CouponRuleServiceImpl.java
View file @
968b4136
package
com
.
soss
.
system
.
service
.
impl
;
import
com.soss.system.constants.SystemConstant
;
import
com.soss.system.domain.CouponRule
;
import
com.soss.system.domain.Goods
;
import
com.soss.system.domain.GoodsCategory
;
...
...
@@ -11,7 +12,7 @@ import com.soss.system.mapper.GoodsMapper;
import
com.soss.system.mapper.ShopMapper
;
import
com.soss.system.service.ICouponRuleService
;
import
com.soss.system.utils.AreaUtil
;
import
com.soss.system.utils.
Collection
Util
;
import
com.soss.system.utils.
Array
Util
;
import
io.jsonwebtoken.lang.Assert
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -68,16 +69,27 @@ public class CouponRuleServiceImpl implements ICouponRuleService {
}
transCategoryIds
(
couponVos
);
translateArea
(
couponVos
);
translateWeekLimit
(
couponVos
);
}
private
void
translateWeekLimit
(
List
<
CouponVo
>
couponVos
)
{
for
(
CouponVo
couponVo
:
couponVos
)
{
if
(!
ArrayUtil
.
isAllAvailable
(
couponVo
.
getWeekLimit
()))
{
String
weekLimitDesc
=
Arrays
.
stream
(
couponVo
.
getWeekLimit
())
.
map
(
week
->
"每"
+
SystemConstant
.
WEEK_DESC
[
week
-
1
]).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
setWeekLimitDesc
(
weekLimitDesc
);
}
}
}
private
void
transCategoryIds
(
List
<
CouponVo
>
couponVos
)
{
List
<
String
>
categoryIds
=
new
ArrayList
<>(
16
);
List
<
Long
>
goodsIds
=
new
ArrayList
<>(
16
);
for
(
CouponVo
couponVo
:
couponVos
)
{
if
(!
couponVo
.
isAllCategory
(
))
{
Collection
Util
.
listAddArray
(
categoryIds
,
couponVo
.
getCategoryIds
());
if
(!
ArrayUtil
.
isAllAvailable
(
couponVo
.
getCategoryIds
()
))
{
Array
Util
.
listAddArray
(
categoryIds
,
couponVo
.
getCategoryIds
());
}
Collection
Util
.
listAddArray
(
goodsIds
,
couponVo
.
getGoodsIds
());
Array
Util
.
listAddArray
(
goodsIds
,
couponVo
.
getGoodsIds
());
}
Map
<
String
,
String
>
categoryMap
;
...
...
@@ -97,18 +109,18 @@ public class CouponRuleServiceImpl implements ICouponRuleService {
}
for
(
CouponVo
couponVo
:
couponVos
)
{
if
(
couponVo
.
isAllCategory
(
))
{
couponVo
.
set
Category
Desc
(
"全品类"
);
if
(
ArrayUtil
.
isAllAvailable
(
couponVo
.
getCategoryIds
()
))
{
couponVo
.
set
GoodLimit
Desc
(
"全品类"
);
continue
;
}
else
if
(
Collection
Util
.
hasContents
(
couponVo
.
getCategoryIds
()))
{
}
else
if
(
Array
Util
.
hasContents
(
couponVo
.
getCategoryIds
()))
{
String
categoryDec
=
Arrays
.
stream
(
couponVo
.
getCategoryIds
()).
map
(
categoryMap:
:
get
).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
set
Category
Desc
(
categoryDec
);
couponVo
.
set
GoodLimit
Desc
(
categoryDec
);
continue
;
}
if
(
Collection
Util
.
hasContents
(
couponVo
.
getGoodsIds
()))
{
if
(
Array
Util
.
hasContents
(
couponVo
.
getGoodsIds
()))
{
String
goodsDesc
=
Arrays
.
stream
(
couponVo
.
getGoodsIds
()).
map
(
goodsMap:
:
get
).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
setGood
s
Desc
(
goodsDesc
);
couponVo
.
setGood
Limit
Desc
(
goodsDesc
);
}
}
}
...
...
@@ -119,12 +131,12 @@ public class CouponRuleServiceImpl implements ICouponRuleService {
List
<
String
>
area
=
new
ArrayList
<>(
16
);
List
<
Long
>
shopIds
=
new
ArrayList
<>(
16
);
for
(
CouponVo
couponVo
:
couponVos
)
{
if
(!
couponVo
.
isAllProvs
(
))
{
Collection
Util
.
listAddArray
(
province
,
couponVo
.
getProvince
());
if
(!
ArrayUtil
.
isAllAvailable
(
couponVo
.
getProvince
()
))
{
Array
Util
.
listAddArray
(
province
,
couponVo
.
getProvince
());
}
Collection
Util
.
listAddArray
(
city
,
couponVo
.
getCity
());
Collection
Util
.
listAddArray
(
area
,
couponVo
.
getArea
());
Collection
Util
.
listAddArray
(
shopIds
,
couponVo
.
getShopIds
());
Array
Util
.
listAddArray
(
city
,
couponVo
.
getCity
());
Array
Util
.
listAddArray
(
area
,
couponVo
.
getArea
());
Array
Util
.
listAddArray
(
shopIds
,
couponVo
.
getShopIds
());
}
Map
<
Long
,
Shop
>
shopMapInit
;
...
...
@@ -137,27 +149,28 @@ public class CouponRuleServiceImpl implements ICouponRuleService {
Map
<
Long
,
Shop
>
shopMap
=
shopMapInit
;
for
(
CouponVo
couponVo
:
couponVos
)
{
if
(
couponVo
.
isAllProvs
())
{
couponVo
.
setProvinceDesc
(
"全国通用"
);
if
(
ArrayUtil
.
isAllAvailable
(
couponVo
.
getProvince
()))
{
couponVo
.
setAreaLimitDesc
(
"全国通用"
);
continue
;
}
else
if
(
ArrayUtil
.
hasContents
(
couponVo
.
getProvince
()))
{
String
provDesc
=
Arrays
.
stream
(
couponVo
.
getProvince
()).
map
(
areaUtil:
:
getProvNameByCode
).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
setAreaLimitDesc
(
provDesc
);
continue
;
}
else
if
(
CollectionUtil
.
hasContents
(
couponVo
.
getProvince
()))
{
String
provDesc
=
Arrays
.
stream
(
couponVo
.
getProvince
()).
map
(
areaUtil:
:
getAreaNameByCode
).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
setProvinceDesc
(
provDesc
);
}
if
(
Collection
Util
.
hasContents
(
couponVo
.
getCity
()))
{
String
cityDesc
=
Arrays
.
stream
(
couponVo
.
getCity
()).
map
(
areaUtil:
:
getAreaNameByCode
).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
set
City
Desc
(
cityDesc
);
if
(
Array
Util
.
hasContents
(
couponVo
.
getCity
()))
{
String
cityDesc
=
Arrays
.
stream
(
couponVo
.
getCity
()).
map
(
areaUtil:
:
get
CityOr
AreaNameByCode
).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
set
AreaLimit
Desc
(
cityDesc
);
continue
;
}
if
(
Collection
Util
.
hasContents
(
couponVo
.
getArea
()))
{
String
areaDesc
=
Arrays
.
stream
(
couponVo
.
getArea
()).
map
(
areaUtil:
:
getAreaNameByCode
).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
setAreaDesc
(
areaDesc
);
if
(
Array
Util
.
hasContents
(
couponVo
.
getArea
()))
{
String
areaDesc
=
Arrays
.
stream
(
couponVo
.
getArea
()).
map
(
areaUtil:
:
get
CityOr
AreaNameByCode
).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
setArea
Limit
Desc
(
areaDesc
);
continue
;
}
if
(!
Collection
Util
.
hasContents
(
couponVo
.
getShopIds
()))
{
if
(!
Array
Util
.
hasContents
(
couponVo
.
getShopIds
()))
{
continue
;
}
...
...
@@ -166,9 +179,9 @@ public class CouponRuleServiceImpl implements ICouponRuleService {
if
(
shop
==
null
)
{
return
null
;
}
return
areaUtil
.
getAreaNameByCode
(
shop
.
getZone
())
+
shop
.
getName
();
return
areaUtil
.
get
CityOr
AreaNameByCode
(
shop
.
getZone
())
+
shop
.
getName
();
}).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
joining
(
","
));
couponVo
.
set
Shop
Desc
(
shopDesc
);
couponVo
.
set
AreaLimit
Desc
(
shopDesc
);
}
}
}
soss-system/src/main/java/com/soss/system/service/impl/CouponServiceImpl.java
View file @
968b4136
...
...
@@ -13,6 +13,7 @@ import com.soss.system.mapper.CouponMapper;
import
com.soss.system.mapper.CouponRuleMapper
;
import
com.soss.system.mapper.CouponUserMapper
;
import
com.soss.system.service.ICouponService
;
import
com.soss.system.utils.ArrayUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -120,6 +121,7 @@ public class CouponServiceImpl implements ICouponService {
}
else
if
(
CouponCategoryType
.
DISCOUNT
.
getType
().
equals
(
couponCategory
.
getType
()))
{
Assert
.
notNull
(
couponPo
.
getPriceDiscount
(),
"打折数还未设置"
);
Assert
.
notNull
(
couponPo
.
getOrderLimit
(),
"订单限制还未设置"
);
couponPo
.
setPriceLimit
(
BigDecimal
.
ZERO
);
ruleName
=
couponPo
.
getOrderLimit
()
+
"折"
;
ruleDesc
=
couponPo
.
getOrderLimit
()
?
"单杯"
:
"整单"
;
}
else
{
...
...
@@ -143,7 +145,14 @@ public class CouponServiceImpl implements ICouponService {
}
Assert
.
isTrue
((
couponPo
.
getCategoryIds
()
!=
null
&&
couponPo
.
getCategoryIds
().
length
>
0
)
||
(
couponPo
.
getGoodsIds
()
!=
null
&&
couponPo
.
getGoodsIds
().
length
>
0
),
"商品范围还未设置"
);
if
(!
ArrayUtil
.
isEmpty
(
couponPo
.
getCategoryIds
())
&&
!
ArrayUtil
.
isEmpty
(
couponPo
.
getGoodsIds
()))
{
throw
new
ServiceException
(
"品类范围和商品范围不能重叠选择"
);
}
couponPo
.
couponUseLimitCheck
();
Assert
.
notEmpty
(
couponPo
.
getWeekLimit
(),
"每周几的限制还未传递"
);
Integer
maxWeekVal
=
Arrays
.
stream
(
couponPo
.
getWeekLimit
()).
max
(
Integer:
:
compareTo
).
get
();
Integer
minWeekVal
=
Arrays
.
stream
(
couponPo
.
getWeekLimit
()).
min
(
Integer:
:
compareTo
).
get
();
Assert
.
isTrue
(
minWeekVal
>=
0
&&
maxWeekVal
<=
7
,
"每周几的值超出范围,应在[0,7]之内"
);
Assert
.
notNull
(
couponPo
.
getSendMsg
(),
"是否短信通知还未设置"
);
Assert
.
isTrue
(!
couponPo
.
getSendMsg
()
||
couponPo
.
getMsgId
()
!=
null
,
"短信模板还未选择"
);
...
...
@@ -183,6 +192,7 @@ public class CouponServiceImpl implements ICouponService {
}
else
{
couponRule
.
setShopIds
(
Arrays
.
stream
(
couponPo
.
getShopIds
()).
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)));
}
couponRule
.
setWeekLimit
(
Arrays
.
stream
(
couponPo
.
getWeekLimit
()).
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)));
if
(
saveFlag
)
{
couponRule
.
setCreatedAt
(
now
);
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
View file @
968b4136
This diff is collapsed.
Click to expand it.
soss-system/src/main/java/com/soss/system/service/impl/CustomerServiceImpl.java
View file @
968b4136
package
com
.
soss
.
system
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
com.soss.common.utils.DateUtils
;
import
com.soss.system.constants.OrderStatusConstant
;
import
com.soss.system.domain.Customer
;
import
com.soss.system.domain.Order
;
import
com.soss.system.domain.vo.customer.CustomerQueryVo
;
import
com.soss.system.domain.vo.customer.CustomerResultVo
;
import
com.soss.system.mapper.CustomerMapper
;
import
com.soss.system.mapper.OrderMapper
;
import
com.soss.system.mapper.ShopMapper
;
import
com.soss.system.service.ICustomerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.soss.system.mapper.CustomerMapper
;
import
com.soss.system.domain.Customer
;
import
com.soss.system.service.ICustomerService
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
/**
* 用户信息Service业务层处理
...
...
@@ -135,4 +135,9 @@ public class CustomerServiceImpl implements ICustomerService
customer
.
setAllow
(
"1"
);
return
customerMapper
.
updateCustomer
(
customer
);
}
@Override
public
Map
<
String
,
Object
>
getCustSimpleOrderStat
(
String
custId
)
{
return
orderMapper
.
getCustOrderSimpleStat
(
custId
);
}
}
soss-system/src/main/java/com/soss/system/service/impl/GoodsServiceImpl.java
View file @
968b4136
package
com
.
soss
.
system
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.exception.ServiceException
;
...
...
@@ -11,14 +7,17 @@ import com.soss.common.utils.GenerateCode;
import
com.soss.common.utils.StringUtils
;
import
com.soss.system.domain.*
;
import
com.soss.system.jiguang.impl.JiGuangPushServiceImpl
;
import
com.soss.system.service.IGoodsService
;
import
com.soss.system.mapper.*
;
import
com.soss.system.service.IGoodsService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 商品Service业务层处理
*
...
...
@@ -60,7 +59,7 @@ public class GoodsServiceImpl implements IGoodsService
* @return 商品
*/
@Override
public
Goods
selectGoodsById
(
Stri
ng
id
)
public
Goods
selectGoodsById
(
Lo
ng
id
)
{
Goods
goods
=
goodsMapper
.
selectGoodsById
(
id
);
GoodsTag
goodsTag
=
new
GoodsTag
();
...
...
@@ -225,15 +224,18 @@ public class GoodsServiceImpl implements IGoodsService
* @return 结果
*/
@Override
public
int
updateGoods
(
Goods
goods
)
{
int
i
=
goodsMapper
.
updateGoods
(
goods
);
if
(
StringUtils
.
isNotEmpty
(
goods
.
getSpec
()))
{
goodsSkuMapper
.
deleteGoodsSkuByGoodsId
(
String
.
valueOf
(
goods
.
getId
()))
;
public
int
updateGoods
(
Goods
goods
)
{
Goods
goodsOri
=
goodsMapper
.
selectGoodsById
(
goods
.
getId
());
int
i
=
goodsMapper
.
updateGoods
(
goods
);
if
(
Objects
.
equals
(
goodsOri
.
getSpec
(),
goods
.
getSpec
()))
{
return
i
;
}
if
(
goods
.
getGoodsTagList
()!=
null
&&!
goods
.
getGoodsTagList
().
isEmpty
()){
/*if(StringUtils.isNotEmpty(goods.getSpec())){
goodsSkuMapper.deleteGoodsSkuByGoodsId(String.valueOf(goods.getId()));
}*/
goodsSkuMapper
.
deleteGoodsSkuByGoodsId
(
String
.
valueOf
(
goods
.
getId
()));
if
(
goods
.
getGoodsTagList
()
!=
null
&&
!
goods
.
getGoodsTagList
().
isEmpty
())
{
goodsTagMapper
.
deleteGoodsTagByGoodsId
(
String
.
valueOf
(
goods
.
getId
()));
}
insertgoodsExt
(
goods
);
return
i
;
...
...
@@ -357,19 +359,12 @@ public class GoodsServiceImpl implements IGoodsService
return
"1"
;
}
@Override
public
List
<
GoodsSku
>
getGoodsSkus
(
long
goodsId
){
GoodsSku
goodsSku
=
new
GoodsSku
();
goodsSku
.
setGoodsId
(
goodsId
);
goodsSku
.
setIsDeleted
(
"0"
);
return
goodsSkuMapper
.
selectGoodsSkuList
(
goodsSku
);
}
public
String
test
()
{
Goods
goods
=
goodsMapper
.
selectGoodsById
(
"21"
);
insertgoodsExt
(
goods
);
return
null
;
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/MachineApiServiceImpl.java
View file @
968b4136
...
...
@@ -191,13 +191,13 @@ public class MachineApiServiceImpl {
for
(
OrderDetail
detail
:
orderDetails
)
{
JSONObject
jsonObject
=
new
JSONObject
();
goodsList
.
add
(
jsonObject
);
jsonObject
.
put
(
"goodsId"
,
Long
.
valueOf
(
detail
.
getGoodsId
()
));
jsonObject
.
put
(
"goodsId"
,
detail
.
getGoodsId
(
));
jsonObject
.
put
(
"goodsName"
,
detail
.
getGoodsName
());
jsonObject
.
put
(
"num"
,
Integer
.
parseInt
(
detail
.
getNum
()));
jsonObject
.
put
(
"amount"
,
detail
.
getAmount
());
jsonObject
.
put
(
"amount"
,
detail
.
get
View
Amount
());
jsonObject
.
put
(
"specRuleDetail"
,
detail
.
getSpecRuleDetail
());
jsonObject
.
put
(
"specRuleIds"
,
detail
.
getSpecRuleIds
());
jsonObject
.
put
(
"skuId"
,
Long
.
parseLong
(
detail
.
getSkuId
()
));
jsonObject
.
put
(
"skuId"
,
detail
.
getSkuId
(
));
// if("0".equals(detail.getGoodsCategory())){
// jsonObject.put("goodsCategory","今日特惠");
// }else{
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
968b4136
...
...
@@ -2,7 +2,6 @@ package com.soss.system.service.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.soss.common.constant.HttpStatus
;
import
com.soss.common.core.domain.AjaxResult
;
import
com.soss.common.core.domain.model.LoginUser
;
import
com.soss.common.exception.ServiceException
;
...
...
@@ -126,17 +125,6 @@ public class OrderServiceImpl implements IOrderService {
@Override
@Transactional
public
AjaxResult
insertOrder
(
LoginUser
loginUser
,
Order
order
)
{
AjaxResult
result
=
check
(
order
);
if
(
HttpStatus
.
SUCCESS
!=
(
int
)
result
.
get
(
result
.
CODE_TAG
))
{
return
result
;
}
try
{
checkBusinessTime
(
order
.
getShopId
());
}
catch
(
ServiceException
e
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
}
order
.
setState
(
OrderStatusConstant
.
Unpaid
);
order
.
setUserId
(
loginUser
.
getOpenId
());
order
.
setUserName
(
loginUser
.
getUsername
());
...
...
@@ -190,7 +178,8 @@ public class OrderServiceImpl implements IOrderService {
}
private
void
checkBusinessTime
(
String
shopId
)
{
@Override
public
void
checkBusinessTime
(
String
shopId
)
{
Shop
shop
=
shopMapper
.
selectShopById
(
shopId
);
String
startTime
=
shop
.
getStartTime
();
String
endTime
=
shop
.
getEndTime
();
...
...
@@ -206,8 +195,6 @@ public class OrderServiceImpl implements IOrderService {
if
(
startBusiness
.
getTimeInMillis
()
>
l
||
endBusiness
.
getTimeInMillis
()
<
l
)
{
throw
new
ServiceException
(
"当前时间本店休息中,暂停点单~"
);
}
}
/**
...
...
@@ -415,7 +402,7 @@ public class OrderServiceImpl implements IOrderService {
for
(
OrderDetail
orderDetail
:
orderDetails
)
{
ShopGoodsSku
shopGoodsSku
=
new
ShopGoodsSku
();
shopGoodsSku
.
setSkuId
(
Long
.
parseLong
(
orderDetail
.
getSkuId
()
));
shopGoodsSku
.
setSkuId
(
orderDetail
.
getSkuId
(
));
shopGoodsSku
.
setShopId
(
Long
.
valueOf
(
order
.
getShopId
()));
shopGoodsSku
.
setIsDeleted
(
"0"
);
List
<
ShopGoodsSku
>
shopGoodsSkus
=
shopGoodsSkuMapper
.
selectShopGoodsSkuList
(
shopGoodsSku
);
...
...
@@ -631,7 +618,7 @@ public class OrderServiceImpl implements IOrderService {
OrderDetail
orderDetail
=
new
OrderDetail
();
orderDetail
.
setOrderId
(
Long
.
parseLong
(
orderId
));
List
<
OrderDetail
>
orderDetails
=
orderDetailMapper
.
selectOrderDetailList
(
orderDetail
);
List
<
Stri
ng
>
skuIds
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getSkuId
).
collect
(
Collectors
.
toList
());
List
<
Lo
ng
>
skuIds
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getSkuId
).
collect
(
Collectors
.
toList
());
OrderTakingVo
infoByShop
=
orderTakingService
.
getInfoByShop
(
shopId
);
List
<
CategoryVo
>
categorys
=
infoByShop
.
getCategorys
();
List
<
GoodsVo
>
ccs
=
new
ArrayList
<>();
...
...
@@ -650,7 +637,7 @@ public class OrderServiceImpl implements IOrderService {
continue
;
}
for
(
SkuVo
skus
:
good
.
getSkus
())
{
if
(
skuIds
.
contains
(
skus
.
getSkuId
(
)))
{
if
(
skuIds
.
contains
(
Long
.
parseLong
(
skus
.
getSkuId
()
)))
{
skuVoList
.
add
(
skus
);
}
}
...
...
soss-system/src/main/java/com/soss/system/service/impl/ShopServiceImpl.java
View file @
968b4136
...
...
@@ -262,10 +262,10 @@ public class ShopServiceImpl implements IShopService
public
String
turn
(
Long
shopId
,
Long
goodsId
,
String
pointer
)
{
ShopGoods
shopGoods
=
new
ShopGoods
();
shopGoods
.
setShopId
(
shopId
);
Goods
goods
=
goodsMapper
.
selectGoodsById
(
String
.
valueOf
(
goodsId
)
);
Goods
goods
=
goodsMapper
.
selectGoodsById
(
goodsId
);
List
<
ShopGoods
>
shopGoodsList
=
shopGoodsMapper
.
selectShopGoodsList
(
shopGoods
);
shopGoodsList
=
shopGoodsList
.
stream
().
filter
(
e
->{
String
category
=
goodsMapper
.
selectGoodsById
(
String
.
valueOf
(
e
.
getGoodsId
()
)).
getCategory
();
String
category
=
goodsMapper
.
selectGoodsById
(
e
.
getGoodsId
(
)).
getCategory
();
if
(
category
.
equals
(
goods
.
getCategory
())){
return
true
;
}
else
{
...
...
@@ -392,7 +392,7 @@ public class ShopServiceImpl implements IShopService
ShopGoodsSku
shopGoodsSku1
=
shopGoodsSkus
.
get
(
0
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"state"
,
shopGoodsSku1
.
getState
());
Goods
goods
=
goodsMapper
.
selectGoodsById
(
String
.
valueOf
(
shopGoodsSku1
.
getGoodsId
()
));
Goods
goods
=
goodsMapper
.
selectGoodsById
(
shopGoodsSku1
.
getGoodsId
(
));
jsonObject
.
put
(
"goods"
,
getGoodsVo
(
goods
,
shopGoodsSku1
.
getShopId
()));
return
AjaxResult
.
success
(
jsonObject
);
...
...
soss-system/src/main/java/com/soss/system/utils/AreaUtil.java
View file @
968b4136
...
...
@@ -6,31 +6,28 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.FileCopyUtils
;
import
javax.annotation.PostConstruct
;
import
java.io.BufferedReader
;
import
java.io.FileReader
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.Map
;
@Component
@Slf4j
public
class
AreaUtil
{
// private Map<String, Area> areaMap;
private
Map
<
String
,
String
>
areaDeepMap
=
new
HashMap
<>();
// private Map<String, Area> areaMap;
private
Map
<
String
,
String
>
provNameMap
=
new
HashMap
<>();
private
Map
<
String
,
String
>
areaOrCityFullNameMap
=
new
HashMap
<>();
@PostConstruct
public
void
init
()
{
try
{
ClassPathResource
resource
=
new
ClassPathResource
(
"province.json"
);
BufferedReader
bufferedReader
=
new
BufferedReader
(
new
FileReader
(
resource
.
getFile
()));
StringBuilder
builder
=
new
StringBuilder
();
String
line
;
while
((
line
=
bufferedReader
.
readLine
())
!=
null
)
{
builder
.
append
(
line
);
}
JSONArray
areaArray
=
JSONArray
.
parseArray
(
builder
.
toString
());
byte
[]
bdata
=
FileCopyUtils
.
copyToByteArray
(
resource
.
getInputStream
());
String
data
=
new
String
(
bdata
,
StandardCharsets
.
UTF_8
);
JSONArray
areaArray
=
JSONArray
.
parseArray
(
data
);
// areaMap = buildAreaTree(areaArray);
deepAreaTree
(
areaArray
,
""
);
}
catch
(
IOException
e
)
{
...
...
@@ -47,14 +44,22 @@ public class AreaUtil {
String
code
=
area
.
getString
(
"value"
);
String
label
=
area
.
getString
(
"label"
);
String
curLabel
=
parentName
+
label
;
areaDeepMap
.
put
(
code
,
curLabel
);
if
(
parentName
.
equals
(
""
))
{
provNameMap
.
put
(
code
,
curLabel
);
}
else
{
areaOrCityFullNameMap
.
put
(
code
,
curLabel
);
}
JSONArray
children
=
area
.
getJSONArray
(
"children"
);
deepAreaTree
(
children
,
curLabel
);
}
}
public
String
getAreaNameByCode
(
String
code
)
{
return
areaDeepMap
.
get
(
code
);
public
String
getProvNameByCode
(
String
code
)
{
return
provNameMap
.
get
(
code
);
}
public
String
getCityOrAreaNameByCode
(
String
code
)
{
return
areaOrCityFullNameMap
.
get
(
code
);
}
/*private Map<String, Area> buildAreaTree(JSONArray areaArray) {
...
...
soss-system/src/main/java/com/soss/system/utils/
Collection
Util.java
→
soss-system/src/main/java/com/soss/system/utils/
Array
Util.java
View file @
968b4136
...
...
@@ -4,14 +4,30 @@ import com.soss.common.utils.StringUtils;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Objects
;
public
class
Collection
Util
{
public
class
Array
Util
{
public
static
<
T
>
void
listAddArray
(
List
<
T
>
lst
,
T
[]
ts
)
{
if
(
hasContents
(
ts
))
{
lst
.
addAll
(
Arrays
.
asList
(
ts
));
}
}
public
static
<
T
>
boolean
isAllAvailable
(
T
[]
ts
)
{
if
(
ts
==
null
||
ts
.
length
!=
1
)
{
return
false
;
}
T
t
=
ts
[
0
];
if
(
t
instanceof
String
)
{
return
Objects
.
equals
(
t
,
"0"
);
}
else
if
(
t
instanceof
Integer
)
{
return
Objects
.
equals
(
t
,
0
);
}
else
if
(
t
instanceof
Long
)
{
return
Objects
.
equals
(
t
,
0L
);
}
return
false
;
}
public
static
<
T
>
boolean
hasContents
(
T
[]
ts
)
{
return
ts
!=
null
&&
ts
.
length
>
0
;
}
...
...
@@ -20,10 +36,33 @@ public class CollectionUtil {
return
StringUtils
.
isEmpty
(
codeStr
)
?
null
:
codeStr
.
split
(
","
);
}
public
static
Integer
[]
transStrToIntList
(
String
idsStr
)
{
if
(
StringUtils
.
isEmpty
(
idsStr
))
{
return
null
;
}
return
Arrays
.
stream
(
idsStr
.
split
(
","
)).
map
(
Integer:
:
parseInt
).
toArray
(
Integer
[]::
new
);
}
public
static
Long
[]
transStrToLongList
(
String
idsStr
)
{
if
(
StringUtils
.
isEmpty
(
idsStr
))
{
return
null
;
}
return
Arrays
.
stream
(
idsStr
.
split
(
","
)).
map
(
Long:
:
parseLong
).
toArray
(
Long
[]::
new
);
}
public
static
<
T
>
boolean
contains
(
T
[]
ts
,
T
t
)
{
if
(
ts
==
null
||
ts
.
length
==
0
)
{
return
false
;
}
for
(
T
src
:
ts
)
{
if
(
Objects
.
equals
(
src
,
t
))
{
return
true
;
}
}
return
false
;
}
public
static
<
T
>
boolean
isEmpty
(
T
[]
ts
)
{
return
ts
==
null
||
ts
.
length
==
0
;
}
}
soss-system/src/main/resources/mapper/system/CouponUserMapper.xml
View file @
968b4136
...
...
@@ -34,7 +34,8 @@
<select
id=
"listCustAvailableCoupon"
resultType=
"com.soss.system.domain.vo.CouponVo"
>
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
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
<include
refid=
"selectCustAvailableCoupon"
/>
</select>
...
...
@@ -44,7 +45,10 @@
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} and cr.use_start_time
<
#{nowTime} and cu.expired_time > #{nowTime}
and cu.state = ${@com.soss.common.enums.CouponUserState @DEFAULT.getState}
and cu.state = ${@com.soss.common.enums.CouponUserState @EFFECTIVE.getState}
<if
test=
"couponId != null"
>
and c.id = #{couponId}
</if>
</sql>
<select
id=
"selectCouponUserList"
resultType=
"com.soss.system.domain.vo.CouponUserVo"
>
...
...
soss-system/src/main/resources/mapper/system/GoodsSkuMapper.xml
View file @
968b4136
...
...
@@ -8,10 +8,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"id"
column=
"id"
/>
<result
property=
"goodsId"
column=
"goods_id"
/>
<result
property=
"ruleList"
column=
"rule_list"
/>
<result
property=
"isDeleted"
column=
"is_deleted"
/>
<result
property=
"createdAt"
column=
"created_at"
/>
<result
property=
"updatedAt"
column=
"updated_at"
/>
<result
property=
"price"
column=
"price"
/>
<result
property=
"isDeleted"
column=
"is_deleted"
/>
<result
property=
"createdAt"
column=
"created_at"
/>
<result
property=
"updatedAt"
column=
"updated_at"
/>
<result
property=
"price"
column=
"price"
/>
<result
property=
"discount"
column=
"discount"
/>
</resultMap>
...
...
@@ -19,15 +19,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, goods_id, rule_list, is_deleted, created_at, updated_at, price,discount from goods_sku
</sql>
<select
id=
"selectSkuListForOrder"
resultMap=
"GoodsSkuResult"
>
select id, goods_id, discount from goods_sku where id in
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
</select>
<select
id=
"selectGoodsSkuList"
parameterType=
"GoodsSku"
resultMap=
"GoodsSkuResult"
>
<include
refid=
"selectGoodsSkuVo"
/>
<where>
and is_deleted =0
<if
test=
"goodsId != null and goodsId != ''"
>
and goods_id = #{goodsId}
</if>
<if
test=
"ruleList != null and ruleList != ''"
>
and rule_list = #{ruleList}
</if>
<if
test=
"isDeleted != null and isDeleted != ''"
>
and is_deleted = #{isDeleted}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"goodsId != null and goodsId != ''"
>
and goods_id = #{goodsId}
</if>
<if
test=
"ruleList != null and ruleList != ''"
>
and rule_list = #{ruleList}
</if>
<if
test=
"isDeleted != null and isDeleted != ''"
>
and is_deleted = #{isDeleted}
</if>
<if
test=
"createdAt != null "
>
and created_at = #{createdAt}
</if>
<if
test=
"updatedAt != null "
>
and updated_at = #{updatedAt}
</if>
<if
test=
"price != null "
>
and price = #{price}
</if>
<if
test=
"discount != null "
>
and discount = #{discount}
</if>
</where>
...
...
soss-system/src/main/resources/mapper/system/OrderDetailMapper.xml
View file @
968b4136
...
...
@@ -11,7 +11,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"goodsName"
column=
"goods_name"
/>
<result
property=
"machineId"
column=
"machine_id"
/>
<result
property=
"num"
column=
"num"
/>
<result
property=
"amount"
column=
"amount"
/>
<result
property=
"viewAmount"
column=
"view_amount"
/>
<result
property=
"amountShould"
column=
"amount_should"
/>
<result
property=
"couponAmount"
column=
"coupon_amount"
/>
<result
property=
"realAmount"
column=
"real_amount"
/>
<result
property=
"specRuleDetail"
column=
"spec_rule_detail"
/>
<result
property=
"specRuleIds"
column=
"spec_rule_ids"
/>
...
...
@@ -33,7 +35,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"goodsName != null and goodsName != ''"
>
and goods_name like concat('%', #{goodsName}, '%')
</if>
<if
test=
"machineId != null and machineId != ''"
>
and machine_id = #{machineId}
</if>
<if
test=
"num != null and num != ''"
>
and num = #{num}
</if>
<if
test=
"amount != null "
>
and amount = #{amount}
</if>
<if
test=
"viewAmount != null "
>
and view_amount = #{viewAmount}
</if>
<if
test=
"amountShould != null "
>
and amount_should = #{amountShould}
</if>
<if
test=
"couponAmount != null "
>
and coupon_amount = #{couponAmount}
</if>
<if
test=
"realAmount != null "
>
and real_amount = #{realAmount}
</if>
<if
test=
"specRuleDetail != null and specRuleDetail != ''"
>
and spec_rule_detail = #{specRuleDetail}
</if>
<if
test=
"specRuleIds != null and specRuleIds != ''"
>
and spec_rule_ids = #{specRuleIds}
</if>
...
...
@@ -57,7 +61,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"goodsName != null and goodsName != ''"
>
goods_name,
</if>
<if
test=
"machineId != null and machineId != ''"
>
machine_id,
</if>
<if
test=
"num != null and num != ''"
>
num,
</if>
<if
test=
"amount != null"
>
amount,
</if>
<if
test=
"viewAmount != null"
>
view_amount,
</if>
<if
test=
"amountShould != null"
>
amount_should,
</if>
<if
test=
"couponAmount != null"
>
coupon_amount,
</if>
<if
test=
"realAmount != null"
>
real_amount,
</if>
<if
test=
"specRuleDetail != null and specRuleDetail != ''"
>
spec_rule_detail,
</if>
<if
test=
"specRuleIds != null and specRuleIds != ''"
>
spec_rule_ids,
</if>
...
...
@@ -72,7 +78,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"goodsName != null and goodsName != ''"
>
#{goodsName},
</if>
<if
test=
"machineId != null and machineId != ''"
>
#{machineId},
</if>
<if
test=
"num != null and num != ''"
>
#{num},
</if>
<if
test=
"amount != null"
>
#{amount},
</if>
<if
test=
"viewAmount != null"
>
#{viewAmount},
</if>
<if
test=
"amountShould != null"
>
#{amountShould},
</if>
<if
test=
"couponAmount != null"
>
#{couponAmount},
</if>
<if
test=
"realAmount != null"
>
#{realAmount},
</if>
<if
test=
"specRuleDetail != null and specRuleDetail != ''"
>
#{specRuleDetail},
</if>
<if
test=
"specRuleIds != null and specRuleIds != ''"
>
#{specRuleIds},
</if>
...
...
@@ -91,7 +99,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"goodsName != null and goodsName != ''"
>
goods_name = #{goodsName},
</if>
<if
test=
"machineId != null and machineId != ''"
>
machine_id = #{machineId},
</if>
<if
test=
"num != null and num != ''"
>
num = #{num},
</if>
<if
test=
"amount != null"
>
amount = #{amount},
</if>
<if
test=
"viewAmount != null"
>
view_amount = #{viewAmount},
</if>
<if
test=
"amountShould != null"
>
amount_should = #{amountShould},
</if>
<if
test=
"couponAmount != null"
>
coupon_amount = #{couponAmount},
</if>
<if
test=
"realAmount != null"
>
real_amount = #{realAmount},
</if>
<if
test=
"specRuleDetail != null and specRuleDetail != ''"
>
spec_rule_detail = #{specRuleDetail},
</if>
<if
test=
"specRuleIds != null and specRuleIds != ''"
>
spec_rule_ids = #{specRuleIds},
</if>
...
...
soss-system/src/main/resources/mapper/system/OrderMapper.xml
View file @
968b4136
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.soss.system.mapper.OrderMapper"
>
<resultMap
type=
"Order"
id=
"OrderResult"
>
...
...
@@ -14,6 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"payTime"
column=
"pay_time"
/>
<result
property=
"finishTime"
column=
"finish_time"
/>
<result
property=
"amount"
column=
"amount"
/>
<result
property=
"couponId"
column=
"coupon_id"
/>
<result
property=
"couponAmount"
column=
"coupon_amount"
/>
<result
property=
"paidAmount"
column=
"paid_amount"
/>
<result
property=
"goodsNum"
column=
"goods_num"
/>
<result
property=
"pickCode"
column=
"pick_code"
/>
<result
property=
"shopId"
column=
"shop_id"
/>
...
...
@@ -39,6 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"payTime != null "
>
and pay_time = #{payTime}
</if>
<if
test=
"finishTime != null "
>
and finish_time = #{finishTime}
</if>
<if
test=
"amount != null "
>
and amount = #{amount}
</if>
<if
test=
"couponId != null "
>
and coupon_id = #{couponId}
</if>
<if
test=
"couponAmount != null "
>
and coupon_amount = #{couponAmount}
</if>
<if
test=
"paidAmount != null "
>
and paid_amount = #{paidAmount}
</if>
<if
test=
"goodsNum != null and goodsNum != ''"
>
and goods_num = #{goodsNum}
</if>
<if
test=
"pickCode != null and pickCode != ''"
>
and pick_code = #{pickCode}
</if>
<if
test=
"shopId != null and shopId != ''"
>
and shop_id = #{shopId}
</if>
...
...
@@ -67,6 +73,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"payTime != null"
>
pay_time,
</if>
<if
test=
"finishTime != null"
>
finish_time,
</if>
<if
test=
"amount != null"
>
amount,
</if>
<if
test=
"couponId != null"
>
coupon_id,
</if>
<if
test=
"couponAmount != null"
>
coupon_amount,
</if>
<if
test=
"paidAmount != null"
>
paid_amount,
</if>
<if
test=
"goodsNum != null and goodsNum != ''"
>
goods_num,
</if>
<if
test=
"pickCode != null and pickCode != ''"
>
pick_code,
</if>
<if
test=
"shopId != null and shopId != ''"
>
shop_id,
</if>
...
...
@@ -85,6 +94,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"payTime != null"
>
#{payTime},
</if>
<if
test=
"finishTime != null"
>
#{finishTime},
</if>
<if
test=
"amount != null"
>
#{amount},
</if>
<if
test=
"couponId != null"
>
#{couponId},
</if>
<if
test=
"couponAmount != null"
>
#{couponAmount},
</if>
<if
test=
"paidAmount != null"
>
#{paidAmount},
</if>
<if
test=
"goodsNum != null and goodsNum != ''"
>
#{goodsNum},
</if>
<if
test=
"pickCode != null and pickCode != ''"
>
#{pickCode},
</if>
<if
test=
"shopId != null and shopId != ''"
>
#{shopId},
</if>
...
...
@@ -107,6 +119,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"payTime != null"
>
pay_time = #{payTime},
</if>
<if
test=
"finishTime != null"
>
finish_time = #{finishTime},
</if>
<if
test=
"amount != null"
>
amount = #{amount},
</if>
<if
test=
"couponId != null"
>
coupon_id = #{couponId},
</if>
<if
test=
"couponAmount != null"
>
coupon_amount = #{couponAmount},
</if>
<if
test=
"paidAmount != null"
>
paid_amount = #{paidAmount},
</if>
<if
test=
"goodsNum != null and goodsNum != ''"
>
goods_num = #{goodsNum},
</if>
<if
test=
"pickCode != null and pickCode != ''"
>
pick_code = #{pickCode},
</if>
<if
test=
"shopId != null and shopId != ''"
>
shop_id = #{shopId},
</if>
...
...
@@ -278,4 +293,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update
id=
"updateCancel"
>
update `order` set state='8' where state =#{status} and updated_at
<
DATE_SUB(NOW() ,interval #{timeout} SECOND)
</update>
<select
id=
"getCustOrderSimpleStat"
resultType=
"java.util.Map"
>
select count(*) orderCount, sum(amount) orderAmount from `order` where user_id = #{custId}
</select>
</mapper>
\ No newline at end of file
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