学工系统功能房功能模块功能修改
-修改预约记录导出字段(借用学期) -为详情统计添加部门多选查询
This commit is contained in:
@@ -8,6 +8,7 @@ import com.srs.common.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import liquibase.pro.packaged.Y;
|
||||
import lombok.*;
|
||||
import com.srs.common.core.domain.BaseEntity;
|
||||
|
||||
@@ -92,6 +93,13 @@ private static final long serialVersionUID=1L;
|
||||
@Excel(name = "预约用途")
|
||||
private String rtPurpose;
|
||||
|
||||
/**
|
||||
* 借用学期
|
||||
*/
|
||||
@ApiModelProperty("借用学期")
|
||||
@Excel(name = "借用学期")
|
||||
private String yearName;
|
||||
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
|
||||
@@ -101,7 +101,7 @@ public interface SrsStaffOneStopRegistrationRecordMapper extends BaseMapper<SrsS
|
||||
@Param("role") String role,
|
||||
@Param("borrower") String borrower,
|
||||
@Param("auditStatus") Integer auditStatus,
|
||||
@Param("rtDepar") String rtDepar
|
||||
@Param("rtDepar") List<String> rtDepar
|
||||
);
|
||||
|
||||
List<Map<String, Object>> getRoomReservationCount(
|
||||
@@ -110,7 +110,7 @@ public interface SrsStaffOneStopRegistrationRecordMapper extends BaseMapper<SrsS
|
||||
@Param("role") String role,
|
||||
@Param("borrower") String borrower,
|
||||
@Param("auditStatus") Integer auditStatus,
|
||||
@Param("rtDepar") String rtDepar
|
||||
@Param("rtDepar") List<String> rtDepar
|
||||
);
|
||||
|
||||
List<Map<String, Object>> getDepartmentUsageStatistics(
|
||||
@@ -119,7 +119,7 @@ public interface SrsStaffOneStopRegistrationRecordMapper extends BaseMapper<SrsS
|
||||
@Param("role") String role,
|
||||
@Param("borrower") String borrower,
|
||||
@Param("auditStatus") Integer auditStatus,
|
||||
@Param("rtDepar") String rtDepar
|
||||
@Param("rtDepar") List<String> rtDepar
|
||||
);
|
||||
|
||||
List<Map<String, Object>> getRoomUsageStatistics(
|
||||
@@ -128,7 +128,7 @@ public interface SrsStaffOneStopRegistrationRecordMapper extends BaseMapper<SrsS
|
||||
@Param("role") String role,
|
||||
@Param("borrower") String borrower,
|
||||
@Param("auditStatus") Integer auditStatus,
|
||||
@Param("rtDepar") String rtDepar
|
||||
@Param("rtDepar") List<String> rtDepar
|
||||
);
|
||||
|
||||
int updateAuditStatusToPending(@Param("id") Integer id);
|
||||
|
||||
@@ -82,13 +82,13 @@ public interface ISrsStaffOneStopRegistrationRecordService extends IService<SrsS
|
||||
*/
|
||||
int deleteSrsStaffOneStopRegistrationRecordByRecordId(Long recordId);
|
||||
|
||||
public List<Map<String, Object>> getDepartmentReservationCount(String startTime,String endTime,String role,String borrower,Integer auditStatus,String rtDepar);
|
||||
public List<Map<String, Object>> getDepartmentReservationCount(String startTime,String endTime,String role,String borrower,Integer auditStatus,List<String> rtDepar);
|
||||
|
||||
public List<Map<String, Object>> getRoomReservationCount(String startTime,String endTime,String role,String borrower,Integer auditStatus,String rtDepar);
|
||||
public List<Map<String, Object>> getRoomReservationCount(String startTime,String endTime,String role,String borrower,Integer auditStatus,List<String> rtDepar);
|
||||
|
||||
public List<Map<String, Object>> getDepartmentUsageStatistics(String startTime,String endTime,String role,String borrower,Integer auditStatus,String rtDepar);
|
||||
public List<Map<String, Object>> getDepartmentUsageStatistics(String startTime,String endTime,String role,String borrower,Integer auditStatus,List<String> rtDepar);
|
||||
|
||||
public List<Map<String, Object>> getRoomUsageStatistics(String startTime,String endTime,String role,String borrower,Integer auditStatus,String rtDepar);
|
||||
public List<Map<String, Object>> getRoomUsageStatistics(String startTime,String endTime,String role,String borrower,Integer auditStatus,List<String> rtDepar);
|
||||
|
||||
int resetAuditStatus(Integer id);
|
||||
|
||||
|
||||
@@ -260,22 +260,22 @@ public class SrsStaffOneStopRegistrationRecordServiceImpl extends ServiceImpl<Sr
|
||||
}
|
||||
|
||||
// 统计各部门预约功能房数量
|
||||
public List<Map<String, Object>> getDepartmentReservationCount(String startTime,String endTime,String role,String borrower,Integer auditStatus,String rtDepar) {
|
||||
public List<Map<String, Object>> getDepartmentReservationCount(String startTime,String endTime,String role,String borrower,Integer auditStatus,List<String> rtDepar) {
|
||||
return srsStaffOneStopRegistrationRecordMapper.getDepartmentUsage(startTime,endTime,role,borrower,auditStatus,rtDepar);
|
||||
}
|
||||
|
||||
// 统计各个功能房的预约数量
|
||||
public List<Map<String, Object>> getRoomReservationCount(String startTime,String endTime,String role,String borrower,Integer auditStatus,String rtDepar) {
|
||||
public List<Map<String, Object>> getRoomReservationCount(String startTime,String endTime,String role,String borrower,Integer auditStatus,List<String> rtDepar) {
|
||||
return srsStaffOneStopRegistrationRecordMapper.getRoomReservationCount(startTime,endTime,role,borrower,auditStatus,rtDepar);
|
||||
}
|
||||
|
||||
// 统计各部门功能房使用情况
|
||||
public List<Map<String, Object>> getDepartmentUsageStatistics(String startTime,String endTime,String role,String borrower,Integer auditStatus,String rtDepar) {
|
||||
public List<Map<String, Object>> getDepartmentUsageStatistics(String startTime,String endTime,String role,String borrower,Integer auditStatus,List<String> rtDepar) {
|
||||
return srsStaffOneStopRegistrationRecordMapper.getDepartmentUsageStatistics(startTime,endTime,role,borrower,auditStatus,rtDepar);
|
||||
}
|
||||
|
||||
// 统计各个功能房使用情况
|
||||
public List<Map<String, Object>> getRoomUsageStatistics(String startTime,String endTime,String role,String borrower,Integer auditStatus,String rtDepar) {
|
||||
public List<Map<String, Object>> getRoomUsageStatistics(String startTime,String endTime,String role,String borrower,Integer auditStatus,List<String> rtDepar) {
|
||||
return srsStaffOneStopRegistrationRecordMapper.getRoomUsageStatistics(startTime,endTime,role,borrower,auditStatus,rtDepar);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,19 @@ import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.TextStyle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.srs.common.exception.ServiceException;
|
||||
import com.srs.common.utils.DateUtils;
|
||||
import com.srs.common.utils.SecurityUtils;
|
||||
import com.srs.comprehensive.domain.SrsStuYear;
|
||||
import com.srs.comprehensive.domain.Vo.StuYearIdName;
|
||||
import com.srs.comprehensive.mapper.SrsStuYearMapper;
|
||||
import com.srs.staff.domain.StaffOneStopRoom;
|
||||
import com.srs.staff.domain.StaffOneStopRoomOpeningHours;
|
||||
import com.srs.staff.mapper.StaffOneStopRoomMapper;
|
||||
@@ -39,6 +45,9 @@ public class StaffOneStopRoomReservationServiceImpl extends ServiceImpl<StaffOne
|
||||
|
||||
@Autowired
|
||||
private StaffOneStopRoomMapper staffOneStopRoomMapper;
|
||||
|
||||
@Autowired
|
||||
private SrsStuYearMapper srsStuYearMapper;
|
||||
|
||||
/**
|
||||
* 查询一站式社区-功能房-预约记录
|
||||
@@ -51,6 +60,7 @@ public class StaffOneStopRoomReservationServiceImpl extends ServiceImpl<StaffOne
|
||||
return staffOneStopRoomReservationMapper.selectStaffOneStopRoomReservationByRtId(rtId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<StaffOneStopRoomOpeningHours> selectStaffOneStopRoomReservationByRtTime(String roomNo ,String rtTime) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
@@ -95,8 +105,70 @@ public class StaffOneStopRoomReservationServiceImpl extends ServiceImpl<StaffOne
|
||||
*/
|
||||
@Override
|
||||
public List<StaffOneStopRoomReservation> selectStaffOneStopRoomReservationList(StaffOneStopRoomReservation staffOneStopRoomReservation) {
|
||||
return staffOneStopRoomReservationMapper.selectStaffOneStopRoomReservationList(staffOneStopRoomReservation);
|
||||
List<StaffOneStopRoomReservation> list = staffOneStopRoomReservationMapper.selectStaffOneStopRoomReservationList(staffOneStopRoomReservation);
|
||||
|
||||
// 查询所有学年数据用于匹配
|
||||
List<SrsStuYear> allYears = srsStuYearMapper.selectSrsStuYearList(new SrsStuYear());
|
||||
|
||||
for (StaffOneStopRoomReservation reservation : list) {
|
||||
// 根据预约时间确定学年
|
||||
if (reservation.getRtTime() != null && !reservation.getRtTime().isEmpty()) {
|
||||
String yearName = determineSchoolYearByTime(reservation.getRtTime(), allYears);
|
||||
reservation.setYearName(yearName);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据预约时间确定所属学年
|
||||
*
|
||||
* @param rtTime 预约时间
|
||||
* @param allYears 所有学年数据
|
||||
* @return 学年名称
|
||||
*/
|
||||
private String determineSchoolYearByTime(String rtTime, List<SrsStuYear> allYears) {
|
||||
try {
|
||||
// 解析预约时间
|
||||
Date reservationDate = null;
|
||||
// 尝试解析不同的日期格式
|
||||
if (rtTime.length() == 10) { // "yyyy-MM-dd" 格式
|
||||
reservationDate = DateUtils.parseDate(rtTime, "yyyy-MM-dd");
|
||||
} else if (rtTime.length() == 7) { // "yyyy-MM" 格式
|
||||
reservationDate = DateUtils.parseDate(rtTime + "-01", "yyyy-MM-dd");
|
||||
} else if (rtTime.length() == 4) { // "yyyy" 格式
|
||||
reservationDate = DateUtils.parseDate(rtTime + "-01-01", "yyyy-MM-dd");
|
||||
} else {
|
||||
// 尝试解析其他格式
|
||||
reservationDate = DateUtils.parseDate(rtTime);
|
||||
}
|
||||
|
||||
if (reservationDate == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 遍历所有学年,找到匹配的学年
|
||||
for (SrsStuYear year : allYears) {
|
||||
if (year.getStartTime() != null && year.getEndTime() != null) {
|
||||
// 直接使用学年自身的起始和结束时间进行判断
|
||||
if (reservationDate.compareTo(year.getStartTime()) >= 0 && reservationDate.compareTo(year.getEndTime()) <= 0) {
|
||||
// 截取字符串,去掉"学年"两个字
|
||||
String yearName = year.getStuYearName();
|
||||
if (yearName != null && yearName.endsWith("学年")) {
|
||||
return yearName.substring(0, yearName.length() - 2);
|
||||
}
|
||||
return yearName;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 解析日期失败,返回null
|
||||
System.out.println("解析预约时间失败: " + rtTime + ", 错误: " + e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增一站式社区-功能房-预约记录
|
||||
@@ -158,4 +230,4 @@ public class StaffOneStopRoomReservationServiceImpl extends ServiceImpl<StaffOne
|
||||
public int deleteStaffOneStopRoomReservationByRtId(Long rtId) {
|
||||
return staffOneStopRoomReservationMapper.deleteStaffOneStopRoomReservationByRtId(rtId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,8 +147,11 @@
|
||||
<if test="auditStatus != null">
|
||||
AND audit_status = #{auditStatus}
|
||||
</if>
|
||||
<if test="rtDepar != null">
|
||||
AND rt_depar = #{rtDepar}
|
||||
<if test="rtDepar != null and rtDepar.size() > 0">
|
||||
AND rt_depar IN
|
||||
<foreach collection="rtDepar" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
GROUP BY
|
||||
@@ -182,8 +185,11 @@
|
||||
<if test="auditStatus != null">
|
||||
AND audit_status = #{auditStatus}
|
||||
</if>
|
||||
<if test="rtDepar != null">
|
||||
AND rt_depar = #{rtDepar}
|
||||
<if test="rtDepar != null and rtDepar.size() > 0">
|
||||
AND rt_depar IN
|
||||
<foreach collection="rtDepar" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
room_name
|
||||
@@ -216,8 +222,11 @@
|
||||
<if test="auditStatus != null">
|
||||
AND audit_status = #{auditStatus}
|
||||
</if>
|
||||
<if test="rtDepar != null">
|
||||
AND rt_depar = #{rtDepar}
|
||||
<if test="rtDepar != null and rtDepar.size() > 0">
|
||||
AND rt_depar IN
|
||||
<foreach collection="rtDepar" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
rt_depar
|
||||
@@ -250,8 +259,11 @@
|
||||
<if test="auditStatus != null">
|
||||
AND audit_status = #{auditStatus}
|
||||
</if>
|
||||
<if test="rtDepar != null">
|
||||
AND rt_depar = #{rtDepar}
|
||||
<if test="rtDepar != null and rtDepar.size() > 0">
|
||||
AND rt_depar IN
|
||||
<foreach collection="rtDepar" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
room_name
|
||||
|
||||
Reference in New Issue
Block a user