同步代码

This commit is contained in:
lulz1 2024-02-29 09:28:18 +08:00
parent fc6a2821d5
commit a0ef0eef99
11 changed files with 79 additions and 6 deletions

View File

@ -0,0 +1,6 @@
package com.chint.application.dtos;
import com.chint.domain.value_object.BaseQuery;
public class OrderDetailQueryParam extends BaseQuery {
}

View File

@ -34,6 +34,7 @@ public class RouteOrderPageRes {
private String amount; private String amount;
private String estimateAmount; private String estimateAmount;
private Integer orderStatus; private Integer orderStatus;
private String approvalStatusCode;
private String approvalStatus; private String approvalStatus;
private String orderStatusName; private String orderStatusName;
private String startTime; private String startTime;

View File

@ -80,6 +80,15 @@ public class OrderController {
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
@Transactional
@ApiOperation("修改行程节点")
@PostMapping("/leg/update")
public Result<String> updateLeg(@RequestBody AddLegData addLegData) {
orderApplicationService.updateLegToOrder(addLegData);
return Result.Success(SUCCESS);
}
@Transactional @Transactional
@ApiOperation("删除行程节点") @ApiOperation("删除行程节点")
@PostMapping("/leg/delete") @PostMapping("/leg/delete")

View File

@ -1,11 +1,9 @@
package com.chint.application.out; package com.chint.application.out;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.chint.application.dtos.AuthenticationDto; import com.chint.application.dtos.*;
import com.chint.application.dtos.AuthenticationSignDto;
import com.chint.application.dtos.LocationParam;
import com.chint.application.dtos.OrderSearchResult;
import com.chint.application.dtos.response.LocationRes; 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.aggregates.order.Location;
import com.chint.domain.repository.ClientRepository; import com.chint.domain.repository.ClientRepository;
import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.LocationRepository;
@ -71,4 +69,11 @@ public class OrderDetailController {
return Result.error("签名错误"); return Result.error("签名错误");
} }
} }
@ApiOperation("查询我的订单")
@PostMapping("/query/page")
public Result<OrderDetailRes> query(@RequestBody OrderDetailQueryParam orderDetailQueryParam){
return null;
}
} }

View File

@ -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<OrderDetailRes> orderDetailPageQuery(OrderDetailQueryParam orderDetailQueryParam) {
return null;
}
}

View File

@ -149,4 +149,8 @@ public class OrderApplicationService {
public void reloadOrderDetail(SyncLegData syncLegData) { public void reloadOrderDetail(SyncLegData syncLegData) {
} }
@Transactional
public void updateLegToOrder(AddLegData addLegData) {
}
} }

View File

@ -32,6 +32,7 @@ public class OrderDetail {
private CurrencyType currencyType; //货币类型 private CurrencyType currencyType; //货币类型
private Long destinationId; private Long destinationId;
private Long originId; private Long originId;
private String employeeNo;
private LocalDateTime orderDate; private LocalDateTime orderDate;
private LocalDateTime startTime; private LocalDateTime startTime;
private LocalDateTime endTime; private LocalDateTime endTime;
@ -69,7 +70,10 @@ public class OrderDetail {
orderDetail.setUpdateTime(LocalDateTime.now()); orderDetail.setUpdateTime(LocalDateTime.now());
return orderDetail; return orderDetail;
} }
public OrderDetail employeeNo(String employeeNo) {
this.setEmployeeNo(employeeNo);
return this;
}
public OrderDetail productType(Integer productType) { public OrderDetail productType(Integer productType) {
this.setProductType(productType); this.setProductType(productType);
return this; return this;

View File

@ -1,11 +1,15 @@
package com.chint.domain.repository; package com.chint.domain.repository;
import com.chint.application.dtos.OrderDetailQueryParam;
import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.OrderDetail;
import org.springframework.data.domain.Page;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
public interface OrderDetailRepository { public interface OrderDetailRepository {
Page<OrderDetail> pageQuery(OrderDetailQueryParam orderDetailQueryParam);
OrderDetail findById(Long orderDetailId); OrderDetail findById(Long orderDetailId);
List<OrderDetail> findByLegId(Long legId); List<OrderDetail> findByLegId(Long legId);

View File

@ -153,7 +153,8 @@ public class LegEventHandler implements LegEventService {
if (byOrderNo.isEmpty()) { if (byOrderNo.isEmpty()) {
//否则创建新的订单添加到routeOrder //否则创建新的订单添加到routeOrder
orderDetail = orderDetailFactory.create(data) orderDetail = orderDetailFactory.create(data)
.price(data.getPrice()).productType(data.getProductType()); .price(data.getPrice()).productType(data.getProductType())
.employeeNo(routeOrder.getUserId());
routeOrder.addOrderDetail(orderDetail); routeOrder.addOrderDetail(orderDetail);
routeOrder = routeRepository.save(routeOrder); routeOrder = routeRepository.save(routeOrder);
// OrderDetail orderDetail = routeOrder // OrderDetail orderDetail = routeOrder

View File

@ -1,10 +1,15 @@
package com.chint.infrastructure.repository; package com.chint.infrastructure.repository;
import com.chint.application.dtos.OrderDetailQueryParam;
import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.OrderDetailRepository; import com.chint.domain.repository.OrderDetailRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
import com.chint.infrastructure.util.BaseContext;
import org.springframework.beans.factory.annotation.Autowired; 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 org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@ -17,6 +22,14 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
@Autowired @Autowired
private JdbcOrderDetailRepository orderDetailRepository; private JdbcOrderDetailRepository orderDetailRepository;
@Override
public Page<OrderDetail> 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 @Override
public OrderDetail findById(Long orderDetailId) { public OrderDetail findById(Long orderDetailId) {
return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND)); return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));

View File

@ -1,6 +1,8 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.OrderDetail; 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.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -12,4 +14,6 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
OrderDetail findByOrderNo(String orderNo); OrderDetail findByOrderNo(String orderNo);
List<OrderDetail> findByLegId(Long legId); List<OrderDetail> findByLegId(Long legId);
Page<OrderDetail> findByEmployeeNo(String employeeNo, Pageable pageable);
} }