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
3fcf97af
Commit
3fcf97af
authored
Aug 12, 2019
by
郑永强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
早晚报素材管理、禁用/启用推送
parent
3752637b
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
304 additions
and
52 deletions
+304
-52
AdNewsBiz.java
...k/src/main/java/com/pcloud/book/adnews/biz/AdNewsBiz.java
+11
-1
AdNewsBizImpl.java
...n/java/com/pcloud/book/adnews/biz/impl/AdNewsBizImpl.java
+32
-10
AdNewsBanDao.java
...rc/main/java/com/pcloud/book/adnews/dao/AdNewsBanDao.java
+12
-0
AdNewsBanDaoImpl.java
...ava/com/pcloud/book/adnews/dao/impl/AdNewsBanDaoImpl.java
+25
-0
AdNews.java
...k/src/main/java/com/pcloud/book/adnews/entity/AdNews.java
+15
-1
AdNewsBan.java
...rc/main/java/com/pcloud/book/adnews/entity/AdNewsBan.java
+24
-0
AdNewsBanEnum.java
...main/java/com/pcloud/book/adnews/enums/AdNewsBanEnum.java
+17
-0
AdNewsFacade.java
...main/java/com/pcloud/book/adnews/facade/AdNewsFacade.java
+15
-10
AdNewsFacadeImpl.java
.../com/pcloud/book/adnews/facade/impl/AdNewsFacadeImpl.java
+43
-19
AdNewsListParam.java
.../main/java/com/pcloud/book/adnews/vo/AdNewsListParam.java
+38
-0
AdNewsBanMapper.xml
...book/src/main/resources/mapper/adnews/AdNewsBanMapper.xml
+40
-0
AdNewsChooseMapper.xml
...k/src/main/resources/mapper/adnews/AdNewsChooseMapper.xml
+1
-2
AdNewsMapper.xml
...ce-book/src/main/resources/mapper/adnews/AdNewsMapper.xml
+31
-9
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/adnews/biz/AdNewsBiz.java
View file @
3fcf97af
...
...
@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.biz;
import
com.pcloud.book.adnews.entity.AdNews
;
import
com.pcloud.book.adnews.entity.AdNewsSet
;
import
com.pcloud.book.adnews.entity.AdNewsWechat
;
import
com.pcloud.book.adnews.vo.AdNewsListParam
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
...
...
@@ -41,7 +42,8 @@ public interface AdNewsBiz {
/**
* 获取素材库列表
*/
PageBeanNew
<
AdNews
>
getAdNewsList
(
String
title
,
Long
partyId
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
AdNews
>
getAdNewsList
(
AdNewsListParam
adNewsListParam
);
/**
* 获取编辑已选取的素材库列表
...
...
@@ -49,6 +51,14 @@ public interface AdNewsBiz {
PageBeanNew
<
AdNews
>
getAdNewsChooseList
(
Long
partyId
,
String
title
,
Boolean
hasUsed
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 禁用/允许推送
* @param partyId
* @param adNewsId
* @param hasBan
*/
void
saveAdNewsBan
(
Long
partyId
,
Long
adNewsId
,
Integer
hasBan
);
/**
* 增加公众号反馈
* @param adNewsWechat
* @return
...
...
pcloud-service-book/src/main/java/com/pcloud/book/adnews/biz/impl/AdNewsBizImpl.java
View file @
3fcf97af
...
...
@@ -5,6 +5,8 @@ import com.pcloud.book.adnews.check.AdNewsCheck;
import
com.pcloud.book.adnews.dao.*
;
import
com.pcloud.book.adnews.entity.*
;
import
com.pcloud.book.adnews.enums.AdContentFromEnum
;
import
com.pcloud.book.adnews.enums.AdNewsBanEnum
;
import
com.pcloud.book.adnews.vo.AdNewsListParam
;
import
com.pcloud.book.advertising.dto.DateCountDTO
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
...
...
@@ -50,6 +52,14 @@ public class AdNewsBizImpl implements AdNewsBiz {
@Autowired
private
AdNewsGroupDao
adNewsGroupDao
;
@Autowired
private
AdNewsWechatDao
adNewsWechatDao
;
@Autowired
private
AdNewsDao
adNewsDao
;
@Autowired
private
AdNewsGroupRecordDao
adNewsGroupRecordDao
;
@Autowired
private
AdNewsBanDao
adNewsBanDao
;
@Autowired
private
ScheduleService
scheduleService
;
@Autowired
private
GroupQrcodeDao
groupQrcodeDao
;
...
...
@@ -60,12 +70,6 @@ public class AdNewsBizImpl implements AdNewsBiz {
@Autowired
private
AdNewsWechatChooseDao
adNewsWechatChooseDao
;
@Autowired
private
AdNewsWechatDao
adNewsWechatDao
;
@Autowired
private
AdNewsDao
adNewsDao
;
@Autowired
private
AdNewsGroupRecordDao
adNewsGroupRecordDao
;
@Autowired
private
WeixinQrcodeBiz
weixinQrcodeBiz
;
private
static
final
String
AD_MORNING_NEWS_SCHEDULE_PRE
=
"AD_MORNING_NEWS_SCHEDULE_"
;
...
...
@@ -247,6 +251,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
/**
* 通过机器人小号发送消息到微信群
*
* @param adNewsSet
* @param groupQrcodeFoAdDTOS
* @param contents
...
...
@@ -286,6 +291,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
/**
* 发送早报还是晚报
*
* @param adNewsSet
* @return
*/
...
...
@@ -377,11 +383,14 @@ public class AdNewsBizImpl implements AdNewsBiz {
@ParamLog
(
"获取素材库列表"
)
@Override
public
PageBeanNew
<
AdNews
>
getAdNewsList
(
String
title
,
Long
partyId
,
Integer
currentPage
,
Integer
numPerPage
)
{
PageParam
pageParam
=
new
PageParam
(
currentPage
,
numPerPage
);
public
PageBeanNew
<
AdNews
>
getAdNewsList
(
AdNewsListParam
adNewsListParam
)
{
PageParam
pageParam
=
new
PageParam
(
adNewsListParam
.
getCurrentPage
(),
adNewsListParam
.
getNumPerPage
()
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"title"
,
title
);
map
.
put
(
"partyId"
,
partyId
);
map
.
put
(
"partyId"
,
adNewsListParam
.
getPartyId
());
map
.
put
(
"title"
,
adNewsListParam
.
getTitle
());
map
.
put
(
"beginTime"
,
adNewsListParam
.
getBeginTime
());
map
.
put
(
"endTime"
,
adNewsListParam
.
getEndTime
());
map
.
put
(
"adNewsWechatIds"
,
adNewsListParam
.
getAdNewsWechatIds
());
PageBeanNew
<
AdNews
>
pageBeanNew
=
adNewsDao
.
listPageNew
(
pageParam
,
map
,
"getAdNewsList"
);
return
pageBeanNew
;
}
...
...
@@ -398,6 +407,19 @@ public class AdNewsBizImpl implements AdNewsBiz {
return
page
;
}
@ParamLog
(
"禁用/允许推送"
)
@Override
public
void
saveAdNewsBan
(
Long
partyId
,
Long
adNewsId
,
Integer
hasBan
)
{
if
(
AdNewsBanEnum
.
BAN
.
key
==
hasBan
)
{
AdNewsBan
model
=
new
AdNewsBan
();
model
.
setAdviserId
(
partyId
);
model
.
setAdNewsId
(
adNewsId
);
adNewsBanDao
.
insert
(
model
);
}
else
{
adNewsBanDao
.
deleteByAdNewsId
(
partyId
,
adNewsId
);
}
}
@ParamLog
(
"发送消息"
)
private
void
sendAdNewsText
(
String
content
,
String
robotId
,
String
weixinGroupId
)
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/adnews/dao/AdNewsBanDao.java
0 → 100644
View file @
3fcf97af
package
com
.
pcloud
.
book
.
adnews
.
dao
;
import
com.pcloud.book.adnews.entity.AdNewsBan
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* @author zhengyongqiang
* @date 2019/8/12 15:12
*/
public
interface
AdNewsBanDao
extends
BaseDao
<
AdNewsBan
>
{
void
deleteByAdNewsId
(
Long
partyId
,
Long
adNewsId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/adnews/dao/impl/AdNewsBanDaoImpl.java
0 → 100644
View file @
3fcf97af
package
com
.
pcloud
.
book
.
adnews
.
dao
.
impl
;
import
com.pcloud.book.adnews.dao.AdNewsBanDao
;
import
com.pcloud.book.adnews.entity.AdNewsBan
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author zhengyongqiang
* @date 2019/8/12 15:11
*/
@Repository
(
"adnewsBanDao"
)
public
class
AdNewsBanDaoImpl
extends
BaseDaoImpl
<
AdNewsBan
>
implements
AdNewsBanDao
{
@Override
public
void
deleteByAdNewsId
(
Long
partyId
,
Long
adNewsId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"partyId"
,
partyId
);
map
.
put
(
"adNewsId"
,
adNewsId
);
super
.
getSqlSession
().
delete
(
getStatement
(
"deleteByAdNewsId"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/adnews/entity/AdNews.java
View file @
3fcf97af
...
...
@@ -38,6 +38,9 @@ public class AdNews extends BaseEntity {
@ApiModelProperty
(
"是否使用"
)
private
Boolean
hasUsed
;
@ApiModelProperty
(
"是否禁用"
)
private
Boolean
hasBan
;
public
String
getType
()
{
return
type
;
}
...
...
@@ -102,6 +105,14 @@ public class AdNews extends BaseEntity {
this
.
hasUsed
=
hasUsed
;
}
public
Boolean
getHasBan
()
{
return
hasBan
;
}
public
void
setHasBan
(
Boolean
hasBan
)
{
this
.
hasBan
=
hasBan
;
}
@Override
public
String
toString
()
{
return
"AdNews{"
+
...
...
@@ -113,6 +124,9 @@ public class AdNews extends BaseEntity {
", shortUrl='"
+
shortUrl
+
'\''
+
", newsDate='"
+
newsDate
+
'\''
+
", hasUsed="
+
hasUsed
+
"} "
+
super
.
toString
();
", hasBan="
+
hasBan
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/adnews/entity/AdNewsBan.java
0 → 100644
View file @
3fcf97af
package
com
.
pcloud
.
book
.
adnews
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author zhengyongqiang
* @date 2019/8/12 15:13
*/
@ApiModel
(
"禁止推送"
)
@Data
public
class
AdNewsBan
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
5102664638916548405L
;
@ApiModelProperty
(
"编辑id"
)
private
Long
adviserId
;
@ApiModelProperty
(
"新闻id"
)
private
Long
adNewsId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/adnews/enums/AdNewsBanEnum.java
0 → 100644
View file @
3fcf97af
package
com
.
pcloud
.
book
.
adnews
.
enums
;
/**
* 禁止推送/允许推送
* @author zhengyongqiang
* @date 2019/8/12 14:42
*/
public
enum
AdNewsBanEnum
{
NONBAN
(
0
),
// 不禁止推送
BAN
(
1
);
// 禁止推送
public
final
Integer
key
;
AdNewsBanEnum
(
Integer
key
){
this
.
key
=
key
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/adnews/facade/AdNewsFacade.java
View file @
3fcf97af
...
...
@@ -2,6 +2,7 @@ package com.pcloud.book.adnews.facade;
import
com.pcloud.book.adnews.entity.AdNewsSet
;
import
com.pcloud.book.adnews.entity.AdNewsWechat
;
import
com.pcloud.book.adnews.vo.AdNewsListParam
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
...
...
@@ -55,16 +56,6 @@ public interface AdNewsFacade {
)
throws
BizException
,
PermissionException
;
@Deprecated
@ApiOperation
(
"获取早晚报素材库"
)
@GetMapping
(
"/getAdNewsList"
)
ResponseDto
<?>
getAdNewsList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"title"
,
required
=
false
)
@ApiParam
(
"标题"
)
String
title
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@Deprecated
@ApiOperation
(
"获取编辑选择的早晚报素材库"
)
@GetMapping
(
"/getAdNewsChooseList"
)
ResponseDto
<?>
getAdNewsChooseList
(
...
...
@@ -75,6 +66,20 @@ public interface AdNewsFacade {
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"早晚报素材库"
)
@PostMapping
(
"/getAdNewsList"
)
ResponseDto
<?>
getAdNewsList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
@ApiParam
(
"查询参数"
)
AdNewsListParam
adNewsListParam
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"禁用/解除禁用"
)
@PostMapping
(
"/saveAdNewsBan"
)
ResponseDto
<?>
saveAdNewsBan
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"adNewsId"
)
@ApiParam
(
"新闻id"
)
Long
adNewsId
,
@RequestParam
(
"hasBan"
)
@ApiParam
(
"禁止推送"
)
Integer
hasBan
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"增加公众号反馈"
)
@PostMapping
(
"/addAdNewsWechat"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/adnews/facade/impl/AdNewsFacadeImpl.java
View file @
3fcf97af
...
...
@@ -4,11 +4,14 @@ import com.pcloud.book.adnews.biz.AdNewsBiz;
import
com.pcloud.book.adnews.entity.AdNewsSet
;
import
com.pcloud.book.adnews.entity.AdNewsWechat
;
import
com.pcloud.book.adnews.facade.AdNewsFacade
;
import
com.pcloud.book.adnews.vo.AdNewsListParam
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.SessionUtil
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
...
...
@@ -107,12 +110,13 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取早晚报素材库"
)
@GetMapping
(
"/getAdNewsList"
)
@ApiOperation
(
"获取
编辑选择的
早晚报素材库"
)
@GetMapping
(
"/getAdNews
Choose
List"
)
@Override
public
ResponseDto
<?>
getAdNewsList
(
public
ResponseDto
<?>
getAdNews
Choose
List
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"title"
,
required
=
false
)
@ApiParam
(
"标题"
)
String
title
,
@RequestParam
(
value
=
"hasUsed"
,
required
=
false
)
@ApiParam
(
"使用状态"
)
Boolean
hasUsed
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
...
...
@@ -123,27 +127,47 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
if
(
numPerPage
==
null
||
numPerPage
<=
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"每页条数不能为空且必须大于0!"
);
}
return
new
ResponseDto
<>(
adNewsBiz
.
getAdNews
List
(
title
,
partyI
d
,
currentPage
,
numPerPage
));
return
new
ResponseDto
<>(
adNewsBiz
.
getAdNews
ChooseList
(
partyId
,
title
,
hasUse
d
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"
获取编辑选择的
早晚报素材库"
)
@
GetMapping
(
"/getAdNewsChoose
List"
)
@ApiOperation
(
"早晚报素材库"
)
@
PostMapping
(
"/getAdNews
List"
)
@Override
public
ResponseDto
<?>
getAdNews
Choose
List
(
public
ResponseDto
<?>
getAdNewsList
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"title"
,
required
=
false
)
@ApiParam
(
"标题"
)
String
title
,
@RequestParam
(
value
=
"hasUsed"
,
required
=
false
)
@ApiParam
(
"使用状态"
)
Boolean
hasUsed
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
@RequestBody
@ApiParam
(
"查询参数"
)
AdNewsListParam
adNewsListParam
)
throws
BizException
,
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
currentPage
==
null
||
currentPage
<
0
)
{
if
(
adNewsListParam
.
getCurrentPage
()
==
null
||
adNewsListParam
.
getCurrentPage
()
<
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"当前页不能为空且不能小于0!"
);
}
if
(
numPerPage
==
null
||
numPerPage
<=
0
)
{
if
(
adNewsListParam
.
getNumPerPage
()
==
null
||
adNewsListParam
.
getNumPerPage
()
<=
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"每页条数不能为空且必须大于0!"
);
}
return
new
ResponseDto
<>(
adNewsBiz
.
getAdNewsChooseList
(
partyId
,
title
,
hasUsed
,
currentPage
,
numPerPage
));
adNewsListParam
.
setPartyId
(
partyId
);
// 将2019-08-12时间转换为 2019-08-12 23:59:59
if
(
adNewsListParam
.
getEndTime
()
!=
null
)
adNewsListParam
.
setEndTime
(
adNewsListParam
.
getEndTime
().
concat
(
" 23:59:59"
));
return
new
ResponseDto
<>(
adNewsBiz
.
getAdNewsList
(
adNewsListParam
));
}
@Override
@ApiOperation
(
"禁用/解除禁用"
)
@PostMapping
(
"/saveAdNewsBan"
)
public
ResponseDto
<?>
saveAdNewsBan
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"adNewsId"
)
@ApiParam
(
"新闻id"
)
Long
adNewsId
,
@RequestParam
(
"hasBan"
)
@ApiParam
(
"禁止推送"
)
Integer
hasBan
)
throws
BizException
,
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(!
NumberUtil
.
isNumber
(
adNewsId
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"adNewsId 不能小于0!"
);
}
if
(!
NumberUtil
.
isNumber
(
hasBan
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"hasBan 必须大于0!"
);
}
adNewsBiz
.
saveAdNewsBan
(
partyId
,
adNewsId
,
hasBan
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"增加公众号反馈"
)
...
...
@@ -166,7 +190,7 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
@RequestBody
@ApiParam
(
"选择的公众号主键"
)
List
<
Long
>
adNewsWechatIds
)
throws
BizException
,
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
adNewsBiz
.
createAdNewsWechatChooseBatch
(
adNewsWechatIds
,
partyId
);
adNewsBiz
.
createAdNewsWechatChooseBatch
(
adNewsWechatIds
,
partyId
);
return
new
ResponseDto
<>();
}
...
...
@@ -176,9 +200,9 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
public
ResponseDto
<?>
deleteAdNewsWechatChoose
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
value
=
"adNewsWechatId"
)
@ApiParam
(
"公众号主键"
)
Long
adNewsWechatId
)
throws
BizException
,
PermissionException
{
)
throws
BizException
,
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
adNewsBiz
.
deleteAdNewsWechatChoose
(
adNewsWechatId
,
partyId
);
adNewsBiz
.
deleteAdNewsWechatChoose
(
adNewsWechatId
,
partyId
);
return
new
ResponseDto
<>();
}
...
...
@@ -189,7 +213,7 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
)
throws
BizException
,
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
currentPage
==
null
||
currentPage
<
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"当前页不能为空且不能小于0!"
);
...
...
@@ -207,7 +231,7 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestParam
(
"currentPage"
)
@ApiParam
(
"当前页"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
)
throws
BizException
,
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
currentPage
==
null
||
currentPage
<
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"当前页不能为空且不能小于0!"
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/adnews/vo/AdNewsListParam.java
0 → 100644
View file @
3fcf97af
package
com
.
pcloud
.
book
.
adnews
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiParam
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author zhengyongqiang
* @date 2019/8/12 11:33
*/
@Data
@ApiModel
(
"查询素材列表"
)
public
class
AdNewsListParam
{
@ApiModelProperty
(
"当前人"
)
private
Long
partyId
;
@ApiModelProperty
(
"标题"
)
private
String
title
;
@ApiModelProperty
(
"开始时间"
)
private
String
beginTime
;
@ApiModelProperty
(
"结束时间"
)
private
String
endTime
;
@ApiModelProperty
(
"公众号id"
)
private
List
<
Long
>
adNewsWechatIds
;
@ApiModelProperty
(
"当前页"
)
private
Integer
currentPage
;
@ApiModelProperty
(
"每页展示条数"
)
private
Integer
numPerPage
;
}
pcloud-service-book/src/main/resources/mapper/adnews/AdNewsBanMapper.xml
0 → 100644
View file @
3fcf97af
<?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.adnews.dao.impl.AdNewsBanDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.adnews.entity.AdNewsBan"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"adviser_id"
property=
"adviserId"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_news_id"
property=
"adNewsId"
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, adviser_id, ad_news_id, create_time, update_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from ad_news_choose
where id = #{id,jdbcType=BIGINT}
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.adnews.entity.AdNewsBan"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into ad_news_ban
(adviser_id,
ad_news_id,
create_time)
values(
#{adviserId,jdbcType=BIGINT},
#{adNewsId,jdbcType=BIGINT},
NOW())
</insert>
<!--根据id删除-->
<delete
id=
"deleteByAdNewsId"
parameterType=
"map"
>
DELETE FROM ad_news_ban
where ad_news_id=#{adNewsId} and adviser_id=#{partyId}
</delete>
</mapper>
pcloud-service-book/src/main/resources/mapper/adnews/AdNewsChooseMapper.xml
View file @
3fcf97af
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "
http://mybatis.org/dtd/
mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.adnews.dao.impl.AdNewsChooseDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.adnews.entity.AdNewsChoose"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
...
...
@@ -8,7 +8,6 @@
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"BOOLEAN"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<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>
...
...
pcloud-service-book/src/main/resources/mapper/adnews/AdNewsMapper.xml
View file @
3fcf97af
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "
http://mybatis.org/dtd/
mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.adnews.dao.impl.AdNewsDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.adnews.entity.AdNews"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
...
...
@@ -124,16 +124,38 @@
</select>
<!--获取素材库列表-->
<select
id=
"getAdNewsList"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from ad_news
where id not in (
select distinct ad_news_id from ad_news_choose
where adviser_id = #{partyId}
)
<select
id=
"getAdNewsList"
parameterType=
"map"
resultType=
"com.pcloud.book.adnews.entity.AdNews"
>
SELECT
a.id id
,a.type type
,a.news_from newsFrom
,a.title title
,a.publisher publisher
,a.url url
,a.short_url shortUrl
,a.news_date newsDate
,a.create_time createTime
,IFNULL((SELECT 1 FROM ad_news_group_record WHERE ad_news_id=a.id and create_user=#{partyId} LIMIT 1),0) hasUsed
,IFNULL((SELECT 1 FROM ad_news_ban WHERE ad_news_id=a.id and adviser_id=#{partyId} LIMIT 1),0) hasBan
FROM
ad_news a
INNER JOIN ad_news_wechat b on a.news_from=b.news_from and b.is_delete=0
<if
test=
"adNewsWechatIds != null and adNewsWechatIds.size()>0"
>
AND b.id IN
<foreach
collection=
"adNewsWechatIds"
item=
"item"
index=
"i"
separator=
","
open=
"("
close=
")"
>
${item}
</foreach>
</if>
where 1=1
<if
test=
"title!=null"
>
and title like concat('%', #{title},'%')
AND a.title like concat('%', #{title},'%')
</if>
<if
test=
"beginTime!=null"
>
AND a.news_date
<![CDATA[>=]]>
#{beginTime}
</if>
<if
test=
"endTime!=null"
>
AND a.news_date
<![CDATA[<=]]>
#{endTime}
</if>
order by create_time desc
</select>
<!--获取编辑选择的素材-->
...
...
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