Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
24403eed
Commit
24403eed
authored
Sep 14, 2021
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug 2849 已解决 附件保存到公共附件库
parent
9f417533
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
8 deletions
+33
-8
FirefightersThought.java
...os/boot/module/common/api/entity/FirefightersThought.java
+8
-0
FirefightersThoughtController.java
.../common/biz/controller/FirefightersThoughtController.java
+25
-8
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/entity/FirefightersThought.java
View file @
24403eed
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -12,6 +13,9 @@ import lombok.experimental.Accessors;
...
@@ -12,6 +13,9 @@ import lombok.experimental.Accessors;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 消防员思想谈话记录
* 消防员思想谈话记录
*
*
...
@@ -51,6 +55,10 @@ public class FirefightersThought extends BaseEntity {
...
@@ -51,6 +55,10 @@ public class FirefightersThought extends BaseEntity {
@ApiModelProperty
(
value
=
"附件"
)
@ApiModelProperty
(
value
=
"附件"
)
private
String
enclosure
;
private
String
enclosure
;
@ApiModelProperty
(
value
=
"附件"
)
@TableField
(
exist
=
false
)
private
Map
<
String
,
List
<
AttachmentDto
>>
attachments
;
@ApiModelProperty
(
value
=
"更新时间"
)
@ApiModelProperty
(
value
=
"更新时间"
)
@TableField
(
fill
=
FieldFill
.
UPDATE
)
@TableField
(
fill
=
FieldFill
.
UPDATE
)
private
Date
updateTime
;
private
Date
updateTime
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/FirefightersThoughtController.java
View file @
24403eed
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
controller
;
import
java.util.Arrays
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
com.yeejoin.amos.boot.module.common.api.entity.SourceFile
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
@@ -52,6 +53,8 @@ public class FirefightersThoughtController extends BaseController {
...
@@ -52,6 +53,8 @@ public class FirefightersThoughtController extends BaseController {
FirefightersThoughtServiceImpl
iFirefightersThoughtService
;
FirefightersThoughtServiceImpl
iFirefightersThoughtService
;
@Autowired
@Autowired
RedisUtils
redisUtils
;
RedisUtils
redisUtils
;
@Autowired
SourceFileServiceImpl
sourceFileService
;
@Value
(
"${redis.cache.failure.time}"
)
@Value
(
"${redis.cache.failure.time}"
)
private
long
time
;
private
long
time
;
/**
/**
...
@@ -63,10 +66,13 @@ public class FirefightersThoughtController extends BaseController {
...
@@ -63,10 +66,13 @@ public class FirefightersThoughtController extends BaseController {
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消防员思想谈话记录"
,
notes
=
"新增消防员思想谈话记录"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消防员思想谈话记录"
,
notes
=
"新增消防员思想谈话记录"
)
public
ResponseModel
<
FirefightersThought
>
saveFirefightersThought
(
HttpServletRequest
request
,
@RequestBody
FirefightersThought
firefightersThought
){
public
ResponseModel
<
FirefightersThought
>
saveFirefightersThought
(
HttpServletRequest
request
,
@RequestBody
FirefightersThought
firefightersThought
){
iFirefightersThoughtService
.
save
(
firefightersThought
);
iFirefightersThoughtService
.
save
(
firefightersThought
);
if
(!
firefightersThought
.
getAttachments
().
isEmpty
()){
sourceFileService
.
saveAttachments
(
firefightersThought
.
getSequenceNbr
(),
firefightersThought
.
getAttachments
());
}
return
ResponseHelper
.
buildResponse
(
firefightersThought
);
return
ResponseHelper
.
buildResponse
(
firefightersThought
);
}
}
/**
/**
* 根据id删除
* 根据id删除
* @param id
* @param id
...
@@ -97,7 +103,12 @@ public class FirefightersThoughtController extends BaseController {
...
@@ -97,7 +103,12 @@ public class FirefightersThoughtController extends BaseController {
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改消防员思想谈话记录"
,
notes
=
"修改消防员思想谈话记录"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改消防员思想谈话记录"
,
notes
=
"修改消防员思想谈话记录"
)
public
ResponseModel
<
FirefightersThought
>
updateByIdFirefightersThought
(
HttpServletRequest
request
,
@RequestBody
FirefightersThought
firefightersThought
){
public
ResponseModel
<
FirefightersThought
>
updateByIdFirefightersThought
(
HttpServletRequest
request
,
@RequestBody
FirefightersThought
firefightersThought
){
if
(!
firefightersThought
.
getAttachments
().
isEmpty
()){
sourceFileService
.
saveAttachments
(
firefightersThought
.
getSequenceNbr
(),
firefightersThought
.
getAttachments
());
}
iFirefightersThoughtService
.
updateById
(
firefightersThought
);
iFirefightersThoughtService
.
updateById
(
firefightersThought
);
//删除缓存
//删除缓存
redisUtils
.
del
(
RedisKey
.
THOUGHT_ID
+
firefightersThought
.
getSequenceNbr
());
redisUtils
.
del
(
RedisKey
.
THOUGHT_ID
+
firefightersThought
.
getSequenceNbr
());
return
ResponseHelper
.
buildResponse
(
firefightersThought
);
return
ResponseHelper
.
buildResponse
(
firefightersThought
);
...
@@ -116,15 +127,21 @@ public class FirefightersThoughtController extends BaseController {
...
@@ -116,15 +127,21 @@ public class FirefightersThoughtController extends BaseController {
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据消防员id查询"
,
notes
=
"根据消防员id查询"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据消防员id查询"
,
notes
=
"根据消防员id查询"
)
public
ResponseModel
<
Object
>
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
public
ResponseModel
<
Object
>
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
if
(
redisUtils
.
hasKey
(
RedisKey
.
THOUGHT_ID
+
id
)){
if
(
redisUtils
.
hasKey
(
RedisKey
.
THOUGHT_ID
+
id
)){
Object
obj
=
redisUtils
.
get
(
RedisKey
.
THOUGHT_ID
+
id
);
Object
obj
=
redisUtils
.
get
(
RedisKey
.
THOUGHT_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
Map
<
String
,
Object
>
mainMap
=
Bean
.
BeantoMap
(
obj
);
}
else
{
mainMap
.
put
(
"attachments"
,
sourceFileService
.
getAttachments
(
id
));
FirefightersThought
firefightersThought
=
iFirefightersThoughtService
.
getById
(
id
);
return
ResponseHelper
.
buildResponse
(
mainMap
);
}
else
{
FirefightersThought
firefightersThought
=
iFirefightersThoughtService
.
getById
(
id
);
redisUtils
.
set
(
RedisKey
.
THOUGHT_ID
+
id
,
JSON
.
toJSON
(
firefightersThought
),
time
);
redisUtils
.
set
(
RedisKey
.
THOUGHT_ID
+
id
,
JSON
.
toJSON
(
firefightersThought
),
time
);
return
ResponseHelper
.
buildResponse
(
firefightersThought
);
Map
<
String
,
Object
>
mainMap
=
Bean
.
BeantoMap
(
firefightersThought
);
mainMap
.
put
(
"attachments"
,
sourceFileService
.
getAttachments
(
id
));
return
ResponseHelper
.
buildResponse
(
mainMap
);
}
}
}
}
...
...
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