Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
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
wxShop
api
Commits
58469903
Commit
58469903
authored
Aug 10, 2020
by
不悦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
“ycf0810
parent
aac575c1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
1884 additions
and
7 deletions
+1884
-7
CouponController.java
...java/com/yami/shop/admin/controller/CouponController.java
+45
-0
MerchantController.java
...va/com/yami/shop/admin/controller/MerchantController.java
+37
-0
pom.xml
yami-shop-api/pom.xml
+30
-0
BargainController.java
.../java/com/yami/shop/api/controller/BargainController.java
+7
-1
CouponController.java
...n/java/com/yami/shop/api/controller/CouponController.java
+65
-0
MerchantController.java
...java/com/yami/shop/api/controller/MerchantController.java
+217
-0
OrderController.java
...in/java/com/yami/shop/api/controller/OrderController.java
+1
-1
QiNiuYunController.java
...java/com/yami/shop/api/controller/QiNiuYunController.java
+34
-0
TransferController.java
...java/com/yami/shop/api/controller/TransferController.java
+0
-0
ConfirmOrderListener.java
...java/com/yami/shop/api/listener/ConfirmOrderListener.java
+2
-1
SubmitOrderListener.java
.../java/com/yami/shop/api/listener/SubmitOrderListener.java
+5
-3
CollectionUtil.java
...n/java/com/zero/jimu/utils/withdrawal/CollectionUtil.java
+76
-0
HttpUtils.java
...c/main/java/com/zero/jimu/utils/withdrawal/HttpUtils.java
+0
-0
PayUtil.java
...src/main/java/com/zero/jimu/utils/withdrawal/PayUtil.java
+138
-0
XmlUtil.java
...src/main/java/com/zero/jimu/utils/withdrawal/XmlUtil.java
+90
-0
apiclient_cert.p12
yami-shop-api/src/main/resources/apiclient_cert.p12
+0
-0
ConfirmOrderEvent.java
...main/java/com/yami/shop/bean/event/ConfirmOrderEvent.java
+5
-0
SubmitOrderEvent.java
.../main/java/com/yami/shop/bean/event/SubmitOrderEvent.java
+5
-0
ChargeOff.java
...ean/src/main/java/com/yami/shop/bean/model/ChargeOff.java
+38
-0
Coupon.java
...p-bean/src/main/java/com/yami/shop/bean/model/Coupon.java
+56
-0
Merchant.java
...bean/src/main/java/com/yami/shop/bean/model/Merchant.java
+81
-0
QiNiu.java
...op-bean/src/main/java/com/yami/shop/bean/model/QiNiu.java
+9
-0
UserCoupon.java
...an/src/main/java/com/yami/shop/bean/model/UserCoupon.java
+33
-0
WxPayParm.java
...ean/src/main/java/com/yami/shop/bean/model/WxPayParm.java
+11
-0
ResultVO.java
...op-bean/src/main/java/com/yami/shop/bean/vo/ResultVO.java
+85
-0
AppConnectMapper.java
...ain/java/com/yami/shop/security/dao/AppConnectMapper.java
+3
-0
AppConnectService.java
...ava/com/yami/shop/security/service/AppConnectService.java
+1
-0
AppConnectServiceImpl.java
...ami/shop/security/service/impl/AppConnectServiceImpl.java
+5
-0
AppConnectMapper.xml
...p-security/src/main/resources/mapper/AppConnectMapper.xml
+4
-0
BargainHelpMapper.java
...ce/src/main/java/com/yami/shop/dao/BargainHelpMapper.java
+1
-0
BargainSendMapper.java
...ce/src/main/java/com/yami/shop/dao/BargainSendMapper.java
+2
-0
ChargeOffMapper.java
...vice/src/main/java/com/yami/shop/dao/ChargeOffMapper.java
+12
-0
CouponMapper.java
...service/src/main/java/com/yami/shop/dao/CouponMapper.java
+32
-0
MerchantMapper.java
...rvice/src/main/java/com/yami/shop/dao/MerchantMapper.java
+19
-0
UserCouponMapper.java
...ice/src/main/java/com/yami/shop/dao/UserCouponMapper.java
+16
-0
ChargeOffService.java
...src/main/java/com/yami/shop/service/ChargeOffService.java
+12
-0
CouponService.java
...ce/src/main/java/com/yami/shop/service/CouponService.java
+23
-0
MerchantService.java
.../src/main/java/com/yami/shop/service/MerchantService.java
+18
-0
SmsLogService.java
...ce/src/main/java/com/yami/shop/service/SmsLogService.java
+2
-0
UserCouponService.java
...rc/main/java/com/yami/shop/service/UserCouponService.java
+12
-0
BargainServiceImpl.java
...n/java/com/yami/shop/service/impl/BargainServiceImpl.java
+17
-0
ChargeOffServiceImpl.java
...java/com/yami/shop/service/impl/ChargeOffServiceImpl.java
+28
-0
CouponServiceImpl.java
...in/java/com/yami/shop/service/impl/CouponServiceImpl.java
+71
-0
MerchantServiceImpl.java
.../java/com/yami/shop/service/impl/MerchantServiceImpl.java
+62
-0
OrderServiceImpl.java
...ain/java/com/yami/shop/service/impl/OrderServiceImpl.java
+1
-1
SmsLogServiceImpl.java
...in/java/com/yami/shop/service/impl/SmsLogServiceImpl.java
+15
-0
UserCouponServiceImpl.java
...ava/com/yami/shop/service/impl/UserCouponServiceImpl.java
+46
-0
BargainHelpMapper.xml
...p-service/src/main/resources/mapper/BargainHelpMapper.xml
+4
-0
BargainSendMapper.xml
...p-service/src/main/resources/mapper/BargainSendMapper.xml
+4
-0
ChargeOffMapper.xml
...hop-service/src/main/resources/mapper/ChargeOffMapper.xml
+69
-0
CouponMapper.xml
yami-shop-service/src/main/resources/mapper/CouponMapper.xml
+224
-0
MerchantMapper.xml
...shop-service/src/main/resources/mapper/MerchantMapper.xml
+0
-0
UserCouponMapper.xml
...op-service/src/main/resources/mapper/UserCouponMapper.xml
+111
-0
No files found.
yami-shop-admin/src/main/java/com/yami/shop/admin/controller/CouponController.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
admin
.
controller
;
import
com.yami.shop.bean.model.Coupon
;
import
com.yami.shop.service.CouponService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/coupon"
)
@Api
(
tags
=
"优惠卷"
)
public
class
CouponController
{
@Autowired
private
CouponService
couponService
;
@PostMapping
(
"/selectAdminCouponList"
)
@ApiOperation
(
value
=
"获取优惠卷列表"
,
notes
=
"获取优惠卷列表"
)
public
ResponseEntity
<
List
<
Coupon
>>
selectAdminCouponList
(
@Valid
@RequestBody
Coupon
coupon
)
{
List
<
Coupon
>
merchantList
=
couponService
.
selectAdminCouponList
(
coupon
);
return
ResponseEntity
.
ok
(
merchantList
);
}
@PostMapping
(
"/edit"
)
@ApiOperation
(
value
=
"修改"
,
notes
=
"修改"
)
public
ResponseEntity
<
String
>
edit
(
@Valid
@RequestBody
Coupon
coupon
)
{
couponService
.
updateByPrimaryKeySelective
(
coupon
);
return
ResponseEntity
.
ok
().
build
();
}
@PostMapping
(
"/save"
)
@ApiOperation
(
value
=
"新增优惠卷"
,
notes
=
"新增优惠卷"
)
public
ResponseEntity
<
String
>
save
(
@Valid
@RequestBody
Coupon
coupon
)
{
couponService
.
insertSelective
(
coupon
);
return
ResponseEntity
.
ok
().
build
();
}
@GetMapping
(
"/delete/{couponId}"
)
@ApiOperation
(
value
=
"删除优惠卷"
,
notes
=
"删除优惠卷"
)
public
ResponseEntity
<
String
>
delete
(
@PathVariable
(
"couponId"
)
Long
couponId
)
{
couponService
.
deleteByPrimaryKey
(
couponId
);
return
ResponseEntity
.
ok
().
build
();
}
}
yami-shop-admin/src/main/java/com/yami/shop/admin/controller/MerchantController.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
admin
.
controller
;
import
com.yami.shop.bean.model.Merchant
;
import
com.yami.shop.service.MerchantService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/merchant"
)
@Api
(
tags
=
"商户"
)
public
class
MerchantController
{
@Autowired
private
MerchantService
merchantService
;
@PostMapping
(
"/selectMerchantList"
)
@ApiOperation
(
value
=
"获取商户列表"
,
notes
=
"获取商户列表"
)
public
ResponseEntity
<
List
<
Merchant
>>
selectMerchantList
(
@Valid
@RequestBody
Merchant
merchant
)
{
List
<
Merchant
>
merchantList
=
merchantService
.
selectMerchantList
(
merchant
);
return
ResponseEntity
.
ok
(
merchantList
);
}
@PostMapping
(
"/edit"
)
@ApiOperation
(
value
=
"审核"
,
notes
=
"审核"
)
public
ResponseEntity
<
String
>
edit
(
@Valid
@RequestBody
Merchant
merchant
)
{
merchantService
.
updateByPrimaryKeySelective
(
merchant
);
return
ResponseEntity
.
ok
().
build
();
}
}
yami-shop-api/pom.xml
View file @
58469903
...
...
@@ -34,6 +34,36 @@
<artifactId>
jdom
</artifactId>
<version>
2.0.2
</version>
</dependency>
<!--七牛云上传相关-->
<dependency>
<groupId>
com.qiniu
</groupId>
<artifactId>
qiniu-java-sdk
</artifactId>
<version>
7.2.11
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.squareup.okhttp3
</groupId>
<artifactId>
okhttp
</artifactId>
<version>
3.3.1
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.6.2
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.qiniu
</groupId>
<artifactId>
happy-dns-java
</artifactId>
<version>
0.1.4
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.github.wxpay
</groupId>
<artifactId>
wxpay-sdk
</artifactId>
<version>
0.0.3
</version>
</dependency>
</dependencies>
<build>
...
...
yami-shop-api/src/main/java/com/yami/shop/api/controller/BargainController.java
View file @
58469903
...
...
@@ -193,7 +193,10 @@ public class BargainController {
for
(
BargainHelp
bargainHelp:
bargainHelpList
){
cutMoneys
+=
bargainHelp
.
getBargainMoney
();
}
double
canCut
=
product
.
getPrice
()-
cutMoneys
;
//能砍的价格
double
canCut
=
product
.
getPrice
()-
cutMoneys
-
bargain
.
getMinPrice
();
//能砍的价格
if
(
canCut
==
0
){
return
ResponseEntity
.
ok
(
"已砍到最低价"
);
}
double
randNumber
=
0
;
//对比
Random
rand
=
new
Random
();
...
...
@@ -231,7 +234,10 @@ public class BargainController {
MIN
=
bargain
.
getNewMin
();
}
if
(
canCut
<
MAX
){
randNumber
=
rand
.
nextDouble
()
*
(
MAX
-
MIN
)
+
MIN
;
if
(
randNumber
>
canCut
){
randNumber
=
canCut
;
}
}
else
{
randNumber
=
rand
.
nextDouble
()
*
(
MAX
-
MIN
)
+
MIN
;
}
...
...
yami-shop-api/src/main/java/com/yami/shop/api/controller/CouponController.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
api
.
controller
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.yami.shop.bean.model.Coupon
;
import
com.yami.shop.bean.model.UserCoupon
;
import
com.yami.shop.security.util.SecurityUtils
;
import
com.yami.shop.service.CouponService
;
import
com.yami.shop.service.UserCouponService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/coupon"
)
@Api
(
tags
=
"优惠卷"
)
public
class
CouponController
{
@Autowired
private
CouponService
couponService
;
@Autowired
private
UserCouponService
userCouponService
;
@PostMapping
(
"/info"
)
@ApiOperation
(
value
=
"优选活动(领卷中心)"
,
notes
=
"优选活动(领卷中心)"
)
public
ResponseEntity
<
List
<
Coupon
>>
info
(
@Valid
@RequestBody
Coupon
coupon
)
{
List
<
Coupon
>
couponList
=
couponService
.
selectCouponList
(
coupon
);
return
ResponseEntity
.
ok
(
couponList
);
}
@PostMapping
(
"/saveUserCoupon"
)
@ApiOperation
(
value
=
"领取优惠券"
,
notes
=
"领取优惠券"
)
public
ResponseEntity
<
HashMap
>
saveUserCoupon
(
@Valid
@RequestBody
UserCoupon
userCoupon
)
{
HashMap
map
=
new
HashMap
();
String
userId
=
SecurityUtils
.
getUser
().
getUserId
();
userCoupon
.
setUserId
(
userId
);
UserCoupon
u
=
userCouponService
.
selectMyUserCoupon
(
userId
,
userCoupon
.
getCouponId
());
if
(
ObjectUtil
.
isNotNull
(
u
)){
map
.
put
(
"code"
,
"已领取该优惠券"
);
return
ResponseEntity
.
ok
(
map
);
}
Coupon
coupon
=
couponService
.
selectByPrimaryKey
(
userCoupon
.
getCouponId
());
if
(
coupon
.
getNum
()>
0
){
userCouponService
.
insertSelective
(
userCoupon
);
map
.
put
(
"code"
,
"领劵成功"
);
}
else
{
map
.
put
(
"code"
,
"该优惠券数量为零"
);
}
return
ResponseEntity
.
ok
(
map
);
}
@PostMapping
(
"/selectMyCouponList"
)
@ApiOperation
(
value
=
"我的优惠券"
,
notes
=
"我的优惠券"
)
public
ResponseEntity
<
List
<
Coupon
>>
selectMyCouponList
(
@Valid
@RequestBody
UserCoupon
userCoupon
)
{
String
userId
=
SecurityUtils
.
getUser
().
getUserId
();
userCoupon
.
setUserId
(
userId
);
List
<
Coupon
>
couponList
=
couponService
.
selectMyCouponList
(
userCoupon
);
return
ResponseEntity
.
ok
(
couponList
);
}
}
yami-shop-api/src/main/java/com/yami/shop/api/controller/MerchantController.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
api
.
controller
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yami.shop.bean.model.ChargeOff
;
import
com.yami.shop.bean.model.Coupon
;
import
com.yami.shop.bean.model.Merchant
;
import
com.yami.shop.bean.model.UserCoupon
;
import
com.yami.shop.security.util.SecurityUtils
;
import
com.yami.shop.service.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Random
;
@RestController
@RequestMapping
(
"/merchant"
)
@Api
(
tags
=
"商户"
)
public
class
MerchantController
{
@Autowired
private
MerchantService
merchantService
;
@Autowired
private
CouponService
couponService
;
@Autowired
private
SmsLogService
smsLogService
;
@Autowired
private
UserCouponService
userCouponService
;
@Autowired
private
ChargeOffService
chargeOffService
;
@GetMapping
(
"/selectByUserId"
)
@ApiOperation
(
value
=
"商家入驻"
,
notes
=
"商家入驻"
)
public
ResponseEntity
<
Merchant
>
selectByUserId
()
{
String
userId
=
SecurityUtils
.
getUser
().
getUserId
();
Merchant
merchant
=
merchantService
.
selectByUserId
(
userId
);
return
ResponseEntity
.
ok
(
merchant
);
}
@PostMapping
(
"/save"
)
@ApiOperation
(
value
=
"商家入驻(注册)"
,
notes
=
"商家入驻(注册)"
)
public
HashMap
save
(
@Valid
@RequestBody
Merchant
merchant
)
{
HashMap
map
=
new
HashMap
();
List
<
Merchant
>
merchantList
=
merchantService
.
list
(
new
LambdaQueryWrapper
<
Merchant
>()
.
eq
(
Merchant:
:
getContactPhone
,
merchant
.
getContactPhone
()));
if
(
merchantList
.
size
()>
0
){
map
.
put
(
"code"
,
"该手机号已注册"
);
return
map
;
}
String
checkoutUtil
=
smsLogService
.
smsCheckout
(
merchant
.
getContactPhone
(),
merchant
.
getCode
());
if
(!
checkoutUtil
.
equals
(
"验证通过"
)){
map
.
put
(
"code"
,
"验证不通过"
);
return
map
;
}
String
userId
=
SecurityUtils
.
getUser
().
getUserId
();
merchant
.
setStatus
(
0
);
//未填写
merchant
.
setCreatedUser
(
userId
);
merchant
.
setCreatedAt
(
new
Date
());
merchant
.
setUpdateTime
(
new
Date
());
merchant
.
setMerchantPassword
(
DigestUtils
.
md5Hex
(
merchant
.
getMerchantPassword
()));
Long
merchantId
=
merchantService
.
insertSelective
(
merchant
);
Merchant
m
=
merchantService
.
selectByPrimaryKey
(
merchantId
);
map
.
put
(
"merchant"
,
m
);
return
map
;
}
@PostMapping
(
"/edit"
)
@ApiOperation
(
value
=
"修改商户信息(填写资料)"
,
notes
=
"修改商户信息(填写资料)"
)
public
ResponseEntity
<
String
>
edit
(
@Valid
@RequestBody
Merchant
merchant
)
{
merchantService
.
updateByPrimaryKeySelective
(
merchant
);
return
ResponseEntity
.
ok
().
build
();
}
@PostMapping
(
"/login"
)
@ApiOperation
(
value
=
"我的门店登录"
,
notes
=
"我的门店登录"
)
public
HashMap
login
(
@Valid
@RequestBody
Merchant
merchant
)
{
HashMap
map
=
new
HashMap
();
String
checkoutUtil
=
smsLogService
.
smsCheckout
(
merchant
.
getContactPhone
(),
merchant
.
getCode
());
map
.
put
(
"code"
,
checkoutUtil
);
if
(
checkoutUtil
.
equals
(
"验证通过"
)){
Merchant
m
=
merchantService
.
selectByContactPhone
(
merchant
.
getContactPhone
());
if
(
ObjectUtil
.
isNotNull
(
m
)){
if
(
DigestUtils
.
md5Hex
(
merchant
.
getMerchantPassword
()).
equals
(
m
.
getMerchantPassword
())){
map
.
put
(
"merchant"
,
m
);
}
else
{
map
.
put
(
"code"
,
"密码错误"
);
}
}
}
return
map
;
}
@PostMapping
(
"/forget"
)
@ApiOperation
(
value
=
"我的门店忘记密码"
,
notes
=
"我的门店忘记密码"
)
public
HashMap
forget
(
@Valid
@RequestBody
Merchant
merchant
)
{
HashMap
map
=
new
HashMap
();
String
checkoutUtil
=
smsLogService
.
smsCheckout
(
merchant
.
getContactPhone
(),
merchant
.
getCode
());
map
.
put
(
"code"
,
checkoutUtil
);
if
(
checkoutUtil
.
equals
(
"验证通过"
)){
Merchant
m
=
merchantService
.
selectByContactPhone
(
merchant
.
getContactPhone
());
if
(
ObjectUtil
.
isNotNull
(
m
)){
merchant
.
setMerchantPassword
(
DigestUtils
.
md5Hex
(
merchant
.
getNewPassword
()));
merchantService
.
updateByPhone
(
merchant
);
map
.
put
(
"code"
,
"密码修改成功"
);
}
}
return
map
;
}
@PostMapping
(
"/editPassword"
)
@ApiOperation
(
value
=
"我的门店修改密码"
,
notes
=
"我的门店修改密码"
)
public
HashMap
editPassword
(
@Valid
@RequestBody
Merchant
merchant
)
{
HashMap
map
=
new
HashMap
();
Merchant
m
=
merchantService
.
selectByContactPhone
(
merchant
.
getContactPhone
());
if
(
ObjectUtil
.
isNotNull
(
m
)){
if
(
DigestUtils
.
md5Hex
(
merchant
.
getMerchantPassword
()).
equals
(
m
.
getMerchantPassword
())){
merchant
.
setMerchantPassword
(
DigestUtils
.
md5Hex
(
merchant
.
getNewPassword
()));
merchantService
.
updateByPhone
(
merchant
);
map
.
put
(
"code"
,
"密码修改成功"
);
}
else
{
map
.
put
(
"code"
,
"密码错误"
);
}
}
return
map
;
}
@PostMapping
(
"/selectNearbyMerchant"
)
@ApiOperation
(
value
=
"优选活动(附近商户)"
,
notes
=
"获取附近商户"
)
public
ResponseEntity
<
List
<
Merchant
>>
selectNearbyMerchant
(
@Valid
@RequestBody
Merchant
merchant
)
{
List
<
Merchant
>
merchantList
=
merchantService
.
selectNearbyMerchant
(
merchant
);
if
(
merchantList
.
size
()>
0
){
for
(
Merchant
m:
merchantList
){
List
<
Coupon
>
couponList
=
couponService
.
selectByMerchantId
(
m
.
getMerchantId
());
merchant
.
setCouponList
(
couponList
);
if
(
couponList
.
size
()>
0
){
double
amount
=
0.0
;
for
(
Coupon
coupon:
couponList
){
amount
+=
coupon
.
getCouponAmount
();
}
m
.
setCouponAmount
(
amount
);
}
}
}
return
ResponseEntity
.
ok
(
merchantList
);
}
@GetMapping
(
"/selectByPrimaryKey/{merchantId}"
)
@ApiOperation
(
value
=
"商家信息"
,
notes
=
"商家信息"
)
public
ResponseEntity
<
Merchant
>
selectByPrimaryKey
(
@PathVariable
(
"merchantId"
)
Long
merchantId
)
{
Merchant
merchantList
=
merchantService
.
selectByPrimaryKey
(
merchantId
);
List
<
Coupon
>
couponList
=
couponService
.
selectByMerchantId
(
merchantId
);
merchantList
.
setCouponList
(
couponList
);
return
ResponseEntity
.
ok
(
merchantList
);
}
@PostMapping
(
"/chargeOff"
)
@ApiOperation
(
value
=
"扫码核销or填写优惠码核销"
,
notes
=
"扫码核销or填写优惠码核销"
)
@Transactional
public
HashMap
chargeOff
(
@Valid
@RequestBody
ChargeOff
chargeOff
)
{
HashMap
map
=
new
HashMap
();
Coupon
coupon
=
userCouponService
.
selectCouponByNumber
(
chargeOff
.
getCouponNumber
());
if
(
coupon
.
getCouponType
()
==
1
){
if
(
coupon
.
getMerchantId
()
!=
chargeOff
.
getMerchantId
()){
map
.
put
(
"code"
,
"该优惠券不是本店的优惠券"
);
return
map
;
}
}
Date
date
=
new
Date
();
if
(
coupon
.
getStartTime
().
getTime
()>
date
.
getTime
()||
date
.
getTime
()>
coupon
.
getOverTime
().
getTime
())
{
map
.
put
(
"code"
,
"目前不是该优惠券活动时间"
);
return
map
;
}
if
(
coupon
.
getUcStatus
()
==
0
){
map
.
put
(
"code"
,
"该优惠券已使用"
);
return
map
;
}
chargeOff
.
setChargeOffAmount
(
coupon
.
getCouponAmount
());
//核销金额
chargeOff
.
setMerchantIncome
(
coupon
.
getCouponAmount
()+
coupon
.
getMerchantAmount
());
//我的收入
chargeOff
.
setCreatedAt
(
new
Date
());
chargeOffService
.
insertSelective
(
chargeOff
);
Merchant
merchant
=
merchantService
.
selectByPrimaryKey
(
chargeOff
.
getMerchantId
());
merchant
.
setMerchantBalance
(
merchant
.
getMerchantBalance
()+
coupon
.
getCouponAmount
()+
coupon
.
getMerchantAmount
());
merchantService
.
updateByPrimaryKeySelective
(
merchant
);
UserCoupon
userCoupon
=
new
UserCoupon
();
userCoupon
.
setUserCouponId
(
coupon
.
getUserCouponId
());
userCoupon
.
setStatus
(
0
);
userCouponService
.
updateByPrimaryKeySelective
(
userCoupon
);
map
.
put
(
"code"
,
"核销成功"
);
return
map
;
}
@GetMapping
(
"/selectChargeOffList/{merchantId}"
)
@ApiOperation
(
value
=
"核销记录"
,
notes
=
"核销记录"
)
public
ResponseEntity
<
List
<
ChargeOff
>>
selectChargeOffList
(
@PathVariable
(
"merchantId"
)
Long
merchantId
)
{
return
ResponseEntity
.
ok
(
chargeOffService
.
selectChargeOffList
(
merchantId
));
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
DigestUtils
.
md5Hex
(
"12345678"
));
Random
random
=
new
Random
();
System
.
out
.
println
(
random
.
nextInt
(
2
));
}
}
yami-shop-api/src/main/java/com/yami/shop/api/controller/OrderController.java
View file @
58469903
...
...
@@ -123,7 +123,7 @@ public class OrderController {
shopCartOrder
.
setShopCartItemDiscounts
(
shopCartItemDiscounts
);
applicationContext
.
publishEvent
(
new
ConfirmOrderEvent
(
shopCartOrder
,
orderParam
,
shopAllShopCartItems
));
applicationContext
.
publishEvent
(
new
ConfirmOrderEvent
(
shopCartOrder
,
orderParam
,
shopAllShopCartItems
,
orderParam
.
getOrderItem
().
getIsBargain
()
));
actualTotal
=
Arith
.
add
(
actualTotal
,
shopCartOrder
.
getActualTotal
());
total
=
Arith
.
add
(
total
,
shopCartOrder
.
getTotal
());
totalCount
=
totalCount
+
shopCartOrder
.
getTotalCount
();
...
...
yami-shop-api/src/main/java/com/yami/shop/api/controller/QiNiuYunController.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
api
.
controller
;
import
cn.hutool.core.lang.UUID
;
import
com.qiniu.util.Auth
;
import
com.qiniu.util.StringMap
;
import
com.yami.shop.bean.model.QiNiu
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/qiNiu"
)
@Api
(
tags
=
"七牛云"
)
public
class
QiNiuYunController
{
// 获取 七牛云的 token
@RequestMapping
(
value
=
"/getToken"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"七牛云"
,
notes
=
"七牛云"
)
public
QiNiu
getToken
()
{
QiNiu
qiNiu
=
new
QiNiu
();
String
accessKey
=
"f-hGiQbSWdHJTHWWJsv5tr_MZ_aerL74WVKdz01W"
;
String
secretKey
=
"6dmqNFgMGP_H6K4obnEPjQbMMf6m2EvXlf7WHDfo"
;
String
bucket
=
"kszz-jkkm"
;
long
expireSeconds
=
600
;
//过期时间
StringMap
putPolicy
=
new
StringMap
();
Auth
auth
=
Auth
.
create
(
accessKey
,
secretKey
);
String
upToken
=
auth
.
uploadToken
(
bucket
,
null
,
expireSeconds
,
putPolicy
);
qiNiu
.
setKey
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"\\-"
,
""
));
qiNiu
.
setToken
(
upToken
);
return
qiNiu
;
}
}
yami-shop-api/src/main/java/com/yami/shop/api/controller/TransferController.java
0 → 100644
View file @
58469903
This diff is collapsed.
Click to expand it.
yami-shop-api/src/main/java/com/yami/shop/api/listener/ConfirmOrderListener.java
View file @
58469903
...
...
@@ -85,10 +85,11 @@ public class ConfirmOrderListener {
if
(
product
==
null
||
sku
==
null
)
{
throw
new
YamiShopBindException
(
"购物车包含无法识别的商品"
);
}
if
(!
event
.
getIsBargain
().
equals
(
"1"
)){
if
(
product
.
getStatus
()
!=
1
||
sku
.
getStatus
()
!=
1
)
{
throw
new
YamiShopBindException
(
"商品["
+
sku
.
getProdName
()
+
"]已下架"
);
}
}
totalCount
=
shopCartItem
.
getProdCount
()
+
totalCount
;
total
=
Arith
.
add
(
shopCartItem
.
getProductTotalAmount
(),
total
);
// 用户地址如果为空,则表示该用户从未设置过任何地址相关信息
...
...
yami-shop-api/src/main/java/com/yami/shop/api/listener/SubmitOrderListener.java
View file @
58469903
...
...
@@ -121,7 +121,7 @@ public class SubmitOrderListener {
List
<
ShopCartItemDto
>
shopCartItems
=
shopCartItemDiscount
.
getShopCartItems
();
for
(
ShopCartItemDto
shopCartItem
:
shopCartItems
)
{
Sku
sku
=
checkAndGetSku
(
shopCartItem
.
getSkuId
(),
shopCartItem
,
skuStocksMap
);
Product
product
=
checkAndGetProd
(
shopCartItem
.
getProdId
(),
shopCartItem
,
prodStocksMap
);
Product
product
=
checkAndGetProd
(
shopCartItem
.
getProdId
(),
shopCartItem
,
prodStocksMap
,
event
.
getIsBargain
()
);
OrderItem
orderItem
=
new
OrderItem
();
orderItem
.
setShopId
(
shopId
);
...
...
@@ -234,15 +234,17 @@ public class SubmitOrderListener {
}
@SuppressWarnings
({
"Duplicates"
})
private
Product
checkAndGetProd
(
Long
prodId
,
ShopCartItemDto
shopCartItem
,
Map
<
Long
,
Product
>
prodStocksMap
)
{
private
Product
checkAndGetProd
(
Long
prodId
,
ShopCartItemDto
shopCartItem
,
Map
<
Long
,
Product
>
prodStocksMap
,
String
isBargain
)
{
Product
product
=
productService
.
getProductByProdId
(
prodId
);
if
(
product
==
null
)
{
throw
new
YamiShopBindException
(
"购物车包含无法识别的商品"
);
}
if
(!
isBargain
.
equals
(
"1"
)){
if
(
product
.
getStatus
()
!=
1
)
{
throw
new
YamiShopBindException
(
"商品["
+
product
.
getProdName
()
+
"]已下架"
);
}
}
// 商品需要改变的库存
Product
mapProduct
=
prodStocksMap
.
get
(
prodId
);
...
...
yami-shop-api/src/main/java/com/zero/jimu/utils/withdrawal/CollectionUtil.java
0 → 100644
View file @
58469903
package
com
.
zero
.
jimu
.
utils
.
withdrawal
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
/**
* 集合类工具
*/
public
class
CollectionUtil
{
private
CollectionUtil
()
{
super
();
}
// 判断一个集合是否为空
public
static
<
T
>
boolean
isEmpty
(
Collection
<
T
>
col
)
{
if
(
col
==
null
||
col
.
isEmpty
())
{
return
true
;
}
return
false
;
}
// 判断一个集合是否不为空
public
static
<
T
>
boolean
isNotEmpty
(
Collection
<
T
>
col
)
{
return
!
isEmpty
(
col
);
}
// 判断Map是否为空
public
static
<
K
,
V
>
boolean
isEmpty
(
Map
<
K
,
V
>
map
)
{
if
(
map
==
null
||
map
.
isEmpty
())
{
return
true
;
}
return
false
;
}
// 判断Map是否不为空为空
public
static
<
K
,
V
>
boolean
isNotEmpty
(
Map
<
K
,
V
>
map
)
{
return
!
isEmpty
(
map
);
}
// 去除list中的重复数据
public
static
<
T
>
List
<
T
>
removeRepeat
(
List
<
T
>
list
)
{
if
(
isEmpty
(
list
))
{
return
list
;
}
List
<
T
>
result
=
new
ArrayList
<
T
>();
for
(
T
e
:
list
)
{
if
(!
result
.
contains
(
e
))
{
result
.
add
(
e
);
}
}
return
result
;
}
// 将集合转换为String数组
public
static
<
T
>
String
[]
toArray
(
List
<
T
>
list
)
{
if
(
isEmpty
(
list
))
{
return
null
;
}
String
[]
result
=
new
String
[
list
.
size
()];
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
result
[
i
]
=
String
.
valueOf
(
list
.
get
(
i
));
}
return
result
;
}
}
\ No newline at end of file
yami-shop-api/src/main/java/com/zero/jimu/utils/withdrawal/HttpUtils.java
0 → 100644
View file @
58469903
This diff is collapsed.
Click to expand it.
yami-shop-api/src/main/java/com/zero/jimu/utils/withdrawal/PayUtil.java
0 → 100644
View file @
58469903
package
com
.
zero
.
jimu
.
utils
.
withdrawal
;
import
cn.hutool.core.util.StrUtil
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.*
;
public
class
PayUtil
{
/**
* 生成订单号
*
* @return
*/
public
static
String
getTradeNo
()
{
// 自增8位数 00000001
Random
random
=
new
Random
();
return
"TNO"
+
System
.
currentTimeMillis
()
+
random
.
nextInt
(
1000000
);
}
/**
* 退款单号
*
* @return
*/
public
static
String
getRefundNo
()
{
// 自增8位数 00000001
Random
random
=
new
Random
();
return
"RNO"
+
System
.
currentTimeMillis
()
+
random
.
nextInt
(
1000000
);
}
/**
* 退款单号
*
* @return
*/
public
static
String
getTransferNo
()
{
// 自增8位数 00000001
Random
random
=
new
Random
();
return
"TNO"
+
System
.
currentTimeMillis
()
+
random
.
nextInt
(
1000000
);
}
/**
* 返回客户端ip
*
* @param request
* @return
*/
public
static
String
getRemoteAddrIp
(
HttpServletRequest
request
)
{
String
ip
=
request
.
getHeader
(
"X-Forwarded-For"
);
if
(
StrUtil
.
isNotEmpty
(
ip
)
&&
!
"unKnown"
.
equalsIgnoreCase
(
ip
))
{
// 多次反向代理后会有多个ip值,第一个ip才是真实ip
int
index
=
ip
.
indexOf
(
","
);
if
(
index
!=
-
1
)
{
return
ip
.
substring
(
0
,
index
);
}
else
{
return
ip
;
}
}
ip
=
request
.
getHeader
(
"X-Real-IP"
);
if
(
StrUtil
.
isNotEmpty
(
ip
)
&&
!
"unKnown"
.
equalsIgnoreCase
(
ip
))
{
return
ip
;
}
return
request
.
getRemoteAddr
();
}
/**
* 获取服务器的ip地址
*
* @param request
* @return
*/
public
static
String
getLocalIp
(
HttpServletRequest
request
)
{
return
request
.
getLocalAddr
();
}
// public static String getSign(Map<String, String> params, String paternerKey) throws UnsupportedEncodingException {
// return Encrypt.getMD5(createSign(params, false) + "&key=" + paternerKey).toUpperCase();
// }
/**
* 构造签名
*
* @param params
* @param encode
* @return
* @throws UnsupportedEncodingException
*/
public
static
String
createSign
(
Map
<
String
,
String
>
params
,
boolean
encode
)
throws
UnsupportedEncodingException
{
Set
<
String
>
keysSet
=
params
.
keySet
();
Object
[]
keys
=
keysSet
.
toArray
();
Arrays
.
sort
(
keys
);
StringBuffer
temp
=
new
StringBuffer
();
boolean
first
=
true
;
for
(
Object
key
:
keys
)
{
if
(
key
==
null
||
StrUtil
.
isEmpty
(
params
.
get
(
key
)))
// 参数为空不参与签名
continue
;
if
(
first
)
{
first
=
false
;
}
else
{
temp
.
append
(
"&"
);
}
temp
.
append
(
key
).
append
(
"="
);
Object
value
=
params
.
get
(
key
);
String
valueStr
=
""
;
if
(
null
!=
value
)
{
valueStr
=
value
.
toString
();
}
if
(
encode
)
{
temp
.
append
(
URLEncoder
.
encode
(
valueStr
,
"UTF-8"
));
}
else
{
temp
.
append
(
valueStr
);
}
}
return
temp
.
toString
();
}
/**
* 创建支付随机字符串
* @return
*/
public
static
String
getNonceStr
(){
String
s
=
UUID
.
randomUUID
().
toString
();
// 去掉“-”符号
return
s
.
replaceAll
(
"\\-"
,
""
).
toUpperCase
();
}
/**
* 支付时间戳
* @return
*/
public
static
String
payTimestamp
()
{
return
Long
.
toString
(
System
.
currentTimeMillis
()
/
1000
);
}
}
\ No newline at end of file
yami-shop-api/src/main/java/com/zero/jimu/utils/withdrawal/XmlUtil.java
0 → 100644
View file @
58469903
package
com
.
zero
.
jimu
.
utils
.
withdrawal
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
org.xmlpull.v1.XmlPullParser
;
import
org.xmlpull.v1.XmlPullParserException
;
import
org.xmlpull.v1.XmlPullParserFactory
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map.Entry
;
public
class
XmlUtil
{
private
static
final
String
PREFIX_XML
=
"<xml>"
;
private
static
final
String
SUFFIX_XML
=
"</xml>"
;
private
static
final
String
PREFIX_CDATA
=
"<![CDATA["
;
private
static
final
String
SUFFIX_CDATA
=
"]]>"
;
/**
* 转化成xml, 单层无嵌套
*
* @param parm
* @param isAddCDATA
* @return
*/
public
static
String
xmlFormat
(
Map
<
String
,
String
>
parm
,
boolean
isAddCDATA
)
{
StringBuffer
strbuff
=
new
StringBuffer
(
PREFIX_XML
);
if
(
CollectionUtil
.
isNotEmpty
(
parm
))
{
for
(
Entry
<
String
,
String
>
entry
:
parm
.
entrySet
())
{
strbuff
.
append
(
"<"
).
append
(
entry
.
getKey
()).
append
(
">"
);
if
(
isAddCDATA
)
{
strbuff
.
append
(
PREFIX_CDATA
);
if
(
StrUtil
.
isNotEmpty
(
entry
.
getValue
()))
{
strbuff
.
append
(
entry
.
getValue
());
}
strbuff
.
append
(
SUFFIX_CDATA
);
}
else
{
if
(
StrUtil
.
isNotEmpty
(
entry
.
getValue
()))
{
strbuff
.
append
(
entry
.
getValue
());
}
}
strbuff
.
append
(
"</"
).
append
(
entry
.
getKey
()).
append
(
">"
);
}
}
return
strbuff
.
append
(
SUFFIX_XML
).
toString
();
}
/**
* 解析xml
*
* @param xml
* @return
* @throws XmlPullParserException
* @throws IOException
*/
public
static
Map
<
String
,
String
>
xmlParse
(
String
xml
)
throws
XmlPullParserException
,
IOException
{
Map
<
String
,
String
>
map
=
null
;
if
(
StrUtil
.
isNotEmpty
(
xml
))
{
InputStream
inputStream
=
new
ByteArrayInputStream
(
xml
.
getBytes
());
XmlPullParser
pullParser
=
XmlPullParserFactory
.
newInstance
().
newPullParser
();
pullParser
.
setInput
(
inputStream
,
"UTF-8"
);
// 为xml设置要解析的xml数据
int
eventType
=
pullParser
.
getEventType
();
while
(
eventType
!=
XmlPullParser
.
END_DOCUMENT
)
{
switch
(
eventType
)
{
case
XmlPullParser
.
START_DOCUMENT
:
map
=
new
HashMap
<
String
,
String
>();
break
;
case
XmlPullParser
.
START_TAG
:
String
key
=
pullParser
.
getName
();
if
(
key
.
equals
(
"xml"
))
break
;
String
value
=
pullParser
.
nextText
().
trim
();
map
.
put
(
key
,
value
);
break
;
case
XmlPullParser
.
END_TAG
:
break
;
}
eventType
=
pullParser
.
next
();
}
}
return
map
;
}
}
yami-shop-api/src/main/resources/apiclient_cert.p12
0 → 100644
View file @
58469903
File added
yami-shop-bean/src/main/java/com/yami/shop/bean/event/ConfirmOrderEvent.java
View file @
58469903
...
...
@@ -42,4 +42,9 @@ public class ConfirmOrderEvent {
* 店铺中的所有商品项
*/
private
List
<
ShopCartItemDto
>
shopCartItems
;
/**
* 砍价进来
*/
private
String
isBargain
;
}
yami-shop-bean/src/main/java/com/yami/shop/bean/event/SubmitOrderEvent.java
View file @
58469903
...
...
@@ -34,4 +34,9 @@ public class SubmitOrderEvent {
private
List
<
Order
>
orders
;
/**
* 砍价进来
*/
private
String
isBargain
;
}
yami-shop-bean/src/main/java/com/yami/shop/bean/model/ChargeOff.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
bean
.
model
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
@TableName
(
"cftz_charge_off"
)
public
class
ChargeOff
{
@TableId
@ApiModelProperty
(
value
=
"核销主键自增"
,
required
=
false
)
private
Long
chargeOffId
;
@ApiModelProperty
(
value
=
"核销金额"
,
required
=
false
)
private
double
chargeOffAmount
;
@ApiModelProperty
(
value
=
"我的收入"
,
required
=
false
)
private
double
merchantIncome
;
@ApiModelProperty
(
value
=
"用户优惠卷id"
,
required
=
false
)
private
Long
userCouponId
;
@ApiModelProperty
(
value
=
"商户id"
,
required
=
false
)
private
Long
merchantId
;
@ApiModelProperty
(
value
=
"核销类型(0:线上核销;1:线下核销)"
,
required
=
false
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
false
)
private
Date
createdAt
;
@ApiModelProperty
(
value
=
"优惠码"
,
required
=
false
)
@TableField
(
exist
=
false
)
private
String
couponNumber
;
}
\ No newline at end of file
yami-shop-bean/src/main/java/com/yami/shop/bean/model/Coupon.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
bean
.
model
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
@TableName
(
"cftz_coupon"
)
public
class
Coupon
{
@TableId
@ApiModelProperty
(
value
=
"主键自增"
,
required
=
false
)
private
Long
couponId
;
@ApiModelProperty
(
value
=
"优惠金额"
,
required
=
false
)
private
double
couponAmount
;
@ApiModelProperty
(
value
=
"优惠券名称"
,
required
=
false
)
private
String
couponName
;
@ApiModelProperty
(
value
=
"发放数量"
,
required
=
false
)
private
Integer
num
;
@ApiModelProperty
(
value
=
"使用门槛"
,
required
=
false
)
private
double
usingThreshold
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
private
Date
startTime
;
@ApiModelProperty
(
value
=
"结束时间"
,
required
=
false
)
private
Date
overTime
;
@ApiModelProperty
(
value
=
"商户id"
,
required
=
false
)
private
Long
merchantId
;
@ApiModelProperty
(
value
=
"小程序id"
,
required
=
false
)
private
String
appId
;
@ApiModelProperty
(
value
=
"小程序路径"
,
required
=
false
)
private
String
appUrl
;
@ApiModelProperty
(
value
=
"优惠卷类型:(1:商家;2:通用)"
,
required
=
false
)
private
Integer
couponType
;
@ApiModelProperty
(
value
=
"状态(0:已过期;1:正常)"
,
required
=
false
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
false
)
private
Date
createdAt
;
@ApiModelProperty
(
value
=
"修改时间"
,
required
=
false
)
private
Date
updateAt
;
@ApiModelProperty
(
value
=
"商家额外获得的金额"
,
required
=
false
)
private
double
merchantAmount
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"优惠码"
,
required
=
false
)
private
String
couponNumber
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"用户优惠券表id"
,
required
=
false
)
private
Long
userCouponId
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"状态(0:已使用;1:未使用)"
,
required
=
false
)
private
Integer
ucStatus
;
}
\ No newline at end of file
yami-shop-bean/src/main/java/com/yami/shop/bean/model/Merchant.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
bean
.
model
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
@Data
@TableName
(
"cftz_merchant"
)
public
class
Merchant
{
@TableId
@ApiModelProperty
(
value
=
"主键自增"
,
required
=
false
)
private
Long
merchantId
;
@ApiModelProperty
(
value
=
"商家名称"
,
required
=
false
)
private
String
merchantName
;
@ApiModelProperty
(
value
=
"商家地址"
,
required
=
false
)
private
String
merchantAddr
;
@ApiModelProperty
(
value
=
"联系人"
,
required
=
false
)
private
String
contact
;
@ApiModelProperty
(
value
=
"联系电话"
,
required
=
false
)
private
String
contactPhone
;
@ApiModelProperty
(
value
=
"门店照片"
,
required
=
false
)
private
String
storePhotos
;
@ApiModelProperty
(
value
=
"店内环境照片"
,
required
=
false
)
private
String
environmentPhotos
;
@ApiModelProperty
(
value
=
"开店人身份证正面照片"
,
required
=
false
)
private
String
cardFrontPhotos
;
@ApiModelProperty
(
value
=
"开店人身份证反面照片"
,
required
=
false
)
private
String
cardBackPhotos
;
@ApiModelProperty
(
value
=
"开店人手持身份证正面照片"
,
required
=
false
)
private
String
cardHandPhotos
;
@ApiModelProperty
(
value
=
"营业执照"
,
required
=
false
)
private
String
businessPhotos
;
@ApiModelProperty
(
value
=
"许可证"
,
required
=
false
)
private
String
licencePhotos
;
@ApiModelProperty
(
value
=
"经度"
,
required
=
false
)
private
double
longitude
;
@ApiModelProperty
(
value
=
"纬度"
,
required
=
false
)
private
double
latitude
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
private
Date
startTime
;
@ApiModelProperty
(
value
=
"结束时间"
,
required
=
false
)
private
Date
overTime
;
@ApiModelProperty
(
value
=
"主营"
,
required
=
false
)
private
String
mainBusiness
;
@ApiModelProperty
(
value
=
"状态:(0:未填写;1,待审核;2,已审核)"
,
required
=
false
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"创建人id"
,
required
=
false
)
private
String
createdUser
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
false
)
private
Date
createdAt
;
@ApiModelProperty
(
value
=
"修改时间"
,
required
=
false
)
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"密码"
,
required
=
false
)
private
String
merchantPassword
;
@ApiModelProperty
(
value
=
"余额"
,
required
=
false
)
private
double
merchantBalance
;
@ApiModelProperty
(
value
=
"距离"
,
required
=
false
)
@TableField
(
exist
=
false
)
private
Long
juli
;
@ApiModelProperty
(
value
=
"优惠券金额"
,
required
=
false
)
@TableField
(
exist
=
false
)
private
double
couponAmount
;
@ApiModelProperty
(
value
=
"商店优惠券列表"
,
required
=
false
)
@TableField
(
exist
=
false
)
private
List
<
Coupon
>
couponList
;
@ApiModelProperty
(
value
=
"验证码"
,
required
=
false
)
@TableField
(
exist
=
false
)
private
String
code
;
@ApiModelProperty
(
value
=
"新密码"
,
required
=
false
)
@TableField
(
exist
=
false
)
private
String
newPassword
;
}
\ No newline at end of file
yami-shop-bean/src/main/java/com/yami/shop/bean/model/QiNiu.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
bean
.
model
;
import
lombok.Data
;
@Data
public
class
QiNiu
{
private
String
token
;
private
String
key
;
}
yami-shop-bean/src/main/java/com/yami/shop/bean/model/UserCoupon.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
bean
.
model
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
@Data
@TableName
(
"cftz_user_coupon"
)
public
class
UserCoupon
{
@TableId
@ApiModelProperty
(
value
=
"用户优惠券表id"
,
required
=
false
)
private
Long
userCouponId
;
@ApiModelProperty
(
value
=
"用户id"
,
required
=
false
)
private
String
userId
;
@ApiModelProperty
(
value
=
"优惠券id"
,
required
=
false
)
private
Long
couponId
;
@ApiModelProperty
(
value
=
"优惠码"
,
required
=
false
)
private
String
couponNumber
;
@ApiModelProperty
(
value
=
"创建时间"
,
required
=
false
)
private
Date
createAt
;
@ApiModelProperty
(
value
=
"修改时间"
,
required
=
false
)
private
Date
updateAt
;
@ApiModelProperty
(
value
=
"状态(0:已使用;1:未使用)"
,
required
=
false
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"我的优惠券类型(1:未使用;2:已使用;3:已过期)"
,
required
=
false
)
@TableField
(
exist
=
false
)
private
Integer
type
;
}
\ No newline at end of file
yami-shop-bean/src/main/java/com/yami/shop/bean/model/WxPayParm.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
bean
.
model
;
import
lombok.Data
;
@Data
public
class
WxPayParm
{
private
String
userId
;
private
double
amount
;
}
yami-shop-bean/src/main/java/com/yami/shop/bean/vo/ResultVO.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
bean
.
vo
;
/**
* result vo
*
* @author zm.xue
* @version 2019/1/4 v1.00 init
*/
@SuppressWarnings
(
"all"
)
public
class
ResultVO
<
T
>
{
private
Result
result
;
private
int
code
;
private
String
msg
;
private
T
object
;
public
ResultVO
(
Result
result
)
{
this
.
result
=
result
;
}
public
ResultVO
(
Result
result
,
T
object
)
{
this
.
result
=
result
;
this
.
object
=
object
;
}
public
int
getCode
()
{
return
result
.
code
;
}
public
String
getMsg
()
{
return
"["
+
result
.
code
+
"]"
+
result
.
msg
;
}
public
T
getObject
()
{
return
object
;
}
public
enum
Result
{
SUCCESS
(
200
,
"成功"
),
DATA_NOT_EXIST
(
300
,
"数据不存在,请刷新后重试"
),
DATA_EXIST
(
301
,
"已存在主键相同的数据"
),
ACCOUNT_OR_PASSWORD_ERROR
(
302
,
"账号不存在或密码错误"
),
MISS_ACCOUNT
(
303
,
"账号不存在"
),
OLD_PASSWORD_ERROR
(
304
,
"旧密码错误"
),
MISS_VIP_ERROR
(
308
,
"VIP用户无法登入后台"
),
MISS_PERMISSION
(
400
,
"缺少相关权限,请联系系统管理员"
),
LOGIN_LOSE
(
401
,
"登录失效,请重新登录"
),
FAIL
(
500
,
"系统异常,请联系系统管理员"
),
USERFAIL
(
501
,
"该用户不可提现"
),
MONEYFAIL
(
502
,
"申请提现金额不符:低于最小金额0.30元或高于5000.00元"
),
MONEYFAILTWO
(
503
,
"申请提现金额大于可提现金额"
),
MONEYFAILTHREE
(
505
,
"转账发生异常"
),
PAY_FAIL
(
506
,
"转账发生异常"
),
SMSCODEFAIL
(
509
,
"验证码不一致,请重新输入"
),
PHONE_UNREGISTERED
(
510
,
"该手机号未注册"
),
ERROR_WXAPI
(
511
,
"调用微信统一下单接口api失败"
),
LOSE_PARAM
(
512
,
"丢失关键参数"
),
INIT_USER_FAIL
(
514
,
"支付失败,请重试"
),
GOODS_AMOUNT_INSUFFICIENT
(
515
,
"您的货款已经不足,请联系管理员充值"
),
NOT_LEVELID
(
516
,
"level_id为空"
),
GOODS_AMOUNT_ERROR
(
517
,
"输入正确的货款"
),
NOT_MONEY_INSUFFICIENT
(
515
,
"余额不足"
),
NOT_PARENT
(
518
,
"没有找到此上级,请确认上级手机号是否正确"
),
UPLOADFAILURE
(
520
,
"上传失败,上传图片数据为空"
),
COMPANY_EXISTENCE
(
521
,
"该公司名已存在"
),
BANK_ERROR
(
519
,
"该用户不可提现"
);
private
int
code
;
private
String
msg
;
Result
(
int
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
}
}
yami-shop-security/src/main/java/com/yami/shop/security/dao/AppConnectMapper.java
View file @
58469903
...
...
@@ -23,4 +23,6 @@ public interface AppConnectMapper extends BaseMapper<AppConnect> {
AppConnect
getByUserId
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"appId"
)
Integer
appId
);
String
getUserIdByUnionId
(
@Param
(
"bizUnionId"
)
String
bizUnionId
);
String
getOpenIdByUserId
(
@Param
(
"userId"
)
String
userId
);
}
\ No newline at end of file
yami-shop-security/src/main/java/com/yami/shop/security/service/AppConnectService.java
View file @
58469903
...
...
@@ -22,4 +22,5 @@ import com.yami.shop.security.model.AppConnect;
public
interface
AppConnectService
extends
IService
<
AppConnect
>
{
AppConnect
getByBizUserId
(
String
bizUserId
,
App
app
);
String
getOpenIdByUserId
(
String
userId
);
}
yami-shop-security/src/main/java/com/yami/shop/security/service/impl/AppConnectServiceImpl.java
View file @
58469903
...
...
@@ -44,4 +44,9 @@ public class AppConnectServiceImpl extends ServiceImpl<AppConnectMapper, AppConn
return
appConnectMapper
.
getByBizUserId
(
bizUserId
,
app
.
value
());
}
@Override
public
String
getOpenIdByUserId
(
String
userId
)
{
return
appConnectMapper
.
getOpenIdByUserId
(
userId
);
}
}
yami-shop-security/src/main/resources/mapper/AppConnectMapper.xml
View file @
58469903
...
...
@@ -24,4 +24,7 @@
<select
id=
"getUserIdByUnionId"
resultType=
"java.lang.String"
>
SELECT user_id from tz_app_connect where biz_unionid = #{bizUnionId} limit 1
</select>
<select
id=
"getOpenIdByUserId"
resultType=
"java.lang.String"
>
SELECT biz_user_id from tz_app_connect where user_id = #{userId} limit 1
</select>
</mapper>
\ No newline at end of file
yami-shop-service/src/main/java/com/yami/shop/dao/BargainHelpMapper.java
View file @
58469903
...
...
@@ -10,4 +10,5 @@ public interface BargainHelpMapper extends BaseMapper<BargainHelp> {
List
<
BargainHelp
>
selectListByBargainOrderId
(
@Param
(
"bargainOrderId"
)
Long
bargainOrderId
);
BargainHelp
selectBargainHelp
(
@Param
(
"bargainOrderId"
)
Long
bargainOrderId
,
@Param
(
"assistorId"
)
String
assistorId
);
int
deleteByBargaiOrderId
(
@Param
(
"bargainOrderId"
)
Long
bargainOrderId
);
}
yami-shop-service/src/main/java/com/yami/shop/dao/BargainSendMapper.java
View file @
58469903
...
...
@@ -17,4 +17,6 @@ public interface BargainSendMapper extends BaseMapper<BargainSend> {
int
updateCount
(
@Param
(
"id"
)
Long
id
);
int
updateStatus
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"activityId"
)
Long
activityId
);
int
deleteByActivityId
(
@Param
(
"activityId"
)
Long
activityId
);
}
yami-shop-service/src/main/java/com/yami/shop/dao/ChargeOffMapper.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yami.shop.bean.model.ChargeOff
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
ChargeOffMapper
extends
BaseMapper
<
ChargeOff
>
{
List
<
ChargeOff
>
selectChargeOffList
(
@Param
(
"merchantId"
)
Long
merchantId
);
int
insertSelective
(
ChargeOff
chargeOff
);
}
yami-shop-service/src/main/java/com/yami/shop/dao/CouponMapper.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yami.shop.bean.model.Coupon
;
import
com.yami.shop.bean.model.UserCoupon
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
import
java.util.List
;
public
interface
CouponMapper
extends
BaseMapper
<
Coupon
>
{
Coupon
selectByPrimaryKey
(
Long
couponId
);
int
deleteByPrimaryKey
(
Long
couponId
);
int
insertSelective
(
Coupon
record
);
int
updateByPrimaryKeySelective
(
Coupon
record
);
List
<
Coupon
>
selectByMerchantId
(
@Param
(
"merchantId"
)
Long
merchantId
);
List
<
Coupon
>
selectCouponList
(
Coupon
coupon
);
List
<
Coupon
>
selectMyCouponList
(
UserCoupon
userCoupon
);
List
<
Coupon
>
selectAdminCouponList
(
Coupon
coupon
);
}
\ No newline at end of file
yami-shop-service/src/main/java/com/yami/shop/dao/MerchantMapper.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yami.shop.bean.model.Merchant
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
MerchantMapper
extends
BaseMapper
<
Merchant
>
{
int
updateByPrimaryKeySelective
(
Merchant
record
);
int
insertSelective
(
Merchant
record
);
List
<
Merchant
>
selectNearbyMerchant
(
Merchant
merchant
);
Merchant
selectByPrimaryKey
(
@Param
(
"merchantId"
)
Long
merchantId
);
Merchant
selectByUserId
(
@Param
(
"createdUser"
)
String
createdUser
);
Merchant
selectByContactPhone
(
@Param
(
"contactPhone"
)
String
contactPhone
);
int
updateByPhone
(
Merchant
merchant
);
List
<
Merchant
>
selectMerchantList
(
Merchant
merchant
);
}
yami-shop-service/src/main/java/com/yami/shop/dao/UserCouponMapper.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yami.shop.bean.model.Coupon
;
import
com.yami.shop.bean.model.UserCoupon
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
UserCouponMapper
extends
BaseMapper
<
UserCoupon
>
{
int
updateByPrimaryKeySelective
(
UserCoupon
record
);
int
insertSelective
(
UserCoupon
record
);
UserCoupon
selectMyUserCoupon
(
UserCoupon
record
);
int
deleteByCouponId
(
@Param
(
"couponId"
)
Long
couponId
);
Coupon
selectCouponByNumber
(
@Param
(
"couponNumber"
)
String
couponNumber
);
}
yami-shop-service/src/main/java/com/yami/shop/service/ChargeOffService.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yami.shop.bean.model.ChargeOff
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
ChargeOffService
extends
IService
<
ChargeOff
>
{
List
<
ChargeOff
>
selectChargeOffList
(
@Param
(
"merchantId"
)
Long
merchantId
);
int
insertSelective
(
ChargeOff
chargeOff
);
}
yami-shop-service/src/main/java/com/yami/shop/service/CouponService.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yami.shop.bean.model.Coupon
;
import
com.yami.shop.bean.model.UserCoupon
;
import
java.util.List
;
public
interface
CouponService
extends
IService
<
Coupon
>
{
Coupon
selectByPrimaryKey
(
Long
couponId
);
int
deleteByPrimaryKey
(
Long
couponId
);
int
insertSelective
(
Coupon
record
);
int
updateByPrimaryKeySelective
(
Coupon
record
);
List
<
Coupon
>
selectByMerchantId
(
Long
merchantId
);
List
<
Coupon
>
selectCouponList
(
Coupon
coupon
);
List
<
Coupon
>
selectMyCouponList
(
UserCoupon
userCoupon
);
List
<
Coupon
>
selectAdminCouponList
(
Coupon
coupon
);
}
yami-shop-service/src/main/java/com/yami/shop/service/MerchantService.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yami.shop.bean.model.Merchant
;
import
java.util.List
;
public
interface
MerchantService
extends
IService
<
Merchant
>
{
int
updateByPrimaryKeySelective
(
Merchant
record
);
Long
insertSelective
(
Merchant
record
);
List
<
Merchant
>
selectNearbyMerchant
(
Merchant
merchant
);
Merchant
selectByPrimaryKey
(
Long
merchantId
);
Merchant
selectByUserId
(
String
createdUser
);
Merchant
selectByContactPhone
(
String
contactPhone
);
void
updateByPhone
(
Merchant
merchant
);
List
<
Merchant
>
selectMerchantList
(
Merchant
merchant
);
}
yami-shop-service/src/main/java/com/yami/shop/service/SmsLogService.java
View file @
58469903
...
...
@@ -29,4 +29,6 @@ public interface SmsLogService extends IService<SmsLog> {
public
boolean
checkValidCode
(
String
mobile
,
String
code
,
SmsType
smsType
);
SmsLog
selectSmsByMobileAndType
(
String
mobile
,
Integer
status
);
String
smsCheckout
(
String
phone
,
String
code
);
}
yami-shop-service/src/main/java/com/yami/shop/service/UserCouponService.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yami.shop.bean.model.Coupon
;
import
com.yami.shop.bean.model.UserCoupon
;
public
interface
UserCouponService
extends
IService
<
UserCoupon
>
{
void
updateByPrimaryKeySelective
(
UserCoupon
record
);
int
insertSelective
(
UserCoupon
record
);
UserCoupon
selectMyUserCoupon
(
String
userId
,
Long
couponId
);
Coupon
selectCouponByNumber
(
String
couponNumber
);
}
yami-shop-service/src/main/java/com/yami/shop/service/impl/BargainServiceImpl.java
View file @
58469903
...
...
@@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.yami.shop.bean.model.Bargain
;
import
com.yami.shop.bean.model.BargainDetailParm
;
import
com.yami.shop.bean.model.BargainParm
;
import
com.yami.shop.bean.model.BargainSend
;
import
com.yami.shop.dao.BargainHelpMapper
;
import
com.yami.shop.dao.BargainMapper
;
import
com.yami.shop.dao.BargainSendMapper
;
import
com.yami.shop.service.BargainService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
...
...
@@ -15,6 +19,10 @@ import java.util.List;
public
class
BargainServiceImpl
extends
ServiceImpl
<
BargainMapper
,
Bargain
>
implements
BargainService
{
@Autowired
private
BargainMapper
bargainMapper
;
@Autowired
private
BargainSendMapper
bargainSendMapper
;
@Autowired
private
BargainHelpMapper
bargainHelpMapper
;
@Override
public
Long
insertSelective
(
Bargain
bargain
)
{
...
...
@@ -28,8 +36,17 @@ public class BargainServiceImpl extends ServiceImpl<BargainMapper, Bargain> impl
}
@Override
@Transactional
public
void
deleteByPrimaryKey
(
Long
id
)
{
bargainMapper
.
deleteByPrimaryKey
(
id
);
List
<
BargainSend
>
bargainSendList
=
bargainSendMapper
.
selectBargainSendList
(
id
);
if
(
bargainSendList
.
size
()>
0
){
for
(
BargainSend
bargainSend:
bargainSendList
){
bargainHelpMapper
.
deleteByBargaiOrderId
(
bargainSend
.
getId
());
}
}
bargainSendMapper
.
deleteByActivityId
(
id
);
}
@Override
...
...
yami-shop-service/src/main/java/com/yami/shop/service/impl/ChargeOffServiceImpl.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yami.shop.bean.model.ChargeOff
;
import
com.yami.shop.dao.ChargeOffMapper
;
import
com.yami.shop.service.ChargeOffService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
public
class
ChargeOffServiceImpl
extends
ServiceImpl
<
ChargeOffMapper
,
ChargeOff
>
implements
ChargeOffService
{
@Autowired
private
ChargeOffMapper
chargeOffMapper
;
@Override
public
List
<
ChargeOff
>
selectChargeOffList
(
Long
merchantId
)
{
return
chargeOffMapper
.
selectChargeOffList
(
merchantId
);
}
@Override
public
int
insertSelective
(
ChargeOff
chargeOff
)
{
return
chargeOffMapper
.
insertSelective
(
chargeOff
);
}
}
yami-shop-service/src/main/java/com/yami/shop/service/impl/CouponServiceImpl.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yami.shop.bean.model.Coupon
;
import
com.yami.shop.bean.model.UserCoupon
;
import
com.yami.shop.dao.CouponMapper
;
import
com.yami.shop.dao.UserCouponMapper
;
import
com.yami.shop.service.CouponService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
@Service
public
class
CouponServiceImpl
extends
ServiceImpl
<
CouponMapper
,
Coupon
>
implements
CouponService
{
@Autowired
private
CouponMapper
couponMapper
;
@Autowired
private
UserCouponMapper
userCouponMapper
;
@Override
public
Coupon
selectByPrimaryKey
(
Long
couponId
)
{
return
couponMapper
.
selectByPrimaryKey
(
couponId
);
}
@Override
@Transactional
public
int
deleteByPrimaryKey
(
Long
couponId
)
{
userCouponMapper
.
deleteByCouponId
(
couponId
);
return
couponMapper
.
deleteByPrimaryKey
(
couponId
);
}
@Override
@Transactional
public
int
insertSelective
(
Coupon
record
)
{
record
.
setStatus
(
1
);
record
.
setCreatedAt
(
new
Date
());
record
.
setUpdateAt
(
new
Date
());
return
couponMapper
.
insertSelective
(
record
);
}
@Override
@Transactional
public
int
updateByPrimaryKeySelective
(
Coupon
record
)
{
record
.
setUpdateAt
(
new
Date
());
return
couponMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
List
<
Coupon
>
selectByMerchantId
(
Long
merchantId
)
{
return
couponMapper
.
selectByMerchantId
(
merchantId
);
}
@Override
public
List
<
Coupon
>
selectCouponList
(
Coupon
coupon
)
{
coupon
.
setStartTime
(
new
Date
());
return
couponMapper
.
selectCouponList
(
coupon
);
}
@Override
public
List
<
Coupon
>
selectMyCouponList
(
UserCoupon
userCoupon
)
{
return
couponMapper
.
selectMyCouponList
(
userCoupon
);
}
@Override
public
List
<
Coupon
>
selectAdminCouponList
(
Coupon
coupon
)
{
return
couponMapper
.
selectAdminCouponList
(
coupon
);
}
}
yami-shop-service/src/main/java/com/yami/shop/service/impl/MerchantServiceImpl.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yami.shop.bean.model.Merchant
;
import
com.yami.shop.dao.MerchantMapper
;
import
com.yami.shop.service.MerchantService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Service
public
class
MerchantServiceImpl
extends
ServiceImpl
<
MerchantMapper
,
Merchant
>
implements
MerchantService
{
@Autowired
private
MerchantMapper
merchantMapper
;
@Override
@Transactional
public
int
updateByPrimaryKeySelective
(
Merchant
record
)
{
return
merchantMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
@Transactional
public
Long
insertSelective
(
Merchant
record
)
{
merchantMapper
.
insertSelective
(
record
);
return
record
.
getMerchantId
();
}
@Override
public
List
<
Merchant
>
selectNearbyMerchant
(
Merchant
merchant
)
{
return
merchantMapper
.
selectNearbyMerchant
(
merchant
);
}
@Override
public
Merchant
selectByPrimaryKey
(
Long
merchantId
)
{
return
merchantMapper
.
selectByPrimaryKey
(
merchantId
);
}
@Override
public
Merchant
selectByUserId
(
String
createdUser
)
{
return
merchantMapper
.
selectByUserId
(
createdUser
);
}
@Override
public
Merchant
selectByContactPhone
(
String
contactPhone
)
{
return
merchantMapper
.
selectByContactPhone
(
contactPhone
);
}
@Transactional
public
void
updateByPhone
(
Merchant
merchant
){
merchantMapper
.
updateByPhone
(
merchant
);
}
@Override
public
List
<
Merchant
>
selectMerchantList
(
Merchant
merchant
)
{
return
merchantMapper
.
selectMerchantList
(
merchant
);
}
}
yami-shop-service/src/main/java/com/yami/shop/service/impl/OrderServiceImpl.java
View file @
58469903
...
...
@@ -98,7 +98,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
mergerOrder
.
getShopCartOrders
().
get
(
0
).
setTotal
(
0.01
);
}
// 通过事务提交订单
eventPublisher
.
publishEvent
(
new
SubmitOrderEvent
(
mergerOrder
,
orderList
));
eventPublisher
.
publishEvent
(
new
SubmitOrderEvent
(
mergerOrder
,
orderList
,
isBargain
));
if
(
"1"
.
equals
(
isBargain
)){
for
(
Order
o:
orderList
){
o
.
setIsBargain
(
isBargain
);
...
...
yami-shop-service/src/main/java/com/yami/shop/service/impl/SmsLogServiceImpl.java
View file @
58469903
...
...
@@ -13,6 +13,7 @@ package com.yami.shop.service.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
com.aliyuncs.DefaultAcsClient
;
import
com.aliyuncs.IAcsClient
;
...
...
@@ -225,4 +226,18 @@ public class SmsLogServiceImpl extends ServiceImpl<SmsLogMapper, SmsLog> impleme
}
return
content
;
}
public
String
smsCheckout
(
String
phone
,
String
code
){
SmsLog
smsLog
=
smsLogMapper
.
selectSmsByMobileAndType
(
phone
,
1
);
if
(
ObjectUtil
.
isNull
(
smsLog
)){
return
"验证码已失效"
;
}
if
(!
code
.
equals
(
smsLog
.
getMobileCode
())){
return
"验证码错误"
;
}
if
((
System
.
currentTimeMillis
()-
smsLog
.
getRecDate
().
getTime
())>
1000
*
60
*
5
){
return
"验证码已过期"
;
}
return
"验证通过"
;
}
}
yami-shop-service/src/main/java/com/yami/shop/service/impl/UserCouponServiceImpl.java
0 → 100644
View file @
58469903
package
com
.
yami
.
shop
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yami.shop.bean.model.Coupon
;
import
com.yami.shop.bean.model.UserCoupon
;
import
com.yami.shop.dao.UserCouponMapper
;
import
com.yami.shop.service.UserCouponService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Random
;
@Service
public
class
UserCouponServiceImpl
extends
ServiceImpl
<
UserCouponMapper
,
UserCoupon
>
implements
UserCouponService
{
@Autowired
private
UserCouponMapper
userCouponMapper
;
@Override
public
void
updateByPrimaryKeySelective
(
UserCoupon
record
)
{
userCouponMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
int
insertSelective
(
UserCoupon
record
)
{
Random
random
=
new
Random
();
record
.
setCouponNumber
((
System
.
currentTimeMillis
()+
random
.
nextInt
(
1000
))+
""
);
record
.
setCreateAt
(
new
Date
());
record
.
setUpdateAt
(
new
Date
());
record
.
setStatus
(
1
);
//未使用
return
userCouponMapper
.
insertSelective
(
record
);
}
@Override
public
UserCoupon
selectMyUserCoupon
(
String
userId
,
Long
couponId
)
{
UserCoupon
userCoupon
=
new
UserCoupon
();
userCoupon
.
setUserId
(
userId
);
userCoupon
.
setCouponId
(
couponId
);
return
userCouponMapper
.
selectMyUserCoupon
(
userCoupon
);
}
@Override
public
Coupon
selectCouponByNumber
(
String
couponNumber
)
{
return
userCouponMapper
.
selectCouponByNumber
(
couponNumber
);
}
}
yami-shop-service/src/main/resources/mapper/BargainHelpMapper.xml
View file @
58469903
...
...
@@ -22,4 +22,8 @@
<select
id=
"selectBargainHelp"
resultType=
"com.yami.shop.bean.model.BargainHelp"
>
select * from tz_bargain_help WHERE bargain_order_id=#{bargainOrderId} and assistor_id = #{assistorId}
</select>
<delete
id=
"deleteByBargaiOrderId"
parameterType=
"java.lang.Long"
>
delete from tz_bargain_help
where bargain_order_id = #{bargainOrderId}
</delete>
</mapper>
yami-shop-service/src/main/resources/mapper/BargainSendMapper.xml
View file @
58469903
...
...
@@ -17,6 +17,10 @@
</resultMap>
<delete
id=
"deleteByActivityId"
parameterType=
"java.lang.Long"
>
delete from tz_bargain_send
where activity_id = #{activityId,jdbcType=BIGINT}
</delete>
<select
id=
"selectBargainSendList"
resultType=
"com.yami.shop.bean.model.BargainSend"
>
select bs.*,u.pic userImg from tz_bargain_send bs
left join tz_user u
...
...
yami-shop-service/src/main/resources/mapper/ChargeOffMapper.xml
0 → 100644
View file @
58469903
<?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" >
<mapper
namespace=
"com.yami.shop.dao.ChargeOffMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yami.shop.bean.model.ChargeOff"
>
<id
column=
"charge_off_id"
property=
"chargeOffId"
jdbcType=
"BIGINT"
/>
<result
column=
"charge_off_amount"
property=
"chargeOffAmount"
jdbcType=
"DECIMAL"
/>
<result
column=
"merchant_income"
property=
"merchantIncome"
jdbcType=
"DECIMAL"
/>
<result
column=
"user_coupon_id"
property=
"userCouponId"
jdbcType=
"BIGINT"
/>
<result
column=
"merchant_id"
property=
"merchantId"
jdbcType=
"BIGINT"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"INTEGER"
/>
<result
column=
"created_at"
property=
"createdAt"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<insert
id=
"insertSelective"
parameterType=
"com.yami.shop.bean.model.ChargeOff"
>
insert into cftz_charge_off
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"chargeOffAmount != null"
>
charge_off_amount,
</if>
<if
test=
"merchantIncome != null"
>
merchant_income,
</if>
<if
test=
"userCouponId != null"
>
user_coupon_id,
</if>
<if
test=
"merchantId != null"
>
merchant_id,
</if>
<if
test=
"type != null"
>
type,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"chargeOffAmount != null"
>
#{chargeOffAmount,jdbcType=DECIMAL},
</if>
<if
test=
"merchantIncome != null"
>
#{merchantIncome,jdbcType=DECIMAL},
</if>
<if
test=
"userCouponId != null"
>
#{userCouponId,jdbcType=BIGINT},
</if>
<if
test=
"merchantId != null"
>
#{merchantId,jdbcType=BIGINT},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=TINYINT},
</if>
<if
test=
"createdAt != null"
>
#{createdAt,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
*
from cftz_charge_off
where charge_off_id = #{chargeOffId,jdbcType=BIGINT}
</select>
<select
id=
"selectChargeOffList"
resultType=
"com.yami.shop.bean.model.ChargeOff"
>
select
*
from cftz_charge_off
where merchant_id = #{merchantId,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
yami-shop-service/src/main/resources/mapper/CouponMapper.xml
0 → 100644
View file @
58469903
<?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" >
<mapper
namespace=
"com.yami.shop.dao.CouponMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yami.shop.bean.model.Coupon"
>
<id
column=
"coupon_id"
property=
"couponId"
jdbcType=
"BIGINT"
/>
<result
column=
"coupon_amount"
property=
"couponAmount"
jdbcType=
"DECIMAL"
/>
<result
column=
"coupon_name"
property=
"couponName"
jdbcType=
"VARCHAR"
/>
<result
column=
"num"
property=
"num"
jdbcType=
"INTEGER"
/>
<result
column=
"using_threshold"
property=
"usingThreshold"
jdbcType=
"DECIMAL"
/>
<result
column=
"start_time"
property=
"startTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"over_time"
property=
"overTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"merchant_id"
property=
"merchantId"
jdbcType=
"BIGINT"
/>
<result
column=
"app_id"
property=
"appId"
jdbcType=
"VARCHAR"
/>
<result
column=
"app_url"
property=
"appUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"coupon_type"
property=
"couponType"
jdbcType=
"INTEGER"
/>
<result
column=
"status"
property=
"status"
jdbcType=
"INTEGER"
/>
<result
column=
"created_at"
property=
"createdAt"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_at"
property=
"updateAt"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"merchant_amount"
property=
"merchantAmount"
jdbcType=
"DECIMAL"
/>
<result
column=
"user_coupon_id"
property=
"userCouponId"
jdbcType=
"BIGINT"
/>
<result
column=
"coupon_number"
property=
"couponNumber"
jdbcType=
"VARCHAR"
/>
<result
column=
"ucStatus"
property=
"ucStatus"
jdbcType=
"INTEGER"
/>
</resultMap>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select *
from cftz_coupon
where coupon_id = #{couponId,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from cftz_coupon
where coupon_id = #{couponId,jdbcType=BIGINT}
</delete>
<insert
id=
"insertSelective"
parameterType=
"com.yami.shop.bean.model.Coupon"
>
insert into cftz_coupon
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"couponId != null"
>
coupon_id,
</if>
<if
test=
"couponAmount != null"
>
coupon_amount,
</if>
<if
test=
"couponName != null"
>
coupon_name,
</if>
<if
test=
"num != null"
>
num,
</if>
<if
test=
"usingThreshold != null"
>
using_threshold,
</if>
<if
test=
"startTime != null"
>
start_time,
</if>
<if
test=
"overTime != null"
>
over_time,
</if>
<if
test=
"merchantId != null"
>
merchant_id,
</if>
<if
test=
"appId != null"
>
app_id,
</if>
<if
test=
"appUrl != null"
>
app_url,
</if>
<if
test=
"couponType != null"
>
coupon_type,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"createdAt != null"
>
created_at,
</if>
<if
test=
"updateAt != null"
>
update_at,
</if>
<if
test=
"merchantAmount != null"
>
merchant_amount,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"couponId != null"
>
#{couponId,jdbcType=BIGINT},
</if>
<if
test=
"couponAmount != null"
>
#{couponAmount,jdbcType=DECIMAL},
</if>
<if
test=
"couponName != null"
>
#{couponName,jdbcType=VARCHAR},
</if>
<if
test=
"num != null"
>
#{num,jdbcType=INTEGER},
</if>
<if
test=
"usingThreshold != null"
>
#{usingThreshold,jdbcType=DECIMAL},
</if>
<if
test=
"startTime != null"
>
#{startTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"overTime != null"
>
#{overTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"merchantId != null"
>
#{merchantId,jdbcType=BIGINT},
</if>
<if
test=
"appId != null"
>
#{appId,jdbcType=VARCHAR},
</if>
<if
test=
"appUrl != null "
>
#{appUrl,jdbcType=VARCHAR},
</if>
<if
test=
"couponType != null"
>
#{couponType,jdbcType=INTEGER},
</if>
<if
test=
"status != null"
>
#{status,jdbcType=INTEGER},
</if>
<if
test=
"createdAt != null"
>
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateAt != null"
>
#{updateAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"merchantAmount != null"
>
#{merchantAmount,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.yami.shop.bean.model.Coupon"
>
update cftz_coupon
<set
>
<if
test=
"couponAmount != null"
>
coupon_amount = #{couponAmount,jdbcType=DECIMAL},
</if>
<if
test=
"couponName != null"
>
coupon_name = #{couponName,jdbcType=VARCHAR},
</if>
<if
test=
"num != null"
>
num = #{num,jdbcType=INTEGER},
</if>
<if
test=
"usingThreshold != null"
>
using_threshold = #{usingThreshold,jdbcType=DECIMAL},
</if>
<if
test=
"startTime != null"
>
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"overTime != null"
>
over_time = #{overTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"merchantId != null and merchantId != ''"
>
merchant_id = #{merchantId,jdbcType=BIGINT},
</if>
<if
test=
"appId != null and appId != ''"
>
app_id = #{appId,jdbcType=VARCHAR},
</if>
<if
test=
"appUrl !=null and appUrl !=''"
>
app_url = #{appUrl,jdbcType=VARCHAR},
</if>
<if
test=
"couponType != null"
>
coupon_type = #{couponType,jdbcType=INTEGER},
</if>
<if
test=
"status != null"
>
status = #{status,jdbcType=INTEGER},
</if>
<if
test=
"createdAt != null"
>
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateAt != null"
>
update_at = #{updateAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"merchantAmount != null"
>
merchant_amount = #{merchantAmount,jdbcType=DECIMAL},
</if>
</set>
where coupon_id = #{couponId,jdbcType=BIGINT}
</update>
<select
id=
"selectByMerchantId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
*
from cftz_coupon
where status = 1 and coupon_type = 1
and merchant_id = #{merchantId,jdbcType=BIGINT}
</select>
<select
id=
"selectCouponList"
resultMap=
"BaseResultMap"
parameterType=
"com.yami.shop.bean.model.Coupon"
>
select
c.*
,uc.coupon_number coupon_number
,uc.user_coupon_id user_coupon_id
from cftz_coupon c
left join cftz_user_coupon uc
on c.coupon_id = uc.coupon_id
where c.status = 1
and c.start_time
<
= #{startTime}
and c.over_time
>
= #{startTime}
<if
test=
"couponName !=null and couponName !=''"
>
and c.coupon_name like concat('%',#{couponName},'%')
</if>
group by c.coupon_id
</select>
<select
id=
"selectMyCouponList"
resultMap=
"BaseResultMap"
parameterType=
"com.yami.shop.bean.model.UserCoupon"
>
select c.*,
uc.coupon_number coupon_number,
uc.user_coupon_id user_coupon_id,
uc.status ucStatus
from cftz_user_coupon uc
LEFT JOIN cftz_coupon c
ON uc.coupon_id = c.coupon_id
where uc.user_id = #{userId}
group by uc.user_coupon_id
</select>
<select
id=
"selectAdminCouponList"
resultMap=
"BaseResultMap"
parameterType=
"com.yami.shop.bean.model.Coupon"
>
select *
from cftz_coupon
where 1=1
<if
test=
"couponName !=null and couponName != ''"
>
and coupon_name like concat('%',#{couponName},'%')
</if>
</select>
</mapper>
\ No newline at end of file
yami-shop-service/src/main/resources/mapper/MerchantMapper.xml
0 → 100644
View file @
58469903
This diff is collapsed.
Click to expand it.
yami-shop-service/src/main/resources/mapper/UserCouponMapper.xml
0 → 100644
View file @
58469903
<?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" >
<mapper
namespace=
"com.yami.shop.dao.UserCouponMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.yami.shop.bean.model.UserCoupon"
>
<id
column=
"user_coupon_id"
property=
"userCouponId"
jdbcType=
"BIGINT"
/>
<result
column=
"user_id"
property=
"userId"
jdbcType=
"VARCHAR"
/>
<result
column=
"coupon_id"
property=
"couponId"
jdbcType=
"BIGINT"
/>
<result
column=
"coupon_number"
property=
"couponNumber"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_at"
property=
"createAt"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_at"
property=
"updateAt"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"status"
property=
"status"
jdbcType=
"INTEGER"
/>
</resultMap>
<insert
id=
"insertSelective"
parameterType=
"com.yami.shop.bean.model.UserCoupon"
>
insert into cftz_user_coupon
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"userCouponId != null"
>
user_coupon_id,
</if>
<if
test=
"userId != null"
>
user_id,
</if>
<if
test=
"couponId != null"
>
coupon_id,
</if>
<if
test=
"couponNumber != null"
>
coupon_number,
</if>
<if
test=
"createAt != null"
>
create_at,
</if>
<if
test=
"updateAt != null"
>
update_at,
</if>
<if
test=
"status != null"
>
status,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"userCouponId != null"
>
#{userCouponId,jdbcType=BIGINT},
</if>
<if
test=
"userId != null"
>
#{userId,jdbcType=VARCHAR},
</if>
<if
test=
"couponId != null"
>
#{couponId,jdbcType=BIGINT},
</if>
<if
test=
"couponNumber != null"
>
#{couponNumber,jdbcType=VARCHAR},
</if>
<if
test=
"createAt != null"
>
#{createAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateAt != null"
>
#{updateAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"status != null"
>
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.yami.shop.bean.model.UserCoupon"
>
update cftz_user_coupon
<set
>
<if
test=
"userId != null"
>
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if
test=
"couponId != null"
>
coupon_id = #{couponId,jdbcType=BIGINT},
</if>
<if
test=
"couponNumber != null"
>
coupon_number = #{couponNumber,jdbcType=VARCHAR},
</if>
<if
test=
"createAt != null"
>
create_at = #{createAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateAt != null"
>
update_at = #{updateAt,jdbcType=TIMESTAMP},
</if>
<if
test=
"status != null"
>
status = #{status,jdbcType=INTEGER},
</if>
</set>
where user_coupon_id = #{userCouponId,jdbcType=BIGINT}
</update>
<select
id=
"selectMyUserCoupon"
resultMap=
"BaseResultMap"
parameterType=
"com.yami.shop.bean.model.UserCoupon"
>
select
*
from cftz_user_coupon
where status = 1
and user_id = #{userId}
and coupon_id = #{couponId,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByCouponId"
parameterType=
"java.lang.Long"
>
delete from cftz_user_coupon
where coupon_id = #{couponId,jdbcType=BIGINT}
</delete>
<select
id=
"selectCouponByNumber"
resultType=
"com.yami.shop.bean.model.Coupon"
parameterType=
"java.lang.String"
>
select
c.*,uc.user_coupon_id,uc.status ucStatus
from cftz_user_coupon uc
left join cftz_coupon c
on uc.coupon_id = c.coupon_id
where uc.coupon_number = #{couponNumber}
</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