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
4436a648
Commit
4436a648
authored
Jul 16, 2021
by
付培阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
联动单位基本信息接口
parent
e9ace829
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
338 additions
and
139 deletions
+338
-139
DateUtils.java
...ava/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
+20
-1
LinkageUnitDto.java
...ejoin/amos/boot/module/common/api/dto/LinkageUnitDto.java
+19
-3
LinkageUnitMapper.java
...amos/boot/module/common/api/mapper/LinkageUnitMapper.java
+23
-6
LinkageUnitMapper.xml
...ommon-api/src/main/resources/mapper/LinkageUnitMapper.xml
+24
-1
DataDictionaryController.java
...odule/common/biz/controller/DataDictionaryController.java
+100
-79
LinkageUnitController.java
...t/module/common/biz/controller/LinkageUnitController.java
+65
-45
LinkageUnitServiceImpl.java
...odule/common/biz/service/impl/LinkageUnitServiceImpl.java
+87
-4
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
View file @
4436a648
...
...
@@ -635,7 +635,7 @@ public class DateUtils {
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
//年份
int
day
=
calendar
.
getActualMaximum
(
Calendar
.
DATE
);
for
(
int
i
=
1
;
i
<=
day
;
i
++)
{
String
source
=
year
+
"-"
+
month
+
"-"
+
i
;
String
source
=
year
+
"-"
+
month
+
"-"
+
i
;
list
.
add
(
shortSdf
.
parse
(
source
));
}
}
catch
(
ParseException
e
)
{
...
...
@@ -644,4 +644,23 @@ public class DateUtils {
return
list
;
}
/**
* 判断一个时间是否在一个时间段内
*
* @param nowTime 当前时间
* @param beginTime 开始时间
* @param endTime 结束时间
*/
public
static
boolean
belongCalendar
(
Date
nowTime
,
Date
beginTime
,
Date
endTime
)
{
Calendar
date
=
Calendar
.
getInstance
();
date
.
setTime
(
nowTime
);
Calendar
begin
=
Calendar
.
getInstance
();
begin
.
setTime
(
beginTime
);
Calendar
end
=
Calendar
.
getInstance
();
end
.
setTime
(
endTime
);
return
date
.
after
(
begin
)
&&
date
.
before
(
end
);
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/LinkageUnitDto.java
View file @
4436a648
...
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
...
...
@@ -15,10 +16,10 @@ import java.util.Date;
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"LinkageUnitDto"
,
description
=
"联动单位"
)
public
class
LinkageUnitDto
extends
BaseDto
{
@ApiModel
(
value
=
"LinkageUnitDto"
,
description
=
"联动单位"
)
public
class
LinkageUnitDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"单位名称"
)
...
...
@@ -78,4 +79,19 @@ public class LinkageUnitDto extends BaseDto {
@ApiModelProperty
(
value
=
"操作人名称"
)
private
String
recUserName
;
@ApiModelProperty
(
value
=
"是否在协议期 "
)
private
String
inAgreement
;
@ApiModelProperty
(
value
=
"消防救援能力"
)
private
String
fireRescueCapability
;
@ApiModelProperty
(
value
=
"职责_简要情况"
)
private
String
responsibilitiesSituation
;
@ApiModelProperty
(
value
=
"应急服务内容"
)
private
String
emergencyServiceContent
;
@ApiModelProperty
(
value
=
"单位_简要情况"
)
private
String
unitSituation
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/mapper/LinkageUnitMapper.java
View file @
4436a648
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.LinkageUnit
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Map
;
/**
* 联动单位 Mapper 接口
*
* @author system_generator
* @date 2021-07-16
*/
* 联动单位 Mapper 接口
*
* @author system_generator
* @date 2021-07-16
*/
public
interface
LinkageUnitMapper
extends
BaseMapper
<
LinkageUnit
>
{
/**
* 列转行查询单个
*
* @param fieldCodes 列
* @param groupCode 分组code
* @param sequenceNbr 主键
* @return List<Map>
*/
LinkageUnitDto
selectOne
(
@Param
(
"isDelete"
)
Boolean
isDelete
,
@Param
(
"fieldCodes"
)
Map
<
String
,
Object
>
fieldCodes
,
@Param
(
"groupCode"
)
String
groupCode
,
@Param
(
"sequenceNbr"
)
Long
sequenceNbr
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/LinkageUnitMapper.xml
View file @
4436a648
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.common.api.mapper.LinkageUnitMapper"
>
<select
id=
"selectOne"
resultType=
"com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto"
>
select
d.*,
lu.*
from
(
select
i.INSTANCE_ID instanceId,
i.GROUP_CODE groupCode,
<foreach
collection=
"fieldCodes"
item=
"value"
index=
"key"
separator=
","
>
MAX(CASE WHEN i.FIELD_CODE = #{key} THEN i.FIELD_VALUE END) as ${key}
</foreach>
from
cb_dynamic_form_instance i
where i.GROUP_CODE = #{groupCode}
and is_delete = #{isDelete}
GROUP by
i.INSTANCE_ID ) d,
cb_linkage_unit lu
where
d.instanceId = lu.instance_id
and lu.sequence_nbr = #{sequenceNbr}
and is_delete = #{isDelete}
</select>
</mapper>
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/DataDictionaryController.java
View file @
4436a648
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
controller
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.*
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -40,11 +37,11 @@ import io.swagger.annotations.ApiOperation;
/**
* 数据字典
*
* @author tb
* @date 2021-06-07
*/
* 数据字典
*
* @author tb
* @date 2021-06-07
*/
@RestController
@Api
(
tags
=
"数据字典Api"
)
@RequestMapping
(
value
=
"/data-dictionary"
)
...
...
@@ -57,67 +54,69 @@ public class DataDictionaryController extends BaseController {
@Value
(
"${redis.cache.failure.time}"
)
private
long
time
;
/**
* 新增数据字典
* @return
*/
* 新增数据字典
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增数据字典"
,
notes
=
"新增数据字典"
)
public
boolean
saveDataDictionary
(
HttpServletRequest
request
,
@RequestBody
DataDictionary
dataDictionary
){
public
boolean
saveDataDictionary
(
HttpServletRequest
request
,
@RequestBody
DataDictionary
dataDictionary
)
{
return
iDataDictionaryService
.
save
(
dataDictionary
);
}
/**
* 根据id删除
* @param id
* @return
*/
* 根据id删除
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据id删除"
,
notes
=
"根据id删除"
)
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
public
boolean
deleteById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
return
iDataDictionaryService
.
removeById
(
id
);
}
/**
* 修改数据字典
* @return
*/
* 修改数据字典
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改数据字典"
,
notes
=
"修改数据字典"
)
public
boolean
updateByIdDataDictionary
(
HttpServletRequest
request
,
@RequestBody
DataDictionary
dataDictionary
){
public
boolean
updateByIdDataDictionary
(
HttpServletRequest
request
,
@RequestBody
DataDictionary
dataDictionary
)
{
return
iDataDictionaryService
.
updateById
(
dataDictionary
);
}
/**
* 根据id查询
* @param id
* @return
*/
* 根据id查询
*
* @param id
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据id查询"
,
notes
=
"根据id查询"
)
public
DataDictionary
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
){
public
DataDictionary
selectById
(
HttpServletRequest
request
,
@PathVariable
Long
id
)
{
return
iDataDictionaryService
.
getById
(
id
);
}
/**
* 列表分页查询
* @return
*/
* 列表分页查询
*
* @return
*/
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表分页查询"
,
notes
=
"列表分页查询"
)
public
IPage
<
DataDictionary
>
listPage
(
String
pageNum
,
String
pageSize
,
DataDictionary
dataDictionary
)
{
public
IPage
<
DataDictionary
>
listPage
(
String
pageNum
,
String
pageSize
,
DataDictionary
dataDictionary
)
{
Page
<
DataDictionary
>
pageBean
;
QueryWrapper
<
DataDictionary
>
dataDictionaryQueryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -144,7 +143,7 @@ public class DataDictionaryController extends BaseController {
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"系统异常"
);
throw
new
RuntimeException
(
"系统异常"
);
}
});
IPage
<
DataDictionary
>
page
;
...
...
@@ -154,25 +153,26 @@ public class DataDictionaryController extends BaseController {
pageBean
=
new
Page
<>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iDataDictionaryService
.
page
(
pageBean
,
dataDictionaryQueryWrapper
);
return
page
;
}
return
page
;
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/gwmcDataDictionary/{type}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据字典类型查询字典"
,
notes
=
"根据字典类型查询字典"
)
public
ResponseModel
<
Object
>
gwmcDataDictionary
(
@PathVariable
String
type
)
throws
Exception
{
public
ResponseModel
<
Object
>
gwmcDataDictionary
(
@PathVariable
String
type
)
throws
Exception
{
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
type
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
null
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
,
JSON
.
toJSON
(
menus
),
time
);
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
null
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
,
JSON
.
toJSON
(
menus
),
time
);
return
ResponseHelper
.
buildResponse
(
menus
);
}
}
...
...
@@ -191,67 +191,88 @@ public class DataDictionaryController extends BaseController {
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
null
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
null
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
,
JSON
.
toJSON
(
menus
),
time
);
return
ResponseHelper
.
buildResponse
(
menus
);
}
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/gwmcDataDictionary/FireChemical/{type}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据字典类型查询危险品字典"
,
notes
=
"根据字典类型查询危险品字典"
)
public
ResponseModel
<
Object
>
gwmcDataDictionaryFireChemical
(
@PathVariable
String
type
)
throws
Exception
{
public
ResponseModel
<
Object
>
gwmcDataDictionaryFireChemical
(
@PathVariable
String
type
)
throws
Exception
{
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
type
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
MenuFrom
>
menus
=
TreeParser
.
getTreexin
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
MenuFrom
>
menus
=
TreeParser
.
getTreexin
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
null
);
MenuFrom
Me
=
new
MenuFrom
(
"-1"
,
"-1"
,
"-1"
,
"危化品库"
,
"危化品库"
,
"危化品库"
,
"-1"
,
null
);
MenuFrom
Me
=
new
MenuFrom
(
"-1"
,
"-1"
,
"-1"
,
"危化品库"
,
"危化品库"
,
"危化品库"
,
"-1"
,
null
);
Me
.
setIsLeaf
(
false
);
Me
.
setChildren
(
menus
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
,
JSON
.
toJSON
(
Me
),
time
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
,
JSON
.
toJSON
(
Me
),
time
);
return
ResponseHelper
.
buildResponse
(
Me
);
}
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/form/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据表态类型多个code查询表单数据项"
,
notes
=
"根据表态类型多个code查询表单数据项"
)
public
ResponseModel
<
Object
>
selectFormdListItem
(
HttpServletRequest
request
,
String
types
)
{
public
ResponseModel
<
Object
>
selectFormdListItem
(
HttpServletRequest
request
,
String
types
)
{
HashMap
<
Object
,
Object
>
objectObjectHashMap
=
new
HashMap
<>();
try
{
String
[]
typest
=
types
.
split
(
","
);
for
(
String
type
:
typest
)
{
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
type
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATA_DICTIONARY_CODE_XIN
+
type
)){
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATA_DICTIONARY_CODE_XIN
+
type
);
objectObjectHashMap
.
put
(
type
,
obj
);
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
MenuFrom
>
menus
=
null
;
menus
=
TreeParser
.
getTreexin
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
null
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE_XIN
+
type
,
JSON
.
toJSON
(
menus
),
time
);
objectObjectHashMap
.
put
(
type
,
menus
);
String
[]
typest
=
types
.
split
(
","
);
for
(
String
type
:
typest
)
{
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
type
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATA_DICTIONARY_CODE_XIN
+
type
))
{
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATA_DICTIONARY_CODE_XIN
+
type
);
objectObjectHashMap
.
put
(
type
,
obj
);
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
MenuFrom
>
menus
=
null
;
menus
=
TreeParser
.
getTreexin
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
null
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE_XIN
+
type
,
JSON
.
toJSON
(
menus
),
time
);
objectObjectHashMap
.
put
(
type
,
menus
);
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
RuntimeException
(
"系统异常!"
);
}
return
ResponseHelper
.
buildResponse
(
objectObjectHashMap
);
}
}
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/dataDictionaryTree"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据字典类型查询字典树"
,
notes
=
"根据字典类型查询字典树"
)
public
ResponseModel
<
Object
>
getDictionaryTree
(
@RequestParam
String
type
,
@RequestParam
String
rootName
)
throws
Exception
{
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
type
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
null
);
// 创建根节点
Menu
menu
=
new
Menu
(-
1L
,
rootName
,
-
1L
,
menus
,
0
);
List
<
Menu
>
menuList
=
new
ArrayList
<>();
// 挂在主节点
menuList
.
add
(
menu
);
return
ResponseHelper
.
buildResponse
(
menuList
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/LinkageUnitController.java
View file @
4436a648
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
controller
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.LinkageUnitServiceImpl
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto
;
...
...
@@ -37,28 +46,29 @@ public class LinkageUnitController extends BaseController {
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增联动单位"
,
notes
=
"新增联动单位"
)
public
ResponseModel
<
LinkageUnitDto
>
save
(
@RequestBody
LinkageUnitDto
model
)
{
model
=
linkageUnitServiceImpl
.
createWith
Model
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增联动单位"
,
notes
=
"新增联动单位"
)
public
ResponseModel
<
LinkageUnitDto
>
save
(
@RequestBody
LinkageUnitDto
model
)
{
model
=
linkageUnitServiceImpl
.
save
Model
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
/**
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新联动单位"
,
notes
=
"根据sequenceNbr更新联动单位"
)
public
ResponseModel
<
LinkageUnitDto
>
updateBySequenceNbrLinkageUnit
(
@RequestBody
LinkageUnitDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
linkageUnitServiceImpl
.
updateWithModel
(
model
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新联动单位"
,
notes
=
"根据sequenceNbr更新联动单位"
)
public
ResponseModel
<
LinkageUnitDto
>
updateBySequenceNbrLinkageUnit
(
@RequestBody
LinkageUnitDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
linkageUnitServiceImpl
.
updateById
(
model
));
}
/**
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
...
...
@@ -67,50 +77,60 @@ public class LinkageUnitController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbr删除联动单位"
,
notes
=
"根据sequenceNbr删除联动单位"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
HttpServletRequest
request
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
linkageUnitServiceImpl
.
remov
eById
(
sequenceNbr
));
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
linkageUnitServiceImpl
.
delet
eById
(
sequenceNbr
));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr
主键
* @param sequenceNbr
主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个联动单位"
,
notes
=
"根据sequenceNbr查询单个联动单位"
)
public
ResponseModel
<
LinkageUnitDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
linkageUnitServiceImpl
.
queryBySeq
(
sequenceNbr
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个联动单位"
,
notes
=
"根据sequenceNbr查询单个联动单位"
)
public
ResponseModel
<
LinkageUnitDto
>
selectOne
(
@PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
linkageUnitServiceImpl
.
queryOne
(
sequenceNbr
));
}
/**
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"联动单位分页查询"
,
notes
=
"联动单位分页查询"
)
public
ResponseModel
<
Page
<
LinkageUnitDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
)
{
Page
<
LinkageUnitDto
>
page
=
new
Page
<
LinkageUnitDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
linkageUnitServiceImpl
.
queryForLinkageUnitPage
(
page
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"联动单位分页查询"
,
notes
=
"联动单位分页查询"
)
public
ResponseModel
<
Page
<
LinkageUnitDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
String
unitName
,
String
linkageUnitType
,
String
inAgreement
)
{
Page
<
LinkageUnitDto
>
page
=
new
Page
<
LinkageUnitDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
Page
<
LinkageUnitDto
>
linkageUnitDtoPage
=
linkageUnitServiceImpl
.
queryForLinkageUnitPage
(
page
,
false
,
unitName
,
linkageUnitType
);
Date
now
=
new
Date
();
List
<
LinkageUnitDto
>
linkageUnitDtoList
=
linkageUnitDtoPage
.
getRecords
().
stream
().
map
(
item
->
{
boolean
isInAgreement
=
DateUtils
.
belongCalendar
(
now
,
item
.
getAgreementStartDate
(),
item
.
getAgreementEndDate
());
item
.
setInAgreement
(
isInAgreement
?
"是"
:
"否"
);
return
item
;
}).
filter
(
item
->
StringUtils
.
isEmpty
(
inAgreement
)
||
inAgreement
.
equals
(
item
.
getInAgreement
())).
collect
(
Collectors
.
toList
());
linkageUnitDtoPage
.
setRecords
(
linkageUnitDtoList
);
return
ResponseHelper
.
buildResponse
(
linkageUnitDtoPage
);
}
/**
* 列表全部数据查询
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"联动单位列表全部数据查询"
,
notes
=
"联动单位列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
LinkageUnitDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
linkageUnitServiceImpl
.
queryForLinkageUnitList
(
));
}
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"联动单位列表全部数据查询"
,
notes
=
"联动单位列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
LinkageUnitDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
linkageUnitServiceImpl
.
queryForLinkageUnitList
(
false
));
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/LinkageUnitServiceImpl.java
View file @
4436a648
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance
;
import
com.yeejoin.amos.boot.module.common.api.entity.LinkageUnit
;
import
com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper
;
import
com.yeejoin.amos.boot.module.common.api.mapper.LinkageUnitMapper
;
import
com.yeejoin.amos.boot.module.common.api.service.ILinkageUnitService
;
import
com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.rdbms.annotation.Condition
;
import
org.typroject.tyboot.core.rdbms.annotation.Operator
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
* 联动单位服务实现类
...
...
@@ -17,17 +30,86 @@ import java.util.List;
*/
@Service
public
class
LinkageUnitServiceImpl
extends
BaseService
<
LinkageUnitDto
,
LinkageUnit
,
LinkageUnitMapper
>
implements
ILinkageUnitService
{
@Autowired
DynamicFormInstanceServiceImpl
dynamicFormInstanceService
;
@Resource
LinkageUnitMapper
linkageUnitMapper
;
@Autowired
DynamicFormColumnServiceImpl
dynamicFormColumnService
;
public
String
getGroupCode
()
{
return
"linkageUnit"
;
}
/**
* 分页查询
*/
public
Page
<
LinkageUnitDto
>
queryForLinkageUnitPage
(
Page
<
LinkageUnitDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
public
Page
<
LinkageUnitDto
>
queryForLinkageUnitPage
(
Page
<
LinkageUnitDto
>
page
,
@Condition
(
Operator
.
eq
)
Boolean
isDelete
,
@Condition
(
Operator
.
like
)
String
unitName
,
@Condition
(
Operator
.
eq
)
String
linkageUnitType
)
{
return
this
.
queryForPage
(
page
,
null
,
false
,
isDelete
,
unitName
,
linkageUnitType
);
}
/**
* 列表查询 示例
*/
public
List
<
LinkageUnitDto
>
queryForLinkageUnitList
()
{
return
this
.
queryForList
(
""
,
false
);
public
List
<
LinkageUnitDto
>
queryForLinkageUnitList
(
@Condition
(
Operator
.
eq
)
Boolean
isDelete
)
{
return
this
.
queryForList
(
""
,
false
,
isDelete
);
}
/**
* 保存联动单位
*
* @param linkageUnitDto 对象
* @return List<LinkageUnitDto>
*/
public
LinkageUnitDto
saveModel
(
LinkageUnitDto
linkageUnitDto
)
{
//1.保存行数据
String
groupCode
=
this
.
getGroupCode
();
Map
<
String
,
Object
>
map
=
Bean
.
BeantoMap
(
linkageUnitDto
);
Long
instanceId
=
dynamicFormInstanceService
.
commonSave
(
groupCode
,
map
);
linkageUnitDto
.
setInstanceId
(
instanceId
);
//2.保存值班信息
LinkageUnitDto
model
=
createWithModel
(
linkageUnitDto
);
//3.返回保存后的数据
return
model
;
}
public
LinkageUnitDto
queryOne
(
Long
sequenceNbr
)
{
boolean
isDelete
=
false
;
String
groupCode
=
getGroupCode
();
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
Map
<
String
,
Object
>
fieldCodes
=
Bean
.
listToMap
(
columns
,
"fieldCode"
,
"queryStrategy"
,
DynamicFormColumn
.
class
);
LinkageUnitDto
linkageUnitDto
=
linkageUnitMapper
.
selectOne
(
isDelete
,
fieldCodes
,
groupCode
,
sequenceNbr
);
return
linkageUnitDto
;
}
public
Boolean
deleteById
(
Long
sequenceNbr
)
{
LinkageUnit
linkageUnit
=
getById
(
sequenceNbr
);
linkageUnit
.
setIsDelete
(
true
);
updateById
(
linkageUnit
);
Long
instanceId
=
linkageUnit
.
getInstanceId
();
List
<
DynamicFormInstance
>
dynamicFormInstanceList
=
dynamicFormInstanceService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
instanceId
));
dynamicFormInstanceList
.
forEach
(
item
->
item
.
setIsDelete
(
true
));
boolean
update
=
dynamicFormInstanceService
.
updateBatchById
(
dynamicFormInstanceList
);
return
update
;
}
public
LinkageUnitDto
updateById
(
LinkageUnitDto
linkageUnitDto
)
{
updateWithModel
(
linkageUnitDto
);
Long
instanceId
=
linkageUnitDto
.
getInstanceId
();
List
<
DynamicFormInstance
>
dynamicFormInstanceList
=
dynamicFormInstanceService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
instanceId
));
Map
<
String
,
Object
>
objectMap
=
Bean
.
BeantoMap
(
linkageUnitDto
);
dynamicFormInstanceList
.
forEach
(
item
->
item
.
setFieldValue
(
objectMap
.
get
(
item
.
getFieldCode
())
!=
null
?
objectMap
.
get
(
item
.
getFieldCode
()).
toString
()
:
item
.
getFieldValue
()));
dynamicFormInstanceService
.
updateBatchById
(
dynamicFormInstanceList
);
return
linkageUnitDto
;
}
}
\ No newline at end of file
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