|
@@ -27,11 +27,14 @@ import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
|
+import org.springframework.data.redis.core.ListOperations;
|
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -58,24 +61,25 @@ public class WorkAttendanceController {
|
|
@Autowired
|
|
@Autowired
|
|
private OSSConfig ossConfig;
|
|
private OSSConfig ossConfig;
|
|
|
|
|
|
- @ApiOperation(value="导出考勤记录")
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ValueOperations<String, Object> valueOperations;
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="考勤统计列表")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name="companyId",value = "单位编号",required = true,paramType = "form"),
|
|
@ApiImplicitParam(name="companyId",value = "单位编号",required = true,paramType = "form"),
|
|
@ApiImplicitParam(name = "startDate",value = "开始时间", required = true,paramType="form"),
|
|
@ApiImplicitParam(name = "startDate",value = "开始时间", required = true,paramType="form"),
|
|
@ApiImplicitParam(name = "endDate",value = "截止时间", required = true,paramType="form"),
|
|
@ApiImplicitParam(name = "endDate",value = "截止时间", required = true,paramType="form"),
|
|
@ApiImplicitParam(name = "subject",value = "subject", required = false,paramType="form")
|
|
@ApiImplicitParam(name = "subject",value = "subject", required = false,paramType="form")
|
|
})
|
|
})
|
|
- @RequestMapping(value = "exportXls",method = RequestMethod.POST)
|
|
|
|
- public MessageResult<String> exportXls(
|
|
|
|
|
|
+ @RequestMapping(value = "statList",method = RequestMethod.POST)
|
|
|
|
+ public MessageResult<Map> statList(
|
|
String companyId,
|
|
String companyId,
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
|
|
@RequestAttribute String subject){
|
|
@RequestAttribute String subject){
|
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
|
|
- //当前用户ID
|
|
|
|
- System.out.println(subject);
|
|
|
|
-
|
|
|
|
- MessageResult<String> msgResult = new MessageResult<>();
|
|
|
|
|
|
+ Map<String,Object> dataMap = new HashMap<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
if (startDate==null){
|
|
if (startDate==null){
|
|
@@ -165,7 +169,7 @@ public class WorkAttendanceController {
|
|
else if(result.equals(WorkAttendance.MISSING)){
|
|
else if(result.equals(WorkAttendance.MISSING)){
|
|
if (workAttendance.getClassifier().equals("1")){
|
|
if (workAttendance.getClassifier().equals("1")){
|
|
//上班缺卡
|
|
//上班缺卡
|
|
- missCardOffWorkCount++;
|
|
|
|
|
|
+ missCardOnWorkCount++;
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
//下班缺卡
|
|
//下班缺卡
|
|
@@ -181,7 +185,7 @@ public class WorkAttendanceController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- personMap.put("personInfo",personInfo);
|
|
|
|
|
|
+ personMap.put("name",personInfo.getName());
|
|
personMap.put("company",personInfo.getPosition1());
|
|
personMap.put("company",personInfo.getPosition1());
|
|
personMap.put("department",personInfo.getPosition2());
|
|
personMap.put("department",personInfo.getPosition2());
|
|
personMap.put("jobNumber",personInfo.getPosition3());
|
|
personMap.put("jobNumber",personInfo.getPosition3());
|
|
@@ -197,11 +201,29 @@ public class WorkAttendanceController {
|
|
personMapList.add(personMap);
|
|
personMapList.add(personMap);
|
|
}
|
|
}
|
|
|
|
|
|
- //todo 生成报表
|
|
|
|
-// String tmplFilePath = "E:\\workAttendanceReport.xlsx";
|
|
|
|
- String downloadUrl = createReport(startTime,endTime,personMapList);
|
|
|
|
|
|
+ //todo 保存到redis
|
|
|
|
+ String tmplKey = "workAttendance_" + DateTime.now().toString("yyMMddHHmmssSSS");
|
|
|
|
+ valueOperations.set(tmplKey,personMapList,5, TimeUnit.MINUTES);
|
|
|
|
|
|
- msgResult.setData(downloadUrl);
|
|
|
|
|
|
+ dataMap.put("list",personMapList);
|
|
|
|
+// dataMap.put("url",downloadUrl);
|
|
|
|
+
|
|
|
|
+ List<Map> dayColumns = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ for (int i=0;i<days;i++){
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+ DateTime dt = startTime.plusDays(i);
|
|
|
|
+
|
|
|
|
+ map.put("name",dt.toString("yyyy-MM-dd"));
|
|
|
|
+ map.put("label",dt.toString("MM-dd") + " " + dt.dayOfWeek().getAsShortText(Locale.CHINA));
|
|
|
|
+
|
|
|
|
+ dayColumns.add(map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dataMap.put("dayColumns", dayColumns);
|
|
|
|
+ dataMap.put("tmplKey",tmplKey);
|
|
|
|
+
|
|
|
|
+ msgResult.setData(dataMap);
|
|
msgResult.setResult(true);
|
|
msgResult.setResult(true);
|
|
}
|
|
}
|
|
catch (Exception ex){
|
|
catch (Exception ex){
|
|
@@ -226,172 +248,198 @@ public class WorkAttendanceController {
|
|
return cellStyle;
|
|
return cellStyle;
|
|
}
|
|
}
|
|
|
|
|
|
- private String createReport(DateTime startTime,DateTime endTime,List<Map> personMapList) throws Exception {
|
|
|
|
- int days = Days.daysBetween(startTime,endTime).getDays();
|
|
|
|
- ClassPathResource resource = new ClassPathResource("static/workAttendanceReport.xls");
|
|
|
|
|
|
+ @ApiOperation(value="导出考勤报表")
|
|
|
|
+ @RequestMapping(value = "exportXls",method = RequestMethod.POST)
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name="tmplKey",value = "模板数据key",required = true,paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "startDate",value = "开始时间", required = true,paramType="form"),
|
|
|
|
+ @ApiImplicitParam(name = "endDate",value = "截止时间", required = true,paramType="form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject",value = "subject", required = false,paramType="form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<String> exportXls(
|
|
|
|
+ String tmplKey,
|
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
|
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
|
|
|
|
+ @RequestAttribute String subject) throws Exception {
|
|
|
|
+ MessageResult<String> msgResult = new MessageResult<>();
|
|
|
|
|
|
- Workbook wb = WorkbookFactory.create(resource.getInputStream());
|
|
|
|
|
|
+ try {
|
|
|
|
+ DateTime startTime = new DateTime(startDate);
|
|
|
|
+ DateTime endTime = new DateTime(endDate);
|
|
|
|
|
|
- Sheet sheet = wb.getSheetAt(0);
|
|
|
|
|
|
+ List<Map> personMapList = (List<Map>) valueOperations.get(tmplKey);
|
|
|
|
|
|
- Row row1 = sheet.getRow(0);
|
|
|
|
- Row row2 = sheet.getRow(1);
|
|
|
|
- Row row3 = sheet.getRow(2);
|
|
|
|
|
|
+ int days = Days.daysBetween(startTime, endTime).getDays();
|
|
|
|
+ ClassPathResource resource = new ClassPathResource("static/workAttendanceReport.xls");
|
|
|
|
|
|
- String title = row1.getCell(0).getStringCellValue();
|
|
|
|
- String subTitle = row2.getCell(0).getStringCellValue();
|
|
|
|
|
|
+ Workbook wb = WorkbookFactory.create(resource.getInputStream());
|
|
|
|
|
|
- row1.getCell(0).setCellValue(String.format(title,startTime.toString("yyyy-MM-dd"),endTime.toString("yyyy-MM-dd")));
|
|
|
|
- row2.getCell(0).setCellValue(String.format(subTitle,DateTime.now().toString("yyyy-MM-dd HH:mm")));
|
|
|
|
|
|
+ Sheet sheet = wb.getSheetAt(0);
|
|
|
|
|
|
- int dayStartColIndex = 11;
|
|
|
|
|
|
+ Row row1 = sheet.getRow(0);
|
|
|
|
+ Row row2 = sheet.getRow(1);
|
|
|
|
+ Row row3 = sheet.getRow(2);
|
|
|
|
|
|
- for (int i=0;i<days;i++){
|
|
|
|
- DateTime dt = startTime.plusDays(i);
|
|
|
|
- row3.getCell(dayStartColIndex + i).setCellValue(dt.toString("MM-dd") + "\r\n" + dt.dayOfWeek().getAsShortText(Locale.CHINA));
|
|
|
|
- }
|
|
|
|
|
|
+ String title = row1.getCell(0).getStringCellValue();
|
|
|
|
+ String subTitle = row2.getCell(0).getStringCellValue();
|
|
|
|
|
|
- //todo 写考勤记录
|
|
|
|
- int startRowIndex = 3;
|
|
|
|
|
|
+ row1.getCell(0).setCellValue(String.format(title, startTime.toString("yyyy-MM-dd"), endTime.toString("yyyy-MM-dd")));
|
|
|
|
+ row2.getCell(0).setCellValue(String.format(subTitle, DateTime.now().toString("yyyy-MM-dd HH:mm")));
|
|
|
|
|
|
- Font redFont = wb.createFont();
|
|
|
|
- redFont.setColor(Font.COLOR_RED);
|
|
|
|
|
|
+ int dayStartColIndex = 11;
|
|
|
|
|
|
- for (int i=0;i<personMapList.size();i++) {
|
|
|
|
- Row row = sheet.createRow(startRowIndex + i);
|
|
|
|
- Map personMap = personMapList.get(i);
|
|
|
|
|
|
+ for (int i = 0; i < days; i++) {
|
|
|
|
+ DateTime dt = startTime.plusDays(i);
|
|
|
|
+ row3.getCell(dayStartColIndex + i).setCellValue(dt.toString("MM-dd") + "\r\n" + dt.dayOfWeek().getAsShortText(Locale.CHINA));
|
|
|
|
+ }
|
|
|
|
|
|
- PersonInfo personInfo = (PersonInfo)personMap.get("personInfo");
|
|
|
|
- row.createCell(0).setCellValue(personInfo.getName());
|
|
|
|
|
|
+ //todo 写考勤记录
|
|
|
|
+ int startRowIndex = 3;
|
|
|
|
|
|
- String companyName = (String)personMap.get("company");
|
|
|
|
- row.createCell(1).setCellValue(companyName);
|
|
|
|
|
|
+ Font redFont = wb.createFont();
|
|
|
|
+ redFont.setColor(Font.COLOR_RED);
|
|
|
|
|
|
- String department = (String)personMap.get("department");
|
|
|
|
- row.createCell(2).setCellValue(department);
|
|
|
|
|
|
+ for (int i = 0; i < personMapList.size(); i++) {
|
|
|
|
+ Row row = sheet.createRow(startRowIndex + i);
|
|
|
|
+ Map personMap = personMapList.get(i);
|
|
|
|
|
|
- String jobNumber = (String)personMap.get("jobNumber");
|
|
|
|
- row.createCell(3).setCellValue(jobNumber);
|
|
|
|
|
|
+ String name = (String) personMap.get("name");
|
|
|
|
+ row.createCell(0).setCellValue(name);
|
|
|
|
|
|
- Integer workDays = Integer.valueOf(personMap.get("workDays").toString());
|
|
|
|
- row.createCell(4).setCellValue(workDays);
|
|
|
|
|
|
+ String companyName = (String) personMap.get("company");
|
|
|
|
+ row.createCell(1).setCellValue(companyName);
|
|
|
|
|
|
- Integer restDays = Integer.valueOf(personMap.get("restDays").toString());
|
|
|
|
- row.createCell(5).setCellValue(restDays);
|
|
|
|
|
|
+ String department = (String) personMap.get("department");
|
|
|
|
+ row.createCell(2).setCellValue(department);
|
|
|
|
|
|
- Integer lateNum = Integer.valueOf(personMap.get("lateNum").toString());
|
|
|
|
- row.createCell(6).setCellValue(lateNum);
|
|
|
|
|
|
+ String jobNumber = (String) personMap.get("jobNumber");
|
|
|
|
+ row.createCell(3).setCellValue(jobNumber);
|
|
|
|
|
|
- Integer leaveNum = Integer.valueOf(personMap.get("leaveNum").toString());
|
|
|
|
- row.createCell(7).setCellValue(leaveNum);
|
|
|
|
|
|
+ Integer workDays = Integer.valueOf(personMap.get("workDays").toString());
|
|
|
|
+ row.createCell(4).setCellValue(workDays);
|
|
|
|
|
|
- Integer missCardOnWorkCount = Integer.valueOf(personMap.get("missCardOnWorkCount").toString());
|
|
|
|
- row.createCell(8).setCellValue(missCardOnWorkCount);
|
|
|
|
|
|
+ Integer restDays = Integer.valueOf(personMap.get("restDays").toString());
|
|
|
|
+ row.createCell(5).setCellValue(restDays);
|
|
|
|
|
|
- Integer missCardOffWorkCount = Integer.valueOf(personMap.get("missCardOffWorkCount").toString());
|
|
|
|
- row.createCell(9).setCellValue(missCardOffWorkCount);
|
|
|
|
|
|
+ Integer lateNum = Integer.valueOf(personMap.get("lateNum").toString());
|
|
|
|
+ row.createCell(6).setCellValue(lateNum);
|
|
|
|
|
|
- Integer missCardAllDayCount = Integer.valueOf(personMap.get("missCardAllDayCount").toString());
|
|
|
|
- row.createCell(10).setCellValue(missCardAllDayCount);
|
|
|
|
|
|
+ Integer leaveNum = Integer.valueOf(personMap.get("leaveNum").toString());
|
|
|
|
+ row.createCell(7).setCellValue(leaveNum);
|
|
|
|
|
|
- Map<String,List> workAttendanceMap = (Map<String,List>)personMap.get("workAttendanceMap");
|
|
|
|
|
|
+ Integer missCardOnWorkCount = Integer.valueOf(personMap.get("missCardOnWorkCount").toString());
|
|
|
|
+ row.createCell(8).setCellValue(missCardOnWorkCount);
|
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
|
|
|
|
|
|
+ Integer missCardOffWorkCount = Integer.valueOf(personMap.get("missCardOffWorkCount").toString());
|
|
|
|
+ row.createCell(9).setCellValue(missCardOffWorkCount);
|
|
|
|
|
|
- for(int j=0;j<days;j++){
|
|
|
|
- String key = startTime.plusDays(j).toString("yyyy-MM-dd");
|
|
|
|
|
|
+ Integer missCardAllDayCount = Integer.valueOf(personMap.get("missCardAllDayCount").toString());
|
|
|
|
+ row.createCell(10).setCellValue(missCardAllDayCount);
|
|
|
|
|
|
- if (workAttendanceMap.containsKey(key)){
|
|
|
|
- List<WorkAttendance> workAttendanceList = workAttendanceMap.get(key);
|
|
|
|
|
|
+ Map<String, List> workAttendanceMap = (Map<String, List>) personMap.get("workAttendanceMap");
|
|
|
|
|
|
- List<Map> posList = new ArrayList<>();
|
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
|
|
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
+ for (int j = 0; j < days; j++) {
|
|
|
|
+ String key = startTime.plusDays(j).toString("yyyy-MM-dd");
|
|
|
|
|
|
- for (WorkAttendance item : workAttendanceList) {
|
|
|
|
- if (sb.length()!=0){
|
|
|
|
- sb.append("\r\n");
|
|
|
|
- }
|
|
|
|
|
|
+ if (workAttendanceMap.containsKey(key)) {
|
|
|
|
+ List<WorkAttendance> workAttendanceList = workAttendanceMap.get(key);
|
|
|
|
|
|
- if(item.getClassifier().equals(1)){
|
|
|
|
- sb.append("上班");
|
|
|
|
- }
|
|
|
|
- else{
|
|
|
|
- sb.append("下班");
|
|
|
|
- }
|
|
|
|
|
|
+ List<Map> posList = new ArrayList<>();
|
|
|
|
|
|
- if (WorkAttendance.SUCCESS.equals(item.getResult())){
|
|
|
|
- sb.append("打卡");
|
|
|
|
- }
|
|
|
|
- else if (WorkAttendance.LATE.equals(item.getResult())){
|
|
|
|
- sb.append("迟到");
|
|
|
|
- }
|
|
|
|
- else if (WorkAttendance.LEAVE_EARLY.equals(item.getResult())){
|
|
|
|
- sb.append("早退");
|
|
|
|
- }
|
|
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
- Map<String,Integer> pos = null;
|
|
|
|
|
|
+ for (WorkAttendance item : workAttendanceList) {
|
|
|
|
+ if (sb.length() != 0) {
|
|
|
|
+ sb.append("\r\n");
|
|
|
|
+ }
|
|
|
|
|
|
- if(WorkAttendance.MISSING.equals(item.getResult())){
|
|
|
|
- pos = new HashMap<>();
|
|
|
|
- pos.put("start",sb.length()-2);
|
|
|
|
- sb.append("缺卡");
|
|
|
|
- }
|
|
|
|
|
|
+ if (item.getClassifier().equals(1)) {
|
|
|
|
+ sb.append("上班");
|
|
|
|
+ } else {
|
|
|
|
+ sb.append("下班");
|
|
|
|
+ }
|
|
|
|
|
|
- if(item.getRecordTime()!=null) {
|
|
|
|
- sb.append(" " + sdf.format(item.getRecordTime()));
|
|
|
|
|
|
+ if (WorkAttendance.SUCCESS.equals(item.getResult())) {
|
|
|
|
+ sb.append("打卡");
|
|
|
|
+ } else if (WorkAttendance.LATE.equals(item.getResult())) {
|
|
|
|
+ sb.append("迟到");
|
|
|
|
+ } else if (WorkAttendance.LEAVE_EARLY.equals(item.getResult())) {
|
|
|
|
+ sb.append("早退");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, Integer> pos = null;
|
|
|
|
|
|
- if(pos!=null) {
|
|
|
|
- pos.put("end", sb.length());
|
|
|
|
- posList.add(pos);
|
|
|
|
|
|
+ if (WorkAttendance.MISSING.equals(item.getResult())) {
|
|
|
|
+ pos = new HashMap<>();
|
|
|
|
+ pos.put("start", sb.length() - 2);
|
|
|
|
+ sb.append("缺卡");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (item.getRecordTime() != null) {
|
|
|
|
+ sb.append(" " + sdf.format(item.getRecordTime()));
|
|
|
|
+
|
|
|
|
+ if (pos != null) {
|
|
|
|
+ pos.put("end", sb.length());
|
|
|
|
+ posList.add(pos);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- HSSFRichTextString sText = new HSSFRichTextString(sb.toString());
|
|
|
|
|
|
+ HSSFRichTextString sText = new HSSFRichTextString(sb.toString());
|
|
|
|
|
|
- for (Map map : posList) {
|
|
|
|
- int start = Integer.valueOf(map.get("start").toString());
|
|
|
|
- int end = Integer.valueOf(map.get("end").toString());
|
|
|
|
|
|
+ for (Map map : posList) {
|
|
|
|
+ int start = Integer.valueOf(map.get("start").toString());
|
|
|
|
+ int end = Integer.valueOf(map.get("end").toString());
|
|
|
|
|
|
- sText.applyFont(start,end,redFont);
|
|
|
|
- }
|
|
|
|
|
|
+ sText.applyFont(start, end, redFont);
|
|
|
|
+ }
|
|
|
|
|
|
- row.createCell(dayStartColIndex + j).setCellValue(sText);
|
|
|
|
|
|
+ row.createCell(dayStartColIndex + j).setCellValue(sText);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- CellStyle cellStyle1 = createCellStyle(wb);
|
|
|
|
|
|
+ CellStyle cellStyle1 = createCellStyle(wb);
|
|
|
|
|
|
- for (int i=0;i<personMapList.size();i++) {
|
|
|
|
- Row row = sheet.getRow(startRowIndex + i);
|
|
|
|
|
|
+ for (int i = 0; i < personMapList.size(); i++) {
|
|
|
|
+ Row row = sheet.getRow(startRowIndex + i);
|
|
|
|
|
|
- if (row!=null) {
|
|
|
|
- for (int j = 0; j < row.getLastCellNum(); j++) {
|
|
|
|
- if (row.getCell(j) != null) {
|
|
|
|
- row.getCell(j).setCellStyle(cellStyle1);
|
|
|
|
|
|
+ if (row != null) {
|
|
|
|
+ for (int j = 0; j < row.getLastCellNum(); j++) {
|
|
|
|
+ if (row.getCell(j) != null) {
|
|
|
|
+ row.getCell(j).setCellStyle(cellStyle1);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //todo 将wb保存到oss
|
|
|
|
- ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
|
- wb.write(output);
|
|
|
|
|
|
+ //todo 将wb保存到oss
|
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
|
+ wb.write(output);
|
|
|
|
|
|
- byte[] buffer = output.toByteArray();
|
|
|
|
- ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
|
|
|
- String fileName = "考勤统计表.xls";
|
|
|
|
|
|
+ String fileName = "考勤统计表.xls";
|
|
|
|
|
|
- String downloadUrl = OSSUtil.upload(ossConfig,"workAttendance",fileName,input);
|
|
|
|
|
|
+ String downloadUrl = OSSUtil.upload(ossConfig, "workAttendance", fileName, input);
|
|
|
|
|
|
- wb.write(output);
|
|
|
|
- wb.close();
|
|
|
|
- output.close();
|
|
|
|
|
|
+ wb.write(output);
|
|
|
|
+ wb.close();
|
|
|
|
+ output.close();
|
|
|
|
|
|
- return downloadUrl;
|
|
|
|
|
|
+ msgResult.setData(downloadUrl);
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex){
|
|
|
|
+ msgResult.setResult(false);
|
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
|
+ logger.error(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value="更新考勤记录")
|
|
@ApiOperation(value="更新考勤记录")
|