This commit is contained in:
xiaofajia 2024-11-06 15:07:08 +08:00
parent 20b6bbe763
commit 8bd53b225c

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.booking.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.RepairRoleEnum;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
@ -23,16 +24,19 @@ import cn.iocoder.yudao.module.system.api.service.dto.ServicePackageDto;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.catalina.User;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -71,7 +75,31 @@ public class DlRepairBookingServiceImpl extends ServiceImpl<DlRepairBookingMappe
* @param repairBookingRespVO 预约对象
**/
@Override
@DSTransactional
public void updateBooking(DlRepairBookingRespVO repairBookingRespVO){
// 构建消息
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList("repair_type");
DictDataRespDTO dictDataRespDTO = dataList.stream().filter(item -> item.getValue().equals(repairBookingRespVO.getRepairType())).findFirst().orElse(null);
String message = String.format(
"%s(%s)预约了%s的%s",
repairBookingRespVO.getUserName(),
repairBookingRespVO.getUserMobile(),
formatter.format(repairBookingRespVO.getBookingTime()),
dictDataRespDTO != null ? dictDataRespDTO.getLabel() : "维修保养"
);
// 选择了服务顾问
if (ObjectUtil.isNotEmpty(repairBookingRespVO.getAdviserId())){
// 站内信通知
// websocket通知
}else {
// 没选服务顾问
// 获取所有的服务顾问
// 站内信通知和websocket通知
}
// 正常的新增修改
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
Optional.ofNullable(loginUserId).ifPresent(repairBookingRespVO::setUserId);
repairBookingRespVO.setBookingStatus("01");