Compare commits
No commits in common. "6b5ba72b0affb76252a7c91c3eae0371d418182d" and "a7135b440aaed7eae462312a267964c103d4681a" have entirely different histories.
6b5ba72b0a
...
a7135b440a
@ -55,10 +55,5 @@ 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 })
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,6 @@ 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',
|
||||||
|
|
||||||
|
@ -33,11 +33,10 @@
|
|||||||
/>
|
/>
|
||||||
</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="结束日期"
|
||||||
/>
|
/>
|
||||||
@ -107,7 +106,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|||||||
/** 提交表单 */
|
/** 提交表单 */
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
console.log('11111111111',JSON.stringify(formData.value.timeInterval))
|
console.log('11111111111',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()
|
||||||
|
@ -148,26 +148,25 @@
|
|||||||
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.SUBSCRIBE_RESERVATION_STATUS" :value="scope.row.status" />
|
<dict-tag :type="DICT_TYPE.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
|
||||||
<el-table-column label="审核" align="center" fixed="right" width="110">
|
label="创建时间"
|
||||||
|
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
|
||||||
@ -178,42 +177,13 @@
|
|||||||
编辑
|
编辑
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.reStatus == 2"
|
|
||||||
link
|
link
|
||||||
type="success"
|
type="danger"
|
||||||
@click="handleTonguo(scope.row.id)"
|
@click="handleDelete(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>
|
||||||
@ -263,7 +233,6 @@ const queryParams = reactive({
|
|||||||
technicianName: undefined,
|
technicianName: undefined,
|
||||||
technicianId: undefined,
|
technicianId: undefined,
|
||||||
reStatus: undefined,
|
reStatus: undefined,
|
||||||
status: undefined,
|
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
createTime: []
|
createTime: []
|
||||||
})
|
})
|
||||||
@ -300,28 +269,14 @@ const openForm = (type: string, id?: number) => {
|
|||||||
formRef.value.open(type, id)
|
formRef.value.open(type, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 审核通过按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleTonguo = async (id: number) => {
|
const handleDelete = async (id: number) => {
|
||||||
|
|
||||||
const check = 1;
|
|
||||||
try {
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
// 发起删除
|
// 发起删除
|
||||||
await LitemallReservationApi.checkLitemallReservation(id,check)
|
await LitemallReservationApi.deleteLitemallReservation(id)
|
||||||
message.success(t('审核成功'))
|
message.success(t('common.delSuccess'))
|
||||||
// 刷新列表
|
|
||||||
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 {}
|
||||||
|
@ -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="220">
|
<el-table-column label="操作" align="center" fixed="right" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="info" @click="openday(scope.row.projectId,scope.row.id)">
|
<el-button @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']">
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 业务组件 -->
|
<!-- 业务组件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
@ -105,8 +105,8 @@ public class ConfigurationController {
|
|||||||
|
|
||||||
//添加预约套餐时间段配置
|
//添加预约套餐时间段配置
|
||||||
@PostMapping("/addUpdConfiguration")
|
@PostMapping("/addUpdConfiguration")
|
||||||
public CommonResult<Integer> addConfiguration(@RequestBody ConfigurationDO pageReqVO) {
|
public CommonResult<Long> addConfiguration(@RequestBody ConfigurationDO pageReqVO) {
|
||||||
Integer aLong = configurationService.addUpdConfiguration(pageReqVO);
|
Long aLong = configurationService.addUpdConfiguration(pageReqVO);
|
||||||
return success(aLong);
|
return success(aLong);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,11 +94,4 @@ 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -57,7 +57,7 @@ public interface ConfigurationService {
|
|||||||
|
|
||||||
List<ServiceTimeVO> getConfiguration(Integer id);
|
List<ServiceTimeVO> getConfiguration(Integer id);
|
||||||
|
|
||||||
Integer addUpdConfiguration(ConfigurationDO pageReqVO);
|
Long addUpdConfiguration(ConfigurationDO pageReqVO);
|
||||||
|
|
||||||
List<ConfigurationDO> getConfigurationList(Integer projectdayId, Integer technicianId);
|
List<ConfigurationDO> getConfigurationList(Integer projectdayId, Integer technicianId);
|
||||||
|
|
||||||
|
@ -13,8 +13,6 @@ 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;
|
||||||
|
|
||||||
@ -103,87 +101,36 @@ public class ConfigurationServiceImpl implements ConfigurationService {
|
|||||||
serviceTimeVOList.add(serviceTimeVO);
|
serviceTimeVOList.add(serviceTimeVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return serviceTimeVOList;
|
return serviceTimeVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public Integer addUpdConfiguration(ConfigurationDO pageReqVO) {
|
public Long 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);
|
||||||
if (serviceTimeVO.getId() == null){ //不存在,添加进时间段
|
configurationDO.setAvailableNumber(Integer.parseInt(serviceTimeVO.getSubscribeNum()));
|
||||||
|
configurationDO.setResidueNumber(Integer.parseInt(serviceTimeVO.getSubscribeNum()));
|
||||||
ConfigurationDO configurationDO = new ConfigurationDO();
|
configurationDO.setStatus(1);
|
||||||
configurationDO.setTechnicianId(pageReqVO.getTechnicianId());
|
configurationMapper.insert(configurationDO);
|
||||||
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
|
||||||
@ -195,21 +142,4 @@ 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -13,7 +13,6 @@ 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;
|
||||||
@ -67,21 +66,37 @@ 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"
|
// 定义日期格式
|
||||||
String finalDateString = dateString(timeIntervalArray[0], timeIntervalArray[1]);
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
// 定义起始日期和结束日期
|
||||||
|
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);
|
||||||
@ -95,93 +110,8 @@ 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());
|
||||||
// 更新
|
// 更新
|
||||||
|
@ -4,7 +4,6 @@ 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;
|
||||||
@ -72,8 +71,4 @@ public interface LitemallReservationService {
|
|||||||
|
|
||||||
List<LitemallReservationDO> reservationInfo(Long userId);
|
List<LitemallReservationDO> reservationInfo(Long userId);
|
||||||
|
|
||||||
Boolean checkLitemallReservation( Long id, Long check);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -22,8 +22,6 @@ 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;
|
||||||
@ -160,14 +158,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(2);
|
litemallReservationDO.setReStatus(1);
|
||||||
litemallReservationMapper.insert(litemallReservationDO);
|
litemallReservationMapper.insert(litemallReservationDO);
|
||||||
int a = configurationDO.getResidueNumber() - 1;
|
int a = configurationDO.getResidueNumber() - 1;
|
||||||
if (a == 0){
|
if (a == 0){
|
||||||
@ -193,9 +191,6 @@ public class LitemallReservationServiceImpl implements LitemallReservationServic
|
|||||||
if (litemallReservationDO.getReStatus() == 0){
|
if (litemallReservationDO.getReStatus() == 0){
|
||||||
litemallReservationDO.setStat("预约失败");
|
litemallReservationDO.setStat("预约失败");
|
||||||
}
|
}
|
||||||
if (litemallReservationDO.getReStatus() == 2){
|
|
||||||
litemallReservationDO.setStat("待审核");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//门店信息
|
//门店信息
|
||||||
@ -227,20 +222,4 @@ 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user