Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-web
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
cloud-web
Commits
890afe98
Commit
890afe98
authored
Dec 17, 2024
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
投稿管理
parent
c87bc5e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
191 additions
and
0 deletions
+191
-0
cloud-web-manage/src/main/java/com/yizhi/application/portal/controller/SitePublicationManageController.java
+191
-0
No files found.
cloud-web-manage/src/main/java/com/yizhi/application/portal/controller/SitePublicationManageController.java
0 → 100644
View file @
890afe98
package
com
.
yizhi
.
application
.
portal
.
controller
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.yizhi.core.application.context.ContextHolder
;
import
com.yizhi.core.application.context.RequestContext
;
import
com.yizhi.core.application.enums.InternationalEnums
;
import
com.yizhi.lecturer.application.enums.DeleteFlag
;
import
com.yizhi.site.application.feign.PortalManagePCFeignClients
;
import
com.yizhi.site.application.feign.PublicationManageFeignClients
;
import
com.yizhi.site.application.vo.domain.ProtalPlateVo
;
import
com.yizhi.site.application.vo.domain.PublicationVo
;
import
com.yizhi.site.application.vo.site.*
;
import
com.yizhi.util.application.constant.ReturnCode
;
import
com.yizhi.util.application.domain.Response
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Date
;
import
java.util.List
;
/**
* 资讯管理
*
* @author mei
* @Date: 2018/3/17 20:30
*/
@Api
(
tags
=
"资讯管理"
)
@RestController
@RequestMapping
(
"/manage/site/classify/publication"
)
public
class
SitePublicationManageController
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
SitePublicationManageController
.
class
);
@Autowired
private
PublicationManageFeignClients
publicationManageFeignClients
;
@Autowired
private
PortalManagePCFeignClients
portalManagePCFeignClient
;
/**
* 资讯列表
*
* @return
*/
@ApiOperation
(
value
=
"查看资讯"
,
notes
=
"查看资讯"
,
response
=
PublicationParamVO
.
class
)
@PostMapping
(
"/list"
)
public
Response
<
Page
<
PublicationVo
>>
list
(
@RequestBody
PublicationParamVO
vo
)
{
try
{
vo
.
setSiteId
(
ContextHolder
.
get
().
getSiteId
());
return
Response
.
ok
(
publicationManageFeignClients
.
list
(
vo
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
LOGGER
.
error
(
""
,
e
);
return
Response
.
fail
(
ReturnCode
.
SERVICE_UNAVAILABLE
.
getCode
(),
ReturnCode
.
SERVICE_UNAVAILABLE
.
getMsg
());
}
}
/**
* 资讯发布的列表
*
*/
@ApiOperation
(
value
=
"查看资讯发布列表"
,
notes
=
"查看资讯发布列表"
,
response
=
PublicationVo
.
class
)
@PostMapping
(
"/release/list"
)
public
Response
<
Page
<
PublicationVo
>>
releaseList
(
@RequestBody
PublicationParamReleaseVO
vo
)
{
try
{
RequestContext
context
=
ContextHolder
.
get
();
vo
.
setCompanyCode
(
context
.
getCompanyCode
());
vo
.
setCompanyId
(
context
.
getCompanyId
());
vo
.
setSiteCode
(
context
.
getSiteCode
());
vo
.
setSiteId
(
context
.
getSiteId
());
vo
.
setAccountId
(
vo
.
getAccountId
());
vo
.
setAdmin
(
context
.
isAdmin
());
vo
.
setOrgId
(
context
.
getOrgId
());
vo
.
setOrgIds
(
context
.
getOrgIds
());
vo
.
setOrgName
(
context
.
getOrgName
());
return
Response
.
ok
(
publicationManageFeignClients
.
releaseList
(
vo
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
LOGGER
.
error
(
""
,
e
);
return
Response
.
fail
(
ReturnCode
.
SERVICE_UNAVAILABLE
.
getCode
(),
ReturnCode
.
SERVICE_UNAVAILABLE
.
getMsg
());
}
}
@ApiOperation
(
value
=
"保存资料分类"
,
notes
=
"保存资料分类"
)
@PostMapping
(
"/insert"
)
public
Response
<
Boolean
>
insert
(
@RequestBody
PublicationVo
information
)
{
try
{
Date
date
=
new
Date
();
RequestContext
context
=
ContextHolder
.
get
();
information
.
setCreateById
(
context
.
getAccountId
());
information
.
setCreateByName
(
context
.
getAccountName
());
information
.
setCreateTime
(
date
);
information
.
setUpdateById
(
context
.
getAccountId
());
information
.
setUpdateByName
(
context
.
getAccountName
());
information
.
setUpdateTime
(
date
);
information
.
setSiteId
(
context
.
getSiteId
());
Long
id
=
publicationManageFeignClients
.
insert
(
information
);
if
(
id
==
null
)
{
Response
.
fail
(
InternationalEnums
.
SITEINFORMATIONMANAGECONTROLLER
.
getCode
());
}
information
.
setId
(
id
);
return
Response
.
ok
(
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
LOGGER
.
error
(
""
,
e
);
return
Response
.
fail
(
ReturnCode
.
SERVICE_UNAVAILABLE
.
getCode
(),
ReturnCode
.
SERVICE_UNAVAILABLE
.
getMsg
());
}
}
@ApiOperation
(
value
=
"修改资料分类"
,
notes
=
"修改资料分类"
)
@PostMapping
(
"/update"
)
public
Response
<
Boolean
>
update
(
@RequestBody
PublicationVo
information
)
{
try
{
RequestContext
context
=
ContextHolder
.
get
();
information
.
setUpdateById
(
context
.
getAccountId
());
information
.
setUpdateByName
(
context
.
getAccountName
());
information
.
setUpdateTime
(
new
Date
());
Boolean
update
=
publicationManageFeignClients
.
update
(
information
);
return
Response
.
ok
(
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
LOGGER
.
error
(
""
+
e
);
return
Response
.
fail
(
ReturnCode
.
UPDATE_FAIL
.
getCode
(),
ReturnCode
.
UPDATE_FAIL
.
getMsg
());
}
}
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除站点"
,
notes
=
"删除站点"
)
public
Response
<
String
>
deleteById
(
@RequestBody
IdOneVO
vo
)
{
if
(
vo
==
null
)
{
return
Response
.
fail
(
InternationalEnums
.
SITEINFORMATIONMANAGECONTROLLER1
.
getCode
());
}
if
(
vo
.
getId
()
==
null
)
{
return
Response
.
fail
(
InternationalEnums
.
SITEINFORMATIONMANAGECONTROLLER1
.
getCode
());
}
try
{
return
Response
.
ok
(
publicationManageFeignClients
.
deleteById
(
vo
));
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
""
,
e
);
return
Response
.
fail
();
}
}
@PostMapping
(
"/releases"
)
@ApiOperation
(
value
=
"资讯发布"
,
notes
=
"资讯发布"
)
public
Response
<
Boolean
>
releases
(
@RequestBody
ParamVO
vo
)
{
if
(
vo
==
null
)
{
return
Response
.
fail
(
InternationalEnums
.
SITEINFORMATIONMANAGECONTROLLER1
.
getCode
());
}
if
(
vo
.
getIds
()
==
null
||
vo
.
getIds
().
size
()
==
0
)
{
return
Response
.
fail
(
InternationalEnums
.
SITEINFORMATIONMANAGECONTROLLER1
.
getCode
());
}
return
Response
.
ok
(
publicationManageFeignClients
.
releases
(
vo
));
}
@PostMapping
(
"/unreleases"
)
@ApiOperation
(
value
=
"资讯取消发布"
,
notes
=
"资讯取消发布"
)
public
Response
<
Boolean
>
unreleases
(
@RequestBody
ParamVO
vo
)
{
if
(
vo
==
null
)
{
return
Response
.
fail
(
InternationalEnums
.
SITEINFORMATIONMANAGECONTROLLER1
.
getCode
());
}
if
(
vo
.
getIds
()
==
null
||
vo
.
getIds
().
size
()
==
0
)
{
return
Response
.
fail
(
InternationalEnums
.
SITEINFORMATIONMANAGECONTROLLER1
.
getCode
());
}
//新增新闻下架,校验是否关联首页模块
List
<
Long
>
ids
=
vo
.
getIds
();
for
(
Long
infoId
:
ids
)
{
ProtalPlateVo
protalPlate
=
new
ProtalPlateVo
();
protalPlate
.
setLinkContent
(
infoId
);
protalPlate
.
setState
(
DeleteFlag
.
YES
.
ordinal
());
ProtalPlateVo
plate
=
portalManagePCFeignClient
.
getPlate
(
protalPlate
);
if
(
plate
!=
null
)
{
LOGGER
.
info
(
"新闻下架失败;informationId={},新闻已经关联到首页配置模块;不能下架"
,
infoId
);
return
Response
.
fail
(
InternationalEnums
.
TRAININGPROJECTCONTROLLER2
.
getCode
());
}
}
boolean
b
=
publicationManageFeignClients
.
unreleases
(
vo
);
return
Response
.
ok
(
b
);
}
@GetMapping
(
"/view"
)
@ApiOperation
(
value
=
"资讯预览"
,
notes
=
"资讯预览"
,
response
=
PublicationVo
.
class
)
public
Response
<
PublicationVo
>
releases
(
@RequestParam
(
name
=
"id"
)
Long
id
)
{
PublicationVo
info
=
publicationManageFeignClients
.
publicationView
(
id
);
return
Response
.
ok
(
info
);
}
}
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