fix(leave/dorm): 打回重提、审批摘要与待办标题优化

修复请假/销假打回后空 flowCode 导致启动失败;审批弹窗展示请假摘要并去掉附件;待办标题短显请假/销假;点名 todaySummary 与楼栋关联脚本一并同步。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
“wuzhen”andCursor committed 2026-10-21 11:24:48 +08:00
1 parent de223a1f5a
commit 15ed3ec9fb
20 files changed
+1136 -320

No files matched your search

@@ -29,9 +29,8 @@ public class StartProcessBo implements Serializable {
private String businessId;
/**
* 流程定义编码
* 流程定义编码(首次启动必填;草稿/退回/撤销后重新提交时实例已存在,可为空)
*/
@NotBlank(message = "流程定义编码不能为空", groups = {AddGroup.class})
private String flowCode;
/**
@@ -126,6 +126,10 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
dto.setTaskId(currentTask.getId());
return dto;
}
// 首次启动必须带流程编码;打回/撤销重提走上面已有实例分支,不依赖 flowCode
if (StringUtils.isBlank(startProcessBo.getFlowCode())) {
throw new ServiceException("流程定义编码不能为空");
}
FlowParams flowParams = FlowParams.build()
.flowCode(startProcessBo.getFlowCode())
.variable(startProcessBo.getVariables())
@@ -39,17 +39,44 @@ public class XgDormRollCallController extends BaseController {
}
/**
* 当前账号当天点名汇总(已/未点名寝室 + 请假/留宿/异常明细)
* 须声明在 /{id} 之前,避免被路径变量吞掉
* 当天点名人数汇总(总人数/已点名人数 + 请假/留宿/异常明细)
*
* @param buildingId 可选;空=全校,有值=指定楼栋
*/
@SaCheckPermission("dormRollCall:dormRollCall:list1")
@GetMapping("/todaySummary")
public R<DormRollCallTodaySummaryVo> todaySummary() {
return R.ok(xgDormRollCallService.queryTodaySummary());
public R<DormRollCallTodaySummaryVo> todaySummary(
@RequestParam(value = "buildingId", required = false) Long buildingId) {
return R.ok(xgDormRollCallService.queryTodaySummary(buildingId));
}
@SaCheckPermission("dormRollCall:dormRollCall:add")
@GetMapping("/generateBatchNo")
public R<String> generateBatchNo() {
return R.ok(xgDormRollCallService.generateBatchNo());
}
@SaCheckPermission("dormRollCall:dormRollCall:list1")
@GetMapping("/buildingRoomsStatus")
public R<List<RoomRollCallStatusVo>> getBuildingRoomsStatus(
@RequestParam("buildingId") Long buildingId,
@RequestParam(value = "batchNo", required = false) String batchNo) {
return R.ok(xgDormRollCallService.getBuildingRoomsStatus(buildingId, batchNo));
}
@SaCheckPermission("dormRollCall:dormRollCall:query")
@GetMapping("/{id}")
@GetMapping("/roomHistory/{roomId}")
public TableDataInfo<XgDormRollCallVo> roomHistory(
@NotNull(message = "房间ID不能为空") @PathVariable("roomId") Long roomId,
PageQuery pageQuery) {
return xgDormRollCallService.queryRoomHistory(roomId, pageQuery);
}
/**
* 详情:id 限制为数字,避免 /todaySummary、/generateBatchNo 等固定路径被当成 id
*/
@SaCheckPermission("dormRollCall:dormRollCall:query")
@GetMapping("/{id:\\d+}")
public R<XgDormRollCallVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) {
return R.ok(xgDormRollCallService.queryById(id));
}
@@ -82,20 +109,6 @@ public class XgDormRollCallController extends BaseController {
ExcelUtil.exportExcel(list, "宿舍点名记录", XgDormRollCallVo.class, response);
}
@SaCheckPermission("dormRollCall:dormRollCall:add")
@GetMapping("/generateBatchNo")
public R<String> generateBatchNo() {
return R.ok(xgDormRollCallService.generateBatchNo());
}
@SaCheckPermission("dormRollCall:dormRollCall:list1")
@GetMapping("/buildingRoomsStatus")
public R<List<RoomRollCallStatusVo>> getBuildingRoomsStatus(
@RequestParam("buildingId") Long buildingId,
@RequestParam(value = "batchNo", required = false) String batchNo) {
return R.ok(xgDormRollCallService.getBuildingRoomsStatus(buildingId, batchNo));
}
@SaCheckPermission("dormRollCall:dormRollCall:add")
@PostMapping("/submit")
@RepeatSubmit()
@@ -106,12 +119,4 @@ public class XgDormRollCallController extends BaseController {
}
return R.fail("提交点名记录失败");
}
@SaCheckPermission("dormRollCall:dormRollCall:query")
@GetMapping("/roomHistory/{roomId}")
public TableDataInfo<XgDormRollCallVo> roomHistory(
@NotNull(message = "房间ID不能为空") @PathVariable("roomId") Long roomId,
PageQuery pageQuery) {
return xgDormRollCallService.queryRoomHistory(roomId, pageQuery);
}
}
@@ -8,7 +8,7 @@ import java.util.ArrayList;
import java.util.List;
/**
* 当前账号当天宿舍点名汇总
* 当天宿舍点名人数汇总(全校或指定楼栋)
*/
@Data
public class DormRollCallTodaySummaryVo implements Serializable {
@@ -16,11 +16,11 @@ public class DormRollCallTodaySummaryVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 已点名寝室数(去重) */
private Integer checkedRoomCount = 0;
/** 总人数:有床位且在住(status=0)学生数 */
private Integer totalStudentCount = 0;
/** 未点名寝室数 */
private Integer uncheckedRoomCount = 0;
/** 已点名人数:本日点名明细中有记录的去重学生数 */
private Integer checkedStudentCount = 0;
/** 请假学生数 */
private Integer leaveCount = 0;
@@ -33,7 +33,10 @@ public interface IXgDormRollCallService {
TableDataInfo<XgDormRollCallVo> queryRoomHistory(Long roomId, PageQuery pageQuery);
/**
* 当前登录账号当天点名汇总(已/未点名寝室 + 请假/留宿/异常明细)
* 当天点名人数汇总(总人数 / 已点名人数 + 请假/留宿/异常明细)。
* <p>
* 总人数 = 有床位且在住学生数;已点名人数 = 本日点名明细有记录的去重学生数。
* buildingId 为空时统计全校;有值时仅统计该楼。
*/
DormRollCallTodaySummaryVo queryTodaySummary();
DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId);
}
@@ -20,18 +20,14 @@ import org.dromara.xg.domain.vo.DormRollCallTodaySummaryVo;
import org.dromara.xg.domain.vo.DormRollCallTodayDetailItemVo;
import org.dromara.xg.domain.XgDormRollCall;
import org.dromara.xg.domain.XgDormRollCallDetail;
import org.dromara.xg.domain.XgDormManager;
import org.dromara.xg.domain.XgDormManagerBuilding;
import org.dromara.xg.domain.XgDormManagerSource;
import org.dromara.xg.domain.XgDormBedStudent;
import org.dromara.xg.mapper.XgDormRollCallMapper;
import org.dromara.xg.mapper.XgDormRollCallDetailMapper;
import org.dromara.xg.mapper.XgDormRoomMapper;
import org.dromara.xg.mapper.XgDormBedMapper;
import org.dromara.xg.mapper.XgDormBuildingMapper;
import org.dromara.xg.mapper.XgStudentMsgMapper;
import org.dromara.xg.mapper.XgDormManagerMapper;
import org.dromara.xg.mapper.XgDormManagerBuildingMapper;
import org.dromara.xg.mapper.XgDormManagerSourceMapper;
import org.dromara.xg.mapper.XgDormBedStudentMapper;
import org.dromara.xg.domain.XgStudentMsg;
import org.dromara.xg.domain.XgDormRoom;
import org.dromara.xg.domain.XgDormBuilding;
@@ -57,9 +53,7 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
private final XgDormBedMapper bedMapper;
private final XgDormBuildingMapper buildingMapper;
private final XgStudentMsgMapper studentMsgMapper;
private final XgDormManagerMapper dormManagerMapper;
private final XgDormManagerBuildingMapper dormManagerBuildingMapper;
private final XgDormManagerSourceMapper dormManagerSourceMapper;
private final XgDormBedStudentMapper bedStudentMapper;
@Override
public XgDormRollCallVo queryById(Long id) {
@@ -282,31 +276,32 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
}
@Override
public DormRollCallTodaySummaryVo queryTodaySummary() {
public DormRollCallTodaySummaryVo queryTodaySummary(Long buildingId) {
DormRollCallTodaySummaryVo summary = new DormRollCallTodaySummaryVo();
Long checkerId;
try {
checkerId = LoginHelper.getUserId();
} catch (Exception e) {
return summary;
}
if (checkerId == null) {
return summary;
}
// 总人数:有床位且在住(status=0)
LambdaQueryWrapper<XgDormBedStudent> totalLqw = Wrappers.<XgDormBedStudent>lambdaQuery()
.eq(XgDormBedStudent::getStatus, "0")
.eq(XgDormBedStudent::getDeleted, "0")
.isNotNull(XgDormBedStudent::getStudentId)
.isNotNull(XgDormBedStudent::getBedId)
.eq(buildingId != null, XgDormBedStudent::getBuildingId, buildingId);
Long totalStudents = bedStudentMapper.selectCount(totalLqw);
summary.setTotalStudentCount(totalStudents == null ? 0 : totalStudents.intValue());
Date dayBegin = DateUtil.beginOfDay(new Date());
Date dayEnd = DateUtil.endOfDay(new Date());
List<XgDormRollCall> todayRecords = baseMapper.selectList(
Wrappers.<XgDormRollCall>lambdaQuery()
.eq(XgDormRollCall::getCheckerId, checkerId)
.eq(XgDormRollCall::getStatus, "0")
.ge(XgDormRollCall::getCheckDate, dayBegin)
.le(XgDormRollCall::getCheckDate, dayEnd)
.orderByDesc(XgDormRollCall::getCheckDate)
);
// 全校或指定楼栋的当天点名主表
LambdaQueryWrapper<XgDormRollCall> rollLqw = Wrappers.<XgDormRollCall>lambdaQuery()
.eq(XgDormRollCall::getStatus, "0")
.ge(XgDormRollCall::getCheckDate, dayBegin)
.le(XgDormRollCall::getCheckDate, dayEnd)
.eq(buildingId != null, XgDormRollCall::getBuildingId, buildingId)
.orderByDesc(XgDormRollCall::getCheckDate);
List<XgDormRollCall> todayRecords = baseMapper.selectList(rollLqw);
// 同一寝室多次点名时取最新一条,避免明细重复统计
// 同一寝室多次点名时取最新一条
Map<Long, XgDormRollCall> latestByRoom = new LinkedHashMap<>();
for (XgDormRollCall record : todayRecords) {
if (record.getRoomId() == null) {
@@ -314,31 +309,6 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
}
latestByRoom.putIfAbsent(record.getRoomId(), record);
}
Set<Long> checkedRoomIds = latestByRoom.keySet();
summary.setCheckedRoomCount(checkedRoomIds.size());
Set<Long> scopeBuildingIds = resolveManagedBuildingIds(checkerId);
for (XgDormRollCall record : latestByRoom.values()) {
if (record.getBuildingId() != null) {
scopeBuildingIds.add(record.getBuildingId());
}
}
if (!scopeBuildingIds.isEmpty()) {
List<XgDormRoom> scopeRooms = roomMapper.selectList(
Wrappers.<XgDormRoom>lambdaQuery()
.in(XgDormRoom::getBuildingId, scopeBuildingIds)
.eq(XgDormRoom::getRoomStatus, "0")
);
long unchecked = scopeRooms.stream()
.map(XgDormRoom::getId)
.filter(id -> !checkedRoomIds.contains(id))
.count();
summary.setUncheckedRoomCount((int) unchecked);
} else {
summary.setUncheckedRoomCount(0);
}
if (latestByRoom.isEmpty()) {
return summary;
}
@@ -354,26 +324,34 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
Map<Long, XgDormRollCall> rollCallMap = latestByRoom.values().stream()
.collect(Collectors.toMap(XgDormRollCall::getId, r -> r, (a, b) -> a));
List<XgDormRollCallDetail> details = detailMapper.selectList(
// 已点名人数:明细中有学生记录的去重(含在寝/请假/留宿/异常,不含空床)
List<XgDormRollCallDetail> allStudentDetails = detailMapper.selectList(
Wrappers.<XgDormRollCallDetail>lambdaQuery()
.in(XgDormRollCallDetail::getRollCallId, rollCallIds)
.in(XgDormRollCallDetail::getRollCallStatus, Arrays.asList("1", "2", "4"))
.isNotNull(XgDormRollCallDetail::getStudentId)
.orderByAsc(XgDormRollCallDetail::getBedCode)
);
Set<Long> checkedStudentIds = allStudentDetails.stream()
.map(XgDormRollCallDetail::getStudentId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
summary.setCheckedStudentCount(checkedStudentIds.size());
List<DormRollCallTodayDetailItemVo> leaveDetails = new ArrayList<>();
List<DormRollCallTodayDetailItemVo> holidayStayDetails = new ArrayList<>();
List<DormRollCallTodayDetailItemVo> absentDetails = new ArrayList<>();
for (XgDormRollCallDetail detail : details) {
DormRollCallTodayDetailItemVo item = toTodayDetailItem(detail, rollCallMap.get(detail.getRollCallId()));
for (XgDormRollCallDetail detail : allStudentDetails) {
String status = detail.getRollCallStatus();
if (!"1".equals(status) && !"2".equals(status) && !"4".equals(status)) {
continue;
}
DormRollCallTodayDetailItemVo item = toTodayDetailItem(detail, rollCallMap.get(detail.getRollCallId()));
if ("1".equals(status)) {
leaveDetails.add(item);
} else if ("4".equals(status)) {
holidayStayDetails.add(item);
} else if ("2".equals(status)) {
} else {
absentDetails.add(item);
}
}
@@ -410,93 +388,6 @@ public class XgDormRollCallServiceImpl implements IXgDormRollCallService {
return item;
}
/**
* 解析当前账号宿舍管理员管辖的楼栋(楼栋权限表 + 授权来源表)。
*/
private Set<Long> resolveManagedBuildingIds(Long userId) {
Set<Long> buildingIds = new HashSet<>();
if (userId == null) {
return buildingIds;
}
List<XgDormManager> managers = dormManagerMapper.selectList(
Wrappers.<XgDormManager>lambdaQuery()
.eq(XgDormManager::getUserId, userId)
.eq(XgDormManager::getStatus, "0")
);
if (managers == null || managers.isEmpty()) {
return buildingIds;
}
List<Long> managerIds = managers.stream().map(XgDormManager::getId).collect(Collectors.toList());
List<XgDormManagerBuilding> managerBuildings = dormManagerBuildingMapper.selectList(
Wrappers.<XgDormManagerBuilding>lambdaQuery()
.in(XgDormManagerBuilding::getManagerId, managerIds)
.eq(XgDormManagerBuilding::getStatus, "0")
);
for (XgDormManagerBuilding mb : managerBuildings) {
if (mb.getBuildingId() != null) {
buildingIds.add(mb.getBuildingId());
}
}
List<XgDormManagerSource> sources = dormManagerSourceMapper.selectList(
Wrappers.<XgDormManagerSource>lambdaQuery()
.in(XgDormManagerSource::getManagerId, managerIds)
.eq(XgDormManagerSource::getStatus, "0")
);
Set<Long> campusIds = new HashSet<>();
Set<Long> areaIds = new HashSet<>();
boolean allCampus = false;
for (XgDormManagerSource source : sources) {
String authType = source.getAuthType();
Long authSource = source.getAuthSource();
if ("1".equals(authType)) {
allCampus = true;
} else if ("2".equals(authType) && authSource != null) {
campusIds.add(authSource);
} else if ("3".equals(authType) && authSource != null) {
areaIds.add(authSource);
} else if ("4".equals(authType) && authSource != null) {
buildingIds.add(authSource);
}
}
if (allCampus) {
List<XgDormBuilding> allBuildings = buildingMapper.selectList(
Wrappers.<XgDormBuilding>lambdaQuery().select(XgDormBuilding::getId)
);
for (XgDormBuilding b : allBuildings) {
if (b.getId() != null) {
buildingIds.add(b.getId());
}
}
return buildingIds;
}
if (!campusIds.isEmpty() || !areaIds.isEmpty()) {
LambdaQueryWrapper<XgDormBuilding> buildingLqw = Wrappers.<XgDormBuilding>lambdaQuery()
.select(XgDormBuilding::getId);
buildingLqw.and(w -> {
boolean first = true;
if (!campusIds.isEmpty()) {
w.in(XgDormBuilding::getCampusId, campusIds);
first = false;
}
if (!areaIds.isEmpty()) {
if (!first) {
w.or();
}
w.in(XgDormBuilding::getAreaId, areaIds);
}
});
List<XgDormBuilding> buildings = buildingMapper.selectList(buildingLqw);
for (XgDormBuilding b : buildings) {
if (b.getId() != null) {
buildingIds.add(b.getId());
}
}
}
return buildingIds;
}
private LambdaQueryWrapper<XgDormRollCall> buildQueryWrapper(XgDormRollCallBo bo) {
LambdaQueryWrapper<XgDormRollCall> lqw = Wrappers.<XgDormRollCall>lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getBatchNo()), XgDormRollCall::getBatchNo, bo.getBatchNo());