|
@@ -10,6 +10,8 @@ import com.xjrsoft.common.enums.GenderEnum;
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
import com.xjrsoft.module.base.entity.BaseSemester;
|
|
import com.xjrsoft.module.base.entity.BaseSemester;
|
|
import com.xjrsoft.module.base.service.IBaseSemesterService;
|
|
import com.xjrsoft.module.base.service.IBaseSemesterService;
|
|
|
|
+import com.xjrsoft.module.organization.entity.User;
|
|
|
|
+import com.xjrsoft.module.organization.service.IUserService;
|
|
import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantCategoryPageDto;
|
|
import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantCategoryPageDto;
|
|
import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
|
|
import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
|
|
import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
|
|
import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
|
|
@@ -44,6 +46,7 @@ public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceIm
|
|
private final BaseStudentScholarshipApplicantMapper applicantMapper;
|
|
private final BaseStudentScholarshipApplicantMapper applicantMapper;
|
|
private final IBaseSemesterService semesterService;
|
|
private final IBaseSemesterService semesterService;
|
|
private final IBaseStudentScholarshipCategoryService categoryService;
|
|
private final IBaseStudentScholarshipCategoryService categoryService;
|
|
|
|
+ private final IUserService userService;
|
|
@Override
|
|
@Override
|
|
public Page<BaseStudentScholarshipApplicantCategoryPageVo> getScholarshiPage(Page<BaseStudentScholarshipApplicantCategoryPageDto> page, BaseStudentScholarshipApplicantCategoryPageDto dto) {
|
|
public Page<BaseStudentScholarshipApplicantCategoryPageVo> getScholarshiPage(Page<BaseStudentScholarshipApplicantCategoryPageDto> page, BaseStudentScholarshipApplicantCategoryPageDto dto) {
|
|
Page<BaseStudentScholarshipApplicantCategoryPageVo> result = applicantMapper.getScholarshiPage(page, dto);
|
|
Page<BaseStudentScholarshipApplicantCategoryPageVo> result = applicantMapper.getScholarshiPage(page, dto);
|
|
@@ -77,7 +80,7 @@ public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceIm
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<Map<String, String>> importData(MultipartFile file) throws IOException {
|
|
public List<Map<String, String>> importData(MultipartFile file) throws IOException {
|
|
- List<ScholarshipApplicantImportVo> dataList = EasyExcel.read(file.getInputStream()).headRowNumber(2).head(ScholarshipApplicantImportVo.class).sheet().doReadSync();
|
|
|
|
|
|
+ List<ScholarshipApplicantImportVo> dataList = EasyExcel.read(file.getInputStream()).headRowNumber(3).head(ScholarshipApplicantImportVo.class).sheet().doReadSync();
|
|
List<BaseStudentScholarshipApplicant> applicantList = this.list(
|
|
List<BaseStudentScholarshipApplicant> applicantList = this.list(
|
|
new QueryWrapper<BaseStudentScholarshipApplicant>().lambda()
|
|
new QueryWrapper<BaseStudentScholarshipApplicant>().lambda()
|
|
.select(BaseStudentScholarshipApplicant::getId)
|
|
.select(BaseStudentScholarshipApplicant::getId)
|
|
@@ -85,6 +88,9 @@ public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceIm
|
|
.eq(BaseStudentScholarshipApplicant::getStatus, 1)
|
|
.eq(BaseStudentScholarshipApplicant::getStatus, 1)
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+ List<Long> userIds = applicantList.stream().map(BaseStudentScholarshipApplicant::getApplicantUserId).collect(Collectors.toList());
|
|
|
|
+ Map<Long, User> userMap = userService.list(new QueryWrapper<User>().lambda().in(User::getId, userIds)).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
|
|
|
+
|
|
List<BaseSemester> semesterList = semesterService.list(
|
|
List<BaseSemester> semesterList = semesterService.list(
|
|
new QueryWrapper<BaseSemester>().lambda()
|
|
new QueryWrapper<BaseSemester>().lambda()
|
|
.select(BaseSemester::getId)
|
|
.select(BaseSemester::getId)
|
|
@@ -100,7 +106,8 @@ public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceIm
|
|
.eq(BaseStudentScholarshipCategory::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
.eq(BaseStudentScholarshipCategory::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
);
|
|
);
|
|
|
|
|
|
- Map<String, Long> categoryMap = categoryList.stream().collect(Collectors.toMap(BaseStudentScholarshipCategory::getName, BaseStudentScholarshipCategory::getId));
|
|
|
|
|
|
+ Map<String, BaseStudentScholarshipCategory> categoryMap = categoryList.stream().collect(Collectors.toMap(BaseStudentScholarshipCategory::getName, x -> x));
|
|
|
|
+ Map<String, Long> categorySemeterMap = categoryList.stream().collect(Collectors.toMap(BaseStudentScholarshipCategory::getName, BaseStudentScholarshipCategory::getBaseSemesterId));
|
|
|
|
|
|
List<Map<String, String>> errorList = new ArrayList<>();
|
|
List<Map<String, String>> errorList = new ArrayList<>();
|
|
List<BaseStudentScholarshipApplicant> updateList = new ArrayList<>();
|
|
List<BaseStudentScholarshipApplicant> updateList = new ArrayList<>();
|
|
@@ -111,24 +118,29 @@ public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceIm
|
|
errorMsg.add("有未填写的列");
|
|
errorMsg.add("有未填写的列");
|
|
}
|
|
}
|
|
if(semesterMap.get(importVo.getSemesterName()) == null){
|
|
if(semesterMap.get(importVo.getSemesterName()) == null){
|
|
- errorMsg.add("学期名称填写不正确");
|
|
|
|
|
|
+ errorMsg.add("学期填写不正确");
|
|
}
|
|
}
|
|
Long semesterId = semesterMap.get(importVo.getSemesterName());
|
|
Long semesterId = semesterMap.get(importVo.getSemesterName());
|
|
if(categoryMap.get(importVo.getScholarshipCategoryName()) == null){
|
|
if(categoryMap.get(importVo.getScholarshipCategoryName()) == null){
|
|
errorMsg.add("奖学金名称填写不正确");
|
|
errorMsg.add("奖学金名称填写不正确");
|
|
}
|
|
}
|
|
- Long categoryId = categoryMap.get(importVo.getScholarshipCategoryName());
|
|
|
|
|
|
+ BaseStudentScholarshipCategory category = categoryMap.get(importVo.getScholarshipCategoryName());
|
|
for (BaseStudentScholarshipApplicant applicant : applicantList) {
|
|
for (BaseStudentScholarshipApplicant applicant : applicantList) {
|
|
- if(applicant.getBaseSemesterId() == semesterId && importVo.getName().equals(applicant.getName()) && importVo.getCredentialNumber().equals(applicant.getStudentId())){
|
|
|
|
- applicant.setBaseStudentScholarshipCategoryId(categoryId);
|
|
|
|
|
|
+ User user = userMap.get(applicant.getApplicantUserId());
|
|
|
|
+ Long baseSemesterId = categorySemeterMap.get(importVo.getScholarshipCategoryName());
|
|
|
|
+ if(baseSemesterId.equals(semesterId)
|
|
|
|
+ && importVo.getName().equals(user.getName())
|
|
|
|
+ && importVo.getCredentialNumber().equals(user.getCredentialNumber())){
|
|
|
|
+ applicant.setBaseStudentScholarshipCategoryId(category.getId());
|
|
applicant.setReviewStatus(1);
|
|
applicant.setReviewStatus(1);
|
|
|
|
+ applicant.setAmount(category.getTotalAmount());
|
|
applicant.setScholarshipLevel(importVo.getScholarshipLevel());
|
|
applicant.setScholarshipLevel(importVo.getScholarshipLevel());
|
|
updateList.add(applicant);
|
|
updateList.add(applicant);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(!errorMsg.isEmpty()){
|
|
if(!errorMsg.isEmpty()){
|
|
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
|
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
|
- map.put("学期名称", importVo.getSemesterName());
|
|
|
|
|
|
+ map.put("学期", importVo.getSemesterName());
|
|
map.put("姓名", importVo.getName());
|
|
map.put("姓名", importVo.getName());
|
|
map.put("身份证号", importVo.getCredentialNumber());
|
|
map.put("身份证号", importVo.getCredentialNumber());
|
|
map.put("奖学金名称", importVo.getScholarshipCategoryName());
|
|
map.put("奖学金名称", importVo.getScholarshipCategoryName());
|