增加 部分接口缺少事务注解
This commit is contained in:
parent
72e57f3bff
commit
f82a5d6800
|
@ -7,6 +7,7 @@ import com.chint.domain.value_object.*;
|
|||
import com.chint.infrastructure.util.Result;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -24,6 +25,8 @@ public class OrderController {
|
|||
@Autowired
|
||||
private OrderQuery orderQuery;
|
||||
|
||||
|
||||
@Transactional
|
||||
@ApiOperation("保存行程规划单")
|
||||
@PostMapping("/save")
|
||||
public Result<RouteOrder> creatOrder(@RequestBody OrderSaveData orderCreateData) {
|
||||
|
@ -31,6 +34,8 @@ public class OrderController {
|
|||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@ApiOperation("提交审批行程规划单")
|
||||
@PostMapping("/approve")
|
||||
public Result<String> approveOrder(@RequestBody ApproveLegData approveLegData) {
|
||||
|
@ -38,6 +43,7 @@ public class OrderController {
|
|||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ApiOperation("同步行程规划单到供应商")
|
||||
@PostMapping("/sync")
|
||||
public Result<String> syncOrder(@RequestBody SyncLegData syncLegData) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.chint.domain.aggregates.order.RouteOrder;
|
|||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.CityRepository;
|
||||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.domain.service.OrderDomainService;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.ctrip.CTripApprovalRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest;
|
||||
|
@ -31,6 +32,10 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
@Autowired
|
||||
private LocationRepository locationRepository;
|
||||
|
||||
|
||||
@Autowired
|
||||
private OrderDomainService orderDomainService;
|
||||
|
||||
@Override
|
||||
public void syncSupplierOrder(RouteOrder order) {
|
||||
System.out.println("开始同步协程订单");
|
||||
|
@ -39,21 +44,22 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
RankInfo rankInfo = RankInfo.of(currentUser.getRankCode());
|
||||
List<String> cityCode = new ArrayList<>();
|
||||
List<HotelEndorsementDetail> hotelList = new ArrayList<>();
|
||||
order.getLegItems().forEach(
|
||||
leg -> {
|
||||
cityCode.add(
|
||||
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
|
||||
);
|
||||
if (leg.getLegType().equals(LEG_TYPE_HOTEL)) {
|
||||
hotelList.add(
|
||||
HotelEndorsementDetail.of(cityCode.stream().distinct().toList())
|
||||
.passenger(PassengerDetail.of(String.valueOf(currentUser.getEmployeeNo())))
|
||||
.starTime(leg.getStartTime())
|
||||
.endTime(leg.getEndTime())
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
orderDomainService.queryLocation(order.getLegItems())
|
||||
.forEach(
|
||||
leg -> {
|
||||
cityCode.add(
|
||||
cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity()
|
||||
);
|
||||
if (leg.getLegType().equals(LEG_TYPE_HOTEL)) {
|
||||
hotelList.add(
|
||||
HotelEndorsementDetail.of(cityCode.stream().distinct().toList())
|
||||
.passenger(PassengerDetail.of(String.valueOf(currentUser.getEmployeeNo())))
|
||||
.starTime(leg.getStartTime())
|
||||
.endTime(leg.getEndTime())
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
ApprovalRequest approvalRequestParam = ApprovalRequest.buildApproval(String.valueOf(currentUser.getEmployeeNo()), approveOrderNo.getActualOrderNo(), rankInfo)
|
||||
.withHotel(hotelList);
|
||||
approvalRequest.approval(approvalRequestParam);
|
||||
|
|
Loading…
Reference in New Issue