diff --git a/src/main/java/com/chint/application/dtos/OrderDetailQueryParam.java b/src/main/java/com/chint/application/dtos/OrderDetailQueryParam.java new file mode 100644 index 00000000..80769d99 --- /dev/null +++ b/src/main/java/com/chint/application/dtos/OrderDetailQueryParam.java @@ -0,0 +1,6 @@ +package com.chint.application.dtos; + +import com.chint.domain.value_object.BaseQuery; + +public class OrderDetailQueryParam extends BaseQuery { +} diff --git a/src/main/java/com/chint/application/dtos/response/RouteOrderPageRes.java b/src/main/java/com/chint/application/dtos/response/RouteOrderPageRes.java index f2c05870..b8d9b9af 100644 --- a/src/main/java/com/chint/application/dtos/response/RouteOrderPageRes.java +++ b/src/main/java/com/chint/application/dtos/response/RouteOrderPageRes.java @@ -34,6 +34,7 @@ public class RouteOrderPageRes { private String amount; private String estimateAmount; private Integer orderStatus; + private String approvalStatusCode; private String approvalStatus; private String orderStatusName; private String startTime; diff --git a/src/main/java/com/chint/application/in/OrderController.java b/src/main/java/com/chint/application/in/OrderController.java index 1ba1dec0..ffa7874a 100644 --- a/src/main/java/com/chint/application/in/OrderController.java +++ b/src/main/java/com/chint/application/in/OrderController.java @@ -80,6 +80,15 @@ public class OrderController { return Result.Success(SUCCESS); } + @Transactional + @ApiOperation("修改行程节点") + @PostMapping("/leg/update") + public Result updateLeg(@RequestBody AddLegData addLegData) { + orderApplicationService.updateLegToOrder(addLegData); + return Result.Success(SUCCESS); + } + + @Transactional @ApiOperation("删除行程节点") @PostMapping("/leg/delete") diff --git a/src/main/java/com/chint/application/out/OrderDetailController.java b/src/main/java/com/chint/application/out/OrderDetailController.java index dd1a5b10..b84f7c47 100644 --- a/src/main/java/com/chint/application/out/OrderDetailController.java +++ b/src/main/java/com/chint/application/out/OrderDetailController.java @@ -1,11 +1,9 @@ package com.chint.application.out; import cn.hutool.core.bean.BeanUtil; -import com.chint.application.dtos.AuthenticationDto; -import com.chint.application.dtos.AuthenticationSignDto; -import com.chint.application.dtos.LocationParam; -import com.chint.application.dtos.OrderSearchResult; +import com.chint.application.dtos.*; import com.chint.application.dtos.response.LocationRes; +import com.chint.application.dtos.response.OrderDetailRes; import com.chint.domain.aggregates.order.Location; import com.chint.domain.repository.ClientRepository; import com.chint.domain.repository.LocationRepository; @@ -71,4 +69,11 @@ public class OrderDetailController { return Result.error("签名错误"); } } + + @ApiOperation("查询我的订单") + @PostMapping("/query/page") + public Result query(@RequestBody OrderDetailQueryParam orderDetailQueryParam){ + + return null; + } } \ No newline at end of file diff --git a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java new file mode 100644 index 00000000..dc02678e --- /dev/null +++ b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java @@ -0,0 +1,22 @@ +package com.chint.application.queryies; + + +import com.chint.application.dtos.OrderDetailQueryParam; +import com.chint.application.dtos.response.OrderDetailRes; +import com.chint.domain.repository.OrderDetailRepository; +import com.chint.infrastructure.util.PageResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class OrderDetailQuery { + + @Autowired + private OrderDetailRepository orderDetailRepository; + + + public PageResult orderDetailPageQuery(OrderDetailQueryParam orderDetailQueryParam) { + + return null; + } +} diff --git a/src/main/java/com/chint/application/services/OrderApplicationService.java b/src/main/java/com/chint/application/services/OrderApplicationService.java index 07550796..29a25522 100644 --- a/src/main/java/com/chint/application/services/OrderApplicationService.java +++ b/src/main/java/com/chint/application/services/OrderApplicationService.java @@ -149,4 +149,8 @@ public class OrderApplicationService { public void reloadOrderDetail(SyncLegData syncLegData) { } + + @Transactional + public void updateLegToOrder(AddLegData addLegData) { + } } diff --git a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java index 943e4206..80881c49 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java @@ -32,6 +32,7 @@ public class OrderDetail { private CurrencyType currencyType; //货币类型 private Long destinationId; private Long originId; + private String employeeNo; private LocalDateTime orderDate; private LocalDateTime startTime; private LocalDateTime endTime; @@ -69,7 +70,10 @@ public class OrderDetail { orderDetail.setUpdateTime(LocalDateTime.now()); return orderDetail; } - + public OrderDetail employeeNo(String employeeNo) { + this.setEmployeeNo(employeeNo); + return this; + } public OrderDetail productType(Integer productType) { this.setProductType(productType); return this; diff --git a/src/main/java/com/chint/domain/repository/OrderDetailRepository.java b/src/main/java/com/chint/domain/repository/OrderDetailRepository.java index c441d947..c4ada0a8 100644 --- a/src/main/java/com/chint/domain/repository/OrderDetailRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderDetailRepository.java @@ -1,11 +1,15 @@ package com.chint.domain.repository; +import com.chint.application.dtos.OrderDetailQueryParam; import com.chint.domain.aggregates.order.OrderDetail; +import org.springframework.data.domain.Page; import java.util.List; import java.util.Optional; public interface OrderDetailRepository { + + Page pageQuery(OrderDetailQueryParam orderDetailQueryParam); OrderDetail findById(Long orderDetailId); List findByLegId(Long legId); diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java index 5ef1b178..4990c620 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java @@ -153,7 +153,8 @@ public class LegEventHandler implements LegEventService { if (byOrderNo.isEmpty()) { //否则创建新的订单添加到routeOrder orderDetail = orderDetailFactory.create(data) - .price(data.getPrice()).productType(data.getProductType()); + .price(data.getPrice()).productType(data.getProductType()) + .employeeNo(routeOrder.getUserId()); routeOrder.addOrderDetail(orderDetail); routeOrder = routeRepository.save(routeOrder); // OrderDetail orderDetail = routeOrder diff --git a/src/main/java/com/chint/infrastructure/repository/OrderDetailRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderDetailRepositoryImpl.java index 9a3856fc..c4164f72 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderDetailRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderDetailRepositoryImpl.java @@ -1,10 +1,15 @@ package com.chint.infrastructure.repository; +import com.chint.application.dtos.OrderDetailQueryParam; import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.repository.OrderDetailRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository; +import com.chint.infrastructure.util.BaseContext; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Repository; import java.util.List; @@ -17,6 +22,14 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository { @Autowired private JdbcOrderDetailRepository orderDetailRepository; + @Override + public Page pageQuery(OrderDetailQueryParam orderDetailQueryParam) { + PageRequest pageRequest = PageRequest + .of(orderDetailQueryParam.getPageNum() - 1, orderDetailQueryParam.getPageSize(), Sort.by("updateTime")); + String employeeNo = BaseContext.getCurrentUser().getEmployeeNo(); + return orderDetailRepository.findByEmployeeNo(employeeNo, pageRequest); + } + @Override public OrderDetail findById(Long orderDetailId) { return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND)); diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java index 05b8df02..7349cee2 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java @@ -1,6 +1,8 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.order.OrderDetail; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @@ -12,4 +14,6 @@ public interface JdbcOrderDetailRepository extends CrudRepository findByLegId(Long legId); + + Page findByEmployeeNo(String employeeNo, Pageable pageable); }