增加 部分接口缺少事务注解

This commit is contained in:
lulz1 2024-02-06 16:01:50 +08:00
parent 72e57f3bff
commit f82a5d6800
2 changed files with 27 additions and 15 deletions

View File

@ -7,6 +7,7 @@ import com.chint.domain.value_object.*;
import com.chint.infrastructure.util.Result; import com.chint.infrastructure.util.Result;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -24,6 +25,8 @@ public class OrderController {
@Autowired @Autowired
private OrderQuery orderQuery; private OrderQuery orderQuery;
@Transactional
@ApiOperation("保存行程规划单") @ApiOperation("保存行程规划单")
@PostMapping("/save") @PostMapping("/save")
public Result<RouteOrder> creatOrder(@RequestBody OrderSaveData orderCreateData) { public Result<RouteOrder> creatOrder(@RequestBody OrderSaveData orderCreateData) {
@ -31,6 +34,8 @@ public class OrderController {
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
@Transactional
@ApiOperation("提交审批行程规划单") @ApiOperation("提交审批行程规划单")
@PostMapping("/approve") @PostMapping("/approve")
public Result<String> approveOrder(@RequestBody ApproveLegData approveLegData) { public Result<String> approveOrder(@RequestBody ApproveLegData approveLegData) {
@ -38,6 +43,7 @@ public class OrderController {
return Result.Success(SUCCESS); return Result.Success(SUCCESS);
} }
@Transactional
@ApiOperation("同步行程规划单到供应商") @ApiOperation("同步行程规划单到供应商")
@PostMapping("/sync") @PostMapping("/sync")
public Result<String> syncOrder(@RequestBody SyncLegData syncLegData) { public Result<String> syncOrder(@RequestBody SyncLegData syncLegData) {

View File

@ -5,6 +5,7 @@ import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.CityRepository; import com.chint.domain.repository.CityRepository;
import com.chint.domain.repository.LocationRepository; import com.chint.domain.repository.LocationRepository;
import com.chint.domain.service.OrderDomainService;
import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.ctrip.CTripApprovalRequest; import com.chint.interfaces.rest.ctrip.CTripApprovalRequest;
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest; import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest;
@ -31,6 +32,10 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
@Autowired @Autowired
private LocationRepository locationRepository; private LocationRepository locationRepository;
@Autowired
private OrderDomainService orderDomainService;
@Override @Override
public void syncSupplierOrder(RouteOrder order) { public void syncSupplierOrder(RouteOrder order) {
System.out.println("开始同步协程订单"); System.out.println("开始同步协程订单");
@ -39,7 +44,8 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
RankInfo rankInfo = RankInfo.of(currentUser.getRankCode()); RankInfo rankInfo = RankInfo.of(currentUser.getRankCode());
List<String> cityCode = new ArrayList<>(); List<String> cityCode = new ArrayList<>();
List<HotelEndorsementDetail> hotelList = new ArrayList<>(); List<HotelEndorsementDetail> hotelList = new ArrayList<>();
order.getLegItems().forEach( orderDomainService.queryLocation(order.getLegItems())
.forEach(
leg -> { leg -> {
cityCode.add( cityCode.add(
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity() cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()