|
|
@@ -110,13 +110,14 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
|
|
|
@Resource
|
|
|
private ScheduleConfig scheduleConfig;
|
|
|
+
|
|
|
/**
|
|
|
* 每一小时获取请假信息
|
|
|
- */
|
|
|
+ */
|
|
|
@Async
|
|
|
@Scheduled(cron = "0 0 0/1 * * ? ")
|
|
|
- public void get(){
|
|
|
- if(scheduleConfig.getIsOpen().equals("1")){
|
|
|
+ public void get() {
|
|
|
+ if (scheduleConfig.getIsOpen().equals("1")) {
|
|
|
queryLeaveRecords();
|
|
|
}
|
|
|
|
|
|
@@ -136,12 +137,14 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
return CommonResult.fail(result.getResponseBody().getMessage());
|
|
|
}
|
|
|
SmartAskForLeaveConfig list = smartAskForLeaveConfigService.getList();
|
|
|
- Integer IfVerification=0;
|
|
|
- if (ObjectUtils.isNotEmpty(list)&&ObjectUtils.isNotEmpty(list.getConfig())) {
|
|
|
+ Integer IfVerification = 0;
|
|
|
+ if (ObjectUtils.isNotEmpty(list) && ObjectUtils.isNotEmpty(list.getConfig())) {
|
|
|
IfVerification = list.getConfig();
|
|
|
}
|
|
|
+// 当前集合的数量
|
|
|
+ Integer resultCount = result.getResponseBody().getData().getResult().size();
|
|
|
List<SmartAttendance> attendances = new ArrayList<>();
|
|
|
- for (int i = 0; i < result.getResponseBody().getData().getTotalCount(); i++) {
|
|
|
+ for (int i = 0; i < resultCount; i++) {
|
|
|
if (result.getResponseBody().getData().getResult().get(i).getLeaveStatus().intValue() == eXwApproveStatu.Passed.getValue()) {
|
|
|
SmartAttendance attendance = new SmartAttendance();
|
|
|
attendance.setXwuid(result.getResponseBody().getData().getResult().get(i).getUid());
|
|
|
@@ -161,10 +164,17 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
}
|
|
|
}
|
|
|
//如果总条数大于第二条 那说明还有第二页
|
|
|
- if (result.getResponseBody().getData().getTotalCount().intValue() > result.getResponseBody().getData().getTotalCount().intValue()) {
|
|
|
- int totalCount = result.getResponseBody().getData().getTotalCount().intValue();
|
|
|
- int pageSize = result.getResponseBody().getData().getPageSize().intValue();
|
|
|
- int totalPage = (totalCount + pageSize - 1) / pageSize;
|
|
|
+// 总数
|
|
|
+ int totalCount = result.getResponseBody().getData().getTotalCount().intValue();
|
|
|
+// 当前分页数
|
|
|
+ Integer page = result.getResponseBody().getData().getPage();
|
|
|
+// 当前页面展示数
|
|
|
+ int pageSize = result.getResponseBody().getData().getPageSize().intValue();
|
|
|
+
|
|
|
+ Integer count = page * pageSize;
|
|
|
+
|
|
|
+ if (totalCount > count) {
|
|
|
+ Integer totalPage = totalCount / pageSize + 1;
|
|
|
for (int i = 2; i <= totalPage; i++) {
|
|
|
PersonalLeaveListSchoolPeriodRecordsResult nextResult = getXwAttendance(TimeExchange.getDate(), TimeExchange.getDate(), i, findPageSize);
|
|
|
if (nextResult == null) {
|
|
|
@@ -174,7 +184,7 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
if (!nextResult.getResponseBody().getCode().equals("000000")) {
|
|
|
return CommonResult.fail(result.getResponseBody().getMessage());
|
|
|
}
|
|
|
- for (int j = 0; j < result.getResponseBody().getData().getTotalCount(); j++) {
|
|
|
+ for (int j = 0; j < result.getResponseBody().getData().getResult().size(); j++) {
|
|
|
if (result.getResponseBody().getData().getResult().get(j).getLeaveStatus().intValue() == eXwApproveStatu.Passed.getValue()) {
|
|
|
SmartAttendance attendance = new SmartAttendance();
|
|
|
attendance.setXwuid(result.getResponseBody().getData().getResult().get(j).getUid());
|
|
|
@@ -297,7 +307,7 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
jsonobject.put("schoolno", schoolno);
|
|
|
jsonobject.put("timestamp", timestamp);
|
|
|
|
|
|
- String md5Str = "appid=" + appId + "&data={\"student_no\":\"" + student.getBsStudentNo() + "\",\"grade_no\":\"" + student.getBsGradeNo() + "\",\"classtab_no\":\"" + student.getBsClassNo() + "\",\"leavebill_content\":\"" + reason + "\",\"leavebill_begindate\":\"" + request.getStartTime() + "\",\"leavebill_enddate\":\"" + request.getEndTime() + "\",\"leavebill_remark\":\"" + "" + "\"}" + "&schoolno=" + schoolno + "×tamp=" + timestamp + "&key=" + appSecret;
|
|
|
+ String md5Str = "appid=" + appId + "&data={\"student_no\":\"" + student.getBsStudentNo() + "\",\"grade_no\":\"" + student.getBsGradeNo() + "\",\"classtab_no\":\"" + student.getBsClassNo() + "\",\"leavebill_content\":\"" + reason + "\",\"leavebill_begindate\":\"" + request.getStartTime() + "\",\"leavebill_enddate\":\"" + request.getEndTime() + "\",\"leavebill_remark\":\"" + "" + "\"}" + "&schoolno=" + schoolno + "×tamp=" + timestamp + "&key=" + appSecret;
|
|
|
String sign = CommonUtil.MD5(md5Str);
|
|
|
//sign签名
|
|
|
jsonobject.put("sign", sign);
|
|
|
@@ -327,7 +337,7 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
Date startTime = null;
|
|
|
- Date endTime= null;
|
|
|
+ Date endTime = null;
|
|
|
HistoricalAttendanceVo historicalAttendanceVo = new HistoricalAttendanceVo();
|
|
|
if ("1".equals(dateTime)) {
|
|
|
// 本学期
|
|
|
@@ -352,19 +362,19 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
endTime = Date.from(now.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
}
|
|
|
|
|
|
- List<Integer> statusList=smartAttendanceService.getGroup();
|
|
|
+ List<Integer> statusList = smartAttendanceService.getGroup();
|
|
|
|
|
|
for (Integer status : statusList) {
|
|
|
- List<SmartAttendance> smartAttendances =smartAttendanceService.getHistoricalAttendance(userId,status,startTime,endTime);
|
|
|
- if (0==status) {
|
|
|
+ List<SmartAttendance> smartAttendances = smartAttendanceService.getHistoricalAttendance(userId, status, startTime, endTime);
|
|
|
+ if (0 == status) {
|
|
|
historicalAttendanceVo.setPunctuality(smartAttendances.size());
|
|
|
- }else if (1==status){
|
|
|
+ } else if (1 == status) {
|
|
|
historicalAttendanceVo.setBeLate(smartAttendances.size());
|
|
|
- }else if (3==status){
|
|
|
+ } else if (3 == status) {
|
|
|
historicalAttendanceVo.setNotClockingIn(smartAttendances.size());
|
|
|
- }else if (6==status){
|
|
|
+ } else if (6 == status) {
|
|
|
historicalAttendanceVo.setAskForLeave(smartAttendances.size());
|
|
|
- }else if (7==status){
|
|
|
+ } else if (7 == status) {
|
|
|
historicalAttendanceVo.setClockOut(smartAttendances.size());
|
|
|
}
|
|
|
}
|
|
|
@@ -374,8 +384,8 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
|
|
|
@Override
|
|
|
@DESRespondSecret(validated = true)
|
|
|
- public CommonResult askForLeavePage(int currentPage, int pageCount, String name, String cardNo, String startTime, String endTime,String ifVerification,String classId) {
|
|
|
- PageUtils<AskForLeaveVo> result=smartAttendanceService.askForLeavePage(currentPage,pageCount,name,cardNo,startTime,endTime,ifVerification,classId);
|
|
|
+ public CommonResult askForLeavePage(int currentPage, int pageCount, String name, String cardNo, String startTime, String endTime, String ifVerification, String classId) {
|
|
|
+ PageUtils<AskForLeaveVo> result = smartAttendanceService.askForLeavePage(currentPage, pageCount, name, cardNo, startTime, endTime, ifVerification, classId);
|
|
|
return CommonResult.ok(result);
|
|
|
|
|
|
}
|
|
|
@@ -383,7 +393,7 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
@Override
|
|
|
@DESRespondSecret(validated = true)
|
|
|
public CommonResult queryPage(int currentPage, int pageCount, Integer gradeId, Integer classId, String status, String studentNo, String name, String startTime, String endTime) {
|
|
|
- PageUtils<SmartAttendanceVo> result= smartAttendanceService.queryPage(currentPage,pageCount,gradeId,classId,status,studentNo,name,startTime,endTime);
|
|
|
+ PageUtils<SmartAttendanceVo> result = smartAttendanceService.queryPage(currentPage, pageCount, gradeId, classId, status, studentNo, name, startTime, endTime);
|
|
|
return CommonResult.ok(result);
|
|
|
}
|
|
|
|
|
|
@@ -421,15 +431,15 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
// 默认前一天的
|
|
|
- if (ObjectUtils.isEmpty(startTime)||ObjectUtils.isEmpty(endTime)) {
|
|
|
+ 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);
|
|
|
+ startTime = now.format(dateTimeFormatter);
|
|
|
+ endTime = end.format(dateTimeFormatter);
|
|
|
}
|
|
|
|
|
|
//获取学生考勤记录
|
|
|
- List<SmartAttendanceVo> vos=smartAttendanceService.queryExpor(gradeId,classId,status,studentNo,name,startTime,endTime);
|
|
|
+ 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);
|
|
|
@@ -445,17 +455,17 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
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="超时打卡";
|
|
|
+ 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);
|
|
|
}
|
|
|
@@ -467,7 +477,7 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
@Override
|
|
|
@DESRespondSecret(validated = true)
|
|
|
public CommonResult askForLeaveScreenPage(int currentPage, int pageCount, String cardNo, String ifVerification) {
|
|
|
- PageUtils<AskForLeaveScreenVo> result= smartAttendanceService.askForLeaveScreenPage(currentPage,pageCount,cardNo,ifVerification);
|
|
|
+ PageUtils<AskForLeaveScreenVo> result = smartAttendanceService.askForLeaveScreenPage(currentPage, pageCount, cardNo, ifVerification);
|
|
|
|
|
|
return CommonResult.ok(result);
|
|
|
}
|
|
|
@@ -477,7 +487,7 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
public CommonResult studentHistoricalAttendance(String dateTime) {
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
Date startTime = null;
|
|
|
- Date endTime= null;
|
|
|
+ Date endTime = null;
|
|
|
HistoricalAttendanceVo historicalAttendanceVo = new HistoricalAttendanceVo();
|
|
|
if ("1".equals(dateTime)) {
|
|
|
// 本学期
|
|
|
@@ -502,19 +512,19 @@ public class SmartAttendanceController implements SmartAttendanceControllerAPI {
|
|
|
endTime = Date.from(now.atZone(ZoneId.systemDefault()).toInstant());
|
|
|
}
|
|
|
|
|
|
- List<Integer> statusList=smartAttendanceService.getGroup();
|
|
|
+ List<Integer> statusList = smartAttendanceService.getGroup();
|
|
|
|
|
|
for (Integer status : statusList) {
|
|
|
- Integer count =smartAttendanceService.getStudentHistoricalAttendance(status,startTime,endTime);
|
|
|
- if (0==status) {
|
|
|
+ Integer count = smartAttendanceService.getStudentHistoricalAttendance(status, startTime, endTime);
|
|
|
+ if (0 == status) {
|
|
|
historicalAttendanceVo.setPunctuality(count);
|
|
|
- }else if (1==status){
|
|
|
+ } else if (1 == status) {
|
|
|
historicalAttendanceVo.setBeLate(count);
|
|
|
- }else if (3==status){
|
|
|
+ } else if (3 == status) {
|
|
|
historicalAttendanceVo.setNotClockingIn(count);
|
|
|
- }else if (6==status){
|
|
|
+ } else if (6 == status) {
|
|
|
historicalAttendanceVo.setAskForLeave(count);
|
|
|
- }else if (7==status){
|
|
|
+ } else if (7 == status) {
|
|
|
historicalAttendanceVo.setClockOut(count);
|
|
|
}
|
|
|
}
|