测试bug修改

This commit is contained in:
fl 2025-03-17 09:12:50 +08:00
parent 2bd3cfd8d9
commit 9cc90a50b8
12 changed files with 115 additions and 40 deletions

View File

@ -139,4 +139,10 @@ public interface AttGroupDao {
* @date 2025/2/18 13:49
*/
List<AttDataBean> getUserInfo(@Param("params") AttGroupBean bean, @Param("list") List<AttGroupCheckOrgBean> addList);
/**
* 查询用户是否有考勤组
* @param userId
* @return
*/
int getPersonAttGroup(Long userId);
}

View File

@ -127,4 +127,11 @@ public interface AttCalService {
* @param attSourceList 考勤数据
*/
void insertAttSourceData(List<AttSourceDataBean> attSourceList);
/**
* 查询用户是否有考勤组
* @param userId
* @return
*/
int getPersonAttGroup(Long userId);
}

View File

@ -476,6 +476,11 @@ public class AttCalServiceImpl implements AttCalService {
}
}
@Override
public int getPersonAttGroup(Long userId) {
return attGroupDao.getPersonAttGroup(userId);
}
/**
* 查出每一个考勤组的应出勤天数以及考勤组的规则
*

View File

@ -142,6 +142,8 @@ public class AttGroupServiceImpl implements AttGroupService {
if (!delList.isEmpty()) {
//删除考勤组绑定人员
attGroupDao.deleteAttGroupPersonByUserId(delList);
//删除考勤组修改月考勤天数
delAttGroup(delList);
}
if (!addList.isEmpty()) {
//添加考勤组绑定人员
@ -153,6 +155,49 @@ public class AttGroupServiceImpl implements AttGroupService {
return result;
}
private void delAttGroup(List<AttGroupCheckOrgBean> delList) {
String nowDate = DateUtil.today();
delList.forEach(m -> {
int i = attCalService.getMonthReportTempData(m.getUserId(),nowDate);
AtomicLong requiredDays = new AtomicLong();
StringBuilder requiredDaysRemark = new StringBuilder();
//查询历史考勤规则方便分组计算
List<AttGroupBean> dataList = attCalService.getAttSettingHistoryByUserAndDate(m.getUserId(),nowDate);
if (!dataList.isEmpty()) {
List<List<AttGroupBean>> result = new ArrayList<>();
List<AttGroupBean> currentList = new ArrayList<>();
//查出考勤组
List<AttGroupBean> groupList = attCalService.getSimplyGroupData();
List<Holiday> holidays = attSourceDataDao.selectHolidayByMonth(nowDate);
Long currentGroupId = dataList.get(0).getGroupId();
for (AttGroupBean data : dataList) {
if (!Objects.equals(data.getGroupId(), currentGroupId)) {
result.add(currentList);
currentList = new ArrayList<>();
currentGroupId = data.getGroupId();
}
currentList.add(data);
}
result.add(currentList);
result.forEach(v -> {
List<AttGroupBean> collect = groupList.stream().filter(g -> Objects.equals(g.getGroupId(), v.get(0).getGroupId())).collect(Collectors.toList());
if(!collect.isEmpty()){
//应考勤天数
List<String> attDayList = WorkdayCalculator.getWorkDay(collect.get(0).getAttDay(),
collect.get(0).getIsHaveHoliday(), holidays, v.get(0).getCurrentDay(),v.get(v.size()-1).getCurrentDay());
requiredDays.addAndGet(attDayList.size());
requiredDaysRemark.append(v.get(0).getCurrentDay()).append("-").append(v.get(v.size()-1).getCurrentDay())
.append("").append(collect.get(0).getGroupName()).append(",应考勤").append(attDayList.size()).append("天;");
}
});
}
if(i>0){
//存在属于修改考勤组需要修改月报表考勤天数
attCalService.updateMonthReportRequiredDay(m.getUserId(),nowDate,requiredDays.get(),requiredDaysRemark.toString());
}
});
}
/**
* 新增的人员
* 考勤人员列表

View File

@ -362,17 +362,21 @@ public class AttendanceDetailsServiceImpl implements AttendanceDetailsService {
String attCurrentMonth = bean.getAttCurrentMonth() + "-01";
//查询历史考勤规则方便分组计算
List<AttGroupBean> dataList = attCalService.getAttSettingHistoryByUserAndDate(String.valueOf(bean.getUserId()),attCurrentMonth);
//查询那个人是否还在考勤组如果不再了就不需要不全当月剩余时间
int i = attCalService.getPersonAttGroup(bean.getUserId());
AtomicLong requiredDays = new AtomicLong();
//以最后一个考勤规则补全剩下当月日期所有考勤规则数据
// 获取最后一个数据的日期
AttGroupBean lastData = dataList.get(dataList.size() - 1);
LocalDate lastDate = LocalDate.parse(lastData.getCurrentDay(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// 获取当月的总天数
int lastDayOfMonth = lastDate.lengthOfMonth();
// 从最后一个日期开始补全当月剩下的日期
for (int day = lastDate.getDayOfMonth() + 1; day <= lastDayOfMonth; day++) {
LocalDate newDate = lastDate.withDayOfMonth(day);
dataList.add(new AttGroupBean(lastData.getUserId(), lastData.getGroupId(), newDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
if(i>0){
//以最后一个考勤规则补全剩下当月日期所有考勤规则数据
// 获取最后一个数据的日期
AttGroupBean lastData = dataList.get(dataList.size() - 1);
LocalDate lastDate = LocalDate.parse(lastData.getCurrentDay(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// 获取当月的总天数
int lastDayOfMonth = lastDate.lengthOfMonth();
// 从最后一个日期开始补全当月剩下的日期
for (int day = lastDate.getDayOfMonth() + 1; day <= lastDayOfMonth; day++) {
LocalDate newDate = lastDate.withDayOfMonth(day);
dataList.add(new AttGroupBean(lastData.getUserId(), lastData.getGroupId(), newDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
}
}
if (!dataList.isEmpty()) {
List<List<AttGroupBean>> result = new ArrayList<>();

View File

@ -29,7 +29,7 @@ public class NewAttTask {
/**
* 考勤模版数据定时器 凌晨10分启动一次一天仅仅一次
*/
@Scheduled(cron = "0 10 0 * * ?")
// @Scheduled(cron = "0 10 0 * * ?")
@Async
public void getAttTempDataTask() {
log.info("--------考勤模版数据定时器开启------");
@ -44,7 +44,7 @@ public class NewAttTask {
* 1.数据拉取考勤定时器 每隔1个小时获取一次数据(从早上 5 点开始每小时执行一次)
* 2.考勤数据应用步骤一考勤数据更新
*/
@Scheduled(cron = "0 0 5-23 * * ?")
// @Scheduled(cron = "0 0 5-23 * * ?")
@Async
public void getAttDataPullTask() {
log.info("--------数据拉取(考勤)定时器开启------");
@ -59,7 +59,7 @@ public class NewAttTask {
* 1.数据拉取考勤定时器
* 2.考勤数据应用步骤一考勤数据更新
*/
@Scheduled(cron = "0 40 8 * * ?")
// @Scheduled(cron = "0 40 8 * * ?")
@Async
public void getEightAttDataPullTask() {
log.info("--------数据拉取(考勤)定时器开启------");
@ -75,7 +75,7 @@ public class NewAttTask {
* 每天12点将当天未打卡考勤人员上班置为旷工
* 每天晚上22点将下班未打卡置为旷工
*/
@Scheduled(cron = "0 0 12,22 * * ?")
// @Scheduled(cron = "0 0 12,22 * * ?")
@Async
public void getAbsenteeismDataTask() {
log.info("--------旷工判断定时器开启------");
@ -89,7 +89,7 @@ public class NewAttTask {
* 昨日下班卡更新
* 每天7点将昨天数据更新一下
*/
@Scheduled(cron = "0 0 7 * * ?")
// @Scheduled(cron = "0 0 7 * * ?")
@Async
public void getYesterdayAttDataTask() {
log.info("--------昨日下班卡更新定时器开启------");
@ -107,7 +107,7 @@ public class NewAttTask {
* 请假数据应用--法假
* 每天更新一次1点更新
*/
@Scheduled(cron = "0 0 1 * * ?")
// @Scheduled(cron = "0 0 1 * * ?")
@Async
public void getLegalHolidayDataTask() {
log.info("--------请假数据应用--法假定时器开启------");
@ -120,7 +120,7 @@ public class NewAttTask {
* 请假数据应用--请假
* 每天更新两次上午8点下午18点45天前数据
*/
@Scheduled(cron = "0 0 8,18 * * ?")
// @Scheduled(cron = "0 0 8,18 * * ?")
@Async
public void getLeaveDataTask() {
log.info("--------请假数据应用--请假定时器开启------");
@ -134,7 +134,7 @@ public class NewAttTask {
* 报表数据生成--日报表
* 6点10分开始,一小时更新一次
*/
@Scheduled(cron = "0 10 6-23 * * ?")
// @Scheduled(cron = "0 10 6-23 * * ?")
@Async
public void getDayReportDataTask() {
log.info("--------报表数据生成--日报表定时器开启------");
@ -148,7 +148,7 @@ public class NewAttTask {
* 报表数据生成--月报表
* 月初生成之后修改
*/
@Scheduled(cron = "0 15 1 1 * ?")
// @Scheduled(cron = "0 15 1 1 * ?")
@Async
public void getMonthReportDataTempTask() {
log.info("--------报表数据生成--月报表定时器开启------");
@ -161,7 +161,7 @@ public class NewAttTask {
* 报表数据生成--月报表
* 每日数据变化修改之后修改
*/
@Scheduled(cron = "0 0 8,10,17,19,23 * * ?")
// @Scheduled(cron = "0 0 8,10,17,19,23 * * ?")
@Async
public void getMonthReportDataTask() {
log.info("--------报表数据生成--月报表定时器开启------");

View File

@ -56,7 +56,7 @@ public class WechatTasks {
/**
* 人员基础数据同步定时器
*/
@Scheduled(initialDelay = 60000, fixedDelay = 60000 * 15)
// @Scheduled(initialDelay = 60000, fixedDelay = 60000 * 15)
@Async
public void pushPersonTask() {
log.info("--------人员基础数据同步定时器开启------");
@ -84,7 +84,7 @@ public class WechatTasks {
/**
* 休假出差数据同步定时器
*/
@Scheduled(initialDelay = 60000 * 6, fixedDelay = 60000 * 15)
// @Scheduled(initialDelay = 60000 * 6, fixedDelay = 60000 * 15)
@Async
public void leaveTask() {
log.info("--------休假出差数据定时器开启------");
@ -169,7 +169,7 @@ public class WechatTasks {
/**
* 考勤数据同步定时器
*/
@Scheduled(initialDelay = 60000 * 12, fixedDelay = 60000 * 15)
// @Scheduled(initialDelay = 60000 * 12, fixedDelay = 60000 * 15)
@Async
public void wechatAttTask() {
log.info("--------考勤数据定时器开启------");

View File

@ -222,6 +222,7 @@ public class ExportFileController {
HolidayBean vo = personLists.get(i);
vo.setId((i + 1));
vo.setExamineStatus(BusinessConstants.WAIT_CHECK.equals(vo.getExamineStatus()) ? "待审核" : BusinessConstants.PASS_CHECK.equals(vo.getExamineStatus()) ? "已通过" : BusinessConstants.NOT_PASS_CHECK.equals(vo.getExamineStatus()) ? "未通过" : "撤回");
vo.setIsTrain("1".equals(vo.getIsTrain())?"" : "");
//事件处理
if ("1".equals(vo.getLeaveStartInterval())) {
vo.setLeaveStartInterval(vo.getLeaveStartDate() + " 上午");
@ -288,6 +289,13 @@ public class ExportFileController {
}
List<AttDataDetailsBean> attList;
//结束日期过滤最新日期不能大于当天
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate endDate = LocalDate.parse(bean.getEndDate(), formatter);
LocalDate today = LocalDate.now();
if (endDate.isAfter(today)) {
bean.setEndDate(today.toString());
}
if ("考勤明细".equals(bean.getExportType())) {
attList = attendanceDetailsService.exportAttDetailsList(bean);
} else {
@ -362,7 +370,7 @@ public class ExportFileController {
.anyMatch(attDay -> dayStr.equals(attDay.getCurrentDay()));
// 如果不存在则添加新的 AttDayBean 记录
if (!dayExists) {
listAttDay.add(new AttDayBean(dayStr, "", ""));
listAttDay.add(new AttDayBean(dayStr, "/", ""));
}
}
@ -412,22 +420,13 @@ public class ExportFileController {
// 导出标题
ExcelWriter writer = ExcelUtil.getWriter(true);
// writer.merge(0,0,0,2 + days.size(),
// "考勤表",true);
//
//
// writer.merge(1,1,0,2 + days.size(),
// bean.getStartDate() + "" + bean.getEndDate() + "考勤",true);
// writer.merge(2,2,0,2 + days.size(),
// "部门:",true);
writer.merge(2 + days.size(),
bean.getStartDate() + "" + bean.getEndDate() + "考勤", true);
int rowNum = 2;
writer.merge(rowNum + listData.size(), rowNum + listData.size() + 1, 0, 0,
"说明", false);
writer.merge(rowNum + listData.size(), rowNum + listData.size(), 1, 2 + days.size(),
"1.考勤记录:出勤记“√”,出差记“Δ”,年休假记“年”,探亲假记“探”,事假记“事”,法定假记“法”,病假记“病”,产假记“产”,婚假记“婚”,丧假记“丧”,育儿假记“育”,陪护假记“陪”,补休记“补”,旷工记“旷”,迟到记“迟”,早退记“退”,流产假记“流”,哺乳假记“哺”,节育假记“节”,父母护理假记“护”,其他记“其他”,省内工地记“工”,省外工地记“外”,出差需在备注栏备注清楚出差地点。", false);
"1.考勤记录:出勤记“√”,出差记“Δ”,年休假记“年”,探亲假记“探”,事假记“事”,法定假记“法”,病假记“病”,产假记“产”,婚假记“婚”,丧假记“丧”,育儿假记“育”,陪护假记“陪”,补休记“补”,旷工记“旷”,迟到记“迟”,早退记“退”,流产假记“流”,哺乳假记“哺”,节育假记“节”,父母护理假记“护”,其他记“其他”,省内工地记“工”,省外工地记“外”,未在考勤组记“/”,出差需在备注栏备注清楚出差地点。", false);
writer.merge(rowNum + listData.size() + 1, rowNum + listData.size() + 1, 1, 2 + days.size(),
"2.员工有关请假凭证记录清楚准确与本表于次月3日前一并报人力资源管理部门专业分公司报送时间为30日前", false);
writer.autoSizeColumn(3);
@ -526,11 +525,13 @@ public class ExportFileController {
try {
List<SysOrgHistoryBean> orgHistoryList = sysOrgService.getOrgHistoryList(bean);
for (int i = 0; i < orgHistoryList.size(); i++) {
SysOrgHistoryBean o = orgHistoryList.get(i);
o.setId(i + 1L);
// 创建一个 SimpleDateFormat 对象用于格式化日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date 转换为 String
String dateString = formatter.format(orgHistoryList.get(i).getChangeTime());
orgHistoryList.get(i).setUpdateTime(dateString);
String dateString = formatter.format(o.getChangeTime());
o.setUpdateTime(dateString);
}
extracted(orgHistoryList, SysOrgHistoryBean.class, "组织变更记录", "组织变更记录", "组织变更记录导出", response);
} catch (Exception e) {

View File

@ -146,6 +146,7 @@ public class HolidayBean extends BaseBean {
/**
* 是否培训 1 0
*/
@Excel(name = "是否培训", width = 20.0,height = 20.0, orderNum = "8")
private String isTrain;
/**

View File

@ -122,6 +122,12 @@
#{item.userId}
</foreach>
</select>
<select id="getPersonAttGroup" resultType="java.lang.Integer">
select count(1)
from att_group_person_relation agpr
where agpr.user_id = #{userId}
and agpr.is_active = 1
</select>
<delete id="deleteAttGroup">
update att_group

View File

@ -200,7 +200,7 @@
lat as attLat,
IF(attendance_external = '外勤打卡', 1, 2) as isOutsideAtt,
'1' as dataSource
from gz_cloud.fc_sup_attendance sup
from gz_cloud_test.fc_sup_attendance sup
where sup.attendance_date = #{pushDate}
and is_wechat != 1
</select>
@ -363,7 +363,7 @@
AND la.examine_status = 1
AND sdd.dict_value IS NOT NULL
AND
(leave_start_date BETWEEN #{pushDate} - INTERVAL 15 DAY
(leave_start_date BETWEEN #{pushDate} - INTERVAL 1 DAY
and #{pushDate}
or #{pushDate} between leave_start_date and leave_end_date
)

View File

@ -38,7 +38,7 @@
<insert id="pushAttDataToQsy">
<foreach collection="list" item="item" separator=";">
replace INTO gz_cloud.fc_sup_attendance (
replace INTO gz_cloud_test.fc_sup_attendance (
name,
id_number,
org_id,
@ -203,7 +203,7 @@
If(PROJECT_ID is null,0,PROJECT_ID) AS proId,
If(ORG_ID is null,0,ORG_ID) AS orgId
FROM
gz_cloud.bm_sup_attend_history
gz_cloud_test.bm_sup_attend_history
WHERE
ID_NUMBER = #{idNumber}
limit 1