|
@@ -8,6 +8,7 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.google.common.collect.Ordering;
|
|
|
import com.jpsoft.bus.config.WxJpsoftConfig;
|
|
|
+import com.jpsoft.bus.modules.base.dto.MergeOrderDTO;
|
|
|
import com.jpsoft.bus.modules.base.entity.MergeOrderInfo;
|
|
|
import com.jpsoft.bus.modules.base.entity.OrderInfo;
|
|
|
import com.jpsoft.bus.modules.base.entity.PaymentInfo;
|
|
@@ -15,10 +16,9 @@ import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
|
|
|
import com.jpsoft.bus.modules.base.service.OrderInfoService;
|
|
|
import com.jpsoft.bus.modules.base.service.PaymentInfoService;
|
|
|
import com.jpsoft.bus.modules.bus.dto.DriverBuyTicketDTO;
|
|
|
+import com.jpsoft.bus.modules.bus.dto.PassengerRecordDTO;
|
|
|
import com.jpsoft.bus.modules.bus.entity.*;
|
|
|
-import com.jpsoft.bus.modules.bus.service.BaiduService;
|
|
|
-import com.jpsoft.bus.modules.bus.service.CompanyInfoService;
|
|
|
-import com.jpsoft.bus.modules.bus.service.PriceInfoService;
|
|
|
+import com.jpsoft.bus.modules.bus.service.*;
|
|
|
import com.jpsoft.bus.modules.common.utils.CommonUtil;
|
|
|
import com.jpsoft.bus.modules.pay.service.AlipayService;
|
|
|
import com.jpsoft.bus.modules.pay.service.WechatService;
|
|
@@ -27,7 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.jpsoft.bus.modules.bus.dao.PassengerInfoDAO;
|
|
|
-import com.jpsoft.bus.modules.bus.service.PassengerInfoService;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.bus.modules.common.dto.Sort;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
@@ -41,6 +40,9 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
|
@Autowired
|
|
|
private MergeOrderInfoService mergeOrderInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StationInfoService stationInfoService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private WxJpsoftConfig wxJpsoftConfig;
|
|
|
|
|
@@ -288,9 +290,10 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String createOrder(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String openId, String mergeOrderId,String passengerIds, String ticketUpStationId, String ticketDownStationId, String ticketType, String goodsTicket, String totalFee) throws Exception {
|
|
|
+ public MergeOrderDTO createOrder(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String openId, String mergeOrderId, String passengerIds, String ticketUpStationId, String ticketDownStationId, String ticketType, String goodsTicket, String totalFee) throws Exception {
|
|
|
|
|
|
|
|
|
+ MergeOrderDTO mergeOrderDTO = new MergeOrderDTO();
|
|
|
|
|
|
//乘客id集合
|
|
|
List<String> passengerList = Arrays.asList(passengerIds.split(","));
|
|
@@ -361,13 +364,18 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
|
mergeId = mergeOrderInfo.getId();
|
|
|
}
|
|
|
|
|
|
+ mergeOrderDTO.setId(mergeId);
|
|
|
+
|
|
|
PassengerInfo passengerInfo0 = get(passengerList.get(0));
|
|
|
|
|
|
String upStationId = passengerInfo0.getUpStationId();
|
|
|
|
|
|
Boolean goodTicketStatus = false;
|
|
|
+ List<PassengerRecordDTO> passengerRecordDTOList = new ArrayList<>();
|
|
|
for (String passengerId : passengerList) {
|
|
|
|
|
|
+ PassengerRecordDTO passengerRecordDTO = new PassengerRecordDTO();
|
|
|
+
|
|
|
OrderInfo orderInfo0 = orderInfoService.findByPassengerIdMergeOrderId(passengerId,mergeId);
|
|
|
if (orderInfo0 != null){
|
|
|
throw new Exception("有乘客已加入此账单,不可重复添加");
|
|
@@ -401,6 +409,23 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
|
orderInfo.setTicketUpStationId(ticketUpStationId);
|
|
|
orderInfo.setTicketDownStationId(ticketDownStationId);
|
|
|
orderInfoService.insert(orderInfo);
|
|
|
+
|
|
|
+ passengerRecordDTO.setId(orderInfo.getId());
|
|
|
+ passengerRecordDTO.setImageUrl(passengerInfo.getImageUrl());
|
|
|
+
|
|
|
+ //开始站点
|
|
|
+ StationInfo startStation = stationInfoService.get(orderInfo.getTicketUpStationId());
|
|
|
+ //终点站
|
|
|
+ StationInfo endStation = stationInfoService.get(orderInfo.getTicketDownStationId());
|
|
|
+ passengerRecordDTO.setStartStation(startStation.getName());
|
|
|
+ passengerRecordDTO.setEndStation(endStation.getName());
|
|
|
+ passengerRecordDTO.setTicketType(orderInfo.getTicketType());
|
|
|
+ passengerRecordDTO.setTicketTypeName(passengerRecordDTO.getTicketTypeName(passengerRecordDTO.getTicketType()));
|
|
|
+ passengerRecordDTO.setGoodTicket(orderInfo.getGoodsTicket());
|
|
|
+ passengerRecordDTO.setPayTime(DateUtil.format(orderInfo.getPayTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
+ passengerRecordDTO.setTotalFee(orderInfo.getTotalFee());
|
|
|
+ passengerRecordDTOList.add(passengerRecordDTO);
|
|
|
+
|
|
|
}else {
|
|
|
throw new Exception("乘客已购票");
|
|
|
}
|
|
@@ -411,9 +436,10 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
|
throw new Exception("乘客已下车");
|
|
|
}
|
|
|
}
|
|
|
+ mergeOrderDTO.setPassengerRecordDTOList(passengerRecordDTOList);
|
|
|
|
|
|
|
|
|
- return mergeId;
|
|
|
+ return mergeOrderDTO;
|
|
|
}
|
|
|
|
|
|
@Override
|