feat: 新增订单编辑、订单删除接口;优化新增订单飞行任务接口
This commit is contained in:
parent
b96e45024d
commit
b4249d89ff
@ -1,7 +1,10 @@
|
||||
package com.aircraft.modules.order.biz;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aircraft.exception.BadRequestException;
|
||||
import com.aircraft.modules.order.domain.OrderDetail;
|
||||
import com.aircraft.modules.order.domain.OrderMain;
|
||||
import com.aircraft.modules.order.domain.OrderOperator;
|
||||
@ -10,6 +13,7 @@ import com.aircraft.modules.order.domain.constant.OrderRedisConstant;
|
||||
import com.aircraft.modules.order.domain.dto.AddOrderDTO;
|
||||
import com.aircraft.modules.order.domain.dto.AddOrderTaskDTO;
|
||||
import com.aircraft.modules.order.domain.dto.OrderMainPageQueryDTO;
|
||||
import com.aircraft.modules.order.domain.dto.UpdateOrderDTO;
|
||||
import com.aircraft.modules.order.domain.enums.MainOrderStatusEnum;
|
||||
import com.aircraft.modules.order.domain.enums.OrderSettlementStatusEnum;
|
||||
import com.aircraft.modules.order.domain.enums.OrderTaskStatusEnum;
|
||||
@ -29,6 +33,7 @@ import com.aircraft.utils.PageResult;
|
||||
import com.aircraft.utils.RedisUtils;
|
||||
import com.aircraft.utils.SecurityUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
@ -98,14 +103,7 @@ public class OrderBiz {
|
||||
// 新增订单
|
||||
OrderMain orderMain = orderMainService.addOrder(buildOrderParam(addOrderDTO, orderInitiatorId));
|
||||
// 构建保存操作人信息
|
||||
List<Long> operatorIds = addOrderDTO.getOperatorIds();
|
||||
List<OrderOperator> orderOperatorList = new ArrayList<>();
|
||||
for (Long operatorId : operatorIds) {
|
||||
OrderOperator orderOperator = new OrderOperator();
|
||||
orderOperator.setOrderId(orderMain.getId());
|
||||
orderOperator.setOperatorId(operatorId);
|
||||
orderOperatorList.add(orderOperator);
|
||||
}
|
||||
List<OrderOperator> orderOperatorList = buildOrderOperatorParam(addOrderDTO.getOperatorIds(), orderMain.getId());
|
||||
// 批量新增订单操作人
|
||||
orderOperatorService.batchAddOrderOperator(orderOperatorList);
|
||||
}
|
||||
@ -156,6 +154,11 @@ public class OrderBiz {
|
||||
// 获取当前登录用户
|
||||
EmEmployees employees = JSON.parseObject(SecurityUtils.getCurrentEmployee(), EmEmployees.class);
|
||||
Long orderInitiatorId = employees.getId();
|
||||
|
||||
// 新建订单飞行任务限制(当前飞行员不能存在任务处于未进行,进行中)
|
||||
Long orderId = orderTaskDTO.getOrderId();
|
||||
orderDetailService.checkOrderDetail(orderId, orderInitiatorId);
|
||||
|
||||
// 构建任务参数
|
||||
OrderDetail orderTask = buildOrderTaskParam(orderTaskDTO, orderInitiatorId);
|
||||
// 批量新增
|
||||
@ -216,4 +219,84 @@ public class OrderBiz {
|
||||
public OrderAllDetailVO queryOrderDetail(Long id) {
|
||||
return new OrderAllDetailVO();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void editOrder(UpdateOrderDTO updateOrderDTO) {
|
||||
// 获取订单详情
|
||||
Long orderId = updateOrderDTO.getOrderId();
|
||||
OrderMain orderMain = orderMainService.obtainOrderMainById(orderId);
|
||||
if (ObjectUtil.isNull(orderMain)) {
|
||||
throw new BadRequestException("订单不存在");
|
||||
}
|
||||
// 判断当前订单状态是否处于未进行中
|
||||
if (!orderMain.getMainOrderStatus().equals(MainOrderStatusEnum.NOT_STARTED.getCode())) {
|
||||
throw new BadRequestException("当前订单状态不是未进行中,不允许修改");
|
||||
}
|
||||
// 判断当前登录人、是否为订单发起人,不是则不允许修改
|
||||
EmEmployees employees = JSON.parseObject(SecurityUtils.getCurrentEmployee(), EmEmployees.class);
|
||||
Long currentId = employees.getId();
|
||||
if (!currentId.equals(orderMain.getOrderInitiatorId())) {
|
||||
throw new BadRequestException("当前登录用户不是订单发起人,不允许修改");
|
||||
}
|
||||
// 当前若存在订单任务则不允许修改
|
||||
List<OrderDetail> orderDetailList = orderDetailService.queryOrderDetailByOrderId(orderId);
|
||||
if (CollectionUtil.isNotEmpty(orderDetailList)) {
|
||||
throw new BadRequestException("当前订单存在订单任务,不允许修改");
|
||||
}
|
||||
// 进行更新订单
|
||||
orderMainService.editOrder(updateOrderDTO);
|
||||
|
||||
// 删除相关的操作人表,进行新增操作
|
||||
orderOperatorService.deleteOrderOperatorByOrderId(orderId);
|
||||
// 进行新增操作员
|
||||
orderOperatorService.batchAddOrderOperator(buildOrderOperatorParam(updateOrderDTO.getOperatorIds(), orderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
* @param orderId 订单ID
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteOrder(Long orderId) {
|
||||
// 获取订单详情
|
||||
OrderMain orderMain = orderMainService.obtainOrderMainById(orderId);
|
||||
if (ObjectUtil.isNull(orderMain)) {
|
||||
throw new BadRequestException("订单不存在");
|
||||
}
|
||||
// 判断当前订单状态是否处于未进行中
|
||||
if (!orderMain.getMainOrderStatus().equals(MainOrderStatusEnum.NOT_STARTED.getCode())) {
|
||||
throw new BadRequestException("当前订单状态不是处于未进行中,不允许删除");
|
||||
}
|
||||
// 检查是否存在订单任务
|
||||
List<OrderDetail> orderDetailList = orderDetailService.queryOrderDetailByOrderId(orderId);
|
||||
if (CollectionUtil.isNotEmpty(orderDetailList)) {
|
||||
throw new BadRequestException("当前订单存在订单任务,不允许删除");
|
||||
}
|
||||
// 删除相关记录
|
||||
orderMainService.deleteOrderMainById(orderId);
|
||||
orderDetailService.deleteOrderDetailByOrderId(orderId);
|
||||
orderOperatorService.deleteOrderOperatorByOrderId(orderId);
|
||||
attachmentMaterialService.deleteAttachmentMaterialByBusinessId(orderId, AttachmentMaterialBusinessTypeEnum.ORDER_TASK_MATERIAL.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建新增操作员参数
|
||||
*
|
||||
* @param operatorIds 操作员集合
|
||||
* @param orderId 订单ID
|
||||
* @return {@link List<OrderOperator>}
|
||||
*/
|
||||
private List<OrderOperator> buildOrderOperatorParam(List<Long> operatorIds, Long orderId) {
|
||||
List<OrderOperator> orderOperatorList = new ArrayList<>();
|
||||
for (Long operatorId : operatorIds) {
|
||||
OrderOperator orderOperator = new OrderOperator();
|
||||
orderOperator.setOrderId(orderId);
|
||||
orderOperator.setOperatorId(operatorId);
|
||||
orderOperatorList.add(orderOperator);
|
||||
}
|
||||
return orderOperatorList;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.aircraft.modules.order.biz.OrderBiz;
|
||||
import com.aircraft.modules.order.domain.dto.AddOrderDTO;
|
||||
import com.aircraft.modules.order.domain.dto.AddOrderTaskDTO;
|
||||
import com.aircraft.modules.order.domain.dto.OrderMainPageQueryDTO;
|
||||
import com.aircraft.modules.order.domain.dto.UpdateOrderDTO;
|
||||
import com.aircraft.modules.order.domain.vo.OrderAllDetailVO;
|
||||
import com.aircraft.modules.order.domain.vo.OrderMainPageQueryVO;
|
||||
import com.aircraft.utils.PageResult;
|
||||
@ -51,6 +52,21 @@ public class OrderMainController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("编辑订单")
|
||||
@PutMapping("/editOrder")
|
||||
public ResponseEntity<Object> editOrder(@RequestBody @Validated UpdateOrderDTO updateOrderDTO) {
|
||||
orderBiz.editOrder(updateOrderDTO);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("删除订单接口")
|
||||
@DeleteMapping("/deleteOrder/{orderId}")
|
||||
public ResponseEntity<Object> deleteOrder(@PathVariable("orderId") Long orderId) {
|
||||
orderBiz.deleteOrder(orderId);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("新增订单任务")
|
||||
@PostMapping("/addOrderTask")
|
||||
public ResponseEntity<Object> addOrderTask(@RequestBody @Validated AddOrderTaskDTO orderTaskDTO) {
|
||||
|
@ -25,28 +25,28 @@ public class AddOrderDTO {
|
||||
/**
|
||||
* 订单类型: 目前只有一种类型载物:值为 1
|
||||
*/
|
||||
@ApiModelProperty(value = "订单类型", example = "1:载物类型")
|
||||
@ApiModelProperty(value = "订单类型", example = "1:载物类型", required = true)
|
||||
private Integer orderType;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
@NotNull(message = "客户ID不能为空")
|
||||
@ApiModelProperty(value = "客户ID")
|
||||
@ApiModelProperty(value = "客户ID", required = true)
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 客户手机号
|
||||
*/
|
||||
@NotBlank(message = "客户手机号不能为空")
|
||||
@ApiModelProperty(value = "客户手机号")
|
||||
@ApiModelProperty(value = "客户手机号", required = true)
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 景区ID
|
||||
*/
|
||||
@NotNull(message = "景区ID不能为空")
|
||||
@ApiModelProperty(value = "景区ID")
|
||||
@ApiModelProperty(value = "景区ID", required = true)
|
||||
private Long attractionId;
|
||||
|
||||
/**
|
||||
@ -54,7 +54,7 @@ public class AddOrderDTO {
|
||||
*/
|
||||
@NotNull
|
||||
@NotEmpty(message = "路线ID集合不能为空")
|
||||
@ApiModelProperty(value = "路线ID集合")
|
||||
@ApiModelProperty(value = "路线ID集合", required = true)
|
||||
private List<Long> routeIds;
|
||||
|
||||
/**
|
||||
@ -62,13 +62,14 @@ public class AddOrderDTO {
|
||||
*/
|
||||
@NotNull
|
||||
@DecimalMin(value = "0.01", message = "货物重量必须大于0")
|
||||
@ApiModelProperty(value = "货物重量")
|
||||
@ApiModelProperty(value = "货物重量", required = true)
|
||||
private BigDecimal cargoWeight;
|
||||
|
||||
/**
|
||||
* 额外费用
|
||||
*/
|
||||
@ApiModelProperty(value = "额外费用")
|
||||
@ApiModelProperty(value = "额外费用", required = true)
|
||||
@DecimalMin(value = "0", message = "额外费用不能小于0")
|
||||
private BigDecimal surchargeAmount;
|
||||
|
||||
/**
|
||||
@ -76,7 +77,7 @@ public class AddOrderDTO {
|
||||
*/
|
||||
@NotNull(message = "操作人集合ID不能为空")
|
||||
@NotEmpty
|
||||
@ApiModelProperty(value = "操作人集合ID")
|
||||
@ApiModelProperty(value = "操作人集合ID", required = true)
|
||||
private List<Long> operatorIds;
|
||||
|
||||
/**
|
||||
@ -84,7 +85,7 @@ public class AddOrderDTO {
|
||||
*/
|
||||
@NotNull(message = "下单时间不能为空")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "下单时间", example = "2023-08-01 12:00:00")
|
||||
@ApiModelProperty(value = "下单时间", example = "2023-08-01 12:00:00", required = true)
|
||||
private Date orderCreateTime;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,79 @@
|
||||
package com.aircraft.modules.order.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 编辑订单信息DTO
|
||||
*
|
||||
* @author chenxiky
|
||||
* @version 1.0.0
|
||||
* @since 2025/7/20
|
||||
*/
|
||||
@Data
|
||||
public class UpdateOrderDTO {
|
||||
|
||||
@NotNull(message = "订单ID不能为空")
|
||||
@ApiModelProperty(value = "订单ID", required = true)
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 客户ID
|
||||
*/
|
||||
@NotNull(message = "客户ID不能为空")
|
||||
@ApiModelProperty(value = "客户ID", required = true)
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 客户手机号
|
||||
*/
|
||||
@NotBlank(message = "客户手机号不能为空")
|
||||
@ApiModelProperty(value = "客户手机号", required = true)
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 景区ID
|
||||
*/
|
||||
@NotNull(message = "景区ID不能为空")
|
||||
@ApiModelProperty(value = "景区ID", required = true)
|
||||
private Long attractionId;
|
||||
|
||||
/**
|
||||
* 路线ID集合
|
||||
*/
|
||||
@NotNull
|
||||
@NotEmpty(message = "路线ID集合不能为空")
|
||||
@ApiModelProperty(value = "路线ID集合", required = true)
|
||||
private List<Long> routeIds;
|
||||
|
||||
/**
|
||||
* 货物重量
|
||||
*/
|
||||
@NotNull
|
||||
@DecimalMin(value = "0.01", message = "货物重量必须大于0")
|
||||
@ApiModelProperty(value = "货物重量", required = true)
|
||||
private BigDecimal cargoWeight;
|
||||
|
||||
/**
|
||||
* 操作人集合ID
|
||||
*/
|
||||
@NotNull(message = "操作人集合ID不能为空")
|
||||
@NotEmpty
|
||||
@ApiModelProperty(value = "操作人集合ID", required = true)
|
||||
private List<Long> operatorIds;
|
||||
|
||||
/**
|
||||
* 额外费用
|
||||
*/
|
||||
@ApiModelProperty(value = "额外费用", required = true)
|
||||
@DecimalMin(value = "0", message = "额外费用不能小于0")
|
||||
private BigDecimal surchargeAmount;
|
||||
|
||||
}
|
@ -3,6 +3,8 @@ package com.aircraft.modules.order.service;
|
||||
import com.aircraft.modules.order.domain.OrderDetail;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 订单明细表 服务类
|
||||
@ -16,7 +18,30 @@ public interface IOrderDetailService extends IService<OrderDetail> {
|
||||
/**
|
||||
* 新增订单明细
|
||||
*
|
||||
* @param orderTask {@link OrderTask}订单任务
|
||||
* @param orderTask {@link OrderDetail}订单任务
|
||||
*/
|
||||
void addOrderDetail(OrderDetail orderTask);
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*
|
||||
* @param orderId 订单ID
|
||||
* @return List<OrderDetail>
|
||||
*/
|
||||
List<OrderDetail> queryOrderDetailByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 根据订单ID删除订单详情
|
||||
*
|
||||
* @param orderId 订单ID
|
||||
*/
|
||||
void deleteOrderDetailByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 检查飞行员当前是否存在任务状态处于未进行或者进行中
|
||||
*
|
||||
* @param orderId 订单ID
|
||||
* @param orderInitiatorId 飞行员ID
|
||||
*/
|
||||
void checkOrderDetail(Long orderId, Long orderInitiatorId);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.aircraft.modules.order.service;
|
||||
|
||||
import com.aircraft.modules.order.domain.OrderMain;
|
||||
import com.aircraft.modules.order.domain.dto.OrderMainPageQueryDTO;
|
||||
import com.aircraft.modules.order.domain.dto.UpdateOrderDTO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
@ -33,4 +34,26 @@ public interface IOrderMainService extends IService<OrderMain> {
|
||||
* @return {@link OrderMain}
|
||||
*/
|
||||
OrderMain addOrder(OrderMain orderMain);
|
||||
|
||||
/**
|
||||
* 修改订单
|
||||
*
|
||||
* @param updateOrderDTO {@link UpdateOrderDTO}
|
||||
*/
|
||||
void editOrder(UpdateOrderDTO updateOrderDTO);
|
||||
|
||||
/**
|
||||
* 根据订单ID查询订单
|
||||
*
|
||||
* @param orderId 订单ID
|
||||
* @return {@link OrderMain}
|
||||
*/
|
||||
OrderMain obtainOrderMainById(Long orderId);
|
||||
|
||||
/**
|
||||
* 根据订单ID删除
|
||||
*
|
||||
* @param orderId 订单ID
|
||||
*/
|
||||
void deleteOrderMainById(Long orderId);
|
||||
}
|
||||
|
@ -30,4 +30,11 @@ public interface IOrderOperatorService extends IService<OrderOperator> {
|
||||
* @return boolean
|
||||
*/
|
||||
boolean batchAddOrderOperator(List<OrderOperator> orderOperatorList);
|
||||
|
||||
/**
|
||||
* 根据订单ID删除
|
||||
*
|
||||
* @param orderId 订单ID
|
||||
*/
|
||||
void deleteOrderOperatorByOrderId(Long orderId);
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
package com.aircraft.modules.order.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.aircraft.exception.BadRequestException;
|
||||
import com.aircraft.modules.order.domain.OrderDetail;
|
||||
import com.aircraft.modules.order.domain.enums.OrderTaskStatusEnum;
|
||||
import com.aircraft.modules.order.mapper.OrderDetailMapper;
|
||||
import com.aircraft.modules.order.service.IOrderDetailService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 订单明细表 服务实现类
|
||||
@ -21,4 +27,31 @@ public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, Order
|
||||
public void addOrderDetail(OrderDetail orderTask) {
|
||||
this.save(orderTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderDetail> queryOrderDetailByOrderId(Long orderId) {
|
||||
return this.list(Wrappers.lambdaQuery(OrderDetail.class).eq(OrderDetail::getOrderId, orderId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOrderDetailByOrderId(Long orderId) {
|
||||
// 根据订单ID 删除
|
||||
this.remove(Wrappers.<OrderDetail>lambdaQuery().eq(OrderDetail::getOrderId, orderId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkOrderDetail(Long orderId, Long orderInitiatorId) {
|
||||
// 根据订单ID,飞行员ID查询,结果集返回一个
|
||||
OrderDetail orderDetail = list(
|
||||
Wrappers.lambdaQuery(OrderDetail.class)
|
||||
.eq(OrderDetail::getOrderId, orderId)
|
||||
.eq(OrderDetail::getOperatorId, orderInitiatorId)
|
||||
.in(OrderDetail::getOrderItemStatus, OrderTaskStatusEnum.NOT_STARTED.getCode(), OrderTaskStatusEnum.PROCESSING.getCode())
|
||||
).stream().findFirst().orElse(null);
|
||||
|
||||
if (ObjectUtil.isNull(orderDetail)) {
|
||||
return;
|
||||
}
|
||||
throw new BadRequestException("新增订单飞行任务: 同一个订单同一个飞行员下,只能存在一个任务状态处于[未进行或进行中]");
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,19 @@
|
||||
package com.aircraft.modules.order.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aircraft.modules.order.domain.OrderMain;
|
||||
import com.aircraft.modules.order.domain.dto.OrderMainPageQueryDTO;
|
||||
import com.aircraft.modules.order.domain.dto.UpdateOrderDTO;
|
||||
import com.aircraft.modules.order.mapper.OrderMainMapper;
|
||||
import com.aircraft.modules.order.service.IOrderMainService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -47,4 +51,30 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
|
||||
this.save(orderMain);
|
||||
return orderMain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editOrder(UpdateOrderDTO updateOrderDTO) {
|
||||
// 路线多个用逗号隔开
|
||||
String routeIdsStr = updateOrderDTO.getRouteIds().stream().map(Object::toString).collect(Collectors.joining(StrUtil.COMMA));
|
||||
// 按需更新字段
|
||||
LambdaUpdateWrapper<OrderMain> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(OrderMain::getId, updateOrderDTO.getOrderId())
|
||||
.set(OrderMain::getCustomerId, updateOrderDTO.getCustomerId())
|
||||
.set(OrderMain::getPhone, updateOrderDTO.getPhone())
|
||||
.set(OrderMain::getAttractionId, updateOrderDTO.getAttractionId())
|
||||
.set(OrderMain::getRouteIds, routeIdsStr)
|
||||
.set(OrderMain::getCargoWeight, updateOrderDTO.getCargoWeight())
|
||||
.set(OrderMain::getSurchargeAmount, updateOrderDTO.getSurchargeAmount());
|
||||
this.update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderMain obtainOrderMainById(Long orderId) {
|
||||
return getById(orderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOrderMainById(Long orderId) {
|
||||
this.removeById(orderId);
|
||||
}
|
||||
}
|
||||
|
@ -32,4 +32,12 @@ public class OrderOperatorServiceImpl extends ServiceImpl<OrderOperatorMapper, O
|
||||
public boolean batchAddOrderOperator(List<OrderOperator> orderOperatorList) {
|
||||
return this.saveBatch(orderOperatorList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOrderOperatorByOrderId(Long orderId) {
|
||||
// 根据订单ID 删除
|
||||
LambdaQueryWrapper<OrderOperator> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(OrderOperator::getOrderId, orderId);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
@ -21,4 +21,12 @@ public interface IAttachmentMaterialService extends IService<AttachmentMaterial>
|
||||
* @param attachmentMaterialList {@link List<AttachmentMaterial>}
|
||||
*/
|
||||
void batchAddAttachmentMaterial(List<AttachmentMaterial> attachmentMaterialList);
|
||||
|
||||
/**
|
||||
* 根据业务ID删除材料
|
||||
*
|
||||
* @param orderId 业务ID
|
||||
* @param code 业务编码
|
||||
*/
|
||||
void deleteAttachmentMaterialByBusinessId(Long orderId, String code);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.aircraft.modules.system.service.impl;
|
||||
import com.aircraft.modules.system.domain.AttachmentMaterial;
|
||||
import com.aircraft.modules.system.mapper.AttachmentMaterialMapper;
|
||||
import com.aircraft.modules.system.service.IAttachmentMaterialService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -23,4 +24,12 @@ public class AttachmentMaterialServiceImpl extends ServiceImpl<AttachmentMateria
|
||||
public void batchAddAttachmentMaterial(List<AttachmentMaterial> attachmentMaterialList) {
|
||||
this.saveBatch(attachmentMaterialList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAttachmentMaterialByBusinessId(Long orderId, String code) {
|
||||
// 根据业务ID 和 code 删除记录
|
||||
this.remove(Wrappers.<AttachmentMaterial>lambdaQuery()
|
||||
.eq(AttachmentMaterial::getBusinessId, orderId)
|
||||
.eq(AttachmentMaterial::getBusinessType, code));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user