Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
site-project
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
site-project
Commits
3a43a3c2
Commit
3a43a3c2
authored
Dec 17, 2024
by
梅存智
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
资讯增加分类 See merge request
!3
parents
7f013b60
823404f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
160 additions
and
11 deletions
+160
-11
cloud-site-api/src/main/java/com/yizhi/site/application/vo/domain/InformationClassify.java
+37
-0
cloud-site-api/src/main/java/com/yizhi/site/application/vo/domain/InformationVo.java
+10
-4
cloud-site-service/src/main/java/com/yizhi/site/application/controller/InformationManageController.java
+62
-1
cloud-site-service/src/main/java/com/yizhi/site/application/domain/Information.java
+12
-0
cloud-site-service/src/main/java/com/yizhi/site/application/service/impl/InformationServiceImpl.java
+39
-6
No files found.
cloud-site-api/src/main/java/com/yizhi/site/application/vo/domain/InformationClassify.java
View file @
3a43a3c2
package
com
.
yizhi
.
site
.
application
.
vo
.
domain
;
import
java.io.Serializable
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.activerecord.Model
;
import
com.baomidou.mybatisplus.annotations.TableField
;
...
...
@@ -27,15 +28,51 @@ public class InformationClassify extends Model<InformationClassify> {
@ApiModelProperty
(
value
=
"文章父类型"
)
@TableField
(
"type_one"
)
private
Long
typeOne
;
@ApiModelProperty
(
value
=
"文章父类型名称"
)
@TableField
(
exist
=
false
)
private
String
typeOneName
;
@ApiModelProperty
(
value
=
"文章子类型(二级)"
)
@TableField
(
"type_two"
)
private
Long
typeTwo
;
@ApiModelProperty
(
value
=
"文章子类型(二级)名称"
)
@TableField
(
exist
=
false
)
private
String
typeTwoName
;
@ApiModelProperty
(
value
=
"文章子类型(三级)"
)
@TableField
(
"type_three"
)
private
Long
typeThree
;
@ApiModelProperty
(
value
=
"文章子类型(三级)名称"
)
@TableField
(
exist
=
false
)
private
String
typeThreeName
;
@ApiModelProperty
(
value
=
"创建时间"
)
@TableField
(
"create_time"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"创建人"
)
@TableField
(
"create_by_id"
)
private
Long
createById
;
@ApiModelProperty
(
value
=
"创建人姓名"
)
@TableField
(
"create_by_name"
)
private
String
createByName
;
@ApiModelProperty
(
value
=
"修改时间"
)
@TableField
(
"update_time"
)
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"修改人"
)
@TableField
(
"update_by_id"
)
private
Long
updateById
;
@ApiModelProperty
(
value
=
"修改人姓名"
)
@TableField
(
"update_by_name"
)
private
String
updateByName
;
@Override
protected
Serializable
pkVal
()
{
return
this
.
id
;
...
...
cloud-site-api/src/main/java/com/yizhi/site/application/vo/domain/InformationVo.java
View file @
3a43a3c2
package
com
.
yizhi
.
site
.
application
.
vo
.
domain
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* <p>
*
...
...
@@ -96,6 +96,12 @@ public class InformationVo{
@ApiModelProperty
(
value
=
"文章第三层类型"
)
private
Long
typeThree
;
@ApiModelProperty
(
value
=
"副标题"
)
private
String
titleSub
;
@ApiModelProperty
(
value
=
"图片来源"
)
private
String
imgSource
;
@ApiModelProperty
(
value
=
"资讯分类"
)
private
List
<
InformationClassify
>
informationClassify
;
...
...
cloud-site-service/src/main/java/com/yizhi/site/application/controller/InformationManageController.java
View file @
3a43a3c2
...
...
@@ -6,9 +6,10 @@ import java.util.Date;
import
java.util.List
;
import
com.yizhi.site.application.domain.Information
;
import
com.yizhi.site.application.mapper.InformationClassifyMapper
;
import
com.yizhi.site.application.constant.SiteConstant
;
import
com.yizhi.site.application.service.PortalBannerService
;
import
com.yizhi.application.orm.id.IdGenerator
;
import
com.yizhi.comment.application.feign.PdfPagesClient
;
import
com.yizhi.comment.application.vo.PdfVO
;
import
com.yizhi.core.application.event.EventWrapper
;
...
...
@@ -28,8 +29,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.yizhi.site.application.service.InformationService
;
import
com.yizhi.site.application.vo.domain.InformationClassify
;
import
com.yizhi.site.application.vo.site.IdOneVO
;
import
com.yizhi.site.application.vo.site.InfomationParamVO
;
import
com.yizhi.site.application.vo.site.ParamVO
;
...
...
@@ -60,6 +63,12 @@ public class InformationManageController {
@Autowired
private
PdfPagesClient
pdfPagesClient
;
@Autowired
private
InformationClassifyMapper
informationClassifyMapper
;
@Autowired
private
IdGenerator
idGenerator
;
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
InformationManageController
.
class
);
@PostMapping
(
"/list"
)
...
...
@@ -108,6 +117,58 @@ public class InformationManageController {
information
.
setState
(
SiteConstant
.
TWO
);
informationService
.
updateById
(
information
);
}
//保存资讯分类
if
(!
CollectionUtils
.
isEmpty
(
information
.
getInformationClassify
()))
{
for
(
InformationClassify
item
:
information
.
getInformationClassify
()){
if
(
item
.
getId
()
==
null
||
item
.
getId
()
==
0
){
item
.
setId
(
idGenerator
.
generate
());
item
.
setInformationId
(
information
.
getId
());
item
.
setCreateById
(
information
.
getCreateById
());
item
.
setCreateByName
(
information
.
getCreateByName
());
item
.
setCreateTime
(
information
.
getCreateTime
());
item
.
setUpdateById
(
information
.
getUpdateById
());
item
.
setUpdateByName
(
information
.
getUpdateByName
());
item
.
setUpdateTime
(
information
.
getUpdateTime
());
informationClassifyMapper
.
insert
(
item
);
}
}
//删除不存在的资讯分类
//获取已有的资讯
InformationClassify
classify
=
new
InformationClassify
();
classify
.
setInformationId
(
information
.
getId
());
EntityWrapper
<
InformationClassify
>
wrapper
=
new
EntityWrapper
<
InformationClassify
>(
classify
);
List
<
InformationClassify
>
informationClassify
=
informationClassifyMapper
.
selectList
(
wrapper
);
if
(!
CollectionUtils
.
isEmpty
(
informationClassify
))
{
boolean
isDel
=
true
;
for
(
InformationClassify
old
:
informationClassify
){
isDel
=
true
;
for
(
InformationClassify
item
:
information
.
getInformationClassify
()){
if
(
old
.
getId
().
equals
(
item
.
getId
())){
isDel
=
false
;
break
;
}
}
if
(
isDel
){
informationClassifyMapper
.
deleteById
(
old
.
getId
());
}
}
}
}
else
{
//删除所有资讯分类
InformationClassify
classify
=
new
InformationClassify
();
classify
.
setInformationId
(
information
.
getId
());
EntityWrapper
<
InformationClassify
>
wrapper
=
new
EntityWrapper
<
InformationClassify
>(
classify
);
List
<
InformationClassify
>
informationClassify
=
informationClassifyMapper
.
selectList
(
wrapper
);
if
(!
CollectionUtils
.
isEmpty
(
informationClassify
))
{
for
(
InformationClassify
old
:
informationClassify
){
informationClassifyMapper
.
deleteById
(
old
.
getId
());
}
}
}
if
(!
StringUtils
.
isEmpty
(
information
.
getPdfOssUrl
())
&&
!
StringUtils
.
isEmpty
(
information
.
getPdfFileName
()))
{
List
<
PdfVO
>
pdfVOs
=
new
ArrayList
<
PdfVO
>();
PdfVO
pdfVO
=
new
PdfVO
();
...
...
cloud-site-service/src/main/java/com/yizhi/site/application/domain/Information.java
View file @
3a43a3c2
...
...
@@ -121,6 +121,18 @@ public class Information extends Model<Information> {
@TableField
(
"type_three"
)
private
Long
typeThree
;
@ApiModelProperty
(
value
=
"文章子类型(三级)名称"
)
@TableField
(
exist
=
false
)
private
String
typeThreeName
;
@ApiModelProperty
(
value
=
"副标题"
)
@TableField
(
"title_sub"
)
private
String
titleSub
;
@ApiModelProperty
(
value
=
"图片来源"
)
@TableField
(
"img_source"
)
private
String
imgSource
;
@ApiModelProperty
(
value
=
"资讯分类"
)
@TableField
(
exist
=
false
)
private
List
<
InformationClassify
>
informationClassify
;
...
...
cloud-site-service/src/main/java/com/yizhi/site/application/service/impl/InformationServiceImpl.java
View file @
3a43a3c2
...
...
@@ -923,10 +923,10 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
if
(
list
.
size
()
>
0
&&
list
!=
null
)
{
for
(
Information
info
:
list
)
{
if
(
info
.
getTypeOne
()
!=
null
||
info
.
getTypeOne
()
!=
0
)
{
if
(
info
.
getTypeOne
()
!=
null
&&
info
.
getTypeOne
()
!=
0
)
{
info
.
setTypeOneName
(
findNameById
(
info
.
getTypeOne
()));
}
if
(
info
.
getTypeTwo
()
!=
null
||
info
.
getTypeTwo
()
!=
0
)
{
if
(
info
.
getTypeTwo
()
!=
null
&&
info
.
getTypeTwo
()
!=
0
)
{
info
.
setTypeTwoName
(
findNameById
(
info
.
getTypeTwo
()));
}
}
...
...
@@ -980,10 +980,10 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
}
if
(
list
.
size
()
>
0
&&
list
!=
null
)
{
for
(
Information
info
:
list
)
{
if
(
info
.
getTypeOne
()
!=
null
||
info
.
getTypeOne
()
!=
0
)
{
if
(
info
.
getTypeOne
()
!=
null
&&
info
.
getTypeOne
()
!=
0
)
{
info
.
setTypeOneName
(
findNameById
(
info
.
getTypeOne
()));
}
if
(
info
.
getTypeTwo
()
!=
null
||
info
.
getTypeTwo
()
!=
0
)
{
if
(
info
.
getTypeTwo
()
!=
null
&&
info
.
getTypeTwo
()
!=
0
)
{
info
.
setTypeTwoName
(
findNameById
(
info
.
getTypeTwo
()));
}
}
...
...
@@ -998,18 +998,34 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
if
(
info
==
null
)
{
return
null
;
}
if
(
info
.
getTypeOne
()
!=
null
||
info
.
getTypeOne
()
!=
0
)
{
if
(
info
.
getTypeOne
()
!=
null
&&
info
.
getTypeOne
()
!=
0
)
{
info
.
setTypeOneName
(
findNameById
(
info
.
getTypeOne
()));
}
if
(
info
.
getTypeTwo
()
!=
null
||
info
.
getTypeTwo
()
!=
0
)
{
if
(
info
.
getTypeTwo
()
!=
null
&&
info
.
getTypeTwo
()
!=
0
)
{
info
.
setTypeTwoName
(
findNameById
(
info
.
getTypeTwo
()));
}
if
(
info
.
getTypeThree
()
!=
null
&&
info
.
getTypeThree
()
!=
0
)
{
info
.
setTypeThreeName
(
findNameById
(
info
.
getTypeThree
()));
}
//设置资讯分类
InformationClassify
classify
=
new
InformationClassify
();
classify
.
setInformationId
(
id
);
EntityWrapper
<
InformationClassify
>
wrapper
=
new
EntityWrapper
<
InformationClassify
>(
classify
);
List
<
InformationClassify
>
informationClassify
=
informationClassifyMapper
.
selectList
(
wrapper
);
if
(!
CollectionUtils
.
isEmpty
(
informationClassify
))
{
for
(
InformationClassify
item
:
informationClassify
){
if
(
item
.
getTypeOne
()
!=
null
&&
item
.
getTypeOne
()
!=
0
)
{
item
.
setTypeOneName
(
findNameById
(
item
.
getTypeOne
()));
}
if
(
item
.
getTypeTwo
()
!=
null
&&
item
.
getTypeTwo
()
!=
0
)
{
item
.
setTypeTwoName
(
findNameById
(
item
.
getTypeTwo
()));
}
if
(
item
.
getTypeThree
()
!=
null
&&
item
.
getTypeThree
()
!=
0
)
{
item
.
setTypeThreeName
(
findNameById
(
item
.
getTypeThree
()));
}
}
}
info
.
setInformationClassify
(
informationClassify
);
return
info
;
...
...
@@ -1043,6 +1059,23 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
this
.
insert
(
information
);
}
//保存资讯分类
if
(!
CollectionUtils
.
isEmpty
(
information
.
getInformationClassify
()))
{
for
(
InformationClassify
item
:
information
.
getInformationClassify
()){
item
.
setId
(
idGenerator
.
generate
());
item
.
setInformationId
(
information
.
getId
());
item
.
setCreateById
(
information
.
getCreateById
());
item
.
setCreateByName
(
information
.
getCreateByName
());
item
.
setCreateTime
(
information
.
getCreateTime
());
item
.
setUpdateById
(
information
.
getUpdateById
());
item
.
setUpdateByName
(
information
.
getUpdateByName
());
item
.
setUpdateTime
(
information
.
getUpdateTime
());
informationClassifyMapper
.
insert
(
item
);
}
}
if
(!
StringUtils
.
isEmpty
(
information
.
getPdfOssUrl
())
&&
!
StringUtils
.
isEmpty
(
information
.
getPdfFileName
()))
{
List
<
PdfVO
>
pdfVOs
=
new
ArrayList
<
PdfVO
>();
PdfVO
pdfVO
=
new
PdfVO
();
...
...
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