fllmoyu преди 4 години
родител
ревизия
e6d08c80f9

+ 1 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/service/PassengerInfoService.java

@@ -30,7 +30,7 @@ public interface PassengerInfoService {
 
     List<PassengerInfo> findByShiftStatusPayStatusNotTicketDown(String shiftId, String status, String payStatus,String ticketDownStationId);
 
-	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 createOrder(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String openId, String mergeOrderId, String passengerIds, String ticketUpStationId, String ticketDownStationId, String ticketTypes, String goodsTicket, String totalFee) throws Exception;
 
 	void updatePassengerOrder(OrderInfo orderInfo, String ticketUpStationId, String ticketDownStationId, String ticketType, String goodsTicket, String totalFee);
 }

+ 16 - 4
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/PassengerInfoServiceImpl.java

@@ -290,16 +290,21 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
     }
 
     @Override
-    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 {
+    public MergeOrderDTO createOrder(VehicleInfo vehicleInfo, ShiftInfo shiftInfo, String openId, String mergeOrderId, String passengerIds, String ticketUpStationId, String ticketDownStationId, String ticketTypes, String goodsTicket, String totalFee) throws Exception {
 
 
         MergeOrderDTO mergeOrderDTO = new MergeOrderDTO();
 
         //乘客id集合
         List<String> passengerList = Arrays.asList(passengerIds.split(","));
+        List<String> ticketTypeList = Arrays.asList(ticketTypes.split(","));
         if (passengerList.size() == 0) {
             throw new Exception("乘客不存在");
         }
+        if (passengerList.size() != ticketTypeList.size()){
+            throw new Exception("乘客数和购票类型数不一致");
+        }
+
 
         PriceInfo priceInfo = priceInfoService.findByStartStationAndEndStation(ticketUpStationId,ticketDownStationId);
         if (priceInfo == null || priceInfo.getPrice().compareTo(BigDecimal.ZERO) <=0){
@@ -311,9 +316,9 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
         }
 
         BigDecimal price = priceInfo.getPrice();
-        if ("1".equals(ticketType)) {
+        /*if ("1".equals(ticketType)) {
             price = price.divide(new BigDecimal(2));
-        }
+        }*/
 
         BigDecimal totalTicketPrice =price.multiply(new BigDecimal(passengerList.size()));
 
@@ -372,7 +377,14 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
 
         Boolean goodTicketStatus = false;
         List<PassengerRecordDTO> passengerRecordDTOList = new ArrayList<>();
-        for (String passengerId : passengerList) {
+     //   for (String passengerId : passengerList) {
+
+        for (int n = 0;n<passengerList.size();n++){
+            String passengerId = passengerList.get(n);
+            String ticketType = ticketTypeList.get(n);
+            if ("1".equals(ticketType)) {
+                price = price.divide(new BigDecimal(2));
+            }
 
             PassengerRecordDTO passengerRecordDTO = new PassengerRecordDTO();
 

+ 46 - 0
common/src/main/java/com/jpsoft/bus/modules/common/utils/WechatMessageUtil.java

@@ -308,6 +308,52 @@ public class WechatMessageUtil {
         return ret;
     }
 
+    /**
+     * 车票补缴
+     * @param openId
+     * @param detail 首行内容
+     * @param appId
+     * @param appSecret
+     * @return
+     */
+    public  boolean sendTicketMessage(String openId, String detail, String ticketName, String orderNo,String reason,String url,String appId, String appSecret) {
+
+
+        String templateId = "BBXlohJ3nFojCeF6pnUxIqq655RpgoqXYqelNhpFR20";
+        JSONObject sendData = new JSONObject();
+
+        JSONObject first = new JSONObject();
+        first.put("value", detail);
+        first.put("color", "#FF0000");
+
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", ticketName);
+        keyword1.put("color", "#173177");
+
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", orderNo);
+        keyword2.put("color", "#173177");
+
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", DateUtil.format(new Date(),"yyyy年MM月dd日"));
+        keyword3.put("color", "#173177");
+
+        JSONObject remark = new JSONObject();
+        remark.put("value", reason);
+        remark.put("color", "#ed1414");
+
+        sendData.put("first", first);
+        sendData.put("keyword1", keyword1);
+        sendData.put("keyword2", keyword2);
+        sendData.put("keyword3", keyword3);
+        sendData.put("remark", remark);
+
+
+        boolean ret = sendTemplate(sendData, appId, appSecret, templateId, openId, url);
+
+        return ret;
+    }
+
     /**
      *
      * @param schoolName

+ 4 - 3
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/PassengerApiController.java

@@ -577,13 +577,13 @@ public class PassengerApiController {
             @ApiImplicitParam(name = "openId", value = "购票人openId", required = true, paramType = "form"),
             @ApiImplicitParam(name = "mergeOrderId", value = "综合车票id", required = true, paramType = "form"),
             @ApiImplicitParam(name = "passengerIds", value = "乘客ids", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "ticketTypes", value = "购票类型", required = true, paramType = "form"),
             @ApiImplicitParam(name = "ticketUpStationId", value = "购票起站", required = true, paramType = "form"),
             @ApiImplicitParam(name = "ticketDownStationId", value = "购票终点站", required = true, paramType = "form"),
-            @ApiImplicitParam(name = "ticketType", value = "购票类型(1:儿童票,2:成人票)", required = true, paramType = "form"),
             @ApiImplicitParam(name = "goodsTicket", value = "货票金额", required = true, paramType = "form"),
             @ApiImplicitParam(name = "totalFee", value = "总金额", required = true, paramType = "form")
     })
-    public MessageResult<Map> createPassengerOrder(String id, String openId, String mergeOrderId, String passengerIds, String ticketUpStationId, String ticketDownStationId, String ticketType, String goodsTicket, String totalFee) {
+    public MessageResult<Map> createPassengerOrder(String id, String openId, String mergeOrderId, String passengerIds,String ticketTypes, String ticketUpStationId, String ticketDownStationId, String goodsTicket, String totalFee) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
@@ -600,7 +600,7 @@ public class PassengerApiController {
             ShiftInfo shiftInfo = shiftInfoList.get(0);
 
 
-            MergeOrderDTO mergeOrderDTO =  passengerInfoService.createOrder(vehicleInfo, shiftInfo, openId, mergeOrderId, passengerIds, ticketUpStationId, ticketDownStationId, ticketType, goodsTicket, totalFee);
+            MergeOrderDTO mergeOrderDTO =  passengerInfoService.createOrder(vehicleInfo, shiftInfo, openId, mergeOrderId, passengerIds, ticketUpStationId, ticketDownStationId, ticketTypes, goodsTicket, totalFee);
 
             Map<String,Object> map = new HashMap<>();
             map.put("MergeOrderDTO",mergeOrderDTO);
@@ -1054,6 +1054,7 @@ public class PassengerApiController {
             searchParams.put("openId",openId);
             searchParams.put("readStatus",false);
             searchParams.put("shiftStatus","1");
+            searchParams.put("payStatus","2");
 
             List<Sort> sortList = new ArrayList<>();
             sortList.add(new Sort("create_time","desc"));