|
|
@@ -15,8 +15,10 @@ import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantCategoryPageDto;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentScholarshipRelease;
|
|
|
import com.xjrsoft.module.student.mapper.BaseStudentMapper;
|
|
|
import com.xjrsoft.module.student.mapper.BaseStudentScholarshipApplicantMapper;
|
|
|
+import com.xjrsoft.module.student.mapper.BaseStudentScholarshipReleaseMapper;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentScholarshipApplicantService;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentScholarshipCategoryService;
|
|
|
import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantCategoryPageVo;
|
|
|
@@ -25,6 +27,7 @@ import com.xjrsoft.module.student.vo.ScholarshipApplicantImportVo;
|
|
|
import com.xjrsoft.module.student.vo.StudentInfoVo;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
@@ -51,6 +54,7 @@ public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceIm
|
|
|
private final IUserService userService;
|
|
|
private final BaseStudentScholarshipApplicantMapper scholarshipApplicantMapper;
|
|
|
private final BaseStudentMapper studentMapper;
|
|
|
+ private final BaseStudentScholarshipReleaseMapper releaseMapper;
|
|
|
|
|
|
@Override
|
|
|
public Page<BaseStudentScholarshipApplicantCategoryPageVo> getScholarshiPage(Page<BaseStudentScholarshipApplicantCategoryPageDto> page, BaseStudentScholarshipApplicantCategoryPageDto dto) {
|
|
|
@@ -156,4 +160,33 @@ public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceIm
|
|
|
}
|
|
|
return errorList;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 每次发放时根据已经发放的金额判断这次申请的发放状态
|
|
|
+ * @param scholarshipApplicant
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Boolean updateReleaseStatus(BaseStudentScholarshipApplicant scholarshipApplicant) {
|
|
|
+ List<BaseStudentScholarshipRelease> releaseList = releaseMapper.selectList(
|
|
|
+ new QueryWrapper<BaseStudentScholarshipRelease>().lambda()
|
|
|
+ .eq(BaseStudentScholarshipRelease::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ .eq(BaseStudentScholarshipRelease::getBaseStudentScholarshipApplicantId, scholarshipApplicant.getId())
|
|
|
+ );
|
|
|
+ if(releaseList.isEmpty()){
|
|
|
+ scholarshipApplicant.setReleaseStatus(0);
|
|
|
+ }
|
|
|
+ double sum = releaseList.stream().filter(x -> x.getAmount() != null).mapToDouble(BaseStudentScholarshipRelease::getAmount).sum();
|
|
|
+ if(sum == 0){
|
|
|
+ scholarshipApplicant.setReleaseStatus(0);
|
|
|
+ }else if(sum < scholarshipApplicant.getAmount()){
|
|
|
+ scholarshipApplicant.setReleaseStatus(1);
|
|
|
+ }else if(sum == scholarshipApplicant.getAmount()){
|
|
|
+ scholarshipApplicant.setReleaseStatus(2);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.updateById(scholarshipApplicant);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|