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