|
|
@@ -37,13 +37,9 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ThreadLocalRandom;
|
|
|
-=======
|
|
|
-import java.util.*;
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
/**
|
|
|
@@ -75,11 +71,7 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
*/
|
|
|
@Override
|
|
|
public JcbtScholarshipApplicationVo queryById(Long id) {
|
|
|
-<<<<<<< HEAD
|
|
|
return baseMapper.selectByIdWithRelations(id);
|
|
|
-=======
|
|
|
- return baseMapper.selectVoById(id);
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -88,12 +80,8 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
@Override
|
|
|
public TableDataInfo<JcbtScholarshipApplicationVo> queryPageList(JcbtScholarshipApplicationBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<JcbtScholarshipApplication> lqw = buildQueryWrapper(bo);
|
|
|
-<<<<<<< HEAD
|
|
|
// 使用自定义分页查询(包含关联表信息)
|
|
|
Page<JcbtScholarshipApplicationVo> result = baseMapper.selectJcbtScholarshipApplicationPage(pageQuery.build(), lqw);
|
|
|
-=======
|
|
|
- Page<JcbtScholarshipApplicationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
|
@@ -111,16 +99,11 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
LambdaQueryWrapper<JcbtScholarshipApplication> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.eq(ObjectUtil.isNotNull(bo.getBatchId()), JcbtScholarshipApplication::getBatchId, bo.getBatchId());
|
|
|
lqw.eq(ObjectUtil.isNotNull(bo.getScholarshipTypeId()), JcbtScholarshipApplication::getScholarshipTypeId, bo.getScholarshipTypeId());
|
|
|
-<<<<<<< HEAD
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getStudentNo()), JcbtScholarshipApplication::getStudentNo, bo.getStudentNo());
|
|
|
-=======
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getStudentCode()), JcbtScholarshipApplication::getStudentCode, bo.getStudentCode());
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getStudentName()), JcbtScholarshipApplication::getStudentName, bo.getStudentName());
|
|
|
lqw.eq(ObjectUtil.isNotNull(bo.getStudentId()), JcbtScholarshipApplication::getStudentId, bo.getStudentId());
|
|
|
lqw.eq(ObjectUtil.isNotNull(bo.getDeptId()), JcbtScholarshipApplication::getDeptId, bo.getDeptId());
|
|
|
lqw.eq(ObjectUtil.isNotNull(bo.getClassId()), JcbtScholarshipApplication::getClassId, bo.getClassId());
|
|
|
-<<<<<<< HEAD
|
|
|
// 已删除 applicantType 和 applicantId 字段
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), JcbtScholarshipApplication::getCurrentStatus, bo.getStatus());
|
|
|
// 支持前端 applicationStatus 查询参数
|
|
|
@@ -129,14 +112,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
JcbtScholarshipApplication::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
|
|
// 注意:排序在XML中处理,避免SQL语法错误
|
|
|
// lqw.orderByDesc(JcbtScholarshipApplication::getCreateTime);
|
|
|
-=======
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getApplicantType()), JcbtScholarshipApplication::getApplicantType, bo.getApplicantType());
|
|
|
- lqw.eq(ObjectUtil.isNotNull(bo.getApplicantId()), JcbtScholarshipApplication::getApplicantId, bo.getApplicantId());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getStatus()), JcbtScholarshipApplication::getStatus, bo.getStatus());
|
|
|
- lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
|
|
- JcbtScholarshipApplication::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
|
|
- lqw.orderByDesc(JcbtScholarshipApplication::getCreateTime);
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
return lqw;
|
|
|
}
|
|
|
|
|
|
@@ -152,7 +127,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
throw new RuntimeException((String) eligibilityCheck.get("message"));
|
|
|
}
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
JcbtScholarshipApplication add = MapstructUtils.convert(bo, JcbtScholarshipApplication.class);
|
|
|
validEntityBeforeSave(add);
|
|
|
|
|
|
@@ -167,23 +141,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
}
|
|
|
if (StringUtils.isBlank(add.getApplicationType())) {
|
|
|
add.setApplicationType("TEACHER_RECOMMEND"); // 默认为教师推荐类型
|
|
|
-=======
|
|
|
- JcbtScholarshipApplication add = BeanUtil.toBean(bo, JcbtScholarshipApplication.class);
|
|
|
- validEntityBeforeSave(add);
|
|
|
-
|
|
|
- // 设置默认值
|
|
|
- if (StringUtils.isBlank(add.getStatus())) {
|
|
|
- add.setStatus("DRAFT");
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(add.getApplicantType())) {
|
|
|
- add.setApplicantType("TEACHER");
|
|
|
- }
|
|
|
- if (add.getRequireMaterials() == null) {
|
|
|
- add.setRequireMaterials(0);
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(add.getMaterialStatus())) {
|
|
|
- add.setMaterialStatus("PENDING");
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
}
|
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
@@ -199,7 +156,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean updateByBo(JcbtScholarshipApplicationBo bo) {
|
|
|
-<<<<<<< HEAD
|
|
|
log.info("🔍 [DEBUG] Service.updateByBo 开始执行");
|
|
|
log.info("🔍 [DEBUG] 接收到的BO对象: {}", bo);
|
|
|
log.info("🔍 [DEBUG] BO关键字段检查:");
|
|
|
@@ -210,7 +166,7 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
log.info(" - currentStatus: {}", bo.getCurrentStatus());
|
|
|
log.info(" - batchId: {}", bo.getBatchId());
|
|
|
log.info(" - scholarshipTypeId: {}", bo.getScholarshipTypeId());
|
|
|
-
|
|
|
+
|
|
|
try {
|
|
|
JcbtScholarshipApplication update = MapstructUtils.convert(bo, JcbtScholarshipApplication.class);
|
|
|
log.info("🔍 [DEBUG] 转换后的Entity对象: {}", update);
|
|
|
@@ -221,15 +177,15 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
log.info(" - currentStatus: {}", update.getCurrentStatus());
|
|
|
log.info(" - batchId: {}", update.getBatchId());
|
|
|
log.info(" - scholarshipTypeId: {}", update.getScholarshipTypeId());
|
|
|
-
|
|
|
+
|
|
|
log.info("🔍 [DEBUG] 开始执行数据校验");
|
|
|
validEntityBeforeSave(update);
|
|
|
log.info("🔍 [DEBUG] 数据校验通过");
|
|
|
-
|
|
|
+
|
|
|
log.info("🔍 [DEBUG] 开始执行数据库更新");
|
|
|
boolean result = baseMapper.updateById(update) > 0;
|
|
|
log.info("🔍 [DEBUG] 数据库更新结果: {}", result);
|
|
|
-
|
|
|
+
|
|
|
return result;
|
|
|
} catch (Exception e) {
|
|
|
log.error("❌ [ERROR] Service.updateByBo 执行异常", e);
|
|
|
@@ -237,62 +193,41 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
log.error("❌ [ERROR] 异常消息: {}", e.getMessage());
|
|
|
throw e;
|
|
|
}
|
|
|
-=======
|
|
|
- JcbtScholarshipApplication update = BeanUtil.toBean(bo, JcbtScholarshipApplication.class);
|
|
|
- validEntityBeforeSave(update);
|
|
|
- return baseMapper.updateById(update) > 0;
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存前的数据校验
|
|
|
*/
|
|
|
private void validEntityBeforeSave(JcbtScholarshipApplication entity) {
|
|
|
-<<<<<<< HEAD
|
|
|
log.info("🔍 [DEBUG] validEntityBeforeSave 开始执行");
|
|
|
log.info("🔍 [DEBUG] 待校验的Entity: {}", entity);
|
|
|
-
|
|
|
+
|
|
|
// 数据校验逻辑
|
|
|
log.info("🔍 [DEBUG] 校验学生学号: {}", entity.getStudentNo());
|
|
|
if (StringUtils.isBlank(entity.getStudentNo())) {
|
|
|
log.error("❌ [ERROR] 学生学号为空!");
|
|
|
throw new RuntimeException("学生学号不能为空");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
log.info("🔍 [DEBUG] 校验学生姓名: {}", entity.getStudentName());
|
|
|
if (StringUtils.isBlank(entity.getStudentName())) {
|
|
|
log.error("❌ [ERROR] 学生姓名为空!");
|
|
|
throw new RuntimeException("学生姓名不能为空");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
log.info("🔍 [DEBUG] 校验批次ID: {}", entity.getBatchId());
|
|
|
if (entity.getBatchId() == null) {
|
|
|
log.error("❌ [ERROR] 批次ID为空!");
|
|
|
throw new RuntimeException("批次ID不能为空");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
log.info("🔍 [DEBUG] 校验奖学金类型ID: {}", entity.getScholarshipTypeId());
|
|
|
if (entity.getScholarshipTypeId() == null) {
|
|
|
log.error("❌ [ERROR] 奖学金类型ID为空!");
|
|
|
throw new RuntimeException("奖学金类型ID不能为空");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
log.info("🔍 [DEBUG] validEntityBeforeSave 校验完成");
|
|
|
-=======
|
|
|
- // 数据校验逻辑
|
|
|
- if (StringUtils.isBlank(entity.getStudentCode())) {
|
|
|
- throw new RuntimeException("学生学号不能为空");
|
|
|
- }
|
|
|
- if (StringUtils.isBlank(entity.getStudentName())) {
|
|
|
- throw new RuntimeException("学生姓名不能为空");
|
|
|
- }
|
|
|
- if (entity.getBatchId() == null) {
|
|
|
- throw new RuntimeException("批次ID不能为空");
|
|
|
- }
|
|
|
- if (entity.getScholarshipTypeId() == null) {
|
|
|
- throw new RuntimeException("奖学金类型ID不能为空");
|
|
|
- }
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -305,11 +240,7 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
// 删除前校验逻辑
|
|
|
for (Long id : ids) {
|
|
|
JcbtScholarshipApplicationVo application = queryById(id);
|
|
|
-<<<<<<< HEAD
|
|
|
if (application != null && "APPROVED".equals(application.getCurrentStatus())) {
|
|
|
-=======
|
|
|
- if (application != null && "APPROVED".equals(application.getStatus())) {
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
throw new RuntimeException("已通过审核的申请不能删除");
|
|
|
}
|
|
|
}
|
|
|
@@ -324,7 +255,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean batchSubmitApplicationsByTeacher(Long batchId, Long scholarshipTypeId, Long classId,
|
|
|
List<JcbtScholarshipApplicationBo> studentApplications) {
|
|
|
-<<<<<<< HEAD
|
|
|
// 检查班级名额 - 使用和前端一致的查询方法
|
|
|
log.info("开始检查班级名额 - 批次ID: {}, 奖学金类型ID: {}, 班级ID: {}, 申请人数: {}",
|
|
|
batchId, scholarshipTypeId, classId, studentApplications.size());
|
|
|
@@ -358,12 +288,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
log.error("全校名额不足 - 可用名额: {}, 申请人数: {}", totalAvailable, studentApplications.size());
|
|
|
throw new RuntimeException("全校可用名额不足,无法提交申请");
|
|
|
}
|
|
|
-=======
|
|
|
- // 检查班级名额
|
|
|
- JcbtScholarshipClassQuotaVo classQuota = classQuotaService.queryAvailableQuota(classId, scholarshipTypeId, batchId);
|
|
|
- if (classQuota == null || classQuota.getAvailableQuota() < studentApplications.size()) {
|
|
|
- throw new RuntimeException("班级可用名额不足,无法提交申请");
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
}
|
|
|
|
|
|
// 批量创建申请记录
|
|
|
@@ -371,18 +295,13 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
applicationBo.setBatchId(batchId);
|
|
|
applicationBo.setScholarshipTypeId(scholarshipTypeId);
|
|
|
applicationBo.setClassId(classId);
|
|
|
-<<<<<<< HEAD
|
|
|
applicationBo.setApplicationType("TEACHER_RECOMMEND"); // 班主任代申请属于教师推荐类型
|
|
|
-=======
|
|
|
- applicationBo.setApplicantType("TEACHER");
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
applicationBo.setStatus("SUBMITTED");
|
|
|
applicationBo.setSubmitTime(new Date());
|
|
|
|
|
|
insertByBo(applicationBo);
|
|
|
}
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
// 更新名额使用情况
|
|
|
if (classQuota != null) {
|
|
|
// 有班级名额分配,更新班级名额
|
|
|
@@ -407,12 +326,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-=======
|
|
|
- // 更新班级名额使用情况
|
|
|
- classQuotaService.updateQuotaUsage(classQuota.getId(),
|
|
|
- classQuota.getUsedQuota() + studentApplications.size(),
|
|
|
- classQuota.getAvailableQuota() - studentApplications.size());
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -422,13 +335,9 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
*/
|
|
|
@Override
|
|
|
public List<JcbtScholarshipApplicationVo> queryApplicationsByApplicant(Long applicantId, Long batchId) {
|
|
|
-<<<<<<< HEAD
|
|
|
// TODO: 重新设计查询逻辑,因为applicantId字段已删除
|
|
|
// 可能需要通过班级ID或其他方式查询班主任负责的申请记录
|
|
|
return new ArrayList<>();
|
|
|
-=======
|
|
|
- return baseMapper.selectApplicationsByApplicant(applicantId, batchId);
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -488,19 +397,11 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
if (application == null) {
|
|
|
throw new RuntimeException("申请记录不存在");
|
|
|
}
|
|
|
-<<<<<<< HEAD
|
|
|
if (!"DRAFT".equals(application.getCurrentStatus())) {
|
|
|
throw new RuntimeException("只有草稿状态的申请才能提交");
|
|
|
}
|
|
|
|
|
|
application.setCurrentStatus("SUBMITTED");
|
|
|
-=======
|
|
|
- if (!"DRAFT".equals(application.getStatus())) {
|
|
|
- throw new RuntimeException("只有草稿状态的申请才能提交");
|
|
|
- }
|
|
|
-
|
|
|
- application.setStatus("SUBMITTED");
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
application.setSubmitTime(new Date());
|
|
|
return baseMapper.updateById(application) > 0;
|
|
|
}
|
|
|
@@ -515,21 +416,12 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
if (application == null) {
|
|
|
throw new RuntimeException("申请记录不存在");
|
|
|
}
|
|
|
-<<<<<<< HEAD
|
|
|
if ("APPROVED".equals(application.getCurrentStatus()) || "REJECTED".equals(application.getCurrentStatus())) {
|
|
|
throw new RuntimeException("已审核的申请不能撤回");
|
|
|
}
|
|
|
|
|
|
application.setCurrentStatus("WITHDRAWN");
|
|
|
// 已删除 remark 字段,撤回原因暂时不存储
|
|
|
-=======
|
|
|
- if ("APPROVED".equals(application.getStatus()) || "REJECTED".equals(application.getStatus())) {
|
|
|
- throw new RuntimeException("已审核的申请不能撤回");
|
|
|
- }
|
|
|
-
|
|
|
- application.setStatus("WITHDRAWN");
|
|
|
- application.setRemark(StringUtils.isNotBlank(reason) ? reason : "申请人主动撤回");
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
return baseMapper.updateById(application) > 0;
|
|
|
}
|
|
|
|
|
|
@@ -779,11 +671,7 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
List<Map<String, Object>> students = new ArrayList<>();
|
|
|
|
|
|
try {
|
|
|
-<<<<<<< HEAD
|
|
|
// 使用自包含查询获取学生列表,关联班级表获取学院和专业信息
|
|
|
-=======
|
|
|
- // 使用自包含查询获取学生列表
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
String sql = """
|
|
|
SELECT
|
|
|
sm.id,
|
|
|
@@ -792,7 +680,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
sm.gender,
|
|
|
sm.phone,
|
|
|
sm.email,
|
|
|
-<<<<<<< HEAD
|
|
|
sm.student_status,
|
|
|
cm.college_id,
|
|
|
cm.college_name,
|
|
|
@@ -806,13 +693,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
AND sm.deleted = 0
|
|
|
AND sm.student_status = '1'
|
|
|
AND (cm.deleted IS NULL OR cm.deleted = 0)
|
|
|
-=======
|
|
|
- sm.student_status
|
|
|
- FROM xg_student_msg sm
|
|
|
- WHERE sm.class_id = ?
|
|
|
- AND sm.deleted = 0
|
|
|
- AND sm.student_status = '1'
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
ORDER BY sm.student_no ASC
|
|
|
""";
|
|
|
|
|
|
@@ -836,8 +716,7 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
studentMap.put("phone", student.get("phone") != null ? student.get("phone").toString() : "");
|
|
|
studentMap.put("email", student.get("email") != null ? student.get("email").toString() : "");
|
|
|
studentMap.put("status", student.get("student_status") != null ? student.get("student_status").toString() : "1");
|
|
|
-<<<<<<< HEAD
|
|
|
-
|
|
|
+
|
|
|
// 添加学院和专业信息
|
|
|
studentMap.put("collegeId", student.get("college_id") != null ? student.get("college_id").toString() : "");
|
|
|
studentMap.put("collegeName", student.get("college_name") != null ? student.get("college_name").toString() : "");
|
|
|
@@ -845,9 +724,7 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
studentMap.put("majorName", student.get("major_name") != null ? student.get("major_name").toString() : "");
|
|
|
studentMap.put("className", student.get("class_name") != null ? student.get("class_name").toString() : "");
|
|
|
studentMap.put("grade", student.get("grade") != null ? student.get("grade").toString() : "");
|
|
|
-
|
|
|
-=======
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
+
|
|
|
students.add(studentMap);
|
|
|
}
|
|
|
log.info("成功获取班级学生列表 - 班级ID: {}, 学生数量: {}", classId, students.size());
|
|
|
@@ -932,12 +809,8 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
List<Map<String, Object>> scholarshipTypes = new ArrayList<>();
|
|
|
|
|
|
try {
|
|
|
-<<<<<<< HEAD
|
|
|
log.info("=== 开始获取带名额信息的奖学金类型 ===");
|
|
|
log.info("输入参数 - 批次ID: {}, 班级ID: {}", batchId, classId);
|
|
|
-=======
|
|
|
- log.info("获取带名额信息的奖学金类型,批次ID: {}, 班级ID: {}", batchId, classId);
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
|
|
|
// 获取该批次关联的所有奖学金类型ID(从批次类型关联表)
|
|
|
List<Long> batchTypeIds = batchTypeService.getScholarshipTypeIdsByBatchId(batchId);
|
|
|
@@ -945,7 +818,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
|
|
|
if (batchTypeIds != null && !batchTypeIds.isEmpty()) {
|
|
|
for (Long scholarshipTypeId : batchTypeIds) {
|
|
|
-<<<<<<< HEAD
|
|
|
log.info("--- 处理奖学金类型ID: {} ---", scholarshipTypeId);
|
|
|
|
|
|
// 查询奖学金类型基本信息
|
|
|
@@ -955,10 +827,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
typeInfo.getId(), typeInfo.getTypeName(), typeInfo.getStatus(),
|
|
|
typeInfo.getAwardAmount(), typeInfo.getLevelType()) : "null");
|
|
|
|
|
|
-=======
|
|
|
- // 查询奖学金类型基本信息
|
|
|
- JcbtScholarshipTypeVo typeInfo = scholarshipTypeService.queryById(scholarshipTypeId);
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
if (typeInfo != null && typeInfo.getStatus() == 1) { // 只返回启用的类型
|
|
|
Map<String, Object> scholarshipType = new HashMap<>();
|
|
|
scholarshipType.put("id", scholarshipTypeId);
|
|
|
@@ -968,7 +836,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
scholarshipType.put("typeCategory", typeInfo.getTypeCategory());
|
|
|
scholarshipType.put("levelType", typeInfo.getLevelType());
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
// 查询该班级在该奖学金类型下的名额分配信息(从jcbt_scholarship_quota表查询)
|
|
|
log.info("开始查询班级名额 - SQL参数: classId={}, scholarshipTypeId={}, batchId={}", classId, scholarshipTypeId, batchId);
|
|
|
log.info("执行SQL: SELECT * FROM jcbt_scholarship_quota WHERE allocation_level = 'CLASS' AND target_dept_id = {} AND scholarship_type_id = {} AND batch_id = {} AND status = 'ACTIVE'", classId, scholarshipTypeId, batchId);
|
|
|
@@ -982,14 +849,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
if (classQuota != null) {
|
|
|
// 有班级名额分配
|
|
|
log.info("发现班级名额分配,处理班级名额数据");
|
|
|
-=======
|
|
|
- // 查询该班级在该奖学金类型下的名额分配信息
|
|
|
- JcbtScholarshipClassQuotaVo classQuota = classQuotaService.queryAvailableQuota(classId, scholarshipTypeId, batchId);
|
|
|
- log.debug("班级名额查询结果,类型ID: {}, 班级ID: {}, 名额信息: {}", scholarshipTypeId, classId, classQuota);
|
|
|
-
|
|
|
- if (classQuota != null) {
|
|
|
- // 有班级名额分配
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
scholarshipType.put("hasQuota", true);
|
|
|
int totalQuota = classQuota.getTotalQuota() != null ? classQuota.getTotalQuota() : 0;
|
|
|
int usedQuota = classQuota.getUsedQuota() != null ? classQuota.getUsedQuota() : 0;
|
|
|
@@ -1000,7 +859,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
scholarshipType.put("availableQuota", availableQuota);
|
|
|
scholarshipType.put("quotaStatus", availableQuota > 0 ? "available" : "full");
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
log.info("班级名额处理结果 - 类型: {}, 总名额: {}, 已用: {}, 可用: {}, 状态: {}",
|
|
|
typeInfo.getTypeName(), totalQuota, usedQuota, availableQuota, availableQuota > 0 ? "available" : "full");
|
|
|
} else {
|
|
|
@@ -1020,13 +878,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-=======
|
|
|
- log.debug("类型: {}, 总名额: {}, 已用: {}, 可用: {}, 状态: {}",
|
|
|
- typeInfo.getTypeName(), totalQuota, usedQuota, availableQuota, availableQuota > 0 ? "available" : "full");
|
|
|
- } else {
|
|
|
- // 没有班级名额分配,查询全校统计信息
|
|
|
- List<JcbtScholarshipQuotaVo> quotaList = quotaService.queryListByBatchAndType(batchId, scholarshipTypeId);
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
int totalQuota = quotaList.stream().mapToInt(q -> q.getTotalQuota() != null ? q.getTotalQuota() : 0).sum();
|
|
|
int usedQuota = quotaList.stream().mapToInt(q -> q.getUsedQuota() != null ? q.getUsedQuota() : 0).sum();
|
|
|
int availableQuota = Math.max(0, totalQuota - usedQuota);
|
|
|
@@ -1037,23 +888,16 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
scholarshipType.put("availableQuota", availableQuota);
|
|
|
scholarshipType.put("quotaStatus", totalQuota > 0 ? (availableQuota > 0 ? "available" : "full") : "unlimited");
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
log.info("全校名额统计结果 - 类型: {} (全校), 总名额: {}, 已用: {}, 可用: {}, 状态: {}",
|
|
|
-=======
|
|
|
- log.debug("类型: {} (全校), 总名额: {}, 已用: {}, 可用: {}, 状态: {}",
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
typeInfo.getTypeName(), totalQuota, usedQuota, availableQuota,
|
|
|
totalQuota > 0 ? (availableQuota > 0 ? "available" : "full") : "unlimited");
|
|
|
}
|
|
|
|
|
|
scholarshipTypes.add(scholarshipType);
|
|
|
-<<<<<<< HEAD
|
|
|
log.info("奖学金类型 {} 处理完成,添加到结果列表", typeInfo.getTypeName());
|
|
|
} else {
|
|
|
log.warn("奖学金类型被跳过 - ID: {}, 原因: {}", scholarshipTypeId,
|
|
|
typeInfo == null ? "类型信息不存在" : "状态未启用(status=" + typeInfo.getStatus() + ")");
|
|
|
-=======
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1079,7 +923,6 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
return levelA != null ? levelA.compareTo(levelB) : 0;
|
|
|
});
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
log.info("=== 最终返回结果 ===");
|
|
|
log.info("奖学金类型总数: {}", scholarshipTypes.size());
|
|
|
for (int i = 0; i < scholarshipTypes.size(); i++) {
|
|
|
@@ -1089,26 +932,18 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
}
|
|
|
} else {
|
|
|
log.warn("批次 {} 未关联任何奖学金类型", batchId);
|
|
|
-=======
|
|
|
- log.info("最终返回的奖学金类型数量: {}", scholarshipTypes.size());
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
}
|
|
|
|
|
|
return scholarshipTypes;
|
|
|
} catch (Exception e) {
|
|
|
-<<<<<<< HEAD
|
|
|
log.error("=== 获取带名额信息的奖学金类型失败 ===");
|
|
|
log.error("错误参数 - 批次ID: {}, 班级ID: {}", batchId, classId);
|
|
|
log.error("错误详情: ", e);
|
|
|
-=======
|
|
|
- log.error("获取带名额信息的奖学金类型失败,批次ID: {}, 班级ID: {}", batchId, classId, e);
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
// 如果调用失败,返回空数据
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
/**
|
|
|
* 测试班级名额查询(用于SQL日志调试)
|
|
|
*/
|
|
|
@@ -1322,6 +1157,4 @@ public class JcbtScholarshipApplicationServiceImpl implements IJcbtScholarshipAp
|
|
|
return "JX" + dateStr + randomNum;
|
|
|
}
|
|
|
|
|
|
-=======
|
|
|
->>>>>>> 4b9dbe40fb94a83d379f7d16211dec6d78c23755
|
|
|
}
|