疗休养

This commit is contained in:
Paidax
2025-06-13 09:24:27 +08:00
parent 726dfd50be
commit d3364e96f5
7 changed files with 114 additions and 91 deletions
@@ -99,6 +99,10 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel {
@Comment("最少参与教工")
private Integer minimumGroupSize;
@Column
@ColDefine(type = ColType.INT)
@Comment("最多报名人数")
private Integer maxApplyNum;
@Column
@ColDefine(type = ColType.VARCHAR, width = 50)
@@ -1,6 +1,7 @@
package io.v.nutz.zhgh.therapyRecuperation.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import cn.hutool.json.JSONUtil;
@@ -194,6 +195,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
u.username AS createUserName,
ta.travelAgencyName,
us.contact,
us.maxApplyNum,
us.contactPhone,
lot.lotName,
lot.lotValue,
@@ -1024,7 +1026,8 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
signUpStartTime = lineUnionSelect.getSignUpStartTime();
signUpEndTime = lineUnionSelect.getSignUpEndTime();
changeEndTime = lineUnionSelect.getChangeEndTime();
//线路人数,省外线路最多报名数
//此条线路最多报名人数(包含家属)
Integer maxApplyNum = lineUnionSelect.getMaxApplyNum();
if (DateUtil.compare(new Date(), signUpStartTime) < 0) {
return Map.of(false, "报名未开始,请耐心等待");
@@ -1033,6 +1036,35 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
return Map.of(false, "报名时间已过,抱歉不能报名");
}
// 获取此线路已经报名的人数(包含家属)
Sql numSql = Sqls.create("select id from the_rapy_recuperation_enroll where takePartInLineId = @takePartInLineId")
.setParam("takePartInLineId", lineUnionSelect.getId());
numSql.setCallback(Sqls.callback.strList());
dao().execute(numSql);
List<String> list = numSql.getList(String.class);
int enrollNum = list.size();
if (Lang.isNotEmpty(list)) {
int i = dao().count(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "in", list));
enrollNum = enrollNum + i;
}
// 去判断当前报名的记录,名额有没有超出限制,包含家属
List<TheRapyRecuperationEnrollCompanion> companionList = enrollInfo.getCompanionList();
int applyNum = 1;
if (Lang.isNotEmpty(companionList)) {
applyNum = applyNum + companionList.size();
}
if ((applyNum + enrollNum) > maxApplyNum) {
int canApplyNum = maxApplyNum - enrollNum;
if (canApplyNum == 0) {
return Map.of(false, "此线路报名人数已满,请选择其他线路报名");
} else {
return Map.of(false, "此线路剩余可报名人数为:【" + canApplyNum + "人】,您当前报名人数为:【" + applyNum + "人】,请减少随行人或选择其他线路报名");
}
}
TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature());
if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) {
@@ -1484,6 +1516,8 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
us.signUpEndTime,
us.changeEndTime,
us.minimumGroupSize,
us.maxApplyNum,
us.estimatedCost,
us.estimatedFamilyNumbers,
line.content,
l.lotName,
@@ -172,6 +172,7 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl
contact,
contactPhone,
minimumGroupSize,
maxApplyNum,
trafficTools,
estimatedCost,
estimatedFamilyNumbers,