bug修改

This commit is contained in:
方亮 2025-10-21 19:41:24 +08:00
parent 12bdc77002
commit 7a1556ba5a
5 changed files with 82 additions and 7 deletions

View File

@ -269,7 +269,17 @@ public class PmWorkerServiceImpl implements PmWorkerService{
Integer contractId = mapper.getContractIdByWorkerId(o.getId()); Integer contractId = mapper.getContractIdByWorkerId(o.getId());
o.setContractId(contractId); o.setContractId(contractId);
addEinRecord(o); addEinRecord(o);
return AjaxResult.success("添加成功"); StringBuilder sb = new StringBuilder();
//下发人脸到考勤机
try {
urkSendService.sendUserToDevice(o.getId(),o.getProId(),o.getSubId(), o.getTeamId(),"0");
sb.append("新增工程入场成功,人员下发考勤机成功--");
return AjaxResult.success(sb.toString());
} catch (Exception e) {
log.error("人员下发考勤机失败:",e);
sb.append("人员下发考勤机失败--");
return AjaxResult.error(sb.toString());
}
} }
/** /**

View File

@ -165,6 +165,9 @@
<if test="idNumber != null and idNumber != ''"> <if test="idNumber != null and idNumber != ''">
and bwedr.id_number = #{idNumber} and bwedr.id_number = #{idNumber}
</if> </if>
<if test="proId != null and proId != ''">
and bwedr.pro_id = #{proId}
</if>
</where> </where>
ORDER BY bwedr.worker_id ORDER BY bwedr.worker_id
</select> </select>
@ -176,15 +179,15 @@
FROM FROM
bm_att_person a bm_att_person a
INNER JOIN bm_worker_ein_day_record e ON a.worker_id = e.worker_id INNER JOIN bm_worker_ein_day_record e ON a.worker_id = e.worker_id
AND a.att_day = e.ein_day AND a.att_day = e.ein_day and a.pro_id = e.pro_id
WHERE WHERE
a.att_day &gt;= #{startDate} a.att_day &gt;= #{startDate}
AND a.att_day &lt;= #{endDate} AND a.att_day &lt;= #{endDate}
<if test="proId != null and proId != ''"> <if test="proId != null and proId != ''">
and a.pro_id = #{proId} and a.pro_id = #{proId}
</if> </if>
<if test="teamId != null and teamId != ''"> <if test="teamId != null and teamId != ''">
and a.team_id = #{teamId} and a.team_id = #{teamId}
</if> </if>
GROUP BY GROUP BY
a.worker_id a.worker_id
@ -205,7 +208,7 @@
FROM FROM
bm_worker_ein_day_record bwedr bm_worker_ein_day_record bwedr
LEFT JOIN bm_att_person bap ON bwedr.worker_id = bap.worker_id LEFT JOIN bm_att_person bap ON bwedr.worker_id = bap.worker_id
AND bap.att_day = bwedr.ein_day AND bap.att_day = bwedr.ein_day and bwedr.pro_id = bap.pro_id
left join pm_worker pw on bwedr.worker_id = pw.id left join pm_worker pw on bwedr.worker_id = pw.id
WHERE WHERE
bwedr.ein_day &gt;= #{startDate} bwedr.ein_day &gt;= #{startDate}

View File

@ -99,4 +99,13 @@ public interface WorkerJobMapper {
void updateProMonthData(AttProMonthPo attProMonthPo); void updateProMonthData(AttProMonthPo attProMonthPo);
void updateMonthId(AttProMonthPo attProMonthPo); void updateMonthId(AttProMonthPo attProMonthPo);
/**
* 获取人员考勤记录
* @param currentDay
* @return
*/
List<PmWorkerJob> getNotAttWorker(String currentDay);
int updateWorkerEinDayRecord(List<PmWorkerJob> matchedWorkers);
} }

View File

