|
@@ -46,7 +46,6 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -269,46 +268,47 @@ public class WechatNoListController {
|
|
|
* @param response
|
|
|
*/
|
|
|
@PostMapping("/excel")
|
|
|
- public void getExcelReport(HttpServletResponse response) {
|
|
|
- Map<String, Object> paramsMap = new HashMap<>();
|
|
|
+ public void getExcelReport(HttpServletResponse response, @RequestBody Map<String, Object> paramsMap) {
|
|
|
+
|
|
|
List<WechatAttendance> excelData = wechatNoListService.queryAttendanceData(paramsMap);
|
|
|
List<WechatAttendance> overtimeData = wechatNoListService.queryOverTimeData(paramsMap);
|
|
|
- if (excelData.isEmpty() || overtimeData.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- String[] titles = {"姓名", "部门", "考勤日期", "考勤类型", "考勤状态", "考勤时间", "审核状态", "状态时长", "审批状态"};
|
|
|
- String[] overtimeTitles = {"姓名", "部门", "加班日期", "加班时长"};
|
|
|
- List<List<Object>> excelList = new ArrayList<>();
|
|
|
- List<List<Object>> overtimeExcelList = new ArrayList<>();
|
|
|
- excelData.forEach(data -> {
|
|
|
- List<Object> temp = new ArrayList<>();
|
|
|
- temp.add(data.getUserName());
|
|
|
- temp.add(data.getDepartName());
|
|
|
- temp.add(data.getCheckinDate());
|
|
|
- temp.add(data.getCheckinType());
|
|
|
- temp.add(data.getExceptionType());
|
|
|
- temp.add(data.getCheckinTime());
|
|
|
- temp.add(data.getType());
|
|
|
- temp.add(data.getStateDuration());
|
|
|
- if (!Check.isNull(data.getStatus())) {
|
|
|
- temp.add("1".equals(data.getStatus()) ? "审批中" : "已通过");
|
|
|
- } else {
|
|
|
- temp.add("");
|
|
|
- }
|
|
|
- excelList.add(temp);
|
|
|
- });
|
|
|
- overtimeData.forEach(data -> {
|
|
|
- List<Object> temp = new ArrayList<>();
|
|
|
- temp.add(data.getUserName());
|
|
|
- temp.add(data.getDepartName());
|
|
|
- temp.add(data.getCheckinDate());
|
|
|
- temp.add(data.getOvertime());
|
|
|
- overtimeExcelList.add(temp);
|
|
|
- });
|
|
|
try {
|
|
|
+ List<List<Object>> excelList = new ArrayList<>();
|
|
|
+ List<List<Object>> overtimeExcelList = new ArrayList<>();
|
|
|
+ if (!excelData.isEmpty()) {
|
|
|
+ excelData.forEach(data -> {
|
|
|
+ List<Object> temp = new ArrayList<>();
|
|
|
+ temp.add(data.getUserName());
|
|
|
+ temp.add(data.getDepartName());
|
|
|
+ temp.add(data.getCheckinDate());
|
|
|
+ temp.add(data.getCheckinType());
|
|
|
+ temp.add(data.getExceptionType());
|
|
|
+ temp.add(data.getCheckinTime());
|
|
|
+ temp.add(data.getType());
|
|
|
+ temp.add(data.getStateDuration());
|
|
|
+ if (!Check.isNull(data.getStatus())) {
|
|
|
+ temp.add("1".equals(data.getStatus()) ? "审批中" : "已通过");
|
|
|
+ } else {
|
|
|
+ temp.add("");
|
|
|
+ }
|
|
|
+ excelList.add(temp);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (!overtimeData.isEmpty()) {
|
|
|
+ overtimeData.forEach(data -> {
|
|
|
+ List<Object> temp = new ArrayList<>();
|
|
|
+ temp.add(data.getUserName());
|
|
|
+ temp.add(data.getDepartName());
|
|
|
+ temp.add(data.getCheckinDate());
|
|
|
+ temp.add(data.getOvertime());
|
|
|
+ overtimeExcelList.add(temp);
|
|
|
+ });
|
|
|
+ }
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
ExportExcelUtils eeu = new ExportExcelUtils();
|
|
|
XSSFWorkbook workbook = new XSSFWorkbook();
|
|
|
+ String[] titles = {"姓名", "部门", "考勤日期", "考勤类型", "考勤状态", "考勤时间", "审核状态", "状态时长", "审批状态"};
|
|
|
+ String[] overtimeTitles = {"姓名", "部门", "加班日期", "加班时长"};
|
|
|
eeu.exportExcelForAttendance(workbook, 0, "异常考勤", titles, excelList);
|
|
|
eeu.exportExcel(workbook, 1, "加班考勤", overtimeTitles, overtimeExcelList);
|
|
|
HttpUtils.setResponseHeader(response, "考勤记录.xlsx");
|
|
@@ -326,14 +326,19 @@ public class WechatNoListController {
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- @AutoLog(value = "考勤异常数据查询")
|
|
|
+ @AutoLog(value = "异常考勤数据-分页列表查询")
|
|
|
@PostMapping(value = "/selectNoListPage")
|
|
|
public Result<PageInfo<WechatAttendance>> selectNoListPage(@RequestBody Map<String, Object> paramsMap) {
|
|
|
Result<PageInfo<WechatAttendance>> result = new Result<>();
|
|
|
- PageInfo<WechatAttendance> pageData = wechatNoListService.selectNoListPage(paramsMap);
|
|
|
- if (!Check.isNull(pageData)) {
|
|
|
- result.setResult(pageData);
|
|
|
- result.setSuccess(true);
|
|
|
+ try {
|
|
|
+ PageInfo<WechatAttendance> pageData = wechatNoListService.selectNoListPage(paramsMap);
|
|
|
+ if (!Check.isNull(pageData)) {
|
|
|
+ result.setResult(pageData);
|
|
|
+ result.setSuccess(true);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("异常考勤数据-分页列表查询 error ", e);
|
|
|
+ result.error500("操作失败");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -344,14 +349,19 @@ public class WechatNoListController {
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- @AutoLog(value = "加班异常数据查询")
|
|
|
+ @AutoLog(value = "加班考勤数据-分页列表查询")
|
|
|
@PostMapping(value = "/selectOverTimePage")
|
|
|
public Result<PageInfo<WechatAttendance>> selectOverTimePage(@RequestBody Map<String, Object> paramsMap) {
|
|
|
Result<PageInfo<WechatAttendance>> result = new Result<>();
|
|
|
- PageInfo<WechatAttendance> pageData = wechatNoListService.selectOverTimePage(paramsMap);
|
|
|
- if (!Check.isNull(pageData)) {
|
|
|
- result.setResult(pageData);
|
|
|
- result.setSuccess(true);
|
|
|
+ try {
|
|
|
+ PageInfo<WechatAttendance> pageData = wechatNoListService.selectOverTimePage(paramsMap);
|
|
|
+ if (!Check.isNull(pageData)) {
|
|
|
+ result.setResult(pageData);
|
|
|
+ result.setSuccess(true);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("加班考勤数据-分页列表查询 error ", e);
|
|
|
+ result.error500("操作失败");
|
|
|
}
|
|
|
return result;
|
|
|
}
|