|
@@ -1,6 +1,8 @@
|
|
|
package com.xjrsoft.module.databoard.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.github.yulichang.toolkit.MPJWrappers;
|
|
@@ -12,7 +14,10 @@ import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
|
import com.xjrsoft.common.utils.SqlRunnerAdapterUtil;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.base.entity.BaseSemester;
|
|
|
+import com.xjrsoft.module.base.mapper.BaseSemesterMapper;
|
|
|
import com.xjrsoft.module.databoard.dto.StatisticsDetailDto;
|
|
|
+import com.xjrsoft.module.databoard.dto.TeacherChangeStatisticsDetailDto;
|
|
|
import com.xjrsoft.module.databoard.vo.*;
|
|
|
import com.xjrsoft.module.oa.entity.WfSubscription;
|
|
|
import com.xjrsoft.module.oa.service.IWfSubscriptionService;
|
|
@@ -34,6 +39,8 @@ import com.xjrsoft.module.workflow.utils.WorkFlowUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.camunda.bpm.engine.HistoryService;
|
|
|
import org.camunda.bpm.engine.history.HistoricProcessInstance;
|
|
|
import org.camunda.bpm.engine.history.HistoricProcessInstanceQuery;
|
|
@@ -46,11 +53,9 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.time.Duration;
|
|
|
-import java.time.LocalDate;
|
|
|
-import java.time.LocalDateTime;
|
|
|
-import java.time.Period;
|
|
|
+import java.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -70,6 +75,7 @@ public class DatadetailController {
|
|
|
private final ITeacherbaseManagerService teacherService;
|
|
|
private final IBaseStudentService studentService;
|
|
|
private final IWfSubscriptionService subscriptionService;
|
|
|
+ private final BaseSemesterMapper baseSemesterMapper;
|
|
|
|
|
|
@GetMapping(value = "/process-statistics")
|
|
|
@ApiOperation(value = "流程统计详情")
|
|
@@ -301,7 +307,6 @@ public class DatadetailController {
|
|
|
return RT.ok(result);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@GetMapping(value = "/person-statistics")
|
|
|
@ApiOperation(value = "教职工详情数据统计")
|
|
|
@SaCheckPermission("datadetail:detail")
|
|
@@ -449,6 +454,107 @@ public class DatadetailController {
|
|
|
return RT.ok(result);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/person-statistics-tea-change")
|
|
|
+ @ApiOperation(value = "教职工详情数据统计之教职工变动情况")
|
|
|
+ @SaCheckPermission("datadetail:detail")
|
|
|
+ @XjrLog(value = "教职工详情数据统计之教职工变动情况", saveResponseData = true)
|
|
|
+ public RT<TeacherChangeStatisticsDetailVo> teacherChangeStatisticsDetail(@Valid TeacherChangeStatisticsDetailDto dto){
|
|
|
+ TeacherChangeStatisticsDetailVo teacherChangeStatisticsDetailVo = new TeacherChangeStatisticsDetailVo();
|
|
|
+ if(ObjectUtils.isEmpty(dto.getStatus())){
|
|
|
+ LocalDate yearLocalDate = LocalDate.now();
|
|
|
+ LocalDate lastDayOfLastYear = yearLocalDate.minusYears(1).with(TemporalAdjusters.lastDayOfYear());
|
|
|
+ LocalDateTime startTime = lastDayOfLastYear.atTime(23, 59, 59);
|
|
|
+
|
|
|
+ LocalDate firstDayOfNextYear = yearLocalDate.plusYears(1).with(TemporalAdjusters.firstDayOfYear());
|
|
|
+ LocalDateTime endTime = firstDayOfNextYear.atStartOfDay();
|
|
|
+
|
|
|
+ dto.setStartTime(startTime);
|
|
|
+ dto.setEndTime(endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(ObjectUtils.isNotEmpty(dto.getStatus()) && dto.getStatus() == 1 && StringUtils.isNotEmpty(dto.getYearMonth())){
|
|
|
+ String yearMonthStr = dto.getYearMonth() + "01";
|
|
|
+ LocalDate yearMonthLocalDate = LocalDate.parse(yearMonthStr);
|
|
|
+
|
|
|
+
|
|
|
+ LocalDate lastDayOfPreviousMonth = yearMonthLocalDate.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth());
|
|
|
+ LocalDateTime startTime = lastDayOfPreviousMonth.atTime(23, 59, 59);
|
|
|
+
|
|
|
+
|
|
|
+ LocalDate firstDayOfNextMonth = yearMonthLocalDate.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth());
|
|
|
+ LocalDateTime endTime = firstDayOfNextMonth.atStartOfDay();
|
|
|
+
|
|
|
+ dto.setStartTime(startTime);
|
|
|
+ dto.setEndTime(endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtils.isNotEmpty(dto.getStatus()) && dto.getStatus() == 2 && ObjectUtils.isNotEmpty(dto.getBaseSemesterId())){
|
|
|
+
|
|
|
+ BaseSemester baseSemester = baseSemesterMapper.selectById(dto.getBaseSemesterId());
|
|
|
+ LocalDateTime startTime = baseSemester.getStartDate().toInstant()
|
|
|
+ .atZone(ZoneId.systemDefault())
|
|
|
+ .toLocalDateTime();
|
|
|
+ LocalDateTime endTime = baseSemester.getEndDate().toInstant()
|
|
|
+ .atZone(ZoneId.systemDefault())
|
|
|
+ .toLocalDateTime();
|
|
|
+
|
|
|
+ dto.setStartTime(startTime);
|
|
|
+ dto.setEndTime(endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtils.isNotEmpty(dto.getStatus()) && dto.getStatus() == 3 && ObjectUtils.isNotEmpty(dto.getYear())){
|
|
|
+ LocalDate yearLocalDate = LocalDate.of(dto.getYear(), 1, 1);
|
|
|
+ LocalDate lastDayOfLastYear = yearLocalDate.minusYears(1).with(TemporalAdjusters.lastDayOfYear());
|
|
|
+ LocalDateTime startTime = lastDayOfLastYear.atTime(23, 59, 59);
|
|
|
+
|
|
|
+ LocalDate firstDayOfNextYear = yearLocalDate.plusYears(1).with(TemporalAdjusters.firstDayOfYear());
|
|
|
+ LocalDateTime endTime = firstDayOfNextYear.atStartOfDay();
|
|
|
+
|
|
|
+ dto.setStartTime(startTime);
|
|
|
+ dto.setEndTime(endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String sql = "select t.user_id,\n" +
|
|
|
+ " t.new_job_state,\n" +
|
|
|
+ " t3.name\n" +
|
|
|
+ "from base_teacher_change_record t\n" +
|
|
|
+ " inner join (SELECT user_id,\n" +
|
|
|
+ " MAX(id) AS max_id\n" +
|
|
|
+ " FROM base_teacher_change_record a\n" +
|
|
|
+ " where a.delete_mark = 0\n" +
|
|
|
+ " and a.create_date between '" +dto.getStartTime() + "' and '" + dto.getEndTime()+ "'\n" +
|
|
|
+ " GROUP BY user_id) t2 on t2.max_id = t.id\n" +
|
|
|
+ " left join base_teacher t1 on t1.user_id = t.user_id\n" +
|
|
|
+ " left join xjr_dictionary_detail t3 on t3.code = t1.employ_type\n" +
|
|
|
+ "where t.delete_mark = 0\n" +
|
|
|
+ " and t1.delete_mark = 0"
|
|
|
+ ;
|
|
|
+ List<Map<String, Object>> list = SqlRunnerAdapter.db().selectList(sql);
|
|
|
+ Map<String, Map<String, Object>> statics = new LinkedHashMap<>();
|
|
|
+ for (Map<String, Object> oneRecord : list){
|
|
|
+ String job_state = oneRecord.get("new_job_state").toString();
|
|
|
+ String name = oneRecord.get("name").toString();
|
|
|
+ if(statics.containsKey(job_state)){
|
|
|
+ Map<String, Object> oneMap = statics.get(job_state);
|
|
|
+ if(oneMap.containsKey(name)){
|
|
|
+ oneMap.put(name, (int)oneMap.get(name) + 1);
|
|
|
+ }else {
|
|
|
+ oneMap.put(name, 1);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ Map<String, Object> oneMap = new LinkedHashMap<>();
|
|
|
+ oneMap.put("item", job_state);
|
|
|
+ oneMap.put(name, 1);
|
|
|
+ statics.put(job_state, oneMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ teacherChangeStatisticsDetailVo.setTeacherChangeItemVoList(new ArrayList<>(statics.values()));
|
|
|
+ return RT.ok(teacherChangeStatisticsDetailVo);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping(value = "/student-statistics")
|
|
|
@ApiOperation(value = "学生详情数据统计")
|
|
|
@SaCheckPermission("datadetail:detail")
|
|
@@ -495,7 +601,6 @@ public class DatadetailController {
|
|
|
}
|
|
|
result.setStudentTypeList(studentTypeList);
|
|
|
|
|
|
-
|
|
|
List<BaseStudentUserPageVo> studentList = studentService.getStudentList(new BaseStudentUserPageDto());
|
|
|
Set<String> studentStayMaleSet = studentList.stream()
|
|
|
.filter(x -> (
|
|
@@ -590,6 +695,7 @@ public class DatadetailController {
|
|
|
);
|
|
|
}
|
|
|
result.setDeptList(deptList);
|
|
|
+
|
|
|
return RT.ok(result);
|
|
|
}
|
|
|
|