Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
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
吴迪
gs1-office-web-sit
Commits
f9ed0dc1
Commit
f9ed0dc1
authored
Oct 17, 2023
by
吴迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改】政府采购
parent
385c7acd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
148 additions
and
31 deletions
+148
-31
ApplicationCaseController.java
.../modules/manage/controller/ApplicationCaseController.java
+79
-23
ApplicationCaseEntity.java
...o/office/modules/manage/entity/ApplicationCaseEntity.java
+5
-4
ApplicationCaseService.java
...office/modules/manage/service/ApplicationCaseService.java
+6
-0
ApplicationCaseServiceImpl.java
...dules/manage/service/impl/ApplicationCaseServiceImpl.java
+58
-4
No files found.
src/main/java/io/office/modules/manage/controller/ApplicationCaseController.java
View file @
f9ed0dc1
package
io
.
office
.
modules
.
manage
.
controller
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
io.office.common.annotation.SysLog
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
import
io.office.common.validator.ValidatorUtils
;
import
io.office.common.validator.group.AddGroup
;
import
io.office.common.validator.group.UpdateGroup
;
import
io.office.modules.manage.entity.ApplicationCaseEntity
;
import
io.office.modules.manage.
form.ApplicationCaseForm
;
import
io.office.modules.manage.
entity.TokenCount
;
import
io.office.modules.manage.service.ApplicationCaseService
;
import
io.office.modules.manage.service.TokenCountService
;
import
io.office.modules.sys.controller.AbstractController
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Arrays
;
import
java.util.Map
;
...
...
@@ -30,19 +33,30 @@ import java.util.Map;
public
class
ApplicationCaseController
extends
AbstractController
{
@Autowired
private
ApplicationCaseService
applicationCaseService
;
@Autowired
private
TokenCountService
tokenCountService
;
@Value
(
"${token.count}"
)
private
int
tokenCountConfig
;
/**
* 列表
*/
@RequestMapping
(
"/list"
)
//@RequiresPermissions("manage:applicationcase:list")
public
R
list
(
@Request
Param
Map
<
String
,
Object
>
params
)
{
public
R
list
(
@Request
Body
Map
<
String
,
Object
>
params
)
{
PageUtils
page
=
applicationCaseService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"data"
,
page
);
}
@RequestMapping
(
"/api/list"
)
//@RequiresPermissions("manage:applicationcase:list")
public
R
getList
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
PageUtils
page
=
applicationCaseService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"data"
,
page
);
}
/**
* 信息
*/
...
...
@@ -56,15 +70,15 @@ public class ApplicationCaseController extends AbstractController {
/**
* 保存
*/
@SysLog
(
"保存
XXXX
"
)
@SysLog
(
"保存
政府采购应用案例
"
)
@RequestMapping
(
"/save"
)
//@RequiresPermissions("manage:applicationcase:save")
public
R
save
(
@RequestBody
ApplicationCase
Form
applicationCase
)
{
public
R
save
(
@RequestBody
ApplicationCase
Entity
applicationCaseEntity
)
{
//校验参数
ValidatorUtils
.
validateEntity
(
applicationCase
,
AddGroup
.
class
);
//
ValidatorUtils.validateEntity(applicationCase, AddGroup.class);
//转化实体对象
ApplicationCaseEntity
applicationCaseEntity
=
new
ApplicationCaseEntity
();
BeanUtil
.
copyProperties
(
applicationCase
,
applicationCaseEntity
);
//
ApplicationCaseEntity applicationCaseEntity = new ApplicationCaseEntity();
//
BeanUtil.copyProperties(applicationCase, applicationCaseEntity);
applicationCaseService
.
saveApplicationCase
(
applicationCaseEntity
,
getUser
());
return
R
.
ok
();
...
...
@@ -73,15 +87,10 @@ public class ApplicationCaseController extends AbstractController {
/**
* 修改
*/
@SysLog
(
"修改
XXXX
"
)
@SysLog
(
"修改
政府采购应用案例
"
)
@RequestMapping
(
"/update"
)
//@RequiresPermissions("manage:applicationcase:update")
public
R
update
(
@RequestBody
ApplicationCaseForm
applicationCase
)
{
ValidatorUtils
.
validateEntity
(
applicationCase
,
UpdateGroup
.
class
);
//转化实体对象
ApplicationCaseEntity
applicationCaseEntity
=
new
ApplicationCaseEntity
();
BeanUtil
.
copyProperties
(
applicationCase
,
applicationCaseEntity
);
public
R
update
(
@RequestBody
ApplicationCaseEntity
applicationCaseEntity
)
{
applicationCaseService
.
updateApplicationCaseById
(
applicationCaseEntity
,
getUser
());
return
R
.
ok
();
}
...
...
@@ -89,12 +98,59 @@ public class ApplicationCaseController extends AbstractController {
/**
* 删除
*/
@SysLog
(
"删除
XXXX
"
)
@SysLog
(
"删除
政府采购应用案例
"
)
@RequestMapping
(
"/delete"
)
//@RequiresPermissions("manage:applicationcase:delete")
public
R
delete
(
@RequestBody
String
[]
ids
)
{
applicationCaseService
.
removeByIds
(
Arrays
.
asList
(
ids
));
for
(
String
id
:
ids
)
{
UpdateWrapper
<
ApplicationCaseEntity
>
applicationCaseEntityUpdateWrapper
=
new
UpdateWrapper
<>();
applicationCaseEntityUpdateWrapper
.
eq
(
"id"
,
id
);
ApplicationCaseEntity
applicationCaseEntity
=
new
ApplicationCaseEntity
();
applicationCaseEntity
.
setLevels
(
"0"
);
applicationCaseService
.
update
(
applicationCaseEntity
,
applicationCaseEntityUpdateWrapper
);
}
return
R
.
ok
();
}
@SysLog
(
"审批政府采购应用案例"
)
@RequestMapping
(
"/check"
)
//@RequiresPermissions("manage:applicationcase:delete")
public
R
check
(
@RequestBody
ApplicationCaseEntity
applicationCaseEntity
)
{
applicationCaseService
.
checkApplicationCaseById
(
applicationCaseEntity
,
getUser
());
return
R
.
ok
();
}
@RequestMapping
(
"api/getDetailInfo"
)
// @RequiresPermissions("manage:partners:info")
public
R
getDetailInfo
(
@RequestBody
Map
<
String
,
String
>
params
){
ApplicationCaseEntity
applicationCaseEntity
=
applicationCaseService
.
getById
(
params
.
get
(
"id"
));
if
(
applicationCaseEntity
==
null
)
{
return
R
.
error
(
"没有可显示的内容"
);
}
if
(
params
.
get
(
"token"
)
!=
null
&&
StringUtils
.
isNotBlank
(
params
.
get
(
"token"
).
toString
()))
{
QueryWrapper
<
TokenCount
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"token"
,
params
.
get
(
"token"
).
toString
());
TokenCount
tokenCount
=
tokenCountService
.
getOne
(
queryWrapper
);
if
(
tokenCount
==
null
)
{
return
R
.
error
(
"非法请求,请获取正确的预览链接!"
);
}
if
(
tokenCount
.
getCountFlag
()
>
tokenCountConfig
)
{
//删除无用token
return
R
.
error
(
"预览链接次数已达上限,请联系相关人员重新获取预览链接!"
);
}
tokenCount
.
setCountFlag
(
tokenCount
.
getCountFlag
()
+
1
);
tokenCountService
.
updateById
(
tokenCount
);
}
else
{
if
(!
applicationCaseEntity
.
getStatus
().
equals
(
"1"
))
{
return
R
.
error
(
"没有可显示的内容"
);
}
if
(
applicationCaseEntity
.
getLevels
().
equals
(
"0"
)
)
{
return
R
.
error
(
"没有可显示的内容"
);
}
}
return
R
.
ok
().
put
(
"data"
,
applicationCaseEntity
);
}
}
src/main/java/io/office/modules/manage/entity/ApplicationCaseEntity.java
View file @
f9ed0dc1
package
io
.
office
.
modules
.
manage
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
...
...
@@ -21,7 +22,7 @@ public class ApplicationCaseEntity implements Serializable {
/**
* 主键
*/
@TableId
@TableId
(
type
=
IdType
.
INPUT
)
private
String
id
;
/**
* 标题
...
...
@@ -42,7 +43,7 @@ public class ApplicationCaseEntity implements Serializable {
/**
* 级别
*/
private
Integer
levels
;
private
String
levels
;
/**
* 跳转地址
*/
...
...
@@ -54,7 +55,7 @@ public class ApplicationCaseEntity implements Serializable {
/**
* 点击量
*/
private
Integer
hits
;
private
int
hits
;
/**
* 审核人
*/
...
...
@@ -74,6 +75,6 @@ public class ApplicationCaseEntity implements Serializable {
/**
* 状态 0 待审核 1 成功 2 失败
*/
private
Integer
status
;
private
String
status
;
}
src/main/java/io/office/modules/manage/service/ApplicationCaseService.java
View file @
f9ed0dc1
...
...
@@ -19,10 +19,16 @@ public interface ApplicationCaseService extends IService<ApplicationCaseEntity>
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
PageUtils
getList
(
Map
<
String
,
Object
>
params
);
@Transactional
void
saveApplicationCase
(
ApplicationCaseEntity
applicationCaseEntity
,
SysUserEntity
loginUser
);
@Transactional
void
updateApplicationCaseById
(
ApplicationCaseEntity
applicationCaseEntity
,
SysUserEntity
loginUser
);
@Transactional
void
checkApplicationCaseById
(
ApplicationCaseEntity
applicationCaseEntity
,
SysUserEntity
loginUser
);
}
src/main/java/io/office/modules/manage/service/impl/ApplicationCaseServiceImpl.java
View file @
f9ed0dc1
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.sitech.idworkstarter.IdWorkService
;
import
io.office.common.utils.DateUtils
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.Query
;
import
io.office.modules.manage.dao.ApplicationCaseDao
;
import
io.office.modules.manage.entity.ApplicationCaseEntity
;
import
io.office.modules.manage.service.ApplicationCaseService
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Map
;
@Service
(
"applicationCaseService"
)
public
class
ApplicationCaseServiceImpl
extends
ServiceImpl
<
ApplicationCaseDao
,
ApplicationCaseEntity
>
implements
ApplicationCaseService
{
...
...
@@ -26,9 +28,43 @@ public class ApplicationCaseServiceImpl extends ServiceImpl<ApplicationCaseDao,
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
QueryWrapper
<
ApplicationCaseEntity
>
applicationCaseEntityQueryWrapper
=
new
QueryWrapper
<>();
if
(
null
!=
params
.
get
(
"levels"
)
&&
StringUtils
.
isNotBlank
(
params
.
get
(
"levels"
).
toString
()))
{
applicationCaseEntityQueryWrapper
.
eq
(
"levels"
,
params
.
get
(
"levels"
).
toString
());
}
else
{
applicationCaseEntityQueryWrapper
.
gt
(
"levels"
,
0
);
}
if
(
null
!=
params
.
get
(
"title"
)
&&
StringUtils
.
isNotBlank
(
params
.
get
(
"title"
).
toString
()))
{
applicationCaseEntityQueryWrapper
.
like
(
"title"
,
params
.
get
(
"title"
).
toString
());
}
if
(
null
!=
params
.
get
(
"author"
)
&&
StringUtils
.
isNotBlank
(
params
.
get
(
"author"
).
toString
()))
{
applicationCaseEntityQueryWrapper
.
eq
(
"author"
,
params
.
get
(
"author"
).
toString
());
}
if
(
null
!=
params
.
get
(
"status"
)
&&
StringUtils
.
isNotBlank
(
params
.
get
(
"status"
).
toString
()))
{
applicationCaseEntityQueryWrapper
.
eq
(
"status"
,
params
.
get
(
"status"
).
toString
());
}
applicationCaseEntityQueryWrapper
.
orderByAsc
(
"release_date"
);
IPage
<
ApplicationCaseEntity
>
page
=
this
.
page
(
new
Query
<
ApplicationCaseEntity
>().
getPage
(
params
),
applicationCaseEntityQueryWrapper
);
return
new
PageUtils
(
page
);
}
@Override
public
PageUtils
getList
(
Map
<
String
,
Object
>
params
)
{
QueryWrapper
<
ApplicationCaseEntity
>
applicationCaseEntityQueryWrapper
=
new
QueryWrapper
<>();
applicationCaseEntityQueryWrapper
.
gt
(
"status"
,
0
);
applicationCaseEntityQueryWrapper
.
orderByAsc
(
"levels"
);
applicationCaseEntityQueryWrapper
.
orderByDesc
(
"show_date"
);
IPage
<
ApplicationCaseEntity
>
page
=
this
.
page
(
new
Query
<
ApplicationCaseEntity
>().
getPage
(
params
),
new
QueryWrapper
<
ApplicationCaseEntity
>().
eq
(
"is_publish"
,
1
)
applicationCaseEntityQueryWrapper
);
return
new
PageUtils
(
page
);
...
...
@@ -37,12 +73,30 @@ public class ApplicationCaseServiceImpl extends ServiceImpl<ApplicationCaseDao,
@Override
public
void
updateApplicationCaseById
(
ApplicationCaseEntity
applicationCaseEntity
,
SysUserEntity
loginUser
)
{
baseMapper
.
updateById
(
applicationCaseEntity
);
UpdateWrapper
<
ApplicationCaseEntity
>
applicationCaseEntityUpdateWrapper
=
new
UpdateWrapper
<>();
applicationCaseEntityUpdateWrapper
.
eq
(
"id"
,
applicationCaseEntity
.
getId
());
applicationCaseEntity
.
setUpdateUser
(
loginUser
.
getUsername
());
applicationCaseEntity
.
setUpdateDate
(
DateUtils
.
format
(
new
Date
(),
DateUtils
.
DATE_TIME_PATTERN
));
baseMapper
.
update
(
applicationCaseEntity
,
applicationCaseEntityUpdateWrapper
);
}
@Override
public
void
checkApplicationCaseById
(
ApplicationCaseEntity
applicationCaseEntity
,
SysUserEntity
loginUser
)
{
UpdateWrapper
<
ApplicationCaseEntity
>
applicationCaseEntityUpdateWrapper
=
new
UpdateWrapper
<>();
applicationCaseEntityUpdateWrapper
.
eq
(
"id"
,
applicationCaseEntity
.
getId
());
applicationCaseEntity
.
setCheckUser
(
loginUser
.
getUsername
());
applicationCaseEntity
.
setCheckDate
(
DateUtils
.
format
(
new
Date
(),
DateUtils
.
DATE_TIME_PATTERN
));
baseMapper
.
update
(
applicationCaseEntity
,
applicationCaseEntityUpdateWrapper
);
}
@Override
public
void
saveApplicationCase
(
ApplicationCaseEntity
applicationCaseEntity
,
SysUserEntity
loginUser
)
{
applicationCaseEntity
.
setId
(
idWorkService
.
getSEQByKey
(
"id_seq"
));
applicationCaseEntity
.
setReleaseDate
(
DateUtils
.
format
(
new
Date
(),
DateUtils
.
DATE_TIME_PATTERN
));
//applicationCaseEntity.setAuthor(loginUser.getUsername());
applicationCaseEntity
.
setHits
(
0
);
//applicationCaseEntity.set
baseMapper
.
insert
(
applicationCaseEntity
);
}
...
...
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