Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
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
徐少华
midjourney-proxy
Commits
e06f5ca3
Commit
e06f5ca3
authored
Nov 26, 2019
by
阮思源
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-zdw-1001921' into 'master'
feat-1001921: 群打卡增加自定义优惠券 See merge request rays/pcloud-book!237
parents
d26a446a
8a4a43dd
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
807 additions
and
22 deletions
+807
-22
YesOrNoEnums.java
...c/main/java/com/pcloud/book/util/common/YesOrNoEnums.java
+27
-0
WeixinClockBiz.java
.../java/com/pcloud/book/weixinclock/biz/WeixinClockBiz.java
+9
-0
WeixinClockBizImpl.java
.../pcloud/book/weixinclock/biz/impl/WeixinClockBizImpl.java
+155
-14
WeixinClockCheckImpl.java
...oud/book/weixinclock/check/impl/WeixinClockCheckImpl.java
+6
-0
WeixinClockCouponDao.java
...com/pcloud/book/weixinclock/dao/WeixinClockCouponDao.java
+35
-0
WeixinClockDao.java
.../java/com/pcloud/book/weixinclock/dao/WeixinClockDao.java
+6
-0
WeixinClockUserCouponDao.java
...pcloud/book/weixinclock/dao/WeixinClockUserCouponDao.java
+19
-0
WeixinClockCouponDaoImpl.java
...d/book/weixinclock/dao/impl/WeixinClockCouponDaoImpl.java
+33
-0
WeixinClockDaoImpl.java
.../pcloud/book/weixinclock/dao/impl/WeixinClockDaoImpl.java
+5
-0
WeixinClockUserCouponDaoImpl.java
...ok/weixinclock/dao/impl/WeixinClockUserCouponDaoImpl.java
+26
-0
WeixinClockDto.java
.../java/com/pcloud/book/weixinclock/dto/WeixinClockDto.java
+38
-0
WeixinClock.java
.../java/com/pcloud/book/weixinclock/entity/WeixinClock.java
+22
-0
WeixinClockCoupon.java
...com/pcloud/book/weixinclock/entity/WeixinClockCoupon.java
+66
-0
WeixinClockUserCoupon.java
...pcloud/book/weixinclock/entity/WeixinClockUserCoupon.java
+19
-0
WeixinClockFacade.java
...com/pcloud/book/weixinclock/facade/WeixinClockFacade.java
+8
-0
WeixinClockFacadeImpl.java
...d/book/weixinclock/facade/impl/WeixinClockFacadeImpl.java
+10
-2
CouponRequestVO.java
...m/pcloud/book/weixinclock/vo/request/CouponRequestVO.java
+72
-0
GetClockCouponResponseVO.java
...ook/weixinclock/vo/response/GetClockCouponResponseVO.java
+75
-0
WeixinClock.Mapper.xml
.../main/resources/mapper/weixinclock/WeixinClock.Mapper.xml
+28
-5
WeixinClockCoupon.Mapper.xml
...resources/mapper/weixinclock/WeixinClockCoupon.Mapper.xml
+90
-0
WeixinClockGroupClassify.Mapper.xml
...es/mapper/weixinclock/WeixinClockGroupClassify.Mapper.xml
+3
-1
WeixinClockUserCoupon.Mapper.xml
...urces/mapper/weixinclock/WeixinClockUserCoupon.Mapper.xml
+55
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/util/common/YesOrNoEnums.java
0 → 100644
View file @
e06f5ca3
package
com
.
pcloud
.
book
.
util
.
common
;
/**
* @Describe: 是否枚举类
* @Author: zhangdongwei
* @Date: Create on 20:08 2019/11/18 0018
*/
public
enum
YesOrNoEnums
{
/**
* 是
*/
YES
(
1
),
/**
* 否
*/
NO
(
0
);
private
Integer
value
;
YesOrNoEnums
(
Integer
value
)
{
this
.
value
=
value
;
}
public
Integer
getValue
()
{
return
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/biz/WeixinClockBiz.java
View file @
e06f5ca3
...
@@ -5,6 +5,7 @@ import com.pcloud.book.group.vo.ListGroupClassifyParam;
...
@@ -5,6 +5,7 @@ import com.pcloud.book.group.vo.ListGroupClassifyParam;
import
com.pcloud.book.weixinclock.dto.ListWeixinClockRankDto
;
import
com.pcloud.book.weixinclock.dto.ListWeixinClockRankDto
;
import
com.pcloud.book.weixinclock.dto.RankDto
;
import
com.pcloud.book.weixinclock.dto.RankDto
;
import
com.pcloud.book.weixinclock.dto.WeixinClockDto
;
import
com.pcloud.book.weixinclock.dto.WeixinClockDto
;
import
com.pcloud.book.weixinclock.vo.response.GetClockCouponResponseVO
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
...
@@ -108,4 +109,12 @@ public interface WeixinClockBiz {
...
@@ -108,4 +109,12 @@ public interface WeixinClockBiz {
* 旧数据处理
* 旧数据处理
*/
*/
void
solveOldData
();
void
solveOldData
();
/**
* 获取群打卡奖励优惠券
* @param wxGroupId
* @param wechatUserId
* @return
*/
GetClockCouponResponseVO
getClockCoupon
(
String
wxGroupId
,
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/biz/impl/WeixinClockBizImpl.java
View file @
e06f5ca3
...
@@ -16,10 +16,12 @@ import com.pcloud.book.group.dao.BookGroupClassifyDao;
...
@@ -16,10 +16,12 @@ import com.pcloud.book.group.dao.BookGroupClassifyDao;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.vo.BookGroupClassifyVO
;
import
com.pcloud.book.group.vo.BookGroupClassifyVO
;
import
com.pcloud.book.group.vo.ListGroupClassifyParam
;
import
com.pcloud.book.group.vo.ListGroupClassifyParam
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.book.weixinclock.biz.WeixinClockBiz
;
import
com.pcloud.book.weixinclock.biz.WeixinClockBiz
;
import
com.pcloud.book.weixinclock.biz.WeixinClockPraiseBiz
;
import
com.pcloud.book.weixinclock.biz.WeixinClockPraiseBiz
;
import
com.pcloud.book.weixinclock.check.WeixinClockCheck
;
import
com.pcloud.book.weixinclock.check.WeixinClockCheck
;
import
com.pcloud.book.weixinclock.dao.WeixinClockBrowseDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockBrowseDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockCouponDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockMemberDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockMemberDao
;
...
@@ -27,17 +29,22 @@ import com.pcloud.book.weixinclock.dao.WeixinClockPraiseDao;
...
@@ -27,17 +29,22 @@ import com.pcloud.book.weixinclock.dao.WeixinClockPraiseDao;
import
com.pcloud.book.weixinclock.dao.WeixinClockPrizeRecordDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockPrizeRecordDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockRewardDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockRewardDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockTopicDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockTopicDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockUserCouponDao
;
import
com.pcloud.book.weixinclock.dto.DrawRewardDto
;
import
com.pcloud.book.weixinclock.dto.DrawRewardDto
;
import
com.pcloud.book.weixinclock.dto.ListWeixinClockRankDto
;
import
com.pcloud.book.weixinclock.dto.ListWeixinClockRankDto
;
import
com.pcloud.book.weixinclock.dto.RankDto
;
import
com.pcloud.book.weixinclock.dto.RankDto
;
import
com.pcloud.book.weixinclock.dto.WeixinClockDto
;
import
com.pcloud.book.weixinclock.dto.WeixinClockDto
;
import
com.pcloud.book.weixinclock.entity.WeixinClock
;
import
com.pcloud.book.weixinclock.entity.WeixinClock
;
import
com.pcloud.book.weixinclock.entity.WeixinClockBrowse
;
import
com.pcloud.book.weixinclock.entity.WeixinClockBrowse
;
import
com.pcloud.book.weixinclock.entity.WeixinClockCoupon
;
import
com.pcloud.book.weixinclock.entity.WeixinClockGroupClassify
;
import
com.pcloud.book.weixinclock.entity.WeixinClockGroupClassify
;
import
com.pcloud.book.weixinclock.entity.WeixinClockMember
;
import
com.pcloud.book.weixinclock.entity.WeixinClockMember
;
import
com.pcloud.book.weixinclock.entity.WeixinClockPraise
;
import
com.pcloud.book.weixinclock.entity.WeixinClockPraise
;
import
com.pcloud.book.weixinclock.entity.WeixinClockPrizeRecord
;
import
com.pcloud.book.weixinclock.entity.WeixinClockPrizeRecord
;
import
com.pcloud.book.weixinclock.entity.WeixinClockTopic
;
import
com.pcloud.book.weixinclock.entity.WeixinClockTopic
;
import
com.pcloud.book.weixinclock.entity.WeixinClockUserCoupon
;
import
com.pcloud.book.weixinclock.vo.request.CouponRequestVO
;
import
com.pcloud.book.weixinclock.vo.response.GetClockCouponResponseVO
;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
...
@@ -75,6 +82,7 @@ import org.slf4j.Logger;
...
@@ -75,6 +82,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Calendar
;
...
@@ -137,6 +145,10 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -137,6 +145,10 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
private
WeixinClockBrowseDao
weixinClockBrowseDao
;
private
WeixinClockBrowseDao
weixinClockBrowseDao
;
@Autowired
@Autowired
private
WeixinClockPraiseDao
weixinClockPraiseDao
;
private
WeixinClockPraiseDao
weixinClockPraiseDao
;
@Autowired
private
WeixinClockCouponDao
weixinClockCouponDao
;
@Autowired
private
WeixinClockUserCouponDao
weixinClockUserCouponDao
;
private
static
final
ThreadFactory
NAMED_THREAD_FACTORY
=
new
ThreadFactoryBuilder
()
private
static
final
ThreadFactory
NAMED_THREAD_FACTORY
=
new
ThreadFactoryBuilder
()
.
setNameFormat
(
"weixinclock-pool-%d"
).
build
();
.
setNameFormat
(
"weixinclock-pool-%d"
).
build
();
...
@@ -178,6 +190,14 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -178,6 +190,14 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
weixinClockDto
.
getWeixinClockRewards
().
forEach
(
e
->
e
.
setWeixinClockId
(
weixinClockId
));
weixinClockDto
.
getWeixinClockRewards
().
forEach
(
e
->
e
.
setWeixinClockId
(
weixinClockId
));
weixinClockRewardDao
.
batchInsert
(
weixinClockDto
.
getWeixinClockRewards
());
weixinClockRewardDao
.
batchInsert
(
weixinClockDto
.
getWeixinClockRewards
());
}
}
if
(
null
!=
weixinClockDto
.
getIsOpenCoupon
()
&&
weixinClockDto
.
getIsOpenCoupon
()
==
1
){
//新增打卡奖励优惠券
CouponRequestVO
vo
=
weixinClockDto
.
getCoupon
();
vo
.
setUserId
(
weixinClockDto
.
getCreateUser
());
WeixinClockCoupon
coupon
=
CouponRequestVO
.
valueToEntity
(
vo
);
coupon
.
setWeixinClockId
(
weixinClockId
);
weixinClockCouponDao
.
insert
(
coupon
);
}
return
weixinClockId
;
return
weixinClockId
;
}
}
...
@@ -306,15 +326,31 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -306,15 +326,31 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
weixinClockDto
.
getWeixinClockRewards
().
forEach
(
e
->
e
.
setWeixinClockId
(
weixinClockId
));
weixinClockDto
.
getWeixinClockRewards
().
forEach
(
e
->
e
.
setWeixinClockId
(
weixinClockId
));
weixinClockRewardDao
.
batchInsert
(
weixinClockDto
.
getWeixinClockRewards
());
weixinClockRewardDao
.
batchInsert
(
weixinClockDto
.
getWeixinClockRewards
());
}
}
if
(
weixinClockDto
.
getIsOpenCoupon
()
==
1
){
CouponRequestVO
vo
=
weixinClockDto
.
getCoupon
();
vo
.
setUserId
(
weixinClockDto
.
getCreateUser
());
WeixinClockCoupon
newCoupon
=
CouponRequestVO
.
valueToEntity
(
vo
);
newCoupon
.
setWeixinClockId
(
weixinClockId
);
WeixinClockCoupon
oldCoupon
=
weixinClockCouponDao
.
getBaseByClockId
(
weixinClockId
);
if
(
null
==
oldCoupon
){
//如果未设置过优惠券,则新增
weixinClockCouponDao
.
insert
(
newCoupon
);
}
else
{
//否则,修改
newCoupon
.
setId
(
oldCoupon
.
getId
());
weixinClockCouponDao
.
update
(
newCoupon
);
}
}
}
}
@Override
@Override
public
PageBeanNew
<
WeixinClockDto
>
listWeixinClock4Adviser
(
PageParam
pageParam
,
Map
<
String
,
Object
>
paramMap
)
throws
BizException
{
public
PageBeanNew
<
WeixinClockDto
>
listWeixinClock4Adviser
(
PageParam
pageParam
,
Map
<
String
,
Object
>
paramMap
)
throws
BizException
{
PageBeanNew
<
WeixinClockDto
>
clockDtoPage
=
weixinClockDao
.
listPageNew
(
pageParam
,
paramMap
,
"listWeixinClock4Adviser"
);
PageBeanNew
<
WeixinClockDto
>
clockDtoPage
=
weixinClockDao
.
listPageNew
(
pageParam
,
paramMap
,
"listWeixinClock4Adviser"
);
if
(
clockDtoPage
==
null
)
{
if
(
clockDtoPage
==
null
||
ListUtils
.
isEmpty
(
clockDtoPage
.
getRecordList
())
)
{
return
new
PageBeanNew
<>(
pageParam
.
getPageNum
(),
pageParam
.
getNumPerPage
(),
0
,
new
ArrayList
<>());
return
new
PageBeanNew
<>(
pageParam
.
getPageNum
(),
pageParam
.
getNumPerPage
(),
0
,
new
ArrayList
<>());
}
}
List
<
Long
>
appIds
=
clockDtoPage
.
getRecordList
().
stream
().
map
(
WeixinClockDto:
:
getClockPrizeId
).
collect
(
Collectors
.
toList
());
//开启的抽奖应用id
List
<
Long
>
appIds
=
clockDtoPage
.
getRecordList
().
stream
().
filter
(
clock
->
clock
.
getIsOpenPrize
()
==
1
).
map
(
WeixinClockDto:
:
getClockPrizeId
).
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
appIds
))
{
if
(!
ListUtils
.
isEmpty
(
appIds
))
{
Map
<
Long
,
AppDto
>
resultsMap
=
appConsr
.
getBaseByIds
(
appIds
);
Map
<
Long
,
AppDto
>
resultsMap
=
appConsr
.
getBaseByIds
(
appIds
);
for
(
WeixinClockDto
weixinClockDto:
clockDtoPage
.
getRecordList
()){
for
(
WeixinClockDto
weixinClockDto:
clockDtoPage
.
getRecordList
()){
...
@@ -330,13 +366,32 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -330,13 +366,32 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
}
}
}
}
}
}
return
clockDtoPage
==
null
?
new
PageBeanNew
()
:
clockDtoPage
;
//开启优惠券的打卡id
List
<
Long
>
clockIds
=
clockDtoPage
.
getRecordList
().
stream
().
filter
(
clock
->
clock
.
getIsOpenCoupon
()
==
1
).
map
(
WeixinClockDto:
:
getWeixinClockId
).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
clockIds
)){
return
clockDtoPage
;
}
Map
<
Long
,
WeixinClockCoupon
>
couponMap
=
weixinClockCouponDao
.
getByClockIds
(
clockIds
);
if
(
MapUtils
.
isEmpty
(
couponMap
)){
return
clockDtoPage
;
}
for
(
WeixinClockDto
weixinClockDto
:
clockDtoPage
.
getRecordList
()){
WeixinClockCoupon
coupon
=
couponMap
.
get
(
weixinClockDto
.
getWeixinClockId
());
if
(
null
==
couponMap
.
get
(
weixinClockDto
.
getWeixinClockId
())){
continue
;
}
weixinClockDto
.
setCoupon
(
CouponRequestVO
.
valueOfEntity
(
coupon
));
}
return
clockDtoPage
;
}
}
@Override
@Override
public
WeixinClockDto
getWeixinClockBaseInfo
(
Long
weixinClockId
)
throws
BizException
{
public
WeixinClockDto
getWeixinClockBaseInfo
(
Long
weixinClockId
)
throws
BizException
{
WeixinClockDto
weixinClockDto
=
weixinClockDao
.
getWeixinClockBaseInfo
(
weixinClockId
);
WeixinClockDto
weixinClockDto
=
weixinClockDao
.
getWeixinClockBaseInfo
(
weixinClockId
);
if
(
null
!=
weixinClockDto
&&
null
!=
weixinClockDto
.
getClockPrizeId
()
&&
!
weixinClockDto
.
getClockPrizeId
().
equals
(
0L
))
{
if
(
null
==
weixinClockDto
){
return
new
WeixinClockDto
();
}
if
(
null
!=
weixinClockDto
.
getClockPrizeId
()
&&
!
weixinClockDto
.
getClockPrizeId
().
equals
(
0L
))
{
AppDto
appDto
=
appConsr
.
getBaseById
(
weixinClockDto
.
getClockPrizeId
());
AppDto
appDto
=
appConsr
.
getBaseById
(
weixinClockDto
.
getClockPrizeId
());
appDto
=
null
==
appDto
?
new
AppDto
()
:
appDto
;
appDto
=
null
==
appDto
?
new
AppDto
()
:
appDto
;
DrawRewardDto
drawRewardDto
=
new
DrawRewardDto
();
DrawRewardDto
drawRewardDto
=
new
DrawRewardDto
();
...
@@ -347,7 +402,13 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -347,7 +402,13 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
drawRewardDto
.
setTypeCode
(
appDto
.
getTypeCode
());
drawRewardDto
.
setTypeCode
(
appDto
.
getTypeCode
());
weixinClockDto
.
setDrawRewardDto
(
drawRewardDto
);
weixinClockDto
.
setDrawRewardDto
(
drawRewardDto
);
}
}
return
weixinClockDto
==
null
?
new
WeixinClockDto
()
:
weixinClockDto
;
if
(
null
!=
weixinClockDto
.
getIsOpenCoupon
()
&&
weixinClockDto
.
getIsOpenCoupon
()
==
1
){
//如果开启了打卡优惠券
WeixinClockCoupon
weixinClockCoupon
=
weixinClockCouponDao
.
getBaseByClockId
(
weixinClockId
);
CouponRequestVO
vo
=
CouponRequestVO
.
valueOfEntity
(
weixinClockCoupon
);
weixinClockDto
.
setCoupon
(
vo
);
}
return
weixinClockDto
;
}
}
@Override
@Override
...
@@ -466,6 +527,41 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -466,6 +527,41 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
return
""
;
return
""
;
}
}
private
String
getCouponUrl
(
Long
adviserId
,
Long
clockPrizeId
,
String
wxGroupId
,
String
wxUserId
){
StringBuffer
sbu
=
new
StringBuffer
();
if
(
null
!=
clockPrizeId
&&
!
clockPrizeId
.
equals
(
0L
))
{
AppDto
appDto
=
appConsr
.
getBaseById
(
clockPrizeId
);
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
if
(
null
==
accountSettingDto
)
{
return
""
;
}
String
protocol
=
accountSettingDto
.
getProtocol
();
if
(
StringUtils
.
isEmpty
(
protocol
))
{
protocol
=
ChannelConstants
.
HTTP
;
}
sbu
.
append
(
protocol
).
append
(
accountSettingDto
.
getDomain
()).
append
(
"/W"
)
.
append
(
accountSettingDto
.
getAccountSettingId
()).
append
(
"/clockcoupon"
).
append
(
"?wxGroupId="
)
.
append
(
wxGroupId
);
return
UrlUtils
.
getShortUrl4Own
(
sbu
.
toString
());
}
if
(
null
!=
adviserId
&&
!
adviserId
.
equals
(
0L
)){
Long
channelId
=
adviserConsr
.
getDefaultChannel
(
adviserId
);
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
channelId
);
if
(
null
==
accountSettingDto
)
{
return
""
;
}
String
protocol
=
accountSettingDto
.
getProtocol
();
if
(
StringUtils
.
isEmpty
(
protocol
))
{
protocol
=
ChannelConstants
.
HTTP
;
}
sbu
.
append
(
protocol
).
append
(
accountSettingDto
.
getDomain
()).
append
(
"/W"
)
.
append
(
accountSettingDto
.
getAccountSettingId
()).
append
(
"/clockcoupon"
).
append
(
"?wxGroupId="
)
.
append
(
wxGroupId
);
return
UrlUtils
.
getShortUrl4Own
(
sbu
.
toString
());
}
return
""
;
}
/**
/**
* 发送关键词信息
* 发送关键词信息
* @param content
* @param content
...
@@ -504,6 +600,7 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -504,6 +600,7 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
weixinClockMember
.
setWxGroupId
(
wechatGroupId
);
weixinClockMember
.
setWxGroupId
(
wechatGroupId
);
weixinClockMember
.
setWxUserId
(
userWxId
);
weixinClockMember
.
setWxUserId
(
userWxId
);
weixinClockMember
.
setWechatUserId
(
wechatUserId
);
weixinClockMember
.
setWechatUserId
(
wechatUserId
);
weixinClockMember
.
setScore
(
0
);
weixinClockMemberDao
.
insert
(
weixinClockMember
);
weixinClockMemberDao
.
insert
(
weixinClockMember
);
weixinClockMemberId
=
weixinClockMember
.
getWeixinClockMemberId
();
weixinClockMemberId
=
weixinClockMember
.
getWeixinClockMemberId
();
}
}
...
@@ -580,15 +677,28 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -580,15 +677,28 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
if
(
null
==
weixinClockDto
.
getClockPrizeId
()){
if
(
null
==
weixinClockDto
.
getClockPrizeId
()){
grantNum
=
0
;
grantNum
=
0
;
}
}
if
(
null
!=
grantNum
&&
!
grantNum
.
equals
(
0
)){
sendContent
=
"@"
+
nickname
+
" "
+
weixinClockDto
.
getClockIntroduction
()
+
"\n"
+
month
+
"月"
+
dayOfMonth
+
"日打卡成功,你已累积打卡"
sendContent
=
"@"
+
nickname
+
" "
+
weixinClockDto
.
getClockIntroduction
()
+
"\n"
+
month
+
"月"
+
dayOfMonth
+
"日打卡成功,你已累积打卡"
+
clockDays
+
"天,累计收获"
+
praiseNum
+
"个赞,排名第"
+
+
clockDays
+
"天,累计收获"
+
praiseNum
+
"个赞,排名第"
+
newOrder
+
",明天继续!"
+
"\n"
+
"\n"
+
"-->点赞与排行榜:"
+
clockRankUrl
+
"\n"
+
"点击抽奖,即可有机会获得精美礼品哦:"
+
"\n"
+
"-->"
+
clockRewardUrl
;
newOrder
+
",明天继续!"
+
"\n"
+
"\n"
+
"点赞与排行榜:"
+
"\n"
+
"-->"
+
clockRankUrl
+
"\n"
;
}
else
{
if
(
null
!=
weixinClockDto
.
getIsOpenCoupon
()
&&
YesOrNoEnums
.
YES
.
getValue
().
equals
(
weixinClockDto
.
getIsOpenCoupon
())){
sendContent
=
"@"
+
nickname
+
" "
+
weixinClockDto
.
getClockIntroduction
()
+
"\n"
+
month
+
"月"
+
dayOfMonth
+
"日打卡成功,你已累积打卡"
//如果有设置奖励优惠券
+
clockDays
+
"天,累计收获"
+
praiseNum
+
"个赞,排名第"
+
WeixinClockCoupon
weixinClockCoupon
=
weixinClockCouponDao
.
getBaseByClockId
(
weixinClockDto
.
getWeixinClockId
());
newOrder
+
",明天继续!"
+
"\n"
+
"\n"
+
"点赞与排行榜:"
+
"\n"
+
"-->"
+
clockRankUrl
;
if
(
weixinClockCoupon
.
getDayNum
()
==
clockDays
.
intValue
()){
WeixinClockUserCoupon
weixinClockUserCoupon
=
new
WeixinClockUserCoupon
();
weixinClockUserCoupon
.
setWxGroupId
(
wechatGroupId
);
weixinClockUserCoupon
.
setWxUserId
(
userWxId
);
weixinClockUserCoupon
.
setWeixinClockId
(
weixinClockDto
.
getWeixinClockId
());
weixinClockUserCoupon
.
setClockCouponId
(
weixinClockCoupon
.
getId
());
weixinClockUserCoupon
.
setWechatUserId
(
wechatUserId
);
weixinClockUserCouponDao
.
insert
(
weixinClockUserCoupon
);
String
couponUrl
=
getCouponUrl
(
weixinClockDto
.
getCreateUser
(),
weixinClockDto
.
getClockPrizeId
(),
wechatGroupId
,
userWxId
);
sendContent
+=
"打卡奖励:"
+
weixinClockCoupon
.
getCouponPrice
()
+
"元优惠券\n-->"
+
couponUrl
+
"\n"
;
}
}
}
if
(
null
!=
grantNum
&&
!
grantNum
.
equals
(
0
)){
sendContent
+=
"点击抽奖,即可有机会获得精美礼品哦:"
+
"\n"
+
"-->"
+
clockRewardUrl
;
}
}
else
{
}
else
{
//获取我打卡天数
//获取我打卡天数
Long
clockDays
=
weixinClockTopicDao
.
getClockCountByUser
(
wechatGroupId
,
userWxId
);
Long
clockDays
=
weixinClockTopicDao
.
getClockCountByUser
(
wechatGroupId
,
userWxId
);
...
@@ -688,14 +798,45 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
...
@@ -688,14 +798,45 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
}
}
@Override
@Override
public
void
solveOldData
(){
public
void
solveOldData
()
{
weixinClockMemberDao
.
initScore
();
weixinClockMemberDao
.
initScore
();
List
<
RankDto
>
rankDtos
=
weixinClockPraiseDao
.
listAll
();
List
<
RankDto
>
rankDtos
=
weixinClockPraiseDao
.
listAll
();
if
(!
ListUtils
.
isEmpty
(
rankDtos
)){
if
(!
ListUtils
.
isEmpty
(
rankDtos
))
{
for
(
RankDto
rankDto
:
rankDtos
){
for
(
RankDto
rankDto
:
rankDtos
)
{
weixinClockMemberDao
.
addPraiseNum
(
rankDto
.
getWxUserId
(),
rankDto
.
getWxGroupId
(),
rankDto
.
getPraiseNum
());
weixinClockMemberDao
.
addPraiseNum
(
rankDto
.
getWxUserId
(),
rankDto
.
getWxGroupId
(),
rankDto
.
getPraiseNum
());
}
}
}
}
}
}
@Override
@ParamLog
(
value
=
"获取群打卡奖励优惠券"
,
isAfterReturn
=
false
)
public
GetClockCouponResponseVO
getClockCoupon
(
String
wxGroupId
,
Long
wechatUserId
)
{
if
(
null
==
wxGroupId
){
return
new
GetClockCouponResponseVO
();
}
WeixinClockDto
weixinClock
=
weixinClockDao
.
getByWxGroupId
(
wxGroupId
);
if
(
null
==
weixinClock
){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"该打卡不存在"
);
}
WeixinClockUserCoupon
weixinClockUserCoupon
=
weixinClockUserCouponDao
.
getByGroupAndUser
(
wxGroupId
,
wechatUserId
);
if
(
null
==
weixinClockUserCoupon
){
WeixinClockCoupon
weixinClockCoupon
=
weixinClockCouponDao
.
getBaseByClockId
(
weixinClock
.
getWeixinClockId
());
GetClockCouponResponseVO
vo
=
new
GetClockCouponResponseVO
();
if
(
null
==
weixinClockCoupon
){
vo
.
setHasCoupon
(
0
);
return
vo
;
}
vo
.
setHasCoupon
(
1
);
vo
.
setHasGot
(
0
);
vo
.
setDayNum
(
weixinClockCoupon
.
getDayNum
());
return
vo
;
}
WeixinClockCoupon
coupon
=
weixinClockCouponDao
.
getBaseById
(
weixinClockUserCoupon
.
getClockCouponId
());
GetClockCouponResponseVO
vo
=
GetClockCouponResponseVO
.
valueFromEntity
(
coupon
);
vo
.
setHasCoupon
(
1
);
vo
.
setHasGot
(
1
);
vo
.
setGetTime
(
weixinClockUserCoupon
.
getCreateTime
());
return
vo
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/check/impl/WeixinClockCheckImpl.java
View file @
e06f5ca3
...
@@ -34,6 +34,12 @@ public class WeixinClockCheckImpl implements WeixinClockCheck {
...
@@ -34,6 +34,12 @@ public class WeixinClockCheckImpl implements WeixinClockCheck {
if
(
StringUtil
.
isEmpty
(
weixinClockDto
.
getClockIntroduction
())){
if
(
StringUtil
.
isEmpty
(
weixinClockDto
.
getClockIntroduction
())){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少打卡简介!"
);
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少打卡简介!"
);
}
}
if
(
weixinClockDto
.
getIsOpenCoupon
()
==
1
&&
null
==
weixinClockDto
.
getCoupon
()){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"未设置打卡奖励优惠券"
);
}
if
(
null
!=
weixinClockDto
.
getCoupon
()
&&
weixinClockDto
.
getCoupon
().
getProOriginPrice
().
compareTo
(
weixinClockDto
.
getCoupon
().
getCouponPrice
())
<
0
){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"优惠券价格不能大于商品原价"
);
}
/*if(null == weixinClockDto.getClockPrizeId()){
/*if(null == weixinClockDto.getClockPrizeId()){
throw new BookBizException(BookBizException.ERROR,"缺少打卡的奖励应用ID!");
throw new BookBizException(BookBizException.ERROR,"缺少打卡的奖励应用ID!");
}*/
}*/
...
...
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/dao/WeixinClockCouponDao.java
0 → 100644
View file @
e06f5ca3
package
com
.
pcloud
.
book
.
weixinclock
.
dao
;
import
com.pcloud.book.weixinclock.entity.WeixinClockCoupon
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Describe: 微信群打卡优惠券dao
* @Author: zhangdongwei
* @Date: Create on 11:18 2019/11/12 0012
*/
public
interface
WeixinClockCouponDao
extends
BaseDao
<
WeixinClockCoupon
>
{
/**
* 获取微信群打卡基本信息
* @param id
* @return
*/
WeixinClockCoupon
getBaseById
(
Long
id
);
/**
* 根据打卡id获取打卡奖励优惠券信息
* @param weixinClockId
* @return
*/
WeixinClockCoupon
getBaseByClockId
(
Long
weixinClockId
);
/**
* 根据打卡id列表获取打卡优惠券列表
* @param clockIds
* @return
*/
Map
<
Long
,
WeixinClockCoupon
>
getByClockIds
(
List
<
Long
>
clockIds
);
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/dao/WeixinClockDao.java
View file @
e06f5ca3
...
@@ -24,4 +24,10 @@ public interface WeixinClockDao extends BaseDao<WeixinClock> {
...
@@ -24,4 +24,10 @@ public interface WeixinClockDao extends BaseDao<WeixinClock> {
* @param weixinClockId
* @param weixinClockId
*/
*/
WeixinClockDto
getWeixinClockBaseInfo
(
Long
weixinClockId
);
WeixinClockDto
getWeixinClockBaseInfo
(
Long
weixinClockId
);
/**
* 获取微信群的签到打卡信息
* @param
*/
WeixinClockDto
getByWxGroupId
(
String
wxGroupId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/dao/WeixinClockUserCouponDao.java
0 → 100644
View file @
e06f5ca3
package
com
.
pcloud
.
book
.
weixinclock
.
dao
;
import
com.pcloud.book.weixinclock.entity.WeixinClockUserCoupon
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* @Describe: 微信群打卡用户优惠dao
* @Author: zhangdongwei
* @Date: Create on 9:24 2019/11/19 0019
*/
public
interface
WeixinClockUserCouponDao
extends
BaseDao
<
WeixinClockUserCoupon
>
{
/**
* 获取我的优惠券
* @param wxGroupId
* @param wechatUserId
* @return
*/
WeixinClockUserCoupon
getByGroupAndUser
(
String
wxGroupId
,
Long
wechatUserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/dao/impl/WeixinClockCouponDaoImpl.java
0 → 100644
View file @
e06f5ca3
package
com
.
pcloud
.
book
.
weixinclock
.
dao
.
impl
;
import
com.pcloud.book.weixinclock.dao.WeixinClockCouponDao
;
import
com.pcloud.book.weixinclock.entity.WeixinClockCoupon
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Describe: 微信群打卡优惠券dao实现层
* @Author: zhangdongwei
* @Date: Create on 11:19 2019/11/12 0012
*/
@Repository
(
"weixinClockCouponDao"
)
public
class
WeixinClockCouponDaoImpl
extends
BaseDaoImpl
<
WeixinClockCoupon
>
implements
WeixinClockCouponDao
{
@Override
public
WeixinClockCoupon
getBaseById
(
Long
id
)
{
return
super
.
sqlSessionTemplate
.
selectOne
(
getStatement
(
"getBaseById"
),
id
);
}
@Override
public
WeixinClockCoupon
getBaseByClockId
(
Long
weixinClockId
)
{
return
super
.
sqlSessionTemplate
.
selectOne
(
getStatement
(
"getBaseByClockId"
),
weixinClockId
);
}
@Override
public
Map
<
Long
,
WeixinClockCoupon
>
getByClockIds
(
List
<
Long
>
clockIds
)
{
return
super
.
sqlSessionTemplate
.
selectMap
(
getStatement
(
"getByClockIds"
),
clockIds
,
"weixinClockId"
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/dao/impl/WeixinClockDaoImpl.java
View file @
e06f5ca3
...
@@ -36,4 +36,9 @@ public class WeixinClockDaoImpl extends BaseDaoImpl<WeixinClock> implements Weix
...
@@ -36,4 +36,9 @@ public class WeixinClockDaoImpl extends BaseDaoImpl<WeixinClock> implements Weix
public
WeixinClockDto
getWeixinClockBaseInfo
(
Long
weixinClockId
)
{
public
WeixinClockDto
getWeixinClockBaseInfo
(
Long
weixinClockId
)
{
return
super
.
sqlSessionTemplate
.
selectOne
(
getStatement
(
"getWeixinClockBaseInfo"
),
weixinClockId
);
return
super
.
sqlSessionTemplate
.
selectOne
(
getStatement
(
"getWeixinClockBaseInfo"
),
weixinClockId
);
}
}
@Override
public
WeixinClockDto
getByWxGroupId
(
String
wxGroupId
)
{
return
super
.
sqlSessionTemplate
.
selectOne
(
getStatement
(
"getByWxGroupId"
),
wxGroupId
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/dao/impl/WeixinClockUserCouponDaoImpl.java
0 → 100644
View file @
e06f5ca3
package
com
.
pcloud
.
book
.
weixinclock
.
dao
.
impl
;
import
com.pcloud.book.weixinclock.dao.WeixinClockUserCouponDao
;
import
com.pcloud.book.weixinclock.entity.WeixinClockUserCoupon
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @Describe: 微信群打卡用户优惠dao实现类
* @Author: zhangdongwei
* @Date: Create on 9:25 2019/11/19 0019
*/
@Repository
(
"weixinClockUserCouponDao"
)
public
class
WeixinClockUserCouponDaoImpl
extends
BaseDaoImpl
<
WeixinClockUserCoupon
>
implements
WeixinClockUserCouponDao
{
@Override
public
WeixinClockUserCoupon
getByGroupAndUser
(
String
wxGroupId
,
Long
wechatUserId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wxGroupId"
,
wxGroupId
);
map
.
put
(
"wechatUserId"
,
wechatUserId
);
return
super
.
sqlSessionTemplate
.
selectOne
(
getStatement
(
"getByGroupAndUser"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/dto/WeixinClockDto.java
View file @
e06f5ca3
...
@@ -3,11 +3,14 @@ package com.pcloud.book.weixinclock.dto;
...
@@ -3,11 +3,14 @@ package com.pcloud.book.weixinclock.dto;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.group.vo.StatisticVO
;
import
com.pcloud.book.group.vo.StatisticVO
;
import
com.pcloud.book.weixinclock.entity.WeixinClockReward
;
import
com.pcloud.book.weixinclock.entity.WeixinClockReward
;
import
com.pcloud.book.weixinclock.vo.request.CouponRequestVO
;
import
com.pcloud.common.dto.BaseDto
;
import
com.pcloud.common.dto.BaseDto
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
javax.validation.Valid
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
/**
/**
...
@@ -52,6 +55,16 @@ public class WeixinClockDto extends BaseDto {
...
@@ -52,6 +55,16 @@ public class WeixinClockDto extends BaseDto {
@ApiModelProperty
(
"打卡奖励URL"
)
@ApiModelProperty
(
"打卡奖励URL"
)
private
String
clockPrizeUrl
;
private
String
clockPrizeUrl
;
@ApiModelProperty
(
"是否开启优惠券"
)
private
Integer
isOpenCoupon
;
@ApiModelProperty
(
"是否开启打卡抽奖"
)
private
Integer
isOpenPrize
;
@ApiModelProperty
(
"打卡奖励优惠券信息"
)
@Valid
private
CouponRequestVO
coupon
;
@ApiModelProperty
(
"创建人"
)
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
private
Long
createUser
;
...
@@ -154,6 +167,30 @@ public class WeixinClockDto extends BaseDto {
...
@@ -154,6 +167,30 @@ public class WeixinClockDto extends BaseDto {
this
.
clockPrizeUrl
=
clockPrizeUrl
;
this
.
clockPrizeUrl
=
clockPrizeUrl
;
}
}
public
Integer
getIsOpenCoupon
()
{
return
isOpenCoupon
;
}
public
Integer
getIsOpenPrize
()
{
return
isOpenPrize
;
}
public
void
setIsOpenPrize
(
Integer
isOpenPrize
)
{
this
.
isOpenPrize
=
isOpenPrize
;
}
public
void
setIsOpenCoupon
(
Integer
isOpenCoupon
)
{
this
.
isOpenCoupon
=
isOpenCoupon
;
}
public
CouponRequestVO
getCoupon
()
{
return
coupon
;
}
public
void
setCoupon
(
CouponRequestVO
coupon
)
{
this
.
coupon
=
coupon
;
}
public
Long
getCreateUser
()
{
public
Long
getCreateUser
()
{
return
createUser
;
return
createUser
;
}
}
...
@@ -204,6 +241,7 @@ public class WeixinClockDto extends BaseDto {
...
@@ -204,6 +241,7 @@ public class WeixinClockDto extends BaseDto {
", clockIntroduction='"
+
clockIntroduction
+
'\''
+
", clockIntroduction='"
+
clockIntroduction
+
'\''
+
", clockPrizeId="
+
clockPrizeId
+
", clockPrizeId="
+
clockPrizeId
+
", clockPrizeUrl='"
+
clockPrizeUrl
+
'\''
+
", clockPrizeUrl='"
+
clockPrizeUrl
+
'\''
+
", isOpenCoupon="
+
isOpenCoupon
+
", createUser="
+
createUser
+
", createUser="
+
createUser
+
", createDate="
+
createDate
+
", createDate="
+
createDate
+
", lastModifiedUser="
+
lastModifiedUser
+
", lastModifiedUser="
+
lastModifiedUser
+
...
...
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/entity/WeixinClock.java
View file @
e06f5ca3
...
@@ -34,6 +34,12 @@ public class WeixinClock extends BaseEntity {
...
@@ -34,6 +34,12 @@ public class WeixinClock extends BaseEntity {
@ApiModelProperty
(
"打卡奖励URL"
)
@ApiModelProperty
(
"打卡奖励URL"
)
private
String
clockPrizeUrl
;
private
String
clockPrizeUrl
;
@ApiModelProperty
(
"是否开启优惠券奖励"
)
private
Integer
isOpenCoupon
;
@ApiModelProperty
(
"是否开启打卡抽奖"
)
private
Integer
isOpenPrize
;
@ApiModelProperty
(
"创建人"
)
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
private
Long
createUser
;
...
@@ -96,6 +102,22 @@ public class WeixinClock extends BaseEntity {
...
@@ -96,6 +102,22 @@ public class WeixinClock extends BaseEntity {
this
.
clockPrizeUrl
=
clockPrizeUrl
;
this
.
clockPrizeUrl
=
clockPrizeUrl
;
}
}
public
Integer
getIsOpenCoupon
()
{
return
isOpenCoupon
;
}
public
void
setIsOpenCoupon
(
Integer
isOpenCoupon
)
{
this
.
isOpenCoupon
=
isOpenCoupon
;
}
public
Integer
getIsOpenPrize
()
{
return
isOpenPrize
;
}
public
void
setIsOpenPrize
(
Integer
isOpenPrize
)
{
this
.
isOpenPrize
=
isOpenPrize
;
}
public
Long
getCreateUser
()
{
public
Long
getCreateUser
()
{
return
createUser
;
return
createUser
;
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/entity/WeixinClockCoupon.java
0 → 100644
View file @
e06f5ca3
package
com
.
pcloud
.
book
.
weixinclock
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
lombok.Data
;
/**
* @Describe: 群打卡优惠券entity
* @Author: zhangdongwei
* @Date: Create on 9:41 2019/11/11 0011
*/
@Data
public
class
WeixinClockCoupon
extends
BaseEntity
{
private
Long
weixinClockId
;
/**
* 优惠券平台(淘宝、京东、当当)
*/
private
Integer
couponPlatform
;
/**
* 商品名称
*/
private
String
title
;
/**
* 商品图片
*/
private
String
pictUrl
;
/**
* 商品原始价格
*/
private
BigDecimal
proOriginPrice
;
/**
* 优惠券价格
*/
private
BigDecimal
couponPrice
;
/**
* 劵后价格
*/
private
BigDecimal
afterCouponPrice
;
/**
* 优惠券点击链接
*/
private
String
couponClickUrl
;
/**
* 领取优惠券的打卡天数
*/
private
Integer
dayNum
;
private
Long
createUser
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
private
Long
updateUser
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/entity/WeixinClockUserCoupon.java
0 → 100644
View file @
e06f5ca3
package
com
.
pcloud
.
book
.
weixinclock
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
lombok.Data
;
/**
* @Describe: 群打卡用户优惠券
* @Author: zhangdongwei
* @Date: Create on 9:09 2019/11/19 0019
*/
@Data
public
class
WeixinClockUserCoupon
extends
BaseEntity
{
private
Long
weixinClockId
;
private
String
wxUserId
;
private
Long
wechatUserId
;
private
String
wxGroupId
;
private
Long
clockCouponId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/facade/WeixinClockFacade.java
View file @
e06f5ca3
...
@@ -129,4 +129,12 @@ public interface WeixinClockFacade {
...
@@ -129,4 +129,12 @@ public interface WeixinClockFacade {
public
ResponseDto
<?>
getShareMemberRank
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
public
ResponseDto
<?>
getShareMemberRank
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"wxGroupId"
)
String
wxGroupId
,
@RequestParam
(
value
=
"wxGroupId"
)
String
wxGroupId
,
@RequestParam
(
value
=
"wxUserId"
)
String
wxUserId
)
throws
BizException
,
PermissionException
;
@RequestParam
(
value
=
"wxUserId"
)
String
wxUserId
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"获取某个群内打卡优惠券"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userInfo"
,
value
=
"Cookie"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"wxGroupId"
,
value
=
"微信群id"
,
dataType
=
"string"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"getClockCoupon"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
getClockCoupon
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"wxGroupId"
)
String
wxGroupId
)
throws
BizException
,
PermissionException
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/facade/impl/WeixinClockFacadeImpl.java
View file @
e06f5ca3
...
@@ -17,6 +17,7 @@ import com.pcloud.common.utils.cookie.Cookie;
...
@@ -17,6 +17,7 @@ import com.pcloud.common.utils.cookie.Cookie;
import
com.pcloud.common.utils.nginx.NginxUtils
;
import
com.pcloud.common.utils.nginx.NginxUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestHeader
;
...
@@ -55,7 +56,7 @@ public class WeixinClockFacadeImpl implements WeixinClockFacade {
...
@@ -55,7 +56,7 @@ public class WeixinClockFacadeImpl implements WeixinClockFacade {
@Override
@Override
@RequestMapping
(
value
=
"createWeixinClock"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"createWeixinClock"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<?>
createWeixinClock
(
@RequestHeader
(
"token"
)
String
token
,
public
ResponseDto
<?>
createWeixinClock
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
WeixinClockDto
weixinClockDto
)
throws
BizException
,
PermissionException
{
@
Validated
@
RequestBody
WeixinClockDto
weixinClockDto
)
throws
BizException
,
PermissionException
{
Long
adviserId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
Long
adviserId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
weixinClockDto
.
setCreateUser
(
adviserId
);
weixinClockDto
.
setCreateUser
(
adviserId
);
weixinClockDto
.
setLastModifiedUser
(
adviserId
);
weixinClockDto
.
setLastModifiedUser
(
adviserId
);
...
@@ -227,9 +228,16 @@ public class WeixinClockFacadeImpl implements WeixinClockFacade {
...
@@ -227,9 +228,16 @@ public class WeixinClockFacadeImpl implements WeixinClockFacade {
}
}
@RequestMapping
(
value
=
"solveOldData"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"solveOldData"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
solveOldData
(){
public
ResponseDto
<?>
solveOldData
()
{
weixinClockBiz
.
solveOldData
();
weixinClockBiz
.
solveOldData
();
return
new
ResponseDto
<>();
return
new
ResponseDto
<>();
}
}
@Override
@RequestMapping
(
value
=
"getClockCoupon"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
getClockCoupon
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"wxGroupId"
)
String
wxGroupId
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
weixinClockBiz
.
getClockCoupon
(
wxGroupId
,
wechatUserId
));
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/vo/request/CouponRequestVO.java
0 → 100644
View file @
e06f5ca3
package
com
.
pcloud
.
book
.
weixinclock
.
vo
.
request
;
import
com.pcloud.book.weixinclock.entity.WeixinClockCoupon
;
import
com.pcloud.common.entity.BaseRequestVO
;
import
com.pcloud.common.utils.bean.BeanUtils
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
javax.validation.constraints.NotNull
;
import
lombok.Data
;
/**
* @Describe: 优惠券请求vo
* @Author: zhangdongwei
* @Date: Create on 16:07 2019/11/12 0012
*/
@Data
public
class
CouponRequestVO
extends
BaseRequestVO
{
/**
* 优惠券平台(淘宝、京东、当当)
*/
@NotNull
(
message
=
"未选择优惠券平台"
)
private
Integer
couponPlatform
;
/**
* 商品名称
*/
@NotNull
(
message
=
"未填写商品名称"
)
private
String
title
;
/**
* 商品图片
*/
@NotNull
(
message
=
"没有商品图片"
)
private
String
pictUrl
;
/**
* 商品原始价格
*/
@NotNull
(
message
=
"未填写商品原始价格"
)
private
BigDecimal
proOriginPrice
;
/**
* 优惠券价格
*/
@NotNull
(
message
=
"未填写优惠券金额"
)
private
BigDecimal
couponPrice
;
/**
* 优惠券点击链接
*/
@NotNull
(
message
=
"优惠券链接不能为空"
)
private
String
couponClickUrl
;
/**
* 领取优惠券天数
*/
@NotNull
(
message
=
"未设置领取的打卡天数"
)
private
Integer
dayNum
;
public
static
WeixinClockCoupon
valueToEntity
(
CouponRequestVO
vo
){
WeixinClockCoupon
weixinClockCoupon
=
BeanUtils
.
copy
(
vo
,
WeixinClockCoupon
.
class
);
weixinClockCoupon
.
setAfterCouponPrice
(
vo
.
getProOriginPrice
().
subtract
(
vo
.
getCouponPrice
()));
weixinClockCoupon
.
setCreateUser
(
vo
.
getUserId
());
weixinClockCoupon
.
setUpdateUser
(
vo
.
getUserId
());
Date
now
=
new
Date
();
weixinClockCoupon
.
setCreateTime
(
now
);
weixinClockCoupon
.
setUpdateTime
(
now
);
return
weixinClockCoupon
;
}
public
static
CouponRequestVO
valueOfEntity
(
WeixinClockCoupon
weixinClockCoupon
){
CouponRequestVO
vo
=
BeanUtils
.
copy
(
weixinClockCoupon
,
CouponRequestVO
.
class
);
return
vo
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/vo/response/GetClockCouponResponseVO.java
0 → 100644
View file @
e06f5ca3
package
com
.
pcloud
.
book
.
weixinclock
.
vo
.
response
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.weixinclock.entity.WeixinClockCoupon
;
import
com.pcloud.common.utils.bean.BeanUtils
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
lombok.Data
;
/**
* @Describe: 获取群打卡奖励优惠券返回类
* @Author: zhangdongwei
* @Date: Create on 20:33 2019/11/18 0018
*/
@Data
public
class
GetClockCouponResponseVO
{
/**
* 优惠券平台(淘宝、京东、当当)
*/
private
Integer
couponPlatform
;
/**
* 商品名称
*/
private
String
title
;
/**
* 商品图片
*/
private
String
pictUrl
;
/**
* 商品原始价格
*/
private
BigDecimal
proOriginPrice
;
/**
* 优惠券价格
*/
private
BigDecimal
couponPrice
;
/**
* 劵后价格
*/
private
BigDecimal
afterCouponPrice
;
/**
* 优惠券点击链接
*/
private
String
couponClickUrl
;
/**
* 领取优惠券天数
*/
private
Integer
dayNum
;
/**
* 领取时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
getTime
;
/**
* 是否有优惠券
*/
private
Integer
hasCoupon
;
/**
* 是否获得优惠券
*/
private
Integer
hasGot
;
public
static
GetClockCouponResponseVO
valueFromEntity
(
WeixinClockCoupon
weixinClockCoupon
){
GetClockCouponResponseVO
vo
=
BeanUtils
.
copy
(
weixinClockCoupon
,
GetClockCouponResponseVO
.
class
);
return
vo
;
}
}
pcloud-service-book/src/main/resources/mapper/weixinclock/WeixinClock.Mapper.xml
View file @
e06f5ca3
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
<result
column=
"clock_introduction"
property=
"clockIntroduction"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_introduction"
property=
"clockIntroduction"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_prize_id"
property=
"clockPrizeId"
jdbcType=
"BIGINT"
/>
<result
column=
"clock_prize_id"
property=
"clockPrizeId"
jdbcType=
"BIGINT"
/>
<result
column=
"clock_prize_url"
property=
"clockPrizeUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_prize_url"
property=
"clockPrizeUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"is_open_coupon"
property=
"isOpenCoupon"
jdbcType=
"INTEGER"
/>
<result
column=
"is_open_prize"
property=
"isOpenPrize"
jdbcType=
"INTEGER"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_date"
property=
"createDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_date"
property=
"createDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"last_modified_user"
property=
"lastModifiedUser"
jdbcType=
"BIGINT"
/>
<result
column=
"last_modified_user"
property=
"lastModifiedUser"
jdbcType=
"BIGINT"
/>
...
@@ -22,6 +24,8 @@
...
@@ -22,6 +24,8 @@
<result
column=
"clock_introduction"
property=
"clockIntroduction"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_introduction"
property=
"clockIntroduction"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_prize_id"
property=
"clockPrizeId"
jdbcType=
"BIGINT"
/>
<result
column=
"clock_prize_id"
property=
"clockPrizeId"
jdbcType=
"BIGINT"
/>
<result
column=
"clock_prize_url"
property=
"clockPrizeUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_prize_url"
property=
"clockPrizeUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"is_open_coupon"
property=
"isOpenCoupon"
jdbcType=
"INTEGER"
/>
<result
column=
"is_open_prize"
property=
"isOpenPrize"
jdbcType=
"INTEGER"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_date"
property=
"createDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_date"
property=
"createDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"last_modified_user"
property=
"lastModifiedUser"
jdbcType=
"BIGINT"
/>
<result
column=
"last_modified_user"
property=
"lastModifiedUser"
jdbcType=
"BIGINT"
/>
...
@@ -37,6 +41,8 @@
...
@@ -37,6 +41,8 @@
<result
column=
"clock_introduction"
property=
"clockIntroduction"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_introduction"
property=
"clockIntroduction"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_prize_id"
property=
"clockPrizeId"
jdbcType=
"BIGINT"
/>
<result
column=
"clock_prize_id"
property=
"clockPrizeId"
jdbcType=
"BIGINT"
/>
<result
column=
"clock_prize_url"
property=
"clockPrizeUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_prize_url"
property=
"clockPrizeUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"is_open_coupon"
property=
"isOpenCoupon"
jdbcType=
"INTEGER"
/>
<result
column=
"is_open_prize"
property=
"isOpenPrize"
jdbcType=
"INTEGER"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_date"
property=
"createDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_date"
property=
"createDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"last_modified_user"
property=
"lastModifiedUser"
jdbcType=
"BIGINT"
/>
<result
column=
"last_modified_user"
property=
"lastModifiedUser"
jdbcType=
"BIGINT"
/>
...
@@ -50,18 +56,18 @@
...
@@ -50,18 +56,18 @@
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
weixin_clock_id, clock_keyword, clock_guide, clock_introduction, clock_prize_id, clock_prize_url, create_user, create_date,
weixin_clock_id, clock_keyword, clock_guide, clock_introduction, clock_prize_id, clock_prize_url,
is_open_coupon, is_open_prize,
create_user, create_date,
last_modified_user, last_modified_date
last_modified_user, last_modified_date
</sql>
</sql>
<insert
id=
"insert"
parameterType=
"weixinClock"
useGeneratedKeys=
"true"
keyProperty=
"weixinClockId"
flushCache=
"true"
>
<insert
id=
"insert"
parameterType=
"weixinClock"
useGeneratedKeys=
"true"
keyProperty=
"weixinClockId"
flushCache=
"true"
>
INSERT INTO weixin_clock (
INSERT INTO weixin_clock (
clock_keyword, clock_guide, clock_introduction, clock_prize_id, clock_prize_url, create_user, create_date,
clock_keyword, clock_guide, clock_introduction, clock_prize_id, clock_prize_url,
is_open_coupon, is_open_prize,
create_user, create_date,
last_modified_user, last_modified_date
last_modified_user, last_modified_date
)
)
VALUES (
VALUES (
#{clockKeyword, jdbcType=VARCHAR}, #{clockGuide, jdbcType=VARCHAR}, #{clockIntroduction, jdbcType=VARCHAR}, #{clockPrizeId, jdbcType=BIGINT},
#{clockKeyword, jdbcType=VARCHAR}, #{clockGuide, jdbcType=VARCHAR}, #{clockIntroduction, jdbcType=VARCHAR}, #{clockPrizeId, jdbcType=BIGINT},
#{clockPrizeUrl, jdbcType=VARCHAR}, #{createUser, jdbcType=VARCHAR}, NOW(), #{lastModifiedUser, jdbcType=BIGINT}, NOW()
#{clockPrizeUrl, jdbcType=VARCHAR}, #{
isOpenCoupon}, #{isOpenPrize}, #{
createUser, jdbcType=VARCHAR}, NOW(), #{lastModifiedUser, jdbcType=BIGINT}, NOW()
)
)
</insert>
</insert>
...
@@ -92,6 +98,12 @@
...
@@ -92,6 +98,12 @@
<if
test=
"clockPrizeUrl != null"
>
<if
test=
"clockPrizeUrl != null"
>
clock_prize_url = #{clockPrizeUrl, jdbcType=VARCHAR},
clock_prize_url = #{clockPrizeUrl, jdbcType=VARCHAR},
</if>
</if>
<if
test=
"isOpenCoupon != null"
>
is_open_coupon = #{isOpenCoupon},
</if>
<if
test=
"isOpenPrize != null"
>
is_open_prize = #{isOpenPrize},
</if>
<if
test=
"lastModifiedUser != null"
>
<if
test=
"lastModifiedUser != null"
>
last_modified_user = #{lastModifiedUser, jdbcType=BIGINT},
last_modified_user = #{lastModifiedUser, jdbcType=BIGINT},
</if>
</if>
...
@@ -107,7 +119,7 @@
...
@@ -107,7 +119,7 @@
</delete>
</delete>
<select
id=
"listWeixinClock4Adviser"
parameterType=
"map"
resultMap=
"BaseResultListMapDTO"
>
<select
id=
"listWeixinClock4Adviser"
parameterType=
"map"
resultMap=
"BaseResultListMapDTO"
>
SELECT weixin_clock_id, clock_keyword, clock_guide, clock_introduction,
SELECT weixin_clock_id, clock_keyword, clock_guide, clock_introduction,
is_open_coupon, is_open_prize,
clock_prize_id, clock_prize_url, create_user, create_date, last_modified_user, last_modified_date
clock_prize_id, clock_prize_url, create_user, create_date, last_modified_user, last_modified_date
FROM
FROM
weixin_clock
weixin_clock
...
@@ -119,7 +131,7 @@
...
@@ -119,7 +131,7 @@
</select>
</select>
<select
id=
"getWeixinClockBaseInfo"
parameterType=
"Long"
resultMap=
"ClockBaseInfoMap"
>
<select
id=
"getWeixinClockBaseInfo"
parameterType=
"Long"
resultMap=
"ClockBaseInfoMap"
>
SELECT weixin_clock_id, clock_keyword, clock_guide, clock_introduction,
SELECT weixin_clock_id, clock_keyword, clock_guide, clock_introduction,
is_open_coupon, is_open_prize,
clock_prize_id, clock_prize_url, create_user, create_date, last_modified_user, last_modified_date
clock_prize_id, clock_prize_url, create_user, create_date, last_modified_user, last_modified_date
FROM
FROM
weixin_clock
weixin_clock
...
@@ -147,4 +159,14 @@
...
@@ -147,4 +159,14 @@
order by c.id desc, g.id desc
order by c.id desc, g.id desc
</select>
</select>
<select
id=
"getByWxGroupId"
resultMap=
"ClockBaseInfoMap"
parameterType=
"string"
>
select cl.weixin_clock_id, cl.clock_keyword, cl.clock_guide, cl.clock_introduction, cl.clock_prize_id, cl.clock_prize_url, cl.is_open_coupon, cl.is_open_prize, cl.create_user, cl.create_date,
cl.last_modified_user, cl.last_modified_date
from weixin_clock cl
left join weixin_clock_group_classify wc on cl.weixin_clock_id = wc.weixin_clock_id
left join book_group_classify c on wc.book_group_classify_id = c.id
left join book_group_qrcode g ON c.id = g.classify_id
where g.weixin_group_id = #{wxGroupId} limit 1
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/weixinclock/WeixinClockCoupon.Mapper.xml
0 → 100644
View file @
e06f5ca3
<?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.pcloud.book.weixinclock.dao.impl.WeixinClockCouponDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.weixinclock.entity.WeixinClockCoupon"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"weixin_clock_id"
property=
"weixinClockId"
jdbcType=
"BIGINT"
/>
<result
column=
"coupon_platform"
property=
"couponPlatform"
jdbcType=
"INTEGER"
/>
<result
column=
"title"
property=
"title"
jdbcType=
"VARCHAR"
/>
<result
column=
"pict_url"
property=
"pictUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"pro_origin_price"
property=
"proOriginPrice"
jdbcType=
"DECIMAL"
/>
<result
column=
"coupon_price"
property=
"couponPrice"
jdbcType=
"DECIMAL"
/>
<result
column=
"after_coupon_price"
property=
"afterCouponPrice"
jdbcType=
"DECIMAL"
/>
<result
column=
"coupon_click_url"
property=
"couponClickUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"day_num"
property=
"dayNum"
jdbcType=
"INTEGER"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_user"
property=
"updateUser"
jdbcType=
"BIGINT"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, weixin_clock_id, coupon_platform, title, pict_url, pro_origin_price, coupon_price, after_coupon_price, coupon_click_url, day_num,
create_user, create_time, update_user, update_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.weixinclock.entity.WeixinClockCoupon"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into weixin_clock_coupon(weixin_clock_id, coupon_platform, title, pict_url,
pro_origin_price, coupon_price,
after_coupon_price, coupon_click_url, day_num,
create_user, create_time, update_user, update_time)
values (#{weixinClockId}, #{couponPlatform}, #{title}, #{pictUrl},
#{proOriginPrice}, #{couponPrice},
#{afterCouponPrice}, #{couponClickUrl}, #{dayNum},
#{createUser}, now(), #{updateUser}, now())
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.weixinclock.entity.WeixinClockCoupon"
>
update weixin_clock_coupon
<set
>
<if
test=
"couponPlatform != null"
>
coupon_platform = #{couponPlatform},
</if>
<if
test=
"title != null"
>
title = #{title,jdbcType=VARCHAR},
</if>
<if
test=
"pictUrl != null"
>
pict_url = #{pictUrl,jdbcType=VARCHAR},
</if>
<if
test=
"proOriginPrice != null"
>
pro_origin_price = #{proOriginPrice,jdbcType=DECIMAL},
</if>
<if
test=
"couponPrice != null"
>
coupon_price = #{couponPrice,jdbcType=DECIMAL},
</if>
<if
test=
"afterCouponPrice != null"
>
after_coupon_price = #{afterCouponPrice,jdbcType=DECIMAL},
</if>
<if
test=
"couponClickUrl != null"
>
coupon_click_url = #{couponClickUrl,jdbcType=VARCHAR},
</if>
<if
test=
"dayNum != null"
>
day_num = #{dayNum},
</if>
<if
test=
"updateUser != null"
>
update_user = #{updateUser},
</if>
update_time = NOW()
</set>
where id = #{id}
</update>
<select
id=
"getBaseById"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from weixin_clock_coupon where id = #{id}
</select>
<select
id=
"getBaseByClockId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from weixin_clock_coupon where weixin_clock_id = #{weixinClockId}
</select>
<select
id=
"getByClockIds"
parameterType=
"list"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from weixin_clock_coupon where weixin_clock_id in
<foreach
collection=
"list"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/weixinclock/WeixinClockGroupClassify.Mapper.xml
View file @
e06f5ca3
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
<result
column=
"clock_introduction"
property=
"clockIntroduction"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_introduction"
property=
"clockIntroduction"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_prize_id"
property=
"clockPrizeId"
jdbcType=
"BIGINT"
/>
<result
column=
"clock_prize_id"
property=
"clockPrizeId"
jdbcType=
"BIGINT"
/>
<result
column=
"clock_prize_url"
property=
"clockPrizeUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"clock_prize_url"
property=
"clockPrizeUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"is_open_coupon"
property=
"isOpenCoupon"
jdbcType=
"INTEGER"
/>
<result
column=
"is_open_prize"
property=
"isOpenPrize"
jdbcType=
"INTEGER"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_date"
property=
"createDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"create_date"
property=
"createDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"last_modified_user"
property=
"lastModifiedUser"
jdbcType=
"BIGINT"
/>
<result
column=
"last_modified_user"
property=
"lastModifiedUser"
jdbcType=
"BIGINT"
/>
...
@@ -51,7 +53,7 @@
...
@@ -51,7 +53,7 @@
<select
id=
"getClockBaseInfoByClassify"
parameterType=
"map"
resultMap=
"ClockBaseInfoMap"
>
<select
id=
"getClockBaseInfoByClassify"
parameterType=
"map"
resultMap=
"ClockBaseInfoMap"
>
SELECT
SELECT
wc.weixin_clock_id, wc.clock_keyword, wc.clock_guide, wc.clock_introduction, wc.clock_prize_id, wc.clock_prize_url, wc.create_user, wc.create_date,
wc.weixin_clock_id, wc.clock_keyword, wc.clock_guide, wc.clock_introduction, wc.clock_prize_id, wc.clock_prize_url, wc.create_user, wc.create_date,
wc.last_modified_user, wc.last_modified_date
wc.last_modified_user, wc.last_modified_date
, wc.is_open_coupon, wc.is_open_prize
FROM
FROM
weixin_clock_group_classify wcc
weixin_clock_group_classify wcc
LEFT JOIN weixin_clock wc ON wcc.weixin_clock_id = wc.weixin_clock_id
LEFT JOIN weixin_clock wc ON wcc.weixin_clock_id = wc.weixin_clock_id
...
...
pcloud-service-book/src/main/resources/mapper/weixinclock/WeixinClockUserCoupon.Mapper.xml
0 → 100644
View file @
e06f5ca3
<?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.pcloud.book.weixinclock.dao.impl.WeixinClockUserCouponDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.weixinclock.entity.WeixinClockUserCoupon"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"weixin_clock_id"
property=
"weixinClockId"
jdbcType=
"BIGINT"
/>
<result
column=
"wx_user_id"
property=
"wxUserId"
jdbcType=
"VARCHAR"
/>
<result
column=
"wx_group_id"
property=
"wxGroupId"
jdbcType=
"VARCHAR"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"BIGINT"
/>
<result
column=
"clock_coupon_id"
property=
"clockCouponId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, weixin_clock_id, wx_user_id, wx_group_id, wechat_user_id, clock_coupon_id, create_time, update_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.weixinclock.entity.WeixinClockUserCoupon"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into weixin_clock_user_coupon (weixin_clock_id, wx_user_id, wx_group_id, wechat_user_id, clock_coupon_id, create_time, update_time)
values (#{weixinClockId}, #{wxUserId}, #{wxGroupId}, #{wechatUserId}, #{clockCouponId}, now(), now())
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.weixinclock.entity.WeixinClockUserCoupon"
>
update weixin_clock_user_coupon
<set>
<if
test=
"weixinClockId != null"
>
weixin_clock_id = #{weixinClockId},
</if>
<if
test=
"wxUserId != null"
>
wx_user_id = #{wxUserId},
</if>
<if
test=
"wxGroupId"
>
wx_group_id = #{wxGroupId},
</if>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId},
</if>
<if
test=
"clockCouponId != null"
>
clock_coupon_id = #{clockCouponId},
</if>
update_time = now(),
</set>
where id = #{id}
</update>
<select
id=
"getByGroupAndUser"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from weixin_clock_user_coupon
where wx_group_id = #{wxGroupId}
and wechat_user_id = #{wechatUserId}
</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