feat:高德用车制度逻辑更改

This commit is contained in:
lulz1 2024-05-22 08:29:48 +08:00
parent a9de1b0439
commit 863cecabd3
6 changed files with 36 additions and 10 deletions

View File

@ -123,10 +123,10 @@ public class OrderDetailController {
@ApiOperation("根据行程规划单查询消费明细-BPM") @ApiOperation("根据行程规划单查询消费明细-BPM")
@PostMapping("/public/query/detail/bpm") @PostMapping("/public/query/detail/bpm")
public Result<OrderDetailBPMVO> queryOrderDetail(@RequestBody OrderDetailQueryParamBPM param) { public OrderDetailBPMVO queryOrderDetail(@RequestBody OrderDetailQueryParamBPM param) {
RouteOrder routeOrder = routeRepository RouteOrder routeOrder = routeRepository
.findByActualOrderNoAndSysCode(param.getSequenceNo(), H3_BPM); .findByActualOrderNoAndSysCode(param.getSequenceNo(), H3_BPM);
return Result.Success(SUCCESS, routeOrderMapper.mapToOrderDetailVOBPM(routeOrder)); return routeOrderMapper.mapToOrderDetailVOBPM(routeOrder);
} }
@ApiOperation("订单明细导出接口") @ApiOperation("订单明细导出接口")

View File

@ -2,8 +2,10 @@ package com.chint.domain.repository;
import com.chint.domain.aggregates.supplier.AmapPolicy; import com.chint.domain.aggregates.supplier.AmapPolicy;
import java.util.List;
import java.util.Optional; import java.util.Optional;
public interface AmapPolicyRepository { public interface AmapPolicyRepository {
Optional<AmapPolicy> findByDefault(); Optional<AmapPolicy> findByDefault();
Optional<AmapPolicy> findByStandardLevel(String standardLevel);
} }

View File

@ -59,8 +59,7 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
@Override @Override
public boolean syncRouteRequest(RouteRequest routeRequest) { public boolean syncRouteRequest(RouteRequest routeRequest) {
TravelApplicationDto dto = new TravelApplicationDto(); TravelApplicationDto dto = new TravelApplicationDto();
RouteRequestFields routeRequestFields = routeRequest.getRouteRequestFields(); TravelApplicationDto travelApplicationDto = generateTravelApplicationInfo(dto, routeRequest);
TravelApplicationDto travelApplicationDto = generateTravelApplicationInfo(dto, routeRequest, routeRequestFields);
Optional<AmapRouteRelationship> byOutApplyRecordId = amapRouteRelationshipRepository Optional<AmapRouteRelationship> byOutApplyRecordId = amapRouteRelationshipRepository
.findByOutApplyRecordId(routeRequest.getRouteRequestNo()); .findByOutApplyRecordId(routeRequest.getRouteRequestNo());
@ -87,7 +86,8 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
return response.getCode().equals(1); 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.setOutApplyRecordId(routeRequest.getRouteRequestNo());
//公司信息写入备注 //公司信息写入备注
dto.setRemark(routeRequestFields.getAccountCompanyName() + "-" dto.setRemark(routeRequestFields.getAccountCompanyName() + "-"
@ -135,13 +135,11 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
areaCodes.add(amapLocationRequest.getACodeByLocationName(location.getLocationName())); areaCodes.add(amapLocationRequest.getACodeByLocationName(location.getLocationName()));
} }
processContent.setValidCityList(areaCodes); processContent.setValidCityList(areaCodes);
// processContent.setAmountLimited(1);
// processContent.setAllowCrossCity(1);
dto.setProcessContent(gson.toJson(processContent)); dto.setProcessContent(gson.toJson(processContent));
dto.setStatus("1"); dto.setStatus("1");
amapPolicyRepository.findByDefault() amapPolicyRepository.findByStandardLevel(routeRequestFields.getStandardLevel())
.ifPresent(policy -> dto.setRegulationId(policy.getAmapPolicyCode())); .ifPresent(policy -> dto.setRegulationId(policy.getAmapPolicyCode()));
return dto; return dto;
@ -155,8 +153,7 @@ public class AmapOrderSyncAdapter implements SupplierOrderSync {
@Override @Override
public boolean cancelRouteRequest(RouteRequest routeRequest) { public boolean cancelRouteRequest(RouteRequest routeRequest) {
TravelApplicationDto dto = new TravelApplicationDto(); TravelApplicationDto dto = new TravelApplicationDto();
RouteRequestFields routeRequestFields = routeRequest.getRouteRequestFields(); TravelApplicationDto travelApplicationDto = generateTravelApplicationInfo(dto, routeRequest);
TravelApplicationDto travelApplicationDto = generateTravelApplicationInfo(dto, routeRequest, routeRequestFields);
travelApplicationDto.setStatus("0"); travelApplicationDto.setStatus("0");
//查询关联表 //查询关联表
AmapRouteRelationship amapRouteRelationship = amapRouteRelationshipRepository AmapRouteRelationship amapRouteRelationship = amapRouteRelationshipRepository

View File

@ -17,4 +17,10 @@ public class AmapPolicyRepositoryImpl implements AmapPolicyRepository {
public Optional<AmapPolicy> findByDefault() { public Optional<AmapPolicy> findByDefault() {
return jdbcAmapPolicyRepository.findByIfDefault(1); return jdbcAmapPolicyRepository.findByIfDefault(1);
} }
@Override
public Optional<AmapPolicy> findByStandardLevel(String standardLevel) {
return jdbcAmapPolicyRepository.queryByStandardLevel(standardLevel).stream().findFirst();
}
} }

View File

@ -1,12 +1,21 @@
package com.chint.infrastructure.repository.jdbc; package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.supplier.AmapPolicy; 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.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional; import java.util.Optional;
@Repository @Repository
public interface JdbcAmapPolicyRepository extends CrudRepository<AmapPolicy, Long> { public interface JdbcAmapPolicyRepository extends CrudRepository<AmapPolicy, Long> {
Optional<AmapPolicy> findByIfDefault(Integer ifDefault); Optional<AmapPolicy> 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<AmapPolicy> queryByStandardLevel(@Param("standardLevel") String standardLevel);
} }

View File

@ -1,6 +1,8 @@
package com.chint; package com.chint;
import com.chint.domain.aggregates.supplier.AmapPolicy;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.AmapPolicyRepository;
import com.chint.domain.service.supplier.SupplierService; import com.chint.domain.service.supplier.SupplierService;
import com.chint.domain.value_object.SupplierCallbackData; import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.util.BaseContext; 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 org.springframework.boot.test.context.SpringBootTest;
import java.util.List; import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP; import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_AMAP;
@ -43,6 +46,9 @@ public class AmapTest {
@Autowired @Autowired
private AmapOrderDetailRequest orderDetailRequest; private AmapOrderDetailRequest orderDetailRequest;
@Autowired
private AmapPolicyRepository amapPolicyRepository;
private Gson gson = new Gson(); private Gson gson = new Gson();
private User user = new User(1L, "230615020", 1, "卢麟哲", "lulz1@chint.com", "15857193365", "A30000001"); private User user = new User(1L, "230615020", 1, "卢麟哲", "lulz1@chint.com", "15857193365", "A30000001");
@ -65,6 +71,12 @@ public class AmapTest {
@Autowired @Autowired
private SupplierService supplierService; private SupplierService supplierService;
@Test
void testRank(){
Optional<AmapPolicy> amapPolicies = amapPolicyRepository.findByStandardLevel("JT_STANDARD_LEVEL_FOUR");
System.out.println(amapPolicies);
}
/** /**
* 处理订单 * 处理订单
*/ */