Commit 54035d10 by 谢春璐

fix

parent f1929307
...@@ -5,6 +5,7 @@ import java.io.FileInputStream; ...@@ -5,6 +5,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
......
...@@ -10,6 +10,7 @@ import java.util.ArrayList; ...@@ -10,6 +10,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -37,7 +38,7 @@ public class FileController { ...@@ -37,7 +38,7 @@ public class FileController {
@PostMapping("upload") @PostMapping("upload")
@ResponseBody @ResponseBody
public ResponseEntity<byte[]> uploadAndExport( public ResponseEntity<byte[]> uploadAndExport(
HttpServletRequest request) { HttpServletRequest request, HttpServletResponse response) {
try { try {
ExcelRead inst = ExcelRead.getInst(); ExcelRead inst = ExcelRead.getInst();
...@@ -76,7 +77,11 @@ public class FileController { ...@@ -76,7 +77,11 @@ public class FileController {
return fileService.checkExport(staffList1); return fileService.checkExport(staffList1);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); try {
response.getWriter().print(e.getMessage());
} catch (IOException e2) {
return null;
}
} }
return null; return null;
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
<form enctype="multipart/form-data" method="post" action="/upload"> <form enctype="multipart/form-data" method="post" action="/upload">
<div class="container" style="padding-top: 20%;"> <div class="container" style="padding-top: 20%;">
<h4>上传文件类型支持:1 .打卡机导出表 2 .企业微信上下班打卡记录 3 .企业微信外出打卡记录
</h4>
<p></p>
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col"> <div class="col">
<p>文件1:<input type="file" name="file"/></p> <p>文件1:<input type="file" name="file"/></p>
......
...@@ -2,8 +2,12 @@ package com.zanchina.check; ...@@ -2,8 +2,12 @@ package com.zanchina.check;
import com.zanchina.check.common.DateUtils; import com.zanchina.check.common.DateUtils;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
...@@ -16,14 +20,28 @@ public class CheckApplicationTests { ...@@ -16,14 +20,28 @@ public class CheckApplicationTests {
@Test @Test
public void contextLoads() throws ParseException { public void contextLoads() throws ParseException {
Date d1 = DateUtils.parseDate("9:00", DateUtils.HHmm); // Date d1 = DateUtils.parseDate("9:00", DateUtils.HHmm);
Date d2 = DateUtils.parseDate("2018/06/19 9:00", DateUtils.yyyyMMddHHmm1); // Date d2 = DateUtils.parseDate("2018/06/19 9:00", DateUtils.yyyyMMddHHmm1);
//
// List<String> allDatesOfTwoDate = DateUtils.getAllDatesOfTwoDate("2018-06-30", "2018-07-15");
//
// Date date = DateUtils.parseDate("2018-07-31".concat(" ").concat("08:55"), DateUtils.yyyyMMddHHmm);
//
// System.out.print(date);
List<String> strings = new ArrayList<>();
strings.add("b1");
strings.add("c");
strings.add("a1");
strings.add("b1");
strings.add("a1");
strings.add("b2");
strings.add("a2");
System.out.print(strings);
strings.sort(Comparator.comparing(s -> s));
System.out.print(strings);
List<String> allDatesOfTwoDate = DateUtils.getAllDatesOfTwoDate("2018-06-30", "2018-07-15");
Date date = DateUtils.parseDate("2018-07-31".concat(" ").concat("08:55"), DateUtils.yyyyMMddHHmm);
System.out.print(date);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment