|
|
@@ -5,38 +5,29 @@ import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
-import com.xjrsoft.common.enums.DeleteMark;
|
|
|
-import com.xjrsoft.common.enums.EnabledMark;
|
|
|
-import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
|
-import com.xjrsoft.common.enums.JobStateEnum;
|
|
|
-import com.xjrsoft.common.enums.RoleEnum;
|
|
|
-import com.xjrsoft.common.enums.TeaChangeTypeEnum;
|
|
|
+import com.xjrsoft.common.enums.*;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
import com.xjrsoft.common.utils.RedisUtil;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.config.CommonPropertiesConfig;
|
|
|
+import com.xjrsoft.module.base.entity.BaseCourseSubject;
|
|
|
+import com.xjrsoft.module.base.entity.CourseSubjectDetail;
|
|
|
import com.xjrsoft.module.hikvision.util.DataUtil;
|
|
|
-import com.xjrsoft.module.organization.entity.Department;
|
|
|
-import com.xjrsoft.module.organization.entity.Post;
|
|
|
-import com.xjrsoft.module.organization.entity.User;
|
|
|
-import com.xjrsoft.module.organization.entity.UserDeptRelation;
|
|
|
-import com.xjrsoft.module.organization.entity.UserPostRelation;
|
|
|
-import com.xjrsoft.module.organization.entity.UserRoleRelation;
|
|
|
+import com.xjrsoft.module.organization.entity.*;
|
|
|
import com.xjrsoft.module.organization.mapper.UserDeptRelationMapper;
|
|
|
import com.xjrsoft.module.organization.mapper.UserRoleRelationMapper;
|
|
|
-import com.xjrsoft.module.organization.service.IDepartmentService;
|
|
|
-import com.xjrsoft.module.organization.service.IPostService;
|
|
|
-import com.xjrsoft.module.organization.service.IUserDeptRelationService;
|
|
|
-import com.xjrsoft.module.organization.service.IUserPostRelationService;
|
|
|
-import com.xjrsoft.module.organization.service.IUserService;
|
|
|
+import com.xjrsoft.module.organization.service.*;
|
|
|
import com.xjrsoft.module.personnel.entity.CarMessageApply;
|
|
|
import com.xjrsoft.module.personnel.mapper.CarMessageApplyMapper;
|
|
|
import com.xjrsoft.module.personnel.service.ITeacherFaceProcessService;
|
|
|
@@ -46,49 +37,36 @@ import com.xjrsoft.module.system.service.IDictionarydetailService;
|
|
|
import com.xjrsoft.module.teacher.dto.AddXjrUserDto;
|
|
|
import com.xjrsoft.module.teacher.dto.BaseTeacherPageDto;
|
|
|
import com.xjrsoft.module.teacher.dto.UpdateXjrUserDto;
|
|
|
-import com.xjrsoft.module.teacher.entity.BaseTeacher;
|
|
|
-import com.xjrsoft.module.teacher.entity.BaseTeacherChangeRecord;
|
|
|
-import com.xjrsoft.module.teacher.entity.BaseTeacherContact;
|
|
|
-import com.xjrsoft.module.teacher.entity.BaseTeacherEducation;
|
|
|
-import com.xjrsoft.module.teacher.entity.BaseTeacherEmploy;
|
|
|
-import com.xjrsoft.module.teacher.entity.BaseTeacherFamily;
|
|
|
-import com.xjrsoft.module.teacher.entity.BaseTeacherFamilyMember;
|
|
|
-import com.xjrsoft.module.teacher.entity.BaseTeacherRegular;
|
|
|
-import com.xjrsoft.module.teacher.entity.WfTeacherDepart;
|
|
|
-import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
-import com.xjrsoft.module.teacher.mapper.BaseTeacherChangeRecordMapper;
|
|
|
-import com.xjrsoft.module.teacher.mapper.BaseTeacherContactMapper;
|
|
|
-import com.xjrsoft.module.teacher.mapper.BaseTeacherEducationMapper;
|
|
|
-import com.xjrsoft.module.teacher.mapper.BaseTeacherEmployMapper;
|
|
|
-import com.xjrsoft.module.teacher.mapper.BaseTeacherFamilyMapper;
|
|
|
-import com.xjrsoft.module.teacher.mapper.BaseTeacherFamilyMemberMapper;
|
|
|
-import com.xjrsoft.module.teacher.mapper.BaseTeacherMapper;
|
|
|
-import com.xjrsoft.module.teacher.mapper.BaseTeacherRegularMapper;
|
|
|
-import com.xjrsoft.module.teacher.mapper.WfTeacherDepartMapper;
|
|
|
-import com.xjrsoft.module.teacher.mapper.XjrUserMapper;
|
|
|
+import com.xjrsoft.module.teacher.entity.*;
|
|
|
+import com.xjrsoft.module.teacher.mapper.*;
|
|
|
import com.xjrsoft.module.teacher.service.ITeacherbaseManagerService;
|
|
|
+import com.xjrsoft.module.teacher.vo.ProfessionalTitleImportVo;
|
|
|
import com.xjrsoft.module.teacher.vo.XjrUserPageVo;
|
|
|
+import com.xjrsoft.module.veb.util.ImportExcelUtil;
|
|
|
+import com.xjrsoft.module.veb.vo.BaseCourseSubjectImportVo;
|
|
|
import com.xjrsoft.module.workflow.entity.WorkflowFormRelation;
|
|
|
import com.xjrsoft.module.workflow.mapper.WorkflowFormRelationMapper;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.camunda.bpm.engine.history.HistoricProcessInstance;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.xjrsoft.module.veb.util.ImportExcelUtil.isRequiredFieldsFilled;
|
|
|
+import static com.xjrsoft.module.veb.util.ImportExcelUtil.validateAndSetDictionaryField;
|
|
|
+
|
|
|
/**
|
|
|
* @title: service
|
|
|
* @Author 管理员
|
|
|
@@ -118,17 +96,14 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
private final IDictionarydetailService dictionaryService;
|
|
|
private final IDepartmentService departmentService;
|
|
|
private final IPostService postService;
|
|
|
+ private final ITeacherFaceProcessService teacherFaceProcessService;
|
|
|
+ private final CarMessageApplyMapper carMessageApplyMapper;
|
|
|
private IDictionarydetailService dictionarydetailService;
|
|
|
-
|
|
|
private WfTeacherDepartMapper wfTeacherDepartMapper;
|
|
|
-
|
|
|
private BaseTeacherChangeRecordMapper baseTeacherChangeRecordMapper;
|
|
|
-
|
|
|
private WorkflowFormRelationMapper workflowFormRelationMapper;
|
|
|
|
|
|
- private final ITeacherFaceProcessService teacherFaceProcessService;
|
|
|
- private final CarMessageApplyMapper carMessageApplyMapper;
|
|
|
-
|
|
|
+ private ProfessionalTitleMapper professionalTitleMapper;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@@ -244,7 +219,7 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean update(UpdateXjrUserDto dto) {
|
|
|
XjrUser old = this.getByIdDeep(dto.getId());
|
|
|
- if(ObjectUtils.isEmpty(old)){
|
|
|
+ if (ObjectUtils.isEmpty(old)) {
|
|
|
throw new MyException("教职工信息不存在");
|
|
|
}
|
|
|
|
|
|
@@ -302,7 +277,7 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
baseTeacherChangeRecordMapper.insert(insetBaseTeacherChangeRecord);
|
|
|
|
|
|
//如果在职状态改为了非在职,禁用账号,并清空海康相关信息
|
|
|
- if(!JobStateEnum.isBeOnTheJobByCode(oldJobState)){
|
|
|
+ if (!JobStateEnum.isBeOnTheJobByCode(oldJobState)) {
|
|
|
disabledUser(dto.getId());
|
|
|
}
|
|
|
}
|
|
|
@@ -795,7 +770,7 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(!updateBaseTeacherRegularList.isEmpty()){
|
|
|
+ if (!updateBaseTeacherRegularList.isEmpty()) {
|
|
|
for (BaseTeacherRegular teacherRegular : updateBaseTeacherRegularList) {
|
|
|
teacherRegularMapper.updateById(teacherRegular);
|
|
|
}
|
|
|
@@ -846,7 +821,7 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
&& HistoricProcessInstance.STATE_COMPLETED.equals(workflowFormRelation.getCurrentState())
|
|
|
) {
|
|
|
XjrUser old = this.getByIdDeep(wfTextbookRecede.getApplicantUserId());
|
|
|
- if(ObjectUtils.isEmpty(old)){
|
|
|
+ if (ObjectUtils.isEmpty(old)) {
|
|
|
throw new MyException("教职工信息不存在");
|
|
|
}
|
|
|
|
|
|
@@ -854,7 +829,7 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
// 更新教职工在职状态
|
|
|
List<BaseTeacher> baseTeacherList = old.getBaseTeacherList();
|
|
|
BaseTeacher updateBaseTeacher;
|
|
|
- for (BaseTeacher baseTeacher : baseTeacherList){
|
|
|
+ for (BaseTeacher baseTeacher : baseTeacherList) {
|
|
|
updateBaseTeacher = new BaseTeacher();
|
|
|
updateBaseTeacher.setId(baseTeacher.getId());
|
|
|
updateBaseTeacher.setJobState("JOB_LZ");
|
|
|
@@ -944,4 +919,141 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
public List<XjrUserPageVo> getList(BaseTeacherPageDto dto) {
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String professionalTitle(MultipartFile file) throws IOException, IllegalAccessException {
|
|
|
+ List<ProfessionalTitleImportVo> excelDataList = EasyExcel.read(file.getInputStream()).headRowNumber(1).head(ProfessionalTitleImportVo.class).sheet().doReadSync();
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+
|
|
|
+ // 获取所有的教职工
|
|
|
+ MPJLambdaWrapper<XjrUser> xjrUserMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ xjrUserMPJLambdaWrapper
|
|
|
+ .select(XjrUser::getId)
|
|
|
+ .select(XjrUser::getUserName, XjrUser::getUserName)
|
|
|
+ .select(XjrUser::getName, XjrUser::getName)
|
|
|
+ .select(" (SELECT GROUP_CONCAT(a.id) FROM xjr_department a" +
|
|
|
+ " INNER JOIN xjr_user_dept_relation b ON a.id = b.dept_id" +
|
|
|
+ " WHERE a.delete_mark = 0 AND b.user_id = t.id) as code")
|
|
|
+ .innerJoin(UserRoleRelation.class, UserRoleRelation::getUserId, XjrUser::getId)
|
|
|
+ .eq(UserRoleRelation::getRoleId, 2)
|
|
|
+ ;
|
|
|
+
|
|
|
+ List<XjrUser> xjrUsers = this.selectJoinList(XjrUser.class, xjrUserMPJLambdaWrapper);
|
|
|
+ // 根据姓名和工号映射
|
|
|
+ Map<String, XjrUser> mapByUsernameAndName = xjrUsers.stream()
|
|
|
+ .collect(Collectors.toMap(u -> u.getUserName() + "-" + u.getName(), u -> u, (u1, u2) -> u1));
|
|
|
+
|
|
|
+ if (MapUtils.isEmpty(mapByUsernameAndName)) {
|
|
|
+ sb.append("系统教职工数据有误,请联系管理员");
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProfessionalTitle> oldProfessionalTitles = professionalTitleMapper.selectList(Wrappers.lambdaQuery(ProfessionalTitle.class)
|
|
|
+ .eq(ProfessionalTitle::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ );
|
|
|
+
|
|
|
+ // 先根据用户分组,再根据
|
|
|
+ Map<Long, Map<String, ProfessionalTitle>> mapByUserIdThenNo = oldProfessionalTitles.stream()
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ ProfessionalTitle::getUserId, // 第一级分组:按 userId 分组
|
|
|
+ Collectors.toMap(
|
|
|
+ ProfessionalTitle::getProfessionalTitleNo, // 第二级分组的键:professionalTitleNo
|
|
|
+ pt -> pt // 第二级分组的值:整个 ProfessionalTitle 对象
|
|
|
+ )
|
|
|
+ ));
|
|
|
+
|
|
|
+ List<ProfessionalTitle> professionalTitles = new ArrayList<>();
|
|
|
+ ProfessionalTitle insert;
|
|
|
+ for (int i = 0; i < excelDataList.size(); i++) {
|
|
|
+ ProfessionalTitleImportVo vo = excelDataList.get(i);
|
|
|
+ if (isRequiredFieldsFilled(vo,
|
|
|
+ sb,
|
|
|
+ i + 1)) {
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ XjrUser user = mapByUsernameAndName.get(vo.getUserName() + "-" + vo.getName());
|
|
|
+ if (ObjectUtils.isEmpty(user)) {
|
|
|
+ sb
|
|
|
+ .append("第")
|
|
|
+ .append(i + 1)
|
|
|
+ .append("行工号和姓名对应的教职工不存在,请核实");
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ insert = new ProfessionalTitle();
|
|
|
+ BeanUtils.copyProperties(vo, insert);
|
|
|
+ insert.setUserId(user.getId());
|
|
|
+ insert.setDeptId(user.getCode());
|
|
|
+
|
|
|
+
|
|
|
+ professionalTitles.add(insert);
|
|
|
+ }
|
|
|
+
|
|
|
+// //批量新增
|
|
|
+// if (!professionalTitles.isEmpty()) {
|
|
|
+// for (BaseCourseSubject baseCourseSubject : baseCourseSubjects) {
|
|
|
+// baseCourseSubjectMapper.insert(baseCourseSubject);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (!courseSubjectDetails.isEmpty()) {
|
|
|
+// for (CourseSubjectDetail courseSubjectDetail : courseSubjectDetails) {
|
|
|
+// courseSubjectDetailMapper.insert(courseSubjectDetail);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String teacherCertification(MultipartFile file) throws IOException, IllegalAccessException {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String evaluatorInformation(MultipartFile file) throws IOException, IllegalAccessException {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String languageCompetence(MultipartFile file) throws IOException, IllegalAccessException {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String facultyContract(MultipartFile file) throws IOException, IllegalAccessException {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String outsideAssociations(MultipartFile file) throws IOException, IllegalAccessException {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String coreTeacher(MultipartFile file) throws IOException, IllegalAccessException {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String scientificResearch(MultipartFile file) throws IOException, IllegalAccessException {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String jobInformation(MultipartFile file) throws IOException, IllegalAccessException {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+// public String jobInformation(MultipartFile file) {
|
|
|
+// return "";
|
|
|
+// }
|
|
|
}
|