|
@@ -7,26 +7,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jeeplus.common.TokenProvider;
|
|
|
-import com.jeeplus.flowable.feign.IFlowableApi;
|
|
|
import com.jeeplus.human.enrollment.enrollmentRegistration.domain.EnrollmentEduInfo;
|
|
|
-import com.jeeplus.human.enrollment.enrollmentRegistration.domain.EnrollmentKeyCard;
|
|
|
import com.jeeplus.human.enrollment.enrollmentRegistration.domain.EnrollmentRegistration;
|
|
|
-import com.jeeplus.human.enrollment.enrollmentRegistration.domain.EnrollmentRiceCard;
|
|
|
import com.jeeplus.human.enrollment.enrollmentRegistration.mapper.EnrollmentEduInfoMapper;
|
|
|
-import com.jeeplus.human.enrollment.enrollmentRegistration.mapper.EnrollmentKeyCardMapper;
|
|
|
-import com.jeeplus.human.enrollment.enrollmentRegistration.utils.SnowFlake;
|
|
|
import com.jeeplus.sys.domain.WorkAttachmentInfo;
|
|
|
import com.jeeplus.sys.feign.IUserApi;
|
|
|
import com.jeeplus.sys.feign.IWorkAttachmentApi;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
+import com.jeeplus.utils.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -42,9 +35,9 @@ public class EnrollmentEduInfoService extends ServiceImpl<EnrollmentEduInfoMappe
|
|
|
@Resource
|
|
|
private EnrollmentEduInfoMapper eduInfoMapper;
|
|
|
|
|
|
- public void deleteByRegistrationId(String id){
|
|
|
+ public void deleteByRegistrationId(String id) {
|
|
|
QueryWrapper<EnrollmentEduInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("enrollment_registration_id",id);
|
|
|
+ queryWrapper.eq("enrollment_registration_id", id);
|
|
|
eduInfoMapper.delete(queryWrapper);
|
|
|
}
|
|
|
|
|
@@ -55,7 +48,7 @@ public class EnrollmentEduInfoService extends ServiceImpl<EnrollmentEduInfoMappe
|
|
|
List<WorkAttachmentInfoDTO> files = eduInfoMapper.findDtos(id);
|
|
|
if (CollectionUtils.isNotEmpty(files)) {
|
|
|
for (WorkAttachmentInfoDTO i : files) {
|
|
|
- i.setCreateBy(SpringUtil.getBean ( IUserApi.class ).getById(i.getBy()));
|
|
|
+ i.setCreateBy(SpringUtil.getBean(IUserApi.class).getById(i.getBy()));
|
|
|
}
|
|
|
Map<String, List<WorkAttachmentInfoDTO>> groupedMap = files.stream()
|
|
|
.collect(Collectors.groupingBy(WorkAttachmentInfoDTO::getAttachmentFlag));
|
|
@@ -67,16 +60,33 @@ public class EnrollmentEduInfoService extends ServiceImpl<EnrollmentEduInfoMappe
|
|
|
return info;
|
|
|
}
|
|
|
|
|
|
- public List<EnrollmentEduInfo> findByRegistrationId(String id) {
|
|
|
+ public List<EnrollmentEduInfo> findByUserId(String id) {
|
|
|
QueryWrapper<EnrollmentEduInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("enrollment_registration_id",id);
|
|
|
+ if (StringUtils.isNotBlank(id)) {
|
|
|
+ queryWrapper.eq("user_id", id);
|
|
|
+ }
|
|
|
List<EnrollmentEduInfo> enrollmentEduInfos = eduInfoMapper.selectList(queryWrapper);
|
|
|
+ // 查询附件信息
|
|
|
+ for (EnrollmentEduInfo eduInfo : enrollmentEduInfos) {
|
|
|
+ List<WorkAttachmentInfoDTO> files = eduInfoMapper.findDtos(eduInfo.getId());
|
|
|
+ if (CollectionUtils.isNotEmpty(files)) {
|
|
|
+ for (WorkAttachmentInfoDTO i : files) {
|
|
|
+ i.setCreateBy(SpringUtil.getBean(IUserApi.class).getById(i.getBy()));
|
|
|
+ }
|
|
|
+ Map<String, List<WorkAttachmentInfoDTO>> groupedMap = files.stream()
|
|
|
+ .collect(Collectors.groupingBy(WorkAttachmentInfoDTO::getAttachmentFlag));
|
|
|
+ List<WorkAttachmentInfoDTO> educationFiles = groupedMap.getOrDefault("education", new ArrayList<>());
|
|
|
+ List<WorkAttachmentInfoDTO> degreeFiles = groupedMap.getOrDefault("degree", new ArrayList<>());
|
|
|
+ eduInfo.setEducationFile(educationFiles);
|
|
|
+ eduInfo.setDegreeFile(degreeFiles);
|
|
|
+ }
|
|
|
+ }
|
|
|
return enrollmentEduInfos;
|
|
|
}
|
|
|
|
|
|
public void saveOrUpdateEduInfo(EnrollmentEduInfo enrollmentEduInfo) {
|
|
|
if (enrollmentEduInfo == null) {
|
|
|
- return ;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isNotBlank(enrollmentEduInfo.getId())) {
|
|
@@ -90,56 +100,57 @@ public class EnrollmentEduInfoService extends ServiceImpl<EnrollmentEduInfoMappe
|
|
|
|
|
|
/**
|
|
|
* 新增
|
|
|
+ *
|
|
|
* @param enrollmentEduInfo
|
|
|
*/
|
|
|
- public void add(EnrollmentEduInfo enrollmentEduInfo){
|
|
|
+ public void add(EnrollmentEduInfo enrollmentEduInfo) {
|
|
|
String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
|
|
|
// 保存学历证书
|
|
|
if (ObjectUtil.isNotEmpty(enrollmentEduInfo.getEducationFile())) {
|
|
|
AtomicInteger sort = new AtomicInteger(1);
|
|
|
- enrollmentEduInfo.getEducationFile().stream().forEach(item->{
|
|
|
+ enrollmentEduInfo.getEducationFile().stream().forEach(item -> {
|
|
|
//保存附件信息
|
|
|
WorkAttachmentInfo workAttachmentDto = new WorkAttachmentInfo();
|
|
|
workAttachmentDto.setName(item.getName());
|
|
|
workAttachmentDto.setSize(item.getSize());
|
|
|
workAttachmentDto.setUrl(item.getUrl());
|
|
|
- Map<String,String> map = new HashMap<>();
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
String workAttachmentDtoInfo = JSON.toJSONString(workAttachmentDto);
|
|
|
String userDTOInfo = JSON.toJSONString(userDTO);
|
|
|
- String attachmentId =id;
|
|
|
+ String attachmentId = id;
|
|
|
String attachmentFlag = "education";
|
|
|
String sortInfo = Integer.toString(sort.get());
|
|
|
- map.put("workAttachmentDtoInfo",workAttachmentDtoInfo);
|
|
|
- map.put("userDTOInfo",userDTOInfo);
|
|
|
- map.put("attachmentId",attachmentId);
|
|
|
- map.put("attachmentFlag",attachmentFlag);
|
|
|
- map.put("sortInfo",sortInfo);
|
|
|
- String fileId = SpringUtil.getBean ( IWorkAttachmentApi.class ).saveFile(map);
|
|
|
+ map.put("workAttachmentDtoInfo", workAttachmentDtoInfo);
|
|
|
+ map.put("userDTOInfo", userDTOInfo);
|
|
|
+ map.put("attachmentId", attachmentId);
|
|
|
+ map.put("attachmentFlag", attachmentFlag);
|
|
|
+ map.put("sortInfo", sortInfo);
|
|
|
+ String fileId = SpringUtil.getBean(IWorkAttachmentApi.class).saveFile(map);
|
|
|
sort.getAndIncrement();
|
|
|
});
|
|
|
}
|
|
|
// 保存学位证书
|
|
|
if (ObjectUtil.isNotEmpty(enrollmentEduInfo.getDegreeFile())) {
|
|
|
AtomicInteger sort = new AtomicInteger(1);
|
|
|
- enrollmentEduInfo.getDegreeFile().stream().forEach(item->{
|
|
|
+ enrollmentEduInfo.getDegreeFile().stream().forEach(item -> {
|
|
|
//保存附件信息
|
|
|
WorkAttachmentInfo workAttachmentDto = new WorkAttachmentInfo();
|
|
|
workAttachmentDto.setName(item.getName());
|
|
|
workAttachmentDto.setSize(item.getSize());
|
|
|
workAttachmentDto.setUrl(item.getUrl());
|
|
|
- Map<String,String> map = new HashMap<>();
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
String workAttachmentDtoInfo = JSON.toJSONString(workAttachmentDto);
|
|
|
String userDTOInfo = JSON.toJSONString(userDTO);
|
|
|
- String attachmentId =id;
|
|
|
+ String attachmentId = id;
|
|
|
String attachmentFlag = "degree";
|
|
|
String sortInfo = Integer.toString(sort.get());
|
|
|
- map.put("workAttachmentDtoInfo",workAttachmentDtoInfo);
|
|
|
- map.put("userDTOInfo",userDTOInfo);
|
|
|
- map.put("attachmentId",attachmentId);
|
|
|
- map.put("attachmentFlag",attachmentFlag);
|
|
|
- map.put("sortInfo",sortInfo);
|
|
|
- String fileId = SpringUtil.getBean ( IWorkAttachmentApi.class ).saveFile(map);
|
|
|
+ map.put("workAttachmentDtoInfo", workAttachmentDtoInfo);
|
|
|
+ map.put("userDTOInfo", userDTOInfo);
|
|
|
+ map.put("attachmentId", attachmentId);
|
|
|
+ map.put("attachmentFlag", attachmentFlag);
|
|
|
+ map.put("sortInfo", sortInfo);
|
|
|
+ String fileId = SpringUtil.getBean(IWorkAttachmentApi.class).saveFile(map);
|
|
|
sort.getAndIncrement();
|
|
|
});
|
|
|
}
|
|
@@ -147,55 +158,55 @@ public class EnrollmentEduInfoService extends ServiceImpl<EnrollmentEduInfoMappe
|
|
|
eduInfoMapper.insert(enrollmentEduInfo);
|
|
|
}
|
|
|
|
|
|
- public void update(EnrollmentEduInfo enrollmentEduInfo){
|
|
|
+ public void update(EnrollmentEduInfo enrollmentEduInfo) {
|
|
|
UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
|
|
|
eduInfoMapper.updateById(enrollmentEduInfo);
|
|
|
- SpringUtil.getBean ( IWorkAttachmentApi.class ).deleteByAttachmentId(enrollmentEduInfo.getId());
|
|
|
+ SpringUtil.getBean(IWorkAttachmentApi.class).deleteByAttachmentId(enrollmentEduInfo.getId());
|
|
|
// 保存学历证明
|
|
|
if (ObjectUtil.isNotEmpty(enrollmentEduInfo.getEducationFile())) {
|
|
|
AtomicInteger sort = new AtomicInteger(1);
|
|
|
- enrollmentEduInfo.getEducationFile().stream().forEach(item->{
|
|
|
+ enrollmentEduInfo.getEducationFile().stream().forEach(item -> {
|
|
|
//保存附件信息
|
|
|
WorkAttachmentInfo workAttachmentDto = new WorkAttachmentInfo();
|
|
|
workAttachmentDto.setName(item.getName());
|
|
|
workAttachmentDto.setSize(item.getSize());
|
|
|
workAttachmentDto.setUrl(item.getUrl());
|
|
|
- Map<String,String> map = new HashMap<>();
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
String workAttachmentDtoInfo = JSON.toJSONString(workAttachmentDto);
|
|
|
String userDTOInfo = JSON.toJSONString(userDTO);
|
|
|
String attachmentId = enrollmentEduInfo.getId();
|
|
|
String attachmentFlag = "education";
|
|
|
String sortInfo = Integer.toString(sort.get());
|
|
|
- map.put("workAttachmentDtoInfo",workAttachmentDtoInfo);
|
|
|
- map.put("userDTOInfo",userDTOInfo);
|
|
|
- map.put("attachmentId",attachmentId);
|
|
|
- map.put("attachmentFlag",attachmentFlag);
|
|
|
- map.put("sortInfo",sortInfo);
|
|
|
- String fileId = SpringUtil.getBean ( IWorkAttachmentApi.class ).saveFile(map);
|
|
|
+ map.put("workAttachmentDtoInfo", workAttachmentDtoInfo);
|
|
|
+ map.put("userDTOInfo", userDTOInfo);
|
|
|
+ map.put("attachmentId", attachmentId);
|
|
|
+ map.put("attachmentFlag", attachmentFlag);
|
|
|
+ map.put("sortInfo", sortInfo);
|
|
|
+ String fileId = SpringUtil.getBean(IWorkAttachmentApi.class).saveFile(map);
|
|
|
sort.getAndIncrement();
|
|
|
});
|
|
|
}
|
|
|
// 保存学位证明
|
|
|
if (ObjectUtil.isNotEmpty(enrollmentEduInfo.getDegreeFile())) {
|
|
|
AtomicInteger sort = new AtomicInteger(1);
|
|
|
- enrollmentEduInfo.getDegreeFile().stream().forEach(item->{
|
|
|
+ enrollmentEduInfo.getDegreeFile().stream().forEach(item -> {
|
|
|
//保存附件信息
|
|
|
WorkAttachmentInfo workAttachmentDto = new WorkAttachmentInfo();
|
|
|
workAttachmentDto.setName(item.getName());
|
|
|
workAttachmentDto.setSize(item.getSize());
|
|
|
workAttachmentDto.setUrl(item.getUrl());
|
|
|
- Map<String,String> map = new HashMap<>();
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
String workAttachmentDtoInfo = JSON.toJSONString(workAttachmentDto);
|
|
|
String userDTOInfo = JSON.toJSONString(userDTO);
|
|
|
String attachmentId = enrollmentEduInfo.getId();
|
|
|
String attachmentFlag = "degree";
|
|
|
String sortInfo = Integer.toString(sort.get());
|
|
|
- map.put("workAttachmentDtoInfo",workAttachmentDtoInfo);
|
|
|
- map.put("userDTOInfo",userDTOInfo);
|
|
|
- map.put("attachmentId",attachmentId);
|
|
|
- map.put("attachmentFlag",attachmentFlag);
|
|
|
- map.put("sortInfo",sortInfo);
|
|
|
- String fileId = SpringUtil.getBean ( IWorkAttachmentApi.class ).saveFile(map);
|
|
|
+ map.put("workAttachmentDtoInfo", workAttachmentDtoInfo);
|
|
|
+ map.put("userDTOInfo", userDTOInfo);
|
|
|
+ map.put("attachmentId", attachmentId);
|
|
|
+ map.put("attachmentFlag", attachmentFlag);
|
|
|
+ map.put("sortInfo", sortInfo);
|
|
|
+ String fileId = SpringUtil.getBean(IWorkAttachmentApi.class).saveFile(map);
|
|
|
sort.getAndIncrement();
|
|
|
});
|
|
|
}
|
|
@@ -203,6 +214,7 @@ public class EnrollmentEduInfoService extends ServiceImpl<EnrollmentEduInfoMappe
|
|
|
|
|
|
/**
|
|
|
* 新增或者更新教育经历数据
|
|
|
+ *
|
|
|
* @param aDto
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|