|
@@ -1,6 +1,7 @@
|
|
package cn.com.ctop.oa.modules.controller;
|
|
package cn.com.ctop.oa.modules.controller;
|
|
|
|
|
|
import cn.com.ctop.common.module.annotation.AutoLog;
|
|
import cn.com.ctop.common.module.annotation.AutoLog;
|
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.ExportExcelUtils;
|
|
import cn.com.ctop.common.module.utils.ExportExcelUtils;
|
|
import cn.com.ctop.common.module.utils.HttpUtils;
|
|
import cn.com.ctop.common.module.utils.HttpUtils;
|
|
import cn.com.ctop.oa.modules.entity.WechatAttendance;
|
|
import cn.com.ctop.oa.modules.entity.WechatAttendance;
|
|
@@ -10,6 +11,7 @@ import com.alibaba.fastjson.JSON;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -44,7 +46,6 @@ import java.io.UnsupportedEncodingException;
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
-import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -266,33 +267,51 @@ public class WechatNoListController {
|
|
* @param requestBody
|
|
* @param requestBody
|
|
* @param response
|
|
* @param response
|
|
*/
|
|
*/
|
|
- @GetMapping("/excel")
|
|
|
|
- public void getExcelReport(HttpServletResponse response) {
|
|
|
|
- Map<String, Object> paramsMap = new HashMap<>();
|
|
|
|
|
|
+ @PostMapping("/excel")
|
|
|
|
+ public void getExcelReport(HttpServletResponse response, @RequestBody Map<String, Object> paramsMap) {
|
|
|
|
+
|
|
List<WechatAttendance> excelData = wechatNoListService.queryAttendanceData(paramsMap);
|
|
List<WechatAttendance> excelData = wechatNoListService.queryAttendanceData(paramsMap);
|
|
- if (excelData.isEmpty()) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- String[] titles = {"姓名", "部门", "考勤日期", "考勤类型", "考勤状态", "考勤时间", "审核状态", "状态时长"};
|
|
|
|
- List<List<Object>> excelList = 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());
|
|
|
|
- excelList.add(temp);
|
|
|
|
- });
|
|
|
|
|
|
+ List<WechatAttendance> overtimeData = wechatNoListService.queryOverTimeData(paramsMap);
|
|
try {
|
|
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();
|
|
OutputStream os = response.getOutputStream();
|
|
ExportExcelUtils eeu = new ExportExcelUtils();
|
|
ExportExcelUtils eeu = new ExportExcelUtils();
|
|
XSSFWorkbook workbook = new XSSFWorkbook();
|
|
XSSFWorkbook workbook = new XSSFWorkbook();
|
|
- eeu.exportExcelForAttendance(workbook, 0, "考勤", titles, excelList);
|
|
|
|
- HttpUtils.setResponseHeader(response, "考勤异常记录.xlsx");
|
|
|
|
|
|
+ String[] titles = {"姓名", "部门", "考勤日期", "考勤类型", "考勤状态", "考勤时间", "审核状态", "状态时长", "审批状态"};
|
|
|
|
+ String[] overtimeTitles = {"姓名", "部门", "加班日期", "加班时长"};
|
|
|
|
+ eeu.exportExcelForAttendance(workbook, 0, "异常考勤", titles, excelList);
|
|
|
|
+ eeu.exportExcel(workbook, 1, "加班考勤", overtimeTitles, overtimeExcelList);
|
|
|
|
+ HttpUtils.setResponseHeader(response, "考勤记录.xlsx");
|
|
workbook.write(os);
|
|
workbook.write(os);
|
|
os.flush();
|
|
os.flush();
|
|
os.close();
|
|
os.close();
|
|
@@ -300,4 +319,50 @@ public class WechatNoListController {
|
|
log.error(e.getMessage());
|
|
log.error(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 考勤异常数据查询(分页)
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @AutoLog(value = "异常考勤数据-分页列表查询")
|
|
|
|
+ @PostMapping(value = "/selectNoListPage")
|
|
|
|
+ public Result<PageInfo<WechatAttendance>> selectNoListPage(@RequestBody Map<String, Object> paramsMap) {
|
|
|
|
+ Result<PageInfo<WechatAttendance>> result = new Result<>();
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 加班考勤数据查询(分页)
|
|
|
|
+ *
|
|
|
|
+ * @param id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @AutoLog(value = "加班考勤数据-分页列表查询")
|
|
|
|
+ @PostMapping(value = "/selectOverTimePage")
|
|
|
|
+ public Result<PageInfo<WechatAttendance>> selectOverTimePage(@RequestBody Map<String, Object> paramsMap) {
|
|
|
|
+ Result<PageInfo<WechatAttendance>> result = new Result<>();
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
}
|
|
}
|