人员请假等根据公司或项目部区分是否去除周六日
This commit is contained in:
parent
ac54c8abda
commit
ee8b14b27c
|
|
@ -39,4 +39,6 @@ public interface LeaveReportingDao {
|
|||
List<LeaveReportingBean> getUserList(@Param("params")LeaveReportingBean bean);
|
||||
|
||||
List<LeaveReportingBean> getFestivalAndHoliday(LeaveReportingBean bean);
|
||||
|
||||
String getAttTypeByUserId(Long userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,24 +123,26 @@ public class LeaveReportingServiceImpl implements LeaveReportingService {
|
|||
@Override
|
||||
public LeaveReportingBean getDays(LeaveReportingBean bean) {
|
||||
try {
|
||||
//只能查自己部门的人
|
||||
Long userId = SecurityUtils.getLoginUser().getSysUser().getUserId();
|
||||
//1 公司机关 2 项目部
|
||||
String attType= leaveReportingDao.getAttTypeByUserId(userId);
|
||||
// 查询出所有周末以及节假日的日期
|
||||
List<LeaveReportingBean> holidays = leaveReportingDao.getFestivalAndHoliday(bean);
|
||||
|
||||
List<LeaveReportingBean> holidays = leaveReportingDao.getFestivalAndHoliday(bean);
|
||||
if("2".equals(attType)){
|
||||
holidays.clear();
|
||||
}
|
||||
// 将节假日转换为 Set<String>,提高查找效率
|
||||
Set<String> holidaySet = new HashSet<>();
|
||||
for (LeaveReportingBean holiday : holidays) {
|
||||
holidaySet.add(holiday.getDate());
|
||||
}
|
||||
|
||||
Date startDate = null;
|
||||
startDate = parseDate(String.valueOf(bean.getLeaveStartDate()));
|
||||
Date endDate = parseDate(String.valueOf(bean.getLeaveEndDate()));
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(startDate);
|
||||
|
||||
int totalDays = 0;
|
||||
|
||||
while (!calendar.getTime().after(endDate)) {
|
||||
String currentDate = formatDate(calendar.getTime());
|
||||
if (!holidaySet.contains(currentDate)) {
|
||||
|
|
|
|||
|
|
@ -198,4 +198,11 @@
|
|||
sys_holiday
|
||||
where type ='1'
|
||||
</select>
|
||||
<select id="getAttTypeByUserId" resultType="java.lang.String">
|
||||
SELECT att_type
|
||||
FROM
|
||||
att_group_person_relation agpr
|
||||
left join att_group ag on agpr.group_id = ag.id
|
||||
where user_id = #{userId} and agpr.is_active = '1'
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue