修改假期,节假日定时器
This commit is contained in:
parent
e4b0c3ad72
commit
a743cb9cd1
|
|
@ -10,6 +10,7 @@ import com.bonus.system.att.dao.AttSourceDataDao;
|
|||
import com.bonus.system.att.entity.*;
|
||||
import com.bonus.system.att.utils.AddressCoordinateFormatUtil;
|
||||
import com.bonus.system.att.utils.WorkdayCalculator;
|
||||
import com.bonus.system.holiday.dao.HolidayDao;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
|
|
@ -54,6 +55,9 @@ public class AttTasks {
|
|||
@Resource(name = "attGroupDao")
|
||||
private AttGroupDao attGroupDao;
|
||||
|
||||
@Resource(name = "HolidayDao")
|
||||
private HolidayDao holidayDao;
|
||||
|
||||
|
||||
private static final int BATCH_SIZE = 10; // 每批次处理的日期数量
|
||||
private static final int THREAD_POOL_SIZE = 5; // 线程池大小
|
||||
|
|
@ -72,7 +76,7 @@ public class AttTasks {
|
|||
/**
|
||||
* 历史考勤数据
|
||||
*/
|
||||
// @Scheduled(initialDelay = 6000 * 4,fixedDelay = 60000 * 30)
|
||||
// @Scheduled(initialDelay = 6000,fixedDelay = 60000 * 30)
|
||||
@Async
|
||||
public void getHisAttTasks() {
|
||||
log.info("--------考勤定时器开启------");
|
||||
|
|
@ -80,8 +84,8 @@ public class AttTasks {
|
|||
return; // 如果任务已经执行过,直接返回
|
||||
}
|
||||
executed = true; // 设置标志位,表示任务已经执行过
|
||||
String startDate = "2024-12-26";
|
||||
String endDate = "2024-12-26";
|
||||
String startDate = "2024-12-21";
|
||||
String endDate = "2024-12-21";
|
||||
List<String> dateList = getStrDateListBetween(startDate, endDate);
|
||||
// List<String> dateList = new ArrayList<>();
|
||||
// dateList.add("2024-10-18");
|
||||
|
|
@ -283,11 +287,16 @@ public class AttTasks {
|
|||
*/
|
||||
private void threadLeaveData(LeaveBean c, String pushDate) {
|
||||
//1.将请假区间变成日期集合
|
||||
// if(c.getUserId() == 879L){
|
||||
// System.out.println("徐军");
|
||||
// }
|
||||
List<String> dateList = getStrDateListBetween(c.getLeaveStartDate(), c.getLeaveEndDate());
|
||||
if (!dateList.isEmpty()) {
|
||||
if(c.getUserId() == 263){
|
||||
System.out.println("米娜");
|
||||
}
|
||||
List<String> dateLists = getStrDateListBetween(c.getLeaveStartDate(), c.getLeaveEndDate());
|
||||
if (!dateLists.isEmpty()) {
|
||||
//根据开始时间、结束时间获取节假日的日期集合
|
||||
List<String> holidayList = holidayDao.getHolidayDataByType(c.getLeaveStartDate(), c.getLeaveEndDate());
|
||||
// 使用Stream API去除A中包含在B中的元素
|
||||
List<String> dateList = dateLists.stream().filter(element -> !holidayList.contains(element)).collect(Collectors.toList());
|
||||
|
||||
dateList.forEach(v -> {
|
||||
boolean tf = false;
|
||||
AttDataBean toWorkBean = new AttDataBean(v, c.getAttStatus(), "1",
|
||||
|
|
|
|||
|
|
@ -86,4 +86,6 @@ public interface HolidayDao {
|
|||
* @return
|
||||
*/
|
||||
List<HolidayImportBean> getHolidayData(LocalDate previousMonthDate);
|
||||
|
||||
List<String> getHolidayDataByType(@Param("startDate") String leaveStartDate,@Param("endDate") String leaveEndDate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
leave_end_interval,
|
||||
</if>
|
||||
leave_duration, source, create_user_id, is_agree, location, host_user_id,host_user_name, remark,examine_status)
|
||||
VALUES (#{userId}, #{userName}, #{orgId}, #{orgName}, '休假' , #{type}, #{leaveReason},
|
||||
VALUES (#{userId}, #{userName}, #{orgId}, #{orgName}, '请假' , #{type}, #{leaveReason},
|
||||
#{leaveStartDate},
|
||||
<if test="leaveStartInterval != null">
|
||||
#{leaveStartInterval},
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
LEFT JOIN sys_user_post p ON p.user_id = l.user_id
|
||||
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
|
||||
WHERE
|
||||
l.is_active = '1' AND l.leave_type = '休假' AND l.source = '1'
|
||||
l.is_active = '1' AND l.type = '请假' AND l.source = '1'
|
||||
<if test='params.userId != null '>
|
||||
and l.user_id = #{params.userId}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@
|
|||
SELECT agpr.org_id,la.*,
|
||||
sdd.dict_value AS attStatus
|
||||
FROM leave_apply la
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_label = if(la.type is not null, la.type, la.leave_type)
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_label = if(la.leave_type is not null, la.leave_type, la.type)
|
||||
AND sdd.dict_type = 'att_status'
|
||||
LEFT JOIN att_group_person_relation agpr ON la.user_id = agpr.user_id
|
||||
WHERE la.is_active = 1
|
||||
|
|
|
|||
|
|
@ -343,7 +343,6 @@
|
|||
att_current_time ASC
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateAttDetailsData">
|
||||
<foreach collection="list" item="params" separator=";">
|
||||
update att_data_update set update_att_current_time = #{params.toWorkAttCurrentTime},
|
||||
|
|
|
|||
|
|
@ -201,5 +201,11 @@
|
|||
WHERE leave_end_date > #{previousMonthDate}
|
||||
</select>
|
||||
|
||||
<select id="getHolidayDataByType" resultType="java.lang.String">
|
||||
SELECT date
|
||||
FROM sys_holiday
|
||||
WHERE date between #{startDate} and #{endDate} and type = 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -160,16 +160,16 @@
|
|||
la.examine_status AS examineStatus,
|
||||
la.location,
|
||||
case
|
||||
when la.leave_type = '病假' then '休假'
|
||||
when la.leave_type = '年休假' then '休假'
|
||||
when la.leave_type = '事假' then '休假'
|
||||
when la.leave_type = '产假' then '休假'
|
||||
when la.leave_type = '婚假' then '休假'
|
||||
when la.leave_type = '丧假' then '休假'
|
||||
when la.leave_type = '探亲假' then '休假'
|
||||
when la.leave_type = '休假' then '休假'
|
||||
when la.leave_type = '育儿假' then '休假'
|
||||
when la.leave_type = '陪护假' then '休假'
|
||||
when la.leave_type = '病假' then '请假'
|
||||
when la.leave_type = '年休假' then '请假'
|
||||
when la.leave_type = '事假' then '请假'
|
||||
when la.leave_type = '产假' then '请假'
|
||||
when la.leave_type = '婚假' then '请假'
|
||||
when la.leave_type = '丧假' then '请假'
|
||||
when la.leave_type = '探亲假' then '请假'
|
||||
when la.leave_type = '请假' then '请假'
|
||||
when la.leave_type = '育儿假' then '请假'
|
||||
when la.leave_type = '陪护假' then '请假'
|
||||
else la.leave_type
|
||||
end as leaveType,
|
||||
case when la.is_agree = '1' then '是' else '否' end as isAgree,
|
||||
|
|
@ -188,9 +188,9 @@
|
|||
AND (
|
||||
(la.leave_type IN ('轮休', '临时外出') AND (la.examine_status = '1' or la.examine_status = '0') )
|
||||
OR
|
||||
(la.leave_type = '休假' AND la.source = '1')
|
||||
(la.type = '请假' AND la.source = '1')
|
||||
OR
|
||||
(la.leave_type NOT IN ('轮休', '临时外出', '休假'))
|
||||
(la.leave_type NOT IN ('轮休', '临时外出', '请假'))
|
||||
)
|
||||
and su.is_cadre = 1
|
||||
<if test="userName!=null and userName!=''">
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
LEFT JOIN sys_user_post p ON p.user_id = l.user_id
|
||||
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
|
||||
WHERE
|
||||
l.is_active = '1' AND l.leave_type = '休假' AND (l.source = '1' OR l.source = '3')
|
||||
l.is_active = '1' AND l.type = '请假' AND (l.source = '1' OR l.source = '3')
|
||||
<if test="params.params.beginTime != null and params.params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(l.leave_start_date,'%y%m%d') >= date_format(#{params.params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue