|
|
@@ -156,6 +156,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneOffset;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
@@ -3409,6 +3410,40 @@ public class OtcTradeOrderServiceImpl implements OtcTradeOrderService {
|
|
|
TradeOrderTotalVO summary = BeanUtils.toBean(tradeOrderTotalDO, TradeOrderTotalVO.class);
|
|
|
orderRespNewVO.setSummary(summary);
|
|
|
|
|
|
+ // 计算领队单价
|
|
|
+ Integer leaderTotalNum = summary.getLeaderTotalNum();
|
|
|
+ if(leaderTotalNum != null && leaderTotalNum > 0) {
|
|
|
+ BigDecimal leaderPrice = summary.getLeaderAmount().divide(new BigDecimal(leaderTotalNum), 2, RoundingMode.HALF_UP);
|
|
|
+ countryList.stream().forEach(item -> {
|
|
|
+ if(Objects.equals(item.getType(), "leader")) {
|
|
|
+ item.setActualPrice(leaderPrice);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 计算陪同单价
|
|
|
+ Integer withTotalNum = summary.getWithTotalNum();
|
|
|
+ if(withTotalNum != null && withTotalNum > 0) {
|
|
|
+ BigDecimal withPrice = summary.getWithAmount().divide(new BigDecimal(withTotalNum), 2, RoundingMode.HALF_UP);
|
|
|
+ countryList.stream().forEach(item -> {
|
|
|
+ if(Objects.equals(item.getType(), "with")) {
|
|
|
+ item.setActualPrice(withPrice);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 添加16免1
|
|
|
+ Integer freeNum = summary.getFreeNum();
|
|
|
+ if(freeNum != null && freeNum > 0) {
|
|
|
+ BigDecimal freePrice = summary.getFreeAmount().divide(new BigDecimal(freeNum), 2, RoundingMode.HALF_UP);
|
|
|
+ TradeOrderConfirmationCountryRespVO countryRespVO = new TradeOrderConfirmationCountryRespVO();
|
|
|
+ countryRespVO.setActualPrice(freePrice.negate());
|
|
|
+ countryRespVO.setNum(freeNum);
|
|
|
+ countryRespVO.setType("free");
|
|
|
+ countryRespVO.setRoomModelName("16免1");
|
|
|
+ countryRespVO.setRoomModelShortName("16免1");
|
|
|
+ countryRespVO.setNationalityName("-");
|
|
|
+ countryRespVO.setFloor(0);
|
|
|
+ countryList.add(countryRespVO);
|
|
|
+ }
|
|
|
//设置游轮航次信息
|
|
|
VoyageDO voyageDO = voyageService.getVoyage(tradeOrderDO.getVoyageId());
|
|
|
orderRespNewVO.setVoyage(BeanUtils.toBean(voyageDO, VoyageRespVO.class));
|