Merge pull request '修改预约模块添加预约时间段bug' (#74) from sjy-two into master
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #74
This commit is contained in:
root 2024-10-25 09:58:23 +08:00
commit 6b5ba72b0a
13 changed files with 297 additions and 69 deletions

View File

@ -55,5 +55,10 @@ export const LitemallReservationApi = {
// 导出预约订单 Excel // 导出预约订单 Excel
exportLitemallReservation: async (params) => { exportLitemallReservation: async (params) => {
return await request.download({ url: `/subscribe/litemall-reservation/export-excel`, params }) return await request.download({ url: `/subscribe/litemall-reservation/export-excel`, params })
} },
// 删除预约订单
checkLitemallReservation: async (id: number,check: number) => {
return await request.get({ url: `/subscribe/litemall-reservation/check?id=` + id + `&check=` + check })
},
} }

View File

@ -127,6 +127,8 @@ export enum DICT_TYPE {
//预约:项目 //预约:项目
SUBSCRIBE_PROJECT_STATUS = 'subscribe_project_status', SUBSCRIBE_PROJECT_STATUS = 'subscribe_project_status',
SUBSCRIBE_RESERVATION_STATUS = 'subscribe_reservation_status',
//预约:配置 //预约:配置
SUBSCRIBE_CONFIGURATION_STATUS = 'subscribe_configuration_status', SUBSCRIBE_CONFIGURATION_STATUS = 'subscribe_configuration_status',

View File

@ -33,10 +33,11 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="可预约日期" prop="timeInterval"> <el-form-item label="可预约日期" prop="timeInterval" >
<el-date-picker <el-date-picker
v-model="formData.timeInterval" v-model="formData.timeInterval"
type="daterange" type="daterange"
value-format="YYYY-MM-DD"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
/> />
@ -106,8 +107,8 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交表单 */ /** 提交表单 */
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
const submitForm = async () => { const submitForm = async () => {
console.log('11111111111',formData.value.timeInterval) console.log('11111111111',JSON.stringify(formData.value.timeInterval))
formData.value.timeInterval = JSON.stringify(formData.value.timeInterval); formData.value.timeInterval = JSON.stringify(formData.value.timeInterval);
// //
await formRef.value.validate() await formRef.value.validate()
// //

View File

@ -148,25 +148,26 @@
width="180px" width="180px"
/> --> /> -->
<!-- <el-table-column label="预约时间段" align="center" prop="hsstr" /> --> <!-- <el-table-column label="预约时间段" align="center" prop="hsstr" /> -->
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="预约状态" align="center" prop="reStatus"> <el-table-column label="预约状态" align="center" prop="reStatus">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.RE_STATUS" :value="scope.row.reStatus" /> <dict-tag :type="DICT_TYPE.RE_STATUS" :value="scope.row.reStatus" />
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="审核状态" align="center" prop="status"> <!-- <el-table-column label="审核状态" align="center" prop="status">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.SUBSCRIBE_RESERVATION_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> --> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" /> -->
<el-table-column
label="创建时间" <el-table-column label="审核" align="center" fixed="right" width="110">
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center" fixed="right" width="110">
<template #default="scope"> <template #default="scope">
<!-- <el-button <!-- <el-button
link link
@ -176,14 +177,43 @@
> >
编辑 编辑
</el-button> --> </el-button> -->
<el-button <el-button
v-if="scope.row.reStatus == 2"
link link
type="danger" type="success"
@click="handleDelete(scope.row.id)" @click="handleTonguo(scope.row.id)"
v-hasPermi="['subscribe:litemall-reservation:delete']"
> >
删除 通过
</el-button> </el-button>
<el-button
v-if="scope.row.reStatus == 2"
link
type="danger"
@click="handleJujue(scope.row.id)"
>
拒绝
</el-button>
<el-button
v-if="scope.row.reStatus == 1"
disabled
type="success"
>
已通过
</el-button>
<el-button
v-if="scope.row.reStatus == 0"
disabled
type="danger"
>
已拒绝
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -233,6 +263,7 @@ const queryParams = reactive({
technicianName: undefined, technicianName: undefined,
technicianId: undefined, technicianId: undefined,
reStatus: undefined, reStatus: undefined,
status: undefined,
remark: undefined, remark: undefined,
createTime: [] createTime: []
}) })
@ -269,14 +300,28 @@ const openForm = (type: string, id?: number) => {
formRef.value.open(type, id) formRef.value.open(type, id)
} }
/** 删除按钮操作 */ /** 审核通过按钮操作 */
const handleDelete = async (id: number) => { const handleTonguo = async (id: number) => {
const check = 1;
try { try {
//
await message.delConfirm()
// //
await LitemallReservationApi.deleteLitemallReservation(id) await LitemallReservationApi.checkLitemallReservation(id,check)
message.success(t('common.delSuccess')) message.success(t('审核成功'))
//
await getList()
} catch {}
}
/** 审核拒绝按钮操作 */
const handleJujue = async (id: number) => {
const check = 0;
try {
await LitemallReservationApi.checkLitemallReservation(id,check)
message.success(t('审核成功'))
// //
await getList() await getList()
} catch {} } catch {}

View File

@ -69,10 +69,10 @@
<el-table-column label="归属项目" align="center" prop="brandName" /> <el-table-column label="归属项目" align="center" prop="brandName" />
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" /> <el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" />
<el-table-column label="操作" align="center" fixed="right" width="200"> <el-table-column label="操作" align="center" fixed="right" width="220">
<template #default="scope"> <template #default="scope">
<el-button @click="openday(scope.row.projectId,scope.row.id)"> <el-button type="info" @click="openday(scope.row.projectId,scope.row.id)">
配置 时间段配置
</el-button> </el-button>
<el-button link type="primary" @click="openForm('update', scope.row.id)" <el-button link type="primary" @click="openForm('update', scope.row.id)"
v-hasPermi="['subscribe:litemall-technician:update']"> v-hasPermi="['subscribe:litemall-technician:update']">

View File

@ -24,6 +24,8 @@
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- 业务组件 --> <!-- 业务组件 -->
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <groupId>cn.iocoder.boot</groupId>

View File

@ -105,8 +105,8 @@ public class ConfigurationController {
//添加预约套餐时间段配置 //添加预约套餐时间段配置
@PostMapping("/addUpdConfiguration") @PostMapping("/addUpdConfiguration")
public CommonResult<Long> addConfiguration(@RequestBody ConfigurationDO pageReqVO) { public CommonResult<Integer> addConfiguration(@RequestBody ConfigurationDO pageReqVO) {
Long aLong = configurationService.addUpdConfiguration(pageReqVO); Integer aLong = configurationService.addUpdConfiguration(pageReqVO);
return success(aLong); return success(aLong);
} }

View File

@ -94,4 +94,11 @@ public class LitemallReservationController {
BeanUtils.toBean(list, LitemallReservationRespVO.class)); BeanUtils.toBean(list, LitemallReservationRespVO.class));
} }
@GetMapping("/check")
public CommonResult<Boolean> checkLitemallReservation(@RequestParam("id") Long id,@RequestParam("check") Long check) {
Boolean aBoolean = litemallReservationService.checkLitemallReservation(id, check);
return success(aBoolean);
}
} }

