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
17323f34
Commit
17323f34
authored
Feb 24, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
值班排班问题修复
parent
284cf40f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
43 deletions
+78
-43
IDutyCommonService.java
...os/boot/module/common/api/service/IDutyCommonService.java
+1
-1
ActionStatus.java
...ejoin/amos/boot/module/common/biz/enums/ActionStatus.java
+30
-0
DutyCommonServiceImpl.java
...module/common/biz/service/impl/DutyCommonServiceImpl.java
+6
-2
DutyFirstAidServiceImpl.java
...dule/common/biz/service/impl/DutyFirstAidServiceImpl.java
+3
-2
DutyPersonServiceImpl.java
...module/common/biz/service/impl/DutyPersonServiceImpl.java
+38
-38
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/service/IDutyCommonService.java
View file @
17323f34
...
...
@@ -140,7 +140,7 @@ public interface IDutyCommonService {
* @param instanceId
* @param dutyShiftList
*/
public
void
insertPersonShift
(
Long
instanceId
,
List
<
DutyPersonShiftDto
>
dutyShiftList
);
public
void
insertPersonShift
(
Long
instanceId
,
List
<
DutyPersonShiftDto
>
dutyShiftList
,
String
type
);
public
Object
getSchedulingDutyForSpecifyDate
(
String
dutyDay
,
Long
shiftId
,
String
postType
,
String
fieldCode
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/enums/ActionStatus.java
0 → 100644
View file @
17323f34
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@Getter
@AllArgsConstructor
public
enum
ActionStatus
{
METHOD_UPDATE
(
"更新"
,
"update"
),
METHOD_ADD
(
"新增"
,
"add"
);
private
String
name
;
private
String
code
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
}
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 @
17323f34
...
...
@@ -58,6 +58,8 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
@Autowired
DutyPersonShiftServiceImpl
dutyPersonShiftService
;
@Autowired
DutyPersonServiceImpl
dutyPersonService
;
@Autowired
Sequence
sequence
;
...
...
@@ -334,7 +336,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
* 岗位: 岗位人员数量
*
* @param dutyDate
*
@param dutyType
*
* @return
*/
public
Object
getPersonPostTypeNameAndCount
(
String
dutyDate
,
String
fieldCode
)
{
...
...
@@ -800,7 +802,9 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
dutyPersonShiftService
.
saveOrUpdateBatch
(
dutyShiftList
);
}
}
public
void
insertPersonShift
(
Long
instanceId
,
List
<
DutyPersonShiftDto
>
dutyShiftList
)
{
public
void
insertPersonShift
(
Long
instanceId
,
List
<
DutyPersonShiftDto
>
dutyShiftList
,
String
type
)
{
dutyPersonService
.
dataCheck
(
dutyShiftList
,
instanceId
,
type
);
Set
<
DutyPersonShift
>
personShiftList
=
dutyShiftList
.
stream
().
map
(
dto
->
{
// BUG 2807 修改时发现BUG 车辆保存有问题 by kongfm 2021-09-14
// 根据instanceId 和 日期查找 如果有则更新
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DutyFirstAidServiceImpl.java
View file @
17323f34
...
...
@@ -6,6 +6,7 @@ import java.util.LinkedHashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.module.common.biz.enums.ActionStatus
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -49,14 +50,14 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
Map
<
String
,
Object
>
map
=
Bean
.
BeantoMap
(
dto
);
Long
instanceId
=
excuteDynamicFormInstance
(
dto
.
getUserId
(),
map
,
this
.
getGroupCode
());
saveDutyPersonShiftDetail
(
instanceId
,
dto
.
getDutyShift
(),
dto
.
getStartTime
());
insertPersonShift
(
instanceId
,
dto
.
getDutyShift
());
insertPersonShift
(
instanceId
,
dto
.
getDutyShift
()
,
ActionStatus
.
METHOD_ADD
.
getCode
()
);
return
dto
;
}
@Override
public
DutyFirstAidDto
update
(
Long
instanceId
,
DutyFirstAidDto
dto
)
{
updateDynamicFormInstance
(
this
.
getGroupCode
(),
instanceId
,
Bean
.
BeantoMap
(
dto
));
insertPersonShift
(
instanceId
,
dto
.
getDutyShift
());
insertPersonShift
(
instanceId
,
dto
.
getDutyShift
()
,
ActionStatus
.
METHOD_UPDATE
.
getCode
()
);
return
dto
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/DutyPersonServiceImpl.java
View file @
17323f34
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto
;
import
com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper
;
import
com.yeejoin.amos.boot.module.common.biz.enums.ActionStatus
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -127,7 +120,7 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
dutyPersonShiftService
.
saveOrUpdateBatch
(
dutyShift
);
}
//2.保存值班信息
insertPersonShift
(
instanceId
,
dutyPersonDto
);
insertPersonShift
(
instanceId
,
dutyPersonDto
,
ActionStatus
.
METHOD_ADD
.
getCode
()
);
//3.返回保存后的数据
return
dutyPersonDto
;
...
...
@@ -164,38 +157,17 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
dynamicFormInstanceService
.
saveOrUpdateBatch
(
entrys
);
}
//5.更新值班信息人日期数据
insertPersonShift
(
instanceId
,
dutyPersonDto
);
insertPersonShift
(
instanceId
,
dutyPersonDto
,
ActionStatus
.
METHOD_UPDATE
.
getCode
()
);
return
dutyPersonDto
;
}
private
void
insertPersonShift
(
Long
instanceId
,
DutyPersonDto
dutyPersonDto
)
{
private
void
insertPersonShift
(
Long
instanceId
,
DutyPersonDto
dutyPersonDto
,
String
type
)
{
//此处代码针对页面操作 已有排班人员排班日期情况下 仍继续执行新增操作所造成的索引报错
//拿到排班月份
if
(!
ValidationUtil
.
isEmpty
(
dutyPersonDto
.
getDutyShift
().
get
(
0
))
&&
ValidationUtil
.
isEmpty
(
dutyPersonDto
.
getDutyShift
().
get
(
0
).
getSequenceNbr
())
){
try
{
//获取本次排班数据
List
<
DutyPersonShiftDto
>
dutyShiftList
=
dutyPersonDto
.
getDutyShift
();
//获取排班月份的最大及最小日期
Date
maxDate
=
DateUtils
.
maxDateOfMonth
(
dutyShiftList
.
get
(
0
).
getDutyDate
());
Date
minDate
=
DateUtils
.
minDateOfMonth
(
dutyShiftList
.
get
(
0
).
getDutyDate
());
//拿到当前这个人指定月所有排班数据
List
<
DutyPersonShiftDto
>
currentData
=
dutyPersonShiftMapper
.
queryDutyByPersonAndData
(
instanceId
,
minDate
,
maxDate
);
//对本次排班数据和历史排班数据的交集做主键赋值 执行更新 避免索引冲突
dutyShiftList
.
forEach
(
e
->{
currentData
.
stream
().
forEach
(
data
->{
if
(
DateUtils
.
dateCompare
(
e
.
getDutyDate
(),
data
.
getDutyDate
())
==
0
){
e
.
setSequenceNbr
(
data
.
getSequenceNbr
());
};
});
});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
Set
<
DutyPersonShift
>
personShiftList
=
dutyPersonDto
.
getDutyShift
().
stream
().
map
(
dto
->
{
//获取本次排班数据
List
<
DutyPersonShiftDto
>
dutyShiftList
=
dutyPersonDto
.
getDutyShift
();
this
.
dataCheck
(
dutyShiftList
,
instanceId
,
type
);
Set
<
DutyPersonShift
>
personShiftList
=
dutyShiftList
.
stream
().
map
(
dto
->
{
DutyPersonShift
dutyPersonShift
=
new
DutyPersonShift
();
dto
.
setInstanceId
(
instanceId
);
Bean
.
copyExistPropertis
(
dto
,
dutyPersonShift
);
...
...
@@ -207,6 +179,34 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
}
}
public
void
dataCheck
(
List
<
DutyPersonShiftDto
>
dutyShiftList
,
Long
instanceId
,
String
type
){
try
{
//获取排班月份的最大及最小日期
Date
maxDate
=
DateUtils
.
maxDateOfMonth
(
dutyShiftList
.
get
(
0
).
getDutyDate
());
Date
minDate
=
DateUtils
.
minDateOfMonth
(
dutyShiftList
.
get
(
0
).
getDutyDate
());
//拿到当前这个人指定月所有排班数据
List
<
DutyPersonShiftDto
>
currentData
=
dutyPersonShiftMapper
.
queryDutyByPersonAndData
(
instanceId
,
minDate
,
maxDate
);
//对本次排班数据和历史排班数据的交集做主键赋值 执行更新 避免索引冲突
dutyShiftList
.
forEach
(
e
->{
for
(
Iterator
<
DutyPersonShiftDto
>
iterator
=
currentData
.
listIterator
();
iterator
.
hasNext
();){
DutyPersonShiftDto
next
=
iterator
.
next
();
if
(
DateUtils
.
dateCompare
(
e
.
getDutyDate
(),
next
.
getDutyDate
())
==
0
){
e
.
setSequenceNbr
(
next
.
getSequenceNbr
());
iterator
.
remove
();
};
}
});
if
(
currentData
.
size
()>
0
&&
ActionStatus
.
METHOD_UPDATE
.
getCode
().
equals
(
type
)
){
ArrayList
<
Long
>
ids
=
new
ArrayList
<>();
currentData
.
stream
().
forEach
(
e
->
ids
.
add
(
e
.
getSequenceNbr
()));
dutyPersonShiftService
.
deleteBatchSeq
(
ids
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
buildFormInstanceData
(
Long
instanceId
,
Map
<
String
,
Object
>
map
,
DynamicFormColumn
column
,
DynamicFormInstance
formInstance
)
{
fillFormInstanceData
(
instanceId
,
map
,
column
,
formInstance
,
sequence
.
nextId
());
}
...
...
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