Merge remote-tracking branch 'origin/main'
# Conflicts: # bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttGroupBean.java
This commit is contained in:
commit
df41b0f7d9
|
|
@ -963,6 +963,26 @@ public class DateTimeHelper {
|
|||
return dateList.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public static List<String> getMonthStartAndEndDay(String startMonth, String endMonth){
|
||||
List<String> list = new ArrayList<>();
|
||||
// 格式化器,用于解析年月字符串
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
// 解析开始年月
|
||||
YearMonth start = YearMonth.parse(startMonth, formatter);
|
||||
// 获取开始年月的第一天
|
||||
LocalDate startDate = start.atDay(1);
|
||||
// 解析结束年月
|
||||
YearMonth end = YearMonth.parse(endMonth, formatter);
|
||||
// 获取结束年月的最后一天
|
||||
LocalDate endDate = end.atEndOfMonth();
|
||||
// 输出结果
|
||||
System.out.println("开始年月的第一天: " + startDate);
|
||||
System.out.println("结束年月的最后一天: " + endDate);
|
||||
list.add(startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
list.add(endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
boolean b = DateTimeHelper.compareTime2("2024-11-27 08:01:35","2024-11-27 08:01:43");
|
||||
System.out.println(b);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.system.att.controller;
|
||||
|
||||
import com.bonus.common.core.utils.DateTimeHelper;
|
||||
import com.bonus.common.core.utils.StringHelper;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.utils.poi.MultiSheetExcelExporter;
|
||||
|
|
@ -167,10 +168,10 @@ public class AttDetailByMonthController extends BaseController {
|
|||
}
|
||||
MultiSheetExcelExporter exporter = new MultiSheetExcelExporter();
|
||||
//将表格时间区间取出来做标题
|
||||
String title = bean.getAttCurrentMonth();
|
||||
String title = bean.getStartMonth() + " ~ " + bean.getEndMonth();
|
||||
List<AttDetailByMonthBean> attDayReportList = attDetailByMonthService.selectAttDetailList(bean);
|
||||
Sheet departmentSheet1 = exporter.createSheet("月异常报表详情");
|
||||
List<String> departmentHeaders1 = Arrays.asList("序号", "姓名", "所属部门", "考勤月", "应考勤天数", "正常打卡天数",
|
||||
List<String> departmentHeaders1 = Arrays.asList("序号", "姓名", "所属部门", "考勤月","打卡记录", "应考勤天数", "正常打卡天数",
|
||||
"迟到天数", "早退天数", "旷工天数", "打卡地异常天数", "出入异常天数");
|
||||
exporter.addHeaderRowAndTitle(departmentSheet1, departmentHeaders1, title);
|
||||
List<Map<String, Object>> departmentData1 = new ArrayList<>();
|
||||
|
|
@ -180,6 +181,7 @@ public class AttDetailByMonthController extends BaseController {
|
|||
map.put("姓名", attDayReportList.get(i).getName());
|
||||
map.put("所属部门", attDayReportList.get(i).getOrgName());
|
||||
map.put("考勤月", attDayReportList.get(i).getAttCurrentMonth());
|
||||
map.put("打卡记录", attDayReportList.get(i).getClockingRecordNum());
|
||||
map.put("应考勤天数", attDayReportList.get(i).getRequiredDays());
|
||||
map.put("正常打卡天数", attDayReportList.get(i).getNormalNum());
|
||||
map.put("迟到天数", attDayReportList.get(i).getLateNum());
|
||||
|
|
@ -203,8 +205,9 @@ public class AttDetailByMonthController extends BaseController {
|
|||
headers.put("9", "打卡地异常");
|
||||
headers.put("99", "工作外出");
|
||||
Map<String, String> attStatus = getStringStringMap();
|
||||
if (StringHelper.isNotEmpty(bean.getAttCurrentMonth())) {
|
||||
List<String> monthFirstAndLast = getMonthFirstAndLast(bean.getAttCurrentMonth());
|
||||
if (StringHelper.isNotEmpty(bean.getStartMonth()) && StringHelper.isNotEmpty(bean.getEndMonth())) {
|
||||
// List<String> monthFirstAndLast = getMonthFirstAndLast(bean.getAttCurrentMonth());
|
||||
List<String> monthFirstAndLast = DateTimeHelper.getMonthStartAndEndDay(bean.getStartMonth(),bean.getEndMonth());
|
||||
AttDetailBean dayTable = new AttDetailBean();
|
||||
dayTable.setStartDate(monthFirstAndLast.get(0));
|
||||
dayTable.setEndDate(monthFirstAndLast.get(1));
|
||||
|
|
@ -221,7 +224,9 @@ public class AttDetailByMonthController extends BaseController {
|
|||
.forEach(entry -> {
|
||||
if ("99".equals(entry.getKey())) {
|
||||
AttDataDetailsBean att = new AttDataDetailsBean();
|
||||
att.setAttCurrentMonth(bean.getAttCurrentMonth());
|
||||
att.setStartDate(monthFirstAndLast.get(0));
|
||||
att.setEndDate(monthFirstAndLast.get(1));
|
||||
// att.setAttCurrentMonth(bean.getAttCurrentMonth());
|
||||
if (bean.getOrgId() != null) {
|
||||
att.setOrgId(Long.valueOf(bean.getOrgId()));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -348,6 +348,13 @@ public class AttendanceDetailsController extends BaseController {
|
|||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
@GetMapping("/getClockingRecordListByUserId")
|
||||
@Log(title = "考勤报表->月报表->打卡记录", businessType = BusinessType.QUERY)
|
||||
public TableDataInfo getClockingRecordListByUserId(AttMonthReportBean bean) {
|
||||
startPage();
|
||||
return getDataTable(attendanceDetailsService.getClockingRecordListByUserId(bean));
|
||||
}
|
||||
|
||||
/**
|
||||
* 月报表导出
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -71,4 +71,13 @@ public interface AttDetailByMonthDao {
|
|||
List<Map<String,Object>> getSonsById(int orgId);
|
||||
|
||||
Map<String,Object> getSonsFinish(int orgId);
|
||||
|
||||
/**
|
||||
* 考勤报表->月异常报表->打卡记录
|
||||
* @param c
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2025/2/18 19:59
|
||||
*/
|
||||
int getClockingRecordNum(@Param("c")AttDetailByMonthBean c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.system.att.dao;
|
||||
|
||||
import com.bonus.system.att.entity.AttDataBean;
|
||||
import com.bonus.system.att.entity.AttGroupBean;
|
||||
import com.bonus.system.att.entity.AttGroupCheckOrgBean;
|
||||
import com.bonus.system.basic.domain.SysTree;
|
||||
|
|
@ -11,6 +12,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 考勤组-数据访问层
|
||||
*
|
||||
* @author zys
|
||||
*/
|
||||
@Repository("attGroupDao")
|
||||
|
|
@ -18,6 +20,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 获取考勤组列表
|
||||
*
|
||||
* @param bean 参数
|
||||
* @return list bean
|
||||
*/
|
||||
|
|
@ -25,12 +28,14 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 查询组织选择列表
|
||||
*
|
||||
* @return list bean
|
||||
*/
|
||||
List<AttGroupCheckOrgBean> selectOrgList();
|
||||
|
||||
/**
|
||||
* 删除考勤组
|
||||
*
|
||||
* @param groupId 考勤组编号
|
||||
* @return 1|0
|
||||
*/
|
||||
|
|
@ -38,6 +43,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 上传考勤组表
|
||||
*
|
||||
* @param bean 参数
|
||||
* @return 1|0
|
||||
*/
|
||||
|
|
@ -45,6 +51,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 上传考勤组设置表
|
||||
*
|
||||
* @param bean 参数
|
||||
* @return 1|0
|
||||
*/
|
||||
|
|
@ -52,6 +59,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 上传考勤人员绑定表
|
||||
*
|
||||
* @param checkOrgList 参数
|
||||
* @return 1|0
|
||||
*/
|
||||
|
|
@ -59,6 +67,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 根据考勤组编号获取详细信息
|
||||
*
|
||||
* @param groupId 考勤组编号
|
||||
* @return bean
|
||||
*/
|
||||
|
|
@ -66,6 +75,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 根据考勤组编号获取人员绑定情况
|
||||
*
|
||||
* @param groupId 考勤组编号
|
||||
* @return list bean
|
||||
*/
|
||||
|
|
@ -73,6 +83,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 删除考勤组绑定人员
|
||||
*
|
||||
* @param groupId 考勤组编号
|
||||
*/
|
||||
void deleteAttGroupRelationPerson(Long groupId);
|
||||
|
|
@ -81,6 +92,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 修改考勤组
|
||||
*
|
||||
* @param bean 参数
|
||||
* @return 1|0
|
||||
*/
|
||||
|
|
@ -88,6 +100,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 修改考勤组设置表
|
||||
*
|
||||
* @param bean 参数
|
||||
* @return 1|0
|
||||
*/
|
||||
|
|
@ -95,6 +108,7 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 查询人员是否绑定考勤组
|
||||
*
|
||||
* @param id 用户编号
|
||||
* @return 1|0
|
||||
*/
|
||||
|
|
@ -102,16 +116,27 @@ public interface AttGroupDao {
|
|||
|
||||
/**
|
||||
* 查询出可选中人员
|
||||
*
|
||||
* @return list bean
|
||||
*/
|
||||
List<SysTree> getAttGroupCheckPerson(Long groupId);
|
||||
|
||||
/**
|
||||
*
|
||||
* 根据组织编号获取人员
|
||||
* @param idList 组织编号
|
||||
*
|
||||
* @param idList 组织编号
|
||||
* @param groupId 考勤组(当前考情组)
|
||||
* @return list bean
|
||||
*/
|
||||
List<AttGroupCheckOrgBean> getUserByOrg(@Param("idList")ArrayList<String> idList, @Param("groupId")Long groupId);
|
||||
List<AttGroupCheckOrgBean> getUserByOrg(@Param("idList") ArrayList<String> idList, @Param("groupId") Long groupId);
|
||||
|
||||
/**
|
||||
* 根据人员ID查询组织机构
|
||||
* @param bean
|
||||
* @param addList
|
||||
* @return List<AttDataBean>
|
||||
* @author cwchen
|
||||
* @date 2025/2/18 13:49
|
||||
*/
|
||||
List<AttDataBean> getUserInfo(@Param("params") AttGroupBean bean, @Param("list") List<AttGroupCheckOrgBean> addList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.system.att.dao;
|
||||
|
||||
import com.bonus.system.api.domain.MapVo;
|
||||
import com.bonus.system.att.entity.AttClockingRecordVo;
|
||||
import com.bonus.system.att.entity.AttDataDetailsBean;
|
||||
import com.bonus.system.att.entity.AttDayReportBean;
|
||||
import com.bonus.system.att.entity.AttMonthReportBean;
|
||||
|
|
@ -97,4 +98,22 @@ public interface AttendanceDetailsDao {
|
|||
List<AttDataDetailsBean> getOrgUserOutCountList(@Param("bean") AttDataDetailsBean bean);
|
||||
|
||||
List<MapVo> getAttStatusList();
|
||||
|
||||
/**
|
||||
* 查询打卡记录
|
||||
* @param c
|
||||
* @return int
|
||||
* @author cwchen
|
||||
* @date 2025/2/18 14:32
|
||||
*/
|
||||
int getClockingRecordNum(@Param("c") AttMonthReportBean c);
|
||||
|
||||
/**
|
||||
* 考勤报表->月报表->打卡记录
|
||||
* @param bean
|
||||
* @return List<AttClockingRecordVo>
|
||||
* @author cwchen
|
||||
* @date 2025/2/18 15:59
|
||||
*/
|
||||
List<AttClockingRecordVo> getClockingRecordListByUserId(AttMonthReportBean bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.bonus.system.att.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @className:AttClockingRecordVo
|
||||
* @author:cwchen
|
||||
* @date:2025-02-18-15:00
|
||||
* @version:1.0
|
||||
* @description:考勤打卡记录-vo
|
||||
*/
|
||||
@Data
|
||||
public class AttClockingRecordVo {
|
||||
|
||||
|
||||
/**考勤日期*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date attCurrentDay;
|
||||
|
||||
/**考勤时间*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date attCurrentTime;
|
||||
|
||||
/**考勤类型1上班2下班*/
|
||||
private String attType;
|
||||
|
||||
/**打卡地址*/
|
||||
private String attAddress;
|
||||
|
||||
/**备注*/
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -96,6 +96,10 @@ public class AttDetailByMonthBean {
|
|||
@Excel(name = "请假天数")
|
||||
private double leaveNum;
|
||||
|
||||
/**打卡记录*/
|
||||
@Excel(name = "打卡记录")
|
||||
private int clockingRecordNum;
|
||||
|
||||
private int[] orgIds;
|
||||
|
||||
/**
|
||||
|
|
@ -106,4 +110,7 @@ public class AttDetailByMonthBean {
|
|||
/** 部门列表 */
|
||||
private List<String> orgList;
|
||||
|
||||
private String startMonth;
|
||||
private String endMonth;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ public class AttGroupBean {
|
|||
*/
|
||||
private String currentDay;
|
||||
|
||||
|
||||
public AttGroupBean(Long groupId, String attDay, String toWorkTime, String offWorkTime,
|
||||
Long todayClockNum, Long lateMinute, Long leaveMinute,
|
||||
Long absenteeismLateMinute, Long absenteeismLeaveMinute,
|
||||
|
|
|
|||
|
|
@ -111,8 +111,17 @@ public class AttMonthReportBean {
|
|||
*/
|
||||
private Double outCount;
|
||||
|
||||
/**打卡记录*/
|
||||
@Excel(name = "打卡记录", sort = 14)
|
||||
private int clockingRecordNum;
|
||||
|
||||
/**
|
||||
* 自己项目部所在分公司下的所有项目部id
|
||||
*/
|
||||
private List<String> orgList;
|
||||
|
||||
/**开始月份*/
|
||||
private String startMonth;
|
||||
/**结束月份*/
|
||||
private String endMonth;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,11 @@ public class AttDetailByMonthServiceImpl implements AttDetailByMonthService{
|
|||
List<AttDetailByMonthBean> list = new ArrayList<>();
|
||||
try {
|
||||
list = attDetailByMonthDao.selectAttAllList(data);
|
||||
|
||||
// 查询打卡记录
|
||||
list.forEach(c -> {
|
||||
int clockingRecordNum = attDetailByMonthDao.getClockingRecordNum(c);
|
||||
c.setClockingRecordNum(clockingRecordNum);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("查询月异常报表列表", e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.bonus.system.att.service;
|
||||
|
||||
import com.bonus.common.core.constant.Constants;
|
||||
import com.bonus.common.core.utils.DateTimeHelper;
|
||||
import com.bonus.common.core.utils.bean.BeanUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.system.att.dao.AttGroupDao;
|
||||
import com.bonus.system.att.dao.AttSourceDataDao;
|
||||
import com.bonus.system.att.entity.AttDataBean;
|
||||
import com.bonus.system.att.entity.AttGroupBean;
|
||||
import com.bonus.system.att.entity.AttGroupCheckOrgBean;
|
||||
import com.bonus.system.att.utils.TreeUtils;
|
||||
|
|
@ -61,7 +63,7 @@ public class AttGroupServiceImpl implements AttGroupService {
|
|||
bean.setCreateUserId(SecurityUtils.getLoginUser().getSysUser().getUserId());
|
||||
//只有部门的将部门变成部门下所有人(去除掉其他考勤组选的人)
|
||||
List<AttGroupCheckOrgBean> checkOrgAllList = dealWithOrgUser(bean, null);
|
||||
if(checkOrgAllList.isEmpty()){
|
||||
if (checkOrgAllList.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
//新增考勤组表
|
||||
|
|
@ -75,6 +77,7 @@ public class AttGroupServiceImpl implements AttGroupService {
|
|||
checkOrgAllList.get(k).setGroupId(bean.getGroupId());
|
||||
}
|
||||
int x = attGroupDao.insertAttGroupPerson(checkOrgAllList);
|
||||
addAttData(bean, checkOrgAllList);
|
||||
if (j > 0 && (x == checkOrgAllList.size())) {
|
||||
result = 1;
|
||||
}
|
||||
|
|
@ -102,7 +105,7 @@ public class AttGroupServiceImpl implements AttGroupService {
|
|||
int result = 0;
|
||||
bean.setUpdateUserId(SecurityUtils.getLoginUser().getSysUser().getUserId());
|
||||
List<AttGroupCheckOrgBean> checkOrgAllList = dealWithOrgUser(bean, null);
|
||||
if(checkOrgAllList.isEmpty()){
|
||||
if (checkOrgAllList.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
//新增考勤组表
|
||||
|
|
@ -134,20 +137,41 @@ public class AttGroupServiceImpl implements AttGroupService {
|
|||
if (!addList.isEmpty()) {
|
||||
//添加考勤组绑定人员
|
||||
attGroupDao.insertAttGroupPerson(addList);
|
||||
// 新增的人员 生成当天的考勤模板
|
||||
List<AttGroupBean> list = new ArrayList<>();
|
||||
for (AttGroupCheckOrgBean attGroupCheckOrgBean : addList) {
|
||||
AttGroupBean groupBean = new AttGroupBean();
|
||||
BeanUtils.copyProperties(attGroupCheckOrgBean, groupBean);
|
||||
list.add(groupBean);
|
||||
}
|
||||
attSourceDataDao.insertAttSettingHistoryData(list);
|
||||
addAttData(bean, addList);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增的人员 生成当天的考勤模板/与考勤规则进行绑定
|
||||
*
|
||||
* @param bean
|
||||
* @param addList
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2025/2/18 13:56
|
||||
*/
|
||||
public void addAttData(AttGroupBean bean, List<AttGroupCheckOrgBean> addList) {
|
||||
// 新增的人员 生成当天的考勤模板/与考勤规则进行绑定
|
||||
List<AttGroupBean> list = new ArrayList<>();
|
||||
List<AttDataBean> listPerson = new ArrayList<>();
|
||||
for (AttGroupCheckOrgBean attGroupCheckOrgBean : addList) {
|
||||
AttGroupBean groupBean = new AttGroupBean();
|
||||
groupBean.setGroupId(attGroupCheckOrgBean.getGroupId());
|
||||
groupBean.setUserId(Long.parseLong(attGroupCheckOrgBean.getUserId()));
|
||||
groupBean.setCurrentDay(DateTimeHelper.getNowDate());
|
||||
list.add(groupBean);
|
||||
}
|
||||
// 新增人员考勤模板数据
|
||||
attSourceDataDao.insertAttSettingHistoryData(list);
|
||||
// 查询人员组织机构ID
|
||||
listPerson = attGroupDao.getUserInfo(bean, addList);
|
||||
// 新增人员考勤规则
|
||||
attSourceDataDao.insertAttDataList(listPerson);
|
||||
}
|
||||
|
||||
public Map<String, List<AttGroupCheckOrgBean>> compareByUserId(
|
||||
List<AttGroupCheckOrgBean> list1,
|
||||
List<AttGroupCheckOrgBean> list2) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.system.att.service;
|
|||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.system.api.domain.MapVo;
|
||||
import com.bonus.system.att.entity.AttClockingRecordVo;
|
||||
import com.bonus.system.att.entity.AttDataDetailsBean;
|
||||
import com.bonus.system.att.entity.AttDayReportBean;
|
||||
import com.bonus.system.att.entity.AttMonthReportBean;
|
||||
|
|
@ -111,4 +112,13 @@ public interface AttendanceDetailsService {
|
|||
List<AttDataDetailsBean> getOrgUserOutCountList(AttDataDetailsBean bean);
|
||||
|
||||
List<MapVo> getAttStatusList();
|
||||
|
||||
/**
|
||||
* 考勤报表->月报表->打卡记录
|
||||
* @param bean
|
||||
* @return List<AttClockingRecordVo>
|
||||
* @author cwchen
|
||||
* @date 2025/2/18 16:00
|
||||
*/
|
||||
List<AttClockingRecordVo> getClockingRecordListByUserId(AttMonthReportBean bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,7 @@ import com.bonus.common.security.utils.SecurityUtils;
|
|||
import com.bonus.system.api.domain.MapVo;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.att.dao.AttendanceDetailsDao;
|
||||
import com.bonus.system.att.entity.AttDataDetailsBean;
|
||||
import com.bonus.system.att.entity.AttDayReportBean;
|
||||
import com.bonus.system.att.entity.AttGroupBean;
|
||||
import com.bonus.system.att.entity.AttMonthReportBean;
|
||||
import com.bonus.system.att.entity.*;
|
||||
import com.bonus.system.att.tasks.AttTasks;
|
||||
import com.bonus.system.att.tasks.WechatTasks;
|
||||
import com.bonus.system.basic.domain.SysNotice;
|
||||
|
|
@ -163,7 +160,13 @@ public class AttendanceDetailsServiceImpl implements AttendanceDetailsService {
|
|||
|
||||
@Override
|
||||
public List<AttMonthReportBean> getAttMonthReportList(AttMonthReportBean bean) {
|
||||
return attendanceDetailsDao.getAttMonthReportList(bean);
|
||||
List<AttMonthReportBean> attMonthReportList = attendanceDetailsDao.getAttMonthReportList(bean);
|
||||
// 查询打卡记录
|
||||
attMonthReportList.forEach(c -> {
|
||||
int clockingRecordNum = attendanceDetailsDao.getClockingRecordNum(c);
|
||||
c.setClockingRecordNum(clockingRecordNum);
|
||||
});
|
||||
return attMonthReportList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -268,4 +271,14 @@ public class AttendanceDetailsServiceImpl implements AttendanceDetailsService {
|
|||
return allList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AttClockingRecordVo> getClockingRecordListByUserId(AttMonthReportBean bean) {
|
||||
List<AttClockingRecordVo> list = new ArrayList<>();
|
||||
try {
|
||||
list = attendanceDetailsDao.getClockingRecordListByUserId(bean);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import cn.hutool.poi.excel.ExcelUtil;
|
|||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.bonus.common.core.constant.BusinessConstants;
|
||||
import com.bonus.common.core.enums.AttStatus;
|
||||
import com.bonus.common.core.utils.DateTimeHelper;
|
||||
import com.bonus.common.core.utils.ExcelStyleUtil;
|
||||
import com.bonus.common.core.utils.StringHelper;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
|
|
@ -672,10 +673,10 @@ public class ExportFileController {
|
|||
}
|
||||
MultiSheetExcelExporter exporter = new MultiSheetExcelExporter();
|
||||
//将表格时间区间取出来做标题
|
||||
String title = bean.getMonth();
|
||||
String title = bean.getStartMonth() + " ~ " + bean.getEndMonth();
|
||||
List<AttMonthReportBean> attDayReportList = attendanceDetailsService.getAttMonthReportList(bean);
|
||||
Sheet departmentSheet1 = exporter.createSheet("月报表详情");
|
||||
List<String> departmentHeaders1 = Arrays.asList("序号", "姓名", "所属部门", "考勤月", "应考勤天数", "正常打卡天数",
|
||||
List<String> departmentHeaders1 = Arrays.asList("序号", "姓名", "所属部门", "考勤月","打卡记录", "应考勤天数", "正常打卡天数",
|
||||
"迟到天数", "早退天数", "旷工天数", "请假天数", "打卡地异常天数", "出入异常天数", "轮休天数", "临时外出天数", "出差天数");
|
||||
exporter.addHeaderRowAndTitle(departmentSheet1, departmentHeaders1, title);
|
||||
List<Map<String, Object>> departmentData1 = new ArrayList<>();
|
||||
|
|
@ -684,7 +685,8 @@ public class ExportFileController {
|
|||
map.put("序号", i + 1);
|
||||
map.put("姓名", attDayReportList.get(i).getUserName());
|
||||
map.put("所属部门", attDayReportList.get(i).getOrgName());
|
||||
map.put("考勤月", title);
|
||||
map.put("考勤月", attDayReportList.get(i).getAttCurrentMonth());
|
||||
map.put("打卡记录", attDayReportList.get(i).getClockingRecordNum());
|
||||
map.put("应考勤天数", attDayReportList.get(i).getRequiredDays());
|
||||
map.put("正常打卡天数", attDayReportList.get(i).getNormalNum());
|
||||
map.put("迟到天数", attDayReportList.get(i).getLateNum());
|
||||
|
|
@ -713,8 +715,8 @@ public class ExportFileController {
|
|||
headers.put("10", "出差详情");
|
||||
headers.put("99", "工作外出");
|
||||
Map<Long, String> attStatus = getStringStringMap();
|
||||
if (StringHelper.isNotEmpty(bean.getMonth())) {
|
||||
List<String> monthFirstAndLast = getMonthFirstAndLast(bean.getMonth());
|
||||
if (StringHelper.isNotEmpty(bean.getStartMonth()) && StringHelper.isNotEmpty(bean.getEndMonth())) {
|
||||
List<String> monthFirstAndLast = DateTimeHelper.getMonthStartAndEndDay(bean.getStartMonth(), bean.getEndMonth());
|
||||
AttDetailBean dayTable = new AttDetailBean();
|
||||
dayTable.setStartDate(monthFirstAndLast.get(0));
|
||||
dayTable.setEndDate(monthFirstAndLast.get(1));
|
||||
|
|
@ -731,7 +733,9 @@ public class ExportFileController {
|
|||
.forEach(entry -> {
|
||||
if ("99".equals(entry.getKey())) {
|
||||
AttDataDetailsBean att = new AttDataDetailsBean();
|
||||
att.setAttCurrentMonth(bean.getMonth());
|
||||
// att.setAttCurrentMonth(bean.getMonth());
|
||||
att.setStartDate(monthFirstAndLast.get(0));
|
||||
att.setEndDate(monthFirstAndLast.get(1));
|
||||
if (bean.getOrgId() != null) {
|
||||
att.setOrgId(bean.getOrgId());
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@
|
|||
left join att_group_person_relation p on p.user_id = amr.user_id
|
||||
where amr.is_active = 1 and p.is_active = 1
|
||||
and amr.required_days != amr.normal_num
|
||||
<if test="bean.attCurrentMonth != null and bean.attCurrentMonth != '' ">
|
||||
and amr.att_current_month = #{bean.attCurrentMonth}
|
||||
<if test="bean.startMonth != null and bean.startMonth != '' ">
|
||||
and amr.att_current_month BETWEEN #{bean.startMonth} AND #{bean.endMonth}
|
||||
</if>
|
||||
<if test="bean.name != null and bean.name != '' ">
|
||||
and INSTR(amr.name,#{bean.name}) > 0
|
||||
|
|
@ -271,4 +271,9 @@
|
|||
where so.id = #{orgId}
|
||||
and is_active = 1
|
||||
</select>
|
||||
<!--考勤报表->月异常报表->打卡记录-->
|
||||
<select id="getClockingRecordNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM att_source_data
|
||||
WHERE name = #{c.name} AND DATE_FORMAT(att_current_day,'%Y-%m') = #{c.attCurrentMonth} AND is_active = '1'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -98,6 +98,30 @@
|
|||
</if>
|
||||
-- AND agpr.user_id IS NULL
|
||||
</select>
|
||||
<!--根据人员ID查询组织机构-->
|
||||
<select id="getUserInfo" resultType="com.bonus.system.att.entity.AttDataBean">
|
||||
SELECT suo.user_id AS userId,
|
||||
suo.org_id AS orgId,
|
||||
CURRENT_DATE AS attCurrentDay,
|
||||
0 AS attStatus,
|
||||
1 AS attType
|
||||
FROM sys_user_org suo
|
||||
WHERE user_id IN
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
||||
#{item.userId}
|
||||
</foreach>
|
||||
UNION ALL
|
||||
SELECT suo.user_id AS userId,
|
||||
suo.org_id AS orgId,
|
||||
CURRENT_DATE AS attCurrentDay,
|
||||
0 AS attStatus,
|
||||
2 AS attType
|
||||
FROM sys_user_org suo
|
||||
WHERE user_id IN
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
||||
#{item.userId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="deleteAttGroup">
|
||||
update att_group
|
||||
|
|
|
|||
|
|
@ -249,10 +249,11 @@
|
|||
</select>
|
||||
|
||||
<select id="getAttMonthReportList" resultType="com.bonus.system.att.entity.AttMonthReportBean">
|
||||
select v.*, v.name as userName,IF(awa.outCount is null,0,awa.outCount) as outCount from att_month_report v
|
||||
select v.*, v.name as userName,IF(awa.outCount is null,0,awa.outCount) as outCount
|
||||
from att_month_report v
|
||||
left join att_group_person_relation p on p.user_id = v.user_id and p.is_active = 1
|
||||
LEFT JOIN (SELECT user_id,count(user_id) as outCount FROM att_work_abnormal WHERE LOCATE(#{bean.month},att_current_day) GROUP BY user_id) awa ON awa.user_id = v.user_id
|
||||
where v.att_current_month = #{bean.month} and p.group_id is not null
|
||||
where v.att_current_month BETWEEN #{bean.startMonth} AND #{bean.endMonth} and p.group_id is not null
|
||||
<if test="bean.orgId != null and bean.orgId != ''">
|
||||
AND v.org_id = #{bean.orgId}
|
||||
</if>
|
||||
|
|
@ -447,8 +448,8 @@
|
|||
<if test="bean.attCurrentDay != null and bean.attCurrentDay != ''">
|
||||
and awa.att_current_day = #{bean.attCurrentDay}
|
||||
</if>
|
||||
<if test="bean.attCurrentMonth != null and bean.attCurrentMonth != ''">
|
||||
and locate(#{bean.attCurrentMonth},awa.att_current_day)
|
||||
<if test="bean.startDate != null and bean.startDate != '' and bean.endDate != null and bean.endDate != ''">
|
||||
AND awa.att_current_day BETWEEN #{bean.startDate} AND #{bean.endDate}
|
||||
</if>
|
||||
<if test="bean.userName != null and bean.userName != ''">
|
||||
and locate(#{bean.userName},awa.user_name)
|
||||
|
|
@ -478,6 +479,21 @@
|
|||
ORDER BY
|
||||
dict_sort ASC
|
||||
</select>
|
||||
<!--查询打卡记录-->
|
||||
<select id="getClockingRecordNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM att_source_data
|
||||
WHERE name = #{c.userName} AND DATE_FORMAT(att_current_day,'%Y-%m') = #{c.attCurrentMonth} AND is_active = '1'
|
||||
</select>
|
||||
<!--考勤报表->月报表->打卡记录-->
|
||||
<select id="getClockingRecordListByUserId" resultType="com.bonus.system.att.entity.AttClockingRecordVo">
|
||||
SELECT att_current_day AS attCurrentDay,
|
||||
att_current_time AS attCurrentTime,
|
||||
att_type AS attType,
|
||||
att_address AS attAddress,
|
||||
remark
|
||||
FROM att_source_data
|
||||
WHERE name = #{userName} AND DATE_FORMAT(att_current_day,'%Y-%m') = #{month} AND is_active = '1'
|
||||
</select>
|
||||
|
||||
<update id="updateAttDetailsData">
|
||||
<foreach collection="list" item="params" separator=";">
|
||||
|
|
|
|||
Loading…
Reference in New Issue