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
cdb27125
Commit
cdb27125
authored
Feb 14, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
16e8c7bf
d89f06ee
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
63 deletions
+82
-63
DutyPersonShiftMapper.java
.../boot/module/common/api/mapper/DutyPersonShiftMapper.java
+13
-0
DutyPersonShiftMapper.xml
...n-api/src/main/resources/mapper/DutyPersonShiftMapper.xml
+0
-0
DynamicFormInstanceMapper.xml
...i/src/main/resources/mapper/DynamicFormInstanceMapper.xml
+39
-7
DutyCommonServiceImpl.java
...module/common/biz/service/impl/DutyCommonServiceImpl.java
+0
-56
DutyPersonServiceImpl.java
...module/common/biz/service/impl/DutyPersonServiceImpl.java
+30
-0
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/mapper/DutyPersonShiftMapper.java
View file @
cdb27125
...
@@ -2,9 +2,13 @@ package com.yeejoin.amos.boot.module.common.api.mapper;
...
@@ -2,9 +2,13 @@ package com.yeejoin.amos.boot.module.common.api.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto
;
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.entity.DutyPersonShift
;
import
com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift
;
import
lombok.Data
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.poi.ss.formula.functions.T
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -152,4 +156,13 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
...
@@ -152,4 +156,13 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
List
<
Map
<
String
,
Object
>>
getNewEquipmentForSpecifyDate
(
String
dutyDate
,
String
groupCode
,
String
equipmentId
,
String
equipmentName
,
String
groupByName
);
List
<
Map
<
String
,
Object
>>
getNewEquipmentForSpecifyDate
(
String
dutyDate
,
String
groupCode
,
String
equipmentId
,
String
equipmentName
,
String
groupByName
);
String
getFirstAidCompanyId
();
String
getFirstAidCompanyId
();
/**
* 获取指定人 指定日期下所有的排班
* @param instanceId 动态表单 关联id
* @param minDate 最小日期
* @param maxDate 最大日期
*/
List
<
DutyPersonShiftDto
>
queryDutyByPersonAndData
(
Long
instanceId
,
Date
minDate
,
Date
maxDate
);
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/DutyPersonShiftMapper.xml
View file @
cdb27125
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/DynamicFormInstanceMapper.xml
View file @
cdb27125
...
@@ -27,7 +27,14 @@
...
@@ -27,7 +27,14 @@
ps.shift_id as shiftId,
ps.shift_id as shiftId,
ps.duty_date as dutyDate,
ps.duty_date as dutyDate,
ds.name as shiftName,
ds.name as shiftName,
'在岗' state
'在岗' state,
(SELECT
org.org_expand_attr1
FROM
cb_org_usr org
WHERE
org.sequence_nbr = d.deptId ) AS sort
FROM
from
from
(
(
select
select
...
@@ -35,7 +42,16 @@
...
@@ -35,7 +42,16 @@
i.GROUP_CODE groupCode,
i.GROUP_CODE groupCode,
<foreach
collection=
"fieldCodes"
item=
"value"
index=
"key"
separator=
","
>
<foreach
collection=
"fieldCodes"
item=
"value"
index=
"key"
separator=
","
>
MAX(CASE WHEN i.FIELD_CODE = #{key} THEN i.FIELD_VALUE END) as ${key}
MAX(CASE WHEN i.FIELD_CODE = #{key} THEN i.FIELD_VALUE END) as ${key}
</foreach>
</foreach>
,
(
SELECT
cdd.sort_num
FROM
cb_data_dictionary cdd
WHERE
cdd.NAME = MAX( CASE WHEN i.FIELD_CODE = 'postTypeName' THEN i.FIELD_VALUE END )
AND cdd.type = 'DUTY_POST_TYPE'
) AS personSort
from
from
cb_dynamic_form_instance i
cb_dynamic_form_instance i
where i.GROUP_CODE = #{groupCode}
where i.GROUP_CODE = #{groupCode}
...
@@ -54,13 +70,13 @@
...
@@ -54,13 +70,13 @@
( `cb_org_usr`.`biz_org_code` LIKE concat( ( SELECT `cb_org_usr`.`biz_org_code` FROM `cb_org_usr` WHERE ( `cb_org_usr`.`sequence_nbr` = 1435847345328660481 ) ), '%' ) )
( `cb_org_usr`.`biz_org_code` LIKE concat( ( SELECT `cb_org_usr`.`biz_org_code` FROM `cb_org_usr` WHERE ( `cb_org_usr`.`sequence_nbr` = 1435847345328660481 ) ), '%' ) )
AND ( `cb_org_usr`.`biz_org_type` = 'DEPARTMENT' )
AND ( `cb_org_usr`.`biz_org_type` = 'DEPARTMENT' )
))
))
and ps.shift_id = ds.sequence_nbr
and ps.shift_id = ds.sequence_nbr
and ps.duty_date = #{dutyDate}
and ps.duty_date = #{dutyDate}
<if
test=
"shiftId != null and shiftId != ''"
>
<if
test=
"shiftId != null and shiftId != ''"
>
and ps.shift_id in (#{shiftId})
and ps.shift_id in (#{shiftId})
</if>
</if>
order by instanceId desc
ORDER BY
sort+0 DESC ,d.personSort+0 ,CONVERT(username USING GBK) ASC
</select>
</select>
<select
id=
"listAll"
resultType=
"java.util.Map"
>
<select
id=
"listAll"
resultType=
"java.util.Map"
>
...
@@ -216,7 +232,13 @@
...
@@ -216,7 +232,13 @@
ps.shift_id as shiftId,
ps.shift_id as shiftId,
ps.duty_date as dutyDate,
ps.duty_date as dutyDate,
ds.name as shiftName,
ds.name as shiftName,
'在岗' state
'在岗' state,
(SELECT
org.org_expand_attr1
FROM
cb_org_usr org
WHERE
org.sequence_nbr = d.deptId ) AS sort
from
from
(
(
select
select
...
@@ -224,7 +246,16 @@
...
@@ -224,7 +246,16 @@
i.GROUP_CODE groupCode,
i.GROUP_CODE groupCode,
<foreach
collection=
"fieldCodes"
item=
"value"
index=
"key"
separator=
","
>
<foreach
collection=
"fieldCodes"
item=
"value"
index=
"key"
separator=
","
>
MAX(CASE WHEN i.FIELD_CODE = #{key} THEN i.FIELD_VALUE END) as ${key}
MAX(CASE WHEN i.FIELD_CODE = #{key} THEN i.FIELD_VALUE END) as ${key}
</foreach>
</foreach>
,
(
SELECT
cdd.sort_num
FROM
cb_data_dictionary cdd
WHERE
cdd.NAME = MAX( CASE WHEN i.FIELD_CODE = 'postTypeName' THEN i.FIELD_VALUE END )
AND cdd.type = 'DUTY_POST_TYPE'
) AS personSort
from
from
cb_dynamic_form_instance i
cb_dynamic_form_instance i
where i.GROUP_CODE = #{groupCode}
where i.GROUP_CODE = #{groupCode}
...
@@ -248,7 +279,8 @@
...
@@ -248,7 +279,8 @@
<if
test=
"shiftId != null and shiftId != ''"
>
<if
test=
"shiftId != null and shiftId != ''"
>
and ps.shift_id in (${shiftId})
and ps.shift_id in (${shiftId})
</if>
</if>
order by instanceId desc
ORDER BY
sort+0 DESC,d.personSort+0 ,CONVERT(username USING GBK) ASC
</select>
</select>
<select
id=
"getInstanceByCodeAndValue"
resultType=
"com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance"
>
<select
id=
"getInstanceByCodeAndValue"
resultType=
"com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance"
>
SELECT
SELECT
...
...
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 @
cdb27125
...
@@ -124,23 +124,6 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
...
@@ -124,23 +124,6 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
List
<
Map
<
String
,
Object
>>
orgUsrList
=
orgUsrService
.
selectForShowByListId
(
ids
);
List
<
Map
<
String
,
Object
>>
orgUsrList
=
orgUsrService
.
selectForShowByListId
(
ids
);
maps
.
forEach
(
item
->
{
maps
.
forEach
(
item
->
{
String
userId
=
String
.
valueOf
(
item
.
get
(
"userId"
));
String
userId
=
String
.
valueOf
(
item
.
get
(
"userId"
));
//此处是用来给119日常值班首页值班岗位排序用
String
sort
=
""
;
switch
(
item
.
get
(
"postType"
).
toString
()
){
case
"826"
:
sort
=
"4"
;
break
;
case
"824"
:
sort
=
"3"
;
break
;
case
"825"
:
sort
=
"2"
;
break
;
case
"827"
:
sort
=
"1"
;
break
;
}
item
.
put
(
"postSort"
,
sort
);
for
(
Map
<
String
,
Object
>
usr
:
orgUsrList
)
{
for
(
Map
<
String
,
Object
>
usr
:
orgUsrList
)
{
if
(
userId
.
equals
(
String
.
valueOf
(
usr
.
get
(
"sequenceNbr"
))))
{
if
(
userId
.
equals
(
String
.
valueOf
(
usr
.
get
(
"sequenceNbr"
))))
{
item
.
put
(
"personImg"
,
usr
.
get
(
"personImg"
));
item
.
put
(
"personImg"
,
usr
.
get
(
"personImg"
));
...
@@ -152,17 +135,6 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
...
@@ -152,17 +135,6 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
}
}
}
});
});
maps
=
maps
.
stream
().
sorted
((
map1
,
map2
)->{
if
(
map1
.
get
(
"companyId"
).
toString
().
equals
(
map2
.
get
(
"companyId"
).
toString
())){
if
(
map1
.
get
(
"deptId"
).
toString
().
equals
(
map2
.
get
(
"deptId"
).
toString
())){
return
map2
.
get
(
"postSort"
).
toString
().
compareTo
(
map1
.
get
(
"postSort"
).
toString
());
}
else
{
return
map1
.
get
(
"deptId"
).
toString
().
compareTo
(
map2
.
get
(
"deptId"
).
toString
());
}
}
else
{
return
map2
.
get
(
"companyId"
).
toString
().
compareTo
(
map1
.
get
(
"companyId"
).
toString
());
}
}).
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -698,23 +670,6 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
...
@@ -698,23 +670,6 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
List
<
Map
<
String
,
Object
>>
orgUsrList
=
orgUsrService
.
selectForShowByListId
(
ids
);
List
<
Map
<
String
,
Object
>>
orgUsrList
=
orgUsrService
.
selectForShowByListId
(
ids
);
maps
.
forEach
(
item
->
{
maps
.
forEach
(
item
->
{
String
userId
=
String
.
valueOf
(
item
.
get
(
"userId"
));
String
userId
=
String
.
valueOf
(
item
.
get
(
"userId"
));
//此处是用来给119日常值班首页值班岗位排序用
String
sort
=
""
;
switch
(
item
.
get
(
"postType"
).
toString
())
{
case
"826"
:
sort
=
"4"
;
break
;
case
"824"
:
sort
=
"3"
;
break
;
case
"825"
:
sort
=
"2"
;
break
;
case
"827"
:
sort
=
"1"
;
break
;
}
item
.
put
(
"postSort"
,
sort
);
for
(
Map
<
String
,
Object
>
usr
:
orgUsrList
)
{
for
(
Map
<
String
,
Object
>
usr
:
orgUsrList
)
{
if
(
userId
.
equals
(
String
.
valueOf
(
usr
.
get
(
"sequenceNbr"
))))
{
if
(
userId
.
equals
(
String
.
valueOf
(
usr
.
get
(
"sequenceNbr"
))))
{
item
.
put
(
"personImg"
,
usr
.
get
(
"personImg"
));
item
.
put
(
"personImg"
,
usr
.
get
(
"personImg"
));
...
@@ -726,17 +681,6 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
...
@@ -726,17 +681,6 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
}
}
}
});
});
maps
=
maps
.
stream
().
sorted
((
map1
,
map2
)
->
{
if
(
map1
.
get
(
"companyId"
).
toString
().
equals
(
map2
.
get
(
"companyId"
).
toString
()))
{
if
(
map1
.
get
(
"deptId"
).
toString
().
equals
(
map2
.
get
(
"deptId"
).
toString
()))
{
return
map2
.
get
(
"postSort"
).
toString
().
compareTo
(
map1
.
get
(
"postSort"
).
toString
());
}
else
{
return
map1
.
get
(
"deptId"
).
toString
().
compareTo
(
map2
.
get
(
"deptId"
).
toString
());
}
}
else
{
return
map2
.
get
(
"companyId"
).
toString
().
compareTo
(
map1
.
get
(
"companyId"
).
toString
());
}
}).
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
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 @
cdb27125
...
@@ -10,6 +10,9 @@ import java.util.Map;
...
@@ -10,6 +10,9 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
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.api.mapper.DutyPersonShiftMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -17,6 +20,7 @@ import org.springframework.stereotype.Service;
...
@@ -17,6 +20,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
@@ -165,6 +169,32 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
...
@@ -165,6 +169,32 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
}
}
private
void
insertPersonShift
(
Long
instanceId
,
DutyPersonDto
dutyPersonDto
)
{
private
void
insertPersonShift
(
Long
instanceId
,
DutyPersonDto
dutyPersonDto
)
{
//此处代码针对页面操作 已有排班人员排班日期情况下 仍继续执行新增操作所造成的索引报错
//拿到排班月份
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
->
{
Set
<
DutyPersonShift
>
personShiftList
=
dutyPersonDto
.
getDutyShift
().
stream
().
map
(
dto
->
{
DutyPersonShift
dutyPersonShift
=
new
DutyPersonShift
();
DutyPersonShift
dutyPersonShift
=
new
DutyPersonShift
();
dto
.
setInstanceId
(
instanceId
);
dto
.
setInstanceId
(
instanceId
);
...
...
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