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());
o.setContractId(contractId);
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 != ''">
and bwedr.id_number = #{idNumber}
</if>
<if test="proId != null and proId != ''">
and bwedr.pro_id = #{proId}
</if>
</where>
ORDER BY bwedr.worker_id
</select>
@ -176,7 +179,7 @@
FROM
bm_att_person a
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
a.att_day &gt;= #{startDate}
AND a.att_day &lt;= #{endDate}
@ -205,7 +208,7 @@
FROM
bm_worker_ein_day_record bwedr
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
WHERE
bwedr.ein_day &gt;= #{startDate}

View File

@ -99,4 +99,13 @@ public interface WorkerJobMapper {
void updateProMonthData(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) {
for (String currentDay : dateList) {
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_name,
bwepr.contract_id,
bwepr.ein_time,
#{currentDay} as ein_day
FROM
bm_worker_ein_pro_record bwepr
@ -45,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bwepr.ein_time DESC
LIMIT 10000000
) aa
ORDER BY ein_time ASC
</select>
<insert id="insertEinDayRecord">
@ -58,6 +60,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</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
bwepr.id,
@ -343,4 +360,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateMonthId">
update tb_pro_month_table_roster set month_id=#{id} where pro_id=#{proId} and month=#{month}
</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>