@ -43,8 +43,32 @@ public class WorkerEinDayRecordTask{
private void updateWorkerEinDayRecord(List<String> dateList) { private void updateWorkerEinDayRecord(List<String> dateList) {
for (String currentDay : dateList) { for (String currentDay : dateList) {
List<PmWorkerJob> workerList = mapper.getWorkerEinDayRecord(currentDay); List<PmWorkerJob> workerList = mapper.getWorkerEinDayRecord(currentDay);
if (!workerList.isEmpty()) { //如果这个人没换工程换了分包或班组没打卡想在新分包换班组打卡会打不上
mapper.insertEinDayRecord(workerList); //执行时将未打卡的人数据更新一下
//已记录入场,未打卡的人员
List<PmWorkerJob> workerEinDayRecord = mapper.getNotAttWorker(currentDay);
// 分成两个list匹配和不匹配
List<PmWorkerJob> matchedWorkers = new ArrayList<>();
List<PmWorkerJob> unmatchedWorkers = new ArrayList<>();
for (PmWorkerJob worker : workerList) {
boolean isMatched = false;
for (PmWorkerJob notAttWorker : workerEinDayRecord) {
if (worker.getWorkerId().equals(notAttWorker.getWorkerId())
&& worker.getProId().equals(notAttWorker.getProId())) {
matchedWorkers.add(worker);
isMatched = true;
break;
}
}
if (!isMatched) {
unmatchedWorkers.add(worker);
}
}
if (!unmatchedWorkers.isEmpty()) {
mapper.insertEinDayRecord(unmatchedWorkers);
}
if (!matchedWorkers.isEmpty()) {
mapper.updateWorkerEinDayRecord(matchedWorkers);
} }
} }
} }

View File

@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bwepr.post_id, bwepr.post_id,
bwepr.post_name, bwepr.post_name,
bwepr.contract_id, bwepr.contract_id,
bwepr.ein_time,
#{currentDay} as ein_day #{currentDay} as ein_day
FROM FROM
bm_worker_ein_pro_record bwepr bm_worker_ein_pro_record bwepr
@ -45,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bwepr.ein_time DESC bwepr.ein_time DESC
LIMIT 10000000 LIMIT 10000000
) aa ) aa
ORDER BY ein_time ASC
</select> </select>
<insert id="insertEinDayRecord"> <insert id="insertEinDayRecord">
@ -58,6 +60,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</insert> </insert>
<update id="updateWorkerEinDayRecord">
<foreach item="item" collection="list" index="index" separator=";">
update bm_worker_ein_day_record
set sub_id = #{item.subId},
sub_name = #{item.subName},
team_id = #{item.teamId},
team_name = #{item.teamName},
post_id = #{item.postId},
post_name = #{item.postName},
contract_id = #{item.contractId}
where worker_id = #{item.workerId} and pro_id = #{item.proId} and ein_day = #{item.einDay}
</foreach>
</update>
<select id="getWorkerExitThan30Day" resultType="com.bonus.job.domain.BmWorkerBlackJob"> <select id="getWorkerExitThan30Day" resultType="com.bonus.job.domain.BmWorkerBlackJob">
SELECT SELECT
bwepr.id, bwepr.id,
@ -343,4 +360,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateMonthId"> <update id="updateMonthId">
update tb_pro_month_table_roster set month_id=#{id} where pro_id=#{proId} and month=#{month} update tb_pro_month_table_roster set month_id=#{id} where pro_id=#{proId} and month=#{month}
</update> </update>
<select id="getNotAttWorker" resultType="com.bonus.job.domain.PmWorkerJob">
SELECT
d.pro_id,
d.worker_id
FROM
bm_worker_ein_day_record d
left join bm_att_person b on d.pro_id = b.pro_id and d.sub_id = b.sub_id and d.team_id = b.team_id and d.worker_id = b.worker_id and d.ein_day = b.att_day
where d.ein_day = #{currentDay} and b.att_day is null
</select>
</mapper> </mapper>