1.按固定人员考勤、临时人员考勤区分

This commit is contained in:
lSun 2026-02-09 13:12:52 +08:00
parent 7f2fdd3c85
commit 8cdb25e97c
4 changed files with 186 additions and 186 deletions

View File

@ -97,9 +97,9 @@ select count(1) from (
LEFT JOIN pm_organization po ON po.id = bp.company_id and po.is_active = '1' LEFT JOIN pm_organization po ON po.id = bp.company_id and po.is_active = '1'
LEFT JOIN bm_sub_relation bsr1 on bsc.id = bsr1.sub_contract_id and bsr1.type = '1' and bsr1.is_active = '1' LEFT JOIN bm_sub_relation bsr1 on bsc.id = bsr1.sub_contract_id and bsr1.type = '1' and bsr1.is_active = '1'
LEFT JOIN bm_sub_relation bsr2 on bsc.id = bsr2.sub_contract_id and bsr2.type = '2' and bsr2.is_active = '1' LEFT JOIN bm_sub_relation bsr2 on bsc.id = bsr2.sub_contract_id and bsr2.type = '2' and bsr2.is_active = '1'
LEFT JOIN bm_sub_relation bsr3 on bsc.id = bsr3.sub_contract_id and bsr3.type = '3' and bsr3.is_active = '1'
LEFT JOIN sys_user su ON su.id = bsr1.`value` and su.sub_id = bsc.sub_id and su.is_active = '1' LEFT JOIN sys_user su ON su.id = bsr1.`value` and su.sub_id = bsc.sub_id and su.is_active = '1'
LEFT JOIN bm_sub_team bst ON bst.id = bsr3.`value` and bst.is_active = '1'
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bst.id and btur.is_active = '1' and btur.id_number is not null LEFT JOIN bm_team_user_relation btur ON btur.team_id = bst.id and btur.is_active = '1' and btur.id_number is not null
<include refid="where" /> <include refid="where" />
GROUP BY bsc.id GROUP BY bsc.id
@ -115,7 +115,7 @@ select count(1) from (
bsc.is_complete as isComplete, bsc.is_complete as isComplete,
bsc.contract_money as contractMoney, bsc.contract_money as contractMoney,
su.username as principal, su.username as principal,
COUNT(DISTINCT bst.id) as teamNumber,
COUNT(DISTINCT btur.id) as personNumber, COUNT(DISTINCT btur.id) as personNumber,
COUNT(DISTINCT bsr2.id) as fileNumber, COUNT(DISTINCT bsr2.id) as fileNumber,
GROUP_CONCAT(DISTINCT bsr2.`value`) as filePaths, GROUP_CONCAT(DISTINCT bsr2.`value`) as filePaths,
@ -130,9 +130,9 @@ select count(1) from (
LEFT JOIN pm_organization po ON po.id = bp.company_id and po.is_active = '1' LEFT JOIN pm_organization po ON po.id = bp.company_id and po.is_active = '1'
LEFT JOIN bm_sub_relation bsr1 on bsc.id = bsr1.sub_contract_id and bsr1.type = '1' and bsr1.is_active = '1' LEFT JOIN bm_sub_relation bsr1 on bsc.id = bsr1.sub_contract_id and bsr1.type = '1' and bsr1.is_active = '1'
LEFT JOIN bm_sub_relation bsr2 on bsc.id = bsr2.sub_contract_id and bsr2.type = '2' and bsr2.is_active = '1' LEFT JOIN bm_sub_relation bsr2 on bsc.id = bsr2.sub_contract_id and bsr2.type = '2' and bsr2.is_active = '1'
LEFT JOIN bm_sub_relation bsr3 on bsc.id = bsr3.sub_contract_id and bsr3.type = '3' and bsr3.is_active = '1'
LEFT JOIN sys_user su ON su.id = bsr1.`value` and su.sub_id = bsc.sub_id and su.is_active = '1' LEFT JOIN sys_user su ON su.id = bsr1.`value` and su.sub_id = bsc.sub_id and su.is_active = '1'
LEFT JOIN bm_sub_team bst ON bst.id = bsr3.v and bst.is_active = '1'
LEFT JOIN bm_team_user_relation btur ON btur.team_id = bst.id and btur.is_active = '1' and btur.id_number is not null LEFT JOIN bm_team_user_relation btur ON btur.team_id = bst.id and btur.is_active = '1' and btur.id_number is not null
LEFT JOIN bm_worker_ein_history bweh ON bweh.sub_id = bsc.sub_id AND bweh.is_active='1' LEFT JOIN bm_worker_ein_history bweh ON bweh.sub_id = bsc.sub_id AND bweh.is_active='1'
<include refid="where" /> <include refid="where" />

View File

@ -24,7 +24,7 @@
`bm_sub_contract` bsc `bm_sub_contract` bsc
LEFT JOIN bm_project bp on bp.id = bsc.pro_id and bp.is_active = '1' LEFT JOIN bm_project bp on bp.id = bsc.pro_id and bp.is_active = '1'
LEFT JOIN bm_subcontractor bs on bs.id = bsc.sub_id and bs.is_active = '1' LEFT JOIN bm_subcontractor bs on bs.id = bsc.sub_id and bs.is_active = '1'
LEFT JOIN bm_sub_team bst ON bst.sub_id = bst.bs.id AND bst.is_active = '1' LEFT JOIN bm_sub_team bst ON bst.sub_id = bs.id AND bst.is_active = '1'
LEFT JOIN t_dict td ON td.type = 'monthcheck' and td.is_active = '1' LEFT JOIN t_dict td ON td.type = 'monthcheck' and td.is_active = '1'
LEFT JOIN fbeva_core_person_evalu fcpe ON fcpe.eva_month = td.`value` AND bsc.id = fcpe.contract_id and fcpe.eva_year = #{params.year} LEFT JOIN fbeva_core_person_evalu fcpe ON fcpe.eva_month = td.`value` AND bsc.id = fcpe.contract_id and fcpe.eva_year = #{params.year}
@ -53,7 +53,7 @@
`bm_sub_contract` bsc `bm_sub_contract` bsc
LEFT JOIN bm_project bp on bp.id = bsc.pro_id and bp.is_active = '1' LEFT JOIN bm_project bp on bp.id = bsc.pro_id and bp.is_active = '1'
LEFT JOIN bm_subcontractor bs on bs.id = bsc.sub_id and bs.is_active = '1' LEFT JOIN bm_subcontractor bs on bs.id = bsc.sub_id and bs.is_active = '1'
LEFT JOIN bm_sub_team bst ON bst.sub_id = bst.bs.id AND bst.is_active = '1' LEFT JOIN bm_sub_team bst ON bst.sub_id = bs.id AND bst.is_active = '1'
LEFT JOIN t_dict td ON td.type = 'monthcheck' and td.is_active = '1' LEFT JOIN t_dict td ON td.type = 'monthcheck' and td.is_active = '1'
LEFT JOIN fbeva_core_person_evalu fcpe ON fcpe.eva_month = td.`value` AND bsc.id = fcpe.contract_id and fcpe.eva_year = #{params.year} LEFT JOIN fbeva_core_person_evalu fcpe ON fcpe.eva_month = td.`value` AND bsc.id = fcpe.contract_id and fcpe.eva_year = #{params.year}

View File

@ -22,7 +22,8 @@
LEFT JOIN bm_subcontractor bs on bs.id = bsc.sub_id and bs.is_active = '1' LEFT JOIN bm_subcontractor bs on bs.id = bsc.sub_id and bs.is_active = '1'
LEFT JOIN bm_sub_relation bsr ON bsr.sub_contract_id = bsc.id AND bsr.type = '1' and bsr.is_active = '1' LEFT JOIN bm_sub_relation bsr ON bsr.sub_contract_id = bsc.id AND bsr.type = '1' and bsr.is_active = '1'
LEFT JOIN t_dict td ON td.type = 'monthcheck' and td.is_active = '1' LEFT JOIN t_dict td ON td.type = 'monthcheck' and td.is_active = '1'
LEFT JOIN fbeva_sub_project fcpe ON fcpe.eva_month = td.`value` AND bsc.id = fcpe.contract_id and fcpe.eva_year = #{params.year} LEFT JOIN fbeva_sub_project fcpe ON fcpe.eva_month = td.`value` AND bsc.id = fcpe.contract_id and fcpe.eva_year
= #{params.year}
LEFT JOIN sys_user su on su.id = bsr.`value` and su.is_active = '1' LEFT JOIN sys_user su on su.id = bsr.`value` and su.is_active = '1'
WHERE bsc.is_active = '1' and td.`value` = #{params.month} WHERE bsc.is_active = '1' and td.`value` = #{params.month}
<if test="params != null and params != ''"> <if test="params != null and params != ''">
@ -32,7 +33,6 @@
<if test="params.subName != null and params.subName != ''"> <if test="params.subName != null and params.subName != ''">
AND bsc.contract_name LIKE concat ('%',#{params.subName},'%') AND bsc.contract_name LIKE concat ('%',#{params.subName},'%')
</if> </if>
</if> </if>
GROUP BY bsc.id GROUP BY bsc.id
limit #{offset}, #{limit} limit #{offset}, #{limit}
@ -67,7 +67,6 @@
<if test="params.subName != null and params.subName != ''"> <if test="params.subName != null and params.subName != ''">
AND bsc.contract_name LIKE concat ('%',#{params.subName},'%') AND bsc.contract_name LIKE concat ('%',#{params.subName},'%')
</if> </if>
</if> </if>
</select> </select>
<select id="getPersonNameList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean"> <select id="getPersonNameList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean">
@ -83,11 +82,9 @@
<if test="subName != null and subName != ''"> <if test="subName != null and subName != ''">
AND bs.sub_name LIKE concat ('%',#{subName},'%') AND bs.sub_name LIKE concat ('%',#{subName},'%')
</if> </if>
</select> </select>
<select id="getHeadContentList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean"> <select id="getHeadContentList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean">
select select fsh.eva_id as evaId,
fsh.eva_id as evaId,
head, head,
itemized, itemized,
content, content,
@ -98,8 +95,7 @@
where fsh.type = #{type} where fsh.type = #{type}
</select> </select>
<select id="getPersonScoreList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean"> <select id="getPersonScoreList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean">
select select detail_grade as evaScore,
detail_grade as evaScore,
evaid as evaIds, evaid as evaIds,
reason, reason,
type type
@ -107,13 +103,14 @@
where detail_id = #{uuid} where detail_id = #{uuid}
</select> </select>
<select id="getPersonList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean"> <select id="getPersonList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean">
select select eva_score as evaScore,
eva_score as evaScore,
person_name as personName, person_name as personName,
person_id as personId, person_id as personId,
sub_pro_id as uuid sub_pro_id as uuid
from fbeva_sub_projectdetails from fbeva_sub_projectdetails
where eva_id = #{evaId} and contract_id = #{contractId} and sub_pro_id = #{uuid} where eva_id = #{evaId}
and contract_id = #{contractId}
and sub_pro_id = #{uuid}
</select> </select>
<select id="getRankList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean"> <select id="getRankList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean">
SELECT SELECT
@ -151,38 +148,41 @@
<select id="getRankListCount" resultType="java.lang.Integer"> <select id="getRankListCount" resultType="java.lang.Integer">
SELECT SELECT
count(1) count(1)
FROM (
SELECT
fsp.id as uuid,
bs.id as subId,
bs.sub_name AS subName,
bsc.id AS cid,
bsc.contract_name,
fsp.eva_month as evaMonth,
fsp.eva_score,
COUNT(bs.sub_name) as proNum,
SUM(fsp.eva_score) / COUNT(bs.sub_name) as evaScore,
case WHEN FORMAT(SUM(fsp.eva_score) / COUNT(bs.sub_name),2) > 90 then 1
when FORMAT(SUM(fsp.eva_score) / COUNT(bs.sub_name),2) > 80 then 2
when FORMAT(SUM(fsp.eva_score) / COUNT(bs.sub_name),2) > 60 then 3
when FORMAT(SUM(fsp.eva_score) / COUNT(bs.sub_name),2) &lt; 61 then 4
else 0
End as status
FROM FROM
`bm_sub_contract` bsc bm_subcontractor bs
LEFT JOIN bm_project bp ON bp.id = bsc.pro_id RIGHT JOIN bm_sub_contract bsc ON bsc.sub_id = bs.id
AND bp.is_active = '1' AND bsc.is_active = 1
LEFT JOIN bm_subcontractor bs ON bs.id = bsc.sub_id AND bs.id IS NOT NULL
AND bs.is_active = '1' LEFT JOIN fbeva_sub_project fsp ON fsp.contract_id = bsc.id
LEFT JOIN bm_sub_relation bsr ON bsr.sub_contract_id = bsc.id
AND bsr.type = '1'
AND bsr.is_active = '1'
LEFT JOIN t_dict td ON td.type = 'monthcheck'
AND td.is_active = '1'
LEFT JOIN fbeva_sub_project fcpe ON fcpe.eva_month = td.`value`
AND bsc.id = fcpe.contract_id
AND fcpe.eva_year = #{params.year}
LEFT JOIN sys_user su ON su.id = bsr.`value`
WHERE WHERE
bsc.is_active = '1' bs.id IS NOT NULL
AND td.`value` = #{params.month} and fcpe.eva_date is not null AND fsp.eva_month IS NOT NULL
<if test="params != null and params != ''"> GROUP BY
<if test="params.proId != null and params.proId != ''"> bs.sub_name
AND bp.id =#{params.proId} <if test="params.status != null and params.status != '' ">
</if> having status = #{params.status}
<if test="params.subName != null and params.subName != ''">
AND bsc.contract_name LIKE concat ('%',#{params.subName},'%')
</if>
</if> </if>
) a
</select> </select>
<select id="getMonthRankHistoryList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean"> <select id="getMonthRankHistoryList" resultType="com.bonus.bmw.subeva.entity.SubEvaBean">
SELECT SELECT DISTINCT su.username AS sitePersonInCharge,
DISTINCT
su.username AS sitePersonInCharge,
fsp.id as uuid, fsp.id as uuid,
bp.NAME as proName, bp.NAME as proName,
bs.sub_name AS subName, bs.sub_name AS subName,
@ -201,14 +201,14 @@
left join bm_sub_relation bsr on bsr.sub_contract_id = bsc.id and bsr.type = 1 left join bm_sub_relation bsr on bsr.sub_contract_id = bsc.id and bsr.type = 1
left join sys_user su on su.id = bsr.value left join sys_user su on su.id = bsr.value
left join fbeva_sub_project fsp on fsp.contract_id = bsc.id left join fbeva_sub_project fsp on fsp.contract_id = bsc.id
where bs.id = #{params.subId} and fsp.eva_date is not null where bs.id = #{params.subId}
limit #{offset}, #{limit} and fsp.eva_date is not null
limit #{offset}
, #{limit}
</select> </select>
<select id="getMonthRankHistoryCount" resultType="java.lang.Integer"> <select id="getMonthRankHistoryCount" resultType="java.lang.Integer">
SELECT SELECT COUNT(DISTINCT su.username)
COUNT(DISTINCT su.username) FROM bm_subcontractor bs
FROM
bm_subcontractor bs
LEFT JOIN bm_sub_contract bsc ON bsc.sub_id = bs.id LEFT JOIN bm_sub_contract bsc ON bsc.sub_id = bs.id
LEFT JOIN pm_company pc ON pc.id = bs.org_id LEFT JOIN pm_company pc ON pc.id = bs.org_id
LEFT JOIN bm_project bp ON bp.id = bsc.pro_id LEFT JOIN bm_project bp ON bp.id = bsc.pro_id
@ -217,20 +217,20 @@ FROM
LEFT JOIN sys_user su ON su.id = bsr. LEFT JOIN sys_user su ON su.id = bsr.
VALUE VALUE
LEFT JOIN fbeva_sub_project fsp ON fsp.contract_id = bsc.id LEFT JOIN fbeva_sub_project fsp ON fsp.contract_id = bsc.id
where bs.id =#{params.subId} and fsp.eva_date is not null where bs.id = #{params.subId}
and fsp.eva_date is not null
</select> </select>
<insert id="insertFbevaSubProject" parameterType="com.bonus.bmw.subeva.entity.SubEvaBean"> <insert id="insertFbevaSubProject" parameterType="com.bonus.bmw.subeva.entity.SubEvaBean">
insert into fbeva_sub_project (id,eva_month,eva_score,eva_name,eva_date,contract_id,eva_year,eva_id) insert into fbeva_sub_project (id, eva_month, eva_score, eva_name, eva_date, contract_id, eva_year, eva_id)
values (#{uuid},#{evaMonth},#{evaToal},#{evaName},#{evaDate},#{contractId},#{evaYear},#{evaId}) values (#{uuid}, #{evaMonth}, #{evaToal}, #{evaName}, #{evaDate}, #{contractId}, #{evaYear}, #{evaId})
</insert> </insert>
<insert id="insertFbevaSubProjectdetails" parameterType="com.bonus.bmw.subeva.entity.SubEvaBean"> <insert id="insertFbevaSubProjectdetails" parameterType="com.bonus.bmw.subeva.entity.SubEvaBean">
insert into fbeva_sub_projectdetails(sub_pro_id,eva_id,eva_score,contract_id,person_name,person_id) insert into fbeva_sub_projectdetails(sub_pro_id, eva_id, eva_score, contract_id, person_name, person_id)
values (#{uuid},#{evaId},#{score},#{contractId},#{personName},#{personId}) values (#{uuid}, #{evaId}, #{score}, #{contractId}, #{personName}, #{personId})
</insert> </insert>
<insert id="insertFbevaStantScoredetails" parameterType="com.bonus.bmw.subeva.entity.SubEvaBean"> <insert id="insertFbevaStantScoredetails" parameterType="com.bonus.bmw.subeva.entity.SubEvaBean">
insert into fbeva_stant_scoredetails(detail_grade,grade_time,evaid,type,detail_id,reason) insert into fbeva_stant_scoredetails(detail_grade, grade_time, evaid, type, detail_id, reason)
values (#{score},#{evaDate},#{evaId},#{type},#{uuid},#{reason}) values (#{score}, #{evaDate}, #{evaId}, #{type}, #{uuid}, #{reason})
</insert> </insert>
</mapper> </mapper>