View File

@ -57,7 +57,7 @@ public interface ConfigurationService {
List<ServiceTimeVO> getConfiguration(Integer id); List<ServiceTimeVO> getConfiguration(Integer id);
Long addUpdConfiguration(ConfigurationDO pageReqVO); Integer addUpdConfiguration(ConfigurationDO pageReqVO);
List<ConfigurationDO> getConfigurationList(Integer projectdayId, Integer technicianId); List<ConfigurationDO> getConfigurationList(Integer projectdayId, Integer technicianId);

View File

@ -13,6 +13,8 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@ -101,36 +103,87 @@ public class ConfigurationServiceImpl implements ConfigurationService {
serviceTimeVOList.add(serviceTimeVO); serviceTimeVOList.add(serviceTimeVO);
} }
return serviceTimeVOList; return serviceTimeVOList;
} }
@Transactional
@Override @Override
public Long addUpdConfiguration(ConfigurationDO pageReqVO) { public Integer addUpdConfiguration(ConfigurationDO pageReqVO) {
//添加成功后时间段添加到预约时间段配置中 //添加成功后时间段添加到预约时间段配置中
if(pageReqVO.getServiceTimes() != null && pageReqVO.getServiceTimes() != ""){ if(pageReqVO.getServiceTimes() != null && pageReqVO.getServiceTimes() != ""){
//把StringJSON格式serviceTime转成对象 //把StringJSON格式serviceTime转成对象
List<ServiceTimeVO> serviceTimeVOS = JSON.parseObject(pageReqVO.getServiceTimes(), new TypeReference<List<ServiceTimeVO>>() {}); List<ServiceTimeVO> serviceTimeVOS = JSON.parseObject(pageReqVO.getServiceTimes(), new TypeReference<List<ServiceTimeVO>>() {});
/**
* 删除时间段
*/
//获取预约天的时间段
List<ServiceTimeVO> serviceTimeVOList = new ArrayList<>();
for (int i = 0; i < serviceTimeVOS.size(); i++) {
if (serviceTimeVOS.get(i).getId() != null){
serviceTimeVOList.add(serviceTimeVOS.get(i));
}
}
List<ServiceTimeVO> configurationByProjectdayId = getConfigurationByProjectdayId(pageReqVO.getProjectdayId());
for (int i = 0; i < configurationByProjectdayId.size(); i++) {
ServiceTimeVO serviceTimeVO1 = configurationByProjectdayId.get(i);
int check = 0;
for (int j = 0; j < serviceTimeVOList.size(); j++) {
ServiceTimeVO serviceTimeVO = serviceTimeVOS.get(j);
if (!serviceTimeVO1.getId().equals(serviceTimeVO.getId())){
check++;
}
if (check == serviceTimeVOList.size()){
configurationMapper.deleteById(serviceTimeVO1.getId());
}
}
}
for (int j = 0; j < serviceTimeVOS.size(); j++) { for (int j = 0; j < serviceTimeVOS.size(); j++) {
ServiceTimeVO serviceTimeVO = serviceTimeVOS.get(j); ServiceTimeVO serviceTimeVO = serviceTimeVOS.get(j);
String serviceTime = serviceTimeVO.getStart() + " - " + serviceTimeVO.getEnd(); String serviceTime = serviceTimeVO.getStart() + " - " + serviceTimeVO.getEnd();
ConfigurationDO configurationDO = new ConfigurationDO(); //判断时间段是否存在
configurationDO.setTechnicianId(pageReqVO.getTechnicianId()); /**
configurationDO.setProjectdayId(pageReqVO.getProjectdayId()); * 添加修改时间段
configurationDO.setTimeQuantum(serviceTime); */
configurationDO.setAvailableNumber(Integer.parseInt(serviceTimeVO.getSubscribeNum())); if (serviceTimeVO.getId() == null){ //不存在添加进时间段
configurationDO.setResidueNumber(Integer.parseInt(serviceTimeVO.getSubscribeNum()));
configurationDO.setStatus(1);
configurationMapper.insert(configurationDO);
}
ConfigurationDO configurationDO = new ConfigurationDO();
configurationDO.setTechnicianId(pageReqVO.getTechnicianId());
configurationDO.setProjectdayId(pageReqVO.getProjectdayId());
configurationDO.setTimeQuantum(serviceTime);
configurationDO.setAvailableNumber(Integer.parseInt(serviceTimeVO.getSubscribeNum()));
configurationDO.setResidueNumber(Integer.parseInt(serviceTimeVO.getSubscribeNum()));
configurationDO.setStatus(1);
int insert = configurationMapper.insert(configurationDO);
if (insert == 0){
return insert;
}
}else {
ConfigurationDO configurationDO = new ConfigurationDO();
configurationDO.setId(serviceTimeVO.getId());
configurationDO.setTechnicianId(pageReqVO.getTechnicianId());
configurationDO.setProjectdayId(pageReqVO.getProjectdayId());
configurationDO.setTimeQuantum(serviceTime);
configurationDO.setAvailableNumber(Integer.parseInt(serviceTimeVO.getSubscribeNum()));
int i = configurationMapper.updateById(configurationDO);
if (i == 0){
return i;
}
}
}
} }
return 1;
return null;
} }
@Override @Override
@ -142,4 +195,21 @@ public class ConfigurationServiceImpl implements ConfigurationService {
return configurationDOS; return configurationDOS;
} }
public List<ServiceTimeVO> getConfigurationByProjectdayId(Long id) {
List<ConfigurationDO> configurationDOS = configurationMapper.selectList("projectday_id", id);
List<ServiceTimeVO> serviceTimeVOList = new ArrayList<>();
for (int i = 0; i < configurationDOS.size(); i++) {
ConfigurationDO configurationDO = configurationDOS.get(i);
ServiceTimeVO serviceTimeVO = new ServiceTimeVO();
String[] split = configurationDO.getTimeQuantum().split(" - ");
serviceTimeVO.setId(configurationDO.getId());
serviceTimeVO.setStart(split[0]);
serviceTimeVO.setEnd(split[1]);
serviceTimeVO.setSubscribeNum(String.valueOf(configurationDO.getAvailableNumber()));
serviceTimeVOList.add(serviceTimeVO);
}
return serviceTimeVOList;
}
} }

