请假月初自动审核
This commit is contained in:
parent
aecd1edbb8
commit
9552513144
|
|
@ -27,7 +27,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||
@Configuration
|
||||
@EnableSwagger2
|
||||
@EnableConfigurationProperties(SwaggerProperties.class)
|
||||
@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = false)
|
||||
@Import({SwaggerBeanPostProcessor.class, SwaggerWebConfiguration.class})
|
||||
public class SwaggerAutoConfiguration
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.system.att.dao;
|
|||
|
||||
import com.bonus.common.datasource.annotation.Slave;
|
||||
import com.bonus.system.att.entity.*;
|
||||
import com.bonus.system.holiday.entity.HolidayBean;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import java.util.List;
|
||||
|
|
@ -223,7 +224,6 @@ public interface AttSourceDataDao {
|
|||
* 修改月的应考勤天数
|
||||
* @param userId
|
||||
* @param nowDate
|
||||
* @param i
|
||||
*/
|
||||
void updateMonthReportRequiredDay(@Param("userId") String userId, @Param("nowDate") String nowDate, @Param("requiredDays") Long requiredDays, @Param("requiredDayRemark") String requiredDayRemark);
|
||||
|
||||
|
|
@ -233,4 +233,6 @@ public interface AttSourceDataDao {
|
|||
* @return
|
||||
*/
|
||||
List<AttMonthReportBean> getOrgDataByUserId(String userId);
|
||||
|
||||
List<HolidayBean> getLeaveDataById(HolidayBean o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.system.att.service;
|
|||
import com.bonus.system.att.entity.AttGroupBean;
|
||||
import com.bonus.system.att.entity.AttMonthReportBean;
|
||||
import com.bonus.system.att.entity.AttSourceDataBean;
|
||||
import com.bonus.system.holiday.entity.HolidayBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -134,4 +135,12 @@ public interface AttCalService {
|
|||
* @return
|
||||
*/
|
||||
int getPersonAttGroup(Long userId);
|
||||
|
||||
/**
|
||||
* 查询通过的请假记录根据id
|
||||
* 修改考勤数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void rollbackAttDataByLeave(HolidayBean o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.bonus.system.att.entity.*;
|
|||
import com.bonus.system.att.utils.AddressCoordinateFormatUtil;
|
||||
import com.bonus.system.att.utils.AttTimeUtil;
|
||||
import com.bonus.system.att.utils.WorkdayCalculator;
|
||||
import com.bonus.system.holiday.entity.HolidayBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
|
|
@ -480,6 +481,21 @@ public class AttCalServiceImpl implements AttCalService {
|
|||
return attGroupDao.getPersonAttGroup(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询通过的请假记录根据id
|
||||
* 修改考勤数据
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void rollbackAttDataByLeave(HolidayBean o) {
|
||||
List<HolidayBean> list = attSourceDataDao.getLeaveDataById(o);
|
||||
for (HolidayBean bean : list) {
|
||||
//先去还原 原始表和明细表数据
|
||||
//调用单人数据区间更新
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查出每一个考勤组的应出勤天数以及考勤组的规则
|
||||
*
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,13 +1,20 @@
|
|||
package com.bonus.system.att.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.att.dao.AttSourceDataDao;
|
||||
import com.bonus.system.att.entity.Holiday;
|
||||
import com.bonus.system.att.entity.OrgChangeBean;
|
||||
import com.bonus.system.att.service.OrgChangeService;
|
||||
import com.bonus.system.holiday.dao.HolidayDao;
|
||||
import com.bonus.system.holiday.entity.HolidayBean;
|
||||
import com.bonus.system.holiday.service.HolidayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
|
@ -16,6 +23,9 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
|
@ -35,6 +45,9 @@ public class HolidayTasks {
|
|||
@Resource(name = "OrgChangeService")
|
||||
private OrgChangeService orgChangeService;
|
||||
|
||||
@Resource(name = "HolidayDao")
|
||||
private HolidayDao holidayDao;
|
||||
|
||||
@Scheduled(cron = "0 0 5 26 11 *")//每天12月26日凌晨5点
|
||||
@Async
|
||||
public void getAttTasks(){
|
||||
|
|
@ -67,6 +80,36 @@ public class HolidayTasks {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 月初自动通过上月所有未通过的请假数据
|
||||
*/
|
||||
@Scheduled(cron = "0 0 5 1 * ?") // 每月1日凌晨5点执行
|
||||
@Async
|
||||
public void updateHolidayStatus(){
|
||||
// 获取当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
// 获取上个月的年份和月份
|
||||
YearMonth previousMonth = YearMonth.from(today).minusMonths(1);
|
||||
// 上个月的第一天
|
||||
LocalDate startOfPreviousMonth = previousMonth.atDay(1);
|
||||
// 上个月的最后一天
|
||||
LocalDate endOfPreviousMonth = previousMonth.atEndOfMonth();
|
||||
// 定义日期格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
// 将日期转换为指定格式的字符串
|
||||
String startStr = startOfPreviousMonth.format(formatter);
|
||||
String endStr = endOfPreviousMonth.format(formatter);
|
||||
HolidayBean bean = new HolidayBean();
|
||||
bean.setLeaveStartInterval(startStr);
|
||||
bean.setLeaveEndInterval(endStr);
|
||||
List<Long> list = holidayDao.getHolidayListByDate(bean);
|
||||
bean.setIds(list);
|
||||
bean.setExamineOpinion("同意 月初自动审核上月未审核数据");
|
||||
//通过
|
||||
bean.setExamineStatus("1");
|
||||
holidayDao.batchCheckStatus(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 考勤组变更更新数据
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.system.att.tasks;
|
|||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.bonus.system.att.service.AttCalService;
|
||||
import com.bonus.system.holiday.entity.HolidayBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
|
@ -278,4 +279,13 @@ public class NewAttTask {
|
|||
attCalService.updateMonthReportData(pushDate);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请假等模块数据回退,需要将数据考勤数据回退再重新调用
|
||||
*/
|
||||
public void rollbackAttDataByLeave(HolidayBean o) {
|
||||
log.info("--------请假等模块数据回退调用------");
|
||||
attCalService.rollbackAttDataByLeave(o);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -111,4 +111,11 @@ public interface HolidayDao {
|
|||
* @return
|
||||
*/
|
||||
List<HolidayBean> judgeRepeatEnd(HolidayBean o);
|
||||
|
||||
/**
|
||||
* 根据日期查询请假数据
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<Long> getHolidayListByDate(HolidayBean bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,4 +73,5 @@ public interface HolidayService {
|
|||
* @date 2025/2/11 14:19
|
||||
*/
|
||||
AjaxResult batchCheckStatus(HolidayBean o);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -548,5 +548,19 @@
|
|||
LEFT JOIN sys_organization so ON so.id = suo.org_id
|
||||
where su.user_id = #{userId}
|
||||
</select>
|
||||
<select id="getLeaveDataById" resultType="com.bonus.system.holiday.entity.HolidayBean">
|
||||
SELECT
|
||||
id,
|
||||
user_id,
|
||||
leave_start_date,
|
||||
leave_end_date
|
||||
FROM
|
||||
leave_apply
|
||||
WHERE
|
||||
<foreach collection="ids" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND examine_status = '1'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -221,7 +221,7 @@
|
|||
select su.user_name, so.org_name, v.* from v_att_data v
|
||||
left join sys_user su on su.user_id = v.user_id
|
||||
left join sys_organization so on so.id = v.org_id
|
||||
where v.att_current_day BETWEEN #{bean.startDate} AND #{bean.endDate} and su.is_active = 1
|
||||
where v.att_current_day BETWEEN #{bean.startDate} AND #{bean.endDate}
|
||||
<if test="bean.orgId != null and bean.orgId != ''">
|
||||
AND v.org_id = #{bean.orgId}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@
|
|||
<if test="examineUserId != 0L">
|
||||
update_user_id = #{updateUserId},
|
||||
</if>
|
||||
<if test="examineOpinion != ''">
|
||||
examine_opinion = #{examineOpinion},
|
||||
</if>
|
||||
examine_status = #{examineStatus}
|
||||
</set>
|
||||
WHERE id IN
|
||||
|
|
@ -283,6 +286,16 @@
|
|||
and id !=#{id}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getHolidayListByDate" resultType="java.lang.Long">
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
leave_apply
|
||||
WHERE
|
||||
is_active = '1'
|
||||
AND leave_start_date BETWEEN #{leaveStartInterval} AND #{leaveEndInterval}
|
||||
AND examine_status = '0'
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue