|
@@ -69,6 +69,15 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|
|
@Value("${file.path}")
|
|
|
private String localFilePath;
|
|
|
|
|
|
+ /******************************* 考勤表中的常量 *******************************/
|
|
|
+
|
|
|
+ public static final String USERNAME= "userName";
|
|
|
+ public static final String DEPT_NAME= "deptName";
|
|
|
+ public static final String ATTENDANCE_TABLE_LEAVE_OR_SUM= "attendanceTableLeaveOrSum";
|
|
|
+ public static final String ATTENDANCE_TABLE_LATE_SUM= "attendanceTableLateSum";
|
|
|
+ public static final String ATTENDANCE_TABLE_LEAVE_SUM= "attendanceTableLeaveSum";
|
|
|
+ public static final String DATE= "date";
|
|
|
+
|
|
|
/**
|
|
|
* 本地文件上传接口
|
|
|
*
|
|
@@ -185,18 +194,16 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|
|
ObjectUtils.requireNonNull(tableName, "exportExcelCommon tableName is empty");
|
|
|
ObjectUtils.requireNonNull(empty, "exportExcelCommon empty is empty");
|
|
|
|
|
|
- GenTable genTable = redisService.getCacheObject(RedisKey.TABLE_INFO + tableName);
|
|
|
- List<GenTableColumn> columns = genTable.getColumns();
|
|
|
-
|
|
|
ExcelUtil<JSONObject> util = new ExcelUtil<>(JSONObject.class);
|
|
|
List<Map<String, Object>> list = null;
|
|
|
- List<GenTableColumn> listVisibleColumns = null;
|
|
|
if (BooleanUtils.isTrue(empty)) {
|
|
|
list = new ArrayList<>(0);
|
|
|
} else {
|
|
|
AjaxResult ajaxResult = remoteAttendanceService.statisticsByMonth(dto.getCondition());
|
|
|
if (AjaxResult.checkSuccess(ajaxResult)) {
|
|
|
list = ((List<Map<String, Object>>) ajaxResult.get(AjaxResult.DATA_TAG));
|
|
|
+ // 导出不需要user_id, 同时把map中的value换成int
|
|
|
+ List<Map<String, Object>> newList = new ArrayList<>(list.size());
|
|
|
for (Map<String, Object> map : list) {
|
|
|
map.remove("user_id");
|
|
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
|
@@ -206,15 +213,25 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|
|
entry.setValue(value1.intValue());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ Map<String, Object> newMap = new LinkedHashMap<>(map.size());
|
|
|
+ newMap.put(USERNAME, map.get(USERNAME));
|
|
|
+ newMap.put(DEPT_NAME, map.get(DEPT_NAME));
|
|
|
+ newMap.put(ATTENDANCE_TABLE_LATE_SUM, map.get(ATTENDANCE_TABLE_LATE_SUM));
|
|
|
+ newMap.put(ATTENDANCE_TABLE_LEAVE_SUM, map.get(ATTENDANCE_TABLE_LEAVE_SUM));
|
|
|
+ newMap.put(ATTENDANCE_TABLE_LEAVE_OR_SUM, map.get(ATTENDANCE_TABLE_LEAVE_OR_SUM));
|
|
|
+ newMap.put(DATE, map.get(DATE));
|
|
|
+ newList.add(newMap);
|
|
|
}
|
|
|
|
|
|
- listVisibleColumns = ExcelUtil.filterData(columns, 4, MaskConstant.LIST_VISIBLE::equals);
|
|
|
+ list = newList;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- util.exportExcelCommon(response, list, "sheet1", listVisibleColumns, empty, true);
|
|
|
+ util.exportExcelCommon(response, list, "sheet1", null, empty, true);
|
|
|
} catch (IOException e) {
|
|
|
+ LOGGER.error("考勤统计导出失败,导出数据为:{}", list);
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return null;
|