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
5babfb01
Commit
5babfb01
authored
Jun 24, 2019
by
高鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mymaster' into 'master'
早晚报 See merge request rays/pcloud-book!20
parents
1e82aa9d
5b7a4614
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
1343 additions
and
4 deletions
+1343
-4
PushService.java
...c/main/java/com/pcloud/book/push/service/PushService.java
+4
-0
pom.xml
pcloud-service-book/pom.xml
+6
-0
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+18
-0
ESNewsBiz.java
...-book/src/main/java/com/pcloud/book/es/biz/ESNewsBiz.java
+23
-0
ESNewsBizImpl.java
.../main/java/com/pcloud/book/es/biz/impl/ESNewsBizImpl.java
+104
-0
ESNews.java
...-book/src/main/java/com/pcloud/book/es/entity/ESNews.java
+147
-0
ESNewsFacade.java
...src/main/java/com/pcloud/book/es/facade/ESNewsFacade.java
+28
-0
ESNewsFacadeImpl.java
...java/com/pcloud/book/es/facade/impl/ESNewsFacadeImpl.java
+43
-0
NewsRepository.java
...in/java/com/pcloud/book/es/repository/NewsRepository.java
+7
-0
GroupQrcodeDao.java
...c/main/java/com/pcloud/book/group/dao/GroupQrcodeDao.java
+6
-0
GroupQrcodeDaoImpl.java
...va/com/pcloud/book/group/dao/impl/GroupQrcodeDaoImpl.java
+5
-0
PushBiz.java
...-book/src/main/java/com/pcloud/book/push/biz/PushBiz.java
+27
-0
PushBizImpl.java
.../main/java/com/pcloud/book/push/biz/impl/PushBizImpl.java
+0
-0
PushCheck.java
...k/src/main/java/com/pcloud/book/push/check/PushCheck.java
+31
-0
MorningEveningNewsDao.java
.../java/com/pcloud/book/push/dao/MorningEveningNewsDao.java
+13
-0
NewsDao.java
...-book/src/main/java/com/pcloud/book/push/dao/NewsDao.java
+23
-0
PushNewsRecordDao.java
...main/java/com/pcloud/book/push/dao/PushNewsRecordDao.java
+21
-0
MorningEveningNewsDaoImpl.java
.../pcloud/book/push/dao/impl/MorningEveningNewsDaoImpl.java
+19
-0
NewsDaoImpl.java
.../main/java/com/pcloud/book/push/dao/impl/NewsDaoImpl.java
+44
-0
PushNewsRecordDaoImpl.java
.../com/pcloud/book/push/dao/impl/PushNewsRecordDaoImpl.java
+30
-0
MorningEveningNews.java
.../java/com/pcloud/book/push/entity/MorningEveningNews.java
+154
-0
News.java
...-book/src/main/java/com/pcloud/book/push/entity/News.java
+119
-0
PushNewsRecord.java
...main/java/com/pcloud/book/push/entity/PushNewsRecord.java
+46
-0
PushFacade.java
...src/main/java/com/pcloud/book/push/facade/PushFacade.java
+21
-0
PushFacadeImpl.java
...java/com/pcloud/book/push/facade/impl/PushFacadeImpl.java
+59
-0
PushServiceImpl.java
...va/com/pcloud/book/push/service/impl/PushServiceImpl.java
+14
-4
GroupQrcode.Mapper.xml
...ok/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
+7
-0
MorningEveningNewsMapper.xml
...c/main/resources/mapper/push/MorningEveningNewsMapper.xml
+111
-0
NewsMapper.xml
...ervice-book/src/main/resources/mapper/push/NewsMapper.xml
+138
-0
PushNewsRecordMapper.xml
...k/src/main/resources/mapper/push/PushNewsRecordMapper.xml
+75
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/push/service/PushService.java
View file @
5babfb01
...
@@ -17,4 +17,8 @@ public interface PushService {
...
@@ -17,4 +17,8 @@ public interface PushService {
@PostMapping
(
"/sendGroupMessage"
)
@PostMapping
(
"/sendGroupMessage"
)
void
sendGroupMessage
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
BizException
;
void
sendGroupMessage
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
BizException
;
@ApiOperation
(
"发送早晚报"
)
@PostMapping
(
"/sendMorningEveningNews"
)
void
sendMorningEveningNews
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
BizException
;
}
}
pcloud-service-book/pom.xml
View file @
5babfb01
...
@@ -170,6 +170,12 @@
...
@@ -170,6 +170,12 @@
<version>
${wxgroup-sdk.version}
</version>
<version>
${wxgroup-sdk.version}
</version>
</dependency>
</dependency>
<!--ES相关-->
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-elasticsearch
</artifactId>
</dependency>
<!--spring-cloud相关-->
<!--spring-cloud相关-->
<dependency>
<dependency>
<groupId>
mysql
</groupId>
<groupId>
mysql
</groupId>
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
5babfb01
...
@@ -172,4 +172,22 @@ public class WechatGroupConsr {
...
@@ -172,4 +172,22 @@ public class WechatGroupConsr {
}
}
return
map
;
return
map
;
}
}
@ParamLog
(
value
=
"根据群id集合批量获取发消息的小号"
)
public
Map
<
String
,
String
>
getSendDailyRobotByGroupIds
(
List
<
String
>
weixinIds
)
throws
BizException
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
for
(
String
weixinId:
weixinIds
){
map
.
put
(
weixinId
,
"wxid_mxrau68qs7ou22"
);
}
try
{
map
=
ResponseHandleUtil
.
parseMapResponse
(
groupMemberService
.
getSendDailyRobotByGroupIds
(
weixinIds
),
String
.
class
,
String
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"根据群id集合批量获取发消息的小号.[getRobotIdByWeixinIdBatch]:"
+
e
.
getMessage
(),
e
);
}
if
(
map
==
null
)
{
return
new
HashMap
<>();
}
return
map
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/es/biz/ESNewsBiz.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
es
.
biz
;
import
com.pcloud.book.es.entity.ESNews
;
import
com.pcloud.book.push.entity.News
;
import
java.util.List
;
public
interface
ESNewsBiz
{
/**
* 将所有的新闻新增到es,初始化
*/
void
addAllNewsToES
();
/**
* 新增新闻
*/
void
addNews
(
News
news
);
/**
* 查询新闻
*/
List
<
ESNews
>
getNews
(
String
title
,
List
<
Long
>
notInIds
,
Integer
top
);
}
pcloud-service-book/src/main/java/com/pcloud/book/es/biz/impl/ESNewsBizImpl.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
es
.
biz
.
impl
;
import
com.pcloud.book.es.biz.ESNewsBiz
;
import
com.pcloud.book.es.entity.ESNews
;
import
com.pcloud.book.es.repository.NewsRepository
;
import
com.pcloud.book.push.dao.NewsDao
;
import
com.pcloud.book.push.entity.News
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.BeanUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.elasticsearch.index.query.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/13 16:36
**/
@Component
(
"esNewsBiz"
)
public
class
ESNewsBizImpl
implements
ESNewsBiz
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
ESNewsBizImpl
.
class
);
@Autowired
private
NewsRepository
newsRepository
;
@Autowired
private
NewsDao
newsDao
;
@ParamLog
(
"导入全部"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
addAllNewsToES
()
{
if
(
newsRepository
.
count
()
>
0
)
{
return
;
}
Integer
count
=
newsDao
.
count
();
LOGGER
.
info
(
"总数:"
+
count
);
if
(
null
==
count
||
count
<=
0
)
{
return
;
}
Long
maxId
=
0L
;
Integer
index
=
0
;
Integer
offset
=
10000
;
while
(
index
*
offset
<
count
)
{
List
<
ESNews
>
list
=
newsDao
.
findAll
(
maxId
,
offset
);
if
(
ListUtils
.
isEmpty
(
list
))
{
break
;
}
newsRepository
.
save
(
list
);
maxId
=
Long
.
valueOf
(
list
.
get
(
list
.
size
()
-
1
).
getId
());
LOGGER
.
info
(
"导入数据至"
+
maxId
);
index
+=
1
;
}
}
@ParamLog
(
"新增新闻"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
addNews
(
News
news
)
{
if
(
news
==
null
)
{
return
;
}
//查询之前有没有相同的
News
newsHas
=
newsDao
.
getByUrl
(
news
.
getUrl
());
if
(
newsHas
!=
null
){
LOGGER
.
info
(
"该news已存在"
+
news
.
toString
());
return
;
}
newsDao
.
insert
(
news
);
ESNews
esNews
=
new
ESNews
();
BeanUtils
.
copyProperties
(
news
,
esNews
);
esNews
.
setId
(
news
.
getId
().
toString
());
esNews
.
setCreateTime
(
new
Date
());
newsRepository
.
save
(
esNews
);
}
@ParamLog
(
"查询新闻"
)
@Override
public
List
<
ESNews
>
getNews
(
String
title
,
List
<
Long
>
notInIds
,
Integer
top
)
{
BoolQueryBuilder
boolQueryBuilder
=
QueryBuilders
.
boolQuery
();
if
(!
StringUtil
.
isEmpty
(
title
))
{
MatchQueryBuilder
matchQuery
=
QueryBuilders
.
matchQuery
(
"title"
,
title
);
boolQueryBuilder
.
must
(
matchQuery
);
}
if
(!
ListUtils
.
isEmpty
(
notInIds
)){
TermsQueryBuilder
termsQuery
=
QueryBuilders
.
termsQuery
(
"id"
,
notInIds
);
boolQueryBuilder
.
mustNot
(
termsQuery
);
}
PageRequest
pageRequest
=
new
PageRequest
(
0
,
top
);
return
newsRepository
.
search
(
boolQueryBuilder
,
pageRequest
).
getContent
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/es/entity/ESNews.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
es
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.elasticsearch.annotations.Document
;
import
java.util.Date
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/13 16:03
**/
@Document
(
indexName
=
"book"
,
type
=
"news"
)
public
class
ESNews
{
@Id
private
String
id
;
/**
* 类型
*/
private
String
type
;
/**
* 来源
*/
private
String
newsFrom
;
/**
* 标题
*/
private
String
title
;
/**
* 发布者
*/
private
String
publisher
;
/**
* 链接
*/
private
String
url
;
/**
* 短链接
*/
private
String
shortUrl
;
/**
* 发布日期
*/
private
String
newsDate
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getNewsFrom
()
{
return
newsFrom
;
}
public
void
setNewsFrom
(
String
newsFrom
)
{
this
.
newsFrom
=
newsFrom
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getPublisher
()
{
return
publisher
;
}
public
void
setPublisher
(
String
publisher
)
{
this
.
publisher
=
publisher
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getShortUrl
()
{
return
shortUrl
;
}
public
void
setShortUrl
(
String
shortUrl
)
{
this
.
shortUrl
=
shortUrl
;
}
public
String
getNewsDate
()
{
return
newsDate
;
}
public
void
setNewsDate
(
String
newsDate
)
{
this
.
newsDate
=
newsDate
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
String
toString
()
{
return
"ESNews{"
+
"id='"
+
id
+
'\''
+
", type='"
+
type
+
'\''
+
", newsFrom='"
+
newsFrom
+
'\''
+
", title='"
+
title
+
'\''
+
", publisher='"
+
publisher
+
'\''
+
", url='"
+
url
+
'\''
+
", shortUrl='"
+
shortUrl
+
'\''
+
", newsDate='"
+
newsDate
+
'\''
+
", createTime="
+
createTime
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/es/facade/ESNewsFacade.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
es
.
facade
;
import
com.pcloud.book.push.entity.News
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
java.util.List
;
@FeignClient
(
value
=
"pcloud-service-book"
,
qualifier
=
"esNewsFacadeCloud"
,
path
=
"esNews"
)
@Api
(
description
=
"ES外部接口"
)
public
interface
ESNewsFacade
{
@ApiOperation
(
"添加所有的新闻到es"
)
@PostMapping
(
"addAllNewsToES"
)
ResponseDto
<?>
addAllNewsToES
()
throws
BizException
;
@ApiOperation
(
"新增新闻"
)
@PostMapping
(
"addNews"
)
ResponseDto
<?>
addNews
(
@RequestBody
News
news
)
throws
BizException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/es/facade/impl/ESNewsFacadeImpl.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
es
.
facade
.
impl
;
import
com.pcloud.book.es.biz.ESNewsBiz
;
import
com.pcloud.book.es.facade.ESNewsFacade
;
import
com.pcloud.book.push.entity.News
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/13 16:43
**/
@RestController
(
"esNewsFacade"
)
@RequestMapping
(
"esNews"
)
public
class
ESNewsFacadeImpl
implements
ESNewsFacade
{
@Autowired
private
ESNewsBiz
esNewsBiz
;
@ApiOperation
(
"添加所有的新闻到es"
)
@PostMapping
(
"addAllNewsToES"
)
@Override
public
ResponseDto
<?>
addAllNewsToES
()
throws
BizException
{
esNewsBiz
.
addAllNewsToES
();
return
new
ResponseDto
<>();
}
@ApiOperation
(
"新增新闻"
)
@PostMapping
(
"addNews"
)
@Override
public
ResponseDto
<?>
addNews
(
@RequestBody
News
news
)
throws
BizException
{
esNewsBiz
.
addNews
(
news
);
return
new
ResponseDto
<>();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/es/repository/NewsRepository.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
es
.
repository
;
import
com.pcloud.book.es.entity.ESNews
;
import
org.springframework.data.elasticsearch.repository.ElasticsearchRepository
;
public
interface
NewsRepository
extends
ElasticsearchRepository
<
ESNews
,
String
>
{
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/GroupQrcodeDao.java
View file @
5babfb01
...
@@ -158,4 +158,10 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
...
@@ -158,4 +158,10 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
* @param groupName
* @param groupName
*/
*/
void
updateGroupName
(
Long
id
,
String
groupName
);
void
updateGroupName
(
Long
id
,
String
groupName
);
/**
* 获取群人数大于或等于人数的群
* @param userCount
*/
List
<
GroupQrcode
>
getListByUserCount
(
Integer
userCount
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/GroupQrcodeDaoImpl.java
View file @
5babfb01
...
@@ -142,4 +142,9 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
...
@@ -142,4 +142,9 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
paramMap
.
put
(
"groupName"
,
groupName
);
paramMap
.
put
(
"groupName"
,
groupName
);
this
.
getSqlSession
().
update
(
this
.
getStatement
(
"updateGroupName"
),
paramMap
);
this
.
getSqlSession
().
update
(
this
.
getStatement
(
"updateGroupName"
),
paramMap
);
}
}
@Override
public
List
<
GroupQrcode
>
getListByUserCount
(
Integer
userCount
)
{
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"getListByUserCount"
),
userCount
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/biz/PushBiz.java
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
biz
;
package
com
.
pcloud
.
book
.
push
.
biz
;
import
com.pcloud.book.push.dto.*
;
import
com.pcloud.book.push.dto.*
;
import
com.pcloud.book.push.entity.MorningEveningNews
;
import
com.pcloud.book.push.entity.Push
;
import
com.pcloud.book.push.entity.Push
;
import
com.pcloud.book.push.entity.PushGroup
;
import
com.pcloud.book.push.entity.PushGroup
;
import
com.pcloud.book.push.entity.PushItem
;
import
com.pcloud.book.push.entity.PushItem
;
...
@@ -112,6 +113,32 @@ public interface PushBiz {
...
@@ -112,6 +113,32 @@ public interface PushBiz {
* @return
* @return
*/
*/
PageBeanNew
<
PushRecordDTO
>
getPushRecordList
(
Long
partyId
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
PushRecordDTO
>
getPushRecordList
(
Long
partyId
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 新增早晚报
* @param morningEveningNews
* @return
*/
Long
createMorningEveningNews
(
MorningEveningNews
morningEveningNews
);
/**
* 修改早晚报
* @param morningEveningNews
*/
void
updateMorningEveningNews
(
MorningEveningNews
morningEveningNews
);
/**
* 获取早晚报
* @param partyId
* @return
*/
MorningEveningNews
getMorningEveningNews
(
Long
partyId
);
/**
* 发送早晚报
*/
void
sendMorningEveningNews
(
Long
partyId
);
/**
/**
* 新增计划式群发
* 新增计划式群发
*/
*/
...
...
pcloud-service-book/src/main/java/com/pcloud/book/push/biz/impl/PushBizImpl.java
View file @
5babfb01
This diff is collapsed.
Click to expand it.
pcloud-service-book/src/main/java/com/pcloud/book/push/check/PushCheck.java
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
check
;
package
com
.
pcloud
.
book
.
push
.
check
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.push.entity.MorningEveningNews
;
import
com.pcloud.book.push.entity.Push
;
import
com.pcloud.book.push.entity.Push
;
import
com.pcloud.book.push.entity.PushGroup
;
import
com.pcloud.book.push.entity.PushGroup
;
import
com.pcloud.book.push.entity.PushItem
;
import
com.pcloud.book.push.entity.PushItem
;
...
@@ -250,4 +251,34 @@ public class PushCheck {
...
@@ -250,4 +251,34 @@ public class PushCheck {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"发送消息项内容类型为图片时,图片不能为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"发送消息项内容类型为图片时,图片不能为空!"
);
}
}
}
}
/**
* 新增早晚报参数校验
* @param morningEveningNews
*/
public
void
createMorningEveningNewsParamCheck
(
MorningEveningNews
morningEveningNews
)
{
if
(
morningEveningNews
.
getHasMorningOpen
()==
null
||
morningEveningNews
.
getHasEveningOpen
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"是否开启早报和晚报不能为空!"
);
}
if
(
morningEveningNews
.
getHasStartContent
()==
null
||
morningEveningNews
.
getHasEndContent
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"是否开启开场和结束语不能为空!"
);
}
if
(
morningEveningNews
.
getSendCount
()==
null
||
morningEveningNews
.
getSendCount
()<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"推送条数必须不能为空且大于0!"
);
}
if
(
morningEveningNews
.
getHasMorningOpen
()&&
StringUtil
.
isEmpty
(
morningEveningNews
.
getMorningTime
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"开启早报后,早报时间不能为空!"
);
}
if
(
morningEveningNews
.
getHasEveningOpen
()&&
StringUtil
.
isEmpty
(
morningEveningNews
.
getEveningTime
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"开启晚报后,晚报时间不能为空!"
);
}
if
(
morningEveningNews
.
getHasStartContent
()&&
StringUtil
.
isEmpty
(
morningEveningNews
.
getStartContent
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"开启开场语后,开场语不能为空!"
);
}
if
(
morningEveningNews
.
getHasEndContent
()&&
StringUtil
.
isEmpty
(
morningEveningNews
.
getEndContent
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"开启结束语后,结束语不能为空!"
);
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/MorningEveningNewsDao.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
dao
;
import
com.pcloud.book.push.entity.MorningEveningNews
;
import
com.pcloud.common.core.dao.BaseDao
;
public
interface
MorningEveningNewsDao
extends
BaseDao
<
MorningEveningNews
>
{
/**
* 获取详情
* @param partyId
* @return
*/
MorningEveningNews
getByPartyId
(
Long
partyId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/NewsDao.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
dao
;
import
com.pcloud.book.es.entity.ESNews
;
import
com.pcloud.book.push.entity.News
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/13 17:45
**/
public
interface
NewsDao
extends
BaseDao
<
News
>
{
List
<
ESNews
>
findAll
(
Long
maxId
,
Integer
offset
);
Integer
count
();
void
batchInsert
(
List
<
News
>
news
);
News
getByUrl
(
String
url
);
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/PushNewsRecordDao.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
dao
;
import
com.pcloud.book.push.entity.PushNewsRecord
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
public
interface
PushNewsRecordDao
extends
BaseDao
<
PushNewsRecord
>
{
/**
* 根据微信群id集合查询发送记录
* @param weixinGroupIds
* @return
*/
List
<
PushNewsRecord
>
getListByGroupIds
(
List
<
String
>
weixinGroupIds
);
/**
* 批量新增
* @param pushNewsRecords
*/
void
batchInsert
(
List
<
PushNewsRecord
>
pushNewsRecords
);
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/impl/MorningEveningNewsDaoImpl.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
dao
.
impl
;
import
com.pcloud.book.push.dao.MorningEveningNewsDao
;
import
com.pcloud.book.push.entity.MorningEveningNews
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/3 11:44
**/
@Repository
(
"morningEveningNewsDao"
)
public
class
MorningEveningNewsDaoImpl
extends
BaseDaoImpl
<
MorningEveningNews
>
implements
MorningEveningNewsDao
{
@Override
public
MorningEveningNews
getByPartyId
(
Long
partyId
)
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getByPartyId"
),
partyId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/impl/NewsDaoImpl.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
dao
.
impl
;
import
com.pcloud.book.es.entity.ESNews
;
import
com.pcloud.book.push.dao.NewsDao
;
import
com.pcloud.book.push.entity.News
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/13 17:46
**/
@Repository
(
"newsDao"
)
public
class
NewsDaoImpl
extends
BaseDaoImpl
<
News
>
implements
NewsDao
{
@Override
public
List
<
ESNews
>
findAll
(
Long
maxId
,
Integer
offset
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"maxId"
,
maxId
);
map
.
put
(
"offset"
,
offset
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"findAll"
),
map
);
}
@Override
public
Integer
count
()
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"count"
));
}
@Override
public
void
batchInsert
(
List
<
News
>
news
)
{
super
.
getSqlSession
().
insert
(
getStatement
(
"batchInsert"
),
news
);
}
@Override
public
News
getByUrl
(
String
url
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"url"
,
url
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getByUrl"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/dao/impl/PushNewsRecordDaoImpl.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
dao
.
impl
;
import
com.pcloud.book.push.dao.PushNewsRecordDao
;
import
com.pcloud.book.push.entity.PushNewsRecord
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/14 12:05
**/
@Repository
(
"pushNewsRecordDao"
)
public
class
PushNewsRecordDaoImpl
extends
BaseDaoImpl
<
PushNewsRecord
>
implements
PushNewsRecordDao
{
@Override
public
List
<
PushNewsRecord
>
getListByGroupIds
(
List
<
String
>
weixinGroupIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"weixinGroupIds"
,
weixinGroupIds
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByGroupIds"
),
map
);
}
@Override
public
void
batchInsert
(
List
<
PushNewsRecord
>
pushNewsRecords
)
{
super
.
getSqlSession
().
insert
(
getStatement
(
"batchInsert"
),
pushNewsRecords
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/entity/MorningEveningNews.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/3 10:02
**/
@ApiModel
(
"微信早晚报推送模型"
)
public
class
MorningEveningNews
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
53098150399104256L
;
@ApiModelProperty
(
"早报时间"
)
private
String
morningTime
;
@ApiModelProperty
(
"晚报时间"
)
private
String
eveningTime
;
@ApiModelProperty
(
"是否开启早报"
)
private
Boolean
hasMorningOpen
;
@ApiModelProperty
(
"是否开启晚报"
)
private
Boolean
hasEveningOpen
;
@ApiModelProperty
(
"发送次数"
)
private
Integer
sendCount
;
@ApiModelProperty
(
"开场语"
)
private
String
startContent
;
@ApiModelProperty
(
"结束语"
)
private
String
endContent
;
@ApiModelProperty
(
"是否开启开场语"
)
private
Boolean
hasStartContent
;
@ApiModelProperty
(
"是否开启结束语"
)
private
Boolean
hasEndContent
;
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
@ApiModelProperty
(
"修改人"
)
private
Long
updateUser
;
public
String
getMorningTime
()
{
return
morningTime
;
}
public
void
setMorningTime
(
String
morningTime
)
{
this
.
morningTime
=
morningTime
;
}
public
String
getEveningTime
()
{
return
eveningTime
;
}
public
void
setEveningTime
(
String
eveningTime
)
{
this
.
eveningTime
=
eveningTime
;
}
public
Boolean
getHasMorningOpen
()
{
return
hasMorningOpen
;
}
public
void
setHasMorningOpen
(
Boolean
hasMorningOpen
)
{
this
.
hasMorningOpen
=
hasMorningOpen
;
}
public
Boolean
getHasEveningOpen
()
{
return
hasEveningOpen
;
}
public
void
setHasEveningOpen
(
Boolean
hasEveningOpen
)
{
this
.
hasEveningOpen
=
hasEveningOpen
;
}
public
Integer
getSendCount
()
{
return
sendCount
;
}
public
void
setSendCount
(
Integer
sendCount
)
{
this
.
sendCount
=
sendCount
;
}
public
String
getStartContent
()
{
return
startContent
;
}
public
void
setStartContent
(
String
startContent
)
{
this
.
startContent
=
startContent
;
}
public
String
getEndContent
()
{
return
endContent
;
}
public
void
setEndContent
(
String
endContent
)
{
this
.
endContent
=
endContent
;
}
public
Boolean
getHasStartContent
()
{
return
hasStartContent
;
}
public
void
setHasStartContent
(
Boolean
hasStartContent
)
{
this
.
hasStartContent
=
hasStartContent
;
}
public
Boolean
getHasEndContent
()
{
return
hasEndContent
;
}
public
void
setHasEndContent
(
Boolean
hasEndContent
)
{
this
.
hasEndContent
=
hasEndContent
;
}
public
Long
getCreateUser
()
{
return
createUser
;
}
public
void
setCreateUser
(
Long
createUser
)
{
this
.
createUser
=
createUser
;
}
public
Long
getUpdateUser
()
{
return
updateUser
;
}
public
void
setUpdateUser
(
Long
updateUser
)
{
this
.
updateUser
=
updateUser
;
}
@Override
public
String
toString
()
{
return
"MorningEveningNews{"
+
"morningTime='"
+
morningTime
+
'\''
+
", eveningTime='"
+
eveningTime
+
'\''
+
", hasMorningOpen="
+
hasMorningOpen
+
", hasEveningOpen="
+
hasEveningOpen
+
", sendCount="
+
sendCount
+
", startContent='"
+
startContent
+
'\''
+
", endContent='"
+
endContent
+
'\''
+
", hasStartContent="
+
hasStartContent
+
", hasEndContent="
+
hasEndContent
+
", createUser="
+
createUser
+
", updateUser="
+
updateUser
+
"} "
+
super
.
toString
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/entity/News.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/13 17:16
**/
@ApiModel
(
"新闻模型"
)
public
class
News
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
3896134057717180981L
;
/**
* 类型
*/
private
String
type
;
/**
* 来源
*/
private
String
newsFrom
;
/**
* 标题
*/
private
String
title
;
/**
* 发布者
*/
private
String
publisher
;
/**
* 链接
*/
private
String
url
;
/**
* 短链接
*/
private
String
shortUrl
;
/**
* 发布日期
*/
private
String
newsDate
;
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getNewsFrom
()
{
return
newsFrom
;
}
public
void
setNewsFrom
(
String
newsFrom
)
{
this
.
newsFrom
=
newsFrom
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getPublisher
()
{
return
publisher
;
}
public
void
setPublisher
(
String
publisher
)
{
this
.
publisher
=
publisher
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getShortUrl
()
{
return
shortUrl
;
}
public
void
setShortUrl
(
String
shortUrl
)
{
this
.
shortUrl
=
shortUrl
;
}
public
String
getNewsDate
()
{
return
newsDate
;
}
public
void
setNewsDate
(
String
newsDate
)
{
this
.
newsDate
=
newsDate
;
}
@Override
public
String
toString
()
{
return
"News{"
+
"type='"
+
type
+
'\''
+
", newsFrom='"
+
newsFrom
+
'\''
+
", title='"
+
title
+
'\''
+
", publisher='"
+
publisher
+
'\''
+
", url='"
+
url
+
'\''
+
", shortUrl='"
+
shortUrl
+
'\''
+
", newsDate='"
+
newsDate
+
'\''
+
"} "
+
super
.
toString
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/entity/PushNewsRecord.java
0 → 100644
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/14 12:02
**/
@ApiModel
(
"早晚报推送记录"
)
public
class
PushNewsRecord
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
9057936389239373740L
;
@ApiModelProperty
(
"微信群id"
)
private
String
weixinGroupId
;
@ApiModelProperty
(
"新闻id"
)
private
Long
newsId
;
public
String
getWeixinGroupId
()
{
return
weixinGroupId
;
}
public
void
setWeixinGroupId
(
String
weixinGroupId
)
{
this
.
weixinGroupId
=
weixinGroupId
;
}
public
Long
getNewsId
()
{
return
newsId
;
}
public
void
setNewsId
(
Long
newsId
)
{
this
.
newsId
=
newsId
;
}
@Override
public
String
toString
()
{
return
"PushNewsRecord{"
+
"weixinGroupId='"
+
weixinGroupId
+
'\''
+
", newsId="
+
newsId
+
"} "
+
super
.
toString
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/facade/PushFacade.java
View file @
5babfb01
package
com
.
pcloud
.
book
.
push
.
facade
;
package
com
.
pcloud
.
book
.
push
.
facade
;
import
com.pcloud.book.push.dto.PushPlanDTO
;
import
com.pcloud.book.push.dto.PushPlanDTO
;
import
com.pcloud.book.push.entity.MorningEveningNews
;
import
com.pcloud.book.push.entity.Push
;
import
com.pcloud.book.push.entity.Push
;
import
com.pcloud.book.push.entity.PushGroup
;
import
com.pcloud.book.push.entity.PushGroup
;
import
com.pcloud.book.push.entity.PushItem
;
import
com.pcloud.book.push.entity.PushItem
;
...
@@ -116,6 +117,26 @@ public interface PushFacade {
...
@@ -116,6 +117,26 @@ public interface PushFacade {
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
@RequestParam
(
"numPerPage"
)
@ApiParam
(
"每页条数"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"新增早晚报"
)
@PostMapping
(
"/createMorningEveningNews"
)
ResponseDto
<?>
createMorningEveningNews
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
@ApiParam
(
"早晚报模型"
)
MorningEveningNews
morningEveningNews
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"修改早晚报"
)
@PostMapping
(
"/updateMorningEveningNews"
)
ResponseDto
<?>
updateMorningEveningNews
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
@ApiParam
(
"新增早晚报模型"
)
MorningEveningNews
morningEveningNews
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"获取早晚报"
)
@GetMapping
(
"/getMorningEveningNews"
)
ResponseDto
<?>
getMorningEveningNews
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"新增计划式群发"
)
@ApiOperation
(
"新增计划式群发"
)
@PostMapping
(
"/createPushPlan"
)
@PostMapping
(
"/createPushPlan"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/push/facade/impl/PushFacadeImpl.java
View file @
5babfb01
...
@@ -3,10 +3,12 @@ package com.pcloud.book.push.facade.impl;
...
@@ -3,10 +3,12 @@ package com.pcloud.book.push.facade.impl;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.push.biz.PushBiz
;
import
com.pcloud.book.push.biz.PushBiz
;
import
com.pcloud.book.push.dto.PushPlanDTO
;
import
com.pcloud.book.push.dto.PushPlanDTO
;
import
com.pcloud.book.push.entity.MorningEveningNews
;
import
com.pcloud.book.push.entity.Push
;
import
com.pcloud.book.push.entity.Push
;
import
com.pcloud.book.push.entity.PushGroup
;
import
com.pcloud.book.push.entity.PushGroup
;
import
com.pcloud.book.push.entity.PushItem
;
import
com.pcloud.book.push.entity.PushItem
;
import
com.pcloud.book.push.facade.PushFacade
;
import
com.pcloud.book.push.facade.PushFacade
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.permission.PermissionException
;
...
@@ -223,6 +225,63 @@ public class PushFacadeImpl implements PushFacade {
...
@@ -223,6 +225,63 @@ public class PushFacadeImpl implements PushFacade {
return
new
ResponseDto
<>(
pushBiz
.
getPushRecordList
(
partyId
,
currentPage
,
numPerPage
));
return
new
ResponseDto
<>(
pushBiz
.
getPushRecordList
(
partyId
,
currentPage
,
numPerPage
));
}
}
@ApiOperation
(
"新增早晚报"
)
@PostMapping
(
"/createMorningEveningNews"
)
@Override
public
ResponseDto
<?>
createMorningEveningNews
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
@ApiParam
(
"早晚报模型"
)
MorningEveningNews
morningEveningNews
)
throws
BizException
,
PermissionException
{
if
(
morningEveningNews
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数为空!"
);
}
String
systemCode
=
(
String
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
SYSTEM_CODE
);
if
(!
SystemCode
.
pcloud
.
code
.
equalsIgnoreCase
(
systemCode
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"登陆角色不正确!"
);
}
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
morningEveningNews
.
setCreateUser
(
partyId
);
morningEveningNews
.
setUpdateUser
(
partyId
);
return
new
ResponseDto
<>(
pushBiz
.
createMorningEveningNews
(
morningEveningNews
));
}
@ApiOperation
(
"修改早晚报"
)
@PostMapping
(
"/updateMorningEveningNews"
)
@Override
public
ResponseDto
<?>
updateMorningEveningNews
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
@ApiParam
(
"早晚报模型"
)
MorningEveningNews
morningEveningNews
)
throws
BizException
,
PermissionException
{
String
systemCode
=
(
String
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
SYSTEM_CODE
);
if
(!
SystemCode
.
pcloud
.
code
.
equalsIgnoreCase
(
systemCode
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"登陆角色不正确!"
);
}
if
(
morningEveningNews
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数为空!"
);
}
if
(
morningEveningNews
.
getId
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"早晚报id为空!"
);
}
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
morningEveningNews
.
setUpdateUser
(
partyId
);
pushBiz
.
updateMorningEveningNews
(
morningEveningNews
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取早晚报"
)
@GetMapping
(
"/getMorningEveningNews"
)
@Override
public
ResponseDto
<?>
getMorningEveningNews
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
)
throws
BizException
,
PermissionException
{
String
systemCode
=
(
String
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
SYSTEM_CODE
);
if
(!
SystemCode
.
pcloud
.
code
.
equalsIgnoreCase
(
systemCode
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"登陆角色不正确!"
);
}
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
pushBiz
.
getMorningEveningNews
(
partyId
));
}
@ApiOperation
(
"新增计划式群发"
)
@ApiOperation
(
"新增计划式群发"
)
@PostMapping
(
"/createPushPlan"
)
@PostMapping
(
"/createPushPlan"
)
@Override
@Override
...
...
pcloud-service-book/src/main/java/com/pcloud/book/push/service/impl/PushServiceImpl.java
View file @
5babfb01
...
@@ -7,12 +7,11 @@ import io.swagger.annotations.ApiOperation;
...
@@ -7,12 +7,11 @@ import io.swagger.annotations.ApiOperation;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
/**
/**
* @Description
* @Description
...
@@ -25,6 +24,8 @@ public class PushServiceImpl implements PushService {
...
@@ -25,6 +24,8 @@ public class PushServiceImpl implements PushService {
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PushServiceImpl
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PushServiceImpl
.
class
);
private
static
final
ExecutorService
EXECUTOR_SINGLE_SERVICE
=
Executors
.
newSingleThreadExecutor
();
@Autowired
@Autowired
private
PushBiz
pushBiz
;
private
PushBiz
pushBiz
;
...
@@ -36,4 +37,13 @@ public class PushServiceImpl implements PushService {
...
@@ -36,4 +37,13 @@ public class PushServiceImpl implements PushService {
LOGGER
.
info
(
"内部接口群发消息被调用"
+
map
.
toString
());
LOGGER
.
info
(
"内部接口群发消息被调用"
+
map
.
toString
());
pushBiz
.
sendGroupMessage
(
new
Long
(
map
.
get
(
"pushId"
).
toString
()));
pushBiz
.
sendGroupMessage
(
new
Long
(
map
.
get
(
"pushId"
).
toString
()));
}
}
@ApiOperation
(
"发送早晚报"
)
@PostMapping
(
"/sendMorningEveningNews"
)
@Override
public
void
sendMorningEveningNews
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
BizException
{
LOGGER
.
info
(
"内部接口发送早晚报被调用"
+
map
.
toString
());
//开线程跑,及时给定时任务返回,避免超时重复调用
EXECUTOR_SINGLE_SERVICE
.
execute
(()
->
pushBiz
.
sendMorningEveningNews
(
new
Long
(
map
.
get
(
"partyId"
).
toString
())));
}
}
}
pcloud-service-book/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
View file @
5babfb01
...
@@ -313,4 +313,10 @@
...
@@ -313,4 +313,10 @@
</set>
</set>
WHERE id = #{id}
WHERE id = #{id}
</update>
</update>
<!--获取群人数大于或等于人数的群-->
<select
id=
"getListByUserCount"
parameterType=
"Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from book_group_qrcode
where user_number>=#{userCount} and is_delete=0
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/push/MorningEveningNewsMapper.xml
0 → 100644
View file @
5babfb01
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.push.dao.impl.MorningEveningNewsDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.push.entity.MorningEveningNews"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"morning_time"
property=
"morningTime"
jdbcType=
"VARCHAR"
/>
<result
column=
"evening_time"
property=
"eveningTime"
jdbcType=
"VARCHAR"
/>
<result
column=
"has_morning_open"
property=
"hasMorningOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"has_evening_open"
property=
"hasEveningOpen"
jdbcType=
"BOOLEAN"
/>
<result
column=
"send_count"
property=
"sendCount"
jdbcType=
"INTEGER"
/>
<result
column=
"start_content"
property=
"startContent"
jdbcType=
"VARCHAR"
/>
<result
column=
"end_content"
property=
"endContent"
jdbcType=
"VARCHAR"
/>
<result
column=
"has_start_content"
property=
"hasStartContent"
jdbcType=
"BOOLEAN"
/>
<result
column=
"has_end_content"
property=
"hasEndContent"
jdbcType=
"BOOLEAN"
/>
<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, morning_time, evening_time, has_morning_open, has_evening_open, send_count, start_content,
end_content, has_start_content, has_end_content, create_user, create_time, update_user, update_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from morning_evening_news
where id = #{id,jdbcType=BIGINT}
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.push.entity.MorningEveningNews"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into morning_evening_news
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
morning_time,
evening_time,
has_morning_open,
has_evening_open,
send_count,
start_content,
end_content,
has_start_content,
has_end_content,
create_user,
create_time,
update_user,
update_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{morningTime,jdbcType=VARCHAR},
#{eveningTime,jdbcType=VARCHAR},
#{hasMorningOpen,jdbcType=BOOLEAN},
#{hasEveningOpen,jdbcType=BOOLEAN},
#{sendCount,jdbcType=INTEGER},
#{startContent,jdbcType=VARCHAR},
#{endContent,jdbcType=VARCHAR},
#{hasStartContent,jdbcType=BOOLEAN},
#{hasEndContent,jdbcType=BOOLEAN},
#{createUser,jdbcType=BIGINT},
NOW(),
#{updateUser,jdbcType=BIGINT},
NOW(),
</trim>
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.push.entity.MorningEveningNews"
>
update morning_evening_news
<set>
<if
test=
"morningTime != null"
>
morning_time = #{morningTime,jdbcType=VARCHAR},
</if>
<if
test=
"eveningTime != null"
>
evening_time = #{eveningTime,jdbcType=VARCHAR},
</if>
<if
test=
"hasMorningOpen != null"
>
has_morning_open = #{hasMorningOpen,jdbcType=BOOLEAN},
</if>
<if
test=
"hasEveningOpen != null"
>
has_evening_open = #{hasEveningOpen,jdbcType=BOOLEAN},
</if>
<if
test=
"sendCount != null"
>
send_count = #{sendCount,jdbcType=INTEGER},
</if>
<if
test=
"startContent != null"
>
start_content = #{startContent,jdbcType=VARCHAR},
</if>
<if
test=
"endContent != null"
>
end_content = #{endContent,jdbcType=VARCHAR},
</if>
<if
test=
"hasStartContent != null"
>
has_start_content = #{hasStartContent,jdbcType=BOOLEAN},
</if>
<if
test=
"hasEndContent != null"
>
has_end_content = #{hasEndContent,jdbcType=BOOLEAN},
</if>
<if
test=
"updateUser != null"
>
update_user = #{updateUser,jdbcType=BIGINT},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getByPartyId"
parameterType=
"Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from morning_evening_news where create_user=#{partyId}
order by create_time desc limit 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/push/NewsMapper.xml
0 → 100644
View file @
5babfb01
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.push.dao.impl.NewsDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.push.entity.News"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"VARCHAR"
/>
<result
column=
"news_from"
property=
"newsFrom"
jdbcType=
"VARCHAR"
/>
<result
column=
"title"
property=
"title"
jdbcType=
"VARCHAR"
/>
<result
column=
"publisher"
property=
"publisher"
jdbcType=
"VARCHAR"
/>
<result
column=
"url"
property=
"url"
jdbcType=
"VARCHAR"
/>
<result
column=
"short_url"
property=
"shortUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"news_date"
property=
"newsDate"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<resultMap
id=
"BaseResultESMap"
type=
"com.pcloud.book.es.entity.ESNews"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"VARCHAR"
/>
<result
column=
"news_from"
property=
"newsFrom"
jdbcType=
"VARCHAR"
/>
<result
column=
"title"
property=
"title"
jdbcType=
"VARCHAR"
/>
<result
column=
"publisher"
property=
"publisher"
jdbcType=
"VARCHAR"
/>
<result
column=
"url"
property=
"url"
jdbcType=
"VARCHAR"
/>
<result
column=
"short_url"
property=
"shortUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"news_date"
property=
"newsDate"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, type, news_from, title, publisher, url, short_url, news_date, create_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from news
where id = #{id,jdbcType=BIGINT}
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.push.entity.News"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into news
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
type,
news_from,
title,
publisher,
url,
short_url,
news_date,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{type,jdbcType=VARCHAR},
#{newsFrom,jdbcType=VARCHAR},
#{title,jdbcType=VARCHAR},
#{publisher,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR},
#{shortUrl,jdbcType=VARCHAR},
#{newsDate,jdbcType=VARCHAR},
NOW()
</trim>
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.push.entity.News"
>
update news
<set>
<if
test=
"type != null"
>
type = #{type,jdbcType=VARCHAR},
</if>
<if
test=
"newsFrom != null"
>
news_from = #{newsFrom,jdbcType=VARCHAR},
</if>
<if
test=
"title != null"
>
title = #{title,jdbcType=VARCHAR},
</if>
<if
test=
"publisher != null"
>
publisher = #{publisher,jdbcType=VARCHAR},
</if>
<if
test=
"url != null"
>
url = #{url,jdbcType=VARCHAR},
</if>
<if
test=
"shortUrl != null"
>
short_url = #{shortUrl,jdbcType=VARCHAR},
</if>
<if
test=
"newsDate != null"
>
news_date = #{newsDate,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<!--查询所有-->
<select
id=
"findAll"
parameterType=
"map"
resultMap=
"BaseResultESMap"
>
select
<include
refid=
"Base_Column_List"
/>
from news
where id>#{maxId}
limit #{offset}
</select>
<!--获取全表数量-->
<select
id=
"count"
resultType=
"Integer"
>
select count(1) from news
</select>
<!--批量新增-->
<insert
id=
"batchInsert"
useGeneratedKeys=
"true"
parameterType=
"java.util.List"
>
insert into news (
type,
news_from,
title,
publisher,
url,
short_url,
news_date,
create_time
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.type,jdbcType=VARCHAR},
#{item.newsFrom,jdbcType=VARCHAR},
#{item.title,jdbcType=VARCHAR},
#{item.publisher,jdbcType=VARCHAR},
#{item.url,jdbcType=VARCHAR},
#{item.shortUrl,jdbcType=VARCHAR},
#{item.newsDate,jdbcType=VARCHAR},
NOW()
)
</foreach>
</insert>
<!--根据链接查询-->
<select
id=
"getByUrl"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from news
where url = #{url} limit 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/push/PushNewsRecordMapper.xml
0 → 100644
View file @
5babfb01
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.push.dao.impl.PushNewsRecordDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.push.entity.PushNewsRecord"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"weixin_group_id"
property=
"weixinGroupId"
jdbcType=
"VARCHAR"
/>
<result
column=
"news_id"
property=
"newsId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, weixin_group_id, news_id, create_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from push_news_record
id = #{id,jdbcType=BIGINT}
</select>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.push.entity.PushNewsRecord"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into push_news_record
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
weixin_group_id,
news_id,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{weixinGroupId,jdbcType=VARCHAR},
#{newsId,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.push.entity.PushNewsRecord"
>
update push_news_record
<set>
<if
test=
"weixinGroupId != null"
>
weixin_group_id = #{weixinGroupId,jdbcType=VARCHAR},
</if>
<if
test=
"newsId != null"
>
news_id = #{newsId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<!--根据微信群id集合查询发送记录-->
<select
id=
"getListByGroupIds"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from push_news_record
where weixin_group_id in
<foreach
collection=
"weixinGroupIds"
index=
"index"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</select>
<!--批量新增-->
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.push.entity.PushNewsRecord"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into push_news_record (
weixin_group_id,
news_id,
create_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.weixinGroupId,jdbcType=VARCHAR},
#{item.newsId,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
</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