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
5d52e8dc
Commit
5d52e8dc
authored
Jul 13, 2021
by
付培阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
今日值班列表查询接口
parent
1f1b440f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
180 additions
and
29 deletions
+180
-29
application.properties
...boot-jcs-system/src/main/resources/application.properties
+1
-1
DynamicFormInstanceMapper.java
...t/module/common/api/mapper/DynamicFormInstanceMapper.java
+16
-0
DynamicFormInstanceMapper.xml
...i/src/main/resources/mapper/DynamicFormInstanceMapper.xml
+34
-5
DutyPersonController.java
...ot/module/common/biz/controller/DutyPersonController.java
+15
-2
IDutyCommonService.java
...os/boot/module/common/biz/service/IDutyCommonService.java
+11
-2
DutyCommonServiceImpl.java
...module/common/biz/service/impl/DutyCommonServiceImpl.java
+103
-19
No files found.
amos-boot-jcs-system/src/main/resources/application.properties
View file @
5d52e8dc
spring.application.name
=
JCS
spring.application.name
=
JCS
_FPY
server.servlet.context-path
=
/jcs
server.port
=
11100
spring.profiles.active
=
dev
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/mapper/DynamicFormInstanceMapper.java
View file @
5d52e8dc
...
...
@@ -70,4 +70,20 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
@Param
(
"appKey"
)
String
appKey
,
@Param
(
"groupCode"
)
String
groupCode
,
@Param
(
"params"
)
Map
<
String
,
String
>
params
);
/**
* 查询当前值班信息
* @param dutyDay 值班日期
* @param shiftIds 班次id
* @param fieldCodes 动态列
* @param appKey 应用标识
* @param groupCode 表单类型
* @return List<Map < String, Object>>
*/
List
<
Map
<
String
,
Object
>>
listOnDutyPerson
(
@Param
(
"dutyDate"
)
String
dutyDay
,
@Param
(
"shiftId"
)
String
shiftIds
,
@Param
(
"fieldCodes"
)
Map
<
String
,
Object
>
fieldCodes
,
@Param
(
"appKey"
)
String
appKey
,
@Param
(
"groupCode"
)
String
groupCode
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/DynamicFormInstanceMapper.xml
View file @
5d52e8dc
...
...
@@ -2,8 +2,7 @@
<!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.DynamicFormInstanceMapper"
>
<select
id=
"selectListByCalledId"
resultType=
"com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto"
>
SELECT
v.sequence_nbr sequenceNbr,
SELECT v.sequence_nbr sequenceNbr,
v.form_column_id formColumnId,
v.instance_id instanceId,
v.group_code groupCode,
...
...
@@ -17,10 +16,9 @@
v.is_delete isDelete,
v.block block,
f.field_type fieldType
FROM
cb_dynamic_form_instance v
FROM cb_dynamic_form_instance v
LEFT JOIN cb_dynamic_form_column f ON f.sequence_nbr = v.form_column_id
WHERE v.instance_id=
#{id}
WHERE v.instance_id =
#{id}
</select>
<select
id=
"listAll"
resultType=
"java.util.Map"
>
select
...
...
@@ -134,4 +132,35 @@
</if>
order by instanceId desc
</select>
<select
id=
"listOnDutyPerson"
resultType=
"java.util.Map"
>
select
d.*,
ps.shift_id as shiftId,
ps.duty_date as dutyDate,
ds.name as shiftName
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 i.APP_KEY = #{appKey}
GROUP by
i.INSTANCE_ID ) d,
cb_duty_person_shift ps,
cb_duty_shift ds
where
d.instanceId = ps.instance_id
and ps.shift_id = ds.sequence_nbr
and ps.duty_date = #{dutyDate}
<if
test=
"shiftId != null and shiftId != ''"
>
and ps.shift_id in (#{shiftId})
</if>
order by instanceId desc
</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/DutyPersonController.java
View file @
5d52e8dc
...
...
@@ -14,6 +14,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.text.ParseException
;
import
java.util.List
;
...
...
@@ -111,6 +112,7 @@ public class DutyPersonController extends BaseController {
/**
* 值班数据删除
*
* @param instanceId 实例id
* @return ResponseModel
*/
...
...
@@ -129,7 +131,8 @@ public class DutyPersonController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
"/exportExcel"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"人员执勤导出"
,
notes
=
"人员执勤导出"
)
public
ResponseModel
exportExcel
(
HttpServletResponse
response
,
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
String
beginDate
,
public
ResponseModel
exportExcel
(
HttpServletResponse
response
,
@ApiParam
(
value
=
"开始日期"
,
required
=
true
)
@RequestParam
String
beginDate
,
@ApiParam
(
value
=
"结束日期"
,
required
=
true
)
@RequestParam
String
endDate
)
throws
ParseException
{
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
downloadList
(
beginDate
,
endDate
));
}
...
...
@@ -137,9 +140,19 @@ public class DutyPersonController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
"查询指定日期值班人信息列表"
)
@GetMapping
(
"/person/{dutyDay}/list"
)
public
ResponseModel
listDutyPerson
(
@ApiParam
(
value
=
"值班日期"
,
required
=
true
)
@PathVariable
String
dutyDay
,
public
ResponseModel
listDutyPerson
(
@ApiParam
(
value
=
"值班日期"
,
required
=
true
)
@PathVariable
String
dutyDay
,
@ApiParam
(
value
=
"班次id"
)
@RequestParam
(
required
=
false
)
Long
shiftId
,
@ApiParam
(
value
=
"岗位"
)
@RequestParam
(
required
=
false
)
String
postType
)
{
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
dayDutyPersonList
(
dutyDay
,
shiftId
,
postType
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
"查询当前值班人信息列表"
)
@GetMapping
(
"/person/on_duty/list"
)
public
ResponseModel
listOnDutyPerson
(
HttpServletRequest
request
)
{
String
appKey
=
request
.
getHeader
(
"appKey"
);
return
ResponseHelper
.
buildResponse
(
iDutyPersonService
.
listOnDutyPerson
(
appKey
));
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/IDutyCommonService.java
View file @
5d52e8dc
...
...
@@ -57,6 +57,7 @@ public interface IDutyCommonService {
/**
* 删除值班数据
*
* @param instanceId 实例id
* @return Boolean
*/
...
...
@@ -64,10 +65,18 @@ public interface IDutyCommonService {
/**
* 查询指定条件的值班人信息
*
* @param dutyDay 查询条件
* @param shiftId 班次
* @param postType 岗位
* @return List<Map<String, Object>>
* @return List<Map < String, Object>>
*/
List
<
Map
<
String
,
Object
>>
dayDutyPersonList
(
String
dutyDay
,
Long
shiftId
,
String
postType
);
/**
* 查询当前值班人信息
*
* @return List<Map < String, Object>>
*/
List
<
Map
<
String
,
Object
>>
dayDutyPersonList
(
String
dutyDay
,
Long
shiftId
,
String
postType
);
List
<
Map
<
String
,
Object
>>
listOnDutyPerson
(
String
appKey
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DutyCommonServiceImpl.java
View file @
5d52e8dc
...
...
@@ -9,12 +9,15 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift
;
import
com.yeejoin.amos.boot.module.common.api.entity.DutyShift
;
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.enums.DutyViewTypeEnum
;
import
com.yeejoin.amos.boot.module.common.biz.service.IDutyCommonService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.joda.time.DateTime
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -53,6 +56,9 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
@Autowired
DutyShiftServiceImpl
dutyShiftService
;
@Autowired
OrgUsrServiceImpl
orgUsrService
;
/**
* 每天单个班次执勤人数全部小于等于3人
*/
...
...
@@ -68,7 +74,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
public
IPage
<
Map
<
String
,
Object
>>
pageList
(
int
current
,
int
size
,
String
beginDate
,
String
endDate
)
throws
ParseException
{
//1.已column为准 进行返回
String
groupCode
=
this
.
getGroupCode
();
IPage
<
Map
<
String
,
Object
>>
iPage
=
dynamicFormInstanceService
.
pageList
(
current
,
size
,
groupCode
);
IPage
<
Map
<
String
,
Object
>>
iPage
=
dynamicFormInstanceService
.
pageList
(
current
,
size
,
groupCode
);
for
(
Map
<
String
,
Object
>
m
:
iPage
.
getRecords
())
{
this
.
fillDutyShiftData
(
beginDate
,
endDate
,
m
);
}
...
...
@@ -77,8 +83,10 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
private
void
fillDutyShiftData
(
String
beginDate
,
String
endDate
,
Map
<
String
,
Object
>
m
)
throws
ParseException
{
String
instanceId
=
m
.
get
(
"instanceId"
).
toString
();
List
<
DutyShift
>
dutyShifts
=
dutyShiftService
.
list
(
new
LambdaQueryWrapper
<
DutyShift
>().
eq
(
BaseEntity:
:
getIsDelete
,
false
).
eq
(
DutyShift:
:
getAppKey
,
RequestContext
.
getAppKey
()));
Map
<
Long
,
DutyShift
>
keyNameMap
=
dutyShifts
.
stream
().
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getSequenceNbr
,
Function
.
identity
()));
List
<
DutyShift
>
dutyShifts
=
dutyShiftService
.
list
(
new
LambdaQueryWrapper
<
DutyShift
>().
eq
(
BaseEntity:
:
getIsDelete
,
false
).
eq
(
DutyShift:
:
getAppKey
,
RequestContext
.
getAppKey
()));
Map
<
Long
,
DutyShift
>
keyNameMap
=
dutyShifts
.
stream
().
collect
(
Collectors
.
toMap
(
BaseEntity:
:
getSequenceNbr
,
Function
.
identity
()));
List
<
DutyPersonShiftDto
>
personShiftList
=
dutyPersonShiftService
.
list
(
new
LambdaQueryWrapper
<
DutyPersonShift
>()
.
eq
(
DutyPersonShift:
:
getInstanceId
,
instanceId
)
.
ge
(
beginDate
!=
null
,
DutyPersonShift:
:
getDutyDate
,
beginDate
)
...
...
@@ -123,7 +131,8 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
private
DutyViewTypeEnum
inferView
(
String
beginDate
,
String
endDate
,
String
appKey
)
{
Map
<
String
,
Long
>
result
=
dutyPersonShiftService
.
getBaseMapper
().
calMaxPersonAndShiftNum
(
beginDate
,
endDate
,
appKey
,
this
.
getGroupCode
());
Map
<
String
,
Long
>
result
=
dutyPersonShiftService
.
getBaseMapper
().
calMaxPersonAndShiftNum
(
beginDate
,
endDate
,
appKey
,
this
.
getGroupCode
());
//计算班次最大执勤人数,时间区间内
Long
maxDutyPersonNumDay
=
result
.
get
(
"maxDutyPersonNumDay"
);
//计算天的最大班次数量,时间区间内
...
...
@@ -175,20 +184,24 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
dataList
.
forEach
(
d
->
{
//TODO: 业务唯一索引,用户id
String
userId
=
d
.
get
(
"userId"
).
toString
();
List
<
DynamicFormInstance
>
instances
=
dynamicFormInstanceService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>()
List
<
DynamicFormInstance
>
instances
=
dynamicFormInstanceService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>()
.
eq
(
DynamicFormInstance:
:
getFieldCode
,
"userId"
)
.
eq
(
DynamicFormInstance:
:
getFieldValue
,
userId
)
.
eq
(
DynamicFormInstance:
:
getGroupCode
,
this
.
getGroupCode
()));
Long
instanceId
=
null
;
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
this
.
getGroupCode
()));
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
this
.
getGroupCode
()));
//1.组装动态表单数据
if
(!
instances
.
isEmpty
())
{
//0.定位instanceId,准备进行更新操作
instanceId
=
instances
.
get
(
0
).
getInstanceId
();
//1.查询已有数据
List
<
DynamicFormInstance
>
instancesInDb
=
dynamicFormInstanceService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
instanceId
));
List
<
DynamicFormInstance
>
instancesInDb
=
dynamicFormInstanceService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
instanceId
));
//2.list 转 map
Map
<
Object
,
DynamicFormInstance
>
instanceMap
=
Bean
.
listToMap
(
instancesInDb
,
"fieldCode"
,
DynamicFormInstance
.
class
);
Map
<
Object
,
DynamicFormInstance
>
instanceMap
=
Bean
.
listToMap
(
instancesInDb
,
"fieldCode"
,
DynamicFormInstance
.
class
);
//3.待更新数据组装,待批量入库
this
.
updateFormValue
(
formInstanceList
,
d
,
instanceId
,
columns
,
instanceMap
);
}
else
{
...
...
@@ -208,10 +221,14 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
List
<
DutyPersonShiftDto
>
shiftDtos
=
(
List
<
DutyPersonShiftDto
>)
d
.
get
(
"dutyShift"
);
Long
finalInstanceId
=
instanceId
;
//按照业务唯一索引查询主键
List
<
DutyPersonShift
>
dutyPersonShiftsDb
=
dutyPersonShiftService
.
list
(
new
LambdaQueryWrapper
<
DutyPersonShift
>().
eq
(
DutyPersonShift:
:
getInstanceId
,
instanceId
));
Map
<
Date
,
Long
>
dutyPersonShiftMap
=
dutyPersonShiftsDb
.
stream
().
collect
(
Collectors
.
toMap
(
DutyPersonShift:
:
getDutyDate
,
DutyPersonShift:
:
getSequenceNbr
));
List
<
DutyPersonShift
>
dutyPersonShiftsDb
=
dutyPersonShiftService
.
list
(
new
LambdaQueryWrapper
<
DutyPersonShift
>().
eq
(
DutyPersonShift:
:
getInstanceId
,
instanceId
));
Map
<
Date
,
Long
>
dutyPersonShiftMap
=
dutyPersonShiftsDb
.
stream
().
collect
(
Collectors
.
toMap
(
DutyPersonShift:
:
getDutyDate
,
DutyPersonShift:
:
getSequenceNbr
));
//todo: 只更新当天及值班之后数据
Set
<
DutyPersonShift
>
needToDb
=
shiftDtos
.
stream
().
filter
(
s
->
DateUtils
.
dateCompare
(
s
.
getDutyDate
(),
new
Date
())
>=
0
).
map
(
shiftDto
->
{
Set
<
DutyPersonShift
>
needToDb
=
shiftDtos
.
stream
().
filter
(
s
->
DateUtils
.
dateCompare
(
s
.
getDutyDate
(),
new
Date
())
>=
0
).
map
(
shiftDto
->
{
DutyPersonShift
dutyPersonShift
=
new
DutyPersonShift
();
Bean
.
copyExistPropertis
(
shiftDto
,
dutyPersonShift
);
dutyPersonShift
.
setInstanceId
(
finalInstanceId
);
...
...
@@ -229,12 +246,14 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
}
public
void
updateFormValue
(
List
<
DynamicFormInstance
>
formInstanceList
,
Map
<
String
,
Object
>
d
,
Long
instanceId
,
List
<
DynamicFormColumn
>
columns
,
Map
<
Object
,
DynamicFormInstance
>
instanceMap
)
{
public
void
updateFormValue
(
List
<
DynamicFormInstance
>
formInstanceList
,
Map
<
String
,
Object
>
d
,
Long
instanceId
,
List
<
DynamicFormColumn
>
columns
,
Map
<
Object
,
DynamicFormInstance
>
instanceMap
)
{
for
(
DynamicFormColumn
column
:
columns
)
{
DynamicFormInstance
formInstance
=
instanceMap
.
get
(
column
.
getFieldCode
());
if
(!
ObjectUtils
.
isEmpty
(
formInstance
))
{
//有的更新
formInstance
.
setFieldValue
(
d
.
get
(
column
.
getFieldCode
())
!=
null
?
d
.
get
(
column
.
getFieldCode
()).
toString
()
:
""
);
formInstance
.
setFieldValue
(
d
.
get
(
column
.
getFieldCode
())
!=
null
?
d
.
get
(
column
.
getFieldCode
()).
toString
()
:
""
);
}
else
{
//没有的新增
formInstance
=
new
DynamicFormInstance
();
...
...
@@ -244,23 +263,27 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
}
private
void
buildFormInstanceData
(
Long
instanceId
,
Map
<
String
,
Object
>
map
,
DynamicFormColumn
column
,
DynamicFormInstance
formInstance
)
{
private
void
buildFormInstanceData
(
Long
instanceId
,
Map
<
String
,
Object
>
map
,
DynamicFormColumn
column
,
DynamicFormInstance
formInstance
)
{
fillFormInstanceData
(
instanceId
,
map
,
column
,
formInstance
,
sequence
.
nextId
());
}
static
void
fillFormInstanceData
(
Long
instanceId
,
Map
<
String
,
Object
>
map
,
DynamicFormColumn
column
,
DynamicFormInstance
formInstance
,
long
l
)
{
static
void
fillFormInstanceData
(
Long
instanceId
,
Map
<
String
,
Object
>
map
,
DynamicFormColumn
column
,
DynamicFormInstance
formInstance
,
long
l
)
{
Bean
.
copyExistPropertis
(
column
,
formInstance
);
formInstance
.
setAppKey
(
RequestContext
.
getAppKey
());
formInstance
.
setInstanceId
(
instanceId
);
formInstance
.
setSequenceNbr
(
l
);
formInstance
.
setFormColumnId
(
column
.
getSequenceNbr
());
formInstance
.
setFieldValue
(
map
.
get
(
column
.
getFieldCode
())
!=
null
?
map
.
get
(
column
.
getFieldCode
()).
toString
()
:
""
);
formInstance
.
setFieldValue
(
map
.
get
(
column
.
getFieldCode
())
!=
null
?
map
.
get
(
column
.
getFieldCode
()).
toString
()
:
""
);
}
@Override
public
Boolean
deleteDutyData
(
Long
instanceId
)
{
dynamicFormInstanceService
.
remove
(
new
LambdaQueryWrapper
<
DynamicFormInstance
>().
eq
(
DynamicFormInstance:
:
getInstanceId
,
instanceId
));
dutyPersonShiftService
.
remove
(
new
LambdaQueryWrapper
<
DutyPersonShift
>().
eq
(
DutyPersonShift:
:
getInstanceId
,
instanceId
));
dutyPersonShiftService
.
remove
(
new
LambdaQueryWrapper
<
DutyPersonShift
>().
eq
(
DutyPersonShift:
:
getInstanceId
,
instanceId
));
return
true
;
}
...
...
@@ -269,10 +292,71 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
String
groupCode
=
this
.
getGroupCode
();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"postType"
,
postType
);
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
Map
<
String
,
Object
>
fieldCodes
=
Bean
.
listToMap
(
columns
,
"fieldCode"
,
"queryStrategy"
,
DynamicFormColumn
.
class
);
return
dynamicFormInstanceService
.
getBaseMapper
().
listOneDayDutyPerson
(
dutyDay
,
shiftId
,
fieldCodes
,
RequestContext
.
getAppKey
(),
groupCode
,
params
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
listOnDutyPerson
(
String
appKey
)
{
String
groupCode
=
this
.
getGroupCode
();
// 获取当前班次列表
DateTime
now
=
new
DateTime
();
List
<
Long
>
shiftIdList
=
getOnDuty
(
now
,
appKey
);
String
shiftIds
=
StringUtils
.
join
(
shiftIdList
.
toArray
(),
","
);
String
dutyDay
=
now
.
toString
(
"yyyy-MM-dd"
);
// 获取当前值班人员
List
<
DynamicFormColumn
>
columns
=
dynamicFormColumnService
.
list
(
new
LambdaQueryWrapper
<
DynamicFormColumn
>().
eq
(
DynamicFormColumn:
:
getGroupCode
,
groupCode
));
Map
<
String
,
Object
>
fieldCodes
=
Bean
.
listToMap
(
columns
,
"fieldCode"
,
"queryStrategy"
,
DynamicFormColumn
.
class
);
return
dynamicFormInstanceService
.
getBaseMapper
().
listOneDayDutyPerson
(
dutyDay
,
shiftId
,
fieldCodes
,
RequestContext
.
getAppKey
(),
groupCode
,
params
);
List
<
Map
<
String
,
Object
>>
maps
=
dynamicFormInstanceService
.
getBaseMapper
().
listOnDutyPerson
(
dutyDay
,
shiftIds
,
fieldCodes
,
RequestContext
.
getAppKey
(),
groupCode
);
// 获取人员照片和电话
List
<
Long
>
ids
=
new
ArrayList
<>();
maps
.
forEach
(
item
->
ids
.
add
(
Long
.
valueOf
(
String
.
valueOf
(
item
.
get
(
"userId"
)))));
try
{
List
<
Map
<
String
,
Object
>>
orgUsrList
=
orgUsrService
.
selectForShowByListId
(
ids
);
maps
.
forEach
(
item
->
{
String
userId
=
String
.
valueOf
(
item
.
get
(
"userId"
));
for
(
Map
<
String
,
Object
>
usr
:
orgUsrList
)
{
if
(
userId
.
equals
(
String
.
valueOf
(
usr
.
get
(
"sequenceNbr"
))))
{
item
.
put
(
"personImg"
,
usr
.
get
(
"personImg"
));
item
.
put
(
"telephone"
,
usr
.
get
(
"telephone"
));
orgUsrList
.
remove
(
usr
);
}
}
});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
maps
;
}
private
List
<
Long
>
getOnDuty
(
DateTime
now
,
String
appKey
)
{
List
<
DutyShiftDto
>
dutyShiftDtos
=
dutyShiftService
.
queryForDutyShiftList
(
appKey
,
false
);
List
<
Long
>
shiftIds
=
new
ArrayList
<>();
int
hour
=
now
.
getHourOfDay
();
int
minute
=
now
.
getMinuteOfHour
();
dutyShiftDtos
.
forEach
(
item
->
{
String
[]
start
=
item
.
getStartTime
().
split
(
": "
);
String
[]
startTime
=
start
[
1
].
split
(
":"
);
Integer
startHour
=
Integer
.
valueOf
(
startTime
[
0
]);
Integer
startMinute
=
Integer
.
valueOf
(
startTime
[
1
]);
String
[]
end
=
item
.
getEndTime
().
split
(
": "
);
String
[]
endTime
=
end
[
1
].
split
(
":"
);
Integer
endHour
=
Integer
.
valueOf
(
endTime
[
0
]);
Integer
endMinute
=
Integer
.
valueOf
(
endTime
[
1
]);
if
(
"当日"
.
equals
(
start
[
0
]))
{
if
(
hour
>
startHour
||
hour
==
startHour
&&
minute
>
startMinute
)
{
if
(
"次日"
.
equals
(
end
[
0
])
||
"当日"
.
equals
(
end
[
0
])
&&
(
hour
<
endHour
||
hour
==
endHour
&&
minute
<
endMinute
))
{
shiftIds
.
add
(
item
.
getSequenceNbr
());
}
}
}
});
return
shiftIds
;
}
}
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