Przeglądaj źródła

奖助学金调整

dzx 1 rok temu
rodzic
commit
97076e2f49

+ 32 - 41
src/main/java/com/xjrsoft/module/student/controller/BaseStudentScholarshipReleaseController.java

@@ -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);
+    }
 }

+ 2 - 2
src/main/java/com/xjrsoft/module/student/dto/AddStudentScholarshipDto.java

@@ -32,8 +32,8 @@ public class AddStudentScholarshipDto implements Serializable {
     /**
     * 学生姓名
     */
-    @ApiModelProperty("学生id")
-    private List<Long> userIds;
+    @ApiModelProperty("申请id")
+    private List<Long> applicantIds;
     /**
     * 性别
     */

+ 2 - 1
src/main/java/com/xjrsoft/module/student/entity/BaseStudentScholarshipApplicant.java

@@ -162,5 +162,6 @@ public class BaseStudentScholarshipApplicant implements Serializable {
     @ApiModelProperty("申请金额")
     private Double amount;
 
-
+    @ApiModelProperty("奖学金等级 0=无等级")
+    private Integer scholarshipLevel;
 }

+ 4 - 0
src/main/java/com/xjrsoft/module/student/service/IBaseStudentScholarshipApplicantService.java

@@ -5,6 +5,9 @@ import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantCategoryPageDto;
 import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
 import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantCategoryPageVo;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
 
 /**
 * @title: 奖学金申请
@@ -30,4 +33,5 @@ public interface IBaseStudentScholarshipApplicantService extends MPJBaseService<
      */
     Page<BaseStudentScholarshipApplicantCategoryPageVo> getScholarshiPage(Page<BaseStudentScholarshipApplicantCategoryPageDto> page, BaseStudentScholarshipApplicantCategoryPageDto dto);
 
+    List<?> importData(MultipartFile file);
 }

+ 9 - 0
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentScholarshipApplicantServiceImpl.java

@@ -12,6 +12,9 @@ import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantCategoryPage
 import com.xjrsoft.module.student.vo.StudentInfoVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
 
 /**
  * @title: 奖学金申请
@@ -29,6 +32,7 @@ public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceIm
         return result;
     }
 
+
     private final BaseStudentScholarshipApplicantMapper scholarshipApplicantMapper;
 
     private final BaseStudentMapper studentMapper;
@@ -52,4 +56,9 @@ public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceIm
 
         return updateById(scholarshipApplicant);
     }
+
+    @Override
+    public List<?> importData(MultipartFile file) {
+        return null;
+    }
 }

+ 1 - 1
src/main/resources/mapper/student/BaseStudentScholarshipReleaseMapper.xml

@@ -16,7 +16,7 @@
         LEFT JOIN base_class t6 ON t5.class_id = t6.id
         LEFT JOIN base_student_scholarship_category t7 ON t1.base_student_scholarship_category_id = t7.id
         LEFT JOIN xjr_dictionary_detail t8 ON t7.category = t8.code
-        WHERE t1.status = 1 AND t1.delete_mark = 0
+        WHERE t1.status = 1 AND t1.delete_mark = 0 and t1.review_status = 1
         <if test="dto.name != null and dto.name != ''">
             and t3.name like concat('%', #{dto.name}, '%')
         </if>