fix:审批结果回传增加参数校验

This commit is contained in:
lulz1 2024-07-03 12:33:39 +08:00
parent 7415086850
commit beb7219f30
5 changed files with 45 additions and 14 deletions

View File

@ -108,7 +108,17 @@ public class OrderPublicController {
@ApiOperation("处理审批结果回复")
@PostMapping("/approve/response")
public Result<String> approveOrder(@RequestBody ApprovalResultData data) {
if(data == null || data.getApprovalRecordNo() == null || data.getApprovalStatus() == null){
return Result.error("Param can not be null");
}
routeApprovalDomainService.handlerApprovalResponse(data);
return Result.Success(SUCCESS);
}
@ApiOperation("行程规划单重新载入差标或推送至商旅平台")
@PostMapping("/standard/reload")
public Result<String> orderStandardReload(@RequestBody OrderQueryData queryData) {
orderDomainService.orderStandardReload(queryData);
return Result.Success(SUCCESS);
}
}

View File

@ -74,6 +74,8 @@ public class ApprovalSubmit implements ApplicationListener<ApplicationReadyEvent
.filter(record -> record.getApprovalRecordNo().equals(data.getApprovalRecordNo()))
.findFirst();
matchingApprovalRecord.ifPresent(record -> processHandleApprovalResult(data, routeOrder, record));
} else {
throw new CommandException("Approval record not found: " + data.getApprovalRecordNo());
}
}

View File

@ -8,11 +8,9 @@ import com.chint.domain.exceptions.OrderException;
import com.chint.domain.factoriy.leg_event.LegEventFactory;
import com.chint.domain.factoriy.order.RouteOrderFactory;
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
import com.chint.domain.repository.CompanyBlackListRepository;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.SupplierRepository;
import com.chint.domain.repository.*;
import com.chint.domain.value_object.ApproveRouteData;
import com.chint.domain.value_object.OrderQueryData;
import com.chint.domain.value_object.UserLoginParam;
import com.chint.infrastructure.constant.RouteConstant;
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
@ -27,6 +25,7 @@ import com.chint.interfaces.rest.ctrip.dto.search.car.OrderFee;
import com.chint.interfaces.rest.ctrip.dto.search.flight.*;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.RefundInfo;
import com.chint.interfaces.rest.data_center.user.UserHttpRequest;
import com.chint.interfaces.rest.ly.LYSearchRequest;
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse;
@ -85,6 +84,12 @@ public class OrderDomainService {
@Autowired
private SupplierRepository supplierRepository;
@Autowired
private UserRepository userRepository;
@Autowired
private UserHttpRequest userHttpRequest;
@Autowired
private RedisTemplate<String, RouteOrder> redisTemplate;
@ -484,4 +489,17 @@ public class OrderDomainService {
}
return orderDetail;
}
public void orderStandardReload(OrderQueryData queryData) {
Long routeId = queryData.getRouteId();
RouteOrder routeOrder = routeRepository.queryById(routeId);
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
userHttpRequest.loadUserInfo(user);
routeOrder.setStandardLevel(user.getStandardLevel());
if ("1".equals(queryData.getExtension())) {
Command.of(RouteAutoSyncCommand.class).route(routeOrder).async().sendToQueue();
} else {
routeRepository.save(routeOrder);
}
}
}

View File

@ -84,16 +84,16 @@ public class RouteRequestDomainService {
legDomainService.checkLegIfStartApproval(routeOrder);
List<CompletableFuture<Void>> futures = new ArrayList<>();
supplierRepository.findAll()
.forEach(it -> futures.add(
CompletableFuture.runAsync(() -> {
List<Leg> legs = legDomainService.queryLegsCanSync(routeOrder, it);
List<Long> legIdList = legs.stream().map(Leg::getLegId).collect(Collectors.toList());
if(!legIdList.isEmpty()){
RouteRequest routeRequest = createRouteRequest(routeOrder, legIdList, it.getName());
syncRouteRequest(routeRequest, it);
}
})
));
.forEach(it -> {
List<Leg> legs = legDomainService.queryLegsCanSync(routeOrder, it);
List<Long> legIdList = legs.stream().map(Leg::getLegId).collect(Collectors.toList());
if (!legIdList.isEmpty()) {
RouteRequest routeRequest = createRouteRequest(routeOrder, legIdList, it.getName());
futures.add(
CompletableFuture.runAsync(() -> syncRouteRequest(routeRequest, it))
);
}
});
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
.thenRun(() -> routeRepository.save(routeOrder)) //保存聚合根
.join();

View File

@ -25,4 +25,5 @@ public class OrderQueryData extends BaseQuery {
private String supplierName;
private String customFieldName;
private String customFieldValue;
private String extension;
}