replace into bm_worker(ID_NUMBER,NAME,SEX,ETHNIC,BIRTHDAY,ADDRESS,ISSUEAUTHORITY,SIGN_DATE,EXPIRY_DATE,phone,is_twins,IS_ACTIVE)
values(#{idNumber},#{name},#{gender},#{ethnic},#{birthday},#{address},#{issueAuthority},#{signDate},#{expiryDate},#{phone},#{isTwins},1)
update bm_worker set is_twins = #{idNumber} where id_number = #{isTwins}
replace into bm_worker_record(ID_NUMBER,SUB_ID,ORG_ID,PROJECT_ID,TEAM_ID,POST_ID,EIN_DATE,EIN_TIME,WHETHER_ONJOB,ein_status,IS_ACTIVE)
values(#{idNumber},#{subId},#{orgId},#{proId},#{teamId},#{postId},#{einDate},#{einTime},1,1,1)
replace into bm_worker_attend_history(ID_NUMBER,NAME,ein_time,PROJECT_ID,SUB_ID,ORG_ID,POST_ID,TEAM_ID,IS_ACTIVE, is_short_term)
values(#{idNumber},#{name},#{einTime},#{proId},#{subId},#{orgId},#{postId},#{teamId},1, #{isShortTerm})
replace into bm_worker_photo(ID_NUMBER,FACE_FEATURES,PHOTO_TYPE,PHOTO_PATH,upload_id,upload_date,upload_time,IS_ACTIVE)
values(#{idNumber},#{faceFeature},#{photoType},#{photoPath},#{uploadId},#{einDate},#{einTime},1)
update bm_worker_record set exit_date = #{exitDate},exit_time = #{exitTime},ein_status = 0 where id_number = #{idNumber}
update bm_worker_attend_history set exit_time = #{exitTime},departureAffirmUrl = #{departureAffirmUrl} where id_number = #{idNumber} and project_id = #{proId} and team_id = #{teamId} and exit_time is null;
update sys_user set is_active = 0 where phone = #{phone} and is_active = 1
insert into fc_face_contrast(IMEI,user_id,NAME,ID_NUMBER,PRO_ID,SUB_ID,CURRENT_DAY,ADD_TIME,PHOTO_PATH,UPLOAD_TYPE,IS_SUCCESS,lon,lat,IS_ACTIVE)
values(#{imei},#{userId},#{name},#{idNumber},#{proId},#{subId},#{currentDay},#{addTime},#{photoPath},#{uploadType},1,#{lon},#{lat},1)
insert into fc_face_contrast(IMEI,user_id,NAME,ID_NUMBER,PRO_ID,SUB_ID,CURRENT_DAY,ADD_TIME,PHOTO_PATH,UPLOAD_TYPE,IS_SUCCESS,IS_ACTIVE,
AUDITOR,AUDIT_STATUS,AUDIT_REMARK,AUDIT_TIME,WORK_HOURS,OVER_HOURS)
values('',#{examineUserId},#{name},#{idNumber},#{proId},'0',#{currentDay},#{examineTime},#{path},1,2,1,#{examineUserId},#{examineStatus},#{remark},
#{examineTime},#{workHours},#{overHours})
replace into bm_worker_give(id,name,ID_NUMBER,ORG_ID,PRO_ID,SUB_ID,TEAM_ID,work_type,star_rating,comment,upload_time,upload_date,comment_id)
values(#{id},#{name},#{idNumber},#{orgId},#{proId},#{subId},#{teamId},#{postId},#{level},#{comment},#{uploadTime},#{uploadDate},#{commentId})
insert into bm_subcontractor(SUB_NAME,REPRESENT,RE_CONTACT,NAME,ID_NUMBER,ADDRESS,SIGNING,EFFECTIVE_DATE,ID_CARD_JUST_URL,ID_CARD_BACK_URL,SIGNATURE_URL,SEAL_URL,BUSINESS_URL,SAFETY_URL,UPDATE_TIME,UPLOADER,UPLOAD_TIME,COMPANY_ID)
select #{subName},#{represent},#{phone},#{name},#{idNumber},#{address},#{issueAuthority},#{effectiveDate},#{frontPhoto},#{backPhoto},#{autoGrapPhoto},#{sealPhoto},#{businessPhoto},#{safetyPermitPhoto},#{uploadTime},#{uploadId},#{uploadTime},company_id from pm_organization
where id = #{companyId} and is_active = 1
and NOT EXISTS (SELECT SUB_NAME FROM bm_subcontractor WHERE SUB_NAME = #{subName} and is_active = 1)
UPDATE
bm_worker_contract
SET
auditor = #{auditor},audit_time = #{auditTime},is_audit = #{isAudit},remark = #{remarks}
where
idCard = #{partBIdCard} and id = #{id}
UPDATE
bm_worker_contract_details
SET
legal_seal = #{legalSeal},company_seal = #{companySeal},is_sign = #{isSign}
WHERE part_b_idCard = #{partBIdCard} and contract_id = #{id};
UPDATE
bm_worker_contract
SET
sub_contract_url = #{subPdfUrl}
WHERE idCard = #{partBIdCard} and id = #{id}
insert INTO
bm_worker_contract_details
(
contract_id,
video_url,
part_a,
legal_person,
part_a_idCard,
part_a_phone,
part_a_adress,
part_b,
sex,
part_b_phone,
part_b_idCard,
part_b_adress,
work_type,
work_task,
work_adress,
ver_method,
ver_stand,
effect_date,
other_supply,
role,
part_b_sign,
team_sign,
message,
signing_date,
face_url,
message_time,
short_message
)
VALUES
(
#{id},#{videoUrl},#{partA},#{legalPerson},#{partAIdCard},#{partAPhone},#{partAAdress},#{partB},
#{sex},#{partBPhone},#{partBIdCard},#{partBAdress},#{workType},
#{workTask},#{workAdress},#{verMethod},#{verStand},#{effectDate},
#{otherSupply},#{role},#{partBSign},#{teamSign},#{message},#{signingDate},
#{faceUrl},#{messageTime},#{shortMessage}
)
insert INTO
bm_worker_contract
(
id,
idCard,
name,
post,
effectDate,
contractCode,
role,
contractValidDate,
contractType,
wageApprovedWay,
wageCriterion,
whetherOnJob,
auditor,
audit_time,
is_audit,
remark,
person_contract_url,
pro_id
)
VALUES
(#{id},#{partBIdCard},#{partB},#{workType},#{effectDate},#{code},#{role},#{effectDate},'电子合同',
#{verMethod},#{verStand},'1',#{auditor},#{auditTime},'0',#{remarks},#{personPdfUrl},#{proId})
insert into bm_worker_witness(contract_id,ID_NUMBER,witness_path,witness_type,upload_date,upload_time,upload_id,is_active)
values (#{id},#{idNumber},#{witnessPath},#{witnessType},#{uploadDate},#{uploadTime},#{uploadId},1)
insert into bm_worker_contract(id,idCard,contractCode,role,laborContractType,contractValidDate,contractInvalidDate,contractType,miurInsurance,endowmentInsurance,wageApprovedWay,wageCriterion,whetherOnJob)
values (#{id},#{idNumber},#{contractCode},#{role},#{laborContractType},#{contractValidDate},#{contractInvalidDate},#{contractType},#{miurInsurance},#{endowmentInsurance},#{wageApprovedWay},#{wageCriterion},#{whetherOnJob})
replace into bm_worker_payroll(ID_NUMBER,BANK_CARD,BANK_NAME,ROLL_BANK_NAME,PATH,is_active,upload_time,upload_id,bankAffiliated)
values (#{idNumber},#{bankCard},#{bankName},#{bankRollName},#{path},1,#{uploadTime},#{uploadId},#{bankAffiliated})
replace into bm_worker_witness(ID_NUMBER,witness_path,witness_type,upload_date,upload_time,upload_id,is_active)
values (#{idNumber},#{path},2,#{uploadDate},#{uploadTime},#{uploadId},1)
replace into bm_safeguarding_info(id,owe_company,owe_project,address,apply_user,id_card,phone,owe_start_day,owe_end_day,owe_money,representations_time,upload_user_id,add_time,current_day,is_active,reply_status,reply_content,company_id)
values (#{id},#{oweCompany},#{oweProject},#{address},#{applayUser},#{idCard},#{phone},#{oweStartDay},#{oweEndDay},#{oweMoney},#{representationTime},#{uploadUserId},#{addTime},#{currentDay},1,#{replyStatus},#{replyContent},#{companyId})
replace into bm_safeguarding_photo (id,safeguarding_id,path,`type`,upload_user_id,add_time,current_day,is_active)
values (#{id},#{safeguardingId},#{path},#{type},#{uploadUserId},#{addTime},#{currentDay},1)
update bm_worker_contract set contractCode = #{code},person_contract_url = #{personPdfUrl}
where idCard = #{partBIdCard}
update bm_worker_contract set is_active = 0 where idCard = #{idNumber};
update bm_worker_contract_details set is_active = 0 where part_b_idCard = #{idNumber};
update bm_worker_witness set is_active = 0 where id_number = #{idNumber} and witness_type = 1;
update bm_worker_attend_history set
EXIT_TIME = #{einTime}
where ID_NUMBER = #{idNumber} and EXIT_TIME is null
update bm_worker_record set
is_exit_push = #{status},
exit_push_time = #{nowTime},
exit_push_content = #{result}
where ID_NUMBER = #{id}
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})
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}
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}
update bm_worker_attend_history set is_short_term = 0
where id_number = #{item.idNumber} and EIN_TIME = #{item.einTime}