diff --git a/src/main/java/com/chint/application/out/OrderDetailController.java b/src/main/java/com/chint/application/out/OrderDetailController.java index 737b6852..c0ff5d23 100644 --- a/src/main/java/com/chint/application/out/OrderDetailController.java +++ b/src/main/java/com/chint/application/out/OrderDetailController.java @@ -123,10 +123,10 @@ public class OrderDetailController { @ApiOperation("根据行程规划单查询消费明细-BPM") @PostMapping("/public/query/detail/bpm") - public Result queryOrderDetail(@RequestBody OrderDetailQueryParamBPM param) { + public OrderDetailBPMVO queryOrderDetail(@RequestBody OrderDetailQueryParamBPM param) { RouteOrder routeOrder = routeRepository .findByActualOrderNoAndSysCode(param.getSequenceNo(), H3_BPM); - return Result.Success(SUCCESS, routeOrderMapper.mapToOrderDetailVOBPM(routeOrder)); + return routeOrderMapper.mapToOrderDetailVOBPM(routeOrder); } @ApiOperation("订单明细导出接口") diff --git a/src/main/java/com/chint/domain/repository/AmapPolicyRepository.java b/src/main/java/com/chint/domain/repository/AmapPolicyRepository.java index 1711eff2..fbdeee8b 100644 --- a/src/main/java/com/chint/domain/repository/AmapPolicyRepository.java +++ b/src/main/java/com/chint/domain/repository/AmapPolicyRepository.java @@ -2,8 +2,10 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.supplier.AmapPolicy; +import java.util.List; import java.util.Optional; public interface AmapPolicyRepository { Optional findByDefault(); + Optional findByStandardLevel(String standardLevel); } diff --git a/src/main/java/com/chint/domain/service/order_sync/AmapOrderSyncAdapter.java b/src/main/java/com/chint/domain/service/order_sync/AmapOrderSyncAdapter.java index 2ed4b3d7..3b67e24b 100644 --- a/src/main/java/com/chint/domain/service/order_sync/AmapOrderSyncAdapter.java +++ b/src/main/java/com/chint/domain/service/order_sync/AmapOrderSyncAdapter.java @@ -59,8 +59,7 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync { @Override public boolean syncRouteRequest(RouteRequest routeRequest) { TravelApplicationDto dto = new TravelApplicationDto(); - RouteRequestFields routeRequestFields = routeRequest.getRouteRequestFields(); - TravelApplicationDto travelApplicationDto = generateTravelApplicationInfo(dto, routeRequest, routeRequestFields); + TravelApplicationDto travelApplicationDto = generateTravelApplicationInfo(dto, routeRequest); Optional byOutApplyRecordId = amapRouteRelationshipRepository .findByOutApplyRecordId(routeRequest.getRouteRequestNo()); @@ -87,7 +86,8 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync { return response.getCode().equals(1); } - private TravelApplicationDto generateTravelApplicationInfo(TravelApplicationDto dto, RouteRequest routeRequest, RouteRequestFields routeRequestFields) { + private TravelApplicationDto generateTravelApplicationInfo(TravelApplicationDto dto, RouteRequest routeRequest) { + RouteRequestFields routeRequestFields = routeRequest.getRouteRequestFields(); dto.setOutApplyRecordId(routeRequest.getRouteRequestNo()); //公司信息写入备注 dto.setRemark(routeRequestFields.getAccountCompanyName() + "-" @@ -135,13 +135,11 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync { areaCodes.add(amapLocationRequest.getACodeByLocationName(location.getLocationName())); } processContent.setValidCityList(areaCodes); -// processContent.setAmountLimited(1); -// processContent.setAllowCrossCity(1); dto.setProcessContent(gson.toJson(processContent)); dto.setStatus("1"); - amapPolicyRepository.findByDefault() + amapPolicyRepository.findByStandardLevel(routeRequestFields.getStandardLevel()) .ifPresent(policy -> dto.setRegulationId(policy.getAmapPolicyCode())); return dto; @@ -155,8 +153,7 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync { @Override public boolean cancelRouteRequest(RouteRequest routeRequest) { TravelApplicationDto dto = new TravelApplicationDto(); - RouteRequestFields routeRequestFields = routeRequest.getRouteRequestFields(); - TravelApplicationDto travelApplicationDto = generateTravelApplicationInfo(dto, routeRequest, routeRequestFields); + TravelApplicationDto travelApplicationDto = generateTravelApplicationInfo(dto, routeRequest); travelApplicationDto.setStatus("0"); //查询关联表 AmapRouteRelationship amapRouteRelationship = amapRouteRelationshipRepository diff --git a/src/main/java/com/chint/infrastructure/repository/AmapPolicyRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/AmapPolicyRepositoryImpl.java index b7370e3c..56a49941 100644 --- a/src/main/java/com/chint/infrastructure/repository/AmapPolicyRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/AmapPolicyRepositoryImpl.java @@ -17,4 +17,10 @@ public class AmapPolicyRepositoryImpl implements AmapPolicyRepository { public Optional findByDefault() { return jdbcAmapPolicyRepository.findByIfDefault(1); } + + + @Override + public Optional findByStandardLevel(String standardLevel) { + return jdbcAmapPolicyRepository.queryByStandardLevel(standardLevel).stream().findFirst(); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcAmapPolicyRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcAmapPolicyRepository.java index 984eb749..d7f4ade6 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcAmapPolicyRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcAmapPolicyRepository.java @@ -1,12 +1,21 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.supplier.AmapPolicy; +import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; +import java.util.List; import java.util.Optional; @Repository public interface JdbcAmapPolicyRepository extends CrudRepository { Optional findByIfDefault(Integer ifDefault); + + @Query(""" + select a.* from amap_policy a left join amap_policy_rank ar on a.id = ar.amap_policy_id + left join ranks r on ar.rank_id = r.rank_id where r.standard_level = :standardLevel + """) + List queryByStandardLevel(@Param("standardLevel") String standardLevel); } diff --git a/src/test/java/com/chint/AmapTest.java b/src/test/java/com/chint/AmapTest.java index 4bb061bc..07004fbf 100644 --- a/src/test/java/com/chint/AmapTest.java +++ b/src/test/java/com/chint/AmapTest.java @@ -1,6 +1,8 @@ package com.chint; +import com.chint.domain.aggregates.supplier.AmapPolicy; import com.chint.domain.aggregates.user.User; +import com.chint.domain.repository.AmapPolicyRepository; import com.chint.domain.service.supplier.SupplierService; import com.chint.domain.value_object.SupplierCallbackData; import com.chint.infrastructure.util.BaseContext; @@ -25,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.List; +import java.util.Optional; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP; @@ -43,6 +46,9 @@ public class AmapTest { @Autowired private AmapOrderDetailRequest orderDetailRequest; + @Autowired + private AmapPolicyRepository amapPolicyRepository; + private Gson gson = new Gson(); private User user = new User(1L, "230615020", 1, "卢麟哲", "lulz1@chint.com", "15857193365", "A30000001"); @@ -65,6 +71,12 @@ public class AmapTest { @Autowired private SupplierService supplierService; + @Test + void testRank(){ + Optional amapPolicies = amapPolicyRepository.findByStandardLevel("JT_STANDARD_LEVEL_FOUR"); + System.out.println(amapPolicies); + } + /** * 处理订单 */