View File

@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.srbscribe.dal.mysql.projectday.ProjectdayMapper;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.reflect.TypeToken; import com.google.common.reflect.TypeToken;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -66,37 +67,21 @@ public class ProjectServiceImpl implements ProjectService {
// 将字符串转换为数组 // 将字符串转换为数组
String[] timeIntervalArray = gson.fromJson(project.getTimeInterval(), arrayType); String[] timeIntervalArray = gson.fromJson(project.getTimeInterval(), arrayType);
String[] startDate = timeIntervalArray[0].split("T");
String[] endDate = timeIntervalArray[1].split("T");
// 定义日期格式 //根据两个日期获取中间所有日期 "2024-10-01,.......,2024-10-31"
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); String finalDateString = dateString(timeIntervalArray[0], timeIntervalArray[1]);
// 定义起始日期和结束日期
LocalDate startDates = LocalDate.parse(startDate[0], formatter);
LocalDate endDates = LocalDate.parse(endDate[0], formatter);
// 获取日期范围内的所有日期
List<LocalDate> dateList = getDatesBetween(startDates, endDates);
// 创建一个 StringBuilder 来存储所有日期的字符串
StringBuilder dateStringBuilder = new StringBuilder();
// 拼接所有日期字符串
for (LocalDate date : dateList) {
dateStringBuilder.append(date.format(formatter)).append(","); // 连接日期和逗号
}
// 删除最后一个逗号和空格
if (dateStringBuilder.length() > 0) {
dateStringBuilder.setLength(dateStringBuilder.length() - 1); // 移除最后的逗号和空格
}
// 输出所有日期作为单个字符串
String finalDateString = dateStringBuilder.toString();
String[] split = finalDateString.split(","); String[] split = finalDateString.split(",");
List<ProjectdayDO> projectdayDOS = new ArrayList<>(); List<ProjectdayDO> projectdayDOS = new ArrayList<>();
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
ProjectdayDO projectdayDO = new ProjectdayDO(); ProjectdayDO projectdayDO = new ProjectdayDO();
projectdayDO.setProjectId(project.getId()); projectdayDO.setProjectId(project.getId());
projectdayDO.setDays(split[i]); projectdayDO.setDays(split[i]);
//获取星期
LocalDate localDate = LocalDate.parse(split[i]); LocalDate localDate = LocalDate.parse(split[i]);
String dayOfWeek = localDate.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINESE); String dayOfWeek = localDate.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINESE);
projectdayDO.setWeek(dayOfWeek); projectdayDO.setWeek(dayOfWeek);
projectdayDOS.add(projectdayDO); projectdayDOS.add(projectdayDO);
} }
projectdayMapper.insertBatch(projectdayDOS); projectdayMapper.insertBatch(projectdayDOS);
@ -110,8 +95,93 @@ public class ProjectServiceImpl implements ProjectService {
return project.getId(); return project.getId();
} }
//根据两个日期获取中间所有日期 "2024-10-01,.......,2024-10-31"
public String dateString(String startDay,String endDay){
// 定义日期格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 定义起始日期和结束日期
LocalDate startDates = LocalDate.parse(startDay, formatter);
LocalDate endDates = LocalDate.parse(endDay, formatter);
// 获取日期范围内的所有日期
List<LocalDate> dateList = getDatesBetween(startDates, endDates);
// 创建一个 StringBuilder 来存储所有日期的字符串
StringBuilder dateStringBuilder = new StringBuilder();
// 拼接所有日期字符串
for (LocalDate date : dateList) {
dateStringBuilder.append(date.format(formatter)).append(","); // 连接日期和逗号
}
// 删除最后一个逗号和空格
if (dateStringBuilder.length() > 0) {
dateStringBuilder.setLength(dateStringBuilder.length() - 1); // 移除最后的逗号和空格
}
// 输出所有日期作为单个字符串
String finalDateString = dateStringBuilder.toString();
return finalDateString;
}
@Override @Override
public void updateProject(ProjectSaveReqVO updateReqVO) { public void updateProject(ProjectSaveReqVO updateReqVO) {
// 创建 Gson 对象
Gson gson = new Gson();
// 定义数组的类型
Type arrayType = new TypeToken<String[]>() {}.getType();
// 将字符串转换为数组
String[] timeIntervalArray = gson.fromJson(updateReqVO.getTimeInterval(), arrayType);
//根据两个日期获取中间所有日期 "2024-10-01,.......,2024-10-31"
String finalDateString = dateString(timeIntervalArray[0], timeIntervalArray[1]);
String[] split = finalDateString.split(",");
List<String> dateList = new ArrayList<>();
for (int i = 0; i < split.length; i++) {
dateList.add(split[i]);
}
//更新前的时间
List<ProjectdayDO> projectdayDOS = projectdayMapper.selectList("project_id", updateReqVO.getId());
List<ProjectdayDO> projectdayList = new ArrayList<>();
for (int i = 0; i < dateList.size(); i++) {
int chick = 0;
for (int j = 0; j < projectdayDOS.size(); j++) {
ProjectdayDO projectdayDO = projectdayDOS.get(j);
if (!dateList.get(i).equals(projectdayDO.getDays())){
chick ++;
}
if (chick == projectdayDOS.size()){ //没有相同预约天添加
ProjectdayDO projectdayDO1 = new ProjectdayDO();
projectdayDO1.setProjectId(updateReqVO.getId());
projectdayDO1.setDays(split[i]);
//获取星期
LocalDate localDate = LocalDate.parse(split[i]);
String dayOfWeek = localDate.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.CHINESE);
projectdayDO1.setWeek(dayOfWeek);
projectdayList.add(projectdayDO1);
}
if (dateList.get(i).equals(projectdayDO.getDays())){
projectdayDOS.remove(projectdayDO); //删除相等的
}
}
}
projectdayMapper.insertBatch(projectdayList);
//删除原来多余的预约天
if (!projectdayDOS.isEmpty()){
projectdayMapper.deleteByIds(projectdayDOS);
}
// 校验存在 // 校验存在
validateProjectExists(updateReqVO.getId()); validateProjectExists(updateReqVO.getId());
// 更新 // 更新

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationPageReqVO; import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationSaveReqVO; import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.reservation.LitemallReservationDO; import cn.iocoder.yudao.module.srbscribe.dal.dataobject.reservation.LitemallReservationDO;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.*; import javax.validation.*;
import java.util.List; import java.util.List;
@ -71,4 +72,8 @@ public interface LitemallReservationService {
List<LitemallReservationDO> reservationInfo(Long userId); List<LitemallReservationDO> reservationInfo(Long userId);
Boolean checkLitemallReservation( Long id, Long check);
} }

View File

@ -22,6 +22,8 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@ -158,14 +160,14 @@ public class LitemallReservationServiceImpl implements LitemallReservationServic
} }
@Transactional
@Override @Override
public int addReservation(LitemallReservationDO litemallReservationDO) { public int addReservation(LitemallReservationDO litemallReservationDO) {
ConfigurationDO configurationDO = configurationMapper.selectOne("id", litemallReservationDO.getConfigurationId()); ConfigurationDO configurationDO = configurationMapper.selectOne("id", litemallReservationDO.getConfigurationId());
if (configurationDO.getResidueNumber() > 0){ //剩余预约人数大于0可预约 if (configurationDO.getResidueNumber() > 0){ //剩余预约人数大于0可预约
litemallReservationDO.setReStatus(1); litemallReservationDO.setReStatus(2);
litemallReservationMapper.insert(litemallReservationDO); litemallReservationMapper.insert(litemallReservationDO);
int a = configurationDO.getResidueNumber() - 1; int a = configurationDO.getResidueNumber() - 1;
if (a == 0){ if (a == 0){
@ -191,6 +193,9 @@ public class LitemallReservationServiceImpl implements LitemallReservationServic
if (litemallReservationDO.getReStatus() == 0){ if (litemallReservationDO.getReStatus() == 0){
litemallReservationDO.setStat("预约失败"); litemallReservationDO.setStat("预约失败");
} }
if (litemallReservationDO.getReStatus() == 2){
litemallReservationDO.setStat("待审核");
}
//门店信息 //门店信息
@ -222,4 +227,20 @@ public class LitemallReservationServiceImpl implements LitemallReservationServic
return litemallReservationDOList; return litemallReservationDOList;
} }
@Override
public Boolean checkLitemallReservation(Long id, Long check) {
LitemallReservationDO litemallReservationDO = litemallReservationMapper.selectOne("id", id);
if (check == 0){ //拒绝
litemallReservationDO.setReStatus(0);
}
if (check == 1){
litemallReservationDO.setReStatus(1);
}
litemallReservationMapper.updateById(litemallReservationDO);
return true;
}
} }