commit
This commit is contained in:
@@ -32,6 +32,7 @@ import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
@@ -164,7 +165,7 @@ public class SiteReserveController {
|
||||
|
||||
Map<Boolean, String> validateSiteReserve = siteReserveService.validateSiteReserve(
|
||||
activitySiteReserve.getSite_id(),
|
||||
activitySiteReserve.getReserve_day(),
|
||||
days[0],
|
||||
activitySiteReserve.getStart_time(),
|
||||
activitySiteReserve.getEnd_time(),
|
||||
activitySiteReserve.getJoinCount()
|
||||
@@ -474,7 +475,7 @@ public class SiteReserveController {
|
||||
.and("end_time", "=", nutMap.getString("end_time"))
|
||||
.and("reserve_state", "in", stateList.stream().map(AuditState::getStateId).collect(Collectors.toList()))
|
||||
);
|
||||
int count = reserveList.stream().mapToInt(ActivitySiteReserve::getJoinCount).sum();
|
||||
int count = Lang.isNotEmpty(reserveList) ? reserveList.stream().mapToInt(ActivitySiteReserve::getJoinCount).sum() : 0;
|
||||
nutMap.addv("allowCount", maxNum);
|
||||
nutMap.addv("hasCount", count);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class SiteReserveServiceImpl extends BaseServiceImpl<ActivitySiteReserve>
|
||||
.and("reserve_state", "in", stateList.stream().map(AuditState::getStateId).collect(Collectors.toList()))
|
||||
);
|
||||
int count = reserveList.stream().mapToInt(ActivitySiteReserve::getJoinCount).sum();
|
||||
if((count + joinCount) >= siteInfo.getMaxNum()) {
|
||||
if((count + joinCount) > siteInfo.getMaxNum()) {
|
||||
return Map.of(false, "预约人数已满");
|
||||
}
|
||||
return Map.of(true, "");
|
||||
|
||||
@@ -237,7 +237,8 @@ public class SiteInfoMobileController {
|
||||
@At("/reserveDo")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
public Object reserveDo(String siteId, String times, String message, String joinUser) {
|
||||
public Object reserveDo(String siteId, String times, String message, String joinUser, Integer joinCount) {
|
||||
|
||||
String moduleName = activityCommonService.findModuleNameByActivityId(siteId);
|
||||
Integer stateCode = activityCommonService.findStartStateCodeByModuleName(moduleName);
|
||||
|
||||
@@ -265,6 +266,7 @@ public class SiteInfoMobileController {
|
||||
as.setReserve_day(item.getString("day"));
|
||||
as.setStart_time(item.getString("start_time"));
|
||||
as.setEnd_time(item.getString("end_time"));
|
||||
as.setJoinCount(joinCount);
|
||||
str += item.getString("day") + ",";
|
||||
li.add(as);
|
||||
}
|
||||
|
||||
@@ -342,12 +342,12 @@ layout("/mobile/platform.html"){
|
||||
this.show = true
|
||||
},
|
||||
async reserveDo() {
|
||||
const resp = await $.post('/mobile/activity/site/info/reserveDo', {
|
||||
siteId: this.site_id,
|
||||
times: JSON.stringify(this.times),
|
||||
message: this.formData.message,
|
||||
joinUser: this.formData.joinUser,
|
||||
joinCount: this.formData.joinCount,
|
||||
this.$set(this.formData, 'start_time', this.times[0].start_time)
|
||||
this.$set(this.formData, 'end_time', this.times[0].end_time)
|
||||
this.$set(this.formData, 'site_id', this.site_id)
|
||||
const resp = await $.post('/platform/activity/site/reserve/doAdd', {
|
||||
data: JSON.stringify(this.formData),
|
||||
days: JSON.stringify(this.times.map(o => o.day))
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
vant.Toast('预约成功')
|
||||
@@ -360,7 +360,7 @@ layout("/mobile/platform.html"){
|
||||
await this.onLoad()
|
||||
}
|
||||
} else {
|
||||
vant.Toast('预约失败')
|
||||
vant.Toast(resp.msg)
|
||||
}
|
||||
},
|
||||
chooseTime(item) {
|
||||
|
||||
@@ -626,7 +626,7 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
const s = this.formData.time.split('-')[0]
|
||||
const e = this.formData.time.split('-')[1]
|
||||
if (moment().unix() >= moment(this.formData.reserve_day + ' ' + e + ':00').unix()) {
|
||||
if (moment().unix() >= moment(this.dayArray[0] + ' ' + e + ':00').unix()) {
|
||||
this.$message.warning('您预约的时间段已过')
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user