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
547c987e
Commit
547c987e
authored
Mar 31, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fillResource
parent
b501a1a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
89 deletions
+131
-89
pom.xml
pcloud-service-book/pom.xml
+0
-1
CustomTimeControlBizImpl.java
...pcloud/book/custom/biz/impl/CustomTimeControlBizImpl.java
+83
-1
CustomCheck.java
...c/main/java/com/pcloud/book/custom/check/CustomCheck.java
+1
-1
CustomTimeControlReply.java
...com/pcloud/book/custom/entity/CustomTimeControlReply.java
+47
-86
No files found.
pcloud-service-book/pom.xml
View file @
547c987e
...
...
@@ -210,7 +210,6 @@
</dependency>
<dependency>
<groupId>
com.pcloud.facade
</groupId>
<artifactId>
pcloud-facade-erp
</artifactId>
<version>
${pcloud-facade.version}
</version>
...
...
pcloud-service-book/src/main/java/com/pcloud/book/custom/biz/impl/CustomTimeControlBizImpl.java
View file @
547c987e
package
com
.
pcloud
.
book
.
custom
.
biz
.
impl
;
import
com.google.common.collect.Lists
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.custom.biz.CustomTimeControlBiz
;
import
com.pcloud.book.custom.check.CustomCheck
;
import
com.pcloud.book.custom.dao.CustomTimeControlDao
;
...
...
@@ -11,12 +15,16 @@ import com.pcloud.book.custom.entity.CustomTimeControlBook;
import
com.pcloud.book.custom.entity.CustomTimeControlReply
;
import
com.pcloud.book.custom.mapper.CustomTimeControlBookMapper
;
import
com.pcloud.book.custom.mapper.CustomTimeControlReplyMapper
;
import
com.pcloud.book.group.enums.AppAndProductTypeEnum
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.skill.entity.PcloudSubReply
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.string.StringUtilParent
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.erp.project.dto.ProjectInfoDTO
;
import
com.pcloud.erp.project.service.ProjectService
;
...
...
@@ -47,6 +55,10 @@ public class CustomTimeControlBizImpl implements CustomTimeControlBiz {
private
CustomCheck
customCheck
;
@Autowired
private
ProjectService
projectService
;
@Autowired
private
AppConsr
appConsr
;
@Autowired
private
ResourceConsr
resourceConsr
;
@Override
@Transactional
...
...
@@ -130,10 +142,15 @@ public class CustomTimeControlBizImpl implements CustomTimeControlBiz {
}
@Override
@ParamLog
(
value
=
"通过id获取定制服务读书推送计划"
,
isAfterReturn
=
false
)
public
CustomTimeControlDTO
getCustomTimeControlById
(
Integer
id
)
{
CustomTimeControlDTO
customTimeControlDTO
=
customTimeControlMapper
.
getCustomTimeControlById
(
id
);
if
(
null
==
customTimeControlDTO
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_EXIST
,
"通过id获取定制服务读书推送计划为null"
);
}
List
<
CustomTimeControlBook
>
customTimeControlBooks
=
customTimeControlDTO
.
getRelatedBooks
();
if
(
null
!=
customTimeControlDTO
&&
!
ListUtils
.
isEmpty
(
customTimeControlBooks
)){
fillRelies
(
customTimeControlDTO
.
getReplyList4Subscribe
(),
customTimeControlDTO
.
getReplyList4Unsubscribe
());
if
(!
ListUtils
.
isEmpty
(
customTimeControlBooks
)){
List
<
String
>
bookIds
=
customTimeControlBooks
.
stream
().
map
(
e
->
e
.
getBookId
()).
collect
(
Collectors
.
toList
());
Map
<
String
,
ProjectInfoDTO
>
projectMap
=
null
;
try
{
...
...
@@ -151,6 +168,71 @@ public class CustomTimeControlBizImpl implements CustomTimeControlBiz {
return
customTimeControlDTO
;
}
private
void
fillRelies
(
List
<
CustomTimeControlReply
>
replyList4Subscribe
,
List
<
CustomTimeControlReply
>
replyList4Unsubscribe
)
{
log
.
info
(
"填充资源"
);
List
<
CustomTimeControlReply
>
customTimeControlReplies
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
replyList4Subscribe
)){
customTimeControlReplies
.
addAll
(
replyList4Subscribe
);
}
if
(!
ListUtils
.
isEmpty
(
replyList4Unsubscribe
)){
customTimeControlReplies
.
addAll
(
replyList4Unsubscribe
);
}
if
(
ListUtils
.
isEmpty
(
customTimeControlReplies
)){
return
;
}
List
<
Long
>
appIds
=
new
ArrayList
<>();
List
<
Long
>
resourceIds
=
new
ArrayList
<>();
for
(
CustomTimeControlReply
reply:
customTimeControlReplies
){
Integer
type
=
reply
.
getReplyType
();
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
)){
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
reply
.
getServeType
())){
appIds
.
add
(
reply
.
getServeId
());
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
)){
resourceIds
.
add
(
reply
.
getResourceId
());
}
}
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
Map
<
Long
,
ResourceDTO
>
resourceDTOMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
appIds
)){
appDtoMap
=
appConsr
.
getBaseByIds
(
appIds
);
}
if
(!
ListUtils
.
isEmpty
(
resourceIds
)){
resourceDTOMap
=
resourceConsr
.
mapByIds
(
resourceIds
);
}
for
(
CustomTimeControlReply
reply:
customTimeControlReplies
){
Integer
type
=
reply
.
getReplyType
();
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
type
)){
Long
serveId
=
reply
.
getServeId
();
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
reply
.
getServeType
())){
AppDto
appDto
=
appDtoMap
.
get
(
serveId
);
if
(
appDto
!=
null
){
reply
.
setServePic
(
appDto
.
getSquareImg
());
reply
.
setServeName
(
appDto
.
getTitle
());
reply
.
setServeTypeCode
(
appDto
.
getTypeCode
());
reply
.
setServeTypeName
(
appDto
.
getTypeName
());
}
}
}
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
type
)){
ResourceDTO
resourceDTO
=
resourceDTOMap
.
get
(
reply
.
getResourceId
());
if
(
resourceDTO
!=
null
){
reply
.
setResourceName
(
resourceDTO
.
getResourceName
());
reply
.
setResourceUrl
(
resourceDTO
.
getFileUrl
());
reply
.
setResourceTypeCode
(
resourceDTO
.
getTypeCode
());
reply
.
setResourceTypeName
(
resourceDTO
.
getTypeName
());
reply
.
setFileType
(
resourceDTO
.
getFileType
());
reply
.
setResourcePdfItems
(
resourceDTO
.
getResourcePdfItems
());
reply
.
setResourceOfficeItemDTOs
(
resourceDTO
.
getResourceOfficeItemDTOs
());
reply
.
setFileSize
(
resourceDTO
.
getFileSize
());
}
}
}
}
@Override
@Transactional
public
void
deleteCustomTimeControlById
(
Integer
id
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/custom/check/CustomCheck.java
View file @
547c987e
...
...
@@ -42,7 +42,7 @@ public class CustomCheck {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"bookid不能为空!"
);
}
if
(
null
==
customTimeControlBook
.
getReadType
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"
readType
不能为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"
阅读类型
不能为空!"
);
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/custom/entity/CustomTimeControlReply.java
View file @
547c987e
package
com
.
pcloud
.
book
.
custom
.
entity
;
import
com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO
;
import
com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
@Data
public
class
CustomTimeControlReply
{
private
Integer
id
;
private
Integer
customTimeControlId
;
@ApiModelProperty
(
"订阅回复类型:1成功,2取消,3未订阅提醒 "
)
private
Integer
subType
;
@ApiModelProperty
(
"类型 1 文字 2 图片 3 链接 4应用 5素材"
)
private
Integer
replyType
;
@ApiModelProperty
(
"内容"
)
private
String
content
;
@ApiModelProperty
(
"描述"
)
private
String
description
;
@ApiModelProperty
(
"链接地址"
)
private
String
linkUrl
;
@ApiModelProperty
(
"图片地址"
)
private
String
picUrl
;
private
Integer
serveId
;
@ApiModelProperty
(
"应用或作品id"
)
private
Long
serveId
;
@ApiModelProperty
(
"应用或作品类型"
)
private
String
serveType
;
private
Integer
resourceId
;
private
Date
createTime
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
Integer
getCustomTimeControlId
()
{
return
customTimeControlId
;
}
public
void
setCustomTimeControlId
(
Integer
customTimeControlId
)
{
this
.
customTimeControlId
=
customTimeControlId
;
}
@ApiModelProperty
(
"资源id"
)
private
Long
resourceId
;
public
Integer
getSubType
()
{
return
subType
;
}
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
public
void
setSubType
(
Integer
subType
)
{
this
.
subType
=
subType
;
}
@ApiModelProperty
(
"应用或作品图片"
)
private
String
servePic
;
public
Integer
getReplyType
()
{
return
replyType
;
}
@ApiModelProperty
(
"应用或作品名称"
)
private
String
serveName
;
public
void
setReplyType
(
Integer
replyType
)
{
this
.
replyType
=
replyType
;
}
@ApiModelProperty
(
"应用或作品类型名称"
)
private
String
serveTypeName
;
public
String
getContent
()
{
return
content
;
}
@ApiModelProperty
(
"应用或作品类型编码"
)
private
String
serveTypeCode
;
public
void
setContent
(
String
content
)
{
this
.
content
=
content
==
null
?
null
:
content
.
trim
();
}
@ApiModelProperty
(
"资源链接"
)
private
String
resourceUrl
;
public
String
getDescription
()
{
return
description
;
}
@ApiModelProperty
(
"资源名称"
)
private
String
resourceName
;
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
==
null
?
null
:
description
.
trim
();
}
@ApiModelProperty
(
"资源类型编码"
)
private
String
resourceTypeCode
;
public
String
getLinkUrl
()
{
return
linkUrl
;
}
@ApiModelProperty
(
"资源类型名称"
)
private
String
resourceTypeName
;
public
void
setLinkUrl
(
String
linkUrl
)
{
this
.
linkUrl
=
linkUrl
==
null
?
null
:
linkUrl
.
trim
();
}
@ApiModelProperty
(
"文件类型"
)
private
String
fileType
;
public
String
getPicUrl
()
{
return
picUrl
;
}
@ApiModelProperty
(
"文件大小"
)
private
Long
fileSize
;
public
void
setPicUrl
(
String
picUrl
)
{
this
.
picUrl
=
picUrl
==
null
?
null
:
picUrl
.
trim
();
}
@ApiModelProperty
(
"pdf转码后的单张图片集合"
)
private
List
<
ResourcePdfItemDTO
>
resourcePdfItems
;
public
Integer
getServeId
()
{
return
serveId
;
}
@ApiModelProperty
(
"文件转码后的单张图片集合"
)
private
List
<
ResourceOfficeItemDTO
>
resourceOfficeItemDTOs
;
public
void
setServeId
(
Integer
serveId
)
{
this
.
serveId
=
serveId
;
}
public
String
getServeType
()
{
return
serveType
;
}
public
void
setServeType
(
String
serveType
)
{
this
.
serveType
=
serveType
==
null
?
null
:
serveType
.
trim
();
}
public
Integer
getResourceId
()
{
return
resourceId
;
}
public
void
setResourceId
(
Integer
resourceId
)
{
this
.
resourceId
=
resourceId
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
}
\ 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