This commit is contained in:
@jyuhsin
2025-06-09 17:08:13 +08:00
parent b3f86d779a
commit 8e7c0c88a4
8 changed files with 98 additions and 9 deletions
@@ -300,8 +300,9 @@ public class TheRapyRecuperationBaseManagerController {
listMap.forEach((k, v) -> {
SysHoliday sysHoliday = v.get(0);
Date date = DateUtil.parse(sysHoliday.getDay());
Date previousDay = DateUtil.offsetDay(date, -1);
holidays.add(DateUtil.formatDate(previousDay));
/*Date previousDay = DateUtil.offsetDay(date, -1);
holidays.add(DateUtil.formatDate(previousDay));*/
holidays.add(DateUtil.formatDate(date));
});
List<Integer> weeks = management.getWeekCheckIn();
@@ -325,10 +326,10 @@ public class TheRapyRecuperationBaseManagerController {
while (!currentDate.isAfter(endDate)) {
// 检查是否为节假日
String currentDateString = currentDate.format(formatter);
/*if (holidays.contains(currentDateString) && lot.getFilterHolidays()) {
if (holidays.contains(currentDateString)) {
currentDate = currentDate.plusDays(1);
continue;
}*/
}
// 检查是否为需要排除的周几
int dayOfWeek = currentDate.getDayOfWeek().getValue() % 7; // 1是周一,7是周日
if (Lang.isNotEmpty(weeks) && !weeks.contains(dayOfWeek)) {
@@ -119,6 +119,11 @@ public class TheRapyRecuperationLine extends BaseModel {
@Comment("成团人数包括家属")
private Integer estimatedFamilyNumbers;
@Column
@ColDefine(type = ColType.INT)
@Comment("最多报名人数")
private Integer maxGroupSize;
@Column
@ColDefine(type = ColType.VARCHAR, width = 100)
@Comment("缩略图")
@@ -167,4 +167,9 @@ public class TheRapyRecuperationLineUnionSelect extends BaseModel {
@Comment("校工会审核id")
private String schoolAuditId;
@Column
@ColDefine(type = ColType.INT)
@Comment("最多报名人数")
private Integer maxGroupSize;
}
@@ -540,7 +540,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
//配置信息
TheRapyRecuperationConfig config = dao().fetch(TheRapyRecuperationConfig.class);
if(StrUtil.isNotBlank(loginName) && loginName.startsWith("2025")) {
if (StrUtil.isNotBlank(loginName) && loginName.startsWith("2025")) {
return Map.of(false, "抱歉,您是今年新入职,不能报名!");
}
@@ -591,10 +591,16 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
TheRapyRecuperationLine lineInfo = dao().fetch(TheRapyRecuperationLine.class, lineUnionSelect.getLineId());
//判断是否工勤线路
if(lineInfo.getSpecialLine() == true && StrUtil.isNotBlank(user.getRemark()) && !user.getRemark().contains("工勤")) {
if (lineInfo.getSpecialLine() == true && StrUtil.isNotBlank(user.getRemark()) && !user.getRemark().contains("工勤")) {
return Map.of(false, "不能报名,此路线为工勤特定线路");
}
//判断人数报满没有
Map<Boolean, String> validSignCountMap = validSignCount(enrollInfo, config, lineUnionSelect.getMaxGroupSize(), StrUtil.isBlank(enrollInfo.getId()) ? "add" : "edit");
if (validSignCountMap.containsKey(false)) {
return validSignCountMap;
}
TheRapyRecuperationType trrt = regionTypeLineMap.get(lineInfo.getRegionalNature());
if (StrUtil.isBlank(enrollInfo.getId()) && StrUtil.isNotBlank(enrollInfo.getTakePartInLineId())) {
//获取标段中的最大费用
@@ -704,6 +710,39 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
return Map.of(true, "验证成功");
}
public Map<Boolean, String> validSignCount(TheRapyRecuperationEnroll enrollInfo, TheRapyRecuperationConfig config, int maxGroupSize, String type) {
int hasSignNumber = 0;//已经报名的人数
int currentSignNumber = 1;//当前报名人数,1表示自己,下面的if是加家属人数
Cnd cnd = Cnd.where("takePartInLineId", "=", enrollInfo.getTakePartInLineId())
.and("stateId", "in", Lang.array(TheRapyRecuperationState.UNIT, TheRapyRecuperationState.LINEUNIT, TheRapyRecuperationState.SCHOOL, TheRapyRecuperationState.PASS))
.and("isNormal", "=", true);
//如果是修改,排除自己的报名记录
if ("edit".equals(type)) {
SqlExpressionGroup group = new SqlExpressionGroup();
group.or("loginName", "!=", ShiroUtil.getPlatformLoginname());
cnd.and(group);
}
List<TheRapyRecuperationEnroll> enrolls = dao().query(TheRapyRecuperationEnroll.class, cnd);
//1表示在配置页面的家属配置的是数量,2是家属的List
if (config.getFamilyInfo() == 1) {
currentSignNumber += enrollInfo.getFamilyNumber() != null ? enrollInfo.getFamilyNumber() : 0;
int sum = enrolls.stream().mapToInt(TheRapyRecuperationEnroll::getFamilyNumber).sum();
hasSignNumber = enrolls.size() + sum;
} else {
currentSignNumber += enrollInfo.getCompanionList() != null ? enrollInfo.getCompanionList().size() : 0;
List<String> list = enrolls.stream().map(TheRapyRecuperationEnroll::getId).collect(Collectors.toList());
List<TheRapyRecuperationEnrollCompanion> companions = dao().query(TheRapyRecuperationEnrollCompanion.class, Cnd.where("trreId", "=", list));
hasSignNumber = enrolls.size() + companions.size();
}
//省外报名限制,不包含家属
if ((hasSignNumber + currentSignNumber) > maxGroupSize) {
return Map.of(false, "报名人数已满");
} else {
return Map.of(true, "");
}
}
public Map<Boolean, String> validSignTime(TheRapyRecuperationEnroll currentEnroll) {
TheRapyRecuperationConfig config = dao().fetch(TheRapyRecuperationConfig.class, Cnd.NEW());
DateTime signUpStartTime = null;
@@ -731,7 +770,7 @@ public class TheRapyRecuperationEnrollServiceImpl extends ViServiceImpl<TheRapyR
.and("stateId", "=", 2750)
.and("YEAR(signingUptime)", "=", DateUtil.thisYear())
.and("loginName", "=", loginName));
if(count > 0) {
if (count > 0) {
return Map.of(false, "一年只能报1次,您已报集中疗休养,请先在我的疗休养中删除,方可报名!");
}
//酒店可以一年报2次,查询是否有报第一次
@@ -186,6 +186,9 @@ public class TheRapyRecuperationLineUnionSelectServiceImpl extends ViServiceImpl
estimatedCost,
estimatedFamilyNumbers,
us.travelAgencyId,
us.maxGroupSize,
us.signScope,
us.chooseUserList,
signUpMode,
enable,
ta.travelAgencyName
@@ -613,7 +613,8 @@ layout("/mobile/platform.html"){
const afterDateStr = moment(afterDate).format('YYYY-MM-DD')
if(this.holidays.includes(afterDateStr)) {
this.$toast(afterDateStr + '是节假日或前一天,不能选择')
this.$toast(afterDateStr + '是节假日,请更换出行时间')
this.chooseDate = []
this.$refs.cal.reset(null)
break
}
@@ -178,7 +178,12 @@ layout("/layouts/platform.html"){
<template scope="{row}">
<el-button @click="openView(row.id)" size="mini" type="primary">查看</el-button>
<el-button v-if="[1,2].includes(row.stateId)" @click="openEdit(row.id)" size="mini" type="primary">编辑</el-button>
<el-button v-if="[1,2,3].includes(row.stateId)" @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
<template v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')}">
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
</template>
<template v-else>
<el-button v-if="[1,2,3].includes(row.stateId)" @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
</template>
</template>
</el-table-column>
</el-table>
@@ -341,6 +346,16 @@ layout("/layouts/platform.html"){
</el-row>
<el-row :gutter="20">
<el-col :md="12" :sm="24" :xs="24">
<el-form-item label="最多报名人数" prop="maxGroupSize">
<el-input-number :max="1000"
:min="1"
:precision="0"
style="width: 100%"
placeholder="请输入最多报名人数"
v-model="formData.maxGroupSize"></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" :xs="24" v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')}">
<el-form-item label="工勤特定线路" prop="specialLine">
<el-radio-group class="mr0-radio" size="small" v-model="formData.specialLine">
@@ -575,6 +590,7 @@ layout("/layouts/platform.html"){
trafficTools: [{required: false, message: '请输入交通工具', trigger: ['change', 'blur']}],
estimatedCost: [{required: false, message: '请输入预计费用', trigger: ['change', 'blur']}],
estimatedFamilyNumbers: [{required: false, message: '请输入成团人数包括家属', trigger: ['change', 'blur']}],
maxGroupSize: [{required: true, message: '请输入最多报名人数', trigger: ['change', 'blur']}],
lotId: [{required: true, message: '请选择标段时间', trigger: ['change', 'blur']}],
openChoose: [{required: true, message: '请选择开放选择', trigger: ['change', 'blur']}],
travelAgencyPlace: [{required: true, message: '请选择旅行社地点', trigger: ['change', 'blur']}],
@@ -412,6 +412,20 @@ layout("/layouts/platform.html"){
</el-form-item>
</el-descriptions-item>
<el-descriptions-item label="最多报名人数">
<template slot="label">
<span class="text-danger">*</span>
最多报名人数
</template>
<el-form-item :prop="'times.' + $index + '.maxGroupSize'"
:rules="[
{ required: true, message: '最多报名人数不能为空', trigger: 'blur' },
{ pattern: /^[0-9]*$/, message: '最多报名人数格式不正确', trigger: 'blur' }
]"
label-width="0">
<el-input disabled placeholder="请输入最多报名人数" clearable v-model="row.maxGroupSize"></el-input>
</el-form-item>
</el-descriptions-item>
<!--<el-descriptions-item label="成团人数包括家属">
<template slot="label">
@@ -520,6 +534,9 @@ layout("/layouts/platform.html"){
<el-descriptions-item label="预计费用(元/人次)">
{{row.estimatedCost}}
</el-descriptions-item>
<el-descriptions-item label="最多报名人数">
{{row.maxGroupSize}}
</el-descriptions-item>
<el-descriptions-item label="是否开启">
<el-switch
disabled
@@ -873,6 +890,7 @@ layout("/layouts/platform.html"){
estimatedCost: this.lineData.estimatedCost,
contact: this.lineData.lineContact,
contactPhone: this.lineData.lineContactPhone,
maxGroupSize: this.lineData.maxGroupSize,
})
},
queryJoinUser(val) {
@@ -984,6 +1002,7 @@ layout("/layouts/platform.html"){
enable: true,
minimumGroupSize: this.lineData.minimumGroupSize,
estimatedCost: this.lineData.estimatedCost,
maxGroupSize: this.lineData.maxGroupSize,
contact: this.lineData.lineContact,
contactPhone: this.lineData.lineContactPhone,
signScope: [],