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
06b52620
Commit
06b52620
authored
May 13, 2020
by
朱亚洁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1002891资讯和券的资源外链访问数据统计记录
parent
f5c94d91
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
827 additions
and
19 deletions
+827
-19
AppletNewsBiz.java
...c/main/java/com/pcloud/book/applet/biz/AppletNewsBiz.java
+24
-0
AppletNewsBizImpl.java
...va/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
+107
-1
AppletLinkClickDao.java
...n/java/com/pcloud/book/applet/dao/AppletLinkClickDao.java
+35
-0
AppletNewsDao.java
...c/main/java/com/pcloud/book/applet/dao/AppletNewsDao.java
+14
-0
AppletLinkClickDaoImpl.java
...m/pcloud/book/applet/dao/impl/AppletLinkClickDaoImpl.java
+39
-0
AppletNewsDaoImpl.java
...va/com/pcloud/book/applet/dao/impl/AppletNewsDaoImpl.java
+15
-0
AppletNewsDTO.java
...c/main/java/com/pcloud/book/applet/dto/AppletNewsDTO.java
+6
-0
PvuvDTO.java
...ook/src/main/java/com/pcloud/book/applet/dto/PvuvDTO.java
+27
-0
AppletLinkClick.java
...n/java/com/pcloud/book/applet/entity/AppletLinkClick.java
+55
-0
AppletNews.java
...c/main/java/com/pcloud/book/applet/entity/AppletNews.java
+2
-0
DataRecordTypeEnum.java
...java/com/pcloud/book/applet/enums/DataRecordTypeEnum.java
+23
-0
DataTypeEnum.java
.../main/java/com/pcloud/book/applet/enums/DataTypeEnum.java
+27
-0
AppletHomeFacade.java
.../java/com/pcloud/book/applet/facade/AppletHomeFacade.java
+46
-3
GiftCouponPackageBiz.java
.../com/pcloud/book/giftcoupon/biz/GiftCouponPackageBiz.java
+16
-2
GiftCouponPackageBizImpl.java
...ud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
+86
-0
GiftCouponPackageDao.java
.../com/pcloud/book/giftcoupon/dao/GiftCouponPackageDao.java
+11
-0
GiftCouponPackageDaoImpl.java
...ud/book/giftcoupon/dao/impl/GiftCouponPackageDaoImpl.java
+14
-0
GiftPackageDTO.java
...n/java/com/pcloud/book/giftcoupon/dto/GiftPackageDTO.java
+22
-0
GiftCouponPackage.java
.../com/pcloud/book/giftcoupon/entity/GiftCouponPackage.java
+5
-1
GiftCouponPackageFacade.java
...cloud/book/giftcoupon/facade/GiftCouponPackageFacade.java
+24
-0
AppletLinkClickMapper.xml
...rc/main/resources/mapper/applet/AppletLinkClickMapper.xml
+51
-0
AppletNews.xml
...vice-book/src/main/resources/mapper/applet/AppletNews.xml
+89
-5
GiftCouplePackageDao.xml
...main/resources/mapper/giftConpon/GiftCouplePackageDao.xml
+89
-7
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletNewsBiz.java
View file @
06b52620
...
@@ -4,6 +4,7 @@ import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
...
@@ -4,6 +4,7 @@ import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
import
com.pcloud.book.applet.dto.AppletNewsCommentDTO
;
import
com.pcloud.book.applet.dto.AppletNewsCommentDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsVO
;
import
com.pcloud.book.applet.dto.AppletNewsVO
;
import
com.pcloud.book.applet.entity.AppletLinkClick
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsComment
;
import
com.pcloud.book.applet.entity.AppletNewsComment
;
...
@@ -156,5 +157,28 @@ public interface AppletNewsBiz {
...
@@ -156,5 +157,28 @@ public interface AppletNewsBiz {
List
<
String
>
getNewsSourceList
();
List
<
String
>
getNewsSourceList
();
/**
* 资讯和券的资源外链访问埋点
* @author:zhuyajie
* @date:2020/5/11 14:11
* * @param null
*/
void
addClickRecord
(
AppletLinkClick
appletLinkClick
);
/**
* 根据跳转地址查询链接编号
* @author:zhuyajie
* @date:2020/5/11 17:39
* * @param null
*/
String
getUrlNumberByUrl
(
String
jumpUrl
);
/**
* 资讯统计分析
* @author:zhuyajie
* @date:2020/5/11 19:54
* * @param null
*/
PageBeanNew
<
AppletNewsDTO
>
listAppletNews4Analysis
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
subjectLabelId
,
Integer
linkOnly
,
Long
rightsClassifyId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
View file @
06b52620
...
@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
...
@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.dao.AppletLinkClickDao
;
import
com.pcloud.book.applet.dao.AppletNewsClassifyDao
;
import
com.pcloud.book.applet.dao.AppletNewsClassifyDao
;
import
com.pcloud.book.applet.dao.AppletNewsCommentDao
;
import
com.pcloud.book.applet.dao.AppletNewsCommentDao
;
import
com.pcloud.book.applet.dao.AppletNewsDao
;
import
com.pcloud.book.applet.dao.AppletNewsDao
;
...
@@ -9,9 +10,14 @@ import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
...
@@ -9,9 +10,14 @@ import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
import
com.pcloud.book.applet.dto.AppletNewsCommentDTO
;
import
com.pcloud.book.applet.dto.AppletNewsCommentDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.applet.dto.AppletNewsVO
;
import
com.pcloud.book.applet.dto.AppletNewsVO
;
import
com.pcloud.book.applet.dto.PvuvDTO
;
import
com.pcloud.book.applet.entity.AppletLinkClick
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsComment
;
import
com.pcloud.book.applet.entity.AppletNewsComment
;
import
com.pcloud.book.applet.enums.DataRecordTypeEnum
;
import
com.pcloud.book.applet.enums.DataTypeEnum
;
import
com.pcloud.book.applet.enums.IntroduceTypeEnum
;
import
com.pcloud.book.applet.vo.AppletNewsClassifyVO
;
import
com.pcloud.book.applet.vo.AppletNewsClassifyVO
;
import
com.pcloud.book.applet.vo.AppletNewsShowStateVO
;
import
com.pcloud.book.applet.vo.AppletNewsShowStateVO
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
...
@@ -26,8 +32,8 @@ import com.pcloud.common.exceptions.BizException;
...
@@ -26,8 +32,8 @@ 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
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
...
@@ -64,6 +70,8 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -64,6 +70,8 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
private
BookLabelDao
bookLabelDao
;
private
BookLabelDao
bookLabelDao
;
@Autowired
@Autowired
private
AssistTempletConsr
assistTempletConsr
;
private
AssistTempletConsr
assistTempletConsr
;
@Autowired
private
AppletLinkClickDao
appletLinkClickDao
;
@Override
@Override
public
Long
addAppletNewsClassify
(
AppletNewsClassify
appletNewsClassify
)
{
public
Long
addAppletNewsClassify
(
AppletNewsClassify
appletNewsClassify
)
{
...
@@ -102,6 +110,9 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -102,6 +110,9 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
@Override
@Override
public
Long
addAppletNews
(
AppletNews
appletNews
)
{
public
Long
addAppletNews
(
AppletNews
appletNews
)
{
if
(
urlNumberExist
(
appletNews
)){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"链接编号重复"
);
}
appletNews
.
setShowState
(
false
);
appletNews
.
setShowState
(
false
);
rightsSettingBiz
.
setClassifyAndLabel
(
appletNews
);
rightsSettingBiz
.
setClassifyAndLabel
(
appletNews
);
appletNewsDao
.
insert
(
appletNews
);
appletNewsDao
.
insert
(
appletNews
);
...
@@ -114,6 +125,9 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -114,6 +125,9 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
if
(
null
==
appletNews
.
getId
()){
if
(
null
==
appletNews
.
getId
()){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"id为空"
);
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"id为空"
);
}
}
if
(
urlNumberExist
(
appletNews
)){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"链接编号重复"
);
}
AppletNews
beforeNews
=
appletNewsDao
.
getById
(
appletNews
.
getId
());
AppletNews
beforeNews
=
appletNewsDao
.
getById
(
appletNews
.
getId
());
rightsSettingBiz
.
setClassifyAndLabel
(
appletNews
);
rightsSettingBiz
.
setClassifyAndLabel
(
appletNews
);
appletNewsDao
.
update
(
appletNews
);
appletNewsDao
.
update
(
appletNews
);
...
@@ -411,4 +425,96 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -411,4 +425,96 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
}
}
}
}
@Override
public
void
addClickRecord
(
AppletLinkClick
appletLinkClick
)
{
appletLinkClickDao
.
insert
(
appletLinkClick
);
}
@Override
public
String
getUrlNumberByUrl
(
String
jumpUrl
)
{
if
(
StringUtil
.
isEmpty
(
jumpUrl
)){
return
""
;
}
return
appletNewsDao
.
getUrlNumberByJumpUrl
(
jumpUrl
);
}
@Override
public
PageBeanNew
<
AppletNewsDTO
>
listAppletNews4Analysis
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
subjectLabelId
,
Integer
linkOnly
,
Long
rightsClassifyId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"name"
,
name
);
paramMap
.
put
(
"linkOnly"
,
linkOnly
);
paramMap
.
put
(
"rightsClassifyId"
,
rightsClassifyId
);
//处理分类
if
(
null
!=
firstClassify
){
BaseTempletClassify
classify
=
new
BaseTempletClassify
();
classify
.
setFirstClassify
(
firstClassify
);
classify
.
setSecondClassify
(
secondClassify
);
classify
.
setGradeLabelId
(
gradeLabelId
);
classify
.
setSubjectLabelId
(
subjectLabelId
);
rightsSettingBiz
.
setClassifyAndLabel
(
classify
);
paramMap
.
put
(
"firstClassify"
,
classify
.
getFirstClassify
());
paramMap
.
put
(
"secondClassify"
,
classify
.
getSecondClassify
());
paramMap
.
put
(
"gradeLabelId"
,
classify
.
getGradeLabelId
());
paramMap
.
put
(
"subjectLabelId"
,
classify
.
getSubjectLabelId
());
}
else
{
paramMap
.
put
(
"gradeLabelId"
,
gradeLabelId
);
paramMap
.
put
(
"subjectLabelId"
,
subjectLabelId
);
}
PageBeanNew
<
AppletNewsDTO
>
pageBeanNew
=
appletNewsDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
)
,
paramMap
,
"listAppletNews4Analysis"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
())){
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
setLabelContent
(
pageBeanNew
.
getRecordList
());
fillStatistic
(
pageBeanNew
.
getRecordList
());
return
pageBeanNew
;
}
/**
* 点击量浏览量
* @author:zhuyajie
* @date:2020/5/11 20:09
* * @param null
*/
private
void
fillStatistic
(
List
<
AppletNewsDTO
>
recordList
)
{
if
(
ListUtils
.
isEmpty
(
recordList
))
{
return
;
}
List
<
Long
>
newsIds
=
recordList
.
stream
().
filter
(
s
->
s
!=
null
).
map
(
AppletNewsDTO:
:
getId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
PvuvDTO
>
clickMap
=
appletLinkClickDao
.
mapPVUV
(
DataTypeEnum
.
news
.
code
,
DataRecordTypeEnum
.
click
.
code
,
newsIds
);
Map
<
Long
,
PvuvDTO
>
browseMap
=
appletLinkClickDao
.
mapPVUV
(
DataTypeEnum
.
news
.
code
,
DataRecordTypeEnum
.
browse
.
code
,
newsIds
);
for
(
AppletNewsDTO
appletNewsDTO
:
recordList
)
{
Long
newsId
=
appletNewsDTO
.
getId
();
if
(!
MapUtils
.
isEmpty
(
clickMap
)
&&
clickMap
.
containsKey
(
newsId
))
{
PvuvDTO
pvuvDTO
=
clickMap
.
get
(
newsId
);
appletNewsDTO
.
setClickPVUV
(
pvuvDTO
.
getPv
()
+
"/"
+
pvuvDTO
.
getUv
());
}
else
{
appletNewsDTO
.
setClickPVUV
(
"0/0"
);
}
if
(!
MapUtils
.
isEmpty
(
browseMap
)
&&
browseMap
.
containsKey
(
newsId
))
{
PvuvDTO
pvuvDTO
=
browseMap
.
get
(
newsId
);
appletNewsDTO
.
setBrowsePVUV
(
pvuvDTO
.
getPv
()
+
"/"
+
pvuvDTO
.
getUv
());
}
else
{
appletNewsDTO
.
setBrowsePVUV
(
"0/0"
);
}
}
}
/**
* 链接编号是否重复
* @author:zhuyajie
* @date:2020/5/11 18:50
* * @param null
*/
public
Boolean
urlNumberExist
(
AppletNews
appletNews
)
{
Boolean
exist
=
false
;
if
(!
IntroduceTypeEnum
.
web_introduct
.
code
.
equals
(
appletNews
.
getJumpType
()))
{
//非外部链接
return
exist
;
}
if
(!
StringUtil
.
isEmpty
(
appletNews
.
getJumpUrl
())
&&
!
StringUtil
.
isEmpty
(
appletNews
.
getUrlNumber
()))
{
exist
=
appletNewsDao
.
urlNumberExist
(
appletNews
.
getJumpUrl
(),
appletNews
.
getUrlNumber
(),
appletNews
.
getId
());
}
return
exist
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletLinkClickDao.java
0 → 100644
View file @
06b52620
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.dto.PvuvDTO
;
import
com.pcloud.book.applet.entity.AppletLinkClick
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
import
java.util.Map
;
/**
* 小程序资讯/券库点击埋点(AppletLinkClick)表数据库访问层
*
* @author makejava
* @since 2020-05-11 11:41:35
*/
public
interface
AppletLinkClickDao
extends
BaseDao
<
AppletLinkClick
>{
/**
* 点击量浏览量pvuv
* @author:zhuyajie
* @date:2020/5/12 10:44
* * @param null
*/
Map
<
Long
,
PvuvDTO
>
mapPVUV
(
Integer
typeId
,
Integer
recordType
,
List
<
Long
>
fromIds
);
/**
* 优惠券使用量
* @author:zhuyajie
* @date:2020/5/12 10:44
* * @param null
*/
Map
<
Long
,
PvuvDTO
>
mapCouponUseCount
(
List
<
Long
>
fromIds
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletNewsDao.java
View file @
06b52620
...
@@ -67,4 +67,18 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
...
@@ -67,4 +67,18 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
void
batchDeleteAppletNews
(
List
<
Long
>
appletNewsIds
);
void
batchDeleteAppletNews
(
List
<
Long
>
appletNewsIds
);
/**
* 根据跳转地址查询
* @author:zhuyajie
* @date:2020/5/11 17:39
* * @param null
*/
String
getUrlNumberByJumpUrl
(
String
jumpUrl
);
/**
* 链接编号是否存在
* @author:zhuyajie
* @date:2020/5/11 18:43
* * @param null
*/
Boolean
urlNumberExist
(
String
jumpUrl
,
String
urlNumber
,
Long
id
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletLinkClickDaoImpl.java
0 → 100644
View file @
06b52620
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.AppletLinkClickDao
;
import
com.pcloud.book.applet.dto.PvuvDTO
;
import
com.pcloud.book.applet.entity.AppletLinkClick
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AppletLinkClickDaoImpl
* @Author zhuyajie
* @Description
* @Date 2020/5/11 13:56
* @Version 1.0
**/
@Component
public
class
AppletLinkClickDaoImpl
extends
BaseDaoImpl
<
AppletLinkClick
>
implements
AppletLinkClickDao
{
@Override
public
Map
<
Long
,
PvuvDTO
>
mapPVUV
(
Integer
typeId
,
Integer
recordType
,
List
<
Long
>
fromIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"list"
,
fromIds
);
map
.
put
(
"recordType"
,
recordType
);
map
.
put
(
"typeId"
,
typeId
);
return
getSessionTemplate
().
selectMap
(
getStatement
(
"mapPVUV"
),
map
,
"fromId"
);
}
@Override
public
Map
<
Long
,
PvuvDTO
>
mapCouponUseCount
(
List
<
Long
>
fromIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"list"
,
fromIds
);
return
getSessionTemplate
().
selectMap
(
getStatement
(
"mapCouponUseCount"
),
map
,
"fromId"
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletNewsDaoImpl.java
View file @
06b52620
...
@@ -6,6 +6,7 @@ import com.pcloud.book.applet.entity.AppletNews;
...
@@ -6,6 +6,7 @@ import com.pcloud.book.applet.entity.AppletNews;
import
com.pcloud.book.applet.vo.AppletNewsClassifyVO
;
import
com.pcloud.book.applet.vo.AppletNewsClassifyVO
;
import
com.pcloud.book.applet.vo.AppletNewsShowStateVO
;
import
com.pcloud.book.applet.vo.AppletNewsShowStateVO
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -102,4 +103,18 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
...
@@ -102,4 +103,18 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
getSessionTemplate
().
delete
(
getStatement
(
"batchDeleteAppletNews"
),
list
);
getSessionTemplate
().
delete
(
getStatement
(
"batchDeleteAppletNews"
),
list
);
}
}
@Override
public
String
getUrlNumberByJumpUrl
(
String
jumpUrl
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getUrlNumberByJumpUrl"
),
jumpUrl
);
}
@Override
public
Boolean
urlNumberExist
(
String
jumpUrl
,
String
urlNumber
,
Long
id
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"jumpUrl"
,
jumpUrl
);
map
.
put
(
"urlNumber"
,
urlNumber
);
map
.
put
(
"id"
,
id
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"urlNumberExist"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/AppletNewsDTO.java
View file @
06b52620
...
@@ -79,4 +79,10 @@ public class AppletNewsDTO extends BaseDto {
...
@@ -79,4 +79,10 @@ public class AppletNewsDTO extends BaseDto {
private
Integer
jumpType
;
private
Integer
jumpType
;
@ApiModelProperty
(
"跳转地址"
)
@ApiModelProperty
(
"跳转地址"
)
private
String
jumpUrl
;
private
String
jumpUrl
;
@ApiModelProperty
(
"跳转外链编号"
)
private
String
urlNumber
;
@ApiModelProperty
(
"点击量pv/uv"
)
private
String
clickPVUV
;
@ApiModelProperty
(
"浏览量pv/uv"
)
private
String
browsePVUV
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/PvuvDTO.java
0 → 100644
View file @
06b52620
package
com
.
pcloud
.
book
.
applet
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
lombok.Data
;
/**
* @ClassName com.pcloud.book.applet.dto.PvuvDTO
* @Author zhuyajie
* @Description pvuv
* @Date 2020/5/12 10:35
* @Version 1.0
**/
@Data
public
class
PvuvDTO
extends
BaseDto
{
private
Long
fromId
;
private
Integer
pv
;
private
Integer
uv
;
/**
* 数量
*/
private
Integer
count
;
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletLinkClick.java
0 → 100644
View file @
06b52620
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
javax.validation.constraints.NotNull
;
import
lombok.Data
;
/**
* 小程序资讯/券库点击埋点(AppletLinkClick)实体类
*
* @author makejava
* @since 2020-05-11 11:41:33
*/
@Data
public
class
AppletLinkClick
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
452524180857423480L
;
/**
* 用户id
*/
@NotNull
private
Long
wechatUserId
;
/**
* 1资讯/2 券库
*/
@NotNull
private
Integer
typeId
;
/**
* 业务id
*/
@NotNull
private
Long
fromId
;
/**
* 业务id
*/
@NotNull
private
Integer
recordType
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletNews.java
View file @
06b52620
...
@@ -50,4 +50,6 @@ public class AppletNews extends BaseTempletClassify {
...
@@ -50,4 +50,6 @@ public class AppletNews extends BaseTempletClassify {
private
Integer
jumpType
;
private
Integer
jumpType
;
@ApiModelProperty
(
"跳转地址"
)
@ApiModelProperty
(
"跳转地址"
)
private
String
jumpUrl
;
private
String
jumpUrl
;
@ApiModelProperty
(
"跳转外链编号"
)
private
String
urlNumber
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/enums/DataRecordTypeEnum.java
0 → 100644
View file @
06b52620
package
com
.
pcloud
.
book
.
applet
.
enums
;
public
enum
DataRecordTypeEnum
{
/**
* 1点击量
*/
click
(
1
),
/**
* 2浏览量
*/
browse
(
2
),
/**
* 3使用量
*/
use
(
3
);
public
final
Integer
code
;
DataRecordTypeEnum
(
Integer
code
)
{
this
.
code
=
code
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/enums/DataTypeEnum.java
0 → 100644
View file @
06b52620
package
com
.
pcloud
.
book
.
applet
.
enums
;
/**
* @ClassName com.pcloud.book.applet.enums.DataTypeEnum
* @Author zhuyajie
* @Description 统计数据类型
* @Date 2020/5/12 10:52
* @Version 1.0
**/
public
enum
DataTypeEnum
{
/**
* 1资讯
*/
news
(
1
),
/**
* 2券库
*/
gift_coupon
(
2
);
public
final
Integer
code
;
DataTypeEnum
(
Integer
code
)
{
this
.
code
=
code
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletHomeFacade.java
View file @
06b52620
...
@@ -16,6 +16,7 @@ import com.pcloud.book.applet.dto.BookDTO4Booklist;
...
@@ -16,6 +16,7 @@ import com.pcloud.book.applet.dto.BookDTO4Booklist;
import
com.pcloud.book.applet.entity.AppletBanner
;
import
com.pcloud.book.applet.entity.AppletBanner
;
import
com.pcloud.book.applet.entity.AppletBooklist
;
import
com.pcloud.book.applet.entity.AppletBooklist
;
import
com.pcloud.book.applet.entity.AppletBooklistClassify
;
import
com.pcloud.book.applet.entity.AppletBooklistClassify
;
import
com.pcloud.book.applet.entity.AppletLinkClick
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsClassify
;
import
com.pcloud.book.applet.entity.AppletNewsComment
;
import
com.pcloud.book.applet.entity.AppletNewsComment
;
...
@@ -32,10 +33,9 @@ import com.pcloud.common.utils.ListUtils;
...
@@ -32,10 +33,9 @@ import com.pcloud.common.utils.ListUtils;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
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.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -48,6 +48,10 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -48,6 +48,10 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
@Api
(
description
=
"小睿小程序首页"
)
@Api
(
description
=
"小睿小程序首页"
)
@RestController
(
"appletHomeFacade"
)
@RestController
(
"appletHomeFacade"
)
@RequestMapping
(
"appletHome"
)
@RequestMapping
(
"appletHome"
)
...
@@ -664,6 +668,45 @@ public class AppletHomeFacade {
...
@@ -664,6 +668,45 @@ public class AppletHomeFacade {
return
new
ResponseDto
<>();
return
new
ResponseDto
<>();
}
}
@ApiOperation
(
"资讯和券的资源外链访问埋点"
)
@PostMapping
(
"addClickRecord"
)
public
ResponseDto
<?>
addClickRecord
(
@RequestBody
@Validated
AppletLinkClick
appletLinkClick
){
if
(
null
==
appletLinkClick
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
appletNewsBiz
.
addClickRecord
(
appletLinkClick
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"根据链接地址获取外链编号"
)
@GetMapping
(
"getUrlNumberByUrl"
)
public
ResponseDto
<
String
>
getUrlNumberByUrl
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"url"
,
required
=
false
)
String
url
){
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
appletNewsBiz
.
getUrlNumberByUrl
(
url
));
}
@ApiOperation
(
"资讯统计分析"
)
@GetMapping
(
"listAppletNews4Analysis"
)
public
ResponseDto
<
PageBeanNew
<
AppletNewsDTO
>>
listAppletNews4Analysis
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页数量"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
@ApiParam
(
"名称/外链编号查询"
)
String
name
,
@RequestParam
(
value
=
"firstClassify"
,
required
=
false
)
@ApiParam
(
"一级书刊分类"
)
Long
firstClassify
,
@RequestParam
(
value
=
"secondClassify"
,
required
=
false
)
@ApiParam
(
"二级书刊分类"
)
Long
secondClassify
,
@RequestParam
(
value
=
"gradeLabelId"
,
required
=
false
)
@ApiParam
(
"年级标签"
)
Long
gradeLabelId
,
@RequestParam
(
value
=
"subjectLabelId"
,
required
=
false
)
@ApiParam
(
"科目标签"
)
Long
subjectLabelId
,
@RequestParam
(
value
=
"linkOnly"
,
required
=
false
)
@ApiParam
(
"只看第三方"
)
Integer
linkOnly
,
@RequestParam
(
value
=
"rightsClassifyId"
,
required
=
false
)
@ApiParam
(
"权益分类"
)
Long
rightsClassifyId
)
throws
PermissionException
{
SessionUtil
.
getInfoToken4Redis
(
token
);
if
(
null
==
currentPage
||
null
==
numPerPage
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少分页参数"
);
}
return
new
ResponseDto
<>(
appletNewsBiz
.
listAppletNews4Analysis
(
currentPage
,
numPerPage
,
name
,
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
linkOnly
,
rightsClassifyId
));
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/GiftCouponPackageBiz.java
View file @
06b52620
...
@@ -7,8 +7,6 @@ import com.pcloud.book.giftcoupon.entity.GiftCouponPackage;
...
@@ -7,8 +7,6 @@ import com.pcloud.book.giftcoupon.entity.GiftCouponPackage;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
public
interface
GiftCouponPackageBiz
{
public
interface
GiftCouponPackageBiz
{
void
createGiftPackage
(
GiftCouponPackage
giftCouponPackage
);
void
createGiftPackage
(
GiftCouponPackage
giftCouponPackage
);
...
@@ -27,4 +25,20 @@ public interface GiftCouponPackageBiz {
...
@@ -27,4 +25,20 @@ public interface GiftCouponPackageBiz {
void
useGiftCoupon
(
Long
wechatUserId
,
Long
receiveId
);
void
useGiftCoupon
(
Long
wechatUserId
,
Long
receiveId
);
void
createGiftReceiveBatch
(
BatchReceiveDTO
batchReceiveDTO
,
Long
wechatUserId
);
void
createGiftReceiveBatch
(
BatchReceiveDTO
batchReceiveDTO
,
Long
wechatUserId
);
/**
* 根据链接获取链接编号
* @author:zhuyajie
* @date:2020/5/11 17:48
* * @param null
*/
String
getUrlNumberByUrl
(
String
url
);
/**
* 兑换券使用分析
* @author:zhuyajie
* @date:2020/5/11 19:29
* * @param null
*/
PageBeanNew
<
GiftPackageDTO
>
listGiftPackage4Analysis
(
String
title
,
Integer
state
,
Integer
couponType
,
Integer
currentPage
,
Integer
numPerPage
,
Integer
linkOnly
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
View file @
06b52620
package
com
.
pcloud
.
book
.
giftcoupon
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
giftcoupon
.
biz
.
impl
;
import
com.pcloud.book.applet.dao.AppletLinkClickDao
;
import
com.pcloud.book.applet.dto.PvuvDTO
;
import
com.pcloud.book.applet.enums.DataRecordTypeEnum
;
import
com.pcloud.book.applet.enums.DataTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz
;
import
com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz
;
...
@@ -12,11 +16,14 @@ import com.pcloud.book.giftcoupon.dto.GiftReceiveDTO;
...
@@ -12,11 +16,14 @@ import com.pcloud.book.giftcoupon.dto.GiftReceiveDTO;
import
com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.enums.CouponTypeEnum
;
import
com.pcloud.book.giftcoupon.enums.CouponUseTypeEnum
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -37,12 +44,17 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -37,12 +44,17 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
private
GiftReceiveDao
giftReceiveDao
;
private
GiftReceiveDao
giftReceiveDao
;
@Autowired
@Autowired
private
GiftParamCheck
giftParamCheck
;
private
GiftParamCheck
giftParamCheck
;
@Autowired
private
AppletLinkClickDao
appletLinkClickDao
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
value
=
"新增专享礼包"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"新增专享礼包"
,
isAfterReturn
=
false
)
@Override
@Override
public
void
createGiftPackage
(
GiftCouponPackage
giftCouponPackage
)
{
public
void
createGiftPackage
(
GiftCouponPackage
giftCouponPackage
)
{
giftParamCheck
.
checkGiftAddParam
(
giftCouponPackage
);
giftParamCheck
.
checkGiftAddParam
(
giftCouponPackage
);
if
(
urlNumberExist
(
giftCouponPackage
)){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"链接编号重复"
);
}
if
(
StringUtil
.
isBlank
(
giftCouponPackage
.
getCoverPic
())){
if
(
StringUtil
.
isBlank
(
giftCouponPackage
.
getCoverPic
())){
giftCouponPackage
.
setCoverPic
(
BookConstant
.
DEFAULT_COVER_PIC
);
giftCouponPackage
.
setCoverPic
(
BookConstant
.
DEFAULT_COVER_PIC
);
}
}
...
@@ -54,6 +66,9 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -54,6 +66,9 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
@Override
@Override
public
void
updateGiftPackage
(
GiftCouponPackage
giftCouponPackage
)
{
public
void
updateGiftPackage
(
GiftCouponPackage
giftCouponPackage
)
{
giftParamCheck
.
checkGiftAddParam
(
giftCouponPackage
);
giftParamCheck
.
checkGiftAddParam
(
giftCouponPackage
);
if
(
urlNumberExist
(
giftCouponPackage
)){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"链接编号重复"
);
}
if
(
StringUtil
.
isBlank
(
giftCouponPackage
.
getCoverPic
())){
if
(
StringUtil
.
isBlank
(
giftCouponPackage
.
getCoverPic
())){
giftCouponPackage
.
setCoverPic
(
BookConstant
.
DEFAULT_COVER_PIC
);
giftCouponPackage
.
setCoverPic
(
BookConstant
.
DEFAULT_COVER_PIC
);
}
}
...
@@ -188,4 +203,75 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -188,4 +203,75 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
giftReceiveDao
.
insert
(
list
);
giftReceiveDao
.
insert
(
list
);
}
}
@Override
public
String
getUrlNumberByUrl
(
String
url
)
{
if
(
StringUtil
.
isEmpty
(
url
)){
return
""
;
}
return
giftCouponPackageDao
.
getUrlNumberByAddress
(
url
);
}
@Override
public
PageBeanNew
<
GiftPackageDTO
>
listGiftPackage4Analysis
(
String
title
,
Integer
state
,
Integer
couponType
,
Integer
currentPage
,
Integer
numPerPage
,
Integer
linkOnly
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"title"
,
title
);
paramMap
.
put
(
"state"
,
state
);
paramMap
.
put
(
"couponType"
,
couponType
);
paramMap
.
put
(
"linkOnly"
,
linkOnly
);
PageBeanNew
<
GiftPackageDTO
>
pageBeanNew
=
giftCouponPackageDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listGiftPackage4Analysis"
);
if
(
pageBeanNew
==
null
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
buildReceiveNum
(
pageBeanNew
.
getRecordList
());
fillUseAnalysis
(
pageBeanNew
.
getRecordList
());
return
pageBeanNew
;
}
/**
* 填充使用分析
* @author:zhuyajie
* @date:2020/5/11 19:43
* * @param null
*/
private
void
fillUseAnalysis
(
List
<
GiftPackageDTO
>
recordList
)
{
if
(
ListUtils
.
isEmpty
(
recordList
)){
return
;
}
List
<
Long
>
ids
=
recordList
.
stream
().
filter
(
s
->
s
!=
null
).
map
(
GiftPackageDTO:
:
getId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
PvuvDTO
>
clickMap
=
appletLinkClickDao
.
mapPVUV
(
DataTypeEnum
.
gift_coupon
.
code
,
DataRecordTypeEnum
.
click
.
code
,
ids
);
Map
<
Long
,
PvuvDTO
>
useMap
=
appletLinkClickDao
.
mapCouponUseCount
(
ids
);
for
(
GiftPackageDTO
giftPackageDTO
:
recordList
)
{
Long
id
=
giftPackageDTO
.
getId
();
if
(!
MapUtils
.
isEmpty
(
clickMap
)
&&
clickMap
.
containsKey
(
id
))
{
PvuvDTO
pvuvDTO
=
clickMap
.
get
(
id
);
giftPackageDTO
.
setClickPVUV
(
pvuvDTO
.
getPv
()
+
"/"
+
pvuvDTO
.
getUv
());
}
else
{
giftPackageDTO
.
setClickPVUV
(
"0/0"
);
}
if
(!
MapUtils
.
isEmpty
(
useMap
)
&&
useMap
.
containsKey
(
id
))
{
PvuvDTO
pvuvDTO
=
useMap
.
get
(
id
);
giftPackageDTO
.
setUseNum
(
pvuvDTO
.
getCount
());
}
else
{
giftPackageDTO
.
setUseNum
(
0
);
}
}
}
/**
* 链接编号是否重复
* @author:zhuyajie
* @date:2020/5/11 18:50
* * @param null
*/
public
Boolean
urlNumberExist
(
GiftCouponPackage
giftCouponPackage
)
{
Boolean
exist
=
false
;
if
(!
CouponTypeEnum
.
COURSE_COUPON
.
value
.
equals
(
giftCouponPackage
.
getCouponType
())
&&
!
CouponUseTypeEnum
.
LINK
.
value
.
equals
(
giftCouponPackage
.
getUseType
()))
{
//非外部链接
return
exist
;
}
if
(!
StringUtil
.
isEmpty
(
giftCouponPackage
.
getExchangeAddress
())
&&
!
StringUtil
.
isEmpty
(
giftCouponPackage
.
getUrlNumber
()))
{
exist
=
giftCouponPackageDao
.
urlNumberExist
(
giftCouponPackage
.
getExchangeAddress
(),
giftCouponPackage
.
getUrlNumber
(),
giftCouponPackage
.
getId
());
}
return
exist
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/GiftCouponPackageDao.java
View file @
06b52620
...
@@ -25,4 +25,14 @@ public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> {
...
@@ -25,4 +25,14 @@ public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> {
void
reduceStock
(
Long
id
);
void
reduceStock
(
Long
id
);
void
reduceStockBatch
(
List
<
Long
>
packageIds
);
void
reduceStockBatch
(
List
<
Long
>
packageIds
);
String
getUrlNumberByAddress
(
String
exchangeAddress
);
/**
* 链接编号是否存在
* @author:zhuyajie
* @date:2020/5/11 18:43
* * @param null
*/
Boolean
urlNumberExist
(
String
exchangeAddress
,
String
urlNumber
,
Long
id
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/impl/GiftCouponPackageDaoImpl.java
View file @
06b52620
...
@@ -46,4 +46,18 @@ public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> imp
...
@@ -46,4 +46,18 @@ public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> imp
map
.
put
(
"packageIds"
,
packageIds
);
map
.
put
(
"packageIds"
,
packageIds
);
super
.
getSqlSession
().
update
(
getStatement
(
"reduceStockBatch"
),
map
);
super
.
getSqlSession
().
update
(
getStatement
(
"reduceStockBatch"
),
map
);
}
}
@Override
public
String
getUrlNumberByAddress
(
String
exchangeAddress
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getUrlNumberByAddress"
),
exchangeAddress
);
}
@Override
public
Boolean
urlNumberExist
(
String
exchangeAddress
,
String
urlNumber
,
Long
id
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"exchangeAddress"
,
exchangeAddress
);
map
.
put
(
"urlNumber"
,
urlNumber
);
map
.
put
(
"id"
,
id
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"urlNumberExist"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/GiftPackageDTO.java
View file @
06b52620
...
@@ -65,4 +65,26 @@ public class GiftPackageDTO {
...
@@ -65,4 +65,26 @@ public class GiftPackageDTO {
* 使用说明
* 使用说明
*/
*/
private
String
instructions
;
private
String
instructions
;
/**
* 课程券使用方式(1-链接兑取,2-复制码)
*/
private
Integer
useType
;
/**
* 兑换地址
*/
private
String
exchangeAddress
;
/**
* 跳转外链编号
*/
private
String
urlNumber
;
/**
* 使用量
*/
private
Integer
useNum
;
/**
* 点击量pv/uv
*/
private
String
clickPVUV
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/entity/GiftCouponPackage.java
View file @
06b52620
...
@@ -58,6 +58,9 @@ public class GiftCouponPackage extends BaseEntity {
...
@@ -58,6 +58,9 @@ public class GiftCouponPackage extends BaseEntity {
* 兑换地址
* 兑换地址
*/
*/
private
String
exchangeAddress
;
private
String
exchangeAddress
;
/**
* 跳转外链编号
*/
private
String
urlNumber
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/facade/GiftCouponPackageFacade.java
View file @
06b52620
...
@@ -23,6 +23,7 @@ import com.pcloud.common.exceptions.BizException;
...
@@ -23,6 +23,7 @@ import com.pcloud.common.exceptions.BizException;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.CookieValue;
...
@@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.CookieValue;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -144,4 +146,26 @@ public class GiftCouponPackageFacade {
...
@@ -144,4 +146,26 @@ public class GiftCouponPackageFacade {
return
new
ResponseDto
<>();
return
new
ResponseDto
<>();
}
}
@ApiOperation
(
"根据链接地址获取外链编号"
)
@GetMapping
(
"getUrlNumberByUrl"
)
public
ResponseDto
<
String
>
getUrlNumberByUrl
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"url"
,
required
=
false
)
String
url
){
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<>(
giftCouponPackageBiz
.
getUrlNumberByUrl
(
url
));
}
@ApiOperation
(
"兑换券使用分析"
)
@GetMapping
(
"/listGiftPackage4Analysis"
)
public
ResponseDto
<
PageBeanNew
<
GiftPackageDTO
>>
listGiftPackage4Analysis
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"title"
,
required
=
false
)
@ApiParam
(
"名称/链接编号"
)
String
title
,
@RequestParam
(
value
=
"state"
,
required
=
false
)
@ApiParam
(
"状态"
)
Integer
state
,
@RequestParam
(
value
=
"couponType"
,
required
=
false
)
@ApiParam
(
"券类型"
)
Integer
couponType
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"linkOnly"
,
required
=
false
)
@ApiParam
(
"只看第三方"
)
Integer
linkOnly
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getInfoToken4Redis
(
token
);
return
new
ResponseDto
<>(
giftCouponPackageBiz
.
listGiftPackage4Analysis
(
title
,
state
,
couponType
,
currentPage
,
numPerPage
,
linkOnly
));
}
}
}
pcloud-service-book/src/main/resources/mapper/applet/AppletLinkClickMapper.xml
0 → 100644
View file @
06b52620
<?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.applet.dao.impl.AppletLinkClickDaoImpl"
>
<resultMap
type=
"com.pcloud.book.applet.entity.AppletLinkClick"
id=
"AppletLinkClickMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"wechatUserId"
column=
"wechat_user_id"
jdbcType=
"INTEGER"
/>
<result
property=
"typeId"
column=
"type_id"
jdbcType=
"INTEGER"
/>
<result
property=
"fromId"
column=
"from_id"
jdbcType=
"INTEGER"
/>
<result
property=
"recordType"
column=
"record_type"
jdbcType=
"INTEGER"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.applet_link_click(wechat_user_id, type_id, from_id, record_type, create_time, create_date)
values (#{wechatUserId}, #{typeId}, #{fromId}, #{recordType}, NOW(),NOW())
</insert>
<select
id=
"mapPVUV"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.PvuvDTO"
>
SELECT
from_id fromId,
COUNT(1) pv,
COUNT(DISTINCT wechat_user_id,create_date) uv
FROM applet_link_click
WHERE type_id = #{typeId}
AND record_type = #{recordType}
AND from_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
close=
")"
open=
"("
>
#{item}
</foreach>
GROUP BY from_id
</select>
<select
id=
"mapCouponUseCount"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.PvuvDTO"
>
SELECT
from_id fromId,
COUNT(1) count
FROM applet_link_click
WHERE type_id=2
AND record_type=3
AND from_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
close=
")"
open=
"("
>
#{item}
</foreach>
GROUP BY from_id
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/applet/AppletNews.xml
View file @
06b52620
...
@@ -25,25 +25,26 @@
...
@@ -25,25 +25,26 @@
<result
column=
"rights_classify_id"
property=
"rightsClassifyId"
jdbcType=
"BIGINT"
/>
<result
column=
"rights_classify_id"
property=
"rightsClassifyId"
jdbcType=
"BIGINT"
/>
<result
column=
"jump_type"
property=
"jumpType"
jdbcType=
"INTEGER"
/>
<result
column=
"jump_type"
property=
"jumpType"
jdbcType=
"INTEGER"
/>
<result
column=
"jump_url"
property=
"jumpUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"jump_url"
property=
"jumpUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"url_number"
property=
"urlNumber"
jdbcType=
"VARCHAR"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest,
id, news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest,
pic1, pic2, pic3, content, show_state, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id,
pic1, pic2, pic3, content, show_state, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id,
jump_type, jump_url
jump_type, jump_url
, url_number
</sql>
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletNews"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.applet.entity.AppletNews"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into applet_news(
insert into applet_news(
news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest,
news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest,
pic1, pic2, pic3, content, show_state, create_time, update_time , first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id,
pic1, pic2, pic3, content, show_state, create_time, update_time , first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id,
jump_type, jump_url
jump_type, jump_url
,url_number
)
)
values (
values (
#{newsName}, #{source}, #{newsClassifyId}, #{proLabelId}, #{depLabelId}, #{purLabelId}, #{type}, #{digest},
#{newsName}, #{source}, #{newsClassifyId}, #{proLabelId}, #{depLabelId}, #{purLabelId}, #{type}, #{digest},
#{pic1}, #{pic2}, #{pic3}, #{content}, #{showState}, NOW(), NOW(), #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{pic1}, #{pic2}, #{pic3}, #{content}, #{showState}, NOW(), NOW(), #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, #{rightsClassifyId,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, #{rightsClassifyId,jdbcType=BIGINT},
#{jumpType}, #{jumpUrl}
#{jumpType}, #{jumpUrl}
, #{urlNumber}
)
)
</insert>
</insert>
...
@@ -82,6 +83,7 @@
...
@@ -82,6 +83,7 @@
jump_type = #{jumpType},
jump_type = #{jumpType},
</if>
</if>
jump_url = #{jumpUrl},
jump_url = #{jumpUrl},
url_number = #{urlNumber},
update_time=NOW()
update_time=NOW()
</set>
</set>
where id = #{id,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
...
@@ -129,7 +131,8 @@
...
@@ -129,7 +131,8 @@
n.rights_classify_id rightsClassifyId,
n.rights_classify_id rightsClassifyId,
d.classify rightsClassifyContent,
d.classify rightsClassifyContent,
n.jump_type jumpType,
n.jump_type jumpType,
n.jump_url jumpUrl
n.jump_url jumpUrl,
n.url_number urlNumber
FROM applet_news n
FROM applet_news n
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id
LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id
...
@@ -194,7 +197,8 @@
...
@@ -194,7 +197,8 @@
n.subject_label_id subjectLabelId,
n.subject_label_id subjectLabelId,
n.rights_classify_id rightsClassifyId,
n.rights_classify_id rightsClassifyId,
n.jump_type jumpType,
n.jump_type jumpType,
n.jump_url jumpUrl
n.jump_url jumpUrl,
n.url_number urlNumber
FROM applet_news n
FROM applet_news n
WHERE 1=1
WHERE 1=1
and n.show_state = 1
and n.show_state = 1
...
@@ -301,4 +305,83 @@
...
@@ -301,4 +305,83 @@
SELECT id FROM applet_news_source WHERE source=#{source}
SELECT id FROM applet_news_source WHERE source=#{source}
)
)
</select>
</select>
<select
id=
"getUrlNumberByJumpUrl"
parameterType=
"string"
resultType=
"string"
>
SELECT url_number
FROM applet_news
WHERE jump_url = #{jumpUrl}
AND jump_type = 2
AND url_number IS NOT NULL
LIMIT 1
</select>
<select
id=
"urlNumberExist"
parameterType=
"map"
resultType=
"boolean"
>
SELECT EXISTS (
SELECT id
FROM applet_news
WHERE
url_number = #{urlNumber}
AND jump_url != #{jumpUrl}
AND jump_type = 2
<if
test=
"id>0"
>
AND id != #{id}
</if>
)
</select>
<select
id=
"listAppletNews4Analysis"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.dto.AppletNewsDTO"
>
SELECT
n.id,
n.news_name newsName,
n.source,
n.news_classify_id newsClassifyId,
n.pro_label_id proLabelId,
n.dep_label_id depLabelId,
n.pur_label_id purLabelId,
n.type,
n.digest,
n.pic1,
n.pic2,
n.pic3,
n.content,
n.show_state showState,
c.news_classify newsClassify,
n.create_time createTime,
n.first_classify firstClassify,
n.second_classify secondClassify,
n.grade_label_id gradeLabelId,
n.subject_label_id subjectLabelId,
n.rights_classify_id rightsClassifyId,
d.classify rightsClassifyContent,
n.jump_type jumpType,
n.jump_url jumpUrl,
n.url_number urlNumber
FROM applet_news n
LEFT JOIN applet_news_classify c ON n.news_classify_id=c.id
LEFT JOIN rights_setting_classify d ON n.rights_classify_id = d.id
WHERE 1=1
<if
test=
"name != null"
>
AND (n.news_name LIKE CONCAT("%",#{name},"%") or n.url_number LIKE CONCAT("%",#{name},"%"))
</if>
<if
test=
"firstClassify!=null"
>
AND n.first_classify =#{firstClassify}
</if>
<if
test=
"secondClassify!=null"
>
AND n.second_classify =#{secondClassify}
</if>
<if
test=
"gradeLabelId != null"
>
AND n.grade_label_id = #{gradeLabelId}
</if>
<if
test=
"subjectLabelId != null"
>
AND n.subject_label_id = #{subjectLabelId}
</if>
<if
test=
"linkOnly == 1"
>
and n.jump_type = 2
</if>
<if
test=
"rightsClassifyId!=null"
>
AND n.rights_classify_id =#{rightsClassifyId}
</if>
ORDER BY n.create_time DESC
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftCouplePackageDao.xml
View file @
06b52620
...
@@ -17,18 +17,19 @@
...
@@ -17,18 +17,19 @@
<result
property=
"instructions"
column=
"instructions"
jdbcType=
"VARCHAR"
/>
<result
property=
"instructions"
column=
"instructions"
jdbcType=
"VARCHAR"
/>
<result
property=
"useType"
column=
"use_type"
jdbcType=
"INTEGER"
/>
<result
property=
"useType"
column=
"use_type"
jdbcType=
"INTEGER"
/>
<result
property=
"exchangeAddress"
column=
"exchange_address"
jdbcType=
"VARCHAR"
/>
<result
property=
"exchangeAddress"
column=
"exchange_address"
jdbcType=
"VARCHAR"
/>
<result
property=
"urlNumber"
column=
"url_number"
jdbcType=
"VARCHAR"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address
coupon_type,instructions,use_type,exchange_address
, url_number
</sql>
</sql>
<!--查询单个-->
<!--查询单个-->
<select
id=
"getById"
resultMap=
"GiftCouplePackageMap"
>
<select
id=
"getById"
resultMap=
"GiftCouplePackageMap"
>
select
select
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address
coupon_type,instructions,use_type,exchange_address
,url_number
from book.gift_coupon_package
from book.gift_coupon_package
where id = #{id}
where id = #{id}
and is_delete=0
and is_delete=0
...
@@ -38,7 +39,7 @@
...
@@ -38,7 +39,7 @@
<select
id=
"queryAllByLimit"
resultMap=
"GiftCouplePackageMap"
>
<select
id=
"queryAllByLimit"
resultMap=
"GiftCouplePackageMap"
>
select
select
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address
coupon_type,instructions,use_type,exchange_address
,url_number
from book.gift_coupon_package
from book.gift_coupon_package
limit #{offset}, #{limit}
limit #{offset}, #{limit}
</select>
</select>
...
@@ -47,7 +48,7 @@
...
@@ -47,7 +48,7 @@
<select
id=
"queryAll"
resultMap=
"GiftCouplePackageMap"
>
<select
id=
"queryAll"
resultMap=
"GiftCouplePackageMap"
>
select
select
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address
coupon_type,instructions,use_type,exchange_address
, url_number
from book.gift_coupon_package
from book.gift_coupon_package
<where>
<where>
<if
test=
"id != null"
>
<if
test=
"id != null"
>
...
@@ -89,9 +90,9 @@
...
@@ -89,9 +90,9 @@
<!--新增所有列-->
<!--新增所有列-->
<insert
id=
"insert"
parameterType=
"com.pcloud.book.giftcoupon.entity.GiftCouponPackage"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.giftcoupon.entity.GiftCouponPackage"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.gift_coupon_package(cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
insert into book.gift_coupon_package(cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address)
coupon_type,instructions,use_type,exchange_address
,url_number
)
values (#{coverPic}, #{title}, #{validDateBegin}, #{validDateEnd}, #{denomination}, #{stock}, #{receiveLimit}, now(), now(), 0,
values (#{coverPic}, #{title}, #{validDateBegin}, #{validDateEnd}, #{denomination}, #{stock}, #{receiveLimit}, now(), now(), 0,
#{couponType},#{instructions},#{useType},#{exchangeAddress})
#{couponType},#{instructions},#{useType},#{exchangeAddress}
, #{urlNumber}
)
</insert>
</insert>
<!--通过主键修改数据-->
<!--通过主键修改数据-->
...
@@ -134,6 +135,9 @@
...
@@ -134,6 +135,9 @@
<if
test=
"exchangeAddress != null"
>
<if
test=
"exchangeAddress != null"
>
exchange_address = #{exchangeAddress},
exchange_address = #{exchangeAddress},
</if>
</if>
<if
test=
"urlNumber != null"
>
url_number = #{urlNumber},
</if>
update_time = now()
update_time = now()
</set>
</set>
where id = #{id}
where id = #{id}
...
@@ -156,7 +160,10 @@
...
@@ -156,7 +160,10 @@
a.valid_date_end validDateEnd,
a.valid_date_end validDateEnd,
if(NOW()
<![CDATA[ < ]]>
a.valid_date_begin,1,if(NOW() between a.valid_date_begin and a.valid_date_end,2,3)) state,
if(NOW()
<![CDATA[ < ]]>
a.valid_date_begin,1,if(NOW() between a.valid_date_begin and a.valid_date_end,2,3)) state,
a.coupon_type couponType,
a.coupon_type couponType,
a.instructions instructions
a.instructions instructions,
a.use_type useType,
a.exchange_address exchangeAddress,
a.url_number urlNumber
from
from
gift_coupon_package a
gift_coupon_package a
where a.is_delete=0
where a.is_delete=0
...
@@ -229,6 +236,80 @@
...
@@ -229,6 +236,80 @@
and stock
<![CDATA[ <= ]]>
0
and stock
<![CDATA[ <= ]]>
0
</select>
</select>
<select
id=
"getUrlNumberByAddress"
parameterType=
"string"
resultType=
"string"
>
SELECT
url_number
FROM
gift_coupon_package
WHERE
exchange_address = #{exchangeAddress}
AND coupon_type = 1
AND use_type = 1
AND url_number IS NOT NULL
LIMIT 1
</select>
<select
id=
"urlNumberExist"
parameterType=
"map"
resultType=
"boolean"
>
SELECT EXISTS (
SELECT
id
FROM
gift_coupon_package
WHERE
url_number = #{urlNumber}
AND exchange_address != #{exchangeAddress}
AND coupon_type = 1
AND use_type = 1
<if
test=
"id>0"
>
AND id != #{id}
</if>
)
</select>
<select
id=
"listGiftPackage4Analysis"
parameterType=
"map"
resultType=
"com.pcloud.book.giftcoupon.dto.GiftPackageDTO"
>
select
a.id id,
a.title title,
a.cover_pic coverPic,
a.denomination denomination,
a.receive_limit receiveLimit,
a.stock,
a.valid_date_begin validDateBegin,
a.valid_date_end validDateEnd,
a.coupon_type couponType,
a.instructions instructions,
a.use_type useType,
a.exchange_address exchangeAddress,
a.url_number urlNumber
from
gift_coupon_package a
where a.is_delete=0
and a.stock>0
<if
test=
"title !=null and title !=''"
>
and (a.title like concat('%',#{title},'%') or a.url_number like concat('%',#{title},'%'))
</if>
<if
test=
"state !=null and state==1"
>
and now()
<![CDATA[ < ]]>
a.valid_date_begin
</if>
<if
test=
"state !=null and state==2"
>
and now() between a.valid_date_begin and a.valid_date_end
</if>
<if
test=
"state !=null and state==3"
>
and now() > a.valid_date_end
</if>
<if
test=
"state !=null and state==4"
>
and now()
<![CDATA[ <= ]]>
a.valid_date_end
</if>
<if
test=
"couponType !=null"
>
and a.coupon_type=#{couponType}
</if>
<if
test=
"linkOnly == 1"
>
and a.coupon_type = 1
</if>
and a.receive_limit>0
order by a.update_time desc
</select>
</mapper>
</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