定时器修改

This commit is contained in:
方亮 2025-10-23 20:19:37 +08:00
parent 79a8afe6c0
commit 733c6b378b
6 changed files with 58 additions and 17 deletions

View File

@ -63,7 +63,7 @@ public class TokenService {
*/ */
public Map<String, Object> createToken(LoginUser loginUser) { public Map<String, Object> createToken(LoginUser loginUser) {
// 检查并删除已有的token // 检查并删除已有的token
if (!isWindows() || !"admin".equals(loginUser.getSysUser().getUserName())) { if (!isWindows() || !"admin".equals(loginUser.getSysUser().getUserName()) || !"15955147004".equals(loginUser.getSysUser().getUserName())) {
delExistingToken(loginUser.getSysUser().getUserId()); delExistingToken(loginUser.getSysUser().getUserId());
} }
String token = IdUtils.fastUUID(); String token = IdUtils.fastUUID();

View File

@ -114,7 +114,7 @@ public class PmWorkerServiceImpl implements PmWorkerService{
//判断是否上传base64人脸优先base64 //判断是否上传base64人脸优先base64
if(StringUtils.isNotEmpty(record.getFacePhotoBase64())){ if(StringUtils.isNotEmpty(record.getFacePhotoBase64())){
//人脸的数据添加 //人脸的数据添加
UploadFileVo uploadFileVo = fileUploadUtils.uploadBast64(record.getFacePhotoBase64(), Constants.FILE_UPLOAD_WORKER, record.getId().toString(), "人脸照片","", ""); UploadFileVo uploadFileVo = fileUploadUtils.uploadBast64(record.getFacePhotoBase64(), Constants.FILE_UPLOAD_WORKER, record.getId().toString(), "1","", "");
uploadFileVos.add(uploadFileVo); uploadFileVos.add(uploadFileVo);
isBase64 = true; isBase64 = true;
}else{ }else{
@ -313,7 +313,7 @@ public class PmWorkerServiceImpl implements PmWorkerService{
MultipartFile facePhoto = null; MultipartFile facePhoto = null;
if(record.getFacePhotoBase64() != null){ if(record.getFacePhotoBase64() != null){
//判断是否上传base64人脸优先base64 //判断是否上传base64人脸优先base64
UploadFileVo uploadFileVo = fileUploadUtils.uploadBast64(record.getFacePhotoBase64(), Constants.FILE_UPLOAD_WORKER, record.getId().toString(), "人脸照片","", ""); UploadFileVo uploadFileVo = fileUploadUtils.uploadBast64(record.getFacePhotoBase64(), Constants.FILE_UPLOAD_WORKER, record.getId().toString(), "1","", "");
uploadFileVos.add(uploadFileVo); uploadFileVos.add(uploadFileVo);
isBase64 = true; isBase64 = true;
}else{ }else{

View File

@ -112,18 +112,17 @@
FROM FROM
tb_pro_month_table pp tb_pro_month_table pp
WHERE WHERE
pp.pro_id = #{proId} pp.pro_id = #{proId} and pp.status = 2
</select> </select>
<select id="getWorkerSalaryNum" resultType="int"> <select id="getWorkerSalaryNum" resultType="int">
SELECT SELECT
count(distinct pp.user_id) AS workerSalaryNum count(distinct pp.user_id) AS workerSalaryNum
FROM FROM
tb_pro_month_table_roster pp tb_pro_month_table_roster pp
inner join tb_pro_month_table tbmt on tbmt.id = pp.month_id
WHERE WHERE
pp.pro_id = #{proId} pp.pro_id = #{proId} and tbmt.status = 2
</select> </select>
<select id="getProSubMsg" resultType="com.bonus.bmw.domain.vo.HomePageSubProVo"> <select id="getProSubMsg" resultType="com.bonus.bmw.domain.vo.HomePageSubProVo">

View File

@ -105,7 +105,11 @@ public interface WorkerJobMapper {
* @param currentDay * @param currentDay
* @return * @return
*/ */
List<PmWorkerJob> getNotAttWorker(String currentDay); List<PmWorkerJob> getAttWorker(String currentDay);
int updateWorkerEinDayRecord(List<PmWorkerJob> matchedWorkers); int updateWorkerEinDayRecord(List<PmWorkerJob> matchedWorkers);
List<PmWorkerJob> getNoContractWorker();
void updateWorkerContractByList(List<PmWorkerJob> list);
} }

View File

@ -35,6 +35,20 @@ public class WorkerEinDayRecordTask{
dateList.add(startDate); dateList.add(startDate);
//更新指定日期的记录 //更新指定日期的记录
updateWorkerEinDayRecord(dateList); updateWorkerEinDayRecord(dateList);
updateWorkerContract();
}catch (Exception e){
logger.error("人员入场更新表失败,{}",e.getMessage());
}
}
/**
* 不传更新当天
*/
public void updateWorkerContract(){
try{
List<PmWorkerJob> list = mapper.getNoContractWorker();
//更新指定日期的记录
mapper.updateWorkerContractByList(list);
}catch (Exception e){ }catch (Exception e){
logger.error("人员入场更新表失败,{}",e.getMessage()); logger.error("人员入场更新表失败,{}",e.getMessage());
} }
@ -46,15 +60,15 @@ public class WorkerEinDayRecordTask{
//如果这个人没换工程换了分包或班组没打卡想在新分包换班组打卡会打不上 //如果这个人没换工程换了分包或班组没打卡想在新分包换班组打卡会打不上
//执行时将未打卡的人数据更新一下 //执行时将未打卡的人数据更新一下
//已记录入场,未打卡的人员 //已记录入场,未打卡的人员
List<PmWorkerJob> workerEinDayRecord = mapper.getNotAttWorker(currentDay); List<PmWorkerJob> workerEinDayRecord = mapper.getAttWorker(currentDay);
// 分成两个list匹配和不匹配 // 分成两个list匹配和不匹配
List<PmWorkerJob> matchedWorkers = new ArrayList<>(); List<PmWorkerJob> matchedWorkers = new ArrayList<>();
List<PmWorkerJob> unmatchedWorkers = new ArrayList<>(); List<PmWorkerJob> unmatchedWorkers = new ArrayList<>();
for (PmWorkerJob worker : workerList) { for (PmWorkerJob worker : workerList) {
boolean isMatched = false; boolean isMatched = false;
for (PmWorkerJob notAttWorker : workerEinDayRecord) { for (PmWorkerJob attWorker : workerEinDayRecord) {
if (worker.getWorkerId().equals(notAttWorker.getWorkerId()) if (worker.getWorkerId().equals(attWorker.getWorkerId())
&& worker.getProId().equals(notAttWorker.getProId())) { && worker.getProId().equals(attWorker.getProId())) {
matchedWorkers.add(worker); matchedWorkers.add(worker);
isMatched = true; isMatched = true;
break; break;
@ -67,9 +81,10 @@ public class WorkerEinDayRecordTask{
if (!unmatchedWorkers.isEmpty()) { if (!unmatchedWorkers.isEmpty()) {
mapper.insertEinDayRecord(unmatchedWorkers); mapper.insertEinDayRecord(unmatchedWorkers);
} }
if (!matchedWorkers.isEmpty()) { //打卡的人无需更新入场了
mapper.updateWorkerEinDayRecord(matchedWorkers); // if (!matchedWorkers.isEmpty()) {
} // mapper.updateWorkerEinDayRecord(matchedWorkers);
// }
} }
} }

View File

@ -361,15 +361,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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 id="getAttWorker" resultType="com.bonus.job.domain.PmWorkerJob">
SELECT SELECT
d.pro_id, d.pro_id,
d.worker_id d.worker_id
FROM FROM
bm_worker_ein_day_record d 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 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 where d.ein_day = #{currentDay} and b.att_day is not null
</select> </select>
<select id="getNoContractWorker" resultType="com.bonus.job.domain.PmWorkerJob">
SELECT
aa.worker_id,
bb.id as contract_id
from
(
SELECT
DISTINCT
worker_id
FROM
bm_worker_ein_day_record
WHERE
contract_id IS NULL) aa
LEFT JOIN bm_worker_contract bb ON aa.worker_id = bb.worker_id and bb.is_active = 1
WHERE bb.id is not null
GROUP BY aa.worker_id
</select>
<update id="updateWorkerContractByList">
<foreach item="item" collection="list" index="index" separator=";">
update bm_worker_ein_day_record set contract_id = #{item.contractId} where worker_id = #{item.workerId} and contract_id is null
</foreach>
</update>
</mapper> </mapper>