人脸更新

This commit is contained in:
fl 2024-12-04 16:27:28 +08:00
parent c51e73ae07
commit 3c8e07cfe4
6 changed files with 352 additions and 104 deletions

View File

@ -97,6 +97,16 @@ public class AttDetailBean {
return params; return params;
} }
/**
* 开始日期
*/
private String startDate;
/**
* 结束日期
*/
private String endDate;
public void setParams(Map<String, Object> params) public void setParams(Map<String, Object> params)
{ {
this.params = params; this.params = params;

View File

@ -9,10 +9,13 @@ import cn.hutool.poi.excel.ExcelWriter;
import com.bonus.common.core.constant.BusinessConstants; import com.bonus.common.core.constant.BusinessConstants;
import com.bonus.common.core.enums.AttStatus; import com.bonus.common.core.enums.AttStatus;
import com.bonus.common.core.utils.ExcelStyleUtil; import com.bonus.common.core.utils.ExcelStyleUtil;
import com.bonus.common.core.utils.StringHelper;
import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.utils.poi.MultiSheetExcelExporter;
import com.bonus.common.security.annotation.RequiresPermissions; import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.system.att.entity.*; import com.bonus.system.att.entity.*;
import com.bonus.system.att.service.AttDetailByMonthService;
import com.bonus.system.att.service.AttendanceDetailsService; import com.bonus.system.att.service.AttendanceDetailsService;
import com.bonus.system.att.service.OrgChangeService; import com.bonus.system.att.service.OrgChangeService;
import com.bonus.system.basic.domain.SysOrg; import com.bonus.system.basic.domain.SysOrg;
@ -33,7 +36,7 @@ import com.bonus.system.wechat.service.WechatEvectionService;
import com.bonus.system.wechat.service.WechatLeaveReportingService; import com.bonus.system.wechat.service.WechatLeaveReportingService;
import com.bonus.system.wechat.service.WechatService; import com.bonus.system.wechat.service.WechatService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -42,7 +45,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -50,6 +52,10 @@ import java.net.URLEncoder;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -121,9 +127,13 @@ public class ExportFileController {
@Resource(name = "WechatService") @Resource(name = "WechatService")
private WechatService wechatService; private WechatService wechatService;
@Resource(name = "attDetailByMonthService")
private AttDetailByMonthService attDetailByMonthService;
/** /**
* 分公司项目部导出 * 分公司项目部导出
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -155,6 +165,7 @@ public class ExportFileController {
/** /**
* 轮休请假外出办事导出 * 轮休请假外出办事导出
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -165,8 +176,8 @@ public class ExportFileController {
public void exportHoliday(HttpServletResponse response, HolidayBean bean) { public void exportHoliday(HttpServletResponse response, HolidayBean bean) {
try { try {
List<HolidayBean> personExportVoList = new ArrayList<>(); List<HolidayBean> personExportVoList = new ArrayList<>();
if("审批".equals(bean.getExportType())){ if ("审批".equals(bean.getExportType())) {
}else{ } else {
//只能查询自己的 //只能查询自己的
bean.setUserId(SecurityUtils.getLoginUser().getSysUser().getUserId()); bean.setUserId(SecurityUtils.getLoginUser().getSysUser().getUserId());
} }
@ -176,15 +187,15 @@ public class ExportFileController {
vo.setId((i + 1)); 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.setExamineStatus(BusinessConstants.WAIT_CHECK.equals(vo.getExamineStatus()) ? "待审核" : BusinessConstants.PASS_CHECK.equals(vo.getExamineStatus()) ? "已通过" : BusinessConstants.NOT_PASS_CHECK.equals(vo.getExamineStatus()) ? "未通过" : "撤回");
//事件处理 //事件处理
if("1".equals(vo.getLeaveStartInterval())){ if ("1".equals(vo.getLeaveStartInterval())) {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" 上午"); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " 上午");
}else{ } else {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" 下午"); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " 下午");
} }
if("1".equals(vo.getLeaveEndInterval())){ if ("1".equals(vo.getLeaveEndInterval())) {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" 上午"); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " 上午");
}else{ } else {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" 下午"); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " 下午");
} }
// 创建一个 SimpleDateFormat 对象用于格式化日期 // 创建一个 SimpleDateFormat 对象用于格式化日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -201,6 +212,7 @@ public class ExportFileController {
/** /**
* 考勤明细导出/原始数据导出 * 考勤明细导出/原始数据导出
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -211,9 +223,9 @@ public class ExportFileController {
public void att(HttpServletResponse response, AttDataDetailsBean bean) { public void att(HttpServletResponse response, AttDataDetailsBean bean) {
try { try {
List<AttDataDetailsBean> attList; List<AttDataDetailsBean> attList;
if("考勤明细".equals(bean.getExportType())){ if ("考勤明细".equals(bean.getExportType())) {
attList = attendanceDetailsService.exportAttDetailsList(bean); attList = attendanceDetailsService.exportAttDetailsList(bean);
}else{ } else {
attList = attendanceDetailsService.exportAttOriginalsList(bean); attList = attendanceDetailsService.exportAttOriginalsList(bean);
} }
//将数据转换成为汉字 //将数据转换成为汉字
@ -249,9 +261,9 @@ public class ExportFileController {
.map(user -> { .map(user -> {
AttDayBean attDayBean = new AttDayBean(); AttDayBean attDayBean = new AttDayBean();
attDayBean.setCurrentDay(user.getAttCurrentDay()); attDayBean.setCurrentDay(user.getAttCurrentDay());
if(!user.getToWorkAttStatus().equals(user.getOffWorkAttStatus())){ if (!user.getToWorkAttStatus().equals(user.getOffWorkAttStatus())) {
attDayBean.setAttType(user.getToWorkAttStatus()+"|"+user.getOffWorkAttStatus()); attDayBean.setAttType(user.getToWorkAttStatus() + "|" + user.getOffWorkAttStatus());
}else{ } else {
attDayBean.setAttType(user.getToWorkAttStatus()); attDayBean.setAttType(user.getToWorkAttStatus());
} }
// if(user.getOrgName().contains(",")){ // if(user.getOrgName().contains(",")){
@ -267,7 +279,7 @@ public class ExportFileController {
.anyMatch(attDay -> dayStr.equals(attDay.getCurrentDay())); .anyMatch(attDay -> dayStr.equals(attDay.getCurrentDay()));
// 如果不存在则添加新的 AttDayBean 记录 // 如果不存在则添加新的 AttDayBean 记录
if (!dayExists) { if (!dayExists) {
listAttDay.add(new AttDayBean(dayStr, "","")); listAttDay.add(new AttDayBean(dayStr, "", ""));
} }
} }
@ -327,19 +339,19 @@ public class ExportFileController {
// "部门:",true); // "部门:",true);
writer.merge(2 + days.size(), writer.merge(2 + days.size(),
bean.getStartDate() + "" + bean.getEndDate() + "考勤",true); bean.getStartDate() + "" + bean.getEndDate() + "考勤", true);
int rowNum = 2; int rowNum = 2;
writer.merge(rowNum + listData.size(),rowNum + listData.size() + 1,0,0, writer.merge(rowNum + listData.size(), rowNum + listData.size() + 1, 0, 0,
"说明",false); "说明", false);
writer.merge(rowNum + listData.size(),rowNum + listData.size(),1,2 + days.size(), 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(), writer.merge(rowNum + listData.size() + 1, rowNum + listData.size() + 1, 1, 2 + days.size(),
"2.员工有关请假凭证记录清楚准确与本表于次月3日前一并报人力资源管理部门专业分公司报送时间为30日前",false); "2.员工有关请假凭证记录清楚准确与本表于次月3日前一并报人力资源管理部门专业分公司报送时间为30日前", false);
writer.autoSizeColumn(3); writer.autoSizeColumn(3);
writer.write(rows, true); writer.write(rows, true);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
try { try {
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode( bean.getStartDate() + "" + bean.getEndDate() + "考勤", "UTF-8") + ".xlsx"); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(bean.getStartDate() + "" + bean.getEndDate() + "考勤", "UTF-8") + ".xlsx");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -361,6 +373,7 @@ public class ExportFileController {
/** /**
* 组织导出 * 组织导出
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -390,6 +403,7 @@ public class ExportFileController {
/** /**
* 日报表导出 * 日报表导出
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -398,24 +412,120 @@ public class ExportFileController {
*/ */
@GetMapping("/exportDayReport") @GetMapping("/exportDayReport")
public void exportDayReport(HttpServletResponse response, AttDayReportBean bean) { public void exportDayReport(HttpServletResponse response, AttDayReportBean bean) {
// try {
// List<AttDayReportExportBean> personExportVoList = new ArrayList<>();
// List<AttDayReportBean> attDayReportList = attendanceDetailsService.getAttDayReportList(bean);
// for (int i = 0; i < attDayReportList.size(); i++) {
// AttDayReportBean vo = attDayReportList.get(i);
// AttDayReportExportBean voe = new AttDayReportExportBean();
// BeanUtils.copyProperties(vo, voe);
// voe.setId((i + 1));
// personExportVoList.add(voe);
// }
// extracted(personExportVoList, AttDayReportExportBean.class, "日报表导出", "日报表导出", "日报表导出", response);
// } catch (Exception e) {
// log.error(e.toString(), e);
// }
try { try {
List<AttDayReportExportBean> personExportVoList = new ArrayList<>(); MultiSheetExcelExporter exporter = new MultiSheetExcelExporter();
List<AttDayReportBean> attDayReportList = attendanceDetailsService.getAttDayReportList(bean); List<AttDayReportBean> attDayReportList = attendanceDetailsService.getAttDayReportList(bean);
Sheet departmentSheet1 = exporter.createSheet("日报表详情");
List<String> departmentHeaders1 = Arrays.asList("序号", "考勤日期", "正常打卡人数", "迟到人数", "早退人数",
"矿工人数", "请假人数", "打卡地异常人数", "出入异常人数", "轮休人数", "临时外出人数");
exporter.addHeaderRow(departmentSheet1, departmentHeaders1);
List<Map<String, Object>> departmentData1 = new ArrayList<>();
for (int i = 0; i < attDayReportList.size(); i++) { for (int i = 0; i < attDayReportList.size(); i++) {
AttDayReportBean vo = attDayReportList.get(i); Map<String, Object> map = new LinkedHashMap<>();
AttDayReportExportBean voe = new AttDayReportExportBean(); map.put("序号", i + 1);
BeanUtils.copyProperties(vo, voe); map.put("考勤日期", attDayReportList.get(i).getAttCurrentDay());
voe.setId((i + 1)); map.put("正常打卡人数", attDayReportList.get(i).getNormalNum());
personExportVoList.add(voe); map.put("迟到人数", attDayReportList.get(i).getLateNum());
map.put("早退人数", attDayReportList.get(i).getEarlyNum());
map.put("矿工人数", attDayReportList.get(i).getSkippingNum());
map.put("请假人数", attDayReportList.get(i).getLeaveNum());
map.put("打卡地异常人数", attDayReportList.get(i).getAddressErrorNum());
map.put("出入异常人数", attDayReportList.get(i).getEinErrorNum());
map.put("轮休人数", attDayReportList.get(i).getRestNum());
map.put("临时外出人数", attDayReportList.get(i).getOutNum());
departmentData1.add(map);
} }
extracted(personExportVoList, AttDayReportExportBean.class, "日报表导出", "日报表导出", "日报表导出", response); exporter.addDataRows(departmentSheet1, departmentData1, departmentHeaders1);
} catch (Exception e) { //详情的数据导出
log.error(e.toString(), e); Map<String, String> headers = new HashMap<>();
headers.put("1", "正常打卡");
headers.put("2", "迟到详情");
headers.put("3", "旷工详情");
headers.put("4", "早退详情");
headers.put("5", "轮休详情");
headers.put("6", "请假详情");
headers.put("7", "外出办事");
headers.put("8", "出入异常");
headers.put("9", "打卡地异常");
Map<String, String> attStatus = getStringStringMap();
if (StringHelper.isNotEmpty(bean.getStartDate()) && StringHelper.isNotEmpty(bean.getEndDate())) {
AttDataDetailsBean dayTable = new AttDataDetailsBean();
dayTable.setStartDate(bean.getStartDate());
dayTable.setEndDate(bean.getEndDate());
headers.entrySet()
.forEach(entry -> {
dayTable.setAttStatus(entry.getKey());
List<AttDataDetailsBean> list = attendanceDetailsService.getAttDayReportDetailsList(dayTable);
Sheet departmentSheet2 = exporter.createSheet(entry.getValue());
List<String> departmentHeaders2 = Arrays.asList("序号", "姓名", "所属部门", "打卡日期", "上班打卡时间", "上班状态", "打卡地址", "下班打卡时间", "下班状态", "打卡地址");
exporter.addHeaderRow(departmentSheet2, departmentHeaders2);
List<Map<String, Object>> departmentData2 = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("序号", i + 1);
map.put("姓名", list.get(i).getUserName());
map.put("所属部门", list.get(i).getOrgName());
map.put("打卡日期", list.get(i).getAttCurrentDay());
map.put("上班打卡时间", list.get(i).getToWorkAttCurrentTime());
map.put("上班状态", attStatus.get(list.get(i).getToWorkAttStatus()));
map.put("上班打卡地址", list.get(i).getToWorkAttAddress());
map.put("下班打卡时间", list.get(i).getOffWorkAttCurrentTime());
map.put("下班状态", attStatus.get(list.get(i).getOffWorkAttStatus()));
map.put("下班打卡地址", list.get(i).getOffWorkAttAddress());
departmentData2.add(map);
}
exporter.addDataRows(departmentSheet2, departmentData2, departmentHeaders2);
});
// 导出Excel文件
exporter.exportToResponse(response, "日报表导出");
}
} catch (IOException e) {
e.printStackTrace();
} }
}
private Map<String, String> getStringStringMap() {
Map<String, String> attStatus = new HashMap<>();
attStatus.put("1", "正常");
attStatus.put("2", "迟到");
attStatus.put("3", "旷工");
attStatus.put("4", "早退");
attStatus.put("5", "轮休");
attStatus.put("6", "请假");
attStatus.put("7", "外出");
attStatus.put("8", "出入异常");
attStatus.put("9", "打卡地异常");
attStatus.put("10", "出差");
attStatus.put("11", "法定节假日");
attStatus.put("12", "年休假");
attStatus.put("13", "探亲假");
attStatus.put("14", "事假");
attStatus.put("15", "病假");
attStatus.put("16", "产假");
attStatus.put("17", "婚假");
attStatus.put("18", "丧假");
return attStatus;
} }
/** /**
* 月报表导出 * 月报表导出
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -424,35 +534,143 @@ public class ExportFileController {
*/ */
@GetMapping("/exportMonthReport") @GetMapping("/exportMonthReport")
public void exportMonthReport(HttpServletResponse response, AttMonthReportBean bean) { public void exportMonthReport(HttpServletResponse response, AttMonthReportBean bean) {
// try {
// List<AttMonthReportExportBean> personExportVoList = new ArrayList<>();
// List<AttMonthReportBean> attMonthReportList = attendanceDetailsService.getAttMonthReportList(bean);
// for (int i = 0; i < attMonthReportList.size(); i++) {
// AttMonthReportBean vo = attMonthReportList.get(i);
// AttMonthReportExportBean voe = new AttMonthReportExportBean();
// BeanUtils.copyProperties(vo, voe);
// voe.setId(i + 1);
// personExportVoList.add(voe);
// }
// extracted(personExportVoList, AttMonthReportExportBean.class, "月报表导出", "月报表导出", "月报表导出", response);
// } catch (Exception e) {
// log.error(e.toString(), e);
// }
try { try {
List<AttMonthReportExportBean> personExportVoList = new ArrayList<>(); MultiSheetExcelExporter exporter = new MultiSheetExcelExporter();
List<AttMonthReportBean> attMonthReportList = attendanceDetailsService.getAttMonthReportList(bean); List<AttMonthReportBean> attDayReportList = attendanceDetailsService.getAttMonthReportList(bean);
for (int i = 0; i < attMonthReportList.size(); i++) { Sheet departmentSheet1 = exporter.createSheet("月报表详情");
AttMonthReportBean vo = attMonthReportList.get(i); List<String> departmentHeaders1 = Arrays.asList("序号", "姓名", "所属部门", "考勤月", "应考勤天数", "正常打卡天数",
AttMonthReportExportBean voe = new AttMonthReportExportBean(); "迟到天数", "早退天数", "矿工天数", "请假天数", "打卡地异常天数", "出入异常天数", "轮休天数", "临时外出天数");
BeanUtils.copyProperties(vo, voe); exporter.addHeaderRow(departmentSheet1, departmentHeaders1);
voe.setId(i + 1); List<Map<String, Object>> departmentData1 = new ArrayList<>();
personExportVoList.add(voe); for (int i = 0; i < attDayReportList.size(); i++) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("序号", i + 1);
map.put("姓名", attDayReportList.get(i).getUserName());
map.put("所属部门", attDayReportList.get(i).getOrgName());
map.put("考勤月", attDayReportList.get(i).getMonth());
map.put("应考勤天数", attDayReportList.get(i).getRequiredDays());
map.put("正常打卡天数", attDayReportList.get(i).getNormalNum());
map.put("迟到天数", attDayReportList.get(i).getLateNum());
map.put("早退天数", attDayReportList.get(i).getEarlyNum());
map.put("矿工天数", attDayReportList.get(i).getSkippingNum());
map.put("请假天数", attDayReportList.get(i).getLeaveNum());
map.put("打卡地异常天数", attDayReportList.get(i).getAddressErrorNum());
map.put("出入异常天数", attDayReportList.get(i).getEinErrorNum());
map.put("轮休天数", attDayReportList.get(i).getRestNum());
map.put("临时外出天数", attDayReportList.get(i).getOutNum());
departmentData1.add(map);
} }
extracted(personExportVoList, AttMonthReportExportBean.class, "月报表导出", "月报表导出", "月报表导出", response); exporter.addDataRows(departmentSheet1, departmentData1, departmentHeaders1);
} catch (Exception e) { //详情的数据导出
log.error(e.toString(), e); Map<String, String> headers = new HashMap<>();
headers.put("1", "正常打卡");
headers.put("2", "迟到详情");
headers.put("3", "旷工详情");
headers.put("4", "早退详情");
headers.put("5", "轮休详情");
headers.put("6", "请假详情");
headers.put("7", "外出办事");
headers.put("8", "出入异常");
headers.put("9", "打卡地异常");
Map<String, String> attStatus = getStringStringMap();
if (StringHelper.isNotEmpty(bean.getMonth())) {
List<String> monthFirstAndLast = getMonthFirstAndLast(bean.getMonth());
AttDetailBean dayTable = new AttDetailBean();
dayTable.setStartDate(monthFirstAndLast.get(0));
dayTable.setEndDate(monthFirstAndLast.get(1));
headers.entrySet()
.forEach(entry -> {
List<AttDetailBean> list = attDetailByMonthService.getDetailList(dayTable);
Sheet departmentSheet2 = exporter.createSheet(entry.getValue());
List<String> departmentHeaders2 = Arrays.asList("序号", "姓名", "所属部门", "打卡日期", "上班打卡时间", "上班状态", "打卡地址", "下班打卡时间", "下班状态", "打卡地址");
exporter.addHeaderRow(departmentSheet2, departmentHeaders2);
List<Map<String, Object>> departmentData2 = new ArrayList<>();
// for (int i = 0; i < list.size(); i++) {
// Map<String, Object> map = new LinkedHashMap<>();
// map.put("序号", i + 1);
// map.put("姓名", list.get(i).getUserName());
// map.put("所属部门", list.get(i).getOrgName());
// map.put("打卡日期", list.get(i).getAttCurrentDay());
// map.put("上班打卡时间", list.get(i).getToWorkAttCurrentTime());
// map.put("上班状态", attStatus.get(list.get(i).getToWorkAttStatus()));
// map.put("上班打卡地址", list.get(i).getToWorkAttAddress());
// map.put("下班打卡时间", list.get(i).getOffWorkAttCurrentTime());
// map.put("下班状态", attStatus.get(list.get(i).getOffWorkAttStatus()));
// map.put("下班打卡地址", list.get(i).getOffWorkAttAddress());
// departmentData2.add(map);
// }
exporter.addDataRows(departmentSheet2, departmentData2, departmentHeaders2);
});
// 导出Excel文件
exporter.exportToResponse(response, "日报表导出");
}
} catch (IOException e) {
e.printStackTrace();
} }
} }
private List<String> getMonthFirstAndLast(String monthString) {
List<String> months = new ArrayList<>();
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
YearMonth yearMonth;
// 使用预定义的 ISO_LOCAL_DATE 格式 (yyyy-MM-dd)
DateTimeFormatter isoFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
try {
// 判空及默认为当月
if (monthString == null || monthString.trim().isEmpty()) {
// 如果字符串为空或仅包含空白字符取当前月份
yearMonth = YearMonth.from(LocalDate.now());
} else {
// 尝试将字符串解析为 YearMonth 对象
yearMonth = YearMonth.parse(monthString, formatter);
}
// 获取该月的第一天
LocalDate firstDayOfMonth = yearMonth.atDay(1);
// 获取该月的最后一天
LocalDate lastDayOfMonth = yearMonth.atEndOfMonth();
months.add(firstDayOfMonth.format(isoFormatter));
months.add(lastDayOfMonth.format(isoFormatter));
} catch (DateTimeParseException e) {
// 如果解析失败打印错误信息并使用当前月份
YearMonth currentYearMonth = YearMonth.from(LocalDate.now());
LocalDate firstDayOfCurrentMonth = currentYearMonth.atDay(1);
LocalDate lastDayOfCurrentMonth = currentYearMonth.atEndOfMonth();
months.add(firstDayOfCurrentMonth.format(isoFormatter));
months.add(lastDayOfCurrentMonth.format(isoFormatter));
}
return months;
}
/** /**
* 导出excel文件 * 导出excel文件
* @param list 数据 *
* @param clazz bean.class * @param list 数据
* @param title 标题 * @param clazz bean.class
* @param title 标题
* @param sheetName sheet名字 * @param sheetName sheet名字
* @param fileName 文件名 * @param fileName 文件名
* @param response 响应 * @param response 响应
* @throws IOException * @throws IOException
*/ */
private static void extracted(List<? extends Object> list,Class<? extends Object> clazz,String title,String sheetName,String fileName, HttpServletResponse response) throws IOException { private static void extracted(List<? extends Object> list, Class<? extends Object> clazz, String title, String sheetName, String fileName, HttpServletResponse response) throws IOException {
ExportParams exportParams = new ExportParams(title, sheetName, ExcelType.XSSF); ExportParams exportParams = new ExportParams(title, sheetName, ExcelType.XSSF);
exportParams.setStyle(ExcelStyleUtil.class); exportParams.setStyle(ExcelStyleUtil.class);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, clazz, list); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, clazz, list);
@ -497,9 +715,9 @@ public class ExportFileController {
} }
/** /**
* 休假报备 * 休假报备
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -513,15 +731,15 @@ public class ExportFileController {
LeaveReportingBean vo = personLists.get(i); LeaveReportingBean vo = personLists.get(i);
vo.setId((i + 1)); vo.setId((i + 1));
//事件处理 //事件处理
if("1".equals(vo.getLeaveStartInterval())){ if ("1".equals(vo.getLeaveStartInterval())) {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" "); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " ");
}else{ } else {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" "); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " ");
} }
if("1".equals(vo.getLeaveEndInterval())){ if ("1".equals(vo.getLeaveEndInterval())) {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" "); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " ");
}else{ } else {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" "); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " ");
} }
// 创建一个 SimpleDateFormat 对象用于格式化日期 // 创建一个 SimpleDateFormat 对象用于格式化日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -539,6 +757,7 @@ public class ExportFileController {
/** /**
* 出差报备 * 出差报备
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -552,15 +771,15 @@ public class ExportFileController {
EvectionBean vo = personLists.get(i); EvectionBean vo = personLists.get(i);
vo.setId((i + 1)); vo.setId((i + 1));
//事件处理 //事件处理
if("1".equals(vo.getLeaveStartInterval())){ if ("1".equals(vo.getLeaveStartInterval())) {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" "); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " ");
}else{ } else {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" "); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " ");
} }
if("1".equals(vo.getLeaveEndInterval())){ if ("1".equals(vo.getLeaveEndInterval())) {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" "); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " ");
}else{ } else {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" "); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " ");
} }
// 创建一个 SimpleDateFormat 对象用于格式化日期 // 创建一个 SimpleDateFormat 对象用于格式化日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -577,6 +796,7 @@ public class ExportFileController {
/** /**
* 组织架构变更导出 * 组织架构变更导出
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -588,12 +808,12 @@ public class ExportFileController {
public void exportOrgChange(HttpServletResponse response, OrgChangeBean bean) { public void exportOrgChange(HttpServletResponse response, OrgChangeBean bean) {
try { try {
List<OrgChangeBean> personExportVoList = new ArrayList<>(); List<OrgChangeBean> personExportVoList = new ArrayList<>();
if("1".equals(bean.getExportType())){ if ("1".equals(bean.getExportType())) {
//只查自己的 //只查自己的
Long userId = SecurityUtils.getLoginUser().getSysUser().getUserId(); Long userId = SecurityUtils.getLoginUser().getSysUser().getUserId();
bean.setUserId(userId); bean.setUserId(userId);
}else{ } else {
if(StringUtils.isEmpty(bean.getIsCheck())){ if (StringUtils.isEmpty(bean.getIsCheck())) {
//不查撤回的 //不查撤回的
bean.setIsCheck("-1"); bean.setIsCheck("-1");
} }
@ -618,9 +838,9 @@ public class ExportFileController {
} }
/** /**
* 小程序打卡数据导出 * 小程序打卡数据导出
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -664,7 +884,7 @@ public class ExportFileController {
break; break;
case "6": case "6":
attStatus = "请假"; attStatus = "请假";
break; break;
case "7": case "7":
attStatus = "外出办事"; attStatus = "外出办事";
break; break;
@ -690,6 +910,7 @@ public class ExportFileController {
/** /**
* 数据管理-休假报备 * 数据管理-休假报备
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -703,15 +924,15 @@ public class ExportFileController {
WechatLeaveReportingBean vo = personLists.get(i); WechatLeaveReportingBean vo = personLists.get(i);
vo.setId((i + 1)); vo.setId((i + 1));
//事件处理 //事件处理
if("1".equals(vo.getLeaveStartInterval())){ if ("1".equals(vo.getLeaveStartInterval())) {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" "); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " ");
}else{ } else {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" "); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " ");
} }
if("1".equals(vo.getLeaveEndInterval())){ if ("1".equals(vo.getLeaveEndInterval())) {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" "); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " ");
}else{ } else {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" "); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " ");
} }
// 创建一个 SimpleDateFormat 对象用于格式化日期 // 创建一个 SimpleDateFormat 对象用于格式化日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -729,6 +950,7 @@ public class ExportFileController {
/** /**
* 数据管理-出差报备 * 数据管理-出差报备
*
* @param response * @param response
* @param bean * @param bean
* @return void * @return void
@ -742,15 +964,15 @@ public class ExportFileController {
WechatEvectionBean vo = personLists.get(i); WechatEvectionBean vo = personLists.get(i);
vo.setId((i + 1)); vo.setId((i + 1));
//事件处理 //事件处理
if("1".equals(vo.getLeaveStartInterval())){ if ("1".equals(vo.getLeaveStartInterval())) {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" "); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " ");
}else{ } else {
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" "); vo.setLeaveStartInterval(vo.getLeaveStartDate() + " ");
} }
if("1".equals(vo.getLeaveEndInterval())){ if ("1".equals(vo.getLeaveEndInterval())) {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" "); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " ");
}else{ } else {
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" "); vo.setLeaveEndInterval(vo.getLeaveEndDate() + " ");
} }
// 创建一个 SimpleDateFormat 对象用于格式化日期 // 创建一个 SimpleDateFormat 对象用于格式化日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

View File

@ -183,6 +183,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(vat.att_current_day &gt;= CONCAT(#{attCurrent}, '-01') AND (vat.att_current_day &gt;= CONCAT(#{attCurrent}, '-01') AND
vat.att_current_day &lt; LAST_DAY(CONCAT(#{attCurrent}, '-01'))) vat.att_current_day &lt; LAST_DAY(CONCAT(#{attCurrent}, '-01')))
</if> </if>
<if test="startDate != null and startDate != ''">
and vat.att_current_day between #{startDate} and #{endDate}
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(vat.att_current_day,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d') and date_format(vat.att_current_day,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if> </if>

View File

@ -113,7 +113,7 @@
attendance_date as attCurrentDay, attendance_time as attCurrentTime, attendance_date as attCurrentDay, attendance_time as attCurrentTime,
CASE attendance_type WHEN '上班' THEN 1 ELSE 2 END as attType, CASE attendance_type WHEN '上班' THEN 1 ELSE 2 END as attType,
'0' as attAddress, lon as attLon, lat as attLat, '1' as dataSource '0' as attAddress, lon as attLon, lat as attLat, '1' as dataSource
from gz_cloud.fc_sup_attendance sup from gz_cloud_test.fc_sup_attendance sup
where sup.attendance_date where sup.attendance_date
<if test=' pushType == "1" '> <if test=' pushType == "1" '>
>= #{pushDate} - INTERVAL 3 DAY >= #{pushDate} - INTERVAL 3 DAY

View File

@ -156,21 +156,28 @@
select su.user_name, so.org_name, v.* from v_att_update_data v select su.user_name, so.org_name, v.* from v_att_update_data v
left join sys_user su on su.user_id = v.user_id left join sys_user su on su.user_id = v.user_id
left join sys_organization so on so.id = v.org_id left join sys_organization so on so.id = v.org_id
where att_current_day = #{attCurrentDay} <where>
<if test='attStatus != null and attStatus == "6"'> <if test="attCurrentDay != null and attCurrentDay != ''">
and (toWorkAttStatus in (12,13,14,15,16,17,18) or offWorkAttStatus in (12,13,14,15,16,17,18)) AND att_current_day = #{attCurrentDay}
</if>
<if test='attStatus != null and attStatus != "6"'>
<if test='attStatus == "1"'>
and ( toWorkAttStatus = #{attStatus} and offWorkAttStatus = #{attStatus} )
</if> </if>
<if test='attStatus != "1"'> <if test="startDate != null and startDate != ''">
and ( toWorkAttStatus = #{attStatus} or offWorkAttStatus = #{attStatus} ) AND att_current_day between #{startDate} AND #{endDate}
</if> </if>
</if> <if test='attStatus != null and attStatus == "6"'>
<if test="userName != null and userName != ''"> and (toWorkAttStatus in (12,13,14,15,16,17,18) or offWorkAttStatus in (12,13,14,15,16,17,18))
AND su.user_name like concat('%', #{userName}, '%') </if>
</if> <if test='attStatus != null and attStatus != "6"'>
<if test='attStatus == "1"'>
and ( toWorkAttStatus = #{attStatus} and offWorkAttStatus = #{attStatus} )
</if>
<if test='attStatus != "1"'>
and ( toWorkAttStatus = #{attStatus} or offWorkAttStatus = #{attStatus} )
</if>
</if>
<if test="userName != null and userName != ''">
AND su.user_name like concat('%', #{userName}, '%')
</if>
</where>
ORDER BY att_current_day DESC ORDER BY att_current_day DESC
</select> </select>

View File

@ -9,6 +9,8 @@
su.user_name, su.user_name,
so.org_name AS oldOrgName, so.org_name AS oldOrgName,
so2.org_name AS newOrgName, so2.org_name AS newOrgName,
ag.group_name AS oldAttGroup,
ag2.group_name AS newAttGroup,
oc.* oc.*
FROM FROM
org_change oc org_change oc
@ -18,6 +20,10 @@
AND so.is_active = '1' AND so.is_active = '1'
LEFT JOIN sys_organization so2 ON oc.new_org_id = so2.id LEFT JOIN sys_organization so2 ON oc.new_org_id = so2.id
AND so2.is_active = '1' AND so2.is_active = '1'
LEFT JOIN att_group ag ON oc.old_att_group = ag.id
AND ag.is_active = '1'
LEFT JOIN att_group ag2 ON oc.new_att_group = ag2.id
AND ag2.is_active = '1'
WHERE WHERE
oc.is_active = '1' oc.is_active = '1'
<if test="userId != null and userId != '' "> <if test="userId != null and userId != '' ">