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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
609 additions
and
561 deletions
+609
-561
DutyPersonShiftMapper.java
.../boot/module/common/api/mapper/DutyPersonShiftMapper.java
+13
-0
DutyPersonShiftMapper.xml
...n-api/src/main/resources/mapper/DutyPersonShiftMapper.xml
+527
-498
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
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
<mapper
namespace=
"com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper"
>
namespace=
"com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper"
>
<select
id=
"calMaxPersonAndShiftNum"
resultType=
"java.util.Map"
>
<select
id=
"calMaxPersonAndShiftNum"
resultType=
"java.util.Map"
>
select
select
(select
(select
IFNULL(max(num),0)
IFNULL(max(num),0)
from
from
(SELECT
(SELECT
ifnull(count(1),0) num
ifnull(count(1),0) num
FROM
FROM
cb_duty_person_shift s,
cb_duty_person_shift s,
cb_duty_shift ds,
cb_duty_shift ds,
cb_dynamic_form_instance i
cb_dynamic_form_instance i
WHERE
WHERE
ds.sequence_nbr = s.shift_id
ds.sequence_nbr = s.shift_id
and s.instance_id = i.instance_id
and s.instance_id = i.instance_id
AND i.field_code = 'userId'
AND i.field_code = 'userId'
and s.duty_date >= #{beginDate}
and s.duty_date >= #{beginDate}
and s.duty_date
<![CDATA[<=]]>
and s.duty_date
<![CDATA[<=]]>
#{endDate}
#{endDate}
AND s.shift_id is not null
<!--// BUG 2807 更新人员车辆排版值班的保存逻辑 如果没有填写数据则保存空数据 。
AND s.shift_id is not null
<!--// BUG 2807 更新人员车辆排版值班的保存逻辑 如果没有填写数据则保存空数据 。
同步修改 查询 导出相关逻辑 by kongfm 2021-09-14 -->
同步修改 查询 导出相关逻辑 by kongfm 2021-09-14 -->
and s.app_Key = #{appKey}
and s.app_Key = #{appKey}
GROUP BY s.duty_date,s.shift_id
<!--增添分组条件 根据班次分组技术 -->
GROUP BY s.duty_date,s.shift_id
<!--增添分组条件 根据班次分组技术 -->
) a) as maxDutyPersonNumDay,
) a) as maxDutyPersonNumDay,
(select
(select
IFNULL(max(num),0)
IFNULL(max(num),0)
from
from
(SELECT
(SELECT
ifnull(count(DISTINCT(s.shift_id)),0) num
ifnull(count(DISTINCT(s.shift_id)),0) num
FROM
FROM
cb_duty_person_shift s,
cb_duty_person_shift s,
cb_duty_shift ds,
cb_duty_shift ds,
cb_dynamic_form_instance i
cb_dynamic_form_instance i
WHERE
WHERE
ds.sequence_nbr = s.shift_id
ds.sequence_nbr = s.shift_id
and s.instance_id = i.instance_id
and s.instance_id = i.instance_id
AND i.field_code = 'userId'
AND i.field_code = 'userId'
and s.duty_date >= #{beginDate}
and s.duty_date >= #{beginDate}
and s.duty_date
<![CDATA[<=]]>
and s.duty_date
<![CDATA[<=]]>
#{endDate}
#{endDate}
and s.app_Key = #{appKey}
and s.app_Key = #{appKey}
GROUP BY s.duty_date) b) as maxShiftNumDay
GROUP BY s.duty_date) b) as maxShiftNumDay
</select>
</select>
<select
id=
"nowDutyCarPersonNum"
resultType=
"java.util.Map"
>
<select
id=
"nowDutyCarPersonNum"
resultType=
"java.util.Map"
>
SELECT
SELECT `a`.`name` AS `name`,
`a`.`name` AS `name`,
a.id,
a.id,
(
(
SELECT count(DISTINCT `cb_duty_person_shift`.`instance_id`) AS `num`
SELECT
FROM (`cb_duty_shift` LEFT JOIN `cb_duty_person_shift` ON ((`cb_duty_person_shift`.`shift_id` = `cb_duty_shift`.`sequence_nbr`)))
count( DISTINCT `cb_duty_person_shift`.`instance_id` ) AS `num`
WHERE (
FROM
(`cb_duty_person_shift`.`is_delete` = 0)
( `cb_duty_shift` LEFT JOIN `cb_duty_person_shift` ON ( ( `cb_duty_person_shift`.`shift_id` = `cb_duty_shift`.`sequence_nbr` ) ) )
AND `cb_duty_person_shift`.`instance_id` IN (
WHERE
SELECT `cb_dynamic_form_instance`.`instance_id`
(
FROM `cb_dynamic_form_instance`
( `cb_duty_person_shift`.`is_delete` = 0 )
WHERE (
AND `cb_duty_person_shift`.`instance_id` IN (
(`cb_dynamic_form_instance`.`group_id` =
SELECT
(SELECT `cb_dynamic_form_group`.`sequence_nbr`
`cb_dynamic_form_instance`.`instance_id`
FROM `cb_dynamic_form_group`
FROM
WHERE (`cb_dynamic_form_group`.`group_code` = 'dutyCar')))
`cb_dynamic_form_instance`
AND (`cb_dynamic_form_instance`.`group_code` = 'dutyCar')
WHERE
AND (`cb_dynamic_form_instance`.`field_value` = `a`.`id`)
(
)
( `cb_dynamic_form_instance`.`group_id` = ( SELECT `cb_dynamic_form_group`.`sequence_nbr` FROM `cb_dynamic_form_group` WHERE ( `cb_dynamic_form_group`.`group_code` = 'dutyCar' ) ) )
)
AND ( `cb_dynamic_form_instance`.`group_code` = 'dutyCar' )
AND (
AND ( `cb_dynamic_form_instance`.`field_value` = `a`.`id` )
CONVERT(date_format(now(), '%Y-%m-%d %H:%i') USING utf8mb3) BETWEEN (
)
CASE
)
LEFT ( `cb_duty_shift`.`start_time`, 3 )
AND (
WHEN '当日:' THEN
CONVERT ( date_format( now( ), '%Y-%m-%d %H:%i' ) USING utf8mb3 ) BETWEEN (
REPLACE ( `cb_duty_shift`.`start_time`, '当日:', `cb_duty_person_shift`.`duty_date` ) ELSE REPLACE ( `cb_duty_shift`.`start_time`, '次日:', ( `cb_duty_person_shift`.`duty_date` + INTERVAL 1 DAY ) )
CASE
END
LEFT ( `cb_duty_shift`.`start_time`, 3 )
)
WHEN '当日:' THEN
AND (
REPLACE ( `cb_duty_shift`.`start_time`, '当日:', `cb_duty_person_shift`.`duty_date` ) ELSE REPLACE ( `cb_duty_shift`.`start_time`, '次日:', ( `cb_duty_person_shift`.`duty_date` + INTERVAL 1 DAY ) )
CASE
END
LEFT ( `cb_duty_shift`.`end_time`, 3 )
)
WHEN '当日:' THEN
AND (
REPLACE ( `cb_duty_shift`.`end_time`, '当日:', `cb_duty_person_shift`.`duty_date` ) ELSE REPLACE ( `cb_duty_shift`.`end_time`, '次日:', ( `cb_duty_person_shift`.`duty_date` + INTERVAL 1 DAY ) )
CASE
END
LEFT ( `cb_duty_shift`.`end_time`, 3 )
)
WHEN '当日:' THEN
)
REPLACE ( `cb_duty_shift`.`end_time`, '当日:', `cb_duty_person_shift`.`duty_date` ) ELSE REPLACE ( `cb_duty_shift`.`end_time`, '次日:', ( `cb_duty_person_shift`.`duty_date` + INTERVAL 1 DAY ) )
)
END
) AS `num`
)
FROM (
)
(
)
`xiy_safety_business_v3.0.1_20100712`.`wl_car` `a`
) AS `num`
LEFT JOIN `jc_power_transfer_company_resources` `b` ON (((`a`.`id` = `b`.`resources_id`) AND (`b`.`status` = 'executing')))
FROM
)
(
LEFT JOIN `cb_data_dictionary` `c` ON (((`c`.`code` = `b`.`car_status`) AND (`c`.`type` = 'CARSTATE')))
(
)
`xiy_safety_business_v3.0.1_20100712`.`wl_car` `a`
LEFT JOIN `jc_power_transfer_company_resources` `b` ON ( ( ( `a`.`id` = `b`.`resources_id` ) AND ( `b`.`status` = 'executing' ) ) )
)
LEFT JOIN `cb_data_dictionary` `c` ON ( ( ( `c`.`code` = `b`.`car_status` ) AND ( `c`.`type` = 'CARSTATE' ) ) )
)
</select>
</select>
<select
id=
"bankViewData"
resultType=
"java.util.Map"
>
<select
id=
"bankViewData"
resultType=
"java.util.Map"
>
SELECT
SELECT S1.*,
S1.*,
S2.name as shiftName
S2.name as shiftName
from (SELECT s.shift_id as shiftId,
from
GROUP_CONCAT(i.field_value) AS userName
(SELECT
FROM cb_duty_person_shift s,
s.shift_id as shiftId,
cb_duty_shift ds,
GROUP_CONCAT(i.field_value) AS userName
cb_dynamic_form_instance i
FROM
WHERE s.instance_id = i.instance_id
cb_duty_person_shift s,
AND ds.sequence_nbr = s.shift_id
cb_duty_shift ds,
AND i.field_code = 'userName'
cb_dynamic_form_instance i
AND s.duty_date = #{dutyDate}
WHERE
AND s.shift_id is not null
s.instance_id = i.instance_id
AND s.app_key = #{appKey}
AND ds.sequence_nbr = s.shift_id
and i.group_code = #{groupCode}
AND i.field_code = 'userName'
GROUP BY s.shift_id
AND s.duty_date = #{dutyDate}
) S1,
AND s.shift_id is not null
cb_duty_shift S2
AND s.app_key = #{appKey}
where s1.shiftId = s2.sequence_nbr
and i.group_code =#{groupCode}
</select>
GROUP BY
<select
id=
"stationViewData"
resultType=
"java.util.Map"
>
s.shift_id
select i.field_value as postTypeName,
) S1,
count(1) as total
cb_duty_shift S2
from cb_duty_person_shift s,
where
cb_dynamic_form_instance i
s1.shiftId = s2.sequence_nbr
where s.instance_id = i.instance_id
</select>
and i.field_code = 'postTypeName'
<select
id=
"stationViewData"
resultType=
"java.util.Map"
>
AND s.duty_date = #{dutyDate}
select
AND s.shift_id is not null
i.field_value as postTypeName,
AND s.app_key = #{appKey}
count(1) as total
and i.group_code = #{groupCode}
from
GROUP BY i.field_value
cb_duty_person_shift s,
</select>
cb_dynamic_form_instance i
<select
id=
"newStationViewData"
resultType=
"java.util.Map"
>
where
s.instance_id = i.instance_id
SELECT result.postTypeName as postTypeName,
and i.field_code = 'postTypeName'
count(result.postTypeName) as total
AND s.duty_date = #{dutyDate}
FROM (
AND s.shift_id is not null
select
AND s.app_key = #{appKey}
(
and i.group_code =#{groupCode}
SELECT
GROUP BY i.field_value
cdd.sort_num
</select>
FROM
<select
id=
"newStationViewData"
resultType=
"java.util.Map"
>
cb_data_dictionary cdd
select
WHERE
i.field_value as postTypeName,
cdd.NAME = MAX( CASE WHEN i.FIELD_CODE = 'postTypeName' THEN i.FIELD_VALUE END )
count(1) as total
AND cdd.type = 'DUTY_POST_TYPE'
from
) AS personSort,
cb_duty_person_shift s,
MAX(CASE WHEN i.FIELD_CODE = 'postTypeName' THEN i.FIELD_VALUE END) as postTypeName
cb_dynamic_form_instance i
from cb_dynamic_form_instance i
where
LEFT JOIN
s.instance_id = i.instance_id
cb_duty_person_shift s on s.instance_id = i.instance_id and s.shift_id is not null
and i.field_code = 'postTypeName'
WHERE s.duty_date = #{dutyDate}
AND s.duty_date = #{dutyDate}
and i.group_code = #{groupCode}
AND s.shift_id is not null
GROUP BY i.instance_id
and i.group_code =#{groupCode}
) result
GROUP BY i.field_value
GROUP BY result.postTypeName
</select>
ORDER BY result.personSort + 0 asc
<select
id=
"newStationViewDataByFieldCode"
resultType=
"java.util.Map"
>
</select>
select
<select
id=
"newStationViewDataByFieldCode"
resultType=
"java.util.Map"
>
i.field_value as postTypeName,
select i.field_value as postTypeName,
count(1) as total
count(1) as total
from
from cb_duty_person_shift s,
cb_duty_person_shift s,
cb_dynamic_form_instance i
cb_dynamic_form_instance i
where s.instance_id = i.instance_id
where
and i.field_code = #{fieldCode}
s.instance_id = i.instance_id
AND s.duty_date = #{dutyDate}
and i.field_code = #{fieldCode}
AND s.shift_id is not null
AND s.duty_date = #{dutyDate}
and i.group_code = #{groupCode}
AND s.shift_id is not null
AND i.field_value is not null
and i.group_code =#{groupCode}
AND i.field_value != ''
AND i.field_value is not null
GROUP BY i.field_value
AND i.field_value != ''
</select>
GROUP BY i.field_value
<select
id=
"genRangeDate"
resultType=
"map"
>
</select>
SELECT DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY)), '%Y-%m-%d') AS date,
<select
id=
"genRangeDate"
resultType=
"map"
>
SELECT
DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date,
@s := @s + 1 AS `index`
@s := @s + 1 AS `index`
FROM
FROM
mysql.help_topic,
mysql.help_topic,
( SELECT @s := 0 ) temp
( SELECT @s := 0 ) temp
WHERE
WHERE
@s
<![CDATA[<=]]>
@s
<![CDATA[<=]]>
DATEDIFF(#{endDate},#{beginDate})
DATEDIFF(#{endDate}
</select>
, #{beginDate})
</select>
<select
id=
'getSpecifyDateList'
resultType=
'map'
>
<select
id=
'getSpecifyDateList'
resultType=
'map'
>
SELECT
SELECT
GROUP_CONCAT(cd.field_value) AS
GROUP_CONCAT(cd.field_value) AS
value
value
,
,
cds.name
cds.name
FROM
FROM
cb_dynamic_form_instance cd
cb_dynamic_form_instance cd
LEFT JOIN (
LEFT JOIN (
SELECT
SELECT
dp.instance_id,
dp.instance_id,
ds.`name`
ds.`name`
FROM
FROM
cb_duty_person_shift dp
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
WHERE
dp.duty_date = #{dutyDate}
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id
) cds ON cd.instance_id = cds.instance_id
WHERE
WHERE
cd.group_code = #{groupCode}
cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.is_delete = 0
AND cd.field_code = 'userName'
AND cd.field_code = 'userName'
<if
test=
"params != null and params!='' "
>
<if
test=
"params != null and params!='' "
>
and cd.field_value !='消防车驾驶员'
and cd.field_value !='消防车驾驶员'
</if>
</if>
AND cd.instance_id IN
AND cd.instance_id IN
<foreach
collection =
'instanceIds'
item=
'instanceId'
index=
'index'
open=
"("
close=
")"
separator=
","
>
<foreach
collection=
'instanceIds'
item=
'instanceId'
index=
'index'
open=
"("
close=
")"
separator=
","
>
#{instanceId}
#{instanceId}
</foreach>
</foreach>
GROUP BY
GROUP BY
cds.`name`
cds.`name`
</select>
</select>
<select
id=
'getEquipmentForSpecifyDate'
resultType=
'map'
>
<select
id=
'getEquipmentForSpecifyDate'
resultType=
'map'
>
select * from (
select * from (
SELECT
SELECT
MAX(
MAX(
CASE
CASE
WHEN cd.FIELD_CODE = #{equipmentId} THEN
WHEN cd.FIELD_CODE = #{equipmentId} THEN
cd.FIELD_VALUE
cd.FIELD_VALUE
END
END
) AS #{equipmentId},
) AS #{equipmentId},
MAX(
MAX(
CASE
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
cd.FIELD_VALUE
END
END
) AS 'userName',
) AS 'userName',
MAX(
MAX(
CASE
CASE
WHEN cd.FIELD_CODE = #{equipmentName} THEN
WHEN cd.FIELD_CODE = #{equipmentName} THEN
cd.FIELD_VALUE
cd.FIELD_VALUE
END
END
) AS #{equipmentName},
) AS #{equipmentName},
MAX(
MAX(
CASE
CASE
WHEN cd.FIELD_CODE = #{teamName} THEN
WHEN cd.FIELD_CODE = #{teamName} THEN
cd.FIELD_VALUE
cd.FIELD_VALUE
END
END
) AS #{teamName}
) AS #{teamName}
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate} and dp.is_delete=0
) cds ON cd.instance_id = cds.instance_id
where cd.group_code =#{groupCode} and cds.instance_id is not null and
cd.is_delete=0
group by cd.instance_id
) result
<if
test=
"groupByName != null and groupByName!='' "
>
group by ${groupByName}
</if>
</select>
<select
id=
'getNewEquipmentForSpecifyDate'
resultType=
'map'
>
select *,
(SELECT
org.org_expand_attr1
FROM
FROM
cb_dynamic_form_instance cd
cb_org_usr org
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
WHERE
dp.duty_date = #{dutyDate} and dp.is_delete=0 and dp.shift_id is not null
org.sequence_nbr = result.deptId ) AS sort
) cds ON cd.instance_id = cds.instance_id
from (
where cd.group_code =#{groupCode} and cds.instance_id is not null and
cd.is_delete=0
group by cd.instance_id
) result
<if
test=
"groupByName != null and groupByName!='' "
>
group by ${groupByName}
</if>
</select>
<select
id=
'getNewEquipmentForSpecifyDate'
resultType=
'map'
>
select * from (
SELECT
SELECT
MAX(
MAX(
CASE
CASE
WHEN cd.FIELD_CODE = #{equipmentId} THEN
WHEN cd.FIELD_CODE = #{equipmentId} THEN
cd.FIELD_VALUE
cd.FIELD_VALUE
END
END
) AS #{equipmentId},
) AS #{equipmentId},
MAX(
MAX(
CASE
CASE
...
@@ -290,13 +290,13 @@ select * from (
...
@@ -290,13 +290,13 @@ select * from (
cd.FIELD_VALUE
cd.FIELD_VALUE
END
END
) AS 'userName',
) AS 'userName',
MAX(
MAX(
CASE
CASE
WHEN cd.FIELD_CODE = #{equipmentName} THEN
WHEN cd.FIELD_CODE = #{equipmentName} THEN
cd.FIELD_VALUE
cd.FIELD_VALUE
END
END
) AS #{equipmentName}
) AS #{equipmentName}
FROM
FROM
cb_dynamic_form_instance cd
cb_dynamic_form_instance cd
LEFT JOIN (
LEFT JOIN (
SELECT
SELECT
...
@@ -306,250 +306,279 @@ select * from (
...
@@ -306,250 +306,279 @@ select * from (
cb_duty_person_shift dp
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
WHERE
dp.duty_date = #{dutyDate} and dp.is_delete=0
dp.duty_date = #{dutyDate} and dp.is_delete=0
and dp.shift_id is not null
) cds ON cd.instance_id = cds.instance_id
) cds ON cd.instance_id = cds.instance_id
where cd.group_code =#{groupCode} and cds.instance_id is not null and
where cd.group_code =#{groupCode} and cds.instance_id is not null and
cd.is_delete=0
cd.is_delete=0
group by cd.instance_id
group by cd.instance_id
) result
) result
<if
test=
"groupByName != null and groupByName!='' "
>
<if
test=
"groupByName != null and groupByName!='' "
>
group by ${groupByName}
group by ${groupByName}
</if>
</if>
</select>
ORDER BY sort+0
<select
id=
'getInstanceIdForSpecifyDateAndEquipment'
resultType=
'map'
>
SELECT
GROUP_CONCAT(cd.instance_id) as instanceIds
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id
WHERE
cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.field_value = #{targetId}
</select>
<select
id=
'getEquipmentOperator'
resultType=
'map'
>
SELECT
result.userName
FROM
(
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
END
) AS 'userName',
MAX(
CASE
WHEN cd.FIELD_CODE = 'postTypeName' THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
cds. NAME
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id
WHERE
cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.instance_id IN
<foreach
collection =
'instanceIds'
item=
'instanceId'
index=
'index'
open=
"("
close=
")"
separator=
","
>
#{instanceId}
</foreach>
) result
WHERE
result.postTypeName = #{operator} and result.name =#{duty}
</select>
</select>
<select
id =
'getPositionStaffDutyForSpecifyDate'
resultType=
"map"
>
SELECT
GROUP_CONCAT(ss.userName) AS userName,
ss.postTypeName
FROM
(
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
END
) AS 'userName',
<choose>
<when
test=
"fieldCode != null and fieldCode != ''"
>
MAX(
CASE
WHEN cd.FIELD_CODE = #{fieldCode} THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
</when>
<otherwise>
MAX(
CASE
WHEN cd.FIELD_CODE = 'postTypeName' THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
</otherwise>
</choose>
cd.instance_id
FROM
cb_dynamic_form_instance cd
WHERE
cd.instance_id in
<foreach
collection =
'instanceIds'
item=
'instanceId'
index=
'index'
open=
"("
close=
")"
separator=
","
>
#{instanceId}
</foreach>
AND cd.group_code = #{groupCode}
AND cd.is_delete = 0
GROUP BY
cd.instance_id
) ss
<!-- LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND NAME IS NOT NULL
) cds ON ss.instance_id = cds.instance_id
WHERE
cds.NAME =#{duty} -->
GROUP BY
ss.postTypeName
</select>
<select
id=
'getDutyForSpecifyDate'
resultType=
"map"
>
SELECT
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND NAME IS NOT NULL
GROUP BY
NAME
</select>
<select
id=
'getFireTeamBySequenceNbr'
resultType=
"map"
>
SELECT
name
FROM
cb_fire_team
WHERE
sequence_nbr = #{sequenceNbr} and is_delete=0
</select>
<select
id=
'getFirstAidCompanyId'
resultType=
"string"
>
SELECT
sequence_nbr
FROM
cb_org_usr a
WHERE
a.is_delete = 0
AND
a.biz_org_name = '消防救援保障部'
</select>
<select
id=
'getFirstAidForTypeCodeAndCompanyId'
resultType=
"map"
>
SELECT
cft.name,
cft.sequence_nbr
FROM
cb_fire_team cft
WHERE
cft.is_delete = 0
AND cft.type_code = (
SELECT
CODE
FROM
cb_data_dictionary cd
WHERE
cd.name = '企(事)业单位医疗救援队(站)'
AND cd.type = 'XFJGLX'
)
<select
id=
'getInstanceIdForSpecifyDateAndEquipment'
AND cft.company = #{company}
resultType=
'map'
>
</select>
SELECT GROUP_CONCAT(cd.instance_id) as instanceIds
FROM cb_dynamic_form_instance cd
LEFT JOIN (
SELECT dp.instance_id,
ds.`name`
FROM cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id
WHERE cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.field_value = #{targetId}
</select>
<select
id=
'getEquipmentOperator'
resultType=
'map'
>
SELECT
result.userName
FROM
(
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
END
) AS 'userName',
MAX(
CASE
WHEN cd.FIELD_CODE = 'postTypeName' THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
cds. NAME
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
) cds ON cd.instance_id = cds.instance_id
WHERE
cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.instance_id IN
<foreach
collection=
'instanceIds'
item=
'instanceId'
index=
'index'
open=
"("
close=
")"
separator=
","
>
#{instanceId}
</foreach>
) result
WHERE
result.postTypeName = #{operator} and result.name =#{duty}
</select>
<select
id=
'getPositionStaffDutyForSpecifyDate'
resultType=
"map"
>
SELECT
GROUP_CONCAT(ss.userName) AS userName,
ss.postTypeName,
(select cdd.sort_num from cb_data_dictionary cdd WHERE cdd.name = ss.postTypeName and cdd.type = 'DUTY_POST_TYPE') as sort
FROM
(
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
END
) AS 'userName',
<choose>
<when
test=
"fieldCode != null and fieldCode != ''"
>
MAX(
CASE
WHEN cd.FIELD_CODE = #{fieldCode} THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
</when>
<otherwise>
MAX(
CASE
WHEN cd.FIELD_CODE = 'postTypeName' THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
</otherwise>
</choose>
cd.instance_id
FROM
cb_dynamic_form_instance cd
WHERE
cd.instance_id in
<foreach
collection=
'instanceIds'
item=
'instanceId'
index=
'index'
open=
"("
close=
")"
separator=
","
>
#{instanceId}
</foreach>
AND cd.group_code = #{groupCode}
AND cd.is_delete = 0
GROUP BY
cd.instance_id
ORDER BY CONVERT(userName USING GBK) ASC
) ss
<!-- LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND NAME IS NOT NULL
) cds ON ss.instance_id = cds.instance_id
WHERE
cds.NAME =#{duty} -->
GROUP BY
ss.postTypeName
ORDER BY
sort ASC
</select>
<select
id=
'getDutyForSpecifyDate'
resultType=
"map"
>
SELECT ds.`name`
FROM cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE dp.duty_date = #{dutyDate}
AND dp.is_delete = 0
AND NAME IS NOT NULL
GROUP BY NAME
</select>
<select
id=
'getFireTeamBySequenceNbr'
resultType=
"map"
>
SELECT name
FROM cb_fire_team
WHERE sequence_nbr = #{sequenceNbr}
and is_delete = 0
</select>
<select
id=
'getFirstAidCompanyId'
resultType=
"string"
>
SELECT sequence_nbr
FROM cb_org_usr a
WHERE a.is_delete = 0
AND a.biz_org_name = '消防救援保障部'
</select>
<select
id=
'getFirstAidForTypeCodeAndCompanyId'
resultType=
"map"
>
SELECT cft.name,
cft.sequence_nbr
FROM cb_fire_team cft
WHERE cft.is_delete = 0
AND cft.type_code = (
SELECT CODE
FROM cb_data_dictionary cd
WHERE cd.name = '企(事)业单位医疗救援队(站)'
AND cd.type = 'XFJGLX'
)
AND cft.company = #{company}
</select>
<select
id=
'queryByCompanyId'
resultType=
"map"
>
<select
id=
'queryByCompanyId'
resultType=
"map"
>
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from (
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId, cou1.biz_org_name companyName
(
from (select * from cb_org_usr cou where is_delete = 0 ) orgUsr
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId, cou1.biz_org_name
left join cb_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
companyName
left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
from (select * from cb_org_usr cou where is_delete = 0 ) orgUsr
i.instance_id where i.field_code = 'telephone') as d
left join cb_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
where d.sequence_nbr in (
left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
select userId from (
i.instance_id where i.field_code = 'telephone') as d
select cb.duty_date,a.deptId,c.userId from cb_duty_person_shift cb
where d.sequence_nbr in (
left join (select i.instance_id id1 ,if(i.field_code = 'deptId',
select userId from (
i.field_value, null) as 'deptId' from cb_dynamic_form_instance i
select cb.duty_date,a.deptId,c.userId from cb_duty_person_shift cb
where i.field_code = 'deptId' and i.field_value is not null) a
left join (select i.instance_id id1 ,if(i.field_code = 'deptId',
on cb.instance_id = a.id1
i.field_value, null) as 'deptId' from cb_dynamic_form_instance i
left join (select i.instance_id id3 ,if(i.field_code = 'userId',
where i.field_code = 'deptId' and i.field_value is not null) a
i.field_value, null) as 'userId' from cb_dynamic_form_instance i
on cb.instance_id = a.id1
where i.field_code = 'userId' and i.field_value is not null) c
left join (select i.instance_id id3 ,if(i.field_code = 'userId',
on cb.instance_id = c.id3
i.field_value, null) as 'userId' from cb_dynamic_form_instance i
where to_days(cb.duty_date) = to_days(now()) and
where i.field_code = 'userId' and i.field_value is not null) c
a.deptId in ( select sequence_nbr from cb_org_usr cou where biz_org_name in
on cb.instance_id = c.id3
<foreach
item=
"item"
index=
"index"
collection=
"bizNames"
open=
"("
separator=
","
close=
")"
>
where to_days(cb.duty_date) = to_days(now()) and
#{item}
a.deptId in ( select sequence_nbr from cb_org_usr cou where biz_org_name in
</foreach>
<foreach
item=
"item"
index=
"index"
collection=
"bizNames"
open=
"("
separator=
","
close=
")"
>
)) r )
#{item}
</foreach>
)) r )
</select>
</select>
<select
id=
'queryByCompanyNew'
resultType=
"map"
>
<select
id=
'queryByCompanyNew'
resultType=
"map"
>
select biz_org_name as bizOrgName,sequence_nbr sequenceNbr,field_value as telephone, amosUserId,companyName from (
select biz_org_name as bizOrgName, sequence_nbr sequenceNbr, field_value as telephone, amosUserId, companyName
select orgUsr.biz_org_name,i.field_value,orgUsr.sequence_nbr,orgUsr.amos_org_id amosUserId, cou1.biz_org_name companyName
from (
from (select * from cb_org_usr cou where is_delete = 0 ) orgUsr
select orgUsr.biz_org_name,
left join cb_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
i.field_value,
left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
orgUsr.sequence_nbr,
i.instance_id where i.field_code = 'telephone') as d
orgUsr.amos_org_id amosUserId,
where d.sequence_nbr in (
cou1.biz_org_name companyName
select userId from (
from (select * from cb_org_usr cou where is_delete = 0) orgUsr
select cb.duty_date,a.deptId,c.userId from cb_duty_person_shift cb
left join cb_org_usr cou1 on orgUsr.parent_id = cou1.sequence_nbr
left join (select i.instance_id id1 ,if(i.field_code = 'deptId',
left join cb_dynamic_form_instance i on orgUsr.sequence_nbr =
i.field_value, null) as 'deptId' from cb_dynamic_form_instance i
i.instance_id
where i.field_code = 'deptId' and i.field_value is not null) a
where i.field_code = 'telephone') as d
on cb.instance_id = a.id1
where d.sequence_nbr in (
left join (select i.instance_id id3 ,if(i.field_code = 'userId',
select userId
i.field_value, null) as 'userId' from cb_dynamic_form_instance i
from (
where i.field_code = 'userId' and i.field_value is not null) c
select cb.duty_date, a.deptId, c.userId
on cb.instance_id = c.id3
from cb_duty_person_shift cb
where to_days(cb.duty_date) = to_days(now()) and
left join (select i.instance_id id1,
a.deptId in ( select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})) r )
if(i.field_code = 'deptId',
i.field_value, null) as 'deptId'
from cb_dynamic_form_instance i
where i.field_code = 'deptId'
and i.field_value is not null) a
on cb.instance_id = a.id1
left join (select i.instance_id id3,
if(i.field_code = 'userId',
i.field_value, null) as 'userId'
from cb_dynamic_form_instance i
where i.field_code = 'userId'
and i.field_value is not null) c
on cb.instance_id = c.id3
where to_days(cb.duty_date) = to_days(now())
and a.deptId in (select sequence_nbr from cb_org_usr cou where biz_org_name = #{bizOrgName})) r)
</select>
<select
id=
'queryDutyByPersonAndData'
resultType=
"com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto"
>
SELECT
*
FROM
`cb_duty_person_shift`
WHERE
duty_date BETWEEN #{minDate} AND #{maxDate}
AND
instance_id = #{instanceId}
</select>
</select>
</mapper>
</mapper>
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