|
@@ -131,7 +131,7 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime,
|
|
public void passengerFace(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String retFileUrl, String recordTime,
|
|
- String stationId,Long libId, Long personId,String localImageUrl) throws Exception {
|
|
|
|
|
|
+ String stationId, Long libId, Long personId, String localImageUrl) throws Exception {
|
|
Date recordDate = DateUtil.parse(recordTime, "yyyy-MM-dd HH:mm:ss");
|
|
Date recordDate = DateUtil.parse(recordTime, "yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
//查询是否有已上车的乘客记录
|
|
//查询是否有已上车的乘客记录
|
|
@@ -143,19 +143,18 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
boolean allow = true;
|
|
boolean allow = true;
|
|
|
|
|
|
//如果已过站则不改状态
|
|
//如果已过站则不改状态
|
|
- if("2".equals(passengerInfo.getPayStatus())) {
|
|
|
|
- log.warn("乘客:{}已过站,不修改状态",passengerInfo.getId());
|
|
|
|
|
|
+ if ("2".equals(passengerInfo.getPayStatus())) {
|
|
|
|
+ log.warn("乘客:{}已过站,不修改状态", passengerInfo.getId());
|
|
allow = false;
|
|
allow = false;
|
|
- }
|
|
|
|
- else if("0".equals(passengerInfo.getPayStatus())){
|
|
|
|
|
|
+ } else if ("0".equals(passengerInfo.getPayStatus())) {
|
|
//未购票,同时已过站
|
|
//未购票,同时已过站
|
|
- if (!passengerInfo.getUpStationId().equals(shiftInfo.getCurrentStationId())){
|
|
|
|
|
|
+ if (!passengerInfo.getUpStationId().equals(shiftInfo.getCurrentStationId())) {
|
|
log.warn("乘客:{}未购票且已过站,不修改状态", passengerInfo.getId());
|
|
log.warn("乘客:{}未购票且已过站,不修改状态", passengerInfo.getId());
|
|
allow = false;
|
|
allow = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if(allow){
|
|
|
|
|
|
+ if (allow) {
|
|
passengerInfo.setLocalImageUrl(localImageUrl);
|
|
passengerInfo.setLocalImageUrl(localImageUrl);
|
|
passengerInfo.setDownTime(recordDate);
|
|
passengerInfo.setDownTime(recordDate);
|
|
passengerInfo.setDownStationId(stationId);
|
|
passengerInfo.setDownStationId(stationId);
|
|
@@ -334,15 +333,15 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
if (passengerList.size() == 0) {
|
|
if (passengerList.size() == 0) {
|
|
throw new Exception("乘客不存在");
|
|
throw new Exception("乘客不存在");
|
|
}
|
|
}
|
|
- if (passengerList.size() != ticketTypeList.size()){
|
|
|
|
|
|
+ if (passengerList.size() != ticketTypeList.size()) {
|
|
throw new Exception("乘客数和购票类型数不一致");
|
|
throw new Exception("乘客数和购票类型数不一致");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- PriceInfo priceInfo = priceInfoService.findByStartStationAndEndStation(ticketUpStationId,ticketDownStationId);
|
|
|
|
- if (priceInfo == null || priceInfo.getPrice().compareTo(BigDecimal.ZERO) <=0){
|
|
|
|
- PriceInfo priceInfo1 = priceInfoService.findByStartStationAndEndStation(ticketDownStationId,ticketUpStationId);
|
|
|
|
- if (priceInfo1 == null || priceInfo1.getPrice().compareTo(BigDecimal.ZERO) <= 0){
|
|
|
|
|
|
+ PriceInfo priceInfo = priceInfoService.findByStartStationAndEndStation(ticketUpStationId, ticketDownStationId);
|
|
|
|
+ if (priceInfo == null || priceInfo.getPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
|
+ PriceInfo priceInfo1 = priceInfoService.findByStartStationAndEndStation(ticketDownStationId, ticketUpStationId);
|
|
|
|
+ if (priceInfo1 == null || priceInfo1.getPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
|
throw new Exception("站点间无费用设置");
|
|
throw new Exception("站点间无费用设置");
|
|
}
|
|
}
|
|
priceInfo = priceInfo1;
|
|
priceInfo = priceInfo1;
|
|
@@ -390,16 +389,15 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
String mergeId = mergeOrderId;
|
|
String mergeId = mergeOrderId;
|
|
- if (StringUtils.isBlank(mergeOrderId)){
|
|
|
|
|
|
+ if (StringUtils.isBlank(mergeOrderId)) {
|
|
MergeOrderInfo mergeOrderInfo = new MergeOrderInfo();
|
|
MergeOrderInfo mergeOrderInfo = new MergeOrderInfo();
|
|
mergeOrderInfo.setId(UUID.randomUUID().toString());
|
|
mergeOrderInfo.setId(UUID.randomUUID().toString());
|
|
mergeOrderInfo.setVehicleShiftId(shiftInfo.getId());
|
|
mergeOrderInfo.setVehicleShiftId(shiftInfo.getId());
|
|
|
|
|
|
//当前车辆所属公司
|
|
//当前车辆所属公司
|
|
- // ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
|
|
|
|
- // VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
|
|
|
|
|
|
+ // ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
|
|
|
|
+ // VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
|
|
|
|
|
|
mergeOrderInfo.setCompanyId(vehicleInfo.getCompanyId());
|
|
mergeOrderInfo.setCompanyId(vehicleInfo.getCompanyId());
|
|
mergeOrderInfo.setOpenId(openId);
|
|
mergeOrderInfo.setOpenId(openId);
|
|
@@ -419,9 +417,9 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
|
|
|
|
Boolean goodTicketStatus = false;
|
|
Boolean goodTicketStatus = false;
|
|
List<PassengerRecordDTO> passengerRecordDTOList = new ArrayList<>();
|
|
List<PassengerRecordDTO> passengerRecordDTOList = new ArrayList<>();
|
|
- // for (String passengerId : passengerList) {
|
|
|
|
|
|
+ // for (String passengerId : passengerList) {
|
|
|
|
|
|
- for (int n = 0;n<passengerList.size();n++){
|
|
|
|
|
|
+ for (int n = 0; n < passengerList.size(); n++) {
|
|
BigDecimal price1 = price;
|
|
BigDecimal price1 = price;
|
|
String passengerId = passengerList.get(n);
|
|
String passengerId = passengerList.get(n);
|
|
String ticketType = ticketTypeList.get(n);
|
|
String ticketType = ticketTypeList.get(n);
|
|
@@ -433,17 +431,17 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
|
|
|
|
PassengerRecordDTO passengerRecordDTO = new PassengerRecordDTO();
|
|
PassengerRecordDTO passengerRecordDTO = new PassengerRecordDTO();
|
|
|
|
|
|
- OrderInfo orderInfo0 = orderInfoService.findByPassengerIdMergeOrderId(passengerId,mergeId);
|
|
|
|
- if (orderInfo0 != null){
|
|
|
|
|
|
+ OrderInfo orderInfo0 = orderInfoService.findByPassengerIdMergeOrderId(passengerId, mergeId);
|
|
|
|
+ if (orderInfo0 != null) {
|
|
throw new Exception("有乘客已加入此账单,不可重复添加");
|
|
throw new Exception("有乘客已加入此账单,不可重复添加");
|
|
}
|
|
}
|
|
|
|
|
|
PassengerInfo passengerInfo = get(passengerId);
|
|
PassengerInfo passengerInfo = get(passengerId);
|
|
- if (!passengerInfo.getUpStationId().equals(upStationId)){
|
|
|
|
|
|
+ if (!passengerInfo.getUpStationId().equals(upStationId)) {
|
|
throw new Exception("上车站点不一致不可同时选择");
|
|
throw new Exception("上车站点不一致不可同时选择");
|
|
}
|
|
}
|
|
if ("1".equals(passengerInfo.getStatus())) {
|
|
if ("1".equals(passengerInfo.getStatus())) {
|
|
- if (!"1".equals(passengerInfo.getPayStatus())){
|
|
|
|
|
|
+ if (!"1".equals(passengerInfo.getPayStatus())) {
|
|
//创建订单
|
|
//创建订单
|
|
OrderInfo orderInfo = new OrderInfo();
|
|
OrderInfo orderInfo = new OrderInfo();
|
|
orderInfo.setId(UUID.randomUUID().toString());
|
|
orderInfo.setId(UUID.randomUUID().toString());
|
|
@@ -456,7 +454,7 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
orderInfo.setPassengerId(passengerId);
|
|
orderInfo.setPassengerId(passengerId);
|
|
orderInfo.setTicketType(ticketType);
|
|
orderInfo.setTicketType(ticketType);
|
|
|
|
|
|
- if (!goodTicketStatus){
|
|
|
|
|
|
+ if (!goodTicketStatus) {
|
|
orderInfo.setGoodsTicket(new BigDecimal(goodsTicket));
|
|
orderInfo.setGoodsTicket(new BigDecimal(goodsTicket));
|
|
orderInfo.setTotalFee(price1.add(new BigDecimal(goodsTicket)));
|
|
orderInfo.setTotalFee(price1.add(new BigDecimal(goodsTicket)));
|
|
goodTicketStatus = true;
|
|
goodTicketStatus = true;
|
|
@@ -479,17 +477,16 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
passengerRecordDTO.setTicketType(orderInfo.getTicketType());
|
|
passengerRecordDTO.setTicketType(orderInfo.getTicketType());
|
|
passengerRecordDTO.setTicketTypeName(passengerRecordDTO.getTicketTypeName(passengerRecordDTO.getTicketType()));
|
|
passengerRecordDTO.setTicketTypeName(passengerRecordDTO.getTicketTypeName(passengerRecordDTO.getTicketType()));
|
|
passengerRecordDTO.setGoodTicket(orderInfo.getGoodsTicket());
|
|
passengerRecordDTO.setGoodTicket(orderInfo.getGoodsTicket());
|
|
- passengerRecordDTO.setPayTime(DateUtil.format(orderInfo.getPayTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
|
+ passengerRecordDTO.setPayTime(DateUtil.format(orderInfo.getPayTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
passengerRecordDTO.setTotalFee(orderInfo.getTotalFee());
|
|
passengerRecordDTO.setTotalFee(orderInfo.getTotalFee());
|
|
passengerRecordDTOList.add(passengerRecordDTO);
|
|
passengerRecordDTOList.add(passengerRecordDTO);
|
|
|
|
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
throw new Exception("乘客已购票");
|
|
throw new Exception("乘客已购票");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
throw new Exception("乘客已下车");
|
|
throw new Exception("乘客已下车");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -515,17 +512,86 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<PassengerInfo> findByOpenIdAndStatus(String openId, String status,String payStatus) {
|
|
|
|
- return passengerInfoDAO.findByOpenIdAndStatus(openId,status,payStatus);
|
|
|
|
|
|
+ public List<PassengerInfo> findByOpenIdAndStatus(String openId, String status, String payStatus) {
|
|
|
|
+ return passengerInfoDAO.findByOpenIdAndStatus(openId, status, payStatus);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<PassengerInfo> findByOpenIdAndVehicleShiftId(String openId, String vehicleShiftId, String status, String payStatus) {
|
|
public List<PassengerInfo> findByOpenIdAndVehicleShiftId(String openId, String vehicleShiftId, String status, String payStatus) {
|
|
- return passengerInfoDAO.findByOpenIdAndVehicleShiftId(openId,vehicleShiftId,status,payStatus);
|
|
|
|
|
|
+ return passengerInfoDAO.findByOpenIdAndVehicleShiftId(openId, vehicleShiftId, status, payStatus);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<PassengerInfo> findByShiftIdAndStatus(String shiftId, String status) {
|
|
public List<PassengerInfo> findByShiftIdAndStatus(String shiftId, String status) {
|
|
- return passengerInfoDAO.findByShiftIdAndStatus(shiftId,status);
|
|
|
|
|
|
+ return passengerInfoDAO.findByShiftIdAndStatus(shiftId, status);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public DriverBuyTicketDTO driverCreateCashOrder(PassengerInfo passengerInfo, String ticketUpStationId, String ticketDownStationId,String paymentId) throws Exception{
|
|
|
|
+ DriverBuyTicketDTO driverBuyTicketDTO = new DriverBuyTicketDTO();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //查询车票价格
|
|
|
|
+ PriceInfo priceInfo = priceInfoService.findByStartStationAndEndStation(ticketUpStationId,ticketDownStationId);
|
|
|
|
+ if (priceInfo == null || priceInfo.getPrice().compareTo(BigDecimal.ZERO) <=0){
|
|
|
|
+ PriceInfo priceInfo1 = priceInfoService.findByStartStationAndEndStation(ticketDownStationId,ticketUpStationId);
|
|
|
|
+ if (priceInfo1 == null || priceInfo1.getPrice().compareTo(BigDecimal.ZERO) <= 0){
|
|
|
|
+ throw new Exception("站点间无费用设置");
|
|
|
|
+ }
|
|
|
|
+ priceInfo = priceInfo1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BigDecimal price = priceInfo.getPrice();
|
|
|
|
+
|
|
|
|
+ //创建综合账单
|
|
|
|
+ MergeOrderInfo mergeOrderInfo = new MergeOrderInfo();
|
|
|
|
+ mergeOrderInfo.setId(UUID.randomUUID().toString());
|
|
|
|
+ mergeOrderInfo.setVehicleShiftId(passengerInfo.getVehicleShiftId());
|
|
|
|
+ //当前车辆所属公司
|
|
|
|
+ ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
|
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
|
|
|
|
+
|
|
|
|
+ mergeOrderInfo.setPayStatus(20);
|
|
|
|
+ mergeOrderInfo.setCompanyId(vehicleInfo.getCompanyId());
|
|
|
|
+ mergeOrderInfo.setOutOrderNo(wxJpsoftConfig.getUrlKey() + com.jpsoft.bus.modules.common.utils.StringUtils.getOutTradeNo());
|
|
|
|
+ mergeOrderInfo.setPayName("cash");
|
|
|
|
+ mergeOrderInfo.setPaymentId(paymentId);
|
|
|
|
+ mergeOrderInfo.setCreateTime(new Date());
|
|
|
|
+ mergeOrderInfoService.insert(mergeOrderInfo);
|
|
|
|
+
|
|
|
|
+ OrderInfo orderInfo = new OrderInfo();
|
|
|
|
+ orderInfo.setId(UUID.randomUUID().toString());
|
|
|
|
+ orderInfo.setBody("买车票");
|
|
|
|
+ orderInfo.setTotalFee(price);
|
|
|
|
+ orderInfo.setPayStatus(20);
|
|
|
|
+ orderInfo.setPayName("cash");
|
|
|
|
+ orderInfo.setPayFee(price);
|
|
|
|
+ orderInfo.setPayTime(new Date());
|
|
|
|
+ orderInfo.setOutOrderNo(com.jpsoft.bus.modules.common.utils.StringUtils.getOutTradeNo());
|
|
|
|
+ orderInfo.setMergeOrderId(mergeOrderInfo.getId());
|
|
|
|
+ orderInfo.setTransactionId(orderInfo.getOutOrderNo());
|
|
|
|
+ orderInfo.setPassengerId(passengerInfo.getId());
|
|
|
|
+ orderInfo.setTicketType("2");
|
|
|
|
+ orderInfo.setCreateTime(new Date());
|
|
|
|
+ orderInfo.setGoodsTicket(BigDecimal.ZERO);
|
|
|
|
+ orderInfo.setTicketUpStationId(ticketUpStationId);
|
|
|
|
+ orderInfo.setTicketDownStationId(ticketDownStationId);
|
|
|
|
+ orderInfoService.insert(orderInfo);
|
|
|
|
+
|
|
|
|
+ //乘客记录添加购票上车点和下车点
|
|
|
|
+ passengerInfo.setTicketUpStationId(ticketUpStationId);
|
|
|
|
+ passengerInfo.setTicketDownStationId(ticketDownStationId);
|
|
|
|
+ passengerInfo.setTicketType("2");
|
|
|
|
+
|
|
|
|
+ //乘客购票状态修改
|
|
|
|
+ passengerInfo.setPayStatus("1");
|
|
|
|
+ update(passengerInfo);
|
|
|
|
+
|
|
|
|
+ driverBuyTicketDTO.setPayName("cash");
|
|
|
|
+ driverBuyTicketDTO.setPayNameStr("现金");
|
|
|
|
+ driverBuyTicketDTO.setTotalFee(price);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return driverBuyTicketDTO;
|
|
}
|
|
}
|
|
}
|
|
}
|