471 lines
26 KiB
XML
471 lines
26 KiB
XML
<?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">
|
|
<mapper namespace="com.bonus.gzrn.rnbmw.push.dao.information.InformationPushDao">
|
|
|
|
<select id="selectProjectPush" resultType="com.bonus.gzrn.rnbmw.push.entity.project.ProjectAllBean">
|
|
select
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',p.construction_contract_url) as constructionContractUrl,
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/', p.tripartiteAgreementUrl) as tripartiteAgreementUrl,
|
|
p.set_tlement_date as settlementDate,p.set_tlement_cycle as settlementCycle,p.set_tlement_amount as settlementAmount,
|
|
CONCAT('SongBianDianProject',IFNULL(p.pro_old_id,p.id)) as projectId,p.name as projectName,
|
|
p.record_id as recordId,'电力工程' as category,'否' as govInvest,p.isRegistered,address.code as projectAddress,
|
|
p.origin as projectDetailedAddress,p.lon,p.lat,p.status,p.contractSigningDate,
|
|
p.contractPrice,p.start_time as startDate,p.end_time as completeDate,
|
|
p.start_time as planStartDate,p.end_time as planCompleteDate,
|
|
p.pro_leader as linkPersonName,p.pro_leader_phone as linkPersonPhone,
|
|
'电力' as subordinateDepartments,p.isInsurance,p.security_payments as securityPayments,
|
|
p.payment_type as securityPaymentsType,
|
|
p.labourSpecialName,p.labourSpecialPhone,p.labourSpecialIdCard,
|
|
p.payDate,sdd.name as bank,p.account_name as accountName,
|
|
p.open_bank_type as accountType,p.special_bank_type as specialAccountType,
|
|
pay_way as salaryPayChannel,open_bank_number as accountNo,
|
|
bank_name as bankName,account_balance as accountBalance,
|
|
GROUP_CONCAT(DISTINCT IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',bpf.file_path),'http://npm.org/123.jpg')) as securityPaymentsExemptUrl,
|
|
GROUP_CONCAT(DISTINCT IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',bpf1.file_path),'http://npm.org/123.jpg')) as safeguardCertificateUrl,
|
|
orgGeneralContractor.project_manager as orgProjectManager,orgGeneralContractor.project_manager_id_card_num as orgProjectManagerIdCardNum,
|
|
orgGeneralContractor.project_manager_phone as orgProjectManagerPhone,orgGeneralContractor.project_manager_approach_date as orgApproachDate,
|
|
orgGeneralContractor.principalName as orgPrincipalName, orgGeneralContractor.principalNamePhone as orgPrincipalNamePhone,
|
|
orgGeneralContractor.principalNameIdCardNum as orgPrincipalNameIdCardNum, orgGeneralContractor.constructionStatus as orgConstructionStatus,
|
|
orgGeneralContractor.legalPersonName as orgLegalPersonName, orgGeneralContractor.legalPersonIdCard as orgLegalPersonIdCard,
|
|
orgGeneralContractor.legalPersonPhone as orgLegalPersonPhone, orgGeneralContractor.orgType as orgOrgType,
|
|
orgGeneralContractor.registerCapital as orgRegisterCapital, orgGeneralContractor.registerAddressCode as orgRegisterAddressCode,
|
|
orgGeneralContractor.postalCode as orgPostalCode, orgGeneralContractor.laborerPersonName as orgLaborerPersonName,
|
|
orgGeneralContractor.laborerPersonIdCard as orgLaborerPersonIdCard, orgGeneralContractor.laborerPersonPhone as orgLaborerPersonPhone,
|
|
orgGeneralContractor.contactPerson as orgContactPerson, orgGeneralContractor.contactPersonPhone as orgContactPersonPhone,
|
|
orgGeneralContractor.officeAddress as orgOfficeAddress, orgGeneralContractor.registDate as orgRegistDate,
|
|
orgGeneralContractor.org_name as orgName,orgGeneralContractor.org_credit_code as orgCreditCode, orgGeneralContractor.register_address as orgRegisterAddress,
|
|
orgDesign.project_manager as orgDesignProjectManager,orgDesign.project_manager_id_card_num as orgDesignProjectManagerIdCardNum,
|
|
orgDesign.project_manager_phone as orgDesignProjectManagerPhone,orgDesign.org_name as orgDesignName,orgDesign.org_credit_code as orgDesignCreditCode,
|
|
orgDesign.principalName as orgDesignPrincipalName, orgDesign.principalNameIdCardNum as orgDesignPrincipalNameIdCardNum,
|
|
orgDesign.principalNamePhone as orgDesignPrincipalNamePhone, orgDesign.constructionStatus as orgDesignConstructionStatus,
|
|
orgDesign.project_manager_approach_date as orgDesignApproachDate, orgDesign.registerAddressCode as orgDesignRegisterAddressCode,
|
|
orgDesign.legalPersonName as orgDesignLegalPersonName, orgDesign.legalPersonIdCard as orgDesignLegalPersonIdCard,
|
|
orgDesign.legalPersonPhone as orgDesignLegalPersonPhone, orgDesign.register_address as orgDesignRegisterAddress,
|
|
orgOwner.project_manager as orgOwnerProjectManager,orgOwner.project_manager_id_card_num as orgOwnerProjectManagerIdCardNum,
|
|
orgOwner.project_manager_phone as orgOwnerProjectManagerPhone,orgOwner.org_name as orgOwnerName,orgOwner.org_credit_code as orgOwnerCreditCode,
|
|
orgOwner.legalPersonName as orgOwnerLegalPersonName, orgOwner.legalPersonIdCard as orgOwnerLegalPersonIdCard, orgOwner.legalPersonPhone as orgOwnerLegalPersonPhone,
|
|
orgOwner.orgType as orgOwnerOrgType, orgOwner.registerCapital as orgOwnerRegisterCapital, orgOwner.registerAddressCode as orgOwnerRegisterAddressCode,
|
|
orgOwner.postalCode as orgOwnerPostalCode, orgOwner.register_address as orgOwnerRegisterAddress, orgOwner.laborerPersonName as orgOwnerLaborerPersonName,
|
|
orgOwner.laborerPersonIdCard as orgOwnerLaborerPersonIdCard, orgOwner.laborerPersonPhone as orgOwnerLaborerPersonPhone,
|
|
orgOwner.contactPerson as orgOwnerContactPerson, orgOwner.contactPersonPhone as orgOwnerContactPersonPhone,
|
|
orgOwner.officeAddress as orgOwnerOfficeAddress, orgOwner.registDate as orgOwnerRegistDate,
|
|
orgSupervision.project_manager as orgSupervisionProjectManager,orgSupervision.project_manager_id_card_num as orgSupervisionProjectManagerIdCardNum,
|
|
orgSupervision.project_manager_phone as orgSupervisionProjectManagerPhone,orgSupervision.org_name as orgSupervisionName,orgSupervision.org_credit_code as orgSupervisionCreditCode,
|
|
orgSupervision.principalName as orgSupervisionPrincipalName, orgSupervision.principalNameIdCardNum as orgSupervisionPrincipalNameIdCardNum,
|
|
orgSupervision.principalNamePhone as orgSupervisionPrincipalNamePhone, orgSupervision.constructionStatus as orgSupervisionConstructionStatus,
|
|
orgSupervision.project_manager_approach_date as orgSupervisionApproachDate, orgSupervision.registerAddressCode as orgSupervisionRegisterAddressCode,
|
|
orgSupervision.legalPersonName as orgSupervisionLegalPersonName, orgSupervision.legalPersonIdCard as orgSupervisionLegalPersonIdCard,
|
|
orgSupervision.legalPersonPhone as orgSupervisionLegalPersonPhone, orgSupervision.register_address as orgSupervisionRegisterAddress,
|
|
orgSurvey.project_manager as orgSurveyProjectManager,orgSurvey.project_manager_id_card_num as orgSurveyProjectManagerIdCardNum,
|
|
orgSurvey.project_manager_phone as orgSurveyProjectManagerPhone,orgSurvey.org_name as orgSurveyName,orgSurvey.org_credit_code as orgSurveyCreditCode,
|
|
orgSurvey.principalName as orgSurveyPrincipalName, orgSurvey.principalNameIdCardNum as orgSurveyPrincipalNameIdCardNum,
|
|
orgSurvey.principalNamePhone as orgSurveyPrincipalNamePhone, orgSurvey.constructionStatus as orgSurveyConstructionStatus,
|
|
orgSurvey.project_manager_approach_date as orgSurveyApproachDate, orgSurvey.registerAddressCode as orgSurveyRegisterAddressCode,
|
|
orgSurvey.legalPersonName as orgSurveyLegalPersonName, orgSurvey.legalPersonIdCard as orgSurveyLegalPersonIdCard,
|
|
orgSurvey.legalPersonPhone as orgSurveyLegalPersonPhone, orgSurvey.register_address as orgSurveyRegisterAddress
|
|
from bm_project p
|
|
left join bm_project_file bpf on bpf.pro_id = p.id and bpf.accessory_type = 0 and bpf.is_active = '1'
|
|
left join bm_project_file bpf1 on bpf1.pro_id = p.id and bpf1.accessory_type = 1 and bpf1.is_active = '1'
|
|
left join sys_dic_detail address on p.registerAddressCode = address.id
|
|
left join sys_dic_detail sdd on sdd.id = p.bank_account
|
|
left join bm_project_five_parties orgGeneralContractor on orgGeneralContractor.pro_id = p.id and orgGeneralContractor.type = 1 and orgGeneralContractor.is_active = 1
|
|
left join bm_project_five_parties orgDesign on orgDesign.pro_id = p.id and orgDesign.type = 2 and orgDesign.is_active = 1
|
|
left join bm_project_five_parties orgOwner on orgOwner.pro_id = p.id and orgOwner.type = 3 and orgOwner.is_active = 1
|
|
left join bm_project_five_parties orgSupervision on orgSupervision.pro_id = p.id and orgSupervision.type = 4 and orgSupervision.is_active = 1
|
|
left join bm_project_five_parties orgSurvey on orgSurvey.pro_id = p.id and orgSurvey.type = 5 and orgSurvey.is_active = 1
|
|
where p.id = #{proId} /*and p.is_push != '1'*/
|
|
GROUP BY bpf.accessory_type,bpf1.accessory_type
|
|
</select>
|
|
|
|
<update id="updateProjectStatus">
|
|
update bm_project set is_push = #{status},push_time = #{time} where id = #{proId}
|
|
</update>
|
|
|
|
|
|
|
|
<select id="selectAttendance" resultType="com.bonus.gzrn.rnbmw.push.entity.attendance.AttendanceInfoBean">
|
|
select * from (
|
|
SELECT
|
|
ffc.id as id,
|
|
concat('SongBianDianProject', IFNULL(p.pro_old_id,p.id)) as projectId,
|
|
p.NAME AS projectName,
|
|
concat('SongBianDianTeam', bs.id) as teamId,
|
|
bs.NAME AS teamName,
|
|
'贵州送变电有限责任公司' AS orgName,
|
|
'9152000021440270X9' AS orgCreditCode,
|
|
ffc.name,ffc.ID_NUMBER as idCard,
|
|
add_time as attendTime,'人脸识别' as attendWay,
|
|
'入场' as direction,
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',PHOTO_PATH) as swipeRecentPhotos
|
|
from fc_face_contrast ffc
|
|
left join bm_worker_record bwr on ffc.ID_NUMBER = bwr.ID_NUMBER
|
|
left join sys_dic_detail bwt on bwt.id = bwr.POST_ID
|
|
left join bm_project p on bwr.project_id = p.id
|
|
left join bm_sub_team bs on bwr.team_id = bs.id
|
|
left join bm_worker_payroll bwp on bwp.ID_NUMBER = bwr.ID_NUMBER
|
|
where (bwp.ROLL_BANK_NAME is not null or bwp.BANK_NAME is not null)
|
|
and LENGTH(bwr.FOREMAN_IDNUMBER) = 18
|
|
and LENGTH(bwr.PRINCIPAL_IDNUMBER) = 18
|
|
and bwr.ein_status = 1 and bwr.is_ein_push = 1 and bwr.is_exit_push != 1
|
|
and p.is_push = 1
|
|
<if test="currentDay != null and currentDay != ''">
|
|
and ffc.CURRENT_DAY = #{currentDay}
|
|
</if>
|
|
<if test="proId != null and proId != ''">
|
|
and ffc.pro_id = #{proId}
|
|
</if>
|
|
<if test="idCard != null and idCard != ''">
|
|
and ffc.ID_NUMBER = #{idCard}
|
|
</if>
|
|
and ffc.ID_NUMBER is not null and AUDIT_STATUS = '1'
|
|
and ffc.is_push != '1'and bwt.name != '管理人员'
|
|
ORDER BY add_time DESC LIMIT 1000000000
|
|
) a GROUP BY a.idCard
|
|
</select>
|
|
|
|
<update id="updateAttendanceStatus">
|
|
update fc_face_contrast set is_push = #{status},push_time = #{nowTime}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<insert id="uploadWorkerPushHistory">
|
|
<if test='type == "ein"'>
|
|
insert into bm_worker_push_history(id_number,pro_id,team_id,contract_id,ein_push_time)
|
|
values (#{bean.idCard},#{bean.projectId},#{bean.teamId},#{bean.contractId},#{bean.einPushTime})
|
|
</if>
|
|
|
|
<if test='type == "exit"'>
|
|
update bm_worker_push_history set exit_push_time = #{bean.exitPushTime}
|
|
where id_number = #{bean.idCard} and pro_id = #{bean.projectId} and team_id = #{bean.teamId}
|
|
</if>
|
|
|
|
<if test='type == "contract"'>
|
|
update bm_worker_push_history set contract_id = #{bean.contractId},contract_push_time = #{bean.contractPushTime}
|
|
where id_number = #{bean.idCard} and pro_id = #{bean.projectId} and team_id = #{bean.teamId}
|
|
</if>
|
|
</insert>
|
|
|
|
<insert id="uploadOnDutyDeparture">
|
|
insert into bm_worker_on_duty_departure(id_number, pro_id, date, push_content) values
|
|
<foreach item="params" collection="list" separator=",">
|
|
(#{params.idNumber}, #{params.proId}, #{params.date}, #{params.pushContent})
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
<select id="selectContractPushList"
|
|
resultType="com.bonus.gzrn.rnbmw.push.entity.contract.WorkerContractInfoBean">
|
|
select
|
|
concat('SongBianDianProject', IFNULL(p.pro_old_id,p.id)) as projectId,
|
|
p.NAME AS projectName,
|
|
concat('SongBianDianTeam', bst.id) as teamId,
|
|
bst.NAME AS teamName,
|
|
'贵州送变电有限责任公司' AS orgName,
|
|
'9152000021440270X9' AS orgCreditCode,
|
|
IFNULL(bwt.name,'其它') as workType,
|
|
case when
|
|
bwci.contractType = '电子合同' then
|
|
IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',bwci.person_contract_url),
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',bwci.sub_contract_url)) when
|
|
bwci.contractType = '纸质合同' then
|
|
contract.contractPath else 'http://npm.org/123.jpg'
|
|
end as contractAppendix,
|
|
bw.name,bw.ID_NUMBER as idCard,
|
|
bwci.contractCode,
|
|
'务工人员' as role,
|
|
IFNULL(bwci.laborContractType,'以完成一定工作为期限的合同') as laborContractType,
|
|
bwci.contractValidDate as contractStartDate,
|
|
bwci.contractValidDate,bwci.contractType, p.payDate,
|
|
IFNULL(bwci.contractInvalidDate,p.end_time) as contractInvalidDate,
|
|
IFNULL(bwci.miurInsurance,'是') as miurInsurance,
|
|
IFNULL(bwci.endowmentInsurance,'是') as endowmentInsurance,
|
|
bwci.wageApprovedWay,bwci.wageCriterion,'是' as whetherOnJob
|
|
from bm_worker_contract bwci
|
|
left join bm_worker_contract_details bwcd on bwcd.part_b_idCard = bwci.idCard
|
|
left join bm_worker bw on bw.ID_NUMBER = bwci.idCard
|
|
left join bm_worker_record bwr on bwr.ID_NUMBER = bwci.idCard
|
|
left join bm_project p on p.id = bwr.PROJECT_ID
|
|
left join bm_sub_team bst on bst.id = bwr.TEAM_ID
|
|
left join sys_dic_detail bwt on bwt.id = bwr.POST_ID
|
|
left join
|
|
(
|
|
select ID_NUMBER,GROUP_CONCAT(IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',
|
|
witness_path),'http://npm.org/123.jpg')) as contractPath
|
|
from bm_worker_witness where witness_type = 1 GROUP BY ID_NUMBER
|
|
) contract on contract.ID_NUMBER = bwci.idCard
|
|
where bw.name is not null
|
|
and if(bwci.contractType = '电子合同', bwcd.is_sign = '1', bwci.contractType = '纸质合同')
|
|
<if test="projectId != null and projectId != ''">
|
|
and p.id = #{projectId}
|
|
</if>
|
|
<if test="idCard != null and idCard != ''">
|
|
and bwci.idCard = #{idCard}
|
|
</if>
|
|
and bwt.name != '管理人员'
|
|
and bwr.ein_status = 1 and bwr.is_ein_push = 1
|
|
and bwci.is_active = 1
|
|
GROUP BY bwci.idCard
|
|
</select>
|
|
|
|
<update id="updateContractStatus">
|
|
update bm_worker_contract set
|
|
is_push = #{status},
|
|
push_time = #{nowTime},
|
|
push_content = #{result}
|
|
where idCard = #{id} and is_active = 1
|
|
</update>
|
|
<update id="updateWorkerEinStatus">
|
|
update bm_worker_record set
|
|
is_ein_push = #{status},
|
|
ein_push_time = #{nowTime},
|
|
ein_push_content = #{result}
|
|
where ID_NUMBER = #{id}
|
|
</update>
|
|
<update id="updateWorkerExitStatus">
|
|
update bm_worker_record set
|
|
is_exit_push = #{status},
|
|
exit_push_time = #{nowTime},
|
|
exit_push_content = #{result}
|
|
where ID_NUMBER = #{id}
|
|
</update>
|
|
|
|
<select id="selectChangHuiErrorContractList"
|
|
resultType="com.bonus.gzrn.rnbmw.push.entity.contract.WorkerContractInfoBean">
|
|
select
|
|
concat('SongBianDianProject', IFNULL(p.pro_old_id,p.id)) as projectId,
|
|
p.NAME AS projectName,
|
|
concat('SongBianDianTeam', bst.id) as teamId,
|
|
bst.NAME AS teamName,
|
|
'贵州送变电有限责任公司' AS orgName,
|
|
'9152000021440270X9' AS orgCreditCode,
|
|
IFNULL(bwt.name,'其它') as workType,
|
|
case when
|
|
bwci.contractType = '电子合同' then
|
|
IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',bwci.person_contract_url),
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',bwci.sub_contract_url)) when
|
|
bwci.contractType = '纸质合同' then
|
|
contract.contractPath else 'http://npm.org/123.jpg'
|
|
end as contractAppendix,
|
|
bw.name,bw.ID_NUMBER as idCard,
|
|
bwci.contractCode,
|
|
'务工人员' as role,
|
|
IFNULL(bwci.laborContractType,'以完成一定工作为期限的合同') as laborContractType,
|
|
bwci.contractValidDate,bwci.contractType,
|
|
IFNULL(bwci.contractInvalidDate,p.end_time) as contractInvalidDate,
|
|
IFNULL(bwci.miurInsurance,'是') as miurInsurance,
|
|
IFNULL(bwci.endowmentInsurance,'是') as endowmentInsurance,
|
|
bwci.wageApprovedWay,bwci.wageCriterion,'是' as whetherOnJob
|
|
from (
|
|
SELECT
|
|
bwr.ID_NUMBER,
|
|
bwr.PROJECT_ID as PROJECT_ID,
|
|
bwr.TEAM_ID,
|
|
CASE bwc.push_time
|
|
WHEN NULL THEN ''
|
|
ELSE bwc.contractCode END AS contractId,
|
|
bwr.ein_push_time,
|
|
bwr.exit_push_time,
|
|
bwc.push_time AS contractPushTime
|
|
FROM
|
|
bm_worker_record bwr
|
|
left join (
|
|
select * from (
|
|
select * from bm_worker_contract
|
|
where is_push = 1 and is_active = 1
|
|
ORDER BY is_push DESC limit 1000000000
|
|
) a GROUP BY a.idCard
|
|
) bwc on bwc.idCard = bwr.ID_NUMBER
|
|
WHERE
|
|
is_ein_push = 1 and bwc.push_time > '2022-12-03 00:00:00' and ein_push_time < '2022-12-07 18:10:00'
|
|
and PROJECT_ID in (10002,256,258,259,260,261,262,263,265,266,267,269,271,272,273,274,276,281)
|
|
GROUP BY bwr.ID_NUMBER
|
|
) a
|
|
left join bm_worker_contract bwci on a.ID_NUMBER = bwci.idCard
|
|
left join bm_worker_contract_details bwcd on bwcd.part_b_idCard = bwci.idCard
|
|
left join bm_worker bw on bw.ID_NUMBER = bwci.idCard
|
|
left join bm_worker_record bwr on bwr.ID_NUMBER = bwci.idCard
|
|
left join bm_project p on p.id = bwr.PROJECT_ID
|
|
left join bm_sub_team bst on bst.id = bwr.TEAM_ID
|
|
left join sys_dic_detail bwt on bwt.id = bwr.POST_ID
|
|
left join
|
|
(
|
|
select ID_NUMBER,GROUP_CONCAT(IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',
|
|
witness_path),'http://npm.org/123.jpg')) as contractPath
|
|
from bm_worker_witness where witness_type = 1 GROUP BY ID_NUMBER
|
|
) contract on contract.ID_NUMBER = bwci.idCard
|
|
where bw.name is not null
|
|
and if(bwci.contractType = '电子合同', bwcd.is_sign = '1', bwci.contractType = '纸质合同')
|
|
and bwt.name != '管理人员'
|
|
and bwr.ein_status = 1 and bwr.is_ein_push = 1
|
|
and bwci.is_active = 1
|
|
GROUP BY bwci.idCard
|
|
</select>
|
|
<select id="selectWorkerByOnJob" resultType="com.bonus.gzrn.rnbmw.push.entity.person.WorkerOnJob">
|
|
select
|
|
'贵州送变电有限责任公司' AS orgName,
|
|
'9152000021440270X9' AS orgCreditCode,
|
|
concat('SongBianDianProject', IFNULL(p.pro_old_id,p.id)) as projectId,
|
|
p.NAME AS projectName,
|
|
concat('SongBianDianTeam', bst.id) as teamId,
|
|
bst.NAME AS teamName,
|
|
bst.EIN_TIME AS approachDate,
|
|
'是' as whetherOnJob,
|
|
case when
|
|
bwah.is_short_term = 1 then '是' when
|
|
bwah.is_short_term = 0 then '否' else '否'
|
|
end as whetherTempWorker,
|
|
'否' as whetherOnDuty,
|
|
case when
|
|
bwr.TEAM_CAPTAIN = 1 then '是' when
|
|
bwr.TEAM_CAPTAIN = 0 then '否' else '否'
|
|
end as teamCaptain,
|
|
IFNULL(bwt.name,'其它') as workType,
|
|
-- '其它' as workType,
|
|
bwr.EIN_TIME AS entryDate,
|
|
bw.NAME,
|
|
bw.ID_NUMBER AS idCard,
|
|
bw.sex AS gender,
|
|
if(bw.ETHNIC = '穿青人','其他',concat(bw.ETHNIC,'族')) as nation,
|
|
bw.ADDRESS AS address,
|
|
IFNULL(bw.phone,'13800000000') as phone,
|
|
'群众' as politicalFace,
|
|
'不限' as education,
|
|
IFNULL(bw.ISSUEAUTHORITY,'暂无') AS issuingAuthority,
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',face.PHOTO_PATH) AS headPortrait,
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',front.PHOTO_PATH) as frontPhontUrl,
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',back.PHOTO_PATH) AS backPhontUrl,
|
|
'是' AS hasContract,
|
|
'是' AS hasWorkInsurance,
|
|
'是' AS hasAccidentInsurance,
|
|
'是' AS miurInsurance,
|
|
'是' AS endowmentInsurance,
|
|
IFNULL(bwp.BANK_CARD,'无') AS payRollBankCardNum,
|
|
IFNULL(bwp.ROLL_BANK_NAME,'无') AS payRollBankName,
|
|
IFNULL(bwp.BANK_NAME,'无') AS payrollBank,
|
|
IFNULL(bwp.bankAffiliated,'无') AS bankAffiliated,
|
|
IFNULL(bwci.wageApprovedWay,'无') AS wageApprovedWay,
|
|
IFNULL(bwci.wageCriterion,'无') AS wageCriterion,
|
|
IFNULL(bwr.FOREMAN,'无') AS leaderName,
|
|
IFNULL(bwr.FOREMAN_PHONE,'无') AS leaderPhone,
|
|
IFNULL(bwr.FOREMAN_IDNUMBER,'无') AS leaderIdCardNum,
|
|
IFNULL(bwr.PRINCIPAL_NAME,'无') AS principalName,
|
|
IFNULL(bwr.PRINCIPAL_PHONE,'无') AS principalPhone,
|
|
IFNULL(bwr.PRINCIPAL_IDNUMBER,'无') AS principalIdCard
|
|
from bm_worker bw
|
|
left join bm_worker_record bwr on bwr.ID_NUMBER = bw.ID_NUMBER
|
|
LEFT JOIN bm_worker_attend_history bwah ON bwah.ID_NUMBER = bwr.ID_NUMBER
|
|
AND bwah.PROJECT_ID = bwr.PROJECT_ID
|
|
AND bwah.TEAM_ID = bwr.TEAM_ID
|
|
left join bm_project p on p.id = bwr.PROJECT_ID
|
|
left join bm_sub_team bst on bst.ID = bwr.TEAM_ID
|
|
left join sys_dic_detail bwt on bwt.id = bwr.POST_ID
|
|
LEFT JOIN bm_worker_photo front ON front.ID_NUMBER = bw.ID_NUMBER and front.PHOTO_TYPE = 1
|
|
LEFT JOIN bm_worker_photo back ON back.ID_NUMBER = bw.ID_NUMBER and back.PHOTO_TYPE = 2
|
|
LEFT JOIN bm_worker_photo face ON face.ID_NUMBER = bw.ID_NUMBER and face.PHOTO_TYPE = 3
|
|
left join bm_worker_contract bwci on bwci.idCard = bw.ID_NUMBER and bwci.is_active = 1
|
|
left join bm_worker_payroll bwp on bwp.ID_NUMBER = bw.ID_NUMBER
|
|
where (bwp.ROLL_BANK_NAME is not null or bwp.BANK_NAME is not null)
|
|
and LENGTH(bw.ID_NUMBER) = 18
|
|
and LENGTH(bwr.FOREMAN_IDNUMBER) = 18
|
|
and LENGTH(bwr.PRINCIPAL_IDNUMBER) = 18
|
|
and bwt.name != '管理人员'
|
|
-- and bwr.is_ein_push != '1'
|
|
and bwr.ein_status = 1
|
|
and bwr.is_exit_push = '0'
|
|
and bst.id is not null
|
|
<if test="projectId != null and projectId != ''">
|
|
and bwr.PROJECT_ID = #{projectId}
|
|
</if>
|
|
<if test="idCard != null and idCard != ''">
|
|
and bw.ID_NUMBER = #{idCard}
|
|
</if>
|
|
</select>
|
|
<select id="selectWorkerByNoJob" resultType="com.bonus.gzrn.rnbmw.push.entity.person.WorkerNoJob">
|
|
select * from (
|
|
select
|
|
'贵州送变电有限责任公司' AS orgName,
|
|
'9152000021440270X9' AS orgCreditCode,
|
|
concat('SongBianDianProject', IFNULL(p.pro_old_id,p.id)) as projectId,
|
|
p.NAME AS projectName,
|
|
concat('SongBianDianTeam', bst.id) as teamId,
|
|
bst.NAME AS teamName,
|
|
bst.EIN_TIME AS approachDate,
|
|
'否' as whetherOnJob,
|
|
case when
|
|
bwah.is_short_term = 1 then '是' when
|
|
bwah.is_short_term = 0 then '否' else '否'
|
|
end as whetherTempWorker,
|
|
'否' as whetherOnDuty,
|
|
case when
|
|
bwr.TEAM_CAPTAIN = 1 then '是' when
|
|
bwr.TEAM_CAPTAIN = 0 then '否' else '否'
|
|
end as teamCaptain,
|
|
IFNULL(bwt.name,'其它') as workType,
|
|
-- '其它' as workType,
|
|
bwr.EIN_TIME AS entryDate,
|
|
bwr.EXIT_TIME as exitDate,
|
|
IFNULL(CONCAT('http://116.63.142.171:1919/gzrnama/',bwah.departureAffirmUrl),
|
|
'http://npm.org/123.jpg') AS departureAffirmUrl,
|
|
bw.NAME,
|
|
bw.ID_NUMBER AS idCard,
|
|
bw.sex AS gender,
|
|
if(bw.ETHNIC = '穿青人','其他',concat(bw.ETHNIC,'族')) as nation,
|
|
bw.ADDRESS AS address,
|
|
IFNULL(bw.phone,'13800000000') as phone,
|
|
'群众' as politicalFace,
|
|
'不限' as education,
|
|
IFNULL(bw.ISSUEAUTHORITY,'暂无') AS issuingAuthority,
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',face.PHOTO_PATH) AS headPortrait,
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',front.PHOTO_PATH) as frontPhontUrl,
|
|
CONCAT('http://116.63.142.171:1919/gzrnama/',back.PHOTO_PATH) AS backPhontUrl,
|
|
'是' AS hasContract,
|
|
'是' AS hasWorkInsurance,
|
|
'是' AS hasAccidentInsurance,
|
|
'是' AS miurInsurance,
|
|
'是' AS endowmentInsurance,
|
|
IFNULL(bwp.BANK_CARD,'无') AS payRollBankCardNum,
|
|
IFNULL(bwp.ROLL_BANK_NAME,'无') AS payRollBankName,
|
|
IFNULL(bwp.BANK_NAME,'无') AS payrollBank,
|
|
-- IFNULL(bwp.bankAffiliated,'无') AS bankAffiliated,
|
|
IFNULL(bwci.wageApprovedWay,'无') AS wageApprovedWay,
|
|
IFNULL(bwci.wageCriterion,'无') AS wageCriterion,
|
|
IFNULL(bwr.FOREMAN,'无') AS leaderName,
|
|
IFNULL(bwr.FOREMAN_PHONE,'无') AS leaderPhone,
|
|
IFNULL(bwr.FOREMAN_IDNUMBER,'无') AS leaderIdCardNum,
|
|
IFNULL(bwr.PRINCIPAL_NAME,'无') AS principalName,
|
|
IFNULL(bwr.PRINCIPAL_PHONE,'无') AS principalPhone,
|
|
IFNULL(bwr.PRINCIPAL_IDNUMBER,'无') AS principalIdCard
|
|
from bm_worker bw
|
|
left join bm_worker_record bwr on bwr.ID_NUMBER = bw.ID_NUMBER
|
|
LEFT JOIN bm_worker_attend_history bwah ON bwah.ID_NUMBER = bwr.ID_NUMBER
|
|
AND bwah.PROJECT_ID = bwr.PROJECT_ID
|
|
AND bwah.TEAM_ID = bwr.TEAM_ID
|
|
left join bm_project p on p.id = bwr.PROJECT_ID
|
|
left join bm_sub_team bst on bst.ID = bwr.TEAM_ID
|
|
left join sys_dic_detail bwt on bwt.id = bwr.POST_ID
|
|
LEFT JOIN bm_worker_photo front ON front.ID_NUMBER = bw.ID_NUMBER and front.PHOTO_TYPE = 1
|
|
LEFT JOIN bm_worker_photo back ON back.ID_NUMBER = bw.ID_NUMBER and back.PHOTO_TYPE = 2
|
|
LEFT JOIN bm_worker_photo face ON face.ID_NUMBER = bw.ID_NUMBER and face.PHOTO_TYPE = 3
|
|
left join bm_worker_contract bwci on bwci.idCard = bw.ID_NUMBER -- and bwci.is_active = 1
|
|
left join bm_worker_payroll bwp on bwp.ID_NUMBER = bw.ID_NUMBER
|
|
where (bwp.ROLL_BANK_NAME is not null or bwp.BANK_NAME is not null)
|
|
and LENGTH(bw.ID_NUMBER) = 18
|
|
and LENGTH(bwr.FOREMAN_IDNUMBER) = 18
|
|
and LENGTH(bwr.PRINCIPAL_IDNUMBER) = 18
|
|
and bwt.name != '管理人员' and bst.id is not null
|
|
-- and bwr.is_exit_push != '1'
|
|
and bwr.is_ein_push = 1
|
|
and bwci.wageApprovedWay is not null
|
|
and CHAR_LENGTH(bwp.ROLL_BANK_NAME) >= 6 and bwr.ein_status = 0
|
|
<if test="projectId != null and projectId != ''">
|
|
and bwr.PROJECT_ID = #{projectId}
|
|
</if>
|
|
<if test="idCard != null and idCard != ''">
|
|
and bw.ID_NUMBER = #{idCard}
|
|
</if>
|
|
order by bwci.upload_time limit 99999999
|
|
) a GROUP BY a.idCard
|
|
</select>
|
|
</mapper> |