fix: 攀枝花东区-缴费分支代码处理
This commit is contained in:
-40
@@ -1,40 +0,0 @@
|
||||
package com.yida.data.user.config;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.school.feign.facility.RemoteDormitoryService;
|
||||
import com.yida.data.user.service.EduStudentService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* excel功能配置类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/10/20
|
||||
*/
|
||||
@Configuration
|
||||
public class ExcelConfiguration {
|
||||
|
||||
@Value("${febs.uploadUrl}")
|
||||
private String uploadUrl;
|
||||
|
||||
@Bean
|
||||
ExportStudentClient exportStudentClient(
|
||||
EduStudentService eduStudentService,
|
||||
RedisService redisService, CommonService commonService) {
|
||||
return new ExportStudentClient(eduStudentService, redisService, commonService,
|
||||
CachePrefixConstant.EXPORT_STUDENT_DATA, uploadUrl);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ExportStudentDormClient exportStudentDormClient(
|
||||
EduStudentService eduStudentService,
|
||||
RedisService redisService, CommonService commonService, RemoteDormitoryService remoteDormitoryService) {
|
||||
return new ExportStudentDormClient(eduStudentService, redisService, commonService,
|
||||
CachePrefixConstant.EXPORT_STUDENT_DORM_DATA, uploadUrl, remoteDormitoryService);
|
||||
}
|
||||
|
||||
}
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
package com.yida.data.user.config;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yida.data.common.core.entity.Dict;
|
||||
import com.yida.data.common.core.entity.user.EduStudent;
|
||||
import com.yida.data.common.excel.DefaultExportExcelClient;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.user.dto.PageStudentDTO;
|
||||
import com.yida.data.user.dto.StudentExportDTO;
|
||||
import com.yida.data.user.excel.SelectStudentExportData;
|
||||
import com.yida.data.user.service.EduStudentService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 学生信息导出处理类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/12/12 15:00
|
||||
*/
|
||||
public class ExportStudentClient
|
||||
extends DefaultExportExcelClient<SelectStudentExportData, StudentExportDTO, EduStudent, EduStudentService> {
|
||||
|
||||
public ExportStudentClient(EduStudentService eduStudentService, RedisService redisService, CommonService commonService,
|
||||
String exportCacheKey, String uploadUrl) {
|
||||
super(eduStudentService, redisService, commonService, exportCacheKey, uploadUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EduStudent> selectExportData(SelectStudentExportData selectStudentExportData) {
|
||||
// 查询数据
|
||||
PageStudentDTO dto = new PageStudentDTO();
|
||||
BeanUtils.copyProperties(selectStudentExportData, dto);
|
||||
return this.baseService.selectStudent(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StudentExportDTO handleSingleData(EduStudent o) {
|
||||
StudentExportDTO exportDTO = new StudentExportDTO();
|
||||
BeanUtils.copyProperties(o, exportDTO);
|
||||
// 采集状态
|
||||
String collectStatus = "未采集";
|
||||
if (Objects.nonNull(o.getCollectType()) && o.getCollectType() == 1) {
|
||||
collectStatus = "已采集";
|
||||
}
|
||||
exportDTO.setCollectStatus(collectStatus);
|
||||
// 班级信息
|
||||
if (StrUtil.isNotBlank(o.getCampusName()) && StrUtil.isNotBlank(o.getSectionName())
|
||||
&& StrUtil.isNotBlank(o.getGradeName()) && StrUtil.isNotBlank(o.getClassName())) {
|
||||
exportDTO.setDeptName(o.getCampusName() + "-" + o.getSectionName() + "-" +
|
||||
o.getGradeName() + "-" + o.getClassName());
|
||||
}
|
||||
// 政治面貌
|
||||
Dict politicsStatus = this.commonService.getDictByTypeAndValueOrLabel("politics_status", null, o.getPoliticsStatus());
|
||||
if (Objects.nonNull(politicsStatus)) {
|
||||
exportDTO.setPoliticsStatus(politicsStatus.getValue());
|
||||
} else {
|
||||
exportDTO.setPoliticsStatus("");
|
||||
}
|
||||
// 学生性别
|
||||
String sex = o.getStuSex();
|
||||
if (StrUtil.isEmpty(sex)) {
|
||||
exportDTO.setStuSex("");
|
||||
} else {
|
||||
exportDTO.setStuSex("0".equals(sex) ? "男" : "女");
|
||||
}
|
||||
// 民族
|
||||
Dict nation = this.commonService.getDictByTypeAndValueOrLabel("nation", null, o.getNation());
|
||||
if (Objects.nonNull(nation)) {
|
||||
exportDTO.setNation(nation.getValue());
|
||||
} else {
|
||||
exportDTO.setNation("");
|
||||
}
|
||||
// 学生类型
|
||||
Integer type = o.getType();
|
||||
if (Objects.nonNull(type)) {
|
||||
exportDTO.setType(type == 0 ? "走读" : "住宿");
|
||||
}
|
||||
// 学籍状态
|
||||
Dict studentStatus = this.commonService.getDictByTypeAndValueOrLabel("student_status", null, o.getStudentStatus());
|
||||
if (Objects.nonNull(studentStatus)) {
|
||||
exportDTO.setStudentStatus(studentStatus.getValue());
|
||||
} else {
|
||||
exportDTO.setStudentStatus("");
|
||||
}
|
||||
return exportDTO;
|
||||
}
|
||||
}
|
||||
-99
@@ -1,99 +0,0 @@
|
||||
package com.yida.data.user.config;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.yida.data.common.core.entity.school.EduDormitoryRoom;
|
||||
import com.yida.data.common.core.entity.user.EduStudent;
|
||||
import com.yida.data.common.core.entity.user.EduUserDept;
|
||||
import com.yida.data.common.excel.DefaultExportExcelClient;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.school.dto.index.ListDormRoomDTO;
|
||||
import com.yida.data.school.feign.facility.RemoteDormitoryService;
|
||||
import com.yida.data.user.dto.StudentDormExportDTO;
|
||||
import com.yida.data.user.excel.SelectStudentDormExportData;
|
||||
import com.yida.data.user.service.EduStudentService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 学生住宿信息导出处理类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/12/13 15:00
|
||||
*/
|
||||
public class ExportStudentDormClient
|
||||
extends DefaultExportExcelClient<SelectStudentDormExportData, StudentDormExportDTO, EduStudent, EduStudentService> {
|
||||
|
||||
private final RemoteDormitoryService remoteDormitoryService;
|
||||
|
||||
private Map<Long, List<EduDormitoryRoom>> dormRoomGroup = new HashMap<>();
|
||||
|
||||
public ExportStudentDormClient(EduStudentService eduStudentService, RedisService redisService, CommonService commonService,
|
||||
String exportCacheKey, String uploadUrl, RemoteDormitoryService remoteDormitoryService) {
|
||||
super(eduStudentService, redisService, commonService, exportCacheKey, uploadUrl);
|
||||
this.remoteDormitoryService = remoteDormitoryService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EduStudent> selectExportData(SelectStudentDormExportData data) {
|
||||
List<Long> dormIds = new ArrayList<>();
|
||||
// 查询匹配的宿舍
|
||||
if (data.getDormRoomId() == null) {
|
||||
List<EduDormitoryRoom> dormRooms = remoteDormitoryService.listDormRoomNoAuth(ListDormRoomDTO.builder()
|
||||
.schoolId(data.getSchoolId())
|
||||
.floor(data.getFloor())
|
||||
.dormIds(data.getDormId() != null ? Collections.singletonList(data.getDormId()) : null).build()).getData();
|
||||
if (CollUtil.isNotEmpty(dormRooms)) {
|
||||
dormRoomGroup = dormRooms.stream().collect(Collectors.groupingBy(EduDormitoryRoom::getDormId));
|
||||
dormIds = dormRooms.stream().map(EduDormitoryRoom::getId).collect(Collectors.toList());
|
||||
}
|
||||
} else {
|
||||
dormIds = Collections.singletonList(data.getDormRoomId());
|
||||
}
|
||||
// 宿舍为空 不查询数据
|
||||
if (CollUtil.isEmpty(dormIds)) {
|
||||
dormIds = new ArrayList<>();
|
||||
dormIds.add(-1L);
|
||||
}
|
||||
// 查询学生信息
|
||||
return this.baseService.listStudentDorm(dormIds, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StudentDormExportDTO handleSingleData(EduStudent o) {
|
||||
// 年级班级信息
|
||||
EduUserDept grade = this.commonService.getUserDept(o.getGradeId());
|
||||
EduUserDept clazz = this.commonService.getUserDept(o.getClassId());
|
||||
StringBuilder gradeClass = new StringBuilder();
|
||||
if (grade != null) {
|
||||
gradeClass.append(grade.getDeptName());
|
||||
}
|
||||
if (clazz != null) {
|
||||
gradeClass.append(clazz.getDeptName());
|
||||
}
|
||||
o.setClassName(gradeClass.toString());
|
||||
// 入住寝室信息
|
||||
EduDormitoryRoom dormRoom;
|
||||
if (CollUtil.isNotEmpty(dormRoomGroup) && dormRoomGroup.containsKey(o.getDormRoomId())) {
|
||||
dormRoom = dormRoomGroup.get(o.getDormRoomId()).get(0);
|
||||
} else {
|
||||
dormRoom = remoteDormitoryService.getDormRoomNoPermission(o.getDormRoomId()).getData();
|
||||
if (dormRoom != null) {
|
||||
dormRoomGroup.put(dormRoom.getId(), Collections.singletonList(dormRoom));
|
||||
}
|
||||
}
|
||||
// 查询到了寝室信息
|
||||
if (Objects.nonNull(dormRoom)) {
|
||||
String dormRoomName = dormRoom.getDormName() +
|
||||
dormRoom.getFloor() + "层" +
|
||||
dormRoom.getName();
|
||||
o.setDormRoomName(dormRoomName);
|
||||
}
|
||||
StudentDormExportDTO exportDTO = new StudentDormExportDTO();
|
||||
BeanUtils.copyProperties(o, exportDTO);
|
||||
exportDTO.setDeptName(o.getClassName());
|
||||
return exportDTO;
|
||||
}
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package com.yida.data.user.controller;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.user.dto.StrategySaveDTO;
|
||||
import com.yida.data.user.service.EduFaceGroupStrategyService;
|
||||
import com.yida.data.user.vo.StrategyInfoVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 人脸组-策略Controller
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:04:39
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("eduFaceGroupStrategy")
|
||||
@Api(tags = "人脸组-策略api")
|
||||
public class EduFaceGroupStrategyController {
|
||||
|
||||
private final EduFaceGroupStrategyService eduFaceGroupStrategyService;
|
||||
|
||||
@GetMapping(value = "getStrategyInfo")
|
||||
@ApiOperation(value = "获取人脸组策略信息")
|
||||
public ResultBean<StrategyInfoVO> getStrategyInfo(@ApiParam(value = "人脸组id", required = true) @RequestParam Long faceGroupId) {
|
||||
return ResultBean.buildSuccess(eduFaceGroupStrategyService.getStrategyInfo(faceGroupId));
|
||||
}
|
||||
|
||||
@PostMapping(value = "saveStrategyInfo")
|
||||
@ApiOperation(value = "保存人脸组策略信息")
|
||||
public ResultBean<String> saveStrategyInfo(@RequestBody StrategySaveDTO strategySaveDTO) {
|
||||
eduFaceGroupStrategyService.saveStrategyInfo(strategySaveDTO);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
}
|
||||
-148
@@ -1,148 +0,0 @@
|
||||
package com.yida.data.user.controller;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApply;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.user.dto.ListStudentApplyDTO;
|
||||
import com.yida.data.user.service.EduStudentApplyService;
|
||||
import com.yida.data.user.vo.StudentApplyImportProgressVO;
|
||||
import com.yida.data.user.vo.StudentApplyStatusVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Api(tags = "交易-学生应用关系")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/transaction/studentApply")
|
||||
@RestController
|
||||
public class EduStudentApplyController {
|
||||
|
||||
private final EduStudentApplyService eduStudentApplyService;
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
@ApiOperation("分页查询学生开通应用")
|
||||
@GetMapping("/listStudentApply")
|
||||
public ResultBean<IPage<EduStudentApply>> listApply(ListStudentApplyDTO dto) {
|
||||
Page<EduStudentApply> page = new Page<>();
|
||||
page.setCurrent(dto.getPageNum());
|
||||
page.setSize(dto.getPageSize());
|
||||
return ResultBean.buildSuccess(eduStudentApplyService.listStudentApply(dto, page));
|
||||
}
|
||||
|
||||
@ApiOperation("获取开通应用详情")
|
||||
@GetMapping("/getStudentApply")
|
||||
public ResultBean<EduStudentApply> getStudentApply(@ApiParam("主键ID") Long id) {
|
||||
return ResultBean.buildSuccess(eduStudentApplyService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("获取开通应用详情")
|
||||
@GetMapping("/getStudentApplyByIdAndCode")
|
||||
public ResultBean<EduStudentApply> getStudentApplyByIdAndCode(
|
||||
@RequestParam("studentId") Long studentId,
|
||||
@RequestParam("applyCode") String applyCode) {
|
||||
List<EduStudentApply> list = eduStudentApplyService.list(Wrappers.lambdaQuery(new EduStudentApply())
|
||||
.eq(EduStudentApply::getStudentId, studentId)
|
||||
.eq(EduStudentApply::getApplyCode, applyCode)
|
||||
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
|
||||
.le(EduStudentApply::getStartTime, LocalDateTime.now())
|
||||
.orderByDesc(EduStudentApply::getEndTime)
|
||||
);
|
||||
EduStudentApply eduStudentApply = null;
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
eduStudentApply = list.get(0);
|
||||
}
|
||||
return ResultBean.buildSuccess(eduStudentApply);
|
||||
}
|
||||
|
||||
@ApiOperation("删除开通应用")
|
||||
@GetMapping("/deleteStudentApply")
|
||||
@OperationLog(module = ModuleName.TRANSATION, methods = "删除学生开通应用", type = OperationLogTypeEnum.DELETE)
|
||||
public ResultBean deleteStudentApply(@ApiParam("主键ID") Long id) {
|
||||
eduStudentApplyService.update(Wrappers.lambdaUpdate(new EduStudentApply())
|
||||
.eq(EduStudentApply::getId, id)
|
||||
.set(EduStudentApply::getDelFlag, 1));
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("保存学生开通应用")
|
||||
@PostMapping("/saveStudentApply")
|
||||
@OperationLog(module = ModuleName.TRANSATION, methods = "保存学生开通应用", type = OperationLogTypeEnum.INSERT)
|
||||
public ResultBean insertApply(@ApiParam("开通应用") @RequestBody EduStudentApply eduStudentApply) {
|
||||
eduStudentApplyService.saveStudentApply(eduStudentApply);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("查询学生是否拥有该应用权限")
|
||||
@GetMapping("/hasApply")
|
||||
public ResultBean<Boolean> listApplyCode(@ApiParam("学生id") Long studentId,
|
||||
@ApiParam("应用编码") String applyCode) {
|
||||
return ResultBean.buildSuccess(eduStudentApplyService.count(Wrappers.lambdaQuery(new EduStudentApply())
|
||||
.eq(EduStudentApply::getStudentId, studentId)
|
||||
.eq(EduStudentApply::getApplyCode, applyCode)
|
||||
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
|
||||
.le(EduStudentApply::getStartTime, LocalDateTime.now())) > 0);
|
||||
}
|
||||
|
||||
@ApiOperation("查询学生的应用状态")
|
||||
@GetMapping("/getApplyStatus")
|
||||
public ResultBean<StudentApplyStatusVO> getApplyStatus(@ApiParam("学生id") Long studentId,
|
||||
@ApiParam("应用编码") String applyCode) {
|
||||
return ResultBean.buildSuccess(eduStudentApplyService.getStudentApplyStatus(studentId, applyCode));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("下载学生开通应用导入模板")
|
||||
@PostMapping("/downloadTemplate")
|
||||
public void downloadTemplate(HttpServletResponse response) throws Exception {
|
||||
eduStudentApplyService.downloadTemplate(response);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("导入学生开通应用信息")
|
||||
@PostMapping("/importStudentApplyInfo")
|
||||
public ResultBean<StudentApplyImportProgressVO> importStudentApplyInfo(@RequestParam(value = "file") MultipartFile file)
|
||||
throws Exception {
|
||||
String redisKey = UUID.randomUUID().toString();
|
||||
StudentApplyImportProgressVO progressVO = new StudentApplyImportProgressVO();
|
||||
progressVO.setRedisKey(redisKey);
|
||||
progressVO.setFinish(0);
|
||||
progressVO.setTotalNum(0);
|
||||
progressVO.setCurrentNum(0);
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey, progressVO);
|
||||
eduStudentApplyService.importStudentApplyInfo(file, redisKey);
|
||||
return ResultBean.buildSuccess(progressVO);
|
||||
}
|
||||
|
||||
@ApiOperation("获取导入学生开通应用信息进度")
|
||||
@GetMapping("/getImportStudentApplyInfoProgress")
|
||||
public ResultBean<StudentApplyImportProgressVO> getImportStudentApplyInfoProgress(@RequestParam("redisKey") String redisKey) {
|
||||
return ResultBean.buildSuccess(eduStudentApplyService.getImportStudentApplyInfoProgress(redisKey));
|
||||
}
|
||||
|
||||
@ApiOperation("删除缓存导入进度")
|
||||
@GetMapping("/deleteRedisStudentApplyImportProgress")
|
||||
public ResultBean deleteRedisStudentApplyImportProgress(@RequestParam("redisKey") String redisKey) {
|
||||
redisService.hdel(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
-84
@@ -1,84 +0,0 @@
|
||||
package com.yida.data.user.controller;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.system.enums.OperationLogTypeEnum;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApply;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApplyFor;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.user.dto.ListStudentApplyDTO;
|
||||
import com.yida.data.user.dto.ListStudentApplyForDTO;
|
||||
import com.yida.data.user.service.EduStudentApplyForService;
|
||||
import com.yida.data.user.service.EduStudentApplyService;
|
||||
import com.yida.data.user.vo.StudentApplyImportProgressVO;
|
||||
import com.yida.data.user.vo.StudentApplyStatusVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Api(tags = "交易-学生应用关系")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/transaction/studentApplyFor")
|
||||
@RestController
|
||||
public class EduStudentApplyForController {
|
||||
|
||||
private final EduStudentApplyForService eduStudentApplyForService;
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
@ApiOperation("分页查询申请学生开通应用")
|
||||
@GetMapping("/listStudentApplyFor")
|
||||
public ResultBean<IPage<EduStudentApplyFor>> listApply(ListStudentApplyForDTO dto) {
|
||||
Page<EduStudentApplyFor> page = new Page<>();
|
||||
page.setCurrent(dto.getPageNum());
|
||||
page.setSize(dto.getPageSize());
|
||||
return ResultBean.buildSuccess(eduStudentApplyForService.listStudentApplyFor(dto, page));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("查询申请详情")
|
||||
@GetMapping("/getStudentApplyFor")
|
||||
public ResultBean<EduStudentApplyFor> getStudentApplyFor(@RequestParam("studentId") Long studentId,
|
||||
@RequestParam("applyCode") String applyCode) {
|
||||
return ResultBean.buildSuccess(eduStudentApplyForService.getByStudentId(studentId, applyCode));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("学生申请开通应用")
|
||||
@GetMapping("/saveStudentApplyFor")
|
||||
@OperationLog(module = ModuleName.STUDENT, methods = "学生申请开通应用", type = OperationLogTypeEnum.INSERT)
|
||||
public ResultBean insertApplyFor(@RequestParam("studentId") Long studentId, @RequestParam("applyCode") String applyCode) {
|
||||
EduStudentApplyFor eduStudentApplyFor = new EduStudentApplyFor();
|
||||
eduStudentApplyFor.setStudentId(studentId);
|
||||
eduStudentApplyFor.setApplyCode(applyCode);
|
||||
eduStudentApplyForService.saveStudentApplyFor(eduStudentApplyFor);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@ApiOperation("处理申请")
|
||||
@GetMapping("/dealApplyFor")
|
||||
@OperationLog(module = ModuleName.STUDENT, methods = "处理申请", type = OperationLogTypeEnum.UPDATE)
|
||||
public ResultBean dealApplyFor(@RequestParam("id") Long id, @RequestParam("status") Integer status) {
|
||||
eduStudentApplyForService.dealApplyFor(id, status);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package com.yida.data.user.controller.in;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupDevice;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.user.dto.BatchIssueDTO;
|
||||
import com.yida.data.user.service.EduFaceGroupDeviceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人脸设备 Controller(不鉴权)
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/9/28
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("in/groupDevice")
|
||||
public class InEduFaceGroupDeviceController {
|
||||
|
||||
private final EduFaceGroupDeviceService eduFaceGroupDeviceService;
|
||||
|
||||
/**
|
||||
* 查询人脸组设备id集合
|
||||
*/
|
||||
@GetMapping("/listFaceGroupOnlineDevice")
|
||||
public ResultBean<List<Long>> listFaceGroupOnlineDevice(@RequestParam Long faceGroupId) {
|
||||
return ResultBean.buildSuccess(eduFaceGroupDeviceService.listFaceGroupOnlineDevice(faceGroupId));
|
||||
}
|
||||
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
package com.yida.data.user.controller.in;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategy;
|
||||
import com.yida.data.user.dto.StrategySaveDTO;
|
||||
import com.yida.data.user.service.EduFaceGroupStrategyService;
|
||||
import com.yida.data.user.vo.StrategyInfoVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 人脸组-策略Controller(不鉴权)
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:04:39
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("in/eduFaceGroupStrategy")
|
||||
@Api(tags = "人脸组-策略api(不鉴权)")
|
||||
public class InEduFaceGroupStrategyController {
|
||||
|
||||
private final EduFaceGroupStrategyService eduFaceGroupStrategyService;
|
||||
|
||||
@GetMapping(value = "getStrategyInfo")
|
||||
@ApiOperation(value = "获取人脸组策略信息")
|
||||
public ResultBean<EduFaceGroupStrategy> getStrategyInfo(@RequestParam Long faceGroupId) {
|
||||
return ResultBean.buildSuccess(eduFaceGroupStrategyService.getOne(Wrappers.lambdaQuery(new EduFaceGroupStrategy())
|
||||
.eq(EduFaceGroupStrategy::getFaceGroupId, faceGroupId)));
|
||||
}
|
||||
}
|
||||
-95
@@ -1,95 +0,0 @@
|
||||
package com.yida.data.user.controller.in;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.annotation.ControllerLog;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.user.EduStaff;
|
||||
import com.yida.data.common.core.entity.user.EduStaffDept;
|
||||
import com.yida.data.common.core.entity.user.EduStudent;
|
||||
import com.yida.data.common.core.entity.user.EduTeacherDept;
|
||||
import com.yida.data.common.core.entity.user.EduUserDept;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.common.core.utils.FileUtil;
|
||||
import com.yida.data.system.feign.RemoteDeptService;
|
||||
import com.yida.data.user.dto.ListStaffDTO;
|
||||
import com.yida.data.user.dto.PageTeacherDTO;
|
||||
import com.yida.data.user.mapper.EduTeacherDeptMapper;
|
||||
import com.yida.data.user.service.EduStaffDeptService;
|
||||
import com.yida.data.user.service.EduStaffService;
|
||||
import com.yida.data.user.service.EduStudentService;
|
||||
import com.yida.data.user.vo.StaStaffDistributeVO;
|
||||
import com.yida.data.user.vo.StaffPageVO;
|
||||
import com.yida.data.user.vo.StaffWithDeptVO;
|
||||
import com.yida.data.user.vo.TeacherClassAndGradeVO;
|
||||
import com.yida.data.user.vo.TeacherClassVO;
|
||||
import com.yida.data.user.vo.TeacherCourseInfoVO;
|
||||
import com.yida.data.user.vo.TeacherDetailVO;
|
||||
import com.yida.data.user.vo.TeacherListVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Api(tags = "教师管理 仅学校管理员有权限")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("in/staff")
|
||||
@RequiredArgsConstructor
|
||||
public class InEduStaffController {
|
||||
|
||||
|
||||
private final EduStaffService eduStaffService;
|
||||
private final RedisService redisService;
|
||||
private final EduStudentService eduStudentService;
|
||||
private final EduTeacherDeptMapper eduTeacherDeptMapper;
|
||||
private final EduStaffDeptService eduStaffDeptService;
|
||||
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
|
||||
@ApiOperation("根据根据部门id查询对应教职工")
|
||||
@GetMapping("/listStaffByDeptId")
|
||||
public ResultBean<List<Long>> listStaffByDeptId(@RequestParam(required = false) Long deptId,
|
||||
@RequestParam(required = false) String nameOrPhone,
|
||||
@RequestParam(required = false) Long schoolId) {
|
||||
|
||||
return ResultBean.buildSuccess(eduStaffService.listStaffByDeptId(deptId, nameOrPhone, schoolId));
|
||||
}
|
||||
|
||||
@ApiOperation("查询职工部门信息")
|
||||
@PostMapping("/getStaffDeptByStaffIds")
|
||||
public ResultBean<List<EduStaffDept>> getStaffDeptByStaffIds(@ApiParam("职工id") @RequestBody List<Long> staffIds) {
|
||||
return ResultBean.buildSuccess(eduStaffDeptService.getStaffDeptByStaffIds(staffIds));
|
||||
}
|
||||
|
||||
@ApiOperation("更新教职工信息缓存")
|
||||
@GetMapping("/updateStaffCache")
|
||||
public ResultBean updateStaffCache() {
|
||||
eduStaffService.updateStaffCache();
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
}
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
package com.yida.data.user.controller.in;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApply;
|
||||
import com.yida.data.user.service.EduStudentApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Api(tags = "交易-学生应用关系(不鉴权)")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/in/transaction/studentApply")
|
||||
@RestController
|
||||
public class InEduStudentApplyController {
|
||||
|
||||
private final EduStudentApplyService eduStudentApplyService;
|
||||
private final RedisService redisService;
|
||||
|
||||
@ApiOperation("查询学生的应用编码列表")
|
||||
@GetMapping("/listApply")
|
||||
public ResultBean<Map<Long, List<String>>> listApplyCode(@RequestParam("studentIds") Long[] studentIds) {
|
||||
List<EduStudentApply> applyCodeList = eduStudentApplyService.list(Wrappers.lambdaQuery(new EduStudentApply())
|
||||
.in(EduStudentApply::getStudentId, studentIds)
|
||||
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
|
||||
.le(EduStudentApply::getStartTime, LocalDateTime.now()));
|
||||
Map<Long, List<String>> res = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(applyCodeList)) {
|
||||
Map<Long, List<EduStudentApply>> collect = applyCodeList.stream()
|
||||
.collect(Collectors.groupingBy(EduStudentApply::getStudentId));
|
||||
for (Map.Entry<Long, List<EduStudentApply>> entry : collect.entrySet()) {
|
||||
List<String> applyCode = entry.getValue().stream().map(x -> x.getApplyCode()).distinct()
|
||||
.collect(Collectors.toList());
|
||||
res.put(entry.getKey(), applyCode);
|
||||
redisService.hset(CachePrefixConstant.STUDENT_APPLY, entry.getKey().toString(), applyCode);
|
||||
}
|
||||
}
|
||||
return ResultBean.buildSuccess(res);
|
||||
}
|
||||
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package com.yida.data.user.controller.out;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.yida.data.common.core.common.ModuleName;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.user.EduUserDept;
|
||||
import com.yida.data.log.annotation.OperationLog;
|
||||
import com.yida.data.user.service.EduParentService;
|
||||
import com.yida.data.user.service.EduUserDeptService;
|
||||
import com.yida.data.user.vo.StaParentDistributeVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 家校部门外部Controller (不鉴权)
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/4/25
|
||||
*/
|
||||
@Api(tags = "家校部门API")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(value = "/out/userDept")
|
||||
public class OutEduUserDeptController {
|
||||
|
||||
private final EduUserDeptService eduUserDeptService;
|
||||
|
||||
@ApiOperation("查询学校年级分布")
|
||||
@GetMapping("/getGradeDistribution")
|
||||
public ResultBean<JSONArray> getGradeDistribution(@ApiParam("学校id") @RequestParam Long schoolId) {
|
||||
return ResultBean.buildSuccess(eduUserDeptService.getGradeDistribution(schoolId));
|
||||
}
|
||||
}
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
package com.yida.data.user.excel;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.user.dto.CardErrorExportDTO;
|
||||
import com.yida.data.user.dto.CardImportDTO;
|
||||
import com.yida.data.user.service.ImportWelcomeStudentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.ehcache.impl.internal.concurrent.ConcurrentHashMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 校园卡号导入监听类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/8/24
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class CardDataDataExcelListener extends AnalysisEventListener<CardImportDTO> {
|
||||
|
||||
private final ImportWelcomeStudentService importWelcomeStudentService;
|
||||
|
||||
/**
|
||||
* 错误信息集合
|
||||
*/
|
||||
private final List<CardErrorExportDTO> errorList;
|
||||
|
||||
/**
|
||||
* 学校id
|
||||
*/
|
||||
private final Long schoolId;
|
||||
|
||||
/**
|
||||
* 当前登录用户信息
|
||||
*/
|
||||
private final CurrentUser currentUser;
|
||||
|
||||
/**
|
||||
* 每次存储条数
|
||||
* 每隔5条存储数据库, 实际使用中可以3000条, 然后清理list, 方便内存回收
|
||||
*/
|
||||
private static final int BATCH_COUNT = 3000;
|
||||
|
||||
/**
|
||||
* 需要保存的数据集合
|
||||
*/
|
||||
ConcurrentHashMap<Integer, CardImportDTO> concurrentHashMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 解析成功一条数据调用一次
|
||||
*
|
||||
* @param dto 导入类
|
||||
* @param analysisContext analysisContext类型
|
||||
* @author ZYJ
|
||||
* @date 2021/8/23 16:12
|
||||
*/
|
||||
@Override
|
||||
public void invoke(CardImportDTO dto, AnalysisContext analysisContext) {
|
||||
// 获取读取的第几条数据
|
||||
Integer i = analysisContext.readRowHolder().getRowIndex();
|
||||
log.info("解析到第: {}条数据: {}", i, JSON.toJSONString(dto));
|
||||
concurrentHashMap.put(i, dto);
|
||||
// 达到BATCH_COUNT了, 需要去存储一次数据库, 防止数据几万条数据在内存, 容易OOM
|
||||
if (concurrentHashMap.size() >= BATCH_COUNT) {
|
||||
saveData();
|
||||
// 存储完成清理集合
|
||||
concurrentHashMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有数据解析完成调用
|
||||
*
|
||||
* @param analysisContext analysisContext类
|
||||
* @author ZYJ
|
||||
* @date 2021/8/23 16:18
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
// 这里也要保存数据, 确保最后遗留的数据也存储到数据库
|
||||
saveData();
|
||||
log.info("所有数据解析完成!");
|
||||
if (CollUtil.isNotEmpty(errorList)) {
|
||||
log.error("错误数据有: {}条", errorList.size());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存导入数据
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2021/8/23 16:20
|
||||
*/
|
||||
private void saveData() {
|
||||
log.info("{}条数据,开始存储数据库!", concurrentHashMap.size());
|
||||
importWelcomeStudentService.saveCardExcelData(concurrentHashMap, errorList, schoolId, currentUser);
|
||||
log.info("存储数据库成功!");
|
||||
}
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package com.yida.data.user.excel;
|
||||
|
||||
import com.yida.data.common.core.file.common.export.SelectExportData;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 导出学生宿舍查询类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/12/13 16:41
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SelectStudentDormExportData extends SelectExportData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1138422440767435262L;
|
||||
|
||||
@ApiModelProperty("学校id")
|
||||
private Long schoolId;
|
||||
|
||||
@ApiModelProperty("宿舍楼")
|
||||
private Long dormId;
|
||||
|
||||
@ApiModelProperty("楼层")
|
||||
private Integer floor;
|
||||
|
||||
@ApiModelProperty("寝室id")
|
||||
private Long dormRoomId;
|
||||
|
||||
@ApiModelProperty("班级id")
|
||||
private Long classId;
|
||||
|
||||
@ApiModelProperty("关键词")
|
||||
private String keyword;
|
||||
}
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
package com.yida.data.user.excel;
|
||||
|
||||
import com.yida.data.common.core.file.common.export.SelectExportData;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 导出学生查询类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2023/12/12 15:41
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SelectStudentExportData extends SelectExportData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7368186456144813899L;
|
||||
|
||||
@ApiModelProperty("区域id")
|
||||
private Long areaId;
|
||||
|
||||
@ApiModelProperty("学校id")
|
||||
private Long schoolId;
|
||||
|
||||
@ApiModelProperty("学生类型id")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("校区id")
|
||||
private Long campusId;
|
||||
|
||||
@ApiModelProperty("校区id")
|
||||
private List<Long> campusIdList;
|
||||
|
||||
@ApiModelProperty("学段id")
|
||||
private Long sectionId;
|
||||
private List<Long> sectionIdList;
|
||||
|
||||
@ApiModelProperty("年级id")
|
||||
private Long gradeId;
|
||||
private List<Long> gradeIdList;
|
||||
|
||||
@ApiModelProperty("班级id")
|
||||
private Long classId;
|
||||
private List<Long> classIdList;
|
||||
|
||||
@ApiModelProperty("学号id")
|
||||
private String stuNumber;
|
||||
|
||||
@ApiModelProperty("名字")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("家庭类型 字典值")
|
||||
private String familyType;
|
||||
|
||||
@ApiModelProperty("是否采集人脸:0否,1是")
|
||||
private String collectType;
|
||||
}
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
package com.yida.data.user.excel;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yida.data.user.dto.StaffImportDTO;
|
||||
import com.yida.data.user.dto.WelcomeStudentImportDTO;
|
||||
import com.yida.data.user.service.EduStaffService;
|
||||
import com.yida.data.user.service.ImportWelcomeStudentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.ehcache.impl.internal.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Excel 职工信息监听类
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class StaffDataExcelListener extends AnalysisEventListener<StaffImportDTO> {
|
||||
|
||||
private final EduStaffService eduStaffService;
|
||||
|
||||
/**
|
||||
* 错误信息集合
|
||||
*/
|
||||
private final ConcurrentHashMap<Integer, Object> errorMap;
|
||||
|
||||
/**
|
||||
* 学校id
|
||||
*/
|
||||
private final Long schoolId;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private final long timestamp;
|
||||
|
||||
/**
|
||||
* 每次存储条数 每隔5条存储数据库, 实际使用中可以3000条, 然后清理list, 方便内存回收
|
||||
*/
|
||||
private static final int BATCH_COUNT = 3000;
|
||||
|
||||
/**
|
||||
* 需要保存的数据集合
|
||||
*/
|
||||
ConcurrentHashMap<Integer, StaffImportDTO> concurrentHashMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 解析成功一条数据调用一次
|
||||
*/
|
||||
@Override
|
||||
public void invoke(StaffImportDTO staffImportDTO, AnalysisContext analysisContext) {
|
||||
// 获取读取的第几条数据
|
||||
Integer i = analysisContext.readRowHolder().getRowIndex();
|
||||
log.info("解析到第: {}条数据: {}", i, JSON.toJSONString(staffImportDTO));
|
||||
concurrentHashMap.put(i, staffImportDTO);
|
||||
// 达到BATCH_COUNT了, 需要去存储一次数据库, 防止数据几万条数据在内存, 容易OOM
|
||||
if (concurrentHashMap.size() >= BATCH_COUNT) {
|
||||
saveData();
|
||||
// 存储完成清理集合
|
||||
concurrentHashMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有数据解析完成调用
|
||||
*
|
||||
* @param analysisContext analysisContext类
|
||||
* @author ZYJ
|
||||
* @date 2021/8/23 16:18
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
// 这里也要保存数据, 确保最后遗留的数据也存储到数据库
|
||||
saveData();
|
||||
log.info("所有数据解析完成!");
|
||||
if (errorMap.size() > 0) {
|
||||
log.error("错误数据有: {}条", errorMap.size());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存导入数据
|
||||
*/
|
||||
private void saveData() {
|
||||
log.info("{}条数据,开始存储数据库!", concurrentHashMap.size());
|
||||
eduStaffService.saveExcelData(concurrentHashMap, errorMap, schoolId, timestamp);
|
||||
log.info("存储数据库成功!");
|
||||
}
|
||||
}
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
package com.yida.data.user.listener;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.yida.data.common.core.entity.attendance.EduAttendanceRule;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.school.EduDormitory;
|
||||
import com.yida.data.common.core.entity.school.EduDormitoryRoom;
|
||||
import com.yida.data.common.core.entity.user.EduStudent;
|
||||
import com.yida.data.common.core.vo.ImportPercentVO;
|
||||
import com.yida.data.school.dto.index.EditPersonNumDTO;
|
||||
import com.yida.data.school.feign.facility.RemoteDormitoryService;
|
||||
import com.yida.data.user.dto.ImportStudentTypeDTO;
|
||||
import com.yida.data.user.dto.ImportStudentTypeDTO;
|
||||
import com.yida.data.user.mapper.EduStudentMapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class ImportStudentTypeListener extends AnalysisEventListener<ImportStudentTypeDTO> {
|
||||
|
||||
private final RedisService redisService;
|
||||
private final EduStudentMapper eduStudentMapper;
|
||||
|
||||
private final ImportPercentVO res;
|
||||
private final Long schoolId;
|
||||
private final String key;
|
||||
|
||||
private final static Integer BATCH_COUNT = 100;
|
||||
|
||||
// 最后一行用作保存数据的进度
|
||||
private Integer rowNum = -1;
|
||||
private List<ImportStudentTypeDTO> list = new ArrayList<>(BATCH_COUNT);
|
||||
|
||||
/**
|
||||
* 这个每一条数据解析都会来调用
|
||||
*
|
||||
* @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()}
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void invoke(ImportStudentTypeDTO data, AnalysisContext context) {
|
||||
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
|
||||
list.add(data);
|
||||
//if (list.size() >= BATCH_COUNT) {
|
||||
// saveData();
|
||||
// // 存储完成清理 list
|
||||
// list = new ArrayList<>(BATCH_COUNT);
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有数据解析完成了 都会来调用
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
|
||||
saveData();
|
||||
res.setFinish(1);
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_TYPE, key, res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加上存储数据库
|
||||
*/
|
||||
private void saveData() {
|
||||
log.info("{}条数据,开始存储数据库!", list.size());
|
||||
res.setTotal((long) list.size());
|
||||
if (list.size() > 0) {
|
||||
// 错误数据
|
||||
List<ImportStudentTypeDTO> errorData = new ArrayList<>();
|
||||
for (ImportStudentTypeDTO dto : list) {
|
||||
// 学生是否存在
|
||||
EduStudent student = eduStudentMapper.selectOne(Wrappers.<EduStudent>lambdaQuery()
|
||||
.eq(EduStudent::getStuNumber, dto.getStudentNum())
|
||||
.eq(EduStudent::getSchoolId, schoolId));
|
||||
|
||||
if (student == null) {
|
||||
dto.setError("学生不存在");
|
||||
errorData.add(dto);
|
||||
continue;
|
||||
}
|
||||
eduStudentMapper.update(null,
|
||||
Wrappers.<EduStudent>lambdaUpdate().eq(EduStudent::getStuNumber, dto.getStudentNum())
|
||||
.set(EduStudent::getType, Integer.valueOf(dto.getType())));
|
||||
|
||||
rowNum++;
|
||||
if (rowNum * 100 / res.getTotal() != res.getPercent()) {
|
||||
res.setPercent((int) (rowNum * 100 / res.getTotal()));
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_TYPE, key, res);
|
||||
}
|
||||
}
|
||||
// 错误数据
|
||||
res.setError(errorData);
|
||||
}
|
||||
}
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
package com.yida.data.user.listener;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.yida.data.user.service.EduStudentApplyService;
|
||||
import com.yida.data.user.vo.StudentApplyImportVO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class importStudentApplyListener extends AnalysisEventListener<StudentApplyImportVO> {
|
||||
|
||||
|
||||
private EduStudentApplyService eduStudentApplyService;
|
||||
|
||||
|
||||
private List<StudentApplyImportVO> list = new ArrayList<>();
|
||||
|
||||
private String key;
|
||||
|
||||
|
||||
public importStudentApplyListener(EduStudentApplyService eduStudentApplyService, String key) {
|
||||
this.eduStudentApplyService = eduStudentApplyService;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(StudentApplyImportVO data, AnalysisContext context) {
|
||||
if (null == data) {
|
||||
log.info("excel导入失败:{}", data.toString());
|
||||
}
|
||||
list.add(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
saveData();
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
eduStudentApplyService.insertStudentApplyData(list, key);
|
||||
}
|
||||
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package com.yida.data.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategy;
|
||||
|
||||
/**
|
||||
* 人脸组-策略Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:04:39
|
||||
*/
|
||||
public interface EduFaceGroupStrategyMapper extends BaseMapper<EduFaceGroupStrategy> {
|
||||
|
||||
/**
|
||||
* 处理一周的通行计划
|
||||
*
|
||||
* @param groupStrategy 人脸组-策略Entity
|
||||
* @author ZYJ
|
||||
* @date 2022/12/12 17:59
|
||||
*/
|
||||
void updateWeekPlan(EduFaceGroupStrategy groupStrategy);
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package com.yida.data.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategyPlan;
|
||||
import com.yida.data.user.vo.StrategyPlanVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-通行计划Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:36:19
|
||||
*/
|
||||
public interface EduFaceGroupStrategyPlanMapper extends BaseMapper<EduFaceGroupStrategyPlan> {
|
||||
|
||||
/**
|
||||
* 查询人脸组-策略-通行计划
|
||||
*
|
||||
* @param strategyId 策略id
|
||||
* @return java.util.List<com.yida.data.user.vo.StrategyPlanVO>
|
||||
* @author ZYJ
|
||||
* @date 2022/12/12 14:43
|
||||
*/
|
||||
List<StrategyPlanVO> listStrategyPlan(@Param("strategyId") Long strategyId);
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
package com.yida.data.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategyPlanTime;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-通行计划-时间Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:36:19
|
||||
*/
|
||||
public interface EduFaceGroupStrategyPlanTimeMapper extends BaseMapper<EduFaceGroupStrategyPlanTime> {
|
||||
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package com.yida.data.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategySpecialDate;
|
||||
import com.yida.data.user.vo.StrategySpecialDateVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-特殊日期Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-26 13:57:32
|
||||
*/
|
||||
public interface EduFaceGroupStrategySpecialDateMapper extends BaseMapper<EduFaceGroupStrategySpecialDate> {
|
||||
|
||||
/**
|
||||
* 查询特殊日期
|
||||
*
|
||||
* @param strategyId 策略id
|
||||
* @return java.util.List<com.yida.data.user.vo.StrategySpecialDateVO>
|
||||
* @author ZYJ
|
||||
* @date 2022/12/26 17:14
|
||||
*/
|
||||
List<StrategySpecialDateVO> listStrategySpecialDate(@Param("strategyId") Long strategyId);
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
package com.yida.data.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategySpecialTime;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-特殊日期-时间Mapper
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-26 13:57:32
|
||||
*/
|
||||
public interface EduFaceGroupStrategySpecialTimeMapper extends BaseMapper<EduFaceGroupStrategySpecialTime> {
|
||||
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package com.yida.data.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApplyFor;
|
||||
import com.yida.data.user.dto.ListStudentApplyForDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface EduStudentApplyForMapper extends BaseMapper<EduStudentApplyFor> {
|
||||
|
||||
|
||||
IPage<EduStudentApplyFor> listStudentApplyFor(@Param("dto") ListStudentApplyForDTO dto, Page page);
|
||||
|
||||
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
package com.yida.data.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApply;
|
||||
import com.yida.data.user.dto.ListStudentApplyDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EduStudentApplyMapper extends BaseMapper<EduStudentApply> {
|
||||
|
||||
List<EduStudentApply> getStudentApplyStatus(@Param("studentId") Long studentId,
|
||||
@Param("applyCode") String applyCode);
|
||||
|
||||
IPage<EduStudentApply> listStudentApply(@Param("dto") ListStudentApplyDTO dto, Page page);
|
||||
|
||||
EduStudentApply getStudentApply(@Param("studentId") Long studentId,
|
||||
@Param("applyCode") String applyCode);
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.yida.data.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategyPlan;
|
||||
import com.yida.data.user.vo.StrategyPlanVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人脸组-策略Service接口
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:36:19
|
||||
*/
|
||||
public interface EduFaceGroupStrategyPlanService extends IService<EduFaceGroupStrategyPlan> {
|
||||
|
||||
/**
|
||||
* 查询人脸组-策略-通行计划
|
||||
*
|
||||
* @param strategyId 策略id
|
||||
* @return java.util.List<com.yida.data.user.vo.StrategyPlanVO>
|
||||
* @author ZYJ
|
||||
* @date 2022/12/12 14:42
|
||||
*/
|
||||
List<StrategyPlanVO> listStrategyPlan(Long strategyId);
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
package com.yida.data.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategyPlanTime;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-通行计划-时间Service接口
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:36:19
|
||||
*/
|
||||
public interface EduFaceGroupStrategyPlanTimeService extends IService<EduFaceGroupStrategyPlanTime> {
|
||||
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package com.yida.data.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategy;
|
||||
import com.yida.data.user.dto.StrategySaveDTO;
|
||||
import com.yida.data.user.vo.StrategyInfoVO;
|
||||
|
||||
/**
|
||||
* 人脸组-策略Service接口
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:04:39
|
||||
*/
|
||||
public interface EduFaceGroupStrategyService extends IService<EduFaceGroupStrategy> {
|
||||
|
||||
/**
|
||||
* 获取人脸组策略信息
|
||||
*
|
||||
* @param faceGroupId 人脸组id
|
||||
* @return com.yida.data.user.vo.StrategyInfoVO
|
||||
* @author ZYJ
|
||||
* @date 2022/12/12 14:11
|
||||
*/
|
||||
StrategyInfoVO getStrategyInfo(Long faceGroupId);
|
||||
|
||||
/**
|
||||
* 保存人脸组策略信息
|
||||
*
|
||||
* @param strategySaveDTO 人脸组-策略信息保存类
|
||||
* @author ZYJ
|
||||
* @date 2022/12/12 15:17
|
||||
*/
|
||||
void saveStrategyInfo(StrategySaveDTO strategySaveDTO);
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.yida.data.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategySpecialDate;
|
||||
import com.yida.data.user.vo.StrategySpecialDateVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-特殊日期Service接口
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-26 13:57:32
|
||||
*/
|
||||
public interface EduFaceGroupStrategySpecialDateService extends IService<EduFaceGroupStrategySpecialDate> {
|
||||
|
||||
/**
|
||||
* 查询特殊日期
|
||||
*
|
||||
* @param strategyId 策略id
|
||||
* @return java.util.List<com.yida.data.user.vo.StrategySpecialDateVO>
|
||||
* @author ZYJ
|
||||
* @date 2022/12/26 17:11
|
||||
*/
|
||||
List<StrategySpecialDateVO> listStrategySpecialDate(Long strategyId);
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.yida.data.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategySpecialTime;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-特殊日期-时间Service接口
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-26 13:57:32
|
||||
*/
|
||||
public interface EduFaceGroupStrategySpecialTimeService extends IService<EduFaceGroupStrategySpecialTime> {
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.yida.data.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApply;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApplyFor;
|
||||
import com.yida.data.user.dto.ListStudentApplyDTO;
|
||||
import com.yida.data.user.dto.ListStudentApplyForDTO;
|
||||
import com.yida.data.user.vo.StudentApplyImportProgressVO;
|
||||
import com.yida.data.user.vo.StudentApplyImportVO;
|
||||
import com.yida.data.user.vo.StudentApplyStatusVO;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface EduStudentApplyForService extends IService<EduStudentApplyFor> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
IPage<EduStudentApplyFor> listStudentApplyFor(ListStudentApplyForDTO dto, Page<EduStudentApplyFor> page);
|
||||
|
||||
|
||||
void saveStudentApplyFor(EduStudentApplyFor eduStudentApplyFor);
|
||||
|
||||
void dealApplyFor(Long id, Integer status);
|
||||
|
||||
EduStudentApplyFor getByStudentId(Long studentId, String appCode);
|
||||
}
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
package com.yida.data.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApply;
|
||||
import com.yida.data.user.dto.ListStudentApplyDTO;
|
||||
import com.yida.data.user.vo.StudentApplyImportProgressVO;
|
||||
import com.yida.data.user.vo.StudentApplyImportVO;
|
||||
import com.yida.data.user.vo.StudentApplyStatusVO;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface EduStudentApplyService extends IService<EduStudentApply> {
|
||||
|
||||
/**
|
||||
* 获取详情
|
||||
*/
|
||||
StudentApplyStatusVO getStudentApplyStatus(Long studentId, String applyCode);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
IPage<EduStudentApply> listStudentApply(ListStudentApplyDTO dto, Page<EduStudentApply> page);
|
||||
|
||||
void saveStudentApply(EduStudentApply eduStudentApply);
|
||||
|
||||
/**
|
||||
* 下载学生开通应用模板
|
||||
*
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
void downloadTemplate(HttpServletResponse response) throws Exception;
|
||||
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
@Async
|
||||
void importStudentApplyInfo(MultipartFile file, String redisKey) throws IOException;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*/
|
||||
void insertStudentApplyData(List<StudentApplyImportVO> studentApplyImportVOList, String redisKey);
|
||||
|
||||
/**
|
||||
* 获取导入进度
|
||||
*/
|
||||
StudentApplyImportProgressVO getImportStudentApplyInfoProgress(String redisKey);
|
||||
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.yida.data.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategyPlan;
|
||||
import com.yida.data.user.mapper.EduFaceGroupStrategyPlanMapper;
|
||||
import com.yida.data.user.service.EduFaceGroupStrategyPlanService;
|
||||
import com.yida.data.user.vo.StrategyPlanVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-通行计划Service实现
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:36:19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class EduFaceGroupStrategyPlanServiceImpl extends ServiceImpl
|
||||
<EduFaceGroupStrategyPlanMapper, EduFaceGroupStrategyPlan> implements EduFaceGroupStrategyPlanService {
|
||||
|
||||
@Override
|
||||
public List<StrategyPlanVO> listStrategyPlan(Long strategyId) {
|
||||
return baseMapper.listStrategyPlan(strategyId);
|
||||
}
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.yida.data.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategyPlanTime;
|
||||
import com.yida.data.user.mapper.EduFaceGroupStrategyPlanTimeMapper;
|
||||
import com.yida.data.user.service.EduFaceGroupStrategyPlanTimeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-通行计划-时间Service实现
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:36:19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class EduFaceGroupStrategyPlanTimeServiceImpl extends ServiceImpl
|
||||
<EduFaceGroupStrategyPlanTimeMapper, EduFaceGroupStrategyPlanTime> implements EduFaceGroupStrategyPlanTimeService {
|
||||
|
||||
|
||||
}
|
||||
-241
@@ -1,241 +0,0 @@
|
||||
package com.yida.data.user.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.attendance.feign.RemoteAttendanceStrategyService;
|
||||
import com.yida.data.common.core.entity.user.*;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.user.dto.*;
|
||||
import com.yida.data.user.mapper.EduFaceGroupStrategyMapper;
|
||||
import com.yida.data.user.service.*;
|
||||
import com.yida.data.user.vo.StrategyInfoVO;
|
||||
import com.yida.data.user.vo.StrategyPlanVO;
|
||||
import com.yida.data.user.vo.StrategySpecialDateVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 人脸组-策略Service实现
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-12 11:04:39
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class EduFaceGroupStrategyServiceImpl extends ServiceImpl
|
||||
<EduFaceGroupStrategyMapper, EduFaceGroupStrategy> implements EduFaceGroupStrategyService {
|
||||
|
||||
@Lazy
|
||||
@Resource
|
||||
private EduFaceGroupUserService eduFaceGroupUserService;
|
||||
|
||||
private final EduFaceGroupDeviceService eduFaceGroupDeviceService;
|
||||
private final EduFaceGroupStrategyPlanService eduFaceGroupStrategyPlanService;
|
||||
private final EduFaceGroupStrategyPlanTimeService eduFaceGroupStrategyPlanTimeService;
|
||||
private final EduFaceGroupStrategySpecialDateService eduFaceGroupStrategySpecialDateService;
|
||||
private final EduFaceGroupStrategySpecialTimeService eduFaceGroupStrategySpecialTimeService;
|
||||
|
||||
private final RemoteAttendanceStrategyService remoteAttendanceStrategyService;
|
||||
|
||||
@Override
|
||||
public StrategyInfoVO getStrategyInfo(Long faceGroupId) {
|
||||
EduFaceGroupStrategy groupStrategy = getOne(Wrappers.lambdaQuery(new EduFaceGroupStrategy())
|
||||
.eq(EduFaceGroupStrategy::getFaceGroupId, faceGroupId));
|
||||
// 返回数据
|
||||
StrategyInfoVO strategyInfoVO = new StrategyInfoVO();
|
||||
if (Objects.nonNull(groupStrategy)) {
|
||||
BeanUtils.copyProperties(groupStrategy, strategyInfoVO);
|
||||
strategyInfoVO.setStrategyId(groupStrategy.getId());
|
||||
// 查询人脸组-策略-通行计划
|
||||
List<StrategyPlanVO> planList = eduFaceGroupStrategyPlanService.listStrategyPlan(groupStrategy.getId());
|
||||
strategyInfoVO.setPlanList(planList);
|
||||
// 查询特殊日期
|
||||
List<StrategySpecialDateVO> specialDateList = eduFaceGroupStrategySpecialDateService.listStrategySpecialDate(groupStrategy.getId());
|
||||
strategyInfoVO.setSpecialList(specialDateList);
|
||||
// 处理周一到周日的唯一编码
|
||||
if (Objects.nonNull(groupStrategy.getMondayPlanId())) {
|
||||
// 周一
|
||||
strategyInfoVO.setMondayUniqueCode(
|
||||
eduFaceGroupStrategyPlanService.getById(groupStrategy.getMondayPlanId()).getUniqueCode());
|
||||
}
|
||||
if (Objects.nonNull(groupStrategy.getTuesdayPlanId())) {
|
||||
// 周二
|
||||
strategyInfoVO.setTuesdayUniqueCode(
|
||||
eduFaceGroupStrategyPlanService.getById(groupStrategy.getTuesdayPlanId()).getUniqueCode());
|
||||
}
|
||||
if (Objects.nonNull(groupStrategy.getWednesdayPlanId())) {
|
||||
// 周三
|
||||
strategyInfoVO.setWednesdayUniqueCode(
|
||||
eduFaceGroupStrategyPlanService.getById(groupStrategy.getWednesdayPlanId()).getUniqueCode());
|
||||
}
|
||||
if (Objects.nonNull(groupStrategy.getThursdayPlanId())) {
|
||||
// 周四
|
||||
strategyInfoVO.setThursdayUniqueCode(
|
||||
eduFaceGroupStrategyPlanService.getById(groupStrategy.getThursdayPlanId()).getUniqueCode());
|
||||
}
|
||||
if (Objects.nonNull(groupStrategy.getFridayPlanId())) {
|
||||
// 周五
|
||||
strategyInfoVO.setFridayUniqueCode(
|
||||
eduFaceGroupStrategyPlanService.getById(groupStrategy.getFridayPlanId()).getUniqueCode());
|
||||
}
|
||||
if (Objects.nonNull(groupStrategy.getSaturdayPlanId())) {
|
||||
// 周六
|
||||
strategyInfoVO.setSaturdayUniqueCode(
|
||||
eduFaceGroupStrategyPlanService.getById(groupStrategy.getSaturdayPlanId()).getUniqueCode());
|
||||
}
|
||||
if (Objects.nonNull(groupStrategy.getSundayPlanId())) {
|
||||
// 周日
|
||||
strategyInfoVO.setSundayUniqueCode(
|
||||
eduFaceGroupStrategyPlanService.getById(groupStrategy.getSundayPlanId()).getUniqueCode());
|
||||
}
|
||||
}
|
||||
return strategyInfoVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveStrategyInfo(StrategySaveDTO strategySaveDTO) {
|
||||
// 查询关联的设备信息
|
||||
List<EduFaceGroupDevice> list = eduFaceGroupDeviceService.list(
|
||||
Wrappers.lambdaQuery(new EduFaceGroupDevice()).eq(EduFaceGroupDevice::getFaceGroupId, strategySaveDTO.getFaceGroupId()));
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
throw new FebsException("请关联对应的设备信息");
|
||||
}
|
||||
|
||||
EduFaceGroupStrategy groupStrategy = new EduFaceGroupStrategy();
|
||||
BeanUtils.copyProperties(strategySaveDTO, groupStrategy);
|
||||
groupStrategy.setId(strategySaveDTO.getStrategyId());
|
||||
|
||||
if (Objects.isNull(strategySaveDTO.getStrategyId())) {
|
||||
// 新增
|
||||
} else {
|
||||
// 编辑, 需要删除对应的附表数据
|
||||
eduFaceGroupStrategyPlanService.remove(Wrappers.lambdaQuery(new EduFaceGroupStrategyPlan())
|
||||
.eq(EduFaceGroupStrategyPlan::getFaceGroupStrategyId, strategySaveDTO.getStrategyId()));
|
||||
eduFaceGroupStrategyPlanTimeService.remove(Wrappers.lambdaQuery(new EduFaceGroupStrategyPlanTime())
|
||||
.eq(EduFaceGroupStrategyPlanTime::getFaceGroupStrategyId, strategySaveDTO.getStrategyId()));
|
||||
|
||||
eduFaceGroupStrategySpecialDateService.remove(Wrappers.lambdaQuery(new EduFaceGroupStrategySpecialDate())
|
||||
.eq(EduFaceGroupStrategySpecialDate::getFaceGroupStrategyId, strategySaveDTO.getStrategyId()));
|
||||
eduFaceGroupStrategySpecialTimeService.remove(Wrappers.lambdaQuery(new EduFaceGroupStrategySpecialTime())
|
||||
.eq(EduFaceGroupStrategySpecialTime::getFaceGroupStrategyId, strategySaveDTO.getStrategyId()));
|
||||
}
|
||||
saveOrUpdate(groupStrategy);
|
||||
|
||||
if (CollUtil.isNotEmpty(strategySaveDTO.getPlanList())) {
|
||||
// 处理通行计划
|
||||
for (StrategyPlanSaveDTO planDTO : strategySaveDTO.getPlanList()) {
|
||||
EduFaceGroupStrategyPlan strategyPlan = new EduFaceGroupStrategyPlan();
|
||||
strategyPlan.setFaceGroupId(strategySaveDTO.getFaceGroupId());
|
||||
strategyPlan.setFaceGroupStrategyId(groupStrategy.getId());
|
||||
strategyPlan.setUniqueCode(planDTO.getUniqueCode());
|
||||
eduFaceGroupStrategyPlanService.save(strategyPlan);
|
||||
|
||||
List<EduFaceGroupStrategyPlanTime> planTimeList = new ArrayList<>();
|
||||
// 处理时间
|
||||
for (StrategyPlanTimeSaveDTO timeDTO : planDTO.getPlanTimeList()) {
|
||||
EduFaceGroupStrategyPlanTime strategyPlanTime = new EduFaceGroupStrategyPlanTime();
|
||||
strategyPlanTime.setFaceGroupId(strategySaveDTO.getFaceGroupId());
|
||||
strategyPlanTime.setFaceGroupStrategyId(groupStrategy.getId());
|
||||
strategyPlanTime.setFaceGroupStrategyPlanId(strategyPlan.getId());
|
||||
strategyPlanTime.setPlanStartTime(timeDTO.getPlanStartTime());
|
||||
strategyPlanTime.setPlanEndTime(timeDTO.getPlanEndTime());
|
||||
planTimeList.add(strategyPlanTime);
|
||||
|
||||
eduFaceGroupStrategyPlanTimeService.save(strategyPlanTime);
|
||||
}
|
||||
|
||||
// 处理一周的通行计划
|
||||
if (strategyPlan.getUniqueCode().equals(strategySaveDTO.getMondayUniqueCode())) {
|
||||
// 周一
|
||||
groupStrategy.setMondayPlanId(strategyPlan.getId());
|
||||
groupStrategy.setMondayTimeList(planTimeList);
|
||||
}
|
||||
if (strategyPlan.getUniqueCode().equals(strategySaveDTO.getTuesdayUniqueCode())) {
|
||||
// 周二
|
||||
groupStrategy.setTuesdayPlanId(strategyPlan.getId());
|
||||
groupStrategy.setTuesdayTimeList(planTimeList);
|
||||
}
|
||||
if (strategyPlan.getUniqueCode().equals(strategySaveDTO.getWednesdayUniqueCode())) {
|
||||
// 周三
|
||||
groupStrategy.setWednesdayPlanId(strategyPlan.getId());
|
||||
groupStrategy.setWednesdayTimeList(planTimeList);
|
||||
}
|
||||
if (strategyPlan.getUniqueCode().equals(strategySaveDTO.getThursdayUniqueCode())) {
|
||||
// 周四
|
||||
groupStrategy.setThursdayPlanId(strategyPlan.getId());
|
||||
groupStrategy.setThursdayTimeList(planTimeList);
|
||||
}
|
||||
if (strategyPlan.getUniqueCode().equals(strategySaveDTO.getFridayUniqueCode())) {
|
||||
// 周五
|
||||
groupStrategy.setFridayPlanId(strategyPlan.getId());
|
||||
groupStrategy.setFridayTimeList(planTimeList);
|
||||
}
|
||||
if (strategyPlan.getUniqueCode().equals(strategySaveDTO.getSaturdayUniqueCode())) {
|
||||
// 周六
|
||||
groupStrategy.setSaturdayPlanId(strategyPlan.getId());
|
||||
groupStrategy.setSaturdayTimeList(planTimeList);
|
||||
}
|
||||
if (strategyPlan.getUniqueCode().equals(strategySaveDTO.getSundayUniqueCode())) {
|
||||
// 周日
|
||||
groupStrategy.setSundayPlanId(strategyPlan.getId());
|
||||
groupStrategy.setSundayTimeList(planTimeList);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<EduFaceGroupStrategySpecialDate> specialDateList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(strategySaveDTO.getSpecialList())) {
|
||||
// 处理特殊日期
|
||||
for (StrategySpecialDateSaveDTO specialDateSaveDTO : strategySaveDTO.getSpecialList()) {
|
||||
if (Objects.isNull(specialDateSaveDTO.getSpecialStartDate())) {
|
||||
continue;
|
||||
}
|
||||
EduFaceGroupStrategySpecialDate specialDate = new EduFaceGroupStrategySpecialDate();
|
||||
specialDate.setFaceGroupId(strategySaveDTO.getFaceGroupId());
|
||||
specialDate.setFaceGroupStrategyId(groupStrategy.getId());
|
||||
specialDate.setSpecialStartDate(specialDateSaveDTO.getSpecialStartDate());
|
||||
specialDate.setSpecialEndDate(specialDateSaveDTO.getSpecialEndDate());
|
||||
eduFaceGroupStrategySpecialDateService.save(specialDate);
|
||||
// 处理特殊日期时间
|
||||
List<EduFaceGroupStrategySpecialTime> specialTimeList = new ArrayList<>();
|
||||
for (StrategySpecialTimeSaveDTO specialTimeSaveDTO : specialDateSaveDTO.getSpecialTimeList()) {
|
||||
EduFaceGroupStrategySpecialTime specialTime = new EduFaceGroupStrategySpecialTime();
|
||||
specialTime.setFaceGroupId(strategySaveDTO.getFaceGroupId());
|
||||
specialTime.setFaceGroupStrategyId(groupStrategy.getId());
|
||||
specialTime.setFaceGroupStrategySpecialDateId(specialDate.getId());
|
||||
specialTime.setSpecialStartTime(specialTimeSaveDTO.getSpecialStartTime());
|
||||
specialTime.setSpecialEndTime(specialTimeSaveDTO.getSpecialEndTime());
|
||||
eduFaceGroupStrategySpecialTimeService.save(specialTime);
|
||||
specialTimeList.add(specialTime);
|
||||
}
|
||||
specialDate.setSpecialTimeList(specialTimeList);
|
||||
specialDateList.add(specialDate);
|
||||
}
|
||||
}
|
||||
groupStrategy.setSpecialDateList(specialDateList);
|
||||
// 处理一周的通行计划
|
||||
baseMapper.updateWeekPlan(groupStrategy);
|
||||
// 设置设备信息
|
||||
groupStrategy.setGroupDeviceList(list);
|
||||
// 设置人员信息
|
||||
List<EduFaceGroupUser> groupUserList = eduFaceGroupUserService.list(Wrappers.lambdaQuery(new EduFaceGroupUser())
|
||||
.eq(EduFaceGroupUser::getFaceGroupId, groupStrategy.getFaceGroupId())
|
||||
// 查询已下发人脸
|
||||
.eq(EduFaceGroupUser::getStatus, 1)
|
||||
);
|
||||
groupStrategy.setGroupUserList(groupUserList);
|
||||
// 保存策略并绑定人员信息
|
||||
remoteAttendanceStrategyService.saveStrategyAndUser(groupStrategy);
|
||||
}
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.yida.data.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategySpecialDate;
|
||||
import com.yida.data.user.mapper.EduFaceGroupStrategySpecialDateMapper;
|
||||
import com.yida.data.user.service.EduFaceGroupStrategySpecialDateService;
|
||||
import com.yida.data.user.vo.StrategySpecialDateVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-特殊日期Service实现
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-26 13:57:32
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class EduFaceGroupStrategySpecialDateServiceImpl extends ServiceImpl
|
||||
<EduFaceGroupStrategySpecialDateMapper, EduFaceGroupStrategySpecialDate> implements EduFaceGroupStrategySpecialDateService {
|
||||
|
||||
@Override
|
||||
public List<StrategySpecialDateVO> listStrategySpecialDate(Long strategyId) {
|
||||
return baseMapper.listStrategySpecialDate(strategyId);
|
||||
}
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package com.yida.data.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.common.core.entity.user.EduFaceGroupStrategySpecialTime;
|
||||
import com.yida.data.user.mapper.EduFaceGroupStrategySpecialTimeMapper;
|
||||
import com.yida.data.user.service.EduFaceGroupStrategySpecialTimeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 人脸组-策略-特殊日期-时间Service实现
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022-12-26 13:57:32
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class EduFaceGroupStrategySpecialTimeServiceImpl extends ServiceImpl
|
||||
<EduFaceGroupStrategySpecialTimeMapper, EduFaceGroupStrategySpecialTime> implements EduFaceGroupStrategySpecialTimeService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
package com.yida.data.user.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.enums.RoleEnum;
|
||||
import com.yida.data.common.core.entity.user.EduParent;
|
||||
import com.yida.data.common.core.entity.user.EduStudent;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApplyFor;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.system.feign.RemoteDeptService;
|
||||
import com.yida.data.user.dto.ListStudentApplyForDTO;
|
||||
import com.yida.data.user.mapper.EduStudentApplyForMapper;
|
||||
import com.yida.data.user.service.EduStudentApplyForService;
|
||||
import com.yida.data.user.service.EduStudentService;
|
||||
import com.yida.data.user.service.EduUserDeptService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EduStudentApplyServiceForImpl extends ServiceImpl<EduStudentApplyForMapper, EduStudentApplyFor> implements
|
||||
EduStudentApplyForService {
|
||||
|
||||
private final CommonService commonService;
|
||||
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
|
||||
private final EduUserDeptService eduUserDeptService;
|
||||
|
||||
|
||||
private final EduStudentService eduStudentService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询学生会员申请记录
|
||||
*
|
||||
* @param dto
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<EduStudentApplyFor> listStudentApplyFor(ListStudentApplyForDTO dto, Page<EduStudentApplyFor> page) {
|
||||
List<Long> schoolIds = new ArrayList<>();
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
if (currentUser.getRolePerms().contains(RoleEnum.ROLE_SCHOOL_PRINCIPAL.getValue())) {
|
||||
schoolIds = Collections.singletonList(currentUser.getDeptId());
|
||||
} else {
|
||||
schoolIds = remoteDeptService.getSchoolByArea(null, null).getData().stream().map(Dept::getDeptId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
dto.setSchoolIdList(schoolIds);
|
||||
return this.baseMapper.listStudentApplyFor(dto, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存会员申请
|
||||
*
|
||||
* @param eduStudentApplyFor
|
||||
*/
|
||||
@Override
|
||||
public void saveStudentApplyFor(EduStudentApplyFor eduStudentApplyFor) {
|
||||
//判断是否已申请
|
||||
EduStudentApplyFor applyFor = getOne(
|
||||
Wrappers.lambdaQuery(new EduStudentApplyFor()).eq(EduStudentApplyFor::getApplyCode, eduStudentApplyFor.getApplyCode())
|
||||
.eq(EduStudentApplyFor::getStudentId, eduStudentApplyFor.getStudentId())
|
||||
.eq(EduStudentApplyFor::getStatus, 0));
|
||||
if (ObjectUtil.isNotNull(applyFor)) {
|
||||
throw new FebsException("用户已申请,请等待管理联系处理!");
|
||||
}
|
||||
eduStudentApplyFor.setApplyName(
|
||||
commonService.getDictByTypeAndValueOrLabel("apply_type", eduStudentApplyFor.getApplyCode(), null).getLabel());
|
||||
EduStudent student = eduStudentService.getStudent(eduStudentApplyFor.getStudentId());
|
||||
log.info("学生信息:【{}】", student);
|
||||
eduStudentApplyFor.setStudentName(student.getStuName());
|
||||
eduStudentApplyFor.setStudentNumber(student.getStuNumber());
|
||||
eduStudentApplyFor.setStudentMobile(
|
||||
StringUtils.join(student.getParents().stream().map(EduParent::getMobile).collect(Collectors.toList()), ","));
|
||||
eduStudentApplyFor.setSchoolName(remoteDeptService.getInfoById(student.getSchoolId()).getData().getDeptName());
|
||||
eduStudentApplyFor.setSchoolId(student.getSchoolId());
|
||||
eduStudentApplyFor.setCampusId(student.getCampusId());
|
||||
eduStudentApplyFor.setCampusName(student.getCampusName());
|
||||
eduStudentApplyFor.setSectionId(student.getSectionId());
|
||||
eduStudentApplyFor.setSectionName(student.getSectionName());
|
||||
eduStudentApplyFor.setGradeId(student.getGradeId());
|
||||
eduStudentApplyFor.setGradeName(student.getGradeName());
|
||||
eduStudentApplyFor.setClassId(student.getClassId());
|
||||
eduStudentApplyFor.setClassName(student.getClassName());
|
||||
this.save(eduStudentApplyFor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理会员申请
|
||||
*
|
||||
* @param id
|
||||
* @param status
|
||||
*/
|
||||
@Override
|
||||
public void dealApplyFor(Long id, Integer status) {
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
|
||||
update(Wrappers.lambdaUpdate(new EduStudentApplyFor()).eq(EduStudentApplyFor::getId, id)
|
||||
.set(EduStudentApplyFor::getStatus, status)
|
||||
.set(EduStudentApplyFor::getDealStaffId, currentUser.getUserId())
|
||||
.set(EduStudentApplyFor::getDealStaffName, currentUser.getUsername()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用编码,用户ID,查询申请详情
|
||||
*
|
||||
* @param studentId
|
||||
* @param appCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public EduStudentApplyFor getByStudentId(Long studentId, String appCode) {
|
||||
return getOne(
|
||||
Wrappers.lambdaQuery(new EduStudentApplyFor()).eq(EduStudentApplyFor::getApplyCode, appCode)
|
||||
.eq(EduStudentApplyFor::getStudentId, studentId)
|
||||
.eq(EduStudentApplyFor::getStatus, 0));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-426
@@ -1,426 +0,0 @@
|
||||
package com.yida.data.user.service.impl;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yida.data.attendance.dto.IssuedFaceDTO;
|
||||
import com.yida.data.attendance.feign.RemoteAttendanceDeviceService;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.common.core.entity.Dict;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.system.Dept;
|
||||
import com.yida.data.common.core.entity.system.enums.RoleEnum;
|
||||
import com.yida.data.common.core.entity.user.EduStudent;
|
||||
import com.yida.data.common.core.entity.user.EduStudentApply;
|
||||
import com.yida.data.common.core.entity.user.EduUserDept;
|
||||
import com.yida.data.common.core.entity.user.EduUserDevice;
|
||||
import com.yida.data.common.core.entity.user.EduUserFace;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.common.core.utils.FileUtil;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.school.dto.transaction.ListApplyFunctionDTO;
|
||||
import com.yida.data.system.feign.RemoteDeptService;
|
||||
import com.yida.data.user.dto.ListStudentApplyDTO;
|
||||
import com.yida.data.user.dto.ListStudentDTO;
|
||||
import com.yida.data.user.feign.RemoteStudentService;
|
||||
import com.yida.data.user.listener.importStudentApplyListener;
|
||||
import com.yida.data.user.mapper.EduStudentApplyMapper;
|
||||
import com.yida.data.user.mapper.EduUserDeviceMapper;
|
||||
import com.yida.data.user.service.EduStudentApplyService;
|
||||
import com.yida.data.user.service.EduStudentService;
|
||||
import com.yida.data.user.service.EduUserDeptService;
|
||||
import com.yida.data.user.service.EduUserFaceService;
|
||||
import com.yida.data.user.vo.StudentApplyImportErrorVO;
|
||||
import com.yida.data.user.vo.StudentApplyImportProgressVO;
|
||||
import com.yida.data.user.vo.StudentApplyImportVO;
|
||||
import com.yida.data.user.vo.StudentApplyStatusVO;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EduStudentApplyServiceImpl extends ServiceImpl<EduStudentApplyMapper, EduStudentApply> implements
|
||||
EduStudentApplyService {
|
||||
|
||||
private final CommonService commonService;
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
private final RemoteStudentService remoteStudentService;
|
||||
|
||||
private final RemoteDeptService remoteDeptService;
|
||||
|
||||
private final EduUserDeptService eduUserDeptService;
|
||||
|
||||
private final EduStudentService eduStudentService;
|
||||
|
||||
private final EduUserFaceService eduUserFaceService;
|
||||
|
||||
private final EduUserDeviceMapper eduUserDeviceMapper;
|
||||
|
||||
private final RemoteAttendanceDeviceService remoteAttendanceDeviceService;
|
||||
|
||||
@Value("${febs.uploadUrl}")
|
||||
private String uploadUrl;
|
||||
|
||||
@Override
|
||||
public StudentApplyStatusVO getStudentApplyStatus(Long studentId, String applyCode) {
|
||||
StudentApplyStatusVO applyStatus = new StudentApplyStatusVO();
|
||||
List<EduStudentApply> list = list(Wrappers.lambdaQuery(new EduStudentApply()).eq(EduStudentApply::getStudentId,
|
||||
studentId)
|
||||
.eq(EduStudentApply::getApplyCode, applyCode)
|
||||
.ge(EduStudentApply::getEndTime, LocalDateTime.now())
|
||||
.le(EduStudentApply::getStartTime, LocalDateTime.now()));
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
List<EduStudentApply> applyList = baseMapper.getStudentApplyStatus(studentId, applyCode);
|
||||
if (CollUtil.isNotEmpty(applyList)) {
|
||||
applyStatus.setStatus(2);
|
||||
applyStatus.setDeadLine(applyList.get(0).getEndTime().toLocalDate().plusDays(1L));
|
||||
} else {
|
||||
applyStatus.setStatus(0);
|
||||
}
|
||||
} else {
|
||||
applyStatus.setStatus(1);
|
||||
}
|
||||
return applyStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<EduStudentApply> listStudentApply(ListStudentApplyDTO dto, Page<EduStudentApply> page) {
|
||||
List<Long> schoolIds = new ArrayList<>();
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
if (currentUser.getRolePerms().contains(RoleEnum.ROLE_SCHOOL_PRINCIPAL.getValue())) {
|
||||
schoolIds = Collections.singletonList(currentUser.getDeptId());
|
||||
} else {
|
||||
schoolIds = remoteDeptService.getSchoolByArea(null, null).getData().stream().map(Dept::getDeptId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
dto.setSchoolIdList(schoolIds);
|
||||
IPage<EduStudentApply> eduStudentApplyIPage = this.baseMapper.listStudentApply(dto, page);
|
||||
return eduStudentApplyIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveStudentApply(EduStudentApply eduStudentApply) {
|
||||
eduStudentApply.setApplyName(
|
||||
commonService.getDictByTypeAndValueOrLabel("apply_type", eduStudentApply.getApplyCode(), null).getLabel());
|
||||
eduStudentApply.setStudentName(eduStudentService.getById(eduStudentApply.getStudentId()).getStuName());
|
||||
eduStudentApply.setStudentNumber(eduStudentService.getById(eduStudentApply.getStudentId()).getStuNumber());
|
||||
eduStudentApply.setSchoolName(commonService.getDept(eduStudentApply.getSchoolId()).getDeptName());
|
||||
eduStudentApply.setCampusName(eduUserDeptService.getById(eduStudentApply.getCampusId()).getDeptName());
|
||||
eduStudentApply.setSectionName(eduUserDeptService.getById(eduStudentApply.getSectionId()).getDeptName());
|
||||
eduStudentApply.setGradeName(eduUserDeptService.getById(eduStudentApply.getGradeId()).getDeptName());
|
||||
eduStudentApply.setClassName(eduUserDeptService.getById(eduStudentApply.getClassId()).getDeptName());
|
||||
this.save(eduStudentApply);
|
||||
|
||||
//编辑再次下发人脸
|
||||
UpdateUserToHaiQing(eduStudentApply);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新面板机会员
|
||||
*
|
||||
* @param eduStudentApply
|
||||
*/
|
||||
public void UpdateUserToHaiQing(EduStudentApply eduStudentApply) {
|
||||
EduUserFace userFace = eduUserFaceService.getOne(
|
||||
Wrappers.lambdaQuery(new EduUserFace()).eq(EduUserFace::getUserId, eduStudentApply.getStudentId())
|
||||
.eq(EduUserFace::getUserType, 0));
|
||||
if (userFace == null) {
|
||||
userFace = new EduUserFace();
|
||||
userFace.setUserId(eduStudentApply.getStudentId());
|
||||
userFace.setName(eduStudentApply.getStudentName());
|
||||
userFace.setUserType(0);
|
||||
|
||||
EduStudent student = (EduStudent) redisService.hget(CachePrefixConstant.STUDENT_DATA,
|
||||
eduStudentApply.getStudentId().toString());
|
||||
if (student == null) {
|
||||
student = eduStudentService.getStudent(eduStudentApply.getStudentId());
|
||||
}
|
||||
if (ObjectUtil.isNull(student) || ObjectUtil.isNull(student.getAvatar())) {
|
||||
log.info("无匹配学生信息或者导入学生信息无头像,无法下发 === {}", student.getId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
userFace.setNotes(1);
|
||||
userFace.setCardValidBegin(eduStudentApply.getStartTime().toString());
|
||||
userFace.setCardValidEnd(eduStudentApply.getEndTime().toString());
|
||||
eduUserFaceService.saveOrUpdate(userFace);
|
||||
//用户原来存在的设备
|
||||
List<EduUserDevice> userDeviceList = eduUserDeviceMapper.selectList(
|
||||
Wrappers.lambdaQuery(new EduUserDevice()).eq(EduUserDevice::getUserId, eduStudentApply.getStudentId())
|
||||
.eq(EduUserDevice::getUserType, 0));
|
||||
if (CollUtil.isNotEmpty(userDeviceList)) {
|
||||
// 用户已经被下发到设备,更新设备上的图像
|
||||
Map<Long, List<EduUserDevice>> userDeviceMap = userDeviceList.stream().collect(
|
||||
Collectors.groupingBy(EduUserDevice::getFaceGroupId));
|
||||
for (Map.Entry<Long, List<EduUserDevice>> entry : userDeviceMap.entrySet()) {
|
||||
Long faceGroupId = entry.getKey();
|
||||
List<EduUserDevice> eduUserDevices = entry.getValue();
|
||||
// 设备id
|
||||
List<Long> deviceIds = eduUserDevices.stream().map(EduUserDevice::getDeviceId).distinct()
|
||||
.collect(Collectors.toList());
|
||||
IssuedFaceDTO dto = new IssuedFaceDTO();
|
||||
dto.setDeviceList(deviceIds);
|
||||
dto.setGroupId(faceGroupId);
|
||||
dto.setUserFaceList(Collections.singletonList(userFace));
|
||||
remoteAttendanceDeviceService.issuedFace(dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadTemplate(HttpServletResponse response) throws Exception {
|
||||
|
||||
String fileName = "学生开通应用导入模板.xls";
|
||||
// 获取导入文件模板
|
||||
ClassPathResource classPathResource = new ClassPathResource("template/" + fileName);
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
FileUtil.download(FileUtil.inputStreamToFile(inputStream), fileName, false, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importStudentApplyInfo(MultipartFile file, String redisKey) throws IOException {
|
||||
log.info("开始导入学生开通应用数据");
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
EasyExcel.read(file.getInputStream(), StudentApplyImportVO.class,
|
||||
new importStudentApplyListener(this, redisKey))
|
||||
.sheet(0).headRowNumber(1).doRead();
|
||||
stopWatch.stop();
|
||||
log.info("导入学生开通应用数据总共耗时: {}", stopWatch.getTotalTimeSeconds() + "秒");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertStudentApplyData(List<StudentApplyImportVO> studentApplyImportVOList, String redisKey) {
|
||||
StudentApplyImportProgressVO progressVO = new StudentApplyImportProgressVO();
|
||||
progressVO.setFinish(0);
|
||||
progressVO.setTotalNum(studentApplyImportVOList.size());
|
||||
progressVO.setCurrentNum(0);
|
||||
progressVO.setRedisKey(redisKey);
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey, progressVO);
|
||||
|
||||
List<StudentApplyImportErrorVO> errorVOList = new ArrayList<>();
|
||||
List<EduStudentApply> saveData = new ArrayList<>();
|
||||
Integer index = 1;
|
||||
|
||||
for (StudentApplyImportVO studentApplyImportVO : studentApplyImportVOList) {
|
||||
index++;
|
||||
String baseMag = "第" + index + "行,";
|
||||
StudentApplyImportErrorVO studentApplyImportErrorVO = checkImportDataIsNull(index, studentApplyImportVO);
|
||||
if (studentApplyImportErrorVO != null) {
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
errorVOList.add(studentApplyImportErrorVO);
|
||||
continue;
|
||||
}
|
||||
Dept dept = commonService.getSchoolByName(studentApplyImportVO.getSchoolName());
|
||||
if (ObjectUtil.isNull(dept)) {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学校名称不匹配");
|
||||
errorVOList.add(errorVO);
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
continue;
|
||||
}
|
||||
// 根据学校ID、学号查询学生信息 检测学号与学生姓名是否匹配
|
||||
EduStudent student = new EduStudent();
|
||||
student.setSchoolId(dept.getDeptId());
|
||||
student.setStuNumber(studentApplyImportVO.getStudentNumber());
|
||||
List<EduStudent> currentStudentList = remoteStudentService.listBaseStudentNoJoin(student).getData();
|
||||
EduStudentApply eduStudentApply = new EduStudentApply();
|
||||
eduStudentApply.setCampusName(studentApplyImportVO.getCampusName());
|
||||
eduStudentApply.setSectionName(studentApplyImportVO.getSectionName());
|
||||
eduStudentApply.setGradeName(studentApplyImportVO.getGradeName());
|
||||
eduStudentApply.setClassName(studentApplyImportVO.getClassName());
|
||||
|
||||
eduStudentApply.setSchoolName(dept.getDeptName());
|
||||
eduStudentApply.setSchoolId(dept.getDeptId());
|
||||
|
||||
if (CollUtil.isEmpty(currentStudentList)) {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学生学号有误");
|
||||
errorVOList.add(errorVO);
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
continue;
|
||||
}
|
||||
eduStudentApply.setStudentNumber(currentStudentList.get(0).getStuNumber());
|
||||
if (!ObjectUtil.equal(studentApplyImportVO.getStudentName(), currentStudentList.get(0).getStuName())) {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学生姓名与学号不匹配");
|
||||
errorVOList.add(errorVO);
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
continue;
|
||||
}
|
||||
eduStudentApply.setStudentName(currentStudentList.get(0).getStuName());
|
||||
|
||||
EduUserDept campus = eduUserDeptService.getById(currentStudentList.get(0).getCampusId());
|
||||
if (campus.getDeptName().equals(studentApplyImportVO.getCampusName())) {
|
||||
eduStudentApply.setCampusId(currentStudentList.get(0).getCampusId());
|
||||
} else {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学区名称与学区名称不匹配");
|
||||
errorVOList.add(errorVO);
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
EduUserDept section = eduUserDeptService.getById(currentStudentList.get(0).getSectionId());
|
||||
if (section.getDeptName().equals(studentApplyImportVO.getSectionName())) {
|
||||
eduStudentApply.setSectionId(currentStudentList.get(0).getSectionId());
|
||||
} else {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学段名称与学段名称不匹配");
|
||||
errorVOList.add(errorVO);
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
EduUserDept grade = eduUserDeptService.getById(currentStudentList.get(0).getGradeId());
|
||||
if (grade.getDeptName().equals(studentApplyImportVO.getGradeName())) {
|
||||
eduStudentApply.setGradeId(currentStudentList.get(0).getGradeId());
|
||||
} else {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学生年级名称与年级名称不匹配");
|
||||
errorVOList.add(errorVO);
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
EduUserDept clazz = eduUserDeptService.getById(currentStudentList.get(0).getClassId());
|
||||
if (clazz.getDeptName().equals(studentApplyImportVO.getClassName())) {
|
||||
eduStudentApply.setClassId(currentStudentList.get(0).getClassId());
|
||||
} else {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "学生班级名称与班级名称不匹配");
|
||||
errorVOList.add(errorVO);
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
log.info("行数据:{}", studentApplyImportVO);
|
||||
Dict dict = commonService.getDictByTypeAndValueOrLabel("apply_type", null, studentApplyImportVO.getApplyName());
|
||||
log.info("获取字典信息:{}", dict);
|
||||
if (ObjectUtil.isNull(dict)) {
|
||||
StudentApplyImportErrorVO errorVO = new StudentApplyImportErrorVO();
|
||||
errorVO.setErrorMsg(baseMag + "无此应用");
|
||||
errorVOList.add(errorVO);
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
continue;
|
||||
} else {
|
||||
eduStudentApply.setApplyCode(dict.getValue());
|
||||
eduStudentApply.setApplyName(studentApplyImportVO.getApplyName());
|
||||
}
|
||||
eduStudentApply.setStudentId(currentStudentList.get(0).getId());
|
||||
String startTime = studentApplyImportVO.getStartTime();
|
||||
if (startTime.contains("/")) {
|
||||
startTime = startTime.replaceAll("/", "-");
|
||||
}
|
||||
|
||||
String endTime = studentApplyImportVO.getEndTime();
|
||||
if (endTime.contains("/")) {
|
||||
endTime = endTime.replaceAll("/", "-");
|
||||
}
|
||||
|
||||
eduStudentApply
|
||||
.setStartTime(LocalDateTimeUtil
|
||||
.parse(startTime + " 00:00:00", "yyyy-MM-dd HH:mm:ss"));
|
||||
eduStudentApply
|
||||
.setEndTime(LocalDateTimeUtil
|
||||
.parse(endTime + " 00:00:00", "yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
saveData.add(eduStudentApply);
|
||||
|
||||
progressVO.setCurrentNum(index - 1);
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey, progressVO);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(saveData)) {
|
||||
super.saveBatch(saveData);
|
||||
}
|
||||
|
||||
productErrorExcel(errorVOList, progressVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StudentApplyImportProgressVO getImportStudentApplyInfoProgress(String redisKey) {
|
||||
return (StudentApplyImportProgressVO) redisService
|
||||
.hget(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, redisKey);
|
||||
}
|
||||
|
||||
|
||||
public void productErrorExcel(List<StudentApplyImportErrorVO> errorVOList, StudentApplyImportProgressVO progressVO) {
|
||||
// 错误信息文件名称
|
||||
if (CollUtil.isNotEmpty(errorVOList)) {
|
||||
String fileName = FileUtil.getLocalUploadAddress() + UUID.randomUUID().toString() + ".xlsx";
|
||||
EasyExcel.write(fileName, StudentApplyImportErrorVO.class)
|
||||
.sheet("错误信息")
|
||||
.doWrite(errorVOList);
|
||||
// 上传到媒资
|
||||
String url = FileUtil.uploadFileToMediaServer(uploadUrl, new File(fileName));
|
||||
progressVO.setErrorPageUrl(url);
|
||||
}
|
||||
progressVO.setFinish(1);
|
||||
redisService.hset(CachePrefixConstant.IMPORT_STUDENT_APPLY_PROGRESS, progressVO.getRedisKey(), progressVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测插入数据是否为空
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public StudentApplyImportErrorVO checkImportDataIsNull(Integer index, StudentApplyImportVO studentApplyImportVO) {
|
||||
StudentApplyImportErrorVO studentApplyImportErrorVO = null;
|
||||
String baseMag = "第" + index + "行,";
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getSchoolName())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "学校名称为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getStudentName())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "学生姓名为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getStudentNumber())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "学生学号为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getApplyName())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "开通应用为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getStartTime())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "有效开始时间为空");
|
||||
}
|
||||
if (ObjectUtil.isNull(studentApplyImportVO.getStartTime())) {
|
||||
studentApplyImportErrorVO = new StudentApplyImportErrorVO();
|
||||
studentApplyImportErrorVO.setErrorMsg(baseMag + "有效结束时间为空");
|
||||
}
|
||||
return studentApplyImportErrorVO;
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yida.data.user.mapper.EduFaceGroupStrategyMapper">
|
||||
|
||||
<!-- 处理一周的通行计划 -->
|
||||
<update id="updateWeekPlan" parameterType="com.yida.data.common.core.entity.user.EduFaceGroupStrategy">
|
||||
update edu_face_group_strategy
|
||||
set monday_plan_id = #{mondayPlanId},
|
||||
tuesday_plan_id = #{tuesdayPlanId},
|
||||
wednesday_plan_id = #{wednesdayPlanId},
|
||||
thursday_plan_id = #{thursdayPlanId},
|
||||
friday_plan_id = #{fridayPlanId},
|
||||
saturday_plan_id = #{saturdayPlanId},
|
||||
sunday_plan_id = #{sundayPlanId}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yida.data.user.mapper.EduFaceGroupStrategyPlanMapper">
|
||||
|
||||
<resultMap id="planMap" type="com.yida.data.user.vo.StrategyPlanVO">
|
||||
<id column="id" property="planId"/>
|
||||
<result column="face_group_id" property="faceGroupId"/>
|
||||
<result column="face_group_strategy_id" property="faceGroupStrategyId"/>
|
||||
<result column="unique_code" property="uniqueCode"/>
|
||||
|
||||
<collection property="planTimeList" ofType="com.yida.data.user.vo.StrategyPlanTimeVO"
|
||||
select="listStrategyPlanTime"
|
||||
column="{planId=id}">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询人脸组-策略-通行计划 -->
|
||||
<select id="listStrategyPlan" resultMap="planMap">
|
||||
SELECT
|
||||
id,
|
||||
face_group_id,
|
||||
face_group_strategy_id,
|
||||
unique_code
|
||||
FROM
|
||||
edu_face_group_strategy_plan
|
||||
WHERE
|
||||
face_group_strategy_id = #{strategyId}
|
||||
AND del_flag = 0
|
||||
</select>
|
||||
|
||||
<!-- 查询人脸组-策略-通行计划-时间段 -->
|
||||
<select id="listStrategyPlanTime" resultType="com.yida.data.user.vo.StrategyPlanTimeVO">
|
||||
SELECT
|
||||
face_group_id,
|
||||
face_group_strategy_id,
|
||||
face_group_strategy_plan_id,
|
||||
plan_start_time,
|
||||
plan_end_time
|
||||
FROM
|
||||
edu_face_group_strategy_plan_time
|
||||
WHERE
|
||||
face_group_strategy_plan_id = #{planId}
|
||||
AND del_flag = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yida.data.user.mapper.EduFaceGroupStrategyPlanTimeMapper">
|
||||
|
||||
</mapper>
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yida.data.user.mapper.EduFaceGroupStrategySpecialDateMapper">
|
||||
|
||||
<resultMap id="specialMap" type="com.yida.data.user.vo.StrategySpecialDateVO">
|
||||
<id column="id" property="specialId"/>
|
||||
<result column="face_group_id" property="faceGroupId"/>
|
||||
<result column="face_group_strategy_id" property="faceGroupStrategyId"/>
|
||||
<result column="special_start_date" property="specialStartDate"/>
|
||||
<result column="special_end_date" property="specialEndDate"/>
|
||||
|
||||
<collection property="specialTimeList" ofType="com.yida.data.user.vo.StrategySpecialTimeVO"
|
||||
select="listStrategySpecialTime"
|
||||
column="{specialDateId=id}">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询特殊日期 -->
|
||||
<select id="listStrategySpecialDate" resultMap="specialMap">
|
||||
SELECT
|
||||
id,
|
||||
face_group_id,
|
||||
face_group_strategy_id,
|
||||
special_start_date,
|
||||
special_end_date
|
||||
FROM
|
||||
edu_face_group_strategy_special_date
|
||||
WHERE
|
||||
face_group_strategy_id = #{strategyId}
|
||||
AND del_flag = 0
|
||||
</select>
|
||||
|
||||
<!-- 查询特殊时间 -->
|
||||
<select id="listStrategySpecialTime" resultType="com.yida.data.user.vo.StrategySpecialTimeVO">
|
||||
SELECT
|
||||
special_start_time,
|
||||
special_end_time
|
||||
FROM
|
||||
edu_face_group_strategy_special_time
|
||||
WHERE
|
||||
face_group_strategy_special_date_id = #{specialDateId}
|
||||
AND del_flag = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yida.data.user.mapper.EduFaceGroupStrategySpecialTimeMapper">
|
||||
|
||||
</mapper>
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.yida.data.user.mapper.EduStudentApplyForMapper">
|
||||
|
||||
<select id="listStudentApplyFor" resultType="com.yida.data.common.core.entity.user.EduStudentApplyFor">
|
||||
SELECT * from edu_student_apply_for
|
||||
WHERE del_flag = 0
|
||||
<if test="dto.studentName!=null and dto.studentName!=''">
|
||||
and student_name LIKE CONCAT('%',#{dto.studentName},'%')
|
||||
</if>
|
||||
<if test="dto.studentNumber!=null and dto.studentNumber!=''">
|
||||
and student_number LIKE CONCAT('%',#{dto.studentNumber},'%')
|
||||
</if>
|
||||
<if test="dto.schoolIdList != null and dto.schoolIdList.size() > 0">
|
||||
and school_id in
|
||||
<foreach collection="dto.schoolIdList" close=")" open="(" separator="," item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.sectionId!=null">
|
||||
and section_id =#{dto.sectionId}
|
||||
</if>
|
||||
<if test="dto.campusId!=null">
|
||||
and campus_id =#{dto.campusId}
|
||||
</if>
|
||||
<if test="dto.gradeId!=null">
|
||||
and grade_id =#{dto.gradeId}
|
||||
</if>
|
||||
<if test="dto.classId!=null">
|
||||
and class_id =#{dto.classId}
|
||||
</if>
|
||||
order by status, create_date desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.yida.data.user.mapper.EduStudentApplyMapper">
|
||||
<select id="getStudentApplyStatus"
|
||||
resultType="com.yida.data.common.core.entity.user.EduStudentApply">
|
||||
select *
|
||||
from edu_student_apply
|
||||
where student_id = #{studentId}
|
||||
and apply_code = #{applyCode}
|
||||
order by end_time desc
|
||||
</select>
|
||||
<select id="listStudentApply" resultType="com.yida.data.common.core.entity.user.EduStudentApply">
|
||||
SELECT * from edu_student_apply
|
||||
WHERE del_flag = 0
|
||||
<if test="dto.studentName!=null and dto.studentName!=''">
|
||||
and student_name LIKE CONCAT('%',#{dto.studentName},'%')
|
||||
</if>
|
||||
<if test="dto.studentNumber!=null and dto.studentNumber!=''">
|
||||
and student_number LIKE CONCAT('%',#{dto.studentNumber},'%')
|
||||
</if>
|
||||
<if test="dto.schoolIdList != null and dto.schoolIdList.size() > 0">
|
||||
and school_id in
|
||||
<foreach collection="dto.schoolIdList" close=")" open="(" separator="," item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.sectionId!=null">
|
||||
and section_id =#{dto.sectionId}
|
||||
</if>
|
||||
<if test="dto.campusId!=null">
|
||||
and campus_id =#{dto.campusId}
|
||||
</if>
|
||||
<if test="dto.gradeId!=null">
|
||||
and grade_id =#{dto.gradeId}
|
||||
</if>
|
||||
<if test="dto.classId!=null">
|
||||
and class_id =#{dto.classId}
|
||||
</if>
|
||||
order by create_date desc
|
||||
</select>
|
||||
|
||||
<select id="getStudentApply"
|
||||
resultType="com.yida.data.common.core.entity.user.EduStudentApply">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
edu_student_apply
|
||||
WHERE
|
||||
del_flag = 0
|
||||
AND student_id = #{studentId}
|
||||
AND apply_code = #{applyCode}
|
||||
AND NOW( ) BETWEEN start_time
|
||||
AND end_time
|
||||
ORDER BY
|
||||
end_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user