|
|
@@ -10,10 +10,6 @@ import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.page.ConventPage;
|
|
|
import com.xjrsoft.common.page.PageOutput;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
-import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
-import com.xjrsoft.module.base.entity.BaseGrade;
|
|
|
-import com.xjrsoft.module.base.entity.BaseMajorSet;
|
|
|
-import com.xjrsoft.module.organization.entity.User;
|
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.student.dto.AddBaseStudentScholarshipReleaseDto;
|
|
|
import com.xjrsoft.module.student.dto.AddStudentScholarshipDto;
|
|
|
@@ -21,14 +17,12 @@ import com.xjrsoft.module.student.dto.BaseStudentScholarshipReleasePageDto;
|
|
|
import com.xjrsoft.module.student.dto.UpdateBaseStudentScholarshipReleaseDto;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentScholarshipRelease;
|
|
|
-import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentScholarshipApplicantService;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentScholarshipReleaseService;
|
|
|
-import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantVo;
|
|
|
+import com.xjrsoft.module.student.vo.BaseNewStudentScoreExcelVo;
|
|
|
import com.xjrsoft.module.student.vo.BaseStudentScholarshipReleasePageVo;
|
|
|
import com.xjrsoft.module.student.vo.BaseStudentScholarshipReleaseRecordVo;
|
|
|
import com.xjrsoft.module.student.vo.BaseStudentScholarshipReleaseVo;
|
|
|
-import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -40,10 +34,13 @@ 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;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @title: 奖学金发放记录表
|
|
|
@@ -137,46 +134,40 @@ public class BaseStudentScholarshipReleaseController {
|
|
|
@ApiOperation(value = "添加学生")
|
|
|
@SaCheckPermission("basestudentscholarshiprelease:add")
|
|
|
public RT<Boolean> addStudent(@Valid @RequestBody AddStudentScholarshipDto dto) {
|
|
|
- if(dto.getUserIds() != null && !dto.getUserIds().isEmpty()){
|
|
|
-
|
|
|
- List<BaseStudentScholarshipApplicantVo> list = userService.selectJoinList(BaseStudentScholarshipApplicantVo.class,
|
|
|
- new MPJLambdaWrapper<User>()
|
|
|
- .selectAs(User::getId, BaseStudentScholarshipApplicantVo::getApplicantUserId)
|
|
|
- .selectAs(User::getName, BaseStudentScholarshipApplicantVo::getName)
|
|
|
- .selectAs(User::getCredentialNumber, BaseStudentScholarshipApplicantVo::getStudentId)
|
|
|
- .select("t5.name", BaseStudentScholarshipApplicantVo::getGenderName)
|
|
|
- .select("t4.name", BaseStudentScholarshipApplicantVo::getEnrollTypeCn)
|
|
|
- .selectAs(BaseMajorSet::getName, BaseStudentScholarshipApplicantVo::getMajorName)
|
|
|
- .selectAs(BaseClass::getName, BaseStudentScholarshipApplicantVo::getClassName)
|
|
|
- .selectAs(BaseGrade::getName, BaseStudentScholarshipApplicantVo::getGradeName)
|
|
|
- .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, User::getId)
|
|
|
- .innerJoin(BaseClass.class, BaseClass::getId, BaseStudentSchoolRoll::getClassId)
|
|
|
- .innerJoin(BaseGrade.class, BaseGrade::getId, BaseClass::getGradeId)
|
|
|
- .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, BaseStudentSchoolRoll::getEnrollType)
|
|
|
- .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, User::getGender)
|
|
|
- .leftJoin(BaseMajorSet.class, BaseMajorSet::getId, BaseStudentSchoolRoll::getMajorSetId)
|
|
|
+ if(dto.getApplicantIds() != null && !dto.getApplicantIds().isEmpty()){
|
|
|
+ List<BaseStudentScholarshipApplicant> applicantList = applicantService.list(
|
|
|
+ new QueryWrapper<BaseStudentScholarshipApplicant>().lambda()
|
|
|
+ .in(BaseStudentScholarshipApplicant::getId, dto.getApplicantIds())
|
|
|
);
|
|
|
List<BaseStudentScholarshipApplicant> dataList = new ArrayList<>();
|
|
|
- for (BaseStudentScholarshipApplicantVo applicantVo : list) {
|
|
|
- dataList.add(
|
|
|
- new BaseStudentScholarshipApplicant(){{
|
|
|
- setStudentId(applicantVo.getStudentId());
|
|
|
- setName(applicantVo.getName());
|
|
|
- setClassName(applicantVo.getClassName());
|
|
|
- setApplicantUserId(applicantVo.getApplicantUserId());
|
|
|
- setGenderName(applicantVo.getGenderName());
|
|
|
- setEnrollTypeCn(applicantVo.getEnrollTypeCn());
|
|
|
- setMajorName(applicantVo.getMajorName());
|
|
|
- setGradeName(applicantVo.getGradeName());
|
|
|
- setStatus(1);
|
|
|
- }}
|
|
|
- );
|
|
|
+ for (BaseStudentScholarshipApplicant applicantVo : applicantList) {
|
|
|
+ applicantVo.setScholarshipLevel(dto.getScholarshipLevel());
|
|
|
+ applicantVo.setBaseStudentScholarshipCategoryId(dto.getBaseStudentScholarshipCategoryId());
|
|
|
+ dataList.add(applicantVo);
|
|
|
}
|
|
|
if(!dataList.isEmpty()){
|
|
|
- applicantService.saveBatch(dataList);
|
|
|
+ applicantService.updateBatchById(dataList);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
return RT.ok(true);
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping("/import")
|
|
|
+ @ApiOperation(value = "成绩导入")
|
|
|
+ public RT<List<Map<String, String>>> scoreImport(@RequestParam MultipartFile file) {
|
|
|
+ List<BaseNewStudentScoreExcelVo> errorList = new ArrayList<>();
|
|
|
+ List<Map<String, String>> result = new ArrayList<>();
|
|
|
+
|
|
|
+ for (BaseNewStudentScoreExcelVo objectMap : errorList) {
|
|
|
+ Map<String, String> object = new LinkedHashMap<>();
|
|
|
+ object.put("毕业学校", objectMap.getGraduateSchool());
|
|
|
+ object.put("姓名", objectMap.getName());
|
|
|
+ object.put("性别", objectMap.getGender());
|
|
|
+ object.put("班级", objectMap.getGraduateClass());
|
|
|
+ object.put("总成绩", objectMap.getScore().intValue() + "");
|
|
|
+ object.put("错误信息", "未能查询到该学生或该学生存在多个");
|
|
|
+ result.add(object);
|
|
|
+ }
|
|
|
+ return RT.ok(result);
|
|
|
+ }
|
|
|
}
|