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
f51da398
Commit
f51da398
authored
Aug 26, 2021
by
chenzhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://172.16.10.76/moa/amos-boot-biz
into developer
parents
ae480437
04ef1308
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
367 additions
and
235 deletions
+367
-235
FirefightersContractDto.java
...s/boot/module/common/api/dto/FirefightersContractDto.java
+8
-2
FirefightersContract.java
...s/boot/module/common/api/entity/FirefightersContract.java
+9
-0
IFirefightersContractService.java
...dule/common/api/service/IFirefightersContractService.java
+12
-0
IOrgUsrService.java
...n/amos/boot/module/common/api/service/IOrgUsrService.java
+19
-4
FirefightersContractController.java
...common/biz/controller/FirefightersContractController.java
+23
-8
FirefightersContractServiceImpl.java
...mon/biz/service/impl/FirefightersContractServiceImpl.java
+78
-0
FirefightersController.java
...oot/module/jcs/biz/controller/FirefightersController.java
+218
-221
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/dto/FirefightersContractDto.java
View file @
f51da398
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
dto
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
* 消防员合同
*
...
...
@@ -52,5 +55,8 @@ public class FirefightersContractDto extends BaseDto {
@ApiModelProperty
(
value
=
"操作人名称"
)
private
String
recUserName
;
@ApiModelProperty
(
value
=
"附件"
)
private
Map
<
String
,
List
<
AttachmentDto
>>
attachments
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/entity/FirefightersContract.java
View file @
f51da398
...
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
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.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -12,6 +14,8 @@ import lombok.experimental.Accessors;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* 消防员合同
*
...
...
@@ -66,4 +70,9 @@ public class FirefightersContract extends BaseEntity {
@ApiModelProperty
(
value
=
"更新时间"
)
@TableField
(
fill
=
FieldFill
.
UPDATE
)
private
Date
updateTime
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"附件"
)
private
Map
<
String
,
List
<
AttachmentDto
>>
attachments
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/service/IFirefightersContractService.java
View file @
f51da398
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
service
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersContractDto
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
/**
* 消防员合同 服务类
*
...
...
@@ -7,5 +10,14 @@ package com.yeejoin.amos.boot.module.common.api.service;
* @date 2021-06-07
*/
public
interface
IFirefightersContractService
{
/**
* 保存
* @param firefightersContract
* @return
*/
public
FirefightersContractDto
save
(
FirefightersContractDto
firefightersContract
);
public
FirefightersContractDto
updateById
(
FirefightersContractDto
firefightersContract
,
AgencyUserModel
userInfo
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/service/IOrgUsrService.java
View file @
f51da398
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
service
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.common.api.dto.*
;
import
com.yeejoin.amos.boot.module.common.api.dto.CheckObjectDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.CompanyDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.ESOrgUsrDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FormValue
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentFormDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgPersonFormDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.RequestData
;
import
com.yeejoin.amos.boot.module.common.api.dto.UserUnitDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance
;
import
com.yeejoin.amos.boot.module.common.api.entity.OrgUsr
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
/**
* 机构/部门/人员表 服务类
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/FirefightersContractController.java
View file @
f51da398
...
...
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
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.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
...
@@ -28,8 +29,11 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersContractDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersContract
;
import
com.yeejoin.amos.boot.module.common.api.service.IFirefightersContractService
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersContractServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -48,6 +52,12 @@ public class FirefightersContractController extends BaseController {
@Autowired
FirefightersContractServiceImpl
iFirefightersContractService
;
@Autowired
IFirefightersContractService
firefightersContractService
;
@Autowired
SourceFileServiceImpl
sourceFileService
;
@Autowired
RedisUtils
redisUtils
;
@Value
(
"${redis.cache.failure.time}"
)
...
...
@@ -59,9 +69,8 @@ public class FirefightersContractController extends BaseController {
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消防员合同"
,
notes
=
"新增消防员合同"
)
public
ResponseModel
<
FirefightersContract
>
saveFirefightersContract
(
HttpServletRequest
request
,
@RequestBody
FirefightersContract
firefightersContract
){
iFirefightersContractService
.
save
(
firefightersContract
);
return
ResponseHelper
.
buildResponse
(
firefightersContract
);
public
ResponseModel
<
FirefightersContractDto
>
saveFirefightersContract
(
HttpServletRequest
request
,
@RequestBody
FirefightersContractDto
firefightersContract
){
return
ResponseHelper
.
buildResponse
(
firefightersContractService
.
save
(
firefightersContract
));
}
/**
...
...
@@ -93,8 +102,8 @@ public class FirefightersContractController extends BaseController {
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改消防员合同"
,
notes
=
"修改消防员合同"
)
public
ResponseModel
<
FirefightersContract
>
updateByIdFirefightersContract
(
HttpServletRequest
request
,
@RequestBody
FirefightersContract
firefightersContract
){
iFirefightersContractService
.
updateById
(
firefightersContract
);
public
ResponseModel
<
FirefightersContract
Dto
>
updateByIdFirefightersContract
(
HttpServletRequest
request
,
@RequestBody
FirefightersContractDto
firefightersContract
){
firefightersContractService
.
updateById
(
firefightersContract
,
getUserInfo
()
);
//删除缓存
redisUtils
.
del
(
RedisKey
.
CONTRACT_ID
+
firefightersContract
.
getSequenceNbr
());
return
ResponseHelper
.
buildResponse
(
firefightersContract
);
...
...
@@ -116,9 +125,12 @@ public class FirefightersContractController extends BaseController {
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
FirefightersContract
firefightersContract
=
iFirefightersContractService
.
getById
(
id
);
redisUtils
.
set
(
RedisKey
.
CONTRACT_ID
+
id
,
JSON
.
toJSON
(
firefightersContract
),
time
);
return
ResponseHelper
.
buildResponse
(
firefightersContract
);
}
FirefightersContractDto
dto
=
new
FirefightersContractDto
();
Bean
.
copyExistPropertis
(
firefightersContract
,
dto
);
dto
.
setAttachments
(
sourceFileService
.
getAttachments
(
id
));
redisUtils
.
set
(
RedisKey
.
CONTRACT_ID
+
id
,
JSON
.
toJSON
(
dto
),
time
);
return
ResponseHelper
.
buildResponse
(
dto
);
}
}
...
...
@@ -173,6 +185,9 @@ public class FirefightersContractController extends BaseController {
pageBean
=
new
Page
<
FirefightersContract
>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iFirefightersContractService
.
page
(
pageBean
,
firefightersContractQueryWrapper
);
page
.
getRecords
().
forEach
(
i
->{
i
.
setAttachments
(
sourceFileService
.
getAttachments
(
i
.
getSequenceNbr
()));
});
return
ResponseHelper
.
buildResponse
(
page
);
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/FirefightersContractServiceImpl.java
View file @
f51da398
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersContractDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersContract
;
import
com.yeejoin.amos.boot.module.common.api.entity.SourceFile
;
import
com.yeejoin.amos.boot.module.common.api.mapper.FirefightersContractMapper
;
import
com.yeejoin.amos.boot.module.common.api.service.IFirefightersContractService
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
/**
* 消防员合同 服务实现类
...
...
@@ -17,4 +31,68 @@ import com.yeejoin.amos.boot.module.common.api.service.IFirefightersContractServ
@Service
public
class
FirefightersContractServiceImpl
extends
BaseService
<
FirefightersContractDto
,
FirefightersContract
,
FirefightersContractMapper
>
implements
IFirefightersContractService
{
@Autowired
SourceFileServiceImpl
sourceFileService
;
@Autowired
private
Sequence
sequence
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
FirefightersContractDto
save
(
FirefightersContractDto
firefightersContract
)
{
long
sequenceId
=
sequence
.
nextId
();
FirefightersContract
detail
=
new
FirefightersContract
();
Bean
.
copyExistPropertis
(
firefightersContract
,
detail
);
firefightersContract
.
setSequenceNbr
(
sequenceId
);
detail
.
setSequenceNbr
(
sequenceId
);
this
.
save
(
detail
);
saveAttachments
(
firefightersContract
);
return
firefightersContract
;
}
public
void
saveAttachments
(
FirefightersContractDto
firefightersContract
)
{
if
(!
ValidationUtil
.
isEmpty
(
firefightersContract
.
getAttachments
()))
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
firefightersContract
.
getAttachments
();
attachmentMap
.
entrySet
().
forEach
(
entry
->
{
List
<
AttachmentDto
>
atts
=
entry
.
getValue
();
sourceFiles
.
addAll
(
attachment2SourceFile
(
entry
.
getKey
(),
atts
));
});
sourceFileService
.
saveSourceFile
(
firefightersContract
.
getSequenceNbr
(),
sourceFiles
);
}
}
private
List
<
SourceFile
>
attachment2SourceFile
(
String
type
,
List
<
AttachmentDto
>
attachmentDtoList
)
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
attachmentDtoList
))
{
attachmentDtoList
.
forEach
(
a
->
{
SourceFile
s
=
new
SourceFile
();
s
.
setFilePath
(
a
.
getUrl
());
s
.
setFileName
(
a
.
getName
());
s
.
setFileCategory
(
type
);
sourceFiles
.
add
(
s
);
});
}
return
sourceFiles
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
FirefightersContractDto
updateById
(
FirefightersContractDto
firefightersContract
,
AgencyUserModel
userInfo
)
{
FirefightersContract
detail
=
new
FirefightersContract
();
Bean
.
copyExistPropertis
(
firefightersContract
,
detail
);
detail
.
setIsDelete
(
false
);
detail
.
setRecDate
(
new
Date
());
detail
.
setRecUserId
(
userInfo
.
getUserId
());
detail
.
setRecUserName
(
userInfo
.
getUserName
());
this
.
baseMapper
.
updateById
(
detail
);
Map
<
String
,
List
<
AttachmentDto
>>
map
=
firefightersContract
.
getAttachments
();
if
(
ObjectUtils
.
isNotEmpty
(
map
))
{
this
.
saveAttachments
(
firefightersContract
);
}
return
firefightersContract
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/FirefightersController.java
View file @
f51da398
...
...
@@ -21,6 +21,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -51,7 +52,6 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.FirefightersJacketServi
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* 消防队员
*
...
...
@@ -63,238 +63,235 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping
(
value
=
"/firefighters"
)
public
class
FirefightersController
extends
BaseController
{
@Autowired
FirefightersServiceImpl
iFirefightersService
;
@Autowired
FirefightersPostServiceImpl
iFirefightersPostService
;
@Autowired
FirefightersContactsServiceImpl
ifirefightersContactsService
;
@Autowired
FirefightersEducationServiceImpl
ifirefightersEducationService
;
@Autowired
FirefightersThoughtServiceImpl
iFirefightersThoughtService
;
@Autowired
FirefightersContractServiceImpl
iFirefightersContractService
;
@Autowired
FirefightersJacketServiceImpl
iFirefightersJacketService
;
@Autowired
RedisUtils
redisUtils
;
@Value
(
"${redis.cache.failure.time}"
)
private
long
time
;
/**
* 新增消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消防队员"
,
notes
=
"新增消防队员"
)
@Transactional
public
ResponseModel
<
FirefightersInfoDto
>
saveFirefighters
(
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
iFirefightersService
.
saveFirefighters
(
firefighters
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
@Autowired
FirefightersServiceImpl
iFirefightersService
;
@Autowired
FirefightersPostServiceImpl
iFirefightersPostService
;
@Autowired
FirefightersContactsServiceImpl
ifirefightersContactsService
;
@Autowired
FirefightersEducationServiceImpl
ifirefightersEducationService
;
@Autowired
FirefightersThoughtServiceImpl
iFirefightersThoughtService
;
@Autowired
FirefightersContractServiceImpl
iFirefightersContractService
;
@Autowired
FirefightersJacketServiceImpl
iFirefightersJacketService
;
@Autowired
RedisUtils
redisUtils
;
@Value
(
"${redis.cache.failure.time}"
)
private
long
time
;
}
/**
* 新增消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消防队员"
,
notes
=
"新增消防队员"
)
@Transactional
public
ResponseModel
<
FirefightersInfoDto
>
saveFirefighters
(
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
iFirefightersService
.
saveFirefighters
(
firefighters
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
/**
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
@Transactional
public
ResponseModel
<
Object
>
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
QueryWrapper
<
FirefightersJacket
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
queryWrapper
.
eq
(
"is_delete"
,
0
);
List
<
FirefightersJacket
>
firefightersJacket
=
iFirefightersJacketService
.
list
(
queryWrapper
);
if
(
firefightersJacket
!=
null
&&
firefightersJacket
.
size
()>
0
)
{
throw
new
RuntimeException
(
"该消防还有在装装备!"
);
}
try
{
iFirefightersService
.
update
(
new
UpdateWrapper
<
Firefighters
>().
eq
(
"sequence_nbr"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersPostService
.
update
(
new
UpdateWrapper
<
FirefightersPost
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersContactsService
.
update
(
new
UpdateWrapper
<
FirefightersContacts
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersEducationService
.
update
(
new
UpdateWrapper
<
FirefightersEducation
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersThoughtService
.
update
(
new
UpdateWrapper
<
FirefightersThought
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersContractService
.
update
(
new
UpdateWrapper
<
FirefightersContract
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersJacketService
.
update
(
new
UpdateWrapper
<
FirefightersJacket
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
//删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"删除失败!"
);
}
}
}
/**
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
@Transactional
public
ResponseModel
<
Object
>
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
QueryWrapper
<
FirefightersJacket
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
queryWrapper
.
eq
(
"is_delete"
,
0
);
List
<
FirefightersJacket
>
firefightersJacket
=
iFirefightersJacketService
.
list
(
queryWrapper
);
if
(
firefightersJacket
!=
null
&&
firefightersJacket
.
size
()
>
0
)
{
throw
new
RuntimeException
(
"该消防还有在装装备!"
);
}
try
{
iFirefightersService
.
update
(
new
UpdateWrapper
<
Firefighters
>().
eq
(
"sequence_nbr"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersPostService
.
update
(
new
UpdateWrapper
<
FirefightersPost
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersContactsService
.
update
(
new
UpdateWrapper
<
FirefightersContacts
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
ifirefightersEducationService
.
update
(
new
UpdateWrapper
<
FirefightersEducation
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersThoughtService
.
update
(
new
UpdateWrapper
<
FirefightersThought
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersContractService
.
update
(
new
UpdateWrapper
<
FirefightersContract
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
iFirefightersJacketService
.
update
(
new
UpdateWrapper
<
FirefightersJacket
>().
eq
(
"firefighters_id"
,
id
).
set
(
"is_delete"
,
1
));
// 删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"删除失败!"
);
}
}
/**
* 修改消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改消防队员"
,
notes
=
"修改消防队员"
)
@Transactional
public
ResponseModel
<
Object
>
updateByIdFirefighters
(
HttpServletRequest
request
,
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
Firefighters
firefighter
=
firefighters
.
getFirefighters
();
iFirefightersService
.
updateById
(
firefighter
);
ifirefightersContactsService
.
updateById
(
firefighters
.
getFirefightersContacts
());
//
删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
firefighter
.
getSequenceNbr
(),
RedisKey
.
FIREFIGHTERS_LIST_ID
+
firefighter
.
getSequenceNbr
());
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
/**
* 修改消防队员
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改消防队员"
,
notes
=
"修改消防队员"
)
@Transactional
public
ResponseModel
<
Object
>
updateByIdFirefighters
(
HttpServletRequest
request
,
@RequestBody
FirefightersInfoDto
firefighters
)
{
try
{
Firefighters
firefighter
=
firefighters
.
getFirefighters
();
iFirefightersService
.
updateById
(
firefighter
);
ifirefightersContactsService
.
updateById
(
firefighters
.
getFirefightersContacts
());
//
删除缓存
redisUtils
.
del
(
RedisKey
.
FIREFIGHTERS_ID
+
firefighter
.
getSequenceNbr
(),
RedisKey
.
FIREFIGHTERS_LIST_ID
+
firefighter
.
getSequenceNbr
());
return
ResponseHelper
.
buildResponse
(
null
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
}
throw
new
RuntimeException
(
"系统异常"
);
}
}
/**
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
/**
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Firefighters
firefighters
=
iFirefightersService
.
getById
(
id
);
QueryWrapper
<
FirefightersContacts
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
FirefightersContacts
firefightersContacts
=
ifirefightersContactsService
.
getOne
(
queryWrapper
);
FirefightersInfoDto
firefightersInfoDto
=
new
FirefightersInfoDto
(
firefighters
,
firefightersContacts
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
JSON
.
toJSON
(
firefightersInfoDto
),
time
);
return
ResponseHelper
.
buildResponse
(
firefightersInfoDto
);
}
}
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Firefighters
firefighters
=
iFirefightersService
.
getById
(
id
);
QueryWrapper
<
FirefightersContacts
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"firefighters_id"
,
id
);
FirefightersContacts
firefightersContacts
=
ifirefightersContactsService
.
getOne
(
queryWrapper
);
FirefightersInfoDto
firefightersInfoDto
=
new
FirefightersInfoDto
(
firefighters
,
firefightersContacts
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_ID
+
id
,
JSON
.
toJSON
(
firefightersInfoDto
),
time
);
return
ResponseHelper
.
buildResponse
(
firefightersInfoDto
);
}
}
/**
* 列表详情展示
*/
/**
* 列表详情展示
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表详情根据id查询"
,
notes
=
"列表详情根据id查询"
)
public
ResponseModel
<
Object
>
listToSelectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Map
<
String
,
Object
>
firefighters
=
iFirefightersService
.
listToSelectById
(
id
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
,
JSON
.
toJSON
(
firefighters
),
time
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表详情根据id查询"
,
notes
=
"列表详情根据id查询"
)
public
ResponseModel
<
Object
>
listToSelectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Map
<
String
,
Object
>
firefighters
=
iFirefightersService
.
listToSelectById
(
id
);
redisUtils
.
set
(
RedisKey
.
FIREFIGHTERS_LIST_ID
+
id
,
JSON
.
toJSON
(
firefighters
),
time
);
return
ResponseHelper
.
buildResponse
(
firefighters
);
}
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
Firefighters
>
listPage
(
String
pageNum
,
String
pageSize
,
Firefighters
firefighters
)
{
Page
<
Firefighters
>
pageBean
;
QueryWrapper
<
Firefighters
>
firefightersQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
Firefighters
>
aClass
=
firefighters
.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
try
{
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
firefighters
);
if
(
o
!=
null
)
{
Class
<?>
type
=
field
.
getType
();
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
if
(
type
.
equals
(
Integer
.
class
))
{
Integer
fileValue
=
(
Integer
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
Long
.
class
))
{
Long
fileValue
=
(
Long
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
String
.
class
))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
if
(!
name
.
equals
(
NameUtils
.
camel2Underline
(
"serialVersionUID"
)))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
});
IPage
<
Firefighters
>
page
;
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
}
else
{
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iFirefightersService
.
page
(
pageBean
,
firefightersQueryWrapper
);
return
page
;
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
Firefighters
>
listPage
(
String
pageNum
,
String
pageSize
,
Firefighters
firefighters
)
{
Page
<
Firefighters
>
pageBean
;
QueryWrapper
<
Firefighters
>
firefightersQueryWrapper
=
new
QueryWrapper
<>();
Class
<?
extends
Firefighters
>
aClass
=
firefighters
.
getClass
();
Arrays
.
stream
(
aClass
.
getDeclaredFields
()).
forEach
(
field
->
{
try
{
field
.
setAccessible
(
true
);
Object
o
=
field
.
get
(
firefighters
);
if
(
o
!=
null
)
{
Class
<?>
type
=
field
.
getType
();
String
name
=
NameUtils
.
camel2Underline
(
field
.
getName
());
if
(
type
.
equals
(
Integer
.
class
))
{
Integer
fileValue
=
(
Integer
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
Long
.
class
))
{
Long
fileValue
=
(
Long
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
if
(
type
.
equals
(
String
.
class
))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
else
{
if
(!
name
.
equals
(
NameUtils
.
camel2Underline
(
"serialVersionUID"
)))
{
String
fileValue
=
(
String
)
field
.
get
(
firefighters
);
firefightersQueryWrapper
.
eq
(
name
,
fileValue
);
}
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
}
});
IPage
<
Firefighters
>
page
;
if
(
StringUtils
.
isBlank
(
pageNum
)
||
StringUtils
.
isBlank
(
pageSize
))
{
pageBean
=
new
Page
<>(
0
,
Long
.
MAX_VALUE
);
}
else
{
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iFirefightersService
.
page
(
pageBean
,
firefightersQueryWrapper
);
return
page
;
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefighters"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"新列表分页查询"
,
notes
=
"新表分页查询"
)
public
ResponseModel
<
Page
<
FirefightersZhDto
>>
getFirefighters
(
Integer
pageNum
,
Integer
pageSize
,
FirefightersDto
firefighters
)
{
//条件分页
if
(
null
==
pageNum
||
null
==
pageSize
)
{
pageNum
=
1
;
pageSize
=
Integer
.
MAX_VALUE
;
}
List
<
FirefightersZhDto
>
list
=
iFirefightersService
.
getFirefighters
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Map
<
String
,
Long
>
num
=
iFirefightersService
.
getFirefightersCount
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Page
<
FirefightersZhDto
>
pageBean
=
new
Page
<>(
pageNum
,
pageSize
,
num
.
get
(
"num"
));
pageBean
.
setRecords
(
list
);
return
ResponseHelper
.
buildResponse
(
pageBean
);
}
/**
* 岗位树,带统计
*
* @param
* @return
* @throws Exception
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefightersJobTitleCount"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
getFirefightersJobTitleCount
()
throws
Exception
{
List
<
Menu
>
menus
=
iFirefightersService
.
getFirefightersJobTitleCount
();
return
ResponseHelper
.
buildResponse
(
menus
);
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefighters"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"新列表分页查询"
,
notes
=
"新表分页查询"
)
public
ResponseModel
<
Page
<
FirefightersZhDto
>>
getFirefighters
(
Integer
pageNum
,
Integer
pageSize
,
FirefightersDto
firefighters
)
{
// 条件分页
if
(
null
==
pageNum
||
null
==
pageSize
)
{
pageNum
=
1
;
pageSize
=
Integer
.
MAX_VALUE
;
}
List
<
FirefightersZhDto
>
list
=
iFirefightersService
.
getFirefighters
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Map
<
String
,
Long
>
num
=
iFirefightersService
.
getFirefightersCount
((
pageNum
-
1
)
*
pageSize
,
pageSize
,
firefighters
);
Page
<
FirefightersZhDto
>
pageBean
=
new
Page
<>(
pageNum
,
pageSize
,
num
.
get
(
"num"
));
pageBean
.
setRecords
(
list
);
return
ResponseHelper
.
buildResponse
(
pageBean
);
}
/**
* 岗位树,带统计
*
* @param
* @return
* @throws Exception
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/getFirefightersJobTitleCount"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
ResponseModel
<
Object
>
getFirefightersJobTitleCount
()
throws
Exception
{
List
<
Menu
>
menus
=
iFirefightersService
.
getFirefightersJobTitleCount
();
return
ResponseHelper
.
buildResponse
(
menus
);
}
}
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