Compare commits
3 Commits
23aec500b8
...
37df108fb2
| Author | SHA1 | Date | |
|---|---|---|---|
| 37df108fb2 | |||
| 79886171c7 | |||
| edfa4ccd1d |
@@ -28,6 +28,8 @@ public interface DmsManageApplicationMapper extends BaseMapper<DmsManageApplicat
|
||||
*/
|
||||
public DmsManageApplication selectDmsManageApplicationById(Long id);
|
||||
|
||||
public DmsManageApplication selectDmsManageApplicationByStuNO(String stuNO);
|
||||
|
||||
/**
|
||||
* 查询宿舍管理申请列表
|
||||
*
|
||||
@@ -67,4 +69,12 @@ public interface DmsManageApplicationMapper extends BaseMapper<DmsManageApplicat
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteDmsManageApplicationByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据学号查询学生宿舍完整信息
|
||||
*
|
||||
* @param stuNo 学号
|
||||
* @return 学生宿舍完整信息
|
||||
*/
|
||||
DomInfo selectStudentDormitoryInfoByStuNo(String stuNo);
|
||||
}
|
||||
@@ -76,4 +76,11 @@ public interface IDmsManageApplicationService extends IService<DmsManageApplicat
|
||||
int deleteDmsManageApplicationById(Long id);
|
||||
|
||||
public AjaxResult stuDel(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取学生宿舍信息
|
||||
* @param studentNo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getStudentDormitoryInfo(String studentNo);
|
||||
}
|
||||
|
||||
@@ -145,6 +145,44 @@ public class DmsManageApplicationServiceImpl extends ServiceImpl<DmsManageApplic
|
||||
return dmsManageApplicationMapper.selectDmsManageApplicationList(dmsManageApplication);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据学号获取学生当前宿舍信息
|
||||
*
|
||||
* @param studentNo 学号
|
||||
* @return 学生宿舍信息
|
||||
*/
|
||||
public AjaxResult getStudentDormitoryInfo(String studentNo) {
|
||||
try {
|
||||
// 参考现有逻辑中的查询方式
|
||||
QueryWrapper<SrsDormitoryStudent> dormStuQuery = new QueryWrapper<>();
|
||||
dormStuQuery.eq("stu_no", studentNo)
|
||||
.last("limit 1");
|
||||
|
||||
SrsDormitoryStudent dormStu = _dormStuMapper.selectOne(dormStuQuery);
|
||||
if (dormStu == null) {
|
||||
return AjaxResult.error("该学生不在住宿记录表中,可能已退宿");
|
||||
}
|
||||
|
||||
// 获取宿舍详细信息
|
||||
DmsDormitory dormitory = dormitoryMapper.selectById(dormStu.getDormitoryId());
|
||||
if (dormitory == null) {
|
||||
return AjaxResult.error("未找到学生宿舍信息");
|
||||
}
|
||||
|
||||
// 使用新添加的Mapper方法直接获取学生宿舍完整信息
|
||||
DomInfo studentDormInfo = dmsManageApplicationMapper.selectStudentDormitoryInfoByStuNo(studentNo);
|
||||
|
||||
if (studentDormInfo == null) {
|
||||
return AjaxResult.error("未找到该学生的宿舍信息");
|
||||
}
|
||||
|
||||
// 返回学生宿舍完整信息
|
||||
return AjaxResult.success(studentDormInfo);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("查询学生宿舍信息失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增宿舍管理申请
|
||||
*
|
||||
@@ -152,6 +190,84 @@ public class DmsManageApplicationServiceImpl extends ServiceImpl<DmsManageApplic
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insertDmsManageApplication(DmsManageApplication dmsManageApplication) {
|
||||
TransactionDefinition def = new DefaultTransactionDefinition();
|
||||
TransactionStatus status = transactionManager.getTransaction(def);
|
||||
try {
|
||||
String username = getUsername();
|
||||
String userType = dmsManageApplication.getGetBy(); // 获取当前用户类型
|
||||
// 只允许辅导员发起申请
|
||||
if (!"teacher".equals(userType)) {
|
||||
throw new Exception("只有辅导员可以发起宿舍申请");
|
||||
}
|
||||
|
||||
QueryWrapper<SrsDormitoryStudent> dormStuQuery = new QueryWrapper<>();
|
||||
dormStuQuery.eq("stu_no", dmsManageApplication.getStuNo())
|
||||
.last("limit 1");
|
||||
|
||||
SrsDormitoryStudent dormStu = _dormStuMapper.selectOne(dormStuQuery);
|
||||
if (dormStu == null) {
|
||||
throw new Exception("该学生已退宿(不在住宿记录表中)");
|
||||
}
|
||||
|
||||
// 检查该学生是否已存在未完成的申请
|
||||
List<String> isExistStatus = new ArrayList<>();
|
||||
isExistStatus.add("0");
|
||||
isExistStatus.add("1");
|
||||
isExistStatus.add("2");
|
||||
|
||||
QueryWrapper<DmsManageApplication> applyQuery = new QueryWrapper<>();
|
||||
applyQuery.eq("stu_no", dmsManageApplication.getStuNo())
|
||||
.in("status", isExistStatus);
|
||||
|
||||
List<DmsManageApplication> isExist = dmsManageApplicationMapper.selectList(applyQuery);
|
||||
|
||||
if (isExist.size() > 0) {
|
||||
throw new RuntimeException("该学生当前存在未审核完成的流程");
|
||||
}
|
||||
|
||||
QueryWrapper<DmsNewRecord> recordQueryWrapper = new QueryWrapper<>();
|
||||
recordQueryWrapper.eq("stu_no", dmsManageApplication.getStuNo())
|
||||
.orderByDesc("id");
|
||||
List<DmsNewRecord> records = _newRecordMapper.selectList(recordQueryWrapper);
|
||||
|
||||
QueryWrapper<DmsNewTask> taskQuery = new QueryWrapper<>();
|
||||
taskQuery.eq("stu_no", dmsManageApplication.getStuNo())
|
||||
.eq("task_status", "2");
|
||||
List<DmsNewTask> taskList = _taskMapper.selectList(taskQuery);
|
||||
if (taskList.size() != 0) {
|
||||
throw new Exception("该学生当前存在未执行的调宿计划任务,建议调宿任务执行后再申请");
|
||||
}
|
||||
|
||||
if (records.size() == 0) {
|
||||
throw new RuntimeException("该学生没有住宿记录");
|
||||
}
|
||||
|
||||
dmsManageApplication.setCurrentDormId(records.get(0).getRoomId());
|
||||
dmsManageApplication.setCreateTime(getNowDate());
|
||||
// 辅导员发起的申请直接进入下一审批环节(状态为1)
|
||||
dmsManageApplication.setStatus(1L);
|
||||
|
||||
int i1 = dmsManageApplicationMapper.insertDmsManageApplication(dmsManageApplication);
|
||||
DmsApprovalProcess approvalProcess = new DmsApprovalProcess();
|
||||
approvalProcess.setApplyId(dmsManageApplication.getId());
|
||||
approvalProcess.setCreateTime(getNowDate());
|
||||
// 自动设置辅导员审批信息
|
||||
approvalProcess.setFdyTime(getNowDate());
|
||||
approvalProcess.setFdyNo(username);
|
||||
approvalProcess.setFdyStatus("6"); // 辅导员审批通过
|
||||
int i2 = approvalProcessMapper.insert(approvalProcess);
|
||||
if (i1 + i2 != 2) {
|
||||
throw new Exception("操作失败");
|
||||
}
|
||||
transactionManager.commit(status);
|
||||
return AjaxResult.success("宿舍申请已成功发起并通过辅导员审批");
|
||||
} catch (Exception ex) {
|
||||
transactionManager.rollback(status);
|
||||
return AjaxResult.error(ex.getMessage());
|
||||
}
|
||||
}
|
||||
/*@Override
|
||||
public AjaxResult insertDmsManageApplication(DmsManageApplication dmsManageApplication) {
|
||||
TransactionDefinition def = new DefaultTransactionDefinition();
|
||||
TransactionStatus status = transactionManager.getTransaction(def);
|
||||
@@ -218,7 +334,7 @@ public class DmsManageApplicationServiceImpl extends ServiceImpl<DmsManageApplic
|
||||
return AjaxResult.error(ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 修改宿舍管理申请
|
||||
|
||||
@@ -29,6 +29,15 @@
|
||||
<result property="currBuildingId" column="cBuildingId"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="DomInfo" id="StudentDormitoryInfoResult">
|
||||
<result property="stuNo" column="stu_no"/>
|
||||
<result property="stuName" column="stu_name"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="buildingName" column="building_name"/>
|
||||
<result property="roomNo" column="room_no"/>
|
||||
<result property="dormitoryId" column="dormitory_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDmsManageApplicationVo">
|
||||
select id, stu_no, time, current_dorm_id, target_dorm_id, reason, type, status, create_time, create_by, update_time, update_by, start_time, end_time, del_flag from dms_manage_application
|
||||
</sql>
|
||||
@@ -102,6 +111,23 @@
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectStudentDormitoryInfoByStuNo" parameterType="String" resultMap="StudentDormitoryInfoResult">
|
||||
SELECT
|
||||
s.stu_no,
|
||||
s.name AS stu_name,
|
||||
s.gender,
|
||||
db.name AS building_name,
|
||||
d.room_no,
|
||||
d.id AS dormitory_id
|
||||
FROM srs_student s
|
||||
LEFT JOIN srs_dormitory_student ds ON s.stu_no = ds.stu_no
|
||||
LEFT JOIN dms_dormitory d ON ds.dormitory_id = d.id
|
||||
LEFT JOIN dms_dormitory_floor df ON d.floor_id = df.id
|
||||
LEFT JOIN dms_dormitory_building db ON df.building_id = db.id
|
||||
WHERE s.stu_no = #{stuNo}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertDmsManageApplication" parameterType="DmsManageApplication"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into dms_manage_application
|
||||
@@ -199,7 +225,38 @@
|
||||
</where>
|
||||
order by a.id desc
|
||||
</select>
|
||||
|
||||
<select id="selectDmsManageApplicationByStuNO" resultType="com.srs.dormitory.domain.DmsManageApplication">
|
||||
SELECT
|
||||
a.*,
|
||||
s.`name` stu_name,
|
||||
p.fdy_no,
|
||||
p.fdy_status,
|
||||
p.fdy_time,
|
||||
p.work_no,
|
||||
p.work_status,
|
||||
p.work_time,
|
||||
p.final_no,
|
||||
p.final_status,
|
||||
p.final_time,
|
||||
cdor.room_no cRoomNo,
|
||||
cb.`name` cBuilding,
|
||||
cb.id cBuildingId,
|
||||
tdor.room_no tRoomNo,
|
||||
tb.`name` tBuilding,
|
||||
tb.id tBuildingId,
|
||||
s.gender
|
||||
FROM
|
||||
dms_manage_application a
|
||||
LEFT JOIN srs_student s ON a.stu_no = s.stu_no
|
||||
LEFT JOIN dms_approval_process p ON p.apply_id = a.id
|
||||
LEFT JOIN dms_dormitory cdor ON cdor.id = a.current_dorm_id
|
||||
LEFT JOIN dms_dormitory_floor cf ON cf.id = cdor.floor_id
|
||||
LEFT JOIN dms_dormitory_building cb ON cb.id = cf.building_id
|
||||
LEFT JOIN dms_dormitory tdor ON tdor.id = a.target_dorm_id
|
||||
LEFT JOIN dms_dormitory_floor tf ON tf.id = tdor.floor_id
|
||||
LEFT JOIN dms_dormitory_building tb ON tb.id = tf.building_id
|
||||
where s.stu_no = #{stuNo}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -11,12 +11,7 @@ import com.srs.system.service.ISysDeptMapService;
|
||||
import com.srs.system.service.ISysPostService;
|
||||
import com.srs.web.controller.common.RoleBool;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
@@ -64,6 +59,8 @@ public class DmsManageApplicationController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/stuChange")
|
||||
public AjaxResult stuChange(@RequestBody DmsManageApplication param) {
|
||||
return dmsManageApplicationService.stuChange(param);
|
||||
@@ -173,5 +170,15 @@ public class DmsManageApplicationController extends BaseController {
|
||||
return dmsManageApplicationService.stuDel(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据学号获取学生当前宿舍信息
|
||||
*/
|
||||
@GetMapping("/studentDormitoryInfo")
|
||||
@ApiOperation("根据学号获取学生当前宿舍信息")
|
||||
public AjaxResult getStudentDormitoryInfo(@RequestParam String studentNo) {
|
||||
// 调用service层方法获取学生宿舍信息
|
||||
return dmsManageApplicationService.getStudentDormitoryInfo(studentNo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class GraduateTextImpI implements GraduateTextService {
|
||||
* @param graduateStudents 毕业生信息列表
|
||||
* 邵政文
|
||||
* 2025-07-02
|
||||
*/
|
||||
*//*
|
||||
@Override
|
||||
public int addGraduateList(List<GraduateStudentNews> graduateStudents) {
|
||||
int count = 0;
|
||||
@@ -93,7 +93,6 @@ public class GraduateTextImpI implements GraduateTextService {
|
||||
|
||||
// 查询该学生已有的学年信息
|
||||
List<Integer> existingYears = graduateTextMapper.selectStuYearByStudentCode(studentCode);
|
||||
|
||||
// 如果学年信息存在于集合中,则更新子表
|
||||
if (existingYears != null && existingYears.contains(student.getStuYear())) {
|
||||
int updateResult = graduateTextMapper.updateGraduateStudentByGraduateId(student);
|
||||
@@ -120,7 +119,7 @@ public class GraduateTextImpI implements GraduateTextService {
|
||||
if(ress != null) {
|
||||
student.setNation(ress.getMz());
|
||||
}
|
||||
double totalPoints = 0;
|
||||
double totalPoints = 0;//总分
|
||||
if (cphCollegeLook != null) {
|
||||
totalPoints += cphCollegeLook.getIamScore() != null ? Double.parseDouble(cphCollegeLook.getIamScore()) : 0;
|
||||
totalPoints += cphCollegeLook.getStuScore() != null ? Double.parseDouble(cphCollegeLook.getStuScore()) : 0;
|
||||
@@ -143,10 +142,117 @@ public class GraduateTextImpI implements GraduateTextService {
|
||||
count += insertResult;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 添加毕业生信息
|
||||
* @param graduateStudents 毕业生信息列表
|
||||
* 邵政文
|
||||
* 2025-07-02
|
||||
*/
|
||||
@Override
|
||||
public int addGraduateList(List<GraduateStudentNews> graduateStudents) {
|
||||
int count = 0;
|
||||
for (GraduateStudentNews student : graduateStudents) {
|
||||
String studentCode = student.getStudentCode();
|
||||
// 根据学号查询是否已存在该学生信息
|
||||
GraduateStudentNews existingStudent = graduateTextMapper.selectByStudentCode(studentCode);
|
||||
|
||||
if (existingStudent != null) {
|
||||
// 存在,使用现有 id 作为 graduate_id
|
||||
Long graduateId = existingStudent.getId();
|
||||
student.setGraduateId(graduateId.intValue()); // 设置 graduate_id
|
||||
|
||||
// 查询该学生已有的学年信息
|
||||
List<Integer> existingYears = graduateTextMapper.selectStuYearByStudentCode(studentCode);
|
||||
|
||||
// 如果学年信息存在于集合中,则更新子表
|
||||
if (existingYears != null && existingYears.contains(student.getStuYear())) {
|
||||
|
||||
//查询该学生学年分数信息
|
||||
CphCollegeLook cphCollegeLook = graduateTextMapper.selectStudentFnByStuNOAndStuYear(student);
|
||||
// 更新各项成绩字段
|
||||
updateStudentScore(student, cphCollegeLook);
|
||||
|
||||
int updateResult = graduateTextMapper.updateGraduateStudentByGraduateId(student);
|
||||
count += updateResult;
|
||||
} else {
|
||||
// 否则插入子表
|
||||
|
||||
//查询该学生学年分数信息
|
||||
CphCollegeLook cphCollegeLook = graduateTextMapper.selectStudentFnByStuNOAndStuYear(student);
|
||||
// 更新各项成绩字段
|
||||
updateStudentScore(student, cphCollegeLook);
|
||||
|
||||
int insertResult = graduateTextMapper.insertGraduateStudent(student);
|
||||
count += insertResult;
|
||||
}
|
||||
} else {
|
||||
// 不存在,先插入主表 graduate_studentinfo
|
||||
// 查询该学生基本信息
|
||||
ViewStuInfo res = graduateTextMapper.selectStudentByStudentCode(student.getStudentCode());
|
||||
//查询该学生民族信息
|
||||
CphStuExtraInfo ress = graduateTextMapper.selectStudentMZByStudentCode(student.getStudentCode());
|
||||
//查询该学生学年分数信息
|
||||
CphCollegeLook cphCollegeLook = graduateTextMapper.selectStudentFnByStuNOAndStuYear(student);
|
||||
|
||||
student.setStudentCollege(res.getDeptName());
|
||||
student.setStudentGrade(res.getGradeName());
|
||||
student.setStudentClass(res.getClassName());
|
||||
student.setSex(res.getGender());
|
||||
student.setBirthData(res.getBirthday());
|
||||
if(ress != null) {
|
||||
student.setNation(ress.getMz());
|
||||
}
|
||||
|
||||
updateStudentScore(student,cphCollegeLook);
|
||||
|
||||
// 注意:由于 useGeneratedKeys=true,插入后会自动回填 id 到 student.id
|
||||
graduateTextMapper.inserts(student);
|
||||
|
||||
// 获取新生成的 id 并设置为 graduate_id
|
||||
Integer newGraduateId = student.getId().intValue();
|
||||
student.setGraduateId(newGraduateId);
|
||||
|
||||
// 插入子表 graduate_student
|
||||
int insertResult = graduateTextMapper.insertGraduateStudent(student);
|
||||
count += insertResult;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取毕业生成绩列表
|
||||
* @param student 毕业生信息
|
||||
* 邵政文
|
||||
* 2025-07-01
|
||||
*/
|
||||
private void updateStudentScore(GraduateStudentNews student, CphCollegeLook cphCollegeLook){
|
||||
Double totalPoints = null;//当综测成绩为空时,总分设为null而不是0,更符合实际情况
|
||||
if (cphCollegeLook != null) {
|
||||
//直接使用查询到学生学年分数信息中的综测成绩作为总分
|
||||
if (cphCollegeLook.getCphScore() != null && !cphCollegeLook.getCphScore().isEmpty()) {//综测成绩不为空
|
||||
try {
|
||||
totalPoints = Double.parseDouble(cphCollegeLook.getCphScore());//转换为double
|
||||
// 保留两位小数
|
||||
totalPoints = Math.round(totalPoints * 100.0) / 100.0;
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果转换失败,保持totalPoints为null
|
||||
totalPoints = null;
|
||||
}
|
||||
}
|
||||
student.setLdeologicalPolitical(cphCollegeLook.getIamScore());
|
||||
student.setScientificQuality(cphCollegeLook.getStuScore());
|
||||
student.setPhysicalQuality(cphCollegeLook.getSportScore());
|
||||
}
|
||||
//设置总分,如果综测成绩为空则设为null
|
||||
student.setTotalPoints(totalPoints);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据ids批量查询毕业生信息
|
||||
* @return 毕业生信息列表
|
||||
|
||||
@@ -105,10 +105,10 @@
|
||||
</select>
|
||||
|
||||
<select id="rankDis" parameterType="CphSearch" resultType="com.srs.comprehensive.domain.Vo.DataScreen">
|
||||
select concat(t2.`name`,'-班级第',t2.class_rank,'名--专业第',t2.major_rank,"名") as `name`,
|
||||
select concat(t2.`name`,'-班级第',t2.class_rank,'名--专业第',t2.major_rank,'名') as `name`,
|
||||
t2.`value` from
|
||||
(select * from (
|
||||
select concat(c.class_name,"--",b.`name`) as `name` ,a.cph_score as `value`,
|
||||
select concat(c.class_name,'--',b.`name`) as `name` ,a.cph_score as `value`,
|
||||
RANK() OVER(PARTITION BY c.class_id,a.stu_year_id,c.grade_id ORDER BY a.cph_score DESC ) as class_rank,
|
||||
RANK() OVER(PARTITION BY c.major_id,a.stu_year_id,c.grade_id ORDER BY a.cph_score DESC ) as major_rank,
|
||||
c.class_id,
|
||||
|
||||
Reference in New Issue
Block a user