|
|
@@ -12,11 +12,9 @@ import com.template.annotation.DESRespondSecret;
|
|
|
import com.template.api.SmartAttendanceControllerAPI;
|
|
|
import com.template.common.utils.*;
|
|
|
import com.template.config.ControlConfig;
|
|
|
+import com.template.config.ScheduleConfig;
|
|
|
import com.template.config.SeewoConfig;
|
|
|
-import com.template.model.enumModel.eAttendanceStatu;
|
|
|
-import com.template.model.enumModel.eIdentityStatu;
|
|
|
-import com.template.model.enumModel.eIfVerification;
|
|
|
-import com.template.model.enumModel.eXwApproveStatu;
|
|
|
+import com.template.model.enumModel.*;
|
|
|
import com.template.model.evaluate.student.SmartEvaluateStudent;
|
|
|
import com.template.model.pojo.*;
|
|
|
import com.template.model.request.askForLeaveRequest;
|
|
|
@@ -27,6 +25,10 @@ import com.template.model.seewo.PersonalLeaveListSchoolPeriodRecordsRequest;
|
|
|
import com.template.model.seewo.PersonalLeaveListSchoolPeriodRecordsResult;
|
|
|
import com.template.model.vo.*;
|
|
|
import com.template.services.*;
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -39,10 +41,12 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@@ -103,13 +107,19 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ScheduleConfig scheduleConfig;
|
|
|
/**
|
|
|
* 每一小时获取请假信息
|
|
|
*/
|
|
|
@Async
|
|
|
@Scheduled(cron = "0 0 0/1 * * ? ")
|
|
|
public void get(){
|
|
|
- queryLeaveRecords();
|
|
|
+ if(scheduleConfig.getIsOpen().equals("1")){
|
|
|
+ queryLeaveRecords();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -392,6 +402,68 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
return CommonResult.fail();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void queryPageExport(HttpServletResponse response, Integer gradeId, Integer classId, String status, String studentNo, String name, String startTime, String endTime) {
|
|
|
+
|
|
|
+ //导出
|
|
|
+ Workbook workbook = new XSSFWorkbook();
|
|
|
+ Sheet sheet = workbook.createSheet("学生考勤记录");
|
|
|
+ Row headerRow = sheet.createRow(0);
|
|
|
+ headerRow.createCell(0).setCellValue("序号");
|
|
|
+ headerRow.createCell(1).setCellValue("姓名");
|
|
|
+ headerRow.createCell(2).setCellValue("年级");
|
|
|
+ headerRow.createCell(3).setCellValue("班级");
|
|
|
+ headerRow.createCell(4).setCellValue("学号");
|
|
|
+ headerRow.createCell(5).setCellValue("头像");
|
|
|
+ headerRow.createCell(6).setCellValue("打卡时间");
|
|
|
+ headerRow.createCell(7).setCellValue("请假时间");
|
|
|
+ headerRow.createCell(8).setCellValue("考勤状态");
|
|
|
+
|
|
|
+ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ // 默认前一天的
|
|
|
+ if (ObjectUtils.isEmpty(startTime)||ObjectUtils.isEmpty(endTime)) {
|
|
|
+ LocalDateTime end = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
|
|
|
+ LocalDateTime now = end.minusDays(1);
|
|
|
+ startTime=now.format(dateTimeFormatter);
|
|
|
+ endTime=end.format(dateTimeFormatter);
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取学生考勤记录
|
|
|
+ List<SmartAttendanceVo> vos=smartAttendanceService.queryExpor(gradeId,classId,status,studentNo,name,startTime,endTime);
|
|
|
+
|
|
|
+ for (int i = 0; i < vos.size(); i++) {
|
|
|
+ SmartAttendanceVo vo = vos.get(i);
|
|
|
+
|
|
|
+ Row dataRow = sheet.createRow(i + 1);
|
|
|
+ dataRow.createCell(0).setCellValue(i + 1);
|
|
|
+ dataRow.createCell(1).setCellValue(vo.getName());
|
|
|
+ dataRow.createCell(2).setCellValue(vo.getGradeName());
|
|
|
+ dataRow.createCell(3).setCellValue(vo.getClassName());
|
|
|
+ dataRow.createCell(4).setCellValue(vo.getCardNo());
|
|
|
+ dataRow.createCell(5).setCellValue(vo.getHeadImage());
|
|
|
+ dataRow.createCell(6).setCellValue(vo.getAttendTime());
|
|
|
+ dataRow.createCell(7).setCellValue(vo.getInitiateTime());
|
|
|
+// 状态
|
|
|
+ Integer status1 = vo.getStatus();
|
|
|
+ String type="";
|
|
|
+ if (0==status1) {
|
|
|
+ type="准时";
|
|
|
+ }else if(1==status1) {
|
|
|
+ type="迟到";
|
|
|
+ }else if(3==status1) {
|
|
|
+ type="缺卡";
|
|
|
+ }else if(6==status1) {
|
|
|
+ type="请假";
|
|
|
+ }else if(7==status1) {
|
|
|
+ type="超时打卡";
|
|
|
+ }
|
|
|
+ dataRow.createCell(8).setCellValue(type);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 将工作簿写入文件
|
|
|
+ ExcelUtils.excelDownload(workbook, "学生考勤.xlsx", response);
|
|
|
+ }
|
|
|
+
|
|
|
public PersonalLeaveListSchoolPeriodRecordsResult getXwAttendance(String startDate, String endDate, Integer currentPage, Integer pageSize) {
|
|
|
//初始化客户端
|
|
|
SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
|