Ver Fonte

Merge remote-tracking branch 'origin/master'

xiao547607 há 4 anos atrás
pai
commit
375b998538
33 ficheiros alterados com 1238 adições e 189 exclusões
  1. 5 2
      common/src/main/java/com/jpsoft/bus/modules/base/dao/OrderInfoDAO.java
  2. 2 0
      common/src/main/java/com/jpsoft/bus/modules/base/entity/MergeOrderInfo.java
  3. 11 0
      common/src/main/java/com/jpsoft/bus/modules/base/entity/OrderInfo.java
  4. 5 2
      common/src/main/java/com/jpsoft/bus/modules/base/service/OrderInfoService.java
  5. 9 4
      common/src/main/java/com/jpsoft/bus/modules/base/service/impl/OrderInfoServiceImpl.java
  6. 2 2
      common/src/main/java/com/jpsoft/bus/modules/bus/callback/GpsDataCallbackImpl.java
  7. 1 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/GpsService.java
  8. 20 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java
  9. 40 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/PassengerInfoServiceImpl.java
  10. 1 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/ShiftInfoServiceImpl.java
  11. 18 1
      common/src/main/java/com/jpsoft/bus/modules/common/utils/StringUtils.java
  12. 2 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dao/WithdrawalRecordDAO.java
  13. 20 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dto/ProfitListDTO.java
  14. 36 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dto/SellListDTO.java
  15. 25 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dto/WithdrawalRecordDetailDTO.java
  16. 24 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dto/WithdrawalRecordListDTO.java
  17. 40 24
      common/src/main/java/com/jpsoft/bus/modules/merchant/entity/WithdrawalRecord.java
  18. 2 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/service/WithdrawalRecordService.java
  19. 11 6
      common/src/main/java/com/jpsoft/bus/modules/merchant/service/impl/WithdrawalRecordServiceImpl.java
  20. 4 1
      common/src/main/java/com/jpsoft/bus/modules/pay/service/impl/WechatServiceImpl.java
  21. 6 1
      common/src/main/resources/mapper/base/MergeOrderInfo.xml
  22. 34 2
      common/src/main/resources/mapper/base/OrderInfo.xml
  23. 3 0
      common/src/main/resources/mapper/bus/PassengerInfo.xml
  24. 13 1
      common/src/main/resources/mapper/merchant/WithdrawalRecord.xml
  25. 1 1
      gps/src/main/java/com/jpsoft/gps/callback/GpsDataCallback.java
  26. 2 2
      gps/src/main/java/com/jpsoft/gps/handler/ProcessHandler.java
  27. 1 0
      web/src/main/java/com/jpsoft/bus/config/WebMvcConfig.java
  28. 249 106
      web/src/main/java/com/jpsoft/bus/modules/base/controller/OrderInfoController.java
  29. 25 0
      web/src/main/java/com/jpsoft/bus/modules/device/controller/DeviceCmdApiController.java
  30. 14 2
      web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java
  31. 523 27
      web/src/main/java/com/jpsoft/bus/modules/mobile/controller/MerchantApiController.java
  32. 1 1
      web/src/main/java/com/jpsoft/bus/modules/mobile/controller/PassengerApiController.java
  33. 88 0
      web/src/main/java/com/jpsoft/bus/scheduled/SettlementTask.java

+ 5 - 2
common/src/main/java/com/jpsoft/bus/modules/base/dao/OrderInfoDAO.java

@@ -1,6 +1,7 @@
 package com.jpsoft.bus.modules.base.dao;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 
 import cn.hutool.core.date.DateTime;
@@ -28,7 +29,9 @@ public interface OrderInfoDAO {
 
     OrderInfo findByPassengerIdMergeOrderId(String passengerId, String mergeOrderId);
 
-    BigDecimal paySum(List<VehicleInfo> vehicleInfoList, String payName, DateTime beginOfDay, DateTime endOfDay,Boolean settlementFlag);
+    BigDecimal paySum(List<VehicleInfo> vehicleInfoList, String companyId,String payName, Date beginOfDay, Date endOfDay, Boolean settlementFlag);
 
-    Integer payNum(List<VehicleInfo> vehicleInfoList, String payName, DateTime beginOfDay, DateTime endOfDay, Boolean settlementFlag);
+    Integer payNum(List<VehicleInfo> vehicleInfoList,String companyId, String payName, Date beginOfDay, Date endOfDay, Boolean settlementFlag);
+
+	List<OrderInfo> findBySearchParams(Map<String, Object> searchParams);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/base/entity/MergeOrderInfo.java

@@ -23,6 +23,8 @@ public class MergeOrderInfo {
     private String openId;
     @ApiModelProperty(value = "班次id")
     private String vehicleShiftId;
+    @ApiModelProperty(value = "公司id")
+    private String companyId;
     @ApiModelProperty(value = "支付状态(10:未支付,15:部分支付,20:支付完成,30:关闭,40:全额退款,45:部分退款)")
     private Integer payStatus;
     @ApiModelProperty(value = "支付方式(wechat:微信,alipay:支付宝,cash:现金,ticket:车票)")

+ 11 - 0
common/src/main/java/com/jpsoft/bus/modules/base/entity/OrderInfo.java

@@ -93,4 +93,15 @@ public class OrderInfo {
         }
         return payNameStr;
     }
+
+    public String getTicketTypeStr(String ticketType){
+        String ticketTypeStr = "";
+        if ("1".equals(ticketType)){
+            ticketTypeStr = "儿童票";
+        }
+        if ("2".equals(ticketType)){
+            ticketTypeStr = "成人票";
+        }
+        return ticketTypeStr;
+    }
 }

+ 5 - 2
common/src/main/java/com/jpsoft/bus/modules/base/service/OrderInfoService.java

@@ -1,6 +1,7 @@
 package com.jpsoft.bus.modules.base.service;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -36,7 +37,9 @@ public interface OrderInfoService {
 	 */
 	Boolean refund(String orderId,String userId) throws Exception;
 
-    BigDecimal paySum(List<VehicleInfo> vehicleInfoList, String payName, DateTime beginOfDay, DateTime endOfDay,Boolean settlementFlag);
+    BigDecimal paySum(List<VehicleInfo> vehicleInfoList,String companyId, String payName, Date beginOfDay, Date endOfDay, Boolean settlementFlag);
 
-	Integer payNum(List<VehicleInfo> vehicleInfoList, String payName, DateTime beginOfDay, DateTime endOfDay,Boolean settlementFlag);
+	Integer payNum(List<VehicleInfo> vehicleInfoList,String companyId, String payName, Date beginOfDay, Date endOfDay,Boolean settlementFlag);
+
+	List<OrderInfo> findBySearchParams(Map<String, Object> searchParams,List<Sort> sortList);
 }

+ 9 - 4
common/src/main/java/com/jpsoft/bus/modules/base/service/impl/OrderInfoServiceImpl.java

@@ -153,12 +153,17 @@ public class OrderInfoServiceImpl implements OrderInfoService {
 	}
 
 	@Override
-	public BigDecimal paySum(List<VehicleInfo> vehicleInfoList, String payName, DateTime beginOfDay, DateTime endOfDay,Boolean settlementFlag) {
-		return orderInfoDAO.paySum(vehicleInfoList,payName,beginOfDay,endOfDay,settlementFlag);
+	public BigDecimal paySum(List<VehicleInfo> vehicleInfoList,String companyId, String payName, Date beginOfDay, Date endOfDay,Boolean settlementFlag) {
+		return orderInfoDAO.paySum(vehicleInfoList,companyId,payName,beginOfDay,endOfDay,settlementFlag);
 	}
 
 	@Override
-	public Integer payNum(List<VehicleInfo> vehicleInfoList, String payName, DateTime beginOfDay, DateTime endOfDay, Boolean settlementFlag) {
-		return orderInfoDAO.payNum(vehicleInfoList,payName,beginOfDay,endOfDay,settlementFlag);
+	public Integer payNum(List<VehicleInfo> vehicleInfoList,String companyId, String payName, Date beginOfDay, Date endOfDay, Boolean settlementFlag) {
+		return orderInfoDAO.payNum(vehicleInfoList,companyId,payName,beginOfDay,endOfDay,settlementFlag);
+	}
+
+	@Override
+	public List<OrderInfo> findBySearchParams(Map<String, Object> searchParams,List<Sort> sortList) {
+		return orderInfoDAO.search(searchParams,sortList);
 	}
 }

+ 2 - 2
common/src/main/java/com/jpsoft/bus/modules/bus/callback/GpsDataCallbackImpl.java

@@ -67,7 +67,7 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
     private RabbitTemplate rabbitTemplate;
 
     @Override
-    public void receive(String deviceNo, String longitude, String latitude) {
+    public void receive(String deviceNo, String longitude, String latitude,boolean manual) {
         log.warn("保存实时数据:{},{},{}", deviceNo, longitude, latitude);
 
         valueOperations.set(deviceNo + "_gps", longitude + "," + latitude, 1, TimeUnit.HOURS);
@@ -139,7 +139,7 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
 
                     if (shiftInfoList.size()>0){
                         ShiftInfo shiftInfo = shiftInfoList.get(0);
-                        String stationId = gpsService.getLatelyStation(v.getId());
+                        String stationId = gpsService.getLatelyStation(v.getId(),manual);
 
                         StationInfo currentStation = stationInfoService.get(stationId);
 

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

@@ -21,7 +21,7 @@ public interface GpsService {
      * @param id
      * @return
      */
-    String getLatelyStation(String id) throws Exception;
+    String getLatelyStation(String id,boolean manual) throws Exception;
 
     boolean matchDistance(StationInfo stationInfo, VehicleInfo vehicleInfo, int distance);
 }

+ 20 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java

@@ -293,7 +293,7 @@ public class GpsServiceImpl implements GpsService {
     }
 
     @Override
-    public String getLatelyStation(String id) throws Exception {
+    public String getLatelyStation(String id,boolean manual) throws Exception {
         VehicleInfo vehicleInfo = vehicleInfoService.get(id);
         if (vehicleInfo == null) {
             throw new Exception("车辆不存在");
@@ -336,6 +336,7 @@ public class GpsServiceImpl implements GpsService {
                 }
 
                 if(frontToEnd){
+                    int n = 0;
                     for (int i=0;i<stationInfoList.size();i++) {
                         StationInfo stationInfo = stationInfoList.get(i);
 
@@ -348,9 +349,19 @@ public class GpsServiceImpl implements GpsService {
                            currentStationId = stationInfo.getId();
                            break;
                         }
+
+                        //非人为设置当前站点则只查后两站
+                        if (!manual) {
+                            n++;
+
+                            if (n >= 2) {
+                                break;
+                            }
+                        }
                     }
                 }
                 else{
+                    int n = 0;
                     for (int i=stationInfoList.size() - 1;i>=0;i--) {
                         StationInfo stationInfo = stationInfoList.get(i);
 
@@ -363,6 +374,14 @@ public class GpsServiceImpl implements GpsService {
                             currentStationId = stationInfo.getId();
                             break;
                         }
+
+                        //非人为设置当前站点则只查后两站
+                        if (!manual) {
+                            n++;
+                            if (n >= 2) {
+                                break;
+                            }
+                        }
                     }
                 }
 

+ 40 - 1
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/PassengerInfoServiceImpl.java

@@ -22,6 +22,7 @@ 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;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -31,6 +32,7 @@ import com.github.pagehelper.Page;
 import com.jpsoft.bus.modules.common.dto.Sort;
 import com.github.pagehelper.PageHelper;
 
+@Slf4j
 @Transactional
 @Component(value = "passengerInfoService")
 public class PassengerInfoServiceImpl implements PassengerInfoService {
@@ -40,6 +42,12 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
     @Autowired
     private MergeOrderInfoService mergeOrderInfoService;
 
+    @Autowired
+    private VehicleInfoService vehicleInfoService;
+
+    @Autowired
+    private ShiftInfoService shiftInfoService;
+
     @Autowired
     private StationInfoService stationInfoService;
 
@@ -132,8 +140,22 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
         if (passengerInfoList.size() > 0) {
             PassengerInfo passengerInfo = passengerInfoList.get(0);
 
+            boolean allow = true;
+
             //如果已过站则不改状态
-            if(!"2".equals(passengerInfo.getPayStatus())) {
+            if("2".equals(passengerInfo.getPayStatus())) {
+                log.warn("乘客:{}已过站,不修改状态",passengerInfo.getId());
+                allow = false;
+            }
+            else if("0".equals(passengerInfo.getPayStatus())){
+                //未购票,同时已过站
+                if (!passengerInfo.getUpStationId().equals(shiftInfo.getCurrentStationId())){
+                    log.warn("乘客:{}未购票且已过站,不修改状态", passengerInfo.getId());
+                    allow = false;
+                }
+            }
+
+            if(allow){
                 passengerInfo.setLocalImageUrl(localImageUrl);
                 passengerInfo.setDownTime(recordDate);
                 passengerInfo.setDownStationId(stationId);
@@ -203,7 +225,12 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
             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(payName);
             mergeOrderInfo.setPaymentId(paymentId);
@@ -246,6 +273,12 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
             mergeOrderInfo.setId(UUID.randomUUID().toString());
             mergeOrderInfo.setVehicleShiftId(passengerInfo.getVehicleShiftId());
             mergeOrderInfo.setPayStatus(10);
+
+            //当前车辆所属公司
+            ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
+            VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
+
+            mergeOrderInfo.setCompanyId(vehicleInfo.getCompanyId());
             mergeOrderInfo.setOutOrderNo(wxJpsoftConfig.getUrlKey() + com.jpsoft.bus.modules.common.utils.StringUtils.getOutTradeNo());
             mergeOrderInfo.setPaymentId(paymentId);
             mergeOrderInfo.setCreateTime(new Date());
@@ -363,6 +396,12 @@ public class PassengerInfoServiceImpl implements PassengerInfoService {
             MergeOrderInfo mergeOrderInfo = new MergeOrderInfo();
             mergeOrderInfo.setId(UUID.randomUUID().toString());
             mergeOrderInfo.setVehicleShiftId(shiftInfo.getId());
+
+            //当前车辆所属公司
+           // ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
+          //  VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
+
+            mergeOrderInfo.setCompanyId(vehicleInfo.getCompanyId());
             mergeOrderInfo.setOpenId(openId);
             mergeOrderInfo.setPayStatus(10);
             mergeOrderInfo.setOutOrderNo(wxJpsoftConfig.getUrlKey() + com.jpsoft.bus.modules.common.utils.StringUtils.getOutTradeNo());

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

@@ -104,7 +104,7 @@ public class ShiftInfoServiceImpl implements ShiftInfoService {
 			}
 		}
 		//TODO 根据经纬度查询当前站点
-		String currentStationId = gpsService.getLatelyStation(vehicleInfo.getId());
+		String currentStationId = gpsService.getLatelyStation(vehicleInfo.getId(),false);
 
 		if (StringUtils.isEmpty(currentStationId)) {
 			currentStationId = startStationId;

+ 18 - 1
common/src/main/java/com/jpsoft/bus/modules/common/utils/StringUtils.java

@@ -1,6 +1,7 @@
 package com.jpsoft.bus.modules.common.utils;
 
 import cn.hutool.core.date.DateUtil;
+import com.jpsoft.bus.modules.bus.entity.StationInfo;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
@@ -210,6 +211,22 @@ public final class StringUtils extends org.apache.commons.lang3.StringUtils {
 
 	public static void main(String[] args) {
 
-		System.out.println(random(8,RandomType.ALL));
+		int currentIndex = 3;
+
+		int n = 0;
+		for (int i=0;i<7;i++) {
+
+
+			if(i <= currentIndex){
+				//正向行驶时,排序比当前站小的站点不用计算
+				continue;
+			}
+			n++;
+			if (n>=2){
+				break;
+			}
+		}
+
+
 	}
 }

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/dao/WithdrawalRecordDAO.java

@@ -18,4 +18,6 @@ public interface WithdrawalRecordDAO {
 	WithdrawalRecord findByMerchantId(String merchantId);
 	List<WithdrawalRecord> list();
 	List<WithdrawalRecord> search(Map<String,Object> searchParams,List<Sort> sortList);
+
+    List<WithdrawalRecord> findByMerchantIdAndStatus(String merchantId, String status);
 }

+ 20 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/dto/ProfitListDTO.java

@@ -0,0 +1,20 @@
+package com.jpsoft.bus.modules.merchant.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-5-7 17:01
+ */
+@Data
+public class ProfitListDTO {
+
+    private String dateDesc;
+
+    private BigDecimal revenue;
+
+    private List<ProfitListDTO> list;
+}

+ 36 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/dto/SellListDTO.java

@@ -0,0 +1,36 @@
+package com.jpsoft.bus.modules.merchant.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-5-7 19:15
+ */
+@Data
+public class SellListDTO {
+
+    private String id;
+
+    private String outOrderNo;
+
+    private String payName;
+
+    private String routeName;
+
+    private BigDecimal payFee;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "支付时间")
+    private Date payTime;
+
+    private String payNameStr;
+
+
+}

+ 25 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/dto/WithdrawalRecordDetailDTO.java

@@ -0,0 +1,25 @@
+package com.jpsoft.bus.modules.merchant.dto;
+
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-5-8 11:44
+ */
+@Data
+public class WithdrawalRecordDetailDTO {
+
+    private String name;
+
+    private String time;
+
+    private String amount;
+
+    private String status;
+
+    private String statusStr;
+
+    private String withdrawalNo;
+
+    private String remark;
+}

+ 24 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/dto/WithdrawalRecordListDTO.java

@@ -0,0 +1,24 @@
+package com.jpsoft.bus.modules.merchant.dto;
+
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-5-8 10:49
+ */
+@Data
+public class WithdrawalRecordListDTO {
+
+    private String id;
+
+    private String name;
+
+    private String time;
+
+    private String amount;
+
+    private String status;
+
+    private String statusStr;
+
+}

+ 40 - 24
common/src/main/java/com/jpsoft/bus/modules/merchant/entity/WithdrawalRecord.java

@@ -4,6 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
+
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -11,50 +12,65 @@ import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
 /**
-  描述:merchant_withdrawal_record的实体类
+ * 描述:merchant_withdrawal_record的实体类
  */
 @Data
 @ApiModel(value = "merchant_withdrawal_record的实体类")
 public class WithdrawalRecord {
-        @ApiModelProperty(value = "")
+    @ApiModelProperty(value = "")
     private String id;
-        @ApiModelProperty(value = "商户id")
+    @ApiModelProperty(value = "商户id")
     private String merchantId;
-        @ApiModelProperty(value = "申请提现金额")
+    @ApiModelProperty(value = "申请提现金额")
     private BigDecimal applyWithdrawalAmount;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "申请时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "申请时间")
     private Date applyTime;
-        @ApiModelProperty(value = "状态(0:申请中,1:同意,2:拒绝)")
+    @ApiModelProperty(value = "状态(0:申请中,1:同意,2:拒绝)")
     private String status;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "审核时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "审核时间")
     private Date examineTime;
-        @ApiModelProperty(value = "审核人")
+    @ApiModelProperty(value = "审核人")
     private String examineBy;
-        @ApiModelProperty(value = "备注")
+    @ApiModelProperty(value = "备注")
     private String remark;
-        @ApiModelProperty(value = "提现编号")
+    @ApiModelProperty(value = "提现编号")
     private String withdrawalNo;
-        @ApiModelProperty(value = "创建人")
+    @ApiModelProperty(value = "创建人")
     private String createBy;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "创建时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
     private Date createTime;
-        @ApiModelProperty(value = "更新人")
+    @ApiModelProperty(value = "更新人")
     private String updateBy;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "更新时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
     private Date updateTime;
-        @ApiModelProperty(value = "是否删除")
-    private Boolean delFlag;
+    @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag = false;
 
     @ApiModelProperty(value = "商户相关信息")
     private AccountInfo accountInfo;
     @ApiModelProperty(value = "商户账户相关信息")
     private CapitalInfo capitalInfo;
+
+
+    public String getStatusStr(String status) {
+        String statusStr = "";
+        if ("0".equals(status)) {
+            statusStr = "申请中";
+        }
+        if ("1".equals(status)) {
+            statusStr = "同意";
+        }
+        if ("2".equals(status)) {
+            statusStr = "拒绝";
+        }
+        return statusStr;
+    }
 }

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/service/WithdrawalRecordService.java

@@ -16,4 +16,6 @@ public interface WithdrawalRecordService {
 	WithdrawalRecord findByMerchantId(String merchantId);
 	List<WithdrawalRecord> list();
 	Page<WithdrawalRecord> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+
+    List<WithdrawalRecord> findByMerchantIdAndStatus(String merchantId, String status);
 }

+ 11 - 6
common/src/main/java/com/jpsoft/bus/modules/merchant/service/impl/WithdrawalRecordServiceImpl.java

@@ -29,14 +29,14 @@ public class WithdrawalRecordServiceImpl implements WithdrawalRecordService {
 	public int insert(WithdrawalRecord model) {
 		// TODO Auto-generated method stub
 		//model.setId(UUID.randomUUID().toString());
-		
+
 		return withdrawalRecordDAO.insert(model);
 	}
 
 	@Override
 	public int update(WithdrawalRecord model) {
 		// TODO Auto-generated method stub
-		return withdrawalRecordDAO.update(model);		
+		return withdrawalRecordDAO.update(model);
 	}
 
 	@Override
@@ -49,25 +49,30 @@ public class WithdrawalRecordServiceImpl implements WithdrawalRecordService {
 	public boolean exist(String id) {
 		// TODO Auto-generated method stub
 		int count = withdrawalRecordDAO.exist(id);
-		
+
 		return count > 0 ? true : false;
 	}
-	
+
 	@Override
 	public List<WithdrawalRecord> list() {
 		// TODO Auto-generated method stub
 		return withdrawalRecordDAO.list();
 	}
-		
+
 	@Override
 	public Page<WithdrawalRecord> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
         Page<WithdrawalRecord> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
             withdrawalRecordDAO.search(searchParams,sortList);
         });
-        
+
         return page;
 	}
 
+	@Override
+	public List<WithdrawalRecord> findByMerchantIdAndStatus(String merchantId, String status) {
+		return withdrawalRecordDAO.findByMerchantIdAndStatus(merchantId,status);
+	}
+
 	@Override
 	public WithdrawalRecord findByMerchantId(String merchantId){
 		return withdrawalRecordDAO.findByMerchantId(merchantId);

+ 4 - 1
common/src/main/java/com/jpsoft/bus/modules/pay/service/impl/WechatServiceImpl.java

@@ -121,6 +121,9 @@ public class WechatServiceImpl implements WechatService {
 
         MergeOrderInfo mergeOrderInfo = mergeOrderInfoService.get(orderInfo.getMergeOrderId());
 
+        PaymentInfo paymentInfo = paymentInfoService.get(mergeOrderInfo.getPaymentId());
+
+
         List<OrderInfo> orderInfoList = orderInfoService.findByMergeOrderId(mergeOrderInfo.getId());
         BigDecimal totalDecimal = BigDecimal.ZERO;
         if (orderInfoList.size()>0){
@@ -139,7 +142,7 @@ public class WechatServiceImpl implements WechatService {
         Map<String, String> params = RefundModel.builder()
                 .appid(wxJpsoftConfig.getAppId())
                 .mch_id(wxJpsoftConfig.getMchId())
-                .sub_mch_id(wxJpsoftConfig.getSubMchId())
+                .sub_mch_id(paymentInfo.getSubMchId())
                 .nonce_str(WxPayKit.generateStr())
                 .transaction_id(orderInfo.getTransactionId())
                 .out_trade_no(mergeOrderInfo.getOutOrderNo())

+ 6 - 1
common/src/main/resources/mapper/base/MergeOrderInfo.xml

@@ -7,6 +7,7 @@
 		<id property="id" column="id_" />
 			<result property="openId" column="open_id" />
 			<result property="vehicleShiftId" column="vehicle_shift_id"/>
+			<result property="companyId" column="company_id"/>
 			<result property="payStatus" column="pay_status" />
 			<result property="payName" column="pay_name" />
 			<result property="outOrderNo" column="out_order_no" />
@@ -26,12 +27,13 @@
 	-->
 	<![CDATA[
 		insert into base_merge_order_info
-	    (id_,open_id,vehicle_shift_id,pay_status,pay_name,out_order_no,transaction_id,payment_id,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,open_id,vehicle_shift_id,company_id,pay_status,pay_name,out_order_no,transaction_id,payment_id,create_by,create_time,update_by,update_time,del_flag)
 		values
 		(
 #{id,jdbcType=VARCHAR}
 ,#{openId,jdbcType=VARCHAR}
 ,#{vehicleShiftId,jdbcType=VARCHAR}
+,#{companyId,jdbcType=VARCHAR}
 ,#{payStatus,jdbcType= NUMERIC }
 ,#{payName,jdbcType=VARCHAR}
 ,#{outOrderNo,jdbcType=VARCHAR}
@@ -56,6 +58,9 @@
 		</if>
 			<if test="vehicleShiftId!=null">
 				vehicle_shift_id=#{vehicleShiftId,jdbcType=VARCHAR},
+			</if>
+			<if test="companyId != null!=null">
+				company_id=#{companyId,jdbcType=VARCHAR},
 			</if>
 				<if test="payStatus!=null">
 		pay_status=#{payStatus,jdbcType= NUMERIC },

+ 34 - 2
common/src/main/resources/mapper/base/OrderInfo.xml

@@ -140,7 +140,7 @@
 				ticket_down_station_id = #{ticketDownStationId,jdbcType=VARCHAR},
 			</if>
 			<if test="settlementFlag != null">
-				settlement_flag = #{settlementFlag,jdbcType=NUMERIC}}
+				settlement_flag = #{settlementFlag,jdbcType=NUMERIC}
 			</if>
 		</set>
 	where id_=#{id}
@@ -173,6 +173,14 @@
 			<if test="searchParams.companyId != null">
 				and g.id_ = #{searchParams.companyId}
 			</if>
+
+			<if test="searchParams.orderCompanyId != null">
+				and h.company_id = #{searchParams.orderCompanyId}
+			</if>
+			<if test="searchParams.vehicleId != null">
+				and c.vehicle_id = #{searchParams.vehicleId}
+			</if>
+
 			<if test="searchParams.licensePlateNumber != null">
 				and e.license_plate_number like #{searchParams.licensePlateNumber}
 			</if>
@@ -191,6 +199,10 @@
 			<if test="searchParams.shiftId != null">
 				and h.vehicle_shift_id = #{searchParams.shiftId}
 			</if>
+			<if test="searchParams.settlementFlag != null">
+				and a.settlement_flag = #{searchParams.settlementFlag}
+			</if>
+
 			<if test="searchParams.createBeginTime != null">
 				<![CDATA[
                   and a.create_time >= #{searchParams.createBeginTime}
@@ -211,6 +223,15 @@
                   and a.pay_time <= #{searchParams.payEndTime}
             ]]>
 			</if>
+
+			<if test="searchParams.payName != null and searchParams.payName != ''">
+				and a.pay_name = #{searchParams.payName}
+			</if>
+			<if test="searchParams.vehicleInfoList != null">
+				<foreach item="item" collection="searchParams.vehicleInfoList" open="and c.vehicle_id in (" separator="," close=")">
+					#{item.id}
+				</foreach>
+			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}
@@ -261,7 +282,7 @@
 		<where>
 			a.del_flag = 0
 			and a.pay_status = 20
-			<if test="payName != null">
+			<if test="payName != null and payName != ''">
 				and a.pay_name = #{payName}
 			</if>
 			<if test="vehicleInfoList!= null">
@@ -282,6 +303,9 @@
 			<if test="settlementFlag != null">
 			and	a.settlement_flag = #{settlementFlag}
 			</if>
+			<if test="companyId != null">
+				and b.company_id = #{companyId}
+			</if>
 		</where>
 	</select>
 
@@ -315,6 +339,14 @@
 			<if test="settlementFlag != null">
 				and	a.settlement_flag = #{settlementFlag}
 			</if>
+			<if test="companyId != null">
+				and b.company_id = #{companyId}
+			</if>
 		</where>
 	</select>
+
+
+	<select id="findBySearchParams" resultMap="OrderInfoMap">
+
+	</select>
 </mapper>

+ 3 - 0
common/src/main/resources/mapper/bus/PassengerInfo.xml

@@ -201,6 +201,9 @@
             <if test="searchParams.maxCreateTime != null">
                 and a.create_time >= #{searchParams.maxCreateTime}
             </if>
+            <if test="searchParams.maxUpTime != null">
+                and a.up_time >= #{searchParams.maxUpTime}
+            </if>
         </where>
         <foreach item="sort" collection="sortList" open="order by" separator=",">
             ${sort.name} ${sort.order}

+ 13 - 1
common/src/main/resources/mapper/merchant/WithdrawalRecord.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!-- namespace必须指向DAO接口 -->
 <mapper namespace="com.jpsoft.bus.modules.merchant.dao.WithdrawalRecordDAO">
@@ -133,6 +133,9 @@
 			<if test="searchParams.withdrawalNo != null">
 				and a.withdrawal_no like #{searchParams.withdrawalNo}
 			</if>
+			<if test="searchParams.merchantId != null">
+				and a.merchant_id = #{searchParams.merchantId}
+			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}
@@ -150,4 +153,13 @@
 		limit 1
 		]]>
 	</select>
+
+	<select id="findByMerchantIdAndStatus" resultMap="WithdrawalRecordMap">
+		<![CDATA[
+		select * from merchant_withdrawal_record
+		where del_flag = 0
+		and merchant_id = #{merchantId}
+		and status_ = #{status}
+		]]>
+	</select>
 </mapper>

+ 1 - 1
gps/src/main/java/com/jpsoft/gps/callback/GpsDataCallback.java

@@ -1,5 +1,5 @@
 package com.jpsoft.gps.callback;
 
 public interface GpsDataCallback {
-    void receive(String deviceNo,String longitude,String latitude);
+    void receive(String deviceNo,String longitude,String latitude,boolean manual);
 }

+ 2 - 2
gps/src/main/java/com/jpsoft/gps/handler/ProcessHandler.java

@@ -28,7 +28,7 @@ public class ProcessHandler extends SimpleChannelInboundHandler<String> {
             if (subArr.length==3){
                 //测试用不进行转换
                 if (this.callback != null) {
-                    this.callback.receive(deviceNo, subArr[1], subArr[0]);
+                    this.callback.receive(deviceNo, subArr[1], subArr[0],false);
                 }
             }
             else {
@@ -45,7 +45,7 @@ public class ProcessHandler extends SimpleChannelInboundHandler<String> {
 
                     if (this.callback != null) {
                         new Thread(()->{
-                            this.callback.receive(deviceNo, df.format(gcj[1]), df.format(gcj[0]));
+                            this.callback.receive(deviceNo, df.format(gcj[1]), df.format(gcj[0]),false);
                         }).start();
                     }
                 }

+ 1 - 0
web/src/main/java/com/jpsoft/bus/config/WebMvcConfig.java

@@ -77,6 +77,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/aliPay/**")
 				.excludePathPatterns("/wxPay/**")
 				.excludePathPatterns("/bus/deviceCmdApi/queryPadLatestVersion")
+				.excludePathPatterns("/bus/deviceCmdApi/queryXunFeiAppId")
 				.excludePathPatterns("/mobile/passengerApi/passengerMessageNoReadNum")
 				.excludePathPatterns("/mobile/passengerApi/passengerMessage")
 				.excludePathPatterns("/mobile/passengerApi/mergeInfo")

+ 249 - 106
web/src/main/java/com/jpsoft/bus/modules/base/controller/OrderInfoController.java

@@ -1,6 +1,7 @@
 package com.jpsoft.bus.modules.base.controller;
 
 import com.github.pagehelper.Page;
+import com.jpsoft.bus.config.OSSConfig;
 import com.jpsoft.bus.modules.base.dto.OrderInfoDTO;
 import com.jpsoft.bus.modules.bus.entity.*;
 import com.jpsoft.bus.modules.bus.service.*;
@@ -8,16 +9,25 @@ import com.jpsoft.bus.modules.common.dto.MessageResult;
 import com.jpsoft.bus.modules.common.dto.Sort;
 import com.jpsoft.bus.modules.base.entity.OrderInfo;
 import com.jpsoft.bus.modules.base.service.OrderInfoService;
+import com.jpsoft.bus.modules.common.utils.OSSUtil;
 import com.jpsoft.bus.modules.common.utils.PojoUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -56,6 +66,9 @@ public class OrderInfoController {
     @Autowired
     private CompanyInfoService companyInfoService;
 
+    @Autowired
+    private OSSConfig ossConfig;
+
 
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
@@ -225,149 +238,279 @@ public class OrderInfoController {
 
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
-    public MessageResult<Map> pageList(
+    public MessageResult<Object> pageList(
             String companyId,String licensePlateNumber,String outOrderNo,String transactionId,
             String shiftId,String createTimeRanges,String payTimeRanges,Integer payStatus,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag,
             @RequestAttribute String subject){
 
         //当前用户ID
         System.out.println(subject);
 
-        MessageResult<Map> msgResult = new MessageResult<>();
+        MessageResult<Object> msgResult = new MessageResult<>();
 
-        Map<String,Object> searchParams = new HashMap<>();
+        try {
 
-        List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("a.create_time","desc"));
+            Map<String, Object> searchParams = new HashMap<>();
 
-        if (StringUtils.isNotEmpty(companyId)) {
-            searchParams.put("companyId",companyId);
-        }
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("a.create_time", "desc"));
 
-        if (StringUtils.isNotEmpty(licensePlateNumber)) {
-            searchParams.put("licensePlateNumber","%"+licensePlateNumber+"%");
-        }
+            if (StringUtils.isNotEmpty(companyId)) {
+                searchParams.put("companyId", companyId);
+            }
 
-        if (StringUtils.isNotEmpty(outOrderNo)) {
-            searchParams.put("outOrderNo","%"+outOrderNo+"%");
-        }
+            if (StringUtils.isNotEmpty(licensePlateNumber)) {
+                searchParams.put("licensePlateNumber", "%" + licensePlateNumber + "%");
+            }
 
-        if (StringUtils.isNotEmpty(transactionId)) {
-            searchParams.put("transactionId","%"+transactionId+"%");
-        }
+            if (StringUtils.isNotEmpty(outOrderNo)) {
+                searchParams.put("outOrderNo", "%" + outOrderNo + "%");
+            }
 
-        if (StringUtils.isNotEmpty(shiftId)) {
-            searchParams.put("shiftId",shiftId);
-        }
+            if (StringUtils.isNotEmpty(transactionId)) {
+                searchParams.put("transactionId", "%" + transactionId + "%");
+            }
 
-        if (payStatus!=null) {
-            searchParams.put("payStatus",payStatus);
-        }
+            if (StringUtils.isNotEmpty(shiftId)) {
+                searchParams.put("shiftId", shiftId);
+            }
 
-        if(StringUtils.isNotEmpty(createTimeRanges)){
-            String[] timeRangeArray = createTimeRanges.split(",");
-            String createBeginTime = "";
-            String createEndTime = "";
-            if (timeRangeArray.length == 1) {
-                createBeginTime = timeRangeArray[0];
-                createBeginTime+=" 00:00:00";
-            } else if (timeRangeArray.length == 2) {
-                createBeginTime = timeRangeArray[0];
-                createEndTime = timeRangeArray[1];
-                createBeginTime+=" 00:00:00";
-                createEndTime+=" 23:59:59";
+            if (payStatus != null) {
+                searchParams.put("payStatus", payStatus);
             }
 
-            searchParams.put("createBeginTime", createBeginTime);
-            searchParams.put("createEndTime", createEndTime);
-        }
+            if (StringUtils.isNotEmpty(createTimeRanges)) {
+                String[] timeRangeArray = createTimeRanges.split(",");
+                String createBeginTime = "";
+                String createEndTime = "";
+                if (timeRangeArray.length == 1) {
+                    createBeginTime = timeRangeArray[0];
+                    createBeginTime += " 00:00:00";
+                } else if (timeRangeArray.length == 2) {
+                    createBeginTime = timeRangeArray[0];
+                    createEndTime = timeRangeArray[1];
+                    createBeginTime += " 00:00:00";
+                    createEndTime += " 23:59:59";
+                }
 
-        if(StringUtils.isNotEmpty(payTimeRanges)){
-            String[] timeRangeArray = payTimeRanges.split(",");
-            String payBeginTime = "";
-            String payEndTime = "";
-            if (timeRangeArray.length == 1) {
-                payBeginTime = timeRangeArray[0];
-                payBeginTime+=" 00:00:00";
-            } else if (timeRangeArray.length == 2) {
-                payBeginTime = timeRangeArray[0];
-                payEndTime = timeRangeArray[1];
-                payBeginTime+=" 00:00:00";
-                payEndTime+=" 23:59:59";
+                searchParams.put("createBeginTime", createBeginTime);
+                searchParams.put("createEndTime", createEndTime);
             }
 
-            searchParams.put("payBeginTime", payBeginTime);
-            searchParams.put("payEndTime", payEndTime);
-        }
+            if (StringUtils.isNotEmpty(payTimeRanges)) {
+                String[] timeRangeArray = payTimeRanges.split(",");
+                String payBeginTime = "";
+                String payEndTime = "";
+                if (timeRangeArray.length == 1) {
+                    payBeginTime = timeRangeArray[0];
+                    payBeginTime += " 00:00:00";
+                } else if (timeRangeArray.length == 2) {
+                    payBeginTime = timeRangeArray[0];
+                    payEndTime = timeRangeArray[1];
+                    payBeginTime += " 00:00:00";
+                    payEndTime += " 23:59:59";
+                }
 
+                searchParams.put("payBeginTime", payBeginTime);
+                searchParams.put("payEndTime", payEndTime);
+            }
 
-        Page<OrderInfo> page = orderInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
-
-        Page<OrderInfoDTO> pageDto = new Page<>();
-
-        for (OrderInfo orderInfo:page) {
-            OrderInfoDTO dto = new OrderInfoDTO();
-            dto.setId(orderInfo.getId());
-            dto.setTotalFee(orderInfo.getTotalFee());
-            dto.setBody(orderInfo.getBody());
-            dto.setPayFee(orderInfo.getPayFee());
-            dto.setPayStatus(orderInfo.getPayStatus());
-            dto.setPayName(orderInfo.getPayName());
-            dto.setPayTime(orderInfo.getPayTime());
-            dto.setCreateTime(orderInfo.getCreateTime());
-            dto.setOutOrderNo(orderInfo.getOutOrderNo());
-            dto.setTransactionId(orderInfo.getTransactionId());
-            dto.setTicketType(orderInfo.getTicketType());
-            dto.setGoodsTicket(orderInfo.getGoodsTicket());
-
-            PassengerInfo passengerInfo = passengerInfoService.get(orderInfo.getPassengerId());
-
-            if(passengerInfo!=null){
-                ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
-                if(shiftInfo!=null){
-                    DriverInfo driverInfo = driverInfoService.get(shiftInfo.getDriverId());
-                    if(driverInfo!=null){
-                        dto.setDriverName(driverInfo.getName());
-                    }
-                    VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
-                    if(vehicleInfo!=null){
-                        dto.setLicensePlateNumber(vehicleInfo.getLicensePlateNumber());
-                        CompanyInfo companyInfo = companyInfoService.get(vehicleInfo.getCompanyId());
-                        if(companyInfo!=null){
-                            dto.setCompanyName(companyInfo.getName());
+
+            Page<OrderInfo> page = orderInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
+
+            List<Map> mapList = new ArrayList<>();
+
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+
+            for (OrderInfo orderInfo : page) {
+
+                Map<String, Object> map = new HashMap<>();
+
+                map.put("id", orderInfo.getId());
+                map.put("totalFee", orderInfo.getTotalFee());
+                map.put("body", orderInfo.getBody());
+                map.put("payFee", orderInfo.getPayFee());
+                map.put("payStatus", orderInfo.getPayStatus());
+                if(orderInfo.getPayStatus()==10){
+                    map.put("payStatusN", "未支付");
+                }
+                else if(orderInfo.getPayStatus()==20){
+                    map.put("payStatusN","已支付");
+                }
+                else if(orderInfo.getPayStatus()==40){
+                    map.put("payStatusN", "已退款");
+                }
+                else{
+                    map.put("payStatusN", "");
+                }
+
+                map.put("payName", orderInfo.getPayName());
+
+                if(("wechat").equals(orderInfo.getPayName())){
+                    map.put("payNameN", "微信");
+                }
+                else if(("alipay").equals(orderInfo.getPayName())){
+                    map.put("payNameN", "支付宝");
+                }
+                else if(("cash").equals(orderInfo.getPayName())){
+                    map.put("payNameN", "现金");
+                }
+                else if(("ticket").equals(orderInfo.getPayName())){
+                    map.put("payNameN", "车票");
+                }
+                else{
+                    map.put("payNameN", "");
+                }
+
+                if(orderInfo.getPayTime()!=null) {
+                    map.put("payTime", sdf.format(orderInfo.getPayTime()));
+                }
+                else{
+                    map.put("payTime", "");
+                }
+                if(orderInfo.getCreateTime()!=null){
+                    map.put("createTime",  sdf.format(orderInfo.getCreateTime()));
+                }
+                else{
+                    map.put("createTime", "");
+                }
+
+                map.put("outOrderNo", orderInfo.getOutOrderNo());
+                map.put("transactionId", orderInfo.getTransactionId());
+                map.put("ticketType", orderInfo.getTicketType());
+                if(("1").equals(orderInfo.getTicketType())){
+                    map.put("ticketTypeN", "儿童票");
+                }
+                else if(("2").equals(orderInfo.getTicketType())){
+                    map.put("ticketTypeN", "成人票");
+                }
+                else{
+                    map.put("ticketTypeN", "");
+                }
+
+                map.put("goodsTicketN", orderInfo.getGoodsTicket());
+
+
+                PassengerInfo passengerInfo = passengerInfoService.get(orderInfo.getPassengerId());
+
+
+                if (passengerInfo != null) {
+                    ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
+                    if (shiftInfo != null) {
+                        DriverInfo driverInfo = driverInfoService.get(shiftInfo.getDriverId());
+                        if (driverInfo != null) {
+                            map.put("driverName", driverInfo.getName());
+                        }
+                        VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
+                        if (vehicleInfo != null) {
+                            map.put("licensePlateNumber", vehicleInfo.getLicensePlateNumber());
+                            CompanyInfo companyInfo = companyInfoService.get(vehicleInfo.getCompanyId());
+                            if (companyInfo != null) {
+                                map.put("companyName", companyInfo.getName());
+                            }
+                        }
+                        RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
+                        if (routeInfo != null) {
+                            map.put("routeName", routeInfo.getName());
+                        }
+                        StationInfo upStation = stationInfoService.get(passengerInfo.getUpStationId());
+                        if (upStation != null) {
+                            map.put("upStationName", upStation.getName());
+                        }
+                        StationInfo downStation = stationInfoService.get(passengerInfo.getDownStationId());
+                        if (downStation != null) {
+                            map.put("downStationName", downStation.getName());
                         }
-                    }
-                    RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
-                    if(routeInfo!=null){
-                        dto.setRouteName(routeInfo.getName());
-                    }
-                    StationInfo upStation = stationInfoService.get(passengerInfo.getUpStationId());
-                    if(upStation!=null){
-                        dto.setUpStationName(upStation.getName());
-                    }
-                    StationInfo downStation = stationInfoService.get(passengerInfo.getDownStationId());
-                    if(downStation!=null){
-                        dto.setDownStationName(downStation.getName());
                     }
                 }
+
+                mapList.add(map);
             }
 
-            pageDto.add(dto);
-        }
 
-        pageDto.setPageSize(page.getPageSize());
-        pageDto.setTotal(page.getTotal());
-        pageDto.setPageNum(page.getPageNum());
+            if (exportFlag) {
+                String filePath = exportXls(mapList);
+                msgResult.setData(filePath);
+            } else {
+                Map<String, Object> dataMap = PojoUtils.pageWrapper(page);
+                dataMap.put("data", mapList);
+                msgResult.setData(dataMap);
+            }
 
-        msgResult.setResult(true);
-        msgResult.setData(PojoUtils.pageWrapper(pageDto));
+            msgResult.setResult(true);
+        }
+        catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+            msgResult.setResult(false);
+        }
 
         return msgResult;
     }
 
 
+    private String exportXls(List<Map> mapList) throws IOException {
+        String downloadUrl = "";
+
+        Workbook workbook = new HSSFWorkbook();
+        Sheet sheet = workbook.createSheet();
+
+        //表头
+        Row rowTitle = sheet.createRow(0);
+
+        String[] titles = new String[]{"所属公司","车牌号","司机姓名","路线名称","账单金额(元)","支付金额(元)","支付状态","支付方式","上车站点","下车站点",
+                "购票类型","货票金额(元)","订单编号","交易流水号","创建时间","支付时间"};
+
+        for (int i=0;i<titles.length;i++) {
+            Cell cell = rowTitle.createCell(i);
+            cell.setCellValue(titles[i]);
+        }
+
+        for (int i=0;i<mapList.size();i++){
+            Map<String,Object> map = mapList.get(i);
+
+            Row row = sheet.createRow(i+1);
+
+            int colIndex = 0;
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("companyName"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("licensePlateNumber"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("driverName"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("routeName"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("totalFee"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("payFee"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("payStatusN"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("payNameN"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("upStationName"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("downStationName"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("ticketTypeN"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("goodsTicket"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("outOrderNo"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("transactionId"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("createTime"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.bus.modules.common.utils.StringUtils.strValue(map.get("payTime"),""));
+
+        }
+
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+
+        try {
+            workbook.write(output);
+
+            byte[] buffer = output.toByteArray();
+            ByteArrayInputStream input = new ByteArrayInputStream(buffer);
+
+            downloadUrl = OSSUtil.upload(ossConfig,"orderInfo","订单管理列表.xls",input);
+        }
+        catch (Exception ex){
+            logger.error(ex.getMessage(),ex);
+        }
+
+        return downloadUrl;
+    }
+
+
     @ApiOperation(value = "修改订单状态")
     @PostMapping("updateOrder")
     public MessageResult<Boolean> updateOrder(String id, Integer payStatus, @RequestAttribute String subject) {

+ 25 - 0
web/src/main/java/com/jpsoft/bus/modules/device/controller/DeviceCmdApiController.java

@@ -54,6 +54,31 @@ public class DeviceCmdApiController {
         return messageResult;
     }
 
+    @GetMapping("queryXunFeiAppId")
+    @ApiOperation(value="查询讯飞AppId")
+    public MessageResult<Map> queryXunFeiAppId(){
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+            DataDictionary dd  = dataDictionaryService.findByName("讯飞AppId");
+
+            Map<String,String> data = new HashMap<>();
+
+            data.put("appId", dd.getValue());
+
+            messageResult.setData(data);
+            messageResult.setResult(true);
+        }
+        catch (Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
     @PostMapping("downloadCommand")
     @ApiOperation(value="下载设备待执行命令")
     public MessageResult<List> downloadCommand(@RequestBody JSONObject requestBody){

+ 14 - 2
web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java

@@ -1081,7 +1081,7 @@ public class DriverApiController {
 
     @PostMapping("updateCurrentStation")
     @ApiOperation(value="更新当前站点")
-    public MessageResult<String> updateCurrentStation(String currentStationId,@RequestAttribute String subject){
+    public MessageResult<String> updateCurrentStation(String currentStationId,@RequestAttribute String subject,HttpServletRequest request){
         MessageResult<String> messageResult = new MessageResult<>();
 
         try {
@@ -1098,11 +1098,23 @@ public class DriverApiController {
             ShiftInfo shiftInfo = shiftInfoList.get(0);
             StationInfo currentStation = stationInfoService.get(currentStationId);
 
+            //记录当前站点的校正记录,以便用来记录站点定位
+            if(currentStation!=null){
+                SysLog sysLog = new SysLog();
+                sysLog.setPointcut("站点校正");
+                sysLog.setData("车牌号:" + vehicleInfo.getLicensePlateNumber() + ",经纬度:" +  vehicleInfo.getLongitude() + "." + vehicleInfo.getLatitude());
+                sysLog.setRemark("当前站点:" + currentStation.getName() + ",id=" + currentStationId);
+                sysLog.setRemoteIp(HttpUtil.getIpAddress(request));
+                sysLog.setCreateTime(new Date());
+                logService.insert(sysLog);
+            }
+
             //改gps后,会自动修改当前站点,只能往后改
             if(currentStation.getLongitude()!=null && currentStation.getLatitude()!=null) {
                 gpsDataCallback.receive(vehicleInfo.getGpsDeviceNo(),
                         String.valueOf(currentStation.getLongitude()),
-                        String.valueOf(currentStation.getLatitude()));
+                        String.valueOf(currentStation.getLatitude()),
+                        true);
             }
 
             shiftInfo.setCurrentStationId(currentStationId);

+ 523 - 27
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/MerchantApiController.java

@@ -2,22 +2,32 @@ package com.jpsoft.bus.modules.mobile.controller;
 
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.base.entity.MergeOrderInfo;
+import com.jpsoft.bus.modules.base.entity.OrderInfo;
 import com.jpsoft.bus.modules.base.entity.ProblemFeedback;
+import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
 import com.jpsoft.bus.modules.base.service.OrderInfoService;
 import com.jpsoft.bus.modules.bus.dto.VehicleDTO;
-import com.jpsoft.bus.modules.bus.entity.CompanyInfo;
-import com.jpsoft.bus.modules.bus.entity.UserInfo;
-import com.jpsoft.bus.modules.bus.entity.VehicleInfo;
-import com.jpsoft.bus.modules.bus.service.CompanyInfoService;
-import com.jpsoft.bus.modules.bus.service.VehicleInfoService;
+import com.jpsoft.bus.modules.bus.entity.*;
+import com.jpsoft.bus.modules.bus.service.*;
 import com.jpsoft.bus.modules.common.dto.MessageResult;
+import com.jpsoft.bus.modules.common.dto.Sort;
 import com.jpsoft.bus.modules.common.utils.DES3;
 import com.jpsoft.bus.modules.common.utils.JwtUtil;
 import com.jpsoft.bus.modules.common.utils.SMSUtil;
+import com.jpsoft.bus.modules.merchant.dto.ProfitListDTO;
+import com.jpsoft.bus.modules.merchant.dto.SellListDTO;
+import com.jpsoft.bus.modules.merchant.dto.WithdrawalRecordDetailDTO;
+import com.jpsoft.bus.modules.merchant.dto.WithdrawalRecordListDTO;
 import com.jpsoft.bus.modules.merchant.entity.AccountInfo;
 import com.jpsoft.bus.modules.merchant.entity.CapitalInfo;
+import com.jpsoft.bus.modules.merchant.entity.WithdrawalRecord;
 import com.jpsoft.bus.modules.merchant.service.AccountInfoService;
 import com.jpsoft.bus.modules.merchant.service.CapitalInfoService;
+import com.jpsoft.bus.modules.merchant.service.WithdrawalRecordService;
+import com.jpsoft.bus.modules.sys.entity.DataDictionary;
+import com.jpsoft.bus.modules.sys.service.DataDictionaryService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -29,12 +39,10 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 
@@ -54,15 +62,39 @@ public class MerchantApiController {
     @Autowired
     private CompanyInfoService companyInfoService;
 
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+
+    @Autowired
+    private DriverInfoService driverInfoService;
+
+    @Autowired
+    private RouteInfoService routeInfoService;
+
+    @Autowired
+    private PassengerInfoService passengerInfoService;
+
     @Autowired
     private CapitalInfoService capitalInfoService;
 
+    @Autowired
+    private WithdrawalRecordService withdrawalRecordService;
+
+    @Autowired
+    private MergeOrderInfoService mergeOrderInfoService;
+
     @Autowired
     private OrderInfoService orderInfoService;
 
     @Autowired
     private VehicleInfoService vehicleInfoService;
 
+    @Autowired
+    private StationInfoService stationInfoService;
+
+    @Autowired
+    private ShiftInfoService shiftInfoService;
+
     @Autowired
     private RedisTemplate redisTemplate;
 
@@ -159,7 +191,7 @@ public class MerchantApiController {
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -227,27 +259,27 @@ public class MerchantApiController {
                 totalRevenue = capitalInfo.getTotalRevenue();
             }
 
-            if (vehicleInfoList.size()>0){
+      //      if (vehicleInfoList.size()>0){
                 //今日收益
-                BigDecimal todaySum = orderInfoService.paySum(vehicleInfoList,null, DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
+                BigDecimal todaySum = orderInfoService.paySum(null,companyInfo.getId(),null, DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
                 if (todaySum != null){
                     todayRevenue = todaySum;
                 }
                 //昨日收益
-                BigDecimal yesterdaySum = orderInfoService.paySum(vehicleInfoList,null,DateUtil.beginOfDay(DateUtil.offsetDay(new Date(),-1)),DateUtil.endOfDay(DateUtil.offsetDay(new Date(),-1)),null);
+                BigDecimal yesterdaySum = orderInfoService.paySum(null,companyInfo.getId(),null,DateUtil.beginOfDay(DateUtil.offsetDay(new Date(),-1)),DateUtil.endOfDay(DateUtil.offsetDay(new Date(),-1)),null);
                 if (yesterdaySum != null){
                     yesterdayRevenue = yesterdaySum;
                 }
 
                 //总收益
-                BigDecimal totalSum = orderInfoService.paySum(vehicleInfoList,null,null,new cn.hutool.core.date.DateTime(),null);
+                BigDecimal totalSum = orderInfoService.paySum(null,companyInfo.getId(),null,null,new cn.hutool.core.date.DateTime(),null);
 
                 if (totalSum != null){
                     totalRevenue = totalSum;
                 }
 
 
-            }
+      //      }
 
             Map<String,Object> map = new HashMap<>();
             map.put("todayRevenue",todayRevenue);
@@ -259,6 +291,7 @@ public class MerchantApiController {
             messageResult.setCode(200);
         } catch (Exception ex) {
             log.error(ex.getMessage(), ex);
+            messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
         }
@@ -294,37 +327,37 @@ public class MerchantApiController {
 
 
 
-            if (vehicleInfoList.size()>0){
+          //  if (vehicleInfoList.size()>0){
                 //微信
-                BigDecimal wechatSum = orderInfoService.paySum(vehicleInfoList,"wechat", DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
+                BigDecimal wechatSum = orderInfoService.paySum(null,companyInfo.getId(),"wechat", DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
                 if (wechatSum != null){
                     wechatRevenue = wechatSum;
                 }
                 //支付宝
-                BigDecimal alipaySum = orderInfoService.paySum(vehicleInfoList,"alipay",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
+                BigDecimal alipaySum = orderInfoService.paySum(null,companyInfo.getId(),"alipay",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
                 if (alipaySum != null){
                     alipayRevenue = alipaySum;
                 }
 
                 //现金
-                BigDecimal cashSum = orderInfoService.paySum(vehicleInfoList,"cash",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
+                BigDecimal cashSum = orderInfoService.paySum(null,companyInfo.getId(),"cash",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
                 if (cashSum != null){
                     cashRevenue = cashSum;
                 }
 
                 //车票
-                BigDecimal ticketSum = orderInfoService.paySum(vehicleInfoList,"ticket",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
+                BigDecimal ticketSum = orderInfoService.paySum(null,companyInfo.getId(),"ticket",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
                 if (ticketSum != null){
                     ticketRevenue = ticketSum;
                 }
 
-                Integer ticketNum = orderInfoService.payNum(vehicleInfoList,null,DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
+                Integer ticketNum = orderInfoService.payNum(null,companyInfo.getId(),null,DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
                 if (ticketNum != null){
                     num = ticketNum;
                 }
 
 
-            }
+      //      }
 
             Map<String,Object> map = new HashMap<>();
             map.put("onlineRevenue",wechatRevenue.add(alipayRevenue));
@@ -339,6 +372,7 @@ public class MerchantApiController {
             messageResult.setCode(200);
         } catch (Exception ex) {
             log.error(ex.getMessage(), ex);
+            messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
         }
@@ -374,6 +408,7 @@ public class MerchantApiController {
             messageResult.setCode(200);
         } catch (Exception ex) {
             log.error(ex.getMessage(), ex);
+            messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
         }
@@ -387,9 +422,101 @@ public class MerchantApiController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "vehicleId", value = "车辆id", required = false, paramType = "form"),
             @ApiImplicitParam(name = "payName", value = "支付方式(微信:wechat,支付宝:alipay,现金:cash,车票:ticket)", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "date", value = "时间(格式:yyyy-MM)", required = false, paramType = "form")
+            @ApiImplicitParam(name = "dateStr", value = "时间(格式:yyyy-MM)", required = false, paramType = "form")
     })
-    public MessageResult<Map> profitList(String vehicleId,String payName,String date,String token, @RequestAttribute String subject) {
+    public MessageResult<ProfitListDTO> profitList(String vehicleId,String payName,String dateStr,String token, @RequestAttribute String subject) {
+        MessageResult<ProfitListDTO> messageResult = new MessageResult<>();
+
+        try {
+
+            ProfitListDTO profitListDTO = new ProfitListDTO();
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+            CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
+            List<VehicleInfo> vehicleInfoList = new ArrayList<>();
+            if (StringUtils.isNotBlank(vehicleId)){
+                VehicleInfo vehicleInfo = vehicleInfoService.get(vehicleId);
+                if (vehicleInfo != null){
+                    vehicleInfoList.add(vehicleInfo);
+                }
+            }else {
+                vehicleInfoList = vehicleInfoService.findByCompanyId(companyInfo.getId());
+            }
+
+
+
+
+            int n = 0;
+            //开始计算的日期
+            Date startDate = DateUtil.endOfDay(new Date());
+            Date newDate = DateUtil.beginOfMonth(new Date());
+            String dateDesc = DateUtil.format(newDate,"yyyy年MM月");
+            if (StringUtils.isNotBlank(dateStr)){
+                Date date = DateUtil.parse(dateStr,"yyyy-MM");
+
+                dateDesc = DateUtil.format(date,"yyyy年MM月");
+                if (newDate.compareTo(DateUtil.beginOfMonth(date))>0){
+                    Date endOfMonth = DateUtil.endOfMonth(date);
+                    n = DateUtil.dayOfMonth(endOfMonth);
+                    startDate =  DateUtil.endOfMonth(date);
+                }else if(newDate.compareTo(DateUtil.beginOfMonth(date))==0){
+                    n = DateUtil.thisDayOfMonth();
+                }
+            }else {
+                n = DateUtil.thisDayOfMonth();
+            }
+
+            BigDecimal revenue = BigDecimal.ZERO;
+
+            profitListDTO.setDateDesc(dateDesc);
+
+
+            List<ProfitListDTO> list = new ArrayList<>();
+            if (n>0){
+                for (int m = 0 ; m <n; m++){
+                    ProfitListDTO profitListDTO1 = new ProfitListDTO();
+                    Date baseDate = DateUtil.offsetDay(startDate,-m);
+                    Date baseStartDate = DateUtil.beginOfDay(baseDate);
+                 //   BigDecimal baseSum = BigDecimal.ZERO;
+                  //  if (vehicleInfoList.size()>0){
+                    BigDecimal baseSum  = orderInfoService.paySum(null,companyInfo.getId(),payName,baseStartDate,baseDate,null);
+                //    }
+
+                    profitListDTO1.setDateDesc(DateUtil.format(baseDate,"yyyy-MM-dd"));
+                    profitListDTO1.setRevenue(baseSum == null?BigDecimal.ZERO:baseSum);
+                    list.add(profitListDTO1);
+                    revenue = revenue.add(baseSum == null?BigDecimal.ZERO:baseSum);
+                }
+            }
+
+
+
+            profitListDTO.setRevenue(revenue);
+            profitListDTO.setList(list);
+            messageResult.setData(profitListDTO);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(),ex);
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("sellList")
+    @ApiOperation(value = "售票明细")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "vehicleId", value = "车辆id", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "payName", value = "支付方式(微信:wechat,支付宝:alipay,现金:cash,车票:ticket)", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "dateStr", value = "时间(格式:yyyy-MM)", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "dateType", value = "全天:0,上半天:1,下半天:2", required = true, paramType = "form")
+    })
+    public MessageResult<Map> sellList(String vehicleId, String payName, String dateStr,String dateType, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,String token, @RequestAttribute String subject) {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
@@ -409,18 +536,154 @@ public class MerchantApiController {
                 vehicleInfoList = vehicleInfoService.findByCompanyId(companyInfo.getId());
             }
 
+            Map<String,Object> searchParams = new HashMap<>();
+            searchParams.put("payStatus",20);
+            if (StringUtils.isNotBlank(payName)){
+                searchParams.put("payName",payName);
+            }
+
+            Date date = DateUtil.parse(dateStr,"yyyy-MM-dd");
+            Date startTime = DateUtil.beginOfDay(date);
+            Date endTime = DateUtil.endOfDay(date);
+            Date middleTime = DateUtil.parse(dateStr + " 12:00:00","yyyy-MM-dd HH:mm:ss");
+            if ("1".equals(dateType)){
+                endTime = middleTime;
+            }
+            if ("2".equals(dateType)){
+                startTime = middleTime;
+            }
+
+            searchParams.put("payBeginTime",startTime);
+            searchParams.put("payEndTime",endTime);
+            if (StringUtils.isNotBlank(vehicleId)){
+                searchParams.put("vehicleId",vehicleId);
+            }
+            searchParams.put("orderCompanyId",companyInfo.getId());
+       //     searchParams.put("vehicleInfoList",vehicleInfoList);
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("a.pay_time","desc"));
+
+            Page<OrderInfo> page = orderInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+            List<OrderInfo> orderInfoList = page.getResult();
+            List<SellListDTO> list = new ArrayList<>();
+            if (orderInfoList.size()>0){
+                for (OrderInfo orderInfo : orderInfoList){
+                    SellListDTO sellListDTO = new SellListDTO();
+                    BeanUtils.copyProperties(orderInfo,sellListDTO);
+
+                    MergeOrderInfo mergeOrderInfo = mergeOrderInfoService.get(orderInfo.getMergeOrderId());
+                    ShiftInfo shiftInfo = shiftInfoService.get(mergeOrderInfo.getVehicleShiftId());
+                    StationInfo start =  stationInfoService.get(shiftInfo.getStartStationId());
+                    StationInfo end = stationInfoService.get(shiftInfo.getEndStationId());
+                    sellListDTO.setRouteName(start.getName() + "-" + end.getName());
+                    sellListDTO.setPayNameStr(orderInfo.getPayNameStr(orderInfo.getPayName()));
+                    list.add(sellListDTO);
+                }
+            }
+            Map<String,Object> pageMap = new HashMap<>();
+            pageMap.put("recordsTotal",page.getTotal());
+            pageMap.put("recordsFiltered",page.getTotal());
+            pageMap.put("totalPage",page.getPages());
+            pageMap.put("pageNumber",page.getPageNum());
+            pageMap.put("pageSize",page.getPageSize());
+            pageMap.put("data", list);
+
+            messageResult.setData(pageMap);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(),ex);
+            messageResult.setCode(400);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("sellDetail")
+    @ApiOperation(value = "售票详情")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", required = true, paramType = "form")
+    })
+    public MessageResult<Map> sellDetail(String id,String token, @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+            OrderInfo orderInfo = orderInfoService.get(id);
+
+            if (orderInfo == null){
+                throw new Exception("订单不存在");
+            }
+            //乘客记录
+            PassengerInfo passengerInfo = passengerInfoService.get(orderInfo.getPassengerId());
+
+            MergeOrderInfo mergeOrderInfo = mergeOrderInfoService.get(orderInfo.getMergeOrderId());
+            //购票上车点
+            StationInfo ticketUpStation = stationInfoService.get(orderInfo.getTicketUpStationId());
+            //购票下车点
+            StationInfo ticketDownStation = stationInfoService.get(orderInfo.getTicketDownStationId());
+
+
+            //班次
+            ShiftInfo shiftInfo = shiftInfoService.get(mergeOrderInfo.getVehicleShiftId());
+            //线路
+            RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
+            //班次开始点
+            StationInfo start = stationInfoService.get(shiftInfo.getStartStationId());
+            //班次终点
+            StationInfo end = stationInfoService.get(shiftInfo.getEndStationId());
+            //司机
+            DriverInfo driverInfo = driverInfoService.get(shiftInfo.getDriverId());
+            //车辆
+            VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
 
+            Map<String,Object> map = new HashMap<>();
 
+            map.put("outOrderNo",orderInfo.getOutOrderNo());
+            map.put("payName",orderInfo.getPayName());
+            map.put("payNameStr",orderInfo.getPayNameStr(orderInfo.getPayName()));
+            map.put("ticketType",orderInfo.getTicketType());
+            map.put("ticketTypeStr",orderInfo.getTicketTypeStr(orderInfo.getTicketType()));
+            map.put("goodTicketFee",orderInfo.getGoodsTicket());
+            map.put("ticketFee",orderInfo.getTotalFee().subtract(orderInfo.getGoodsTicket()));
+            map.put("totalFee",orderInfo.getTotalFee());
+            map.put("ticketTrip",ticketUpStation.getName() + "-" +ticketDownStation.getName());
+            if ("2".equals(passengerInfo.getStatus())){
+                map.put("ticketStatus","已过期");
+            }
+            if ("1".equals(passengerInfo.getStatus())){
+                map.put("ticketStatus","乘车中");
+            }
+            map.put("createTime",DateUtil.format(orderInfo.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
+            map.put("payTime",DateUtil.format(orderInfo.getPayTime(),"yyyy-MM-dd HH:mm:ss"));
+            Date closeTime = null;
+            if (passengerInfo.getDownTime() != null){
+                closeTime = passengerInfo.getDownTime();
 
+            }
+            map.put("closeTime",DateUtil.format(closeTime,"yyyy-MM-dd HH:mm:ss"));
 
+            map.put("routeName",routeInfo.getName());
+            map.put("routeTrip",start.getName() + "-" + end.getName());
+            map.put("routeTime",routeInfo.getStartTime() + "-" + routeInfo.getEndTime());
+            map.put("licensePlateNumber",vehicleInfo.getLicensePlateNumber());
+            map.put("driverName",driverInfo.getName());
+            map.put("phone",driverInfo.getPhone());
 
-           // map.put("token", token);
 
-         //   messageResult.setData(map);
+            messageResult.setData(map);
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
-            log.error(ex.getMessage());
+            log.error(ex.getMessage(),ex);
             messageResult.setCode(400);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
@@ -430,4 +693,237 @@ public class MerchantApiController {
     }
 
 
+    @PostMapping("myAccount")
+    @ApiOperation(value = "我的账户")
+    public MessageResult<Map> myAccount(String token, @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+            BigDecimal withdrawalAmount = BigDecimal.ZERO;
+            BigDecimal todayRevenue = BigDecimal.ZERO;
+            BigDecimal onlineTotalRevenue = BigDecimal.ZERO;
+            BigDecimal alreadyWithdrawalAmount = BigDecimal.ZERO;
+
+            CapitalInfo capitalInfo = capitalInfoService.findByMerchantId(accountInfo.getId());
+            if (capitalInfo != null){
+                withdrawalAmount = capitalInfo.getWithdrawalAmount();
+                onlineTotalRevenue = capitalInfo.getOnlineTotalRevenue();
+                alreadyWithdrawalAmount = capitalInfo.getAlreadyWithdrawalAmount();
+            }
+            CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
+            List<VehicleInfo> vehicleInfoList = vehicleInfoService.findByCompanyId(companyInfo.getId());
+         //   if (vehicleInfoList.size()>0){
+                BigDecimal wechatTodaySum = orderInfoService.paySum(null,companyInfo.getId(),"wechat",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),false);
+                BigDecimal alipayTodaySum = orderInfoService.paySum(null,companyInfo.getId(),"alipay",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),false);
+                todayRevenue = (wechatTodaySum == null?BigDecimal.ZERO:wechatTodaySum).add(alipayTodaySum==null?BigDecimal.ZERO:alipayTodaySum);
+
+        //    }
+
+
+            DataDictionary dataDictionary = dataDictionaryService.findByName("提现日期");
+            Map<String,Object> map = new HashMap<>();
+            map.put("withdrawalAmount",withdrawalAmount);
+            map.put("todayRevenue",todayRevenue);
+            map.put("onlineTotalRevenue",onlineTotalRevenue.add(todayRevenue));
+            map.put("alreadyWithdrawalAmount",alreadyWithdrawalAmount);
+            map.put("account",accountInfo);
+            map.put("date",dataDictionary.getValue());
+
+
+            messageResult.setData(map);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setCode(400);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+
+    @PostMapping("logOut")
+    @ApiOperation(value = "登出")
+    public MessageResult<Map> logOut(String token, @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+
+            accountInfo.setOpenId("");
+            accountInfoService.update(accountInfo);
+
+
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setCode(400);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+    @PostMapping("withdrawalRecordList")
+    @ApiOperation(value = "提现记录")
+    public MessageResult<Map> withdrawalRecordList(String token, @RequestAttribute String subject,@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+
+            Map<String,Object> searchParams = new HashMap<>();
+            searchParams.put("merchantId",accountInfo.getId());
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("create_time","desc"));
+            Page<WithdrawalRecord> page = withdrawalRecordService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+            List<WithdrawalRecord> withdrawalRecordList = page.getResult();
+            List<WithdrawalRecordListDTO> list = new ArrayList<>();
+            if (withdrawalRecordList.size()>0){
+                for (WithdrawalRecord withdrawalRecord : withdrawalRecordList){
+                    WithdrawalRecordListDTO withdrawalRecordListDTO = new WithdrawalRecordListDTO();
+                    withdrawalRecordListDTO.setId(withdrawalRecord.getId());
+                    withdrawalRecordListDTO.setName("账户提现");
+                    withdrawalRecordListDTO.setTime(DateUtil.format(withdrawalRecord.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
+                    withdrawalRecordListDTO.setStatus(withdrawalRecord.getStatus());
+                    withdrawalRecordListDTO.setStatusStr(withdrawalRecord.getStatusStr(withdrawalRecord.getStatus()));
+                    withdrawalRecordListDTO.setAmount("-" + withdrawalRecord.getApplyWithdrawalAmount());
+                    list.add(withdrawalRecordListDTO);
+
+                }
+            }
+            Map<String,Object> pageMap = new HashMap<>();
+            pageMap.put("recordsTotal",page.getTotal());
+            pageMap.put("recordsFiltered",page.getTotal());
+            pageMap.put("totalPage",page.getPages());
+            pageMap.put("pageNumber",page.getPageNum());
+            pageMap.put("pageSize",page.getPageSize());
+            pageMap.put("data", list);
+
+            messageResult.setData(pageMap);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setCode(400);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+
+    @PostMapping("withdrawalRecordDetail")
+    @ApiOperation(value = "提现记录详情")
+    public MessageResult<WithdrawalRecordDetailDTO> withdrawalRecordDetail(String id, String token, @RequestAttribute String subject) {
+        MessageResult<WithdrawalRecordDetailDTO> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+
+            WithdrawalRecord withdrawalRecord = withdrawalRecordService.get(id);
+            if (withdrawalRecord == null){
+                throw new Exception("记录不存在");
+            }
+            WithdrawalRecordDetailDTO withdrawalRecordDetailDTO = new WithdrawalRecordDetailDTO();
+            withdrawalRecordDetailDTO.setName("账户提现");
+            withdrawalRecordDetailDTO.setAmount("-"+withdrawalRecord.getApplyWithdrawalAmount());
+            withdrawalRecordDetailDTO.setStatus(withdrawalRecord.getStatus());
+            withdrawalRecordDetailDTO.setStatusStr(withdrawalRecord.getStatusStr(withdrawalRecord.getStatus()));
+            withdrawalRecordDetailDTO.setWithdrawalNo(withdrawalRecord.getWithdrawalNo());
+            if ("0".equals(withdrawalRecord.getStatus())){
+                withdrawalRecordDetailDTO.setTime(DateUtil.format(withdrawalRecord.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
+            }
+            else {
+                withdrawalRecordDetailDTO.setTime(DateUtil.format(withdrawalRecord.getExamineTime(),"yyyy-MM-dd HH:mm:ss"));
+            }
+
+            withdrawalRecordDetailDTO.setRemark(withdrawalRecord.getRemark());
+
+            messageResult.setData(withdrawalRecordDetailDTO);
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setCode(400);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+
+    @PostMapping("withdrawalSubmit")
+    @ApiOperation(value = "提现")
+    public MessageResult<Map> withdrawal(String amount, String token, @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+
+            CapitalInfo capitalInfo = capitalInfoService.findByMerchantId(accountInfo.getId());
+            if (capitalInfo == null){
+                throw new Exception("没有相关账户信息");
+            }
+            List<WithdrawalRecord> withdrawalRecordList = withdrawalRecordService.findByMerchantIdAndStatus(accountInfo.getId(),"0");
+
+            if (withdrawalRecordList.size()>0){
+                throw new Exception("有一笔正在审核的提现记录,不可再次申请");
+            }
+            BigDecimal bigAmount = new BigDecimal(amount);
+            if (bigAmount.compareTo(capitalInfo.getWithdrawalAmount()) >0){
+                throw new Exception("提现金额不可超过可提现金额");
+            }
+
+            WithdrawalRecord withdrawalRecord = new WithdrawalRecord();
+            withdrawalRecord.setId(UUID.randomUUID().toString());
+            withdrawalRecord.setMerchantId(accountInfo.getId());
+            withdrawalRecord.setApplyWithdrawalAmount(bigAmount);
+            withdrawalRecord.setApplyTime(new Date());
+            withdrawalRecord.setStatus("0");
+            withdrawalRecord.setWithdrawalNo(com.jpsoft.bus.modules.common.utils.StringUtils.getOutTradeNo());
+            withdrawalRecord.setCreateBy(accountInfo.getId());
+            withdrawalRecord.setCreateTime(new Date());
+            withdrawalRecordService.insert(withdrawalRecord);
+
+            messageResult.setResult(true);
+            messageResult.setCode(200);
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setCode(400);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
 }

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

@@ -568,7 +568,7 @@ public class PassengerApiController {
             searchParams.put("vehicleShiftId", shiftInfo.getId());
             searchParams.put("status", "1");
             searchParams.put("payStatus", "0");
-            searchParams.put("maxCreateTime", DateUtil.offsetMinute(new Date(), -10));
+            searchParams.put("maxUpTime", DateUtil.offsetMinute(new Date(), -10));
             List<Sort> sortList = new ArrayList<>();
             sortList.add(new Sort("up_time", "desc"));
             Page<PassengerInfo> page = passengerInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);

+ 88 - 0
web/src/main/java/com/jpsoft/bus/scheduled/SettlementTask.java

@@ -0,0 +1,88 @@
+package com.jpsoft.bus.scheduled;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.db.sql.Order;
+import com.jpsoft.bus.modules.base.entity.OrderInfo;
+import com.jpsoft.bus.modules.base.service.OrderInfoService;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.jpsoft.bus.modules.merchant.entity.AccountInfo;
+import com.jpsoft.bus.modules.merchant.entity.CapitalInfo;
+import com.jpsoft.bus.modules.merchant.service.AccountInfoService;
+import com.jpsoft.bus.modules.merchant.service.CapitalInfoService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-5-08 10:28
+ */
+@Component
+@Slf4j
+@Transactional
+public class SettlementTask {
+
+    @Autowired
+    private CapitalInfoService capitalInfoService;
+
+    @Autowired
+    private OrderInfoService orderInfoService;
+
+    @Autowired
+    private AccountInfoService accountInfoService;
+
+
+    //每天凌晨12点01分开始
+    @Scheduled(cron = "0 01 0 ? * *")
+    public  void run() {
+
+        log.warn("每日资金结算定时任务开始");
+
+        Date yesterdayDate = DateUtil.offsetDay(new Date(),-1);
+    //    Date startDate = DateUtil.beginOfDay(yesterdayDate);
+        Date endDate = DateUtil.endOfDay(yesterdayDate);
+
+        List<CapitalInfo> capitalInfoList = capitalInfoService.list();
+        if (capitalInfoList.size()>0){
+            for (CapitalInfo capitalInfo : capitalInfoList){
+
+                //线上收益
+                BigDecimal onlineRevenue = BigDecimal.ZERO;
+                //线下收益
+                BigDecimal downRevenue = BigDecimal.ZERO;
+                AccountInfo accountInfo = accountInfoService.get(capitalInfo.getMerchantId());
+                Map<String,Object> searchParams = new HashMap<>();
+                searchParams.put("orderCompanyId",accountInfo.getCompanyId());
+                searchParams.put("payStatus",20);
+                searchParams.put("settlementFlag",false);
+                searchParams.put("payEndTime",endDate);
+                List<Sort> sortList = new ArrayList<>();
+                sortList.add(new Sort("a.pay_time","desc"));
+                List<OrderInfo> orderInfoList = orderInfoService.findBySearchParams(searchParams,sortList);
+                if (orderInfoList.size()>0){
+                    for (OrderInfo orderInfo : orderInfoList){
+                        if ("wechat".equals(orderInfo.getPayName()) || "alipay".equals(orderInfo.getPayName())){
+                            onlineRevenue = onlineRevenue.add(orderInfo.getPayFee());
+                        }
+                        if ("cash".equals(orderInfo.getPayName()) || "ticket".equals(orderInfo.getPayName())){
+                           downRevenue = downRevenue.add(orderInfo.getPayFee());
+                        }
+                        orderInfo.setSettlementFlag(true);
+                        orderInfoService.update(orderInfo);
+                    }
+                }
+
+                capitalInfo.setWithdrawalAmount(capitalInfo.getWithdrawalAmount().add(onlineRevenue));
+                capitalInfo.setTotalRevenue(capitalInfo.getTotalRevenue().add(onlineRevenue).add(downRevenue));
+                capitalInfo.setOnlineTotalRevenue(capitalInfo.getOnlineTotalRevenue().add(onlineRevenue));
+                capitalInfoService.update(capitalInfo);
+            }
+        }
+        log.warn("每日资金结算定时任务结束");
+    }
+}