更改
This commit is contained in:
+3
-2
@@ -101,7 +101,8 @@ public class TrainSignUpActivityApplyController {
|
||||
tsuc.isReceiveGift,
|
||||
tsuc.giftType,
|
||||
tsuc.reserveMode,
|
||||
type.lxname
|
||||
type.lxname,
|
||||
tsuc.courseIsLimitApply
|
||||
FROM
|
||||
`train_sign_up_course` tsuc
|
||||
LEFT JOIN train_sign_up_type type ON type.id = tsuc.courseType
|
||||
@@ -116,7 +117,7 @@ public class TrainSignUpActivityApplyController {
|
||||
Pagination pagination = trainSignUpActivityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
List<NutMap> courseList = pagination.getList();
|
||||
|
||||
List<TrainSignUpActivityCourse> activityCourseList = trainSignUpActivityService.dao().query(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", activityId));
|
||||
List<TrainSignUpActivityCourse> activityCourseList = trainSignUpActivityService.dao().query(TrainSignUpActivityCourse.class, Cnd.where("activityId", "=", activityId).asc("courseStartTime"));
|
||||
|
||||
Map<String, List<TrainSignUpActivityCourse>> map = activityCourseList.stream().collect(Collectors.groupingBy(TrainSignUpActivityCourse::getCourseId));
|
||||
|
||||
|
||||
+11
-5
@@ -114,7 +114,7 @@ public class MTrainSignUpActivityController {
|
||||
@RequiresAuthentication
|
||||
public Object getCourseTimeSelectList(String courseId) {
|
||||
// 查课程的时间段
|
||||
List<TrainSignUpActivityCourse> courseList = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
List<TrainSignUpActivityCourse> courseList = dao.query(TrainSignUpActivityCourse.class, Cnd.where("courseId", "=", courseId).asc("courseStartTime"));
|
||||
|
||||
// 查课程的报名人数
|
||||
List<TrainSignUpUserCourse> applyUserList = dao.query(TrainSignUpUserCourse.class, Cnd.where("courseId", "=", courseId));
|
||||
@@ -131,8 +131,9 @@ public class MTrainSignUpActivityController {
|
||||
nutMap.put("remainingNum", remainingNum);
|
||||
nutMap.put("text", DateUtil.format(v.getCourseStartTime(), "HH:mm") + "至" + DateUtil.format(v.getCourseEndTime(), "HH:mm") + "段(剩" + remainingNum + ")");
|
||||
nutMap.put("value", id);
|
||||
nutMap.put("disabled", remainingNum == 0);
|
||||
return nutMap;
|
||||
}).filter(v-> v.getInt("remainingNum") != 0).collect(Collectors.toList());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -298,12 +299,17 @@ public class MTrainSignUpActivityController {
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@RequiresAuthentication
|
||||
public Object validateSourceSignUp(String activityCourseId) {
|
||||
public Object validateSourceSignUp(String activityCourseId, String courseId) {
|
||||
try {
|
||||
lock.lock();
|
||||
|
||||
List<TrainSignUpUser> userList = dao.query(TrainSignUpUser.class, Cnd.where("courseId", "=", courseId).and("state", "=", 1));
|
||||
List<String> isList = userList.stream().map(TrainSignUpUser::getUserId).toList();
|
||||
|
||||
// 该时间段下已报名的人数
|
||||
int count = dao.count(TrainSignUpUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId));
|
||||
// 获取改时间段下的活动课程限制报名人数
|
||||
int count = dao.count(TrainSignUpUserCourse.class, Cnd.where("activityCourseId", "=", activityCourseId)
|
||||
.and("courseId", "=", courseId).and("userId", "in", isList));
|
||||
// 获取该时间段下的活动课程限制报名人数
|
||||
TrainSignUpActivityCourse course = dao.fetch(TrainSignUpActivityCourse.class, activityCourseId);
|
||||
Integer courseLimitNum = course.getCourseLimitNum();
|
||||
// 报名加上自己,如果大于了限制人数,那就无法报名
|
||||
|
||||
@@ -319,6 +319,8 @@ layout("/mobile/platform.html"){
|
||||
<van-field label="校区" readonly v-model="choose.campus"></van-field>
|
||||
<van-field label="活动地点" readonly v-model="choose.courseLocation"></van-field>
|
||||
</div>
|
||||
</div>
|
||||
<div class="van-doc-card-two" style="margin-bottom: 16px">
|
||||
<div class="van-card-header">
|
||||
基础信息
|
||||
</div>
|
||||
@@ -674,7 +676,10 @@ layout("/mobile/platform.html"){
|
||||
|
||||
let flag = this.choose.courseIsLimitApply
|
||||
if (flag) {
|
||||
const resp = await $.post('/platform/mobile/trainSignUpActivity/validateSourceSignUp',{activityCourseId: this.formData.activityCourseId})
|
||||
const resp = await $.post('/platform/mobile/trainSignUpActivity/validateSourceSignUp',{
|
||||
activityCourseId: this.formData.activityCourseId,
|
||||
courseId: this.choose.id
|
||||
})
|
||||
if (resp.code !== 0) {
|
||||
vant.Dialog.alert({
|
||||
title: '温馨提示',
|
||||
|
||||
@@ -386,6 +386,21 @@ layout("/layouts/platform.html"){
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-if="choose.courseIsLimitApply">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="报名时段" prop="activityCourseId"
|
||||
:rules="{ required: true, message: '请选择报名时段', trigger: 'blur'}">
|
||||
<el-select style="width: 100%" v-model="formData.activityCourseId" placeholder="请选择报名时段">
|
||||
<el-option v-for="item in courseTimeSelectList"
|
||||
:label="item.text"
|
||||
:value="item.value"
|
||||
:disabled="item.disabled"
|
||||
:key="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col span="24">
|
||||
<el-form-item
|
||||
@@ -485,9 +500,18 @@ layout("/layouts/platform.html"){
|
||||
trainType: '培训班',
|
||||
|
||||
applyDialog: false,
|
||||
courseTimeSelectList:[],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getCourseTimeSelectList(o) {
|
||||
const resp = await $.post('/platform/mobile/trainSignUpActivity/getCourseTimeSelectList',{courseId: o.id})
|
||||
if (resp.code === 0) {
|
||||
this.courseTimeSelectList = resp.data
|
||||
} else {
|
||||
this.$message.warning(resp.msg)
|
||||
}
|
||||
},
|
||||
async doCancel(row){
|
||||
const msg = '您确认要取消' + row.courseName + '的报名吗?'
|
||||
this.$confirm(msg, '提示', {
|
||||
@@ -526,6 +550,16 @@ layout("/layouts/platform.html"){
|
||||
return "(<span style='color: red'>余" + lave +"</span>/" + o.coursePeopleNumber + "人)"
|
||||
}
|
||||
},
|
||||
async validateCourseTime() {
|
||||
const res = await $.post('/platform/mobile/trainSignUpActivity/validateSourceSignUp', {
|
||||
activityCourseId: this.formData.activityCourseId,
|
||||
courseId: this.choose.id
|
||||
})
|
||||
if(res.code !== 0) {
|
||||
this.$message.warning(res.msg)
|
||||
}
|
||||
return res.code === 0
|
||||
},
|
||||
async doSubmit() {
|
||||
//获取家属是多少人
|
||||
let per = 0
|
||||
@@ -543,8 +577,9 @@ layout("/layouts/platform.html"){
|
||||
this.$message.warning(res.msg)
|
||||
return
|
||||
}
|
||||
this.$refs['form'].validate(valid => {
|
||||
this.$refs['form'].validate(async valid => {
|
||||
if (valid) {
|
||||
if(this.choose.courseIsLimitApply && !await this.validateCourseTime()) return
|
||||
const msg = '您确认要提交' + this.choose.courseName + '的报名吗?'
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
@@ -560,7 +595,7 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
})
|
||||
this.formData.mobileColumnsValue = JSON.stringify(mobileColumnsValue)
|
||||
const resp = await $.post('/platform/mobile/trainSignUpActivity/doSignUp',this.formData)
|
||||
const resp = await $.post('/platform/mobile/trainSignUpActivity/doSignUp', this.formData)
|
||||
if (resp.code === 0) {
|
||||
await this.pageData()
|
||||
this.$message.success(resp.msg)
|
||||
@@ -592,6 +627,9 @@ layout("/layouts/platform.html"){
|
||||
this.$message.warning('您不在报名人员范围内')
|
||||
return
|
||||
}
|
||||
if (row.courseIsLimitApply) {
|
||||
await this.getCourseTimeSelectList(row)
|
||||
}
|
||||
const res = await $.post('/platform/mobile/trainSignUpActivity/validateSignUp', {
|
||||
cndId: row.conditionStructureId,
|
||||
courseId: row.id,
|
||||
|
||||
Reference in New Issue
Block a user