|
@@ -3,7 +3,11 @@ package com.template.controller;
|
|
|
|
|
|
|
|
import com.alibaba.druid.sql.visitor.functions.If;
|
|
import com.alibaba.druid.sql.visitor.functions.If;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.seewo.open.sdk.DefaultSeewoClient;
|
|
import com.seewo.open.sdk.DefaultSeewoClient;
|
|
|
import com.seewo.open.sdk.SeewoClient;
|
|
import com.seewo.open.sdk.SeewoClient;
|
|
@@ -31,6 +35,7 @@ import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
@@ -83,6 +88,9 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
SmartAskForLeaveConfigService smartAskForLeaveConfigService;
|
|
SmartAskForLeaveConfigService smartAskForLeaveConfigService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ SmartClassService smartClassService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@DESRespondSecret(validated = true)
|
|
@DESRespondSecret(validated = true)
|
|
|
public CommonResult insertSmartAttendance(SmartAttendance smartApply, BindingResult bindingResult) {
|
|
public CommonResult insertSmartAttendance(SmartAttendance smartApply, BindingResult bindingResult) {
|
|
@@ -532,6 +540,75 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
return CommonResult.ok(historicalAttendanceVo);
|
|
return CommonResult.ok(historicalAttendanceVo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @DESRespondSecret(validated = true)
|
|
|
|
|
+ public CommonResult classHistoricalAttendance(String dateTime, int currentPage, int pageCount, String className) {
|
|
|
|
|
+
|
|
|
|
|
+ LambdaQueryWrapper<SmartClass> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper.eq(ObjectUtils.isNotEmpty(className), SmartClass::getName, className);
|
|
|
|
|
+ IPage<SmartClass> page = smartClassService.page(new Page<>(currentPage, pageCount), wrapper);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
+ Date startTime = null;
|
|
|
|
|
+ Date endTime = null;
|
|
|
|
|
+ if ("1".equals(dateTime)) {
|
|
|
|
|
+// 本学期
|
|
|
|
|
+ SmartSemester smartSemester = smartSemesterService.getSemester(now);
|
|
|
|
|
+ if (ObjectUtils.isEmpty(smartSemester)) {
|
|
|
|
|
+ return CommonResult.ok("不存在该学期");
|
|
|
|
|
+ }
|
|
|
|
|
+ startTime = smartSemester.getStartTime();
|
|
|
|
|
+ endTime = smartSemester.getEndTime();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } else if ("2".equals(dateTime)) {
|
|
|
|
|
+// 近1个月
|
|
|
|
|
+ LocalDateTime localDateTime = now.minusMonths(1);
|
|
|
|
|
+ startTime = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
|
|
+ endTime = Date.from(now.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
|
|
+
|
|
|
|
|
+ } else if ("3".equals(dateTime)) {
|
|
|
|
|
+// 近一周
|
|
|
|
|
+ LocalDateTime localDateTime = now.minusDays(7);
|
|
|
|
|
+ startTime = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
|
|
+ endTime = Date.from(now.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ List<SmartClass> records = page.getRecords();
|
|
|
|
|
+ ArrayList<ClassHistoricalAttendanceVo> vos = new ArrayList<>();
|
|
|
|
|
+ for (SmartClass record : records) {
|
|
|
|
|
+ ClassHistoricalAttendanceVo historicalAttendanceVo = new ClassHistoricalAttendanceVo();
|
|
|
|
|
+ historicalAttendanceVo.setClassName(record.getName());
|
|
|
|
|
+ List<ClasAttendanceVo> list = smartAttendanceService.getClassHistoricalAttendance(startTime, endTime, record.getId());
|
|
|
|
|
+ for (ClasAttendanceVo clasAttendanceVo : list) {
|
|
|
|
|
+ Integer status = clasAttendanceVo.getStatus();
|
|
|
|
|
+ Integer count = clasAttendanceVo.getCount();
|
|
|
|
|
+
|
|
|
|
|
+ if (0 == status) {
|
|
|
|
|
+ historicalAttendanceVo.setPunctuality(count);
|
|
|
|
|
+ } else if (1 == status) {
|
|
|
|
|
+ historicalAttendanceVo.setBeLate(count);
|
|
|
|
|
+ } else if (3 == status) {
|
|
|
|
|
+ historicalAttendanceVo.setNotClockingIn(count);
|
|
|
|
|
+ } else if (7 == status) {
|
|
|
|
|
+ historicalAttendanceVo.setClockOut(count);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+// 请假的单独弄
|
|
|
|
|
+ Integer count = smartAttendanceService.getClassAckHistoricalAttendance(6, startTime, endTime,record.getId());
|
|
|
|
|
+ historicalAttendanceVo.setAskForLeave(count);
|
|
|
|
|
+ vos.add(historicalAttendanceVo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Page<ClassHistoricalAttendanceVo> objectPage = new Page<>();
|
|
|
|
|
+ BeanUtils.copyProperties(page, objectPage);
|
|
|
|
|
+ objectPage.setRecords(vos);
|
|
|
|
|
+
|
|
|
|
|
+ return CommonResult.ok(objectPage);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public PersonalLeaveListSchoolPeriodRecordsResult getXwAttendance(String startDate, String endDate, Integer currentPage, Integer pageSize) {
|
|
public PersonalLeaveListSchoolPeriodRecordsResult getXwAttendance(String startDate, String endDate, Integer currentPage, Integer pageSize) {
|
|
|
//初始化客户端
|
|
//初始化客户端
|
|
|
SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
|
|
SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
|