Browse Source

Merge remote-tracking branch 'origin/master'

yanliming 4 years ago
parent
commit
fa7aac17c1
56 changed files with 3532 additions and 51 deletions
  1. 11 0
      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. 14 0
      common/src/main/java/com/jpsoft/bus/modules/base/entity/OrderInfo.java
  4. 11 0
      common/src/main/java/com/jpsoft/bus/modules/base/service/OrderInfoService.java
  5. 18 0
      common/src/main/java/com/jpsoft/bus/modules/base/service/impl/OrderInfoServiceImpl.java
  6. 3 3
      common/src/main/java/com/jpsoft/bus/modules/bus/callback/GpsDataCallbackImpl.java
  7. 4 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dao/VehicleInfoDAO.java
  8. 15 0
      common/src/main/java/com/jpsoft/bus/modules/bus/dto/VehicleDTO.java
  9. 1 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/GpsService.java
  10. 5 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/VehicleInfoService.java
  11. 23 3
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java
  12. 40 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/PassengerInfoServiceImpl.java
  13. 1 1
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/ShiftInfoServiceImpl.java
  14. 10 0
      common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/VehicleInfoServiceImpl.java
  15. 4 4
      common/src/main/java/com/jpsoft/bus/modules/common/utils/SMSUtil.java
  16. 18 1
      common/src/main/java/com/jpsoft/bus/modules/common/utils/StringUtils.java
  17. 22 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dao/AccountInfoDAO.java
  18. 19 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dao/CapitalInfoDAO.java
  19. 23 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dao/WithdrawalRecordDAO.java
  20. 20 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dto/ProfitListDTO.java
  21. 36 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dto/SellListDTO.java
  22. 25 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dto/WithdrawalRecordDetailDTO.java
  23. 24 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/dto/WithdrawalRecordListDTO.java
  24. 56 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/entity/AccountInfo.java
  25. 46 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/entity/CapitalInfo.java
  26. 76 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/entity/WithdrawalRecord.java
  27. 21 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/service/AccountInfoService.java
  28. 20 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/service/CapitalInfoService.java
  29. 21 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/service/WithdrawalRecordService.java
  30. 80 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/service/impl/AccountInfoServiceImpl.java
  31. 75 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/service/impl/CapitalInfoServiceImpl.java
  32. 80 0
      common/src/main/java/com/jpsoft/bus/modules/merchant/service/impl/WithdrawalRecordServiceImpl.java
  33. 6 1
      common/src/main/resources/mapper/base/MergeOrderInfo.xml
  34. 104 1
      common/src/main/resources/mapper/base/OrderInfo.xml
  35. 3 0
      common/src/main/resources/mapper/bus/PassengerInfo.xml
  36. 14 0
      common/src/main/resources/mapper/bus/VehicleInfo.xml
  37. 167 0
      common/src/main/resources/mapper/merchant/AccountInfo.xml
  38. 117 0
      common/src/main/resources/mapper/merchant/CapitalInfo.xml
  39. 165 0
      common/src/main/resources/mapper/merchant/WithdrawalRecord.xml
  40. 1 1
      common/src/main/resources/mapper/sys/SysLog.xml
  41. 1 1
      gps/src/main/java/com/jpsoft/gps/callback/GpsDataCallback.java
  42. 2 2
      gps/src/main/java/com/jpsoft/gps/handler/ProcessHandler.java
  43. 3 1
      web/src/main/java/com/jpsoft/bus/config/RabbitmqConfig.java
  44. 3 0
      web/src/main/java/com/jpsoft/bus/config/WebMvcConfig.java
  45. 30 0
      web/src/main/java/com/jpsoft/bus/listener/WeixinListener.java
  46. 2 2
      web/src/main/java/com/jpsoft/bus/modules/bus/controller/PriceInfoController.java
  47. 65 0
      web/src/main/java/com/jpsoft/bus/modules/bus/controller/VehicleInfoController.java
  48. 37 14
      web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java
  49. 293 0
      web/src/main/java/com/jpsoft/bus/modules/merchant/controller/AccountInfoController.java
  50. 225 0
      web/src/main/java/com/jpsoft/bus/modules/merchant/controller/CapitalInfoController.java
  51. 362 0
      web/src/main/java/com/jpsoft/bus/modules/merchant/controller/WithdrawalRecordController.java
  52. 929 0
      web/src/main/java/com/jpsoft/bus/modules/mobile/controller/MerchantApiController.java
  53. 2 2
      web/src/main/java/com/jpsoft/bus/modules/mobile/controller/PassengerApiController.java
  54. 77 0
      web/src/main/java/com/jpsoft/bus/modules/sys/controller/LogController.java
  55. 88 0
      web/src/main/java/com/jpsoft/bus/scheduled/SettlementTask.java
  56. 12 12
      web/src/main/resources/application-production.yml

+ 11 - 0
common/src/main/java/com/jpsoft/bus/modules/base/dao/OrderInfoDAO.java

@@ -1,6 +1,11 @@
 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;
+import com.jpsoft.bus.modules.bus.entity.VehicleInfo;
 import org.springframework.stereotype.Repository;
 import com.jpsoft.bus.modules.base.entity.OrderInfo;
 import java.util.Map;
@@ -23,4 +28,10 @@ public interface OrderInfoDAO {
 	List<OrderInfo> findByMergeOrderId(String mergeOrderId);
 
     OrderInfo findByPassengerIdMergeOrderId(String passengerId, String mergeOrderId);
+
+    BigDecimal paySum(List<VehicleInfo> vehicleInfoList, String companyId,String payName, Date beginOfDay, Date 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:车票)")

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

@@ -73,6 +73,9 @@ public class OrderInfo {
     @ApiModelProperty(value = "购票的下车站点")
     private String ticketDownStationId;
 
+    @ApiModelProperty(value = "结算状态")
+    private Boolean settlementFlag = false;
+
 
     public String getPayNameStr(String payName){
         String payNameStr = "";
@@ -90,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;
+    }
 }

+ 11 - 0
common/src/main/java/com/jpsoft/bus/modules/base/service/OrderInfoService.java

@@ -1,9 +1,14 @@
 package com.jpsoft.bus.modules.base.service;
 
+import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
+
+import cn.hutool.core.date.DateTime;
 import com.jpsoft.bus.modules.base.entity.OrderInfo;
 import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.bus.entity.VehicleInfo;
 import com.jpsoft.bus.modules.common.dto.Sort;
 
 public interface OrderInfoService {
@@ -31,4 +36,10 @@ public interface OrderInfoService {
 	 * @throws Exception
 	 */
 	Boolean refund(String orderId,String userId) throws Exception;
+
+    BigDecimal paySum(List<VehicleInfo> vehicleInfoList,String companyId, String payName, Date beginOfDay, Date 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);
 }

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

@@ -1,15 +1,18 @@
 package com.jpsoft.bus.modules.base.service.impl;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 import javax.annotation.Resource;
 
+import cn.hutool.core.date.DateTime;
 import com.jpsoft.bus.modules.base.dao.OrderLogDAO;
 import com.jpsoft.bus.modules.base.entity.OrderLog;
 import com.jpsoft.bus.modules.base.service.OrderLogService;
 import com.jpsoft.bus.modules.bus.entity.PassengerInfo;
+import com.jpsoft.bus.modules.bus.entity.VehicleInfo;
 import com.jpsoft.bus.modules.bus.service.PassengerInfoService;
 import com.jpsoft.bus.modules.pay.service.AlipayService;
 import com.jpsoft.bus.modules.pay.service.WechatService;
@@ -148,4 +151,19 @@ public class OrderInfoServiceImpl implements OrderInfoService {
 
 		return true;
 	}
+
+	@Override
+	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 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);
+	}
 }

+ 3 - 3
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);
 
@@ -264,7 +264,7 @@ public class GpsDataCallbackImpl implements GpsDataCallback {
                         }
 
                         //判断车辆和当前站点的位置关系
-                        if (gpsService.matchDistance(currentStation,v,50)){
+                        if (gpsService.matchDistance(currentStation,v,100)){
                             shiftInfo.setCurrentStationStatus("1");
                             shiftInfoService.update(shiftInfo);
                         }else {

+ 4 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dao/VehicleInfoDAO.java

@@ -19,4 +19,8 @@ public interface VehicleInfoDAO {
     VehicleInfo findByCodeAndCarNum(String activationCode, String carNum);
 	VehicleInfo findByGpsDeviceNo(String gpsDeviceNo);
 	int updateGps(VehicleInfo entity);
+
+	VehicleInfo findByCarNum(String carNum);
+
+    List<VehicleInfo> findByCompanyId(String companyId);
 }

+ 15 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/VehicleDTO.java

@@ -0,0 +1,15 @@
+package com.jpsoft.bus.modules.bus.dto;
+
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-5-7 16:08
+ */
+@Data
+public class VehicleDTO {
+
+    private String id;
+
+    private String licensePlateNumber;
+}

+ 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);
 }

+ 5 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/VehicleInfoService.java

@@ -18,5 +18,10 @@ public interface VehicleInfoService {
     VehicleInfo findByCodeAndCarNum(String activationCode, String carNum);
 
 	VehicleInfo findByGpsDeviceNo(String deviceNo);
+
+	VehicleInfo findByCarNum(String carNum);
+
 	void updateGps(VehicleInfo v);
+
+    List<VehicleInfo> findByCompanyId(String companyId);
 }

+ 23 - 3
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("车辆不存在");
@@ -327,6 +327,7 @@ public class GpsServiceImpl implements GpsService {
             StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
 
             boolean frontToEnd = true;
+            int distance = 100;
 
             if (stationInfoList.size() > 0) {
                 if(endStation.getId().equals(stationInfoList.get(0).getId())){
@@ -335,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);
 
@@ -343,13 +345,23 @@ public class GpsServiceImpl implements GpsService {
                             continue;
                         }
 
-                        if(matchDistance(stationInfo,vehicleInfo,50)){
+                        if(matchDistance(stationInfo,vehicleInfo,distance)){
                            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);
 
@@ -358,10 +370,18 @@ public class GpsServiceImpl implements GpsService {
                             continue;
                         }
 
-                        if(matchDistance(stationInfo,vehicleInfo,50)){
+                        if(matchDistance(stationInfo,vehicleInfo,distance)){
                             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;

+ 10 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/VehicleInfoServiceImpl.java

@@ -81,4 +81,14 @@ public class VehicleInfoServiceImpl implements VehicleInfoService {
 	public void updateGps(VehicleInfo v) {
 		vehicleInfoDAO.updateGps(v);
 	}
+
+	@Override
+	public List<VehicleInfo> findByCompanyId(String companyId) {
+		return vehicleInfoDAO.findByCompanyId(companyId);
+	}
+
+	@Override
+	public VehicleInfo findByCarNum(String carNum){
+		return vehicleInfoDAO.findByCarNum(carNum);
+	}
 }

+ 4 - 4
common/src/main/java/com/jpsoft/bus/modules/common/utils/SMSUtil.java

@@ -86,10 +86,10 @@ public class SMSUtil {
 	 * @param phones 手机号,多个以英文逗号","隔开
 	 * @param signName 签名:目前仅支持"荆鹏云平台","速乐购"两种签名
 	 * @param smsTemplateCode 短信模版ID
-	 * @param json 短信模板变量,传参规则{"key":"value"},key的名字须和申请模板中的变量名一致,多个变量之间以逗号隔开。示例:针对模板“验证码${code},您正在进行${product}身份验证,打死不要告诉别人哦!”,传参时需传入{"code":"1234","product":"alidayu"}
+	 * @param jsonStr 短信模板变量,传参规则{"key":"value"},key的名字须和申请模板中的变量名一致,多个变量之间以逗号隔开。示例:针对模板“验证码${code},您正在进行${product}身份验证,打死不要告诉别人哦!”,传参时需传入{"code":"1234","product":"alidayu"}
 	 * @return
 	 */
-	public static MessageResult send(String phones, String signName, String smsTemplateCode, JSONObject json){
+	public static MessageResult send(String phones, String signName, String smsTemplateCode, String jsonStr){
 
 		boolean success = true;
 		String msg = "发送成功";
@@ -98,8 +98,8 @@ public class SMSUtil {
 		AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
 		req.setSmsType(SMS_TYPE);
 		req.setSmsFreeSignName(signName);
-		if(json != null){
-			req.setSmsParamString(json.toString());
+		if(jsonStr != null){
+			req.setSmsParamString(jsonStr);
 		}
 		req.setRecNum(phones);
 		req.setSmsTemplateCode(smsTemplateCode);

+ 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;
+			}
+		}
+
+
 	}
 }

+ 22 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/dao/AccountInfoDAO.java

@@ -0,0 +1,22 @@
+package com.jpsoft.bus.modules.merchant.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.bus.modules.merchant.entity.AccountInfo;
+import java.util.Map;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+@Repository
+public interface AccountInfoDAO {
+	int insert(AccountInfo entity);
+	int update(AccountInfo entity);
+	int exist(String id);
+	AccountInfo get(String id);
+	int delete(String id);
+	List<AccountInfo> list();
+	List<AccountInfo> search(Map<String,Object> searchParams,List<Sort> sortList);
+
+    AccountInfo findByPhone(String phone);
+
+    AccountInfo findByOpenId(String openId);
+}

+ 19 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/dao/CapitalInfoDAO.java

@@ -0,0 +1,19 @@
+package com.jpsoft.bus.modules.merchant.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.bus.modules.merchant.entity.CapitalInfo;
+import java.util.Map;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+@Repository
+public interface CapitalInfoDAO {
+	int insert(CapitalInfo entity);
+	int update(CapitalInfo entity);
+	int exist(String id);
+	CapitalInfo get(String id);
+	int delete(String id);
+	CapitalInfo findByMerchantId(String merchantId);
+	List<CapitalInfo> list();
+	List<CapitalInfo> search(Map<String,Object> searchParams,List<Sort> sortList);
+}

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

@@ -0,0 +1,23 @@
+package com.jpsoft.bus.modules.merchant.dao;
+
+import java.util.List;
+
+import com.jpsoft.bus.modules.merchant.entity.CapitalInfo;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.bus.modules.merchant.entity.WithdrawalRecord;
+import java.util.Map;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+@Repository
+public interface WithdrawalRecordDAO {
+	int insert(WithdrawalRecord entity);
+	int update(WithdrawalRecord entity);
+	int exist(String id);
+	WithdrawalRecord get(String id);
+	int delete(String id);
+	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;
+
+}

+ 56 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/entity/AccountInfo.java

@@ -0,0 +1,56 @@
+package com.jpsoft.bus.modules.merchant.entity;
+
+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;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:merchant_account_info的实体类
+ */
+@Data
+@ApiModel(value = "merchant_account_info的实体类")
+public class AccountInfo {
+        @ApiModelProperty(value = "")
+    private String id;
+        @ApiModelProperty(value = "商户名称")
+    private String name;
+        @ApiModelProperty(value = "关联的公司车队")
+    private String companyId;
+        @ApiModelProperty(value = "微信openId")
+    private String openId;
+        @ApiModelProperty(value = "手机号")
+    private String phone;
+        @ApiModelProperty(value = "提现许可(0:不可提现,1:可提现)")
+    private Boolean withdrawAllow;
+        @ApiModelProperty(value = "商户冻结(0:未冻结,1:已冻结)")
+    private Boolean frozen;
+        @ApiModelProperty(value = "头像")
+    private String imageUrl;
+        @ApiModelProperty(value = "银行名称")
+    private String bankName;
+        @ApiModelProperty(value = "银行卡账号")
+    private String bankNumber;
+        @ApiModelProperty(value = "创建人")
+    private String createBy;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+        @ApiModelProperty(value = "更新人")
+    private String updateBy;
+        @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 String companyName;
+}

+ 46 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/entity/CapitalInfo.java

@@ -0,0 +1,46 @@
+package com.jpsoft.bus.modules.merchant.entity;
+
+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;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * 描述:merchant_capital_info的实体类
+ */
+@Data
+@ApiModel(value = "merchant_capital_info的实体类")
+public class CapitalInfo {
+    @ApiModelProperty(value = "")
+    private String id;
+    @ApiModelProperty(value = "商户id")
+    private String merchantId;
+    @ApiModelProperty(value = "可提现金额(线上)")
+    private BigDecimal withdrawalAmount = BigDecimal.ZERO;
+    @ApiModelProperty(value = "已提现金额(线上)")
+    private BigDecimal alreadyWithdrawalAmount= BigDecimal.ZERO;
+    @ApiModelProperty(value = "总收益(不包含当天)")
+    private BigDecimal totalRevenue= BigDecimal.ZERO;
+    @ApiModelProperty(value = "线上总收益(不包含当天)")
+    private BigDecimal onlineTotalRevenue= BigDecimal.ZERO;
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+    @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 = false;
+}

+ 76 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/entity/WithdrawalRecord.java

@@ -0,0 +1,76 @@
+package com.jpsoft.bus.modules.merchant.entity;
+
+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;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+ * 描述:merchant_withdrawal_record的实体类
+ */
+@Data
+@ApiModel(value = "merchant_withdrawal_record的实体类")
+public class WithdrawalRecord {
+    @ApiModelProperty(value = "")
+    private String id;
+    @ApiModelProperty(value = "商户id")
+    private String merchantId;
+    @ApiModelProperty(value = "申请提现金额")
+    private BigDecimal applyWithdrawalAmount;
+    @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:拒绝)")
+    private String status;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "审核时间")
+    private Date examineTime;
+    @ApiModelProperty(value = "审核人")
+    private String examineBy;
+    @ApiModelProperty(value = "备注")
+    private String remark;
+    @ApiModelProperty(value = "提现编号")
+    private String withdrawalNo;
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+    @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 = 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;
+    }
+}

+ 21 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/service/AccountInfoService.java

@@ -0,0 +1,21 @@
+package com.jpsoft.bus.modules.merchant.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.bus.modules.merchant.entity.AccountInfo;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+public interface AccountInfoService {
+	AccountInfo get(String id);
+	boolean exist(String id);
+	int insert(AccountInfo model);
+	int update(AccountInfo model);
+	int delete(String id);
+	List<AccountInfo> list();
+	Page<AccountInfo> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+
+    AccountInfo findByPhone(String phone);
+
+    AccountInfo findByOpenId(String openId);
+}

+ 20 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/service/CapitalInfoService.java

@@ -0,0 +1,20 @@
+package com.jpsoft.bus.modules.merchant.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.jpsoft.bus.modules.merchant.entity.AccountInfo;
+import com.jpsoft.bus.modules.merchant.entity.CapitalInfo;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+public interface CapitalInfoService {
+	CapitalInfo get(String id);
+	boolean exist(String id);
+	int insert(CapitalInfo model);
+	int update(CapitalInfo model);
+	int delete(String id);
+	CapitalInfo findByMerchantId(String merchantId);
+	List<CapitalInfo> list();
+	Page<CapitalInfo> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+}

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

@@ -0,0 +1,21 @@
+package com.jpsoft.bus.modules.merchant.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.jpsoft.bus.modules.merchant.entity.WithdrawalRecord;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+
+public interface WithdrawalRecordService {
+	WithdrawalRecord get(String id);
+	boolean exist(String id);
+	int insert(WithdrawalRecord model);
+	int update(WithdrawalRecord model);
+	int delete(String id);
+	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);
+}

+ 80 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/service/impl/AccountInfoServiceImpl.java

@@ -0,0 +1,80 @@
+package com.jpsoft.bus.modules.merchant.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.bus.modules.merchant.dao.AccountInfoDAO;
+import com.jpsoft.bus.modules.merchant.entity.AccountInfo;
+import com.jpsoft.bus.modules.merchant.service.AccountInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="accountInfoService")
+public class AccountInfoServiceImpl implements AccountInfoService {
+	@Resource(name="accountInfoDAO")
+	private AccountInfoDAO accountInfoDAO;
+
+	@Override
+	public AccountInfo get(String id) {
+		// TODO Auto-generated method stub
+		return accountInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(AccountInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+
+		return accountInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(AccountInfo model) {
+		// TODO Auto-generated method stub
+		return accountInfoDAO.update(model);
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return accountInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = accountInfoDAO.exist(id);
+
+		return count > 0 ? true : false;
+	}
+
+	@Override
+	public List<AccountInfo> list() {
+		// TODO Auto-generated method stub
+		return accountInfoDAO.list();
+	}
+
+	@Override
+	public Page<AccountInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<AccountInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            accountInfoDAO.search(searchParams,sortList);
+        });
+
+        return page;
+	}
+
+	@Override
+	public AccountInfo findByPhone(String phone) {
+		return accountInfoDAO.findByPhone(phone);
+	}
+
+	@Override
+	public AccountInfo findByOpenId(String openId) {
+		return accountInfoDAO.findByOpenId(openId);
+	}
+}

+ 75 - 0
common/src/main/java/com/jpsoft/bus/modules/merchant/service/impl/CapitalInfoServiceImpl.java

@@ -0,0 +1,75 @@
+package com.jpsoft.bus.modules.merchant.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.bus.modules.merchant.dao.CapitalInfoDAO;
+import com.jpsoft.bus.modules.merchant.entity.CapitalInfo;
+import com.jpsoft.bus.modules.merchant.service.CapitalInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="capitalInfoService")
+public class CapitalInfoServiceImpl implements CapitalInfoService {
+	@Resource(name="capitalInfoDAO")
+	private CapitalInfoDAO capitalInfoDAO;
+
+	@Override
+	public CapitalInfo get(String id) {
+		// TODO Auto-generated method stub
+		return capitalInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(CapitalInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return capitalInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(CapitalInfo model) {
+		// TODO Auto-generated method stub
+		return capitalInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return capitalInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = capitalInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<CapitalInfo> list() {
+		// TODO Auto-generated method stub
+		return capitalInfoDAO.list();
+	}
+		
+	@Override
+	public Page<CapitalInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<CapitalInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            capitalInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+
+	@Override
+	public CapitalInfo findByMerchantId(String merchantId){
+		return capitalInfoDAO.findByMerchantId(merchantId);
+	}
+}

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

@@ -0,0 +1,80 @@
+package com.jpsoft.bus.modules.merchant.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.bus.modules.merchant.dao.WithdrawalRecordDAO;
+import com.jpsoft.bus.modules.merchant.entity.WithdrawalRecord;
+import com.jpsoft.bus.modules.merchant.service.WithdrawalRecordService;
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="withdrawalRecordService")
+public class WithdrawalRecordServiceImpl implements WithdrawalRecordService {
+	@Resource(name="withdrawalRecordDAO")
+	private WithdrawalRecordDAO withdrawalRecordDAO;
+
+	@Override
+	public WithdrawalRecord get(String id) {
+		// TODO Auto-generated method stub
+		return withdrawalRecordDAO.get(id);
+	}
+
+	@Override
+	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);
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return withdrawalRecordDAO.delete(id);
+	}
+
+	@Override
+	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);
+	}
+}

+ 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 },

+ 104 - 1
common/src/main/resources/mapper/base/OrderInfo.xml

@@ -27,6 +27,7 @@
 			<result property="mergeOrderId" column="merge_order_id"/>
 			<result property="ticketUpStationId" column="ticket_up_station_id"/>
 			<result property="ticketDownStationId" column="ticket_down_station_id"/>
+			<result property="settlementFlag" column="settlement_flag"/>
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.bus.modules.base.entity.OrderInfo">
 	<!--
@@ -36,7 +37,7 @@
 	-->
 	<![CDATA[
 		insert into base_order_info
-	    (id_,total_fee,body_,pay_status,pay_name,pay_fee,refund_fee,pay_time,out_order_no,transaction_id,open_id,payment_id,create_by,create_time,update_by,update_time,del_flag,passenger_id,ticket_type,goods_ticket,merge_order_id,ticket_up_station_id,ticket_down_station_id)
+	    (id_,total_fee,body_,pay_status,pay_name,pay_fee,refund_fee,pay_time,out_order_no,transaction_id,open_id,payment_id,create_by,create_time,update_by,update_time,del_flag,passenger_id,ticket_type,goods_ticket,merge_order_id,ticket_up_station_id,ticket_down_station_id,settlement_flag)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -62,6 +63,7 @@
 ,#{mergeOrderId,jdbcType=VARCHAR}
 ,#{ticketUpStationId,jdbcType=VARCHAR}
 ,#{ticketDownStationId,jdbcType=VARCHAR}
+,#{settlementFlag,jdbcType=NUMERIC}
 		)
 	]]>
 	</insert>
@@ -137,6 +139,9 @@
 			<if test="ticketDownStationId != null">
 				ticket_down_station_id = #{ticketDownStationId,jdbcType=VARCHAR},
 			</if>
+			<if test="settlementFlag != null">
+				settlement_flag = #{settlementFlag,jdbcType=NUMERIC}
+			</if>
 		</set>
 	where id_=#{id}
 	</update>
@@ -168,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>
@@ -186,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}
@@ -206,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}
@@ -246,4 +272,81 @@
 		and merge_order_id = #{mergeOrderId}
 		]]>
 	</select>
+
+	<select id="paySum" resultType="java.math.BigDecimal">
+		<![CDATA[
+		select SUM(a.pay_fee) from base_order_info a
+		left join base_merge_order_info b on a.merge_order_id = b.id_
+		left join bus_shift_info c on b.vehicle_shift_id = c.id_
+		]]>
+		<where>
+			a.del_flag = 0
+			and a.pay_status = 20
+			<if test="payName != null and payName != ''">
+				and a.pay_name = #{payName}
+			</if>
+			<if test="vehicleInfoList!= null">
+				<foreach item="item" collection="vehicleInfoList" open="and c.vehicle_id in (" separator="," close=")">
+					#{item.id}
+				</foreach>
+			</if>
+			<if test="beginOfDay != null">
+				<![CDATA[
+			and	a.pay_time >= #{beginOfDay}
+				]]>
+			</if>
+			<if test="endOfDay != null">
+				<![CDATA[
+			and	a.pay_time < #{endOfDay}
+				]]>
+			</if>
+			<if test="settlementFlag != null">
+			and	a.settlement_flag = #{settlementFlag}
+			</if>
+			<if test="companyId != null">
+				and b.company_id = #{companyId}
+			</if>
+		</where>
+	</select>
+
+	<select id="payNum" resultType="Integer">
+		<![CDATA[
+		select count(a.id_) from base_order_info a
+		left join base_merge_order_info b on a.merge_order_id = b.id_
+		left join bus_shift_info c on b.vehicle_shift_id = c.id_
+		]]>
+		<where>
+			a.del_flag = 0
+			and a.pay_status = 20
+			<if test="payName != null">
+				and a.pay_name = #{payName}
+			</if>
+			<if test="vehicleInfoList!= null">
+				<foreach item="item" collection="vehicleInfoList" open="and c.vehicle_id in (" separator="," close=")">
+					#{item.id}
+				</foreach>
+			</if>
+			<if test="beginOfDay != null">
+				<![CDATA[
+			and	a.pay_time >= #{beginOfDay}
+				]]>
+			</if>
+			<if test="endOfDay != null">
+				<![CDATA[
+			and	a.pay_time < #{endOfDay}
+				]]>
+			</if>
+			<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}

+ 14 - 0
common/src/main/resources/mapper/bus/VehicleInfo.xml

@@ -199,4 +199,18 @@
 		</set>
 		where id_=#{id}
 	</update>
+
+	<select id="findByCarNum" resultMap="VehicleInfoMap">
+		select * from bus_vehicle_info where del_flag=0 and license_plate_number=#{carNum}
+		order by create_time desc limit 1
+	</select>
+
+	<select id="findByCompanyId" resultMap="VehicleInfoMap">
+		<![CDATA[
+		select * from bus_vehicle_info
+		where del_flag = 0
+		and company_id = #{companyId}
+		]]>
+	</select>
+
 </mapper>

+ 167 - 0
common/src/main/resources/mapper/merchant/AccountInfo.xml

@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!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.AccountInfoDAO">
+	<resultMap id="AccountInfoMap" type="com.jpsoft.bus.modules.merchant.entity.AccountInfo">
+		<id property="id" column="id_" />
+			<result property="name" column="name_" />
+			<result property="companyId" column="company_id" />
+			<result property="openId" column="open_id" />
+			<result property="phone" column="phone_" />
+			<result property="withdrawAllow" column="withdraw_allow" />
+			<result property="frozen" column="frozen_" />
+			<result property="imageUrl" column="image_url" />
+			<result property="bankName" column="bank_name" />
+			<result property="bankNumber" column="bank_number" />
+			<result property="createBy" column="create_by" />
+			<result property="createTime" column="create_time" />
+			<result property="updateBy" column="update_by" />
+			<result property="updateTime" column="update_time" />
+			<result property="delFlag" column="del_flag" />
+			<result property="companyName" column="company_name" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.bus.modules.merchant.entity.AccountInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into merchant_account_info
+	    (id_,name_,company_id,open_id,phone_,withdraw_allow,frozen_,image_url,bank_name,bank_number,create_by,create_time,update_by,update_time,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{name,jdbcType=VARCHAR}
+,#{companyId,jdbcType=VARCHAR}
+,#{openId,jdbcType=VARCHAR}
+,#{phone,jdbcType=VARCHAR}
+,#{withdrawAllow,jdbcType= NUMERIC }
+,#{frozen,jdbcType= NUMERIC }
+,#{imageUrl,jdbcType=VARCHAR}
+,#{bankName,jdbcType=VARCHAR}
+,#{bankNumber,jdbcType=VARCHAR}
+,#{createBy,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{delFlag,jdbcType= NUMERIC }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from merchant_account_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.bus.modules.merchant.entity.AccountInfo">
+		update merchant_account_info
+		<set>
+				<if test="name!=null">
+		name_=#{name,jdbcType=VARCHAR},
+		</if>
+				<if test="companyId!=null">
+		company_id=#{companyId,jdbcType=VARCHAR},
+		</if>
+				<if test="openId!=null">
+		open_id=#{openId,jdbcType=VARCHAR},
+		</if>
+				<if test="phone!=null">
+		phone_=#{phone,jdbcType=VARCHAR},
+		</if>
+				<if test="withdrawAllow!=null">
+		withdraw_allow=#{withdrawAllow,jdbcType= NUMERIC },
+		</if>
+				<if test="frozen!=null">
+		frozen_=#{frozen,jdbcType= NUMERIC },
+		</if>
+				<if test="imageUrl!=null">
+		image_url=#{imageUrl,jdbcType=VARCHAR},
+		</if>
+				<if test="bankName!=null">
+		bank_name=#{bankName,jdbcType=VARCHAR},
+		</if>
+				<if test="bankNumber!=null">
+		bank_number=#{bankNumber,jdbcType=VARCHAR},
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="AccountInfoMap">
+		SELECT
+		a.*,
+		b.name_ AS company_name
+		FROM
+		merchant_account_info a
+		LEFT JOIN bus_company_info b ON a.company_id = b.id_
+		where a.id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from merchant_account_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="AccountInfoMap">
+		select * from merchant_account_info
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="AccountInfoMap">
+		<![CDATA[
+			SELECT
+				a.*,
+				b.name_ AS company_name
+			FROM
+				merchant_account_info a
+				LEFT JOIN bus_company_info b ON b.id_ = a.company_id
+		]]>
+		<where>
+			a.del_flag = 0
+			<if test="searchParams.id != null">
+				and a.ID_ like #{searchParams.id}
+			</if>
+			<if test="searchParams.companyCode != null">
+				and b.code_ like #{searchParams.companyCode}
+			</if>
+			<if test="searchParams.name != null">
+				and a.name_ like #{searchParams.name}
+			</if>
+			<if test="searchParams.phone != null">
+				and a.phone_ like #{searchParams.phone}
+			</if>
+			<if test="searchParams.frozen != null">
+				and a.frozen_ = #{searchParams.frozen}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+
+	<select id="findByPhone" resultMap="AccountInfoMap">
+		<![CDATA[
+		select  * from merchant_account_info
+		where del_flag = 0
+		and phone_ = #{phone}
+		]]>
+	</select>
+
+	<select id="findByOpenId" resultMap="AccountInfoMap">
+		<![CDATA[
+		select * from merchant_account_info
+		where del_flag = 0
+		and open_id = #{openId}
+		limit 1
+		]]>
+	</select>
+</mapper>

+ 117 - 0
common/src/main/resources/mapper/merchant/CapitalInfo.xml

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!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.CapitalInfoDAO">
+	<resultMap id="CapitalInfoMap" type="com.jpsoft.bus.modules.merchant.entity.CapitalInfo">
+		<id property="id" column="id_" />
+			<result property="merchantId" column="merchant_id" />
+			<result property="withdrawalAmount" column="withdrawal_amount" />
+			<result property="alreadyWithdrawalAmount" column="already_withdrawal_amount" />
+			<result property="totalRevenue" column="total_revenue" />
+			<result property="onlineTotalRevenue" column="online_total_revenue"/>
+			<result property="createBy" column="create_by" />
+			<result property="createTime" column="create_time" />
+			<result property="updateBy" column="update_by" />
+			<result property="updateTime" column="update_time" />
+			<result property="delFlag" column="del_flag" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.bus.modules.merchant.entity.CapitalInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into merchant_capital_info
+	    (id_,merchant_id,withdrawal_amount,already_withdrawal_amount,total_revenue,online_total_revenue,create_by,create_time,update_by,update_time,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{merchantId,jdbcType=VARCHAR}
+,#{withdrawalAmount,jdbcType= NUMERIC }
+,#{alreadyWithdrawalAmount,jdbcType= NUMERIC }
+,#{totalRevenue,jdbcType= NUMERIC }
+,#{onlineTotalRevenue,jdbcType=NUMERIC}
+,#{createBy,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{delFlag,jdbcType= NUMERIC }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from merchant_capital_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.bus.modules.merchant.entity.CapitalInfo">
+		update merchant_capital_info
+		<set>
+				<if test="merchantId!=null">
+		merchant_id=#{merchantId,jdbcType=VARCHAR},
+		</if>
+				<if test="withdrawalAmount!=null">
+		withdrawal_amount=#{withdrawalAmount,jdbcType= NUMERIC },
+		</if>
+				<if test="alreadyWithdrawalAmount!=null">
+		already_withdrawal_amount=#{alreadyWithdrawalAmount,jdbcType= NUMERIC },
+		</if>
+				<if test="totalRevenue!=null">
+		total_revenue=#{totalRevenue,jdbcType= NUMERIC },
+		</if>
+			<if test="onlineTotalRevenue!=null">
+				online_total_revenue=#{onlineTotalRevenue,jdbcType= NUMERIC },
+			</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="CapitalInfoMap">
+		select *	from merchant_capital_info where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from merchant_capital_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="CapitalInfoMap">
+		select * from merchant_capital_info
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="CapitalInfoMap">
+		<![CDATA[
+			select * from merchant_capital_info
+		]]>
+		<where>
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+	<select id="findByMerchantId" parameterType="string" resultMap="CapitalInfoMap">
+		<![CDATA[
+		SELECT
+			*
+			FROM
+			merchant_capital_info
+		WHERE
+			del_flag = 0
+			AND merchant_id = #{merchantId}
+		limit 1
+		]]>
+	</select>
+</mapper>

+ 165 - 0
common/src/main/resources/mapper/merchant/WithdrawalRecord.xml

@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!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">
+	<resultMap id="WithdrawalRecordMap" type="com.jpsoft.bus.modules.merchant.entity.WithdrawalRecord">
+		<id property="id" column="id_" />
+			<result property="merchantId" column="merchant_id" />
+			<result property="applyWithdrawalAmount" column="apply_withdrawal_amount" />
+			<result property="applyTime" column="apply_time" />
+			<result property="status" column="status_" />
+			<result property="examineTime" column="examine_time" />
+			<result property="examineBy" column="examine_by" />
+			<result property="remark" column="remark_" />
+			<result property="withdrawalNo" column="withdrawal_no" />
+			<result property="createBy" column="create_by" />
+			<result property="createTime" column="create_time" />
+			<result property="updateBy" column="update_by" />
+			<result property="updateTime" column="update_time" />
+			<result property="delFlag" column="del_flag" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.bus.modules.merchant.entity.WithdrawalRecord">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into merchant_withdrawal_record
+	    (id_,merchant_id,apply_withdrawal_amount,apply_time,status_,examine_time,examine_by,remark_,withdrawal_no,create_by,create_time,update_by,update_time,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{merchantId,jdbcType=VARCHAR}
+,#{applyWithdrawalAmount,jdbcType= NUMERIC }
+,#{applyTime,jdbcType= TIMESTAMP }
+,#{status,jdbcType=VARCHAR}
+,#{examineTime,jdbcType= TIMESTAMP }
+,#{examineBy,jdbcType=VARCHAR}
+,#{remark,jdbcType=VARCHAR}
+,#{withdrawalNo,jdbcType=VARCHAR}
+,#{createBy,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{delFlag,jdbcType= NUMERIC }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from merchant_withdrawal_record where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.bus.modules.merchant.entity.WithdrawalRecord">
+		update merchant_withdrawal_record
+		<set>
+				<if test="merchantId!=null">
+		merchant_id=#{merchantId,jdbcType=VARCHAR},
+		</if>
+				<if test="applyWithdrawalAmount!=null">
+		apply_withdrawal_amount=#{applyWithdrawalAmount,jdbcType= NUMERIC },
+		</if>
+				<if test="applyTime!=null">
+		apply_time=#{applyTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="status!=null">
+		status_=#{status,jdbcType=VARCHAR},
+		</if>
+				<if test="examineTime!=null">
+		examine_time=#{examineTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="examineBy!=null">
+		examine_by=#{examineBy,jdbcType=VARCHAR},
+		</if>
+				<if test="remark!=null">
+		remark_=#{remark,jdbcType=VARCHAR},
+		</if>
+				<if test="withdrawalNo!=null">
+		withdrawal_no=#{withdrawalNo,jdbcType=VARCHAR},
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="WithdrawalRecordMap">
+		select * from merchant_withdrawal_record where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from merchant_withdrawal_record where id_=#{0}
+	</select>
+	<select id="list" resultMap="WithdrawalRecordMap">
+		select * from merchant_withdrawal_record
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="WithdrawalRecordMap">
+		<![CDATA[
+			SELECT
+				a.*
+			FROM
+				merchant_withdrawal_record a
+				LEFT JOIN merchant_account_info b ON a.merchant_id = b.id_
+				LEFT JOIN bus_company_info c ON b.company_id = c.id_
+		]]>
+		<where>
+			a.del_flag = 0
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+			<if test="searchParams.companyCode != null">
+				and c.code_ like #{searchParams.companyCode}
+			</if>
+			<if test="searchParams.name != null">
+				and b.name_ like #{searchParams.name}
+			</if>
+			<if test="searchParams.phone != null">
+				and b.phone_ like #{searchParams.phone}
+			</if>
+			<if test="searchParams.status != null">
+				and a.status_ = #{searchParams.status}
+			</if>
+			<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}
+	 	</foreach>
+	</select>
+	<select id="findByMerchantId" parameterType="string" resultMap="WithdrawalRecordMap">
+		<![CDATA[
+		SELECT
+			*
+			FROM
+			merchant_withdrawal_record
+		WHERE
+			del_flag = 0
+			AND merchant_id = #{merchantId}
+		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
common/src/main/resources/mapper/sys/SysLog.xml

@@ -58,7 +58,7 @@
         </set>
         where id_=#{id}
     </update>
-    <select id="get" parameterType="string" resultMap="SysLogMap">
+    <select id="get" parameterType="Long" resultMap="SysLogMap">
         select * from sys_log where id_=#{0}
     </select>
     <select id="exist" parameterType="string" resultType="int">

+ 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();
                     }
                 }

+ 3 - 1
web/src/main/java/com/jpsoft/bus/config/RabbitmqConfig.java

@@ -13,5 +13,7 @@ import java.util.Map;
 @Configuration
 public class RabbitmqConfig {
     @Bean
-    public Queue StationRemindQueue() {return new Queue("stationRemindQueue", true);}
+    public Queue StationRemindQueue() {
+        return new Queue("stationRemindQueue", true);
+    }
 }

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

@@ -90,6 +90,9 @@ public class WebMvcConfig implements WebMvcConfigurer {
 				.excludePathPatterns("/mobile/passengerApi/passengerShiftRemindList")
 				.excludePathPatterns("/mobile/passengerApi/helpCenterList")
 				.excludePathPatterns("/mobile/passengerApi/vehicleStationDis")
+				.excludePathPatterns("/mobile/merchantApi/getVerifyCode")
+				.excludePathPatterns("/mobile/merchantApi/validateCode")
+				.excludePathPatterns("/mobile/merchantApi/findByOpenId")
 
 
 		;

+ 30 - 0
web/src/main/java/com/jpsoft/bus/listener/WeixinListener.java

@@ -0,0 +1,30 @@
+package com.jpsoft.bus.listener;
+
+import com.jpsoft.bus.modules.common.utils.WeixinUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+@Slf4j
+@WebListener
+@Component
+@Profile({"dev","test","production"})
+public class WeixinListener implements ServletContextListener {
+    @Value("${wx.commonAccessTokenUrl}")
+    private String commonAccessTokenUrl;
+
+    @Override
+    public void contextInitialized(ServletContextEvent arg0) {
+        WeixinUtil.access_token_url = commonAccessTokenUrl + "?grant_type=client_credential&appid=APPID&secret=APPSECRET";
+    }
+
+    @Override
+    public void contextDestroyed(ServletContextEvent arg0) {
+
+    }
+}

+ 2 - 2
web/src/main/java/com/jpsoft/bus/modules/bus/controller/PriceInfoController.java

@@ -281,7 +281,7 @@ public class PriceInfoController {
                 for(StationInfo startSi : stationInfoList){
                     Map<String,Object> priceMap = new HashMap<>();
                     PriceInfo priceInfo = priceInfoService.findByStartStationAndEndStation(startSi.getId(),endSi.getId());
-                    String priceStr = "";
+                    String priceStr = "0";
                     //BigDecimal price = new BigDecimal(0);
                     if(priceInfo != null){
                         priceStr = priceInfo.getPrice().toString();
@@ -498,7 +498,7 @@ public class PriceInfoController {
                     PriceInfo priceInfo = priceInfoService.findByStartStationAndEndStation(startStation.getId(),endStation.getId());
 
                     XSSFCell cellContent2 = rowContent.createCell(j+1);
-                    String priceStr = "";
+                    String priceStr = "0";
                     if(priceInfo != null) {
                         priceStr = priceInfo.getPrice().toString();
                     }

+ 65 - 0
web/src/main/java/com/jpsoft/bus/modules/bus/controller/VehicleInfoController.java

@@ -13,10 +13,13 @@ import com.jpsoft.bus.modules.bus.service.VehicleInfoService;
 import com.jpsoft.bus.modules.common.utils.OSSUtil;
 import com.jpsoft.bus.modules.common.utils.POIUtils;
 import com.jpsoft.bus.modules.common.utils.PojoUtils;
+import com.jpsoft.bus.modules.sys.entity.SysLog;
+import com.jpsoft.bus.modules.sys.service.SysLogService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
@@ -39,6 +42,7 @@ import java.util.*;
 @RestController
 @RequestMapping("/bus/vehicleInfo")
 @Api(description = "vehicleInfo")
+@Slf4j
 public class VehicleInfoController {
     private Logger logger = LoggerFactory.getLogger(getClass());
 
@@ -54,6 +58,9 @@ public class VehicleInfoController {
     @Autowired
     private GpsDataInfoService gpsDataInfoService;
 
+    @Autowired
+    private SysLogService sysLogService;
+
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
     public MessageResult<VehicleInfo> create(){
@@ -408,4 +415,62 @@ public class VehicleInfoController {
 
         return messageResult;
     }
+
+    @ApiOperation(value="车辆信息一键绑定")
+    @RequestMapping(value = "bindBus",method = RequestMethod.POST)
+    public MessageResult<Map> bindBus(
+            @RequestParam(value="logId",defaultValue="") String logId,
+            @RequestAttribute String subject)throws Exception{
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+        try {
+
+            if (StringUtils.isEmpty(logId)) {
+                throw new Exception("未查到日志信息");
+            }
+
+            SysLog sysLog = sysLogService.get(Long.valueOf(logId));
+
+            if (sysLog == null) {
+                throw new Exception("未查到日志信息");
+            }
+
+
+            String sysData = sysLog.getData();
+            String[] data = sysData.split(",");
+            if (data.length > 2) {
+                //车牌号
+                String carNum = data[0];
+                //平板设备编号
+                String activationCode = data[1];
+                //设备编号
+                String deviceNo = data[2];
+                VehicleInfo vehicleInfo = vehicleInfoService.findByCarNum(carNum);
+                if (vehicleInfo == null) {
+                    throw new Exception("未查到车辆信息");
+                }
+
+                vehicleInfo.setActivationCode(activationCode);
+                vehicleInfo.setDeviceNo(deviceNo);
+                vehicleInfo.setUpdateBy(subject);
+                vehicleInfo.setUpdateTime(new Date());
+
+                vehicleInfoService.update(vehicleInfo);
+                msgResult.setResult(true);
+                msgResult.setMessage("绑定成功");
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("绑定失败");
+            }
+        } catch (Exception ex) {
+            log.error(ex.getMessage());
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }

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

@@ -18,10 +18,9 @@ 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.CommonUtil;
-import com.jpsoft.bus.modules.common.utils.JwtUtil;
-import com.jpsoft.bus.modules.common.utils.OSSUtil;
-import com.jpsoft.bus.modules.common.utils.PojoUtils;
+import com.jpsoft.bus.modules.common.utils.*;
+import com.jpsoft.bus.modules.sys.entity.SysLog;
+import com.jpsoft.bus.modules.sys.service.SysLogService;
 import com.jpsoft.gps.callback.GpsDataCallback;
 import io.swagger.annotations.*;
 import lombok.extern.slf4j.Slf4j;
@@ -34,6 +33,7 @@ import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -103,23 +103,45 @@ public class DriverApiController {
     @Autowired
     private GpsDataCallback gpsDataCallback;
 
+    @Autowired
+    private SysLogService logService;
+
     @PostMapping("carActivation")
     @ApiOperation(value = "司机端激活")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "activationCode", value = "激活码", required = true, paramType = "query"),
-            @ApiImplicitParam(name = "carNum", value = "车牌号", required = true, paramType = "form")
+        @ApiImplicitParam(name = "licensePlateNumber", value = "车牌号", required = true, paramType = "form"),
+        @ApiImplicitParam(name = "padSerialNumber", value = "平板序列号", required = true, paramType = "form"),
+        @ApiImplicitParam(name = "pacsSerialNumber", value = "门禁设备序列号", required = true, paramType = "form")
     })
-    public MessageResult<Map> carActivation(String activationCode,String carNum){
-
+    public MessageResult<Map> carActivation(String licensePlateNumber, String padSerialNumber, String pacsSerialNumber, HttpServletRequest request){
         MessageResult<Map> messageResult = new MessageResult<>();
+
         try{
-            VehicleInfo vehicleInfo = vehicleInfoService.findByCodeAndCarNum(activationCode,carNum);
+            VehicleInfo vehicleInfo = vehicleInfoService.findByCodeAndCarNum(padSerialNumber,licensePlateNumber);
+
             if (vehicleInfo == null){
-                throw new Exception("车牌号或激活码错误");
+                SysLog sysLog = new SysLog();
+                sysLog.setPointcut("车辆激活");
+                sysLog.setData(licensePlateNumber + "," + padSerialNumber + "," + pacsSerialNumber);
+                sysLog.setRemark("车牌号与当前平板未绑定!");
+                sysLog.setRemoteIp(HttpUtil.getIpAddress(request));
+                sysLog.setCreateTime(new Date());
+                logService.insert(sysLog);
+
+                throw new Exception(sysLog.getRemark());
+            }
+            else if(!pacsSerialNumber.equals(vehicleInfo.getDeviceNo())){
+                SysLog sysLog = new SysLog();
+                sysLog.setPointcut("车辆激活");
+                sysLog.setData(licensePlateNumber + "," + padSerialNumber + "," + pacsSerialNumber);
+                sysLog.setRemark("车牌号与当前打卡设备未绑定!");
+                sysLog.setRemoteIp(HttpUtil.getIpAddress(request));
+                sysLog.setCreateTime(new Date());
+                logService.insert(sysLog);
+
+                throw new Exception(sysLog.getRemark());
             }
-            /*if ("1".equals(vehicleInfo.getStatus())){
-                throw new Exception("此车辆已被激活");
-            }*/
+
             vehicleInfo.setStatus("1");
             vehicleInfoService.update(vehicleInfo);
 
@@ -1080,7 +1102,8 @@ public class DriverApiController {
             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);

+ 293 - 0
web/src/main/java/com/jpsoft/bus/modules/merchant/controller/AccountInfoController.java

@@ -0,0 +1,293 @@
+package com.jpsoft.bus.modules.merchant.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.bus.entity.CompanyInfo;
+import com.jpsoft.bus.modules.bus.service.CompanyInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.jpsoft.bus.modules.common.utils.PojoUtils;
+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 com.jpsoft.bus.modules.sys.entity.User;
+import com.jpsoft.bus.modules.sys.service.UserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+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.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/merchant/accountInfo")
+@Api(description = "商户")
+public class AccountInfoController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private AccountInfoService accountInfoService;
+    @Autowired
+    private CompanyInfoService companyInfoService;
+    @Autowired
+    private UserService userService;
+    @Autowired
+    private CapitalInfoService capitalInfoService;
+
+    @ApiOperation(value="创建空记录")
+    @GetMapping("create")
+    public MessageResult<AccountInfo> create(){
+        MessageResult<AccountInfo> msgResult = new MessageResult<>();
+
+        AccountInfo accountInfo = new AccountInfo();
+
+        msgResult.setData(accountInfo);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+    
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    public MessageResult<AccountInfo> add(@RequestBody AccountInfo accountInfo,@RequestAttribute String subject){
+        MessageResult<AccountInfo> msgResult = new MessageResult<>();
+
+        try {
+            accountInfo.setId(UUID.randomUUID().toString());
+            accountInfo.setDelFlag(false);
+            accountInfo.setCreateBy(subject);
+            accountInfo.setCreateTime(new Date());
+            
+            int affectCount = accountInfoService.insert(accountInfo);
+
+            if (affectCount > 0) {
+                CapitalInfo ci = capitalInfoService.findByMerchantId(accountInfo.getId());
+                if(ci == null) {
+                    ci = new CapitalInfo();
+                    ci.setId(UUID.randomUUID().toString());
+                    ci.setMerchantId(accountInfo.getId());
+                    ci.setAlreadyWithdrawalAmount(new BigDecimal(0));
+                    ci.setOnlineTotalRevenue(new BigDecimal(0));
+                    ci.setTotalRevenue(new BigDecimal(0));
+                    ci.setWithdrawalAmount(new BigDecimal(0));
+
+                    ci.setDelFlag(false);
+                    ci.setCreateBy(subject);
+                    ci.setCreateTime(new Date());
+                    capitalInfoService.insert(ci);
+                }
+                msgResult.setResult(true);
+                msgResult.setData(accountInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<AccountInfo> edit(@PathVariable("id") String id){
+        MessageResult<AccountInfo> msgResult = new MessageResult<>();
+
+        try {
+            AccountInfo accountInfo = accountInfoService.get(id);
+
+            if (accountInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(accountInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="更新用户")
+    @PostMapping("update")
+    public MessageResult<AccountInfo> update(@RequestBody AccountInfo accountInfo,@RequestAttribute String subject){
+        MessageResult<AccountInfo> msgResult = new MessageResult<>();
+
+        try {
+            accountInfo.setUpdateBy(subject);
+            accountInfo.setUpdateTime(new Date());
+            
+            int affectCount = accountInfoService.update(accountInfo);
+
+            if (affectCount > 0) {
+                CapitalInfo ci = capitalInfoService.findByMerchantId(accountInfo.getId());
+                if(ci == null) {
+                    ci = new CapitalInfo();
+                    ci.setId(UUID.randomUUID().toString());
+                    ci.setMerchantId(accountInfo.getId());
+                    ci.setAlreadyWithdrawalAmount(new BigDecimal(0));
+                    ci.setOnlineTotalRevenue(new BigDecimal(0));
+                    ci.setTotalRevenue(new BigDecimal(0));
+                    ci.setWithdrawalAmount(new BigDecimal(0));
+
+                    ci.setDelFlag(false);
+                    ci.setCreateBy(subject);
+                    ci.setCreateTime(new Date());
+                    capitalInfoService.insert(ci);
+                }
+                msgResult.setResult(true);
+                msgResult.setData(accountInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+	@ApiOperation(value="删除")
+    @PostMapping("delete/{id}")
+    public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            AccountInfo accountInfo = accountInfoService.get(id);
+            accountInfo.setDelFlag(true);
+            accountInfo.setUpdateBy(subject);
+            accountInfo.setUpdateTime(new Date());
+
+            int affectCount = accountInfoService.update(accountInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                AccountInfo accountInfo = accountInfoService.get(id);
+                accountInfo.setDelFlag(true);
+                accountInfo.setUpdateBy(subject);
+                accountInfo.setUpdateTime(new Date());
+
+                affectCount += accountInfoService.update(accountInfo);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String id,
+            @RequestParam(value="name",defaultValue="") String name,
+            @RequestParam(value="companyId",defaultValue="") String companyId,
+            @RequestParam(value="phone",defaultValue="") String phone,
+            @RequestParam(value="frozen",defaultValue="") String frozen,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestAttribute String subject){
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("b.sort_no","asc"));
+        sortList.add(new Sort("a.create_time","asc"));
+
+        if (StringUtils.isNotEmpty(id)) {
+            searchParams.put("id","%" + id + "%");
+        }
+
+        if (StringUtils.isNotEmpty(name)) {
+            searchParams.put("name","%" + name + "%");
+        }
+        if (StringUtils.isNotEmpty(phone)) {
+            searchParams.put("phone","%" + phone + "%");
+        }
+        if (StringUtils.isNotEmpty(frozen)) {
+            searchParams.put("frozen",frozen);
+        }
+        if (StringUtils.isNotEmpty(companyId)) {
+            CompanyInfo companyInfo = companyInfoService.get(companyId);
+            searchParams.put("companyCode",companyInfo.getCode() + "%");
+        }else{
+            if (!userService.hasRole(subject, "SYSADMIN")) {
+                User user = userService.get(subject);
+                CompanyInfo companyInfo = companyInfoService.get(user.getCompanyId());
+                searchParams.put("companyCode", companyInfo.getCode() + "%");
+            }
+        }
+
+        Page<AccountInfo> page = accountInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+}

+ 225 - 0
web/src/main/java/com/jpsoft/bus/modules/merchant/controller/CapitalInfoController.java

@@ -0,0 +1,225 @@
+package com.jpsoft.bus.modules.merchant.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.jpsoft.bus.modules.common.utils.PojoUtils;
+import com.jpsoft.bus.modules.merchant.entity.CapitalInfo;
+import com.jpsoft.bus.modules.merchant.service.CapitalInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+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.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/merchant/capitalInfo")
+@Api(description = "商户钱包")
+public class CapitalInfoController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private CapitalInfoService capitalInfoService;
+
+    @ApiOperation(value="创建空记录")
+    @GetMapping("create")
+    public MessageResult<CapitalInfo> create(){
+        MessageResult<CapitalInfo> msgResult = new MessageResult<>();
+
+        CapitalInfo capitalInfo = new CapitalInfo();
+
+        msgResult.setData(capitalInfo);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+    
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    public MessageResult<CapitalInfo> add(@RequestBody CapitalInfo capitalInfo,@RequestAttribute String subject){
+        MessageResult<CapitalInfo> msgResult = new MessageResult<>();
+
+        try {
+            capitalInfo.setId(UUID.randomUUID().toString());
+            capitalInfo.setDelFlag(false);
+            capitalInfo.setCreateBy(subject);
+            capitalInfo.setCreateTime(new Date());
+            
+            int affectCount = capitalInfoService.insert(capitalInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(capitalInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<CapitalInfo> edit(@PathVariable("id") String id){
+        MessageResult<CapitalInfo> msgResult = new MessageResult<>();
+
+        try {
+            CapitalInfo capitalInfo = capitalInfoService.get(id);
+
+            if (capitalInfo != null) {
+                msgResult.setResult(true);
+                msgResult.setData(capitalInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="更新用户")
+    @PostMapping("update")
+    public MessageResult<CapitalInfo> update(@RequestBody CapitalInfo capitalInfo,@RequestAttribute String subject){
+        MessageResult<CapitalInfo> msgResult = new MessageResult<>();
+
+        try {
+            capitalInfo.setUpdateBy(subject);
+            capitalInfo.setUpdateTime(new Date());
+            
+            int affectCount = capitalInfoService.update(capitalInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(capitalInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+	@ApiOperation(value="删除")
+    @PostMapping("delete/{id}")
+    public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            CapitalInfo capitalInfo = capitalInfoService.get(id);
+            capitalInfo.setDelFlag(true);
+            capitalInfo.setUpdateBy(subject);
+            capitalInfo.setUpdateTime(new Date());
+
+            int affectCount = capitalInfoService.update(capitalInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                CapitalInfo capitalInfo = capitalInfoService.get(id);
+                capitalInfo.setDelFlag(true);
+                capitalInfo.setUpdateBy(subject);
+                capitalInfo.setUpdateTime(new Date());
+
+                affectCount += capitalInfoService.update(capitalInfo);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String id,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestAttribute String subject){
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("id_","asc"));
+
+        if (StringUtils.isNotEmpty(id)) {
+            searchParams.put("id","%" + id + "%");
+        }
+
+        Page<CapitalInfo> page = capitalInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+}

+ 362 - 0
web/src/main/java/com/jpsoft/bus/modules/merchant/controller/WithdrawalRecordController.java

@@ -0,0 +1,362 @@
+package com.jpsoft.bus.modules.merchant.controller;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.bus.modules.bus.entity.CompanyInfo;
+import com.jpsoft.bus.modules.bus.service.CompanyInfoService;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import com.jpsoft.bus.modules.common.dto.Sort;
+import com.jpsoft.bus.modules.common.utils.PojoUtils;
+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.User;
+import com.jpsoft.bus.modules.sys.service.UserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+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.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/merchant/withdrawalRecord")
+@Api(description = "商户提现")
+public class WithdrawalRecordController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private WithdrawalRecordService withdrawalRecordService;
+    @Autowired
+    private AccountInfoService accountInfoService;
+    @Autowired
+    private CapitalInfoService capitalInfoService;
+    @Autowired
+    private CompanyInfoService companyInfoService;
+    @Autowired
+    private UserService userService;
+
+    @ApiOperation(value="创建空记录")
+    @GetMapping("create")
+    public MessageResult<WithdrawalRecord> create(){
+        MessageResult<WithdrawalRecord> msgResult = new MessageResult<>();
+
+        WithdrawalRecord withdrawalRecord = new WithdrawalRecord();
+
+        msgResult.setData(withdrawalRecord);
+        msgResult.setResult(true);
+
+        return msgResult;
+    }
+    
+    @ApiOperation(value="添加信息")
+    @PostMapping("add")
+    public MessageResult<WithdrawalRecord> add(@RequestBody WithdrawalRecord withdrawalRecord,@RequestAttribute String subject){
+        MessageResult<WithdrawalRecord> msgResult = new MessageResult<>();
+
+        try {
+            withdrawalRecord.setId(UUID.randomUUID().toString());
+            withdrawalRecord.setDelFlag(false);
+            withdrawalRecord.setCreateBy(subject);
+            withdrawalRecord.setCreateTime(new Date());
+            
+            int affectCount = withdrawalRecordService.insert(withdrawalRecord);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(withdrawalRecord);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="获取信息")
+    @GetMapping("edit/{id}")
+    public MessageResult<WithdrawalRecord> edit(@PathVariable("id") String id){
+        MessageResult<WithdrawalRecord> msgResult = new MessageResult<>();
+
+        try {
+            WithdrawalRecord withdrawalRecord = withdrawalRecordService.get(id);
+
+            if (withdrawalRecord != null) {
+                msgResult.setResult(true);
+                msgResult.setData(withdrawalRecord);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库不存在该记录!");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="更新用户")
+    @PostMapping("update")
+    public MessageResult<WithdrawalRecord> update(@RequestBody WithdrawalRecord withdrawalRecord,@RequestAttribute String subject){
+        MessageResult<WithdrawalRecord> msgResult = new MessageResult<>();
+
+        try {
+            withdrawalRecord.setUpdateBy(subject);
+            withdrawalRecord.setUpdateTime(new Date());
+            
+            int affectCount = withdrawalRecordService.update(withdrawalRecord);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(withdrawalRecord);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库更新失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+	@ApiOperation(value="删除")
+    @PostMapping("delete/{id}")
+    public MessageResult<Integer> delete(@PathVariable("id") String id,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            WithdrawalRecord withdrawalRecord = withdrawalRecordService.get(id);
+            withdrawalRecord.setDelFlag(true);
+            withdrawalRecord.setUpdateBy(subject);
+            withdrawalRecord.setUpdateTime(new Date());
+
+            int affectCount = withdrawalRecordService.update(withdrawalRecord);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value="批量删除")
+    @PostMapping("batchDelete")
+    public MessageResult<Integer> batchDelete(@RequestBody List<String> idList,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (String id : idList) {
+                WithdrawalRecord withdrawalRecord = withdrawalRecordService.get(id);
+                withdrawalRecord.setDelFlag(true);
+                withdrawalRecord.setUpdateBy(subject);
+                withdrawalRecord.setUpdateTime(new Date());
+
+                affectCount += withdrawalRecordService.update(withdrawalRecord);
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="列表")
+    @RequestMapping(value = "pageList",method = RequestMethod.POST)
+    public MessageResult<Map> pageList(
+            String id,
+            @RequestParam(value="name",defaultValue="") String name,
+            @RequestParam(value="companyId",defaultValue="") String companyId,
+            @RequestParam(value="phone",defaultValue="") String phone,
+            @RequestParam(value="status",defaultValue="") String status,
+            @RequestParam(value="withdrawalNo",defaultValue="") String withdrawalNo,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
+            @RequestAttribute String subject){
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("id_","asc"));
+
+        if (StringUtils.isNotEmpty(id)) {
+            searchParams.put("id","%" + id + "%");
+        }
+
+        if (StringUtils.isNotEmpty(name)) {
+            searchParams.put("name","%" + name + "%");
+        }
+        if (StringUtils.isNotEmpty(phone)) {
+            searchParams.put("phone","%" + phone + "%");
+        }
+        if (StringUtils.isNotEmpty(status)) {
+            searchParams.put("status",status);
+        }
+        if (StringUtils.isNotEmpty(withdrawalNo)) {
+            searchParams.put("withdrawalNo","%" + withdrawalNo + "%");
+        }
+
+        if (StringUtils.isNotEmpty(companyId)) {
+            CompanyInfo companyInfo = companyInfoService.get(companyId);
+            searchParams.put("companyCode",companyInfo.getCode() + "%");
+        }else{
+            if (!userService.hasRole(subject, "SYSADMIN")) {
+                User user = userService.get(subject);
+                CompanyInfo companyInfo = companyInfoService.get(user.getCompanyId());
+                searchParams.put("companyCode", companyInfo.getCode() + "%");
+            }
+        }
+
+        Page<WithdrawalRecord> page = withdrawalRecordService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+        for(WithdrawalRecord wr : page.getResult()){
+            AccountInfo ac = accountInfoService.get(wr.getMerchantId());
+            wr.setAccountInfo(ac);
+            CapitalInfo ci = capitalInfoService.findByMerchantId(wr.getMerchantId());
+            wr.setCapitalInfo(ci);
+        }
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
+
+    @ApiOperation(value="审核")
+    @RequestMapping(value = "approval",method = RequestMethod.POST)
+    public MessageResult<String> approval(
+            String id,String status,
+            @RequestAttribute String subject) throws Exception{
+
+        //当前用户ID
+        System.out.println(subject);
+
+        MessageResult<String> msgResult = new MessageResult<>();
+
+        try{
+
+            WithdrawalRecord wr = withdrawalRecordService.get(id);
+            if(wr == null){
+                throw new Exception("查无此项申请!");
+            }
+
+            AccountInfo ai = accountInfoService.get(wr.getMerchantId());
+            if(ai == null){
+                throw new Exception("查无此营收用户!");
+            }
+
+            CapitalInfo ci = capitalInfoService.findByMerchantId(wr.getMerchantId());
+            if(ci == null){
+                ci = new CapitalInfo();
+                ci.setId(UUID.randomUUID().toString());
+                ci.setMerchantId(wr.getMerchantId());
+                ci.setAlreadyWithdrawalAmount(new BigDecimal(0));
+                ci.setOnlineTotalRevenue(new BigDecimal(0));
+                ci.setTotalRevenue(new BigDecimal(0));
+                ci.setWithdrawalAmount(new BigDecimal(0));
+
+                ci.setDelFlag(false);
+                ci.setCreateBy(subject);
+                ci.setCreateTime(new Date());
+                capitalInfoService.insert(ci);
+
+                throw new Exception("该用户账户有误!");
+            }else{
+                if("1".equals(status)){
+                    //withdrawal_amount 可提现金额
+                    //already_withdrawal_amount 已提现金额
+                    BigDecimal withdrawalAmount = ci.getWithdrawalAmount();
+                    BigDecimal alreadyWithdrawalAmount = ci.getAlreadyWithdrawalAmount();
+                    //正在提现金额
+                    BigDecimal applyWithdrawalAmount = wr.getApplyWithdrawalAmount();
+
+                    if(withdrawalAmount.compareTo(applyWithdrawalAmount) < 0 ) {
+                        //小于
+                        throw new Exception("可提现金额不足");
+                    }else{
+                        BigDecimal newWithdrawalAmount =  withdrawalAmount.subtract(applyWithdrawalAmount);
+                        BigDecimal newAlreadyWithdrawalAmount =  alreadyWithdrawalAmount.add(applyWithdrawalAmount);
+
+                        ci.setWithdrawalAmount(newWithdrawalAmount);
+                        ci.setAlreadyWithdrawalAmount(newAlreadyWithdrawalAmount);
+                        ci.setUpdateBy(subject);
+                        ci.setUpdateTime(new Date());
+
+                        capitalInfoService.update(ci);
+                    }
+                }
+
+                wr.setStatus(status);
+                wr.setUpdateBy(subject);
+                wr.setUpdateTime(new Date());
+                wr.setExamineBy(subject);
+                wr.setExamineTime(new Date());
+                withdrawalRecordService.update(wr);
+            }
+
+            msgResult.setResult(true);
+            msgResult.setMessage("审核完成");
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+}

+ 929 - 0
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/MerchantApiController.java

@@ -0,0 +1,929 @@
+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.*;
+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;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
+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.*;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-5-7 11:05
+ */
+@RestController
+@RequestMapping("/mobile/merchantApi")
+@Api(value = "merchantApi")
+@Slf4j
+public class MerchantApiController {
+
+    @Value("${jwt.secret}")
+    private String jwtSecret;
+
+    @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;
+
+    @Autowired
+    private AccountInfoService accountInfoService;
+
+
+    @PostMapping("getVerifyCode")
+    @ApiOperation(value = "商户获取短信验证码(公开接口)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "phone", value = "电话", required = true, paramType = "form")
+    })
+    public MessageResult<String> getVerifyCode(String phone) {
+        MessageResult<String> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.findByPhone(phone);
+            if (accountInfo == null) {
+                throw new Exception("该号码还未注册营收管理员帐号");
+            }
+
+
+            String key = "SMS_" + phone;
+
+            String verifyCode = (String) redisTemplate.opsForValue().get(key);
+
+            if (StringUtils.isEmpty(verifyCode)) {
+                verifyCode = SMSUtil.generateNumberString(6);
+                JSONObject verifyCodeJSON = new JSONObject();
+                verifyCodeJSON.put("code", verifyCode);
+
+                messageResult = SMSUtil.send(phone, "车信达", "SMS_49390047", verifyCodeJSON.toString());
+
+                //设置当前用户的验证码,5分钟内有效
+                redisTemplate.opsForValue().set(key, verifyCode, 5, TimeUnit.MINUTES);
+            }
+
+            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("validateCode")
+    @ApiOperation(value = "验证短信验证码(公开接口)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "phone", value = "手机号", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "verifyCode", value = "验证码", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "openId", value = "微信openId", paramType = "form")
+    })
+    public MessageResult<Map> validateCode(String phone, String verifyCode, String openId) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+
+            AccountInfo accountInfo = accountInfoService.findByPhone(phone);
+            if (accountInfo == null) {
+                throw new Exception("该号码还未注册营收管理员帐号");
+            }
+            String smsKey = "SMS_" + phone;
+
+            String beforeVerifyCode = (String) redisTemplate.opsForValue().get(smsKey);
+
+            if (StringUtils.isBlank(openId)) {
+                throw new Exception("用户标识为空");
+            }
+
+            if (StringUtils.isEmpty(beforeVerifyCode)) {
+                throw new Exception("验证码已过期!");
+            }
+
+            if (!beforeVerifyCode.equals(verifyCode)) {
+                throw new Exception("验证码错误!");
+            }
+
+            accountInfo.setOpenId(openId);
+            accountInfoService.update(accountInfo);
+
+
+            String token = JwtUtil.createToken(jwtSecret, String.valueOf(accountInfo.getId()), DateTime.now().plusDays(30).toDate());
+
+            Map<String, Object> map = new HashMap<>();
+            map.put("token", token);
+
+            messageResult.setData(map);
+            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("findByOpenId")
+    @ApiOperation(value = "通过openId查询人员(公开接口)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "openId", value = "微信openId", required = true, paramType = "form")
+    })
+    public MessageResult<Map> findByOpenId(String openId) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+            if (StringUtils.isBlank(openId)) {
+                throw new Exception("获取微信信息有误");
+            }
+            AccountInfo accountInfo = accountInfoService.findByOpenId(openId);
+
+            String token = JwtUtil.createToken(jwtSecret, String.valueOf(accountInfo.getId()), DateTime.now().plusDays(30).toDate());
+
+            Map<String, Object> map = new HashMap<>();
+            map.put("token", token);
+
+            messageResult.setData(map);
+            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("revenueStatisticsUp")
+    @ApiOperation(value = "营收统计(上)")
+    public MessageResult<Map> revenueStatisticsUp(String token, @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+            CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
+            List<VehicleInfo> vehicleInfoList = vehicleInfoService.findByCompanyId(companyInfo.getId());
+            //今日收益
+            BigDecimal todayRevenue = BigDecimal.ZERO;
+            //昨日收益
+            BigDecimal yesterdayRevenue = BigDecimal.ZERO;
+            //累计收益
+            BigDecimal totalRevenue = BigDecimal.ZERO;
+
+            CapitalInfo capitalInfo = capitalInfoService.findByMerchantId(accountInfo.getId());
+            if (capitalInfo != null){
+                totalRevenue = capitalInfo.getTotalRevenue();
+            }
+
+      //      if (vehicleInfoList.size()>0){
+                //今日收益
+                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(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(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);
+            map.put("yesterdayRevenue",yesterdayRevenue);
+            map.put("totalRevenue",totalRevenue);
+
+            messageResult.setData(map);
+            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("revenueStatisticsDown")
+    @ApiOperation(value = "营收统计(下)")
+    public MessageResult<Map> revenueStatisticsDown(String token, @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+            CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
+            List<VehicleInfo> vehicleInfoList = vehicleInfoService.findByCompanyId(companyInfo.getId());
+            //线上购票款
+            BigDecimal onlineRevenue = BigDecimal.ZERO;
+            //微信收款
+            BigDecimal wechatRevenue = BigDecimal.ZERO;
+            //支付宝收款
+            BigDecimal alipayRevenue = BigDecimal.ZERO;
+            //现金收款
+            BigDecimal cashRevenue = BigDecimal.ZERO;
+            //车票收款
+            BigDecimal ticketRevenue = BigDecimal.ZERO;
+            //售票数
+            Integer num = 0;
+
+
+
+          //  if (vehicleInfoList.size()>0){
+                //微信
+                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(null,companyInfo.getId(),"alipay",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
+                if (alipaySum != null){
+                    alipayRevenue = alipaySum;
+                }
+
+                //现金
+                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(null,companyInfo.getId(),"ticket",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),null);
+                if (ticketSum != null){
+                    ticketRevenue = ticketSum;
+                }
+
+                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));
+            map.put("wechatRevenue",wechatRevenue);
+            map.put("alipayRevenue",alipayRevenue);
+            map.put("cashRevenue",cashRevenue);
+            map.put("ticketRevenue",ticketRevenue);
+            map.put("num",num);
+
+            messageResult.setData(map);
+            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("merchantVehicleList")
+    @ApiOperation(value = "商户的车辆列表")
+    public MessageResult<List<VehicleDTO>> merchantVehicleList(String token, @RequestAttribute String subject) {
+        MessageResult<List<VehicleDTO>> messageResult = new MessageResult<>();
+
+        try {
+
+            AccountInfo accountInfo = accountInfoService.get(subject);
+            if (accountInfo == null){
+                throw new Exception("请重新登录");
+            }
+            CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
+            List<VehicleInfo> vehicleInfoList = vehicleInfoService.findByCompanyId(companyInfo.getId());
+            List<VehicleDTO> list = new ArrayList<>();
+            if (vehicleInfoList.size()>0){
+                for (VehicleInfo vehicleInfo : vehicleInfoList){
+                    VehicleDTO vehicleDTO = new VehicleDTO();
+                    BeanUtils.copyProperties(vehicleInfo,vehicleDTO);
+                    list.add(vehicleDTO);
+                }
+            }
+
+            messageResult.setData(list);
+            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("profitList")
+    @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 = false, paramType = "form")
+    })
+    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 {
+
+            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());
+            }
+
+            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());
+
+
+            messageResult.setData(map);
+            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("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;
+    }
+
+}

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

@@ -147,7 +147,7 @@ public class PassengerApiController {
                 JSONObject verifyCodeJSON = new JSONObject();
                 verifyCodeJSON.put("code", verifyCode);
 
-                messageResult = SMSUtil.send(phone, "SMS_49390047", verifyCodeJSON.toString());
+                messageResult = SMSUtil.send(phone,"车信达" ,"SMS_49390047", verifyCodeJSON.toString());
 
                 //设置当前用户的验证码,5分钟内有效
                 redisTemplate.opsForValue().set(key, verifyCode, 5, TimeUnit.MINUTES);
@@ -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);

+ 77 - 0
web/src/main/java/com/jpsoft/bus/modules/sys/controller/LogController.java

@@ -126,4 +126,81 @@ public class LogController {
 
         return msgResult;
     }
+
+    @ApiOperation(value="车辆日志列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userId",value = "用户编号", paramType = "form"),
+            @ApiImplicitParam(name = "url",value = "url",  paramType = "form"),
+            @ApiImplicitParam(name = "remoteIP",value = "远程IP", paramType="form"),
+            @ApiImplicitParam(name = "startTime",value = "开始时间", paramType="form"),
+            @ApiImplicitParam(name = "endTime",value = "结束时间", paramType="form"),
+            @ApiImplicitParam(name = "elapseMin",value = "耗时大于(毫秒)", paramType="form"),
+            @ApiImplicitParam(name = "elapseMax",value = "耗时小于(毫秒)", paramType="form"),
+            @ApiImplicitParam(name = "pointcut",value = "切入口", paramType="form"),
+            @ApiImplicitParam(name = "remoteIP",value = "远程IP", paramType="form"),
+            @ApiImplicitParam(name = "remark",value = "备注", paramType="form")
+    })
+    @RequestMapping(value = "busList",method = RequestMethod.POST)
+    public MessageResult<Map> busList(
+            String userId,
+            String url,
+            String remoteIP,
+            Long elapseMin,
+            Long elapseMax,
+            String pointcut,
+            String remark,
+            @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") Date startTime,
+            @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") Date endTime,
+            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
+            @RequestParam(value="pageSize",defaultValue="20") int pageSize){
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        Map<String,Object> searchParams = new HashMap<>();
+
+        List<Sort> sortList = new ArrayList<>();
+        sortList.add(new Sort("create_time","desc"));
+
+        if (StringUtils.isNotEmpty(userId)) {
+            searchParams.put("userId",userId);
+        }
+
+        if (StringUtils.isNotEmpty(url)) {
+            searchParams.put("url",url + "%");
+        }
+
+        if (StringUtils.isNotEmpty(remoteIP)) {
+            searchParams.put("remoteIP",remoteIP + "%");
+        }
+
+        if (StringUtils.isNotEmpty(pointcut)) {
+            searchParams.put("pointcut",pointcut + "%");
+        }
+
+        if (startTime!=null) {
+            searchParams.put("startTime",startTime);
+        }
+
+        if (endTime!=null) {
+            searchParams.put("endTime",endTime);
+        }
+
+        if (elapseMin!=null){
+            searchParams.put("elapseMin",elapseMin);
+        }
+
+        if (elapseMax!=null){
+            searchParams.put("elapseMax",elapseMax);
+        }
+
+        if (StringUtils.isNotEmpty(remark)) {
+            searchParams.put("remark","%" + remark + "%");
+        }
+
+        Page<SysLog> page = sysLogService.pageSearch(searchParams,pageIndex,pageSize,sortList);
+
+        msgResult.setResult(true);
+        msgResult.setData(PojoUtils.pageWrapper(page));
+
+        return msgResult;
+    }
 }

+ 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("每日资金结算定时任务结束");
+    }
+}

+ 12 - 12
web/src/main/resources/application-production.yml

@@ -3,9 +3,9 @@ spring:
     #    url: jdbc:log4jdbc:mysql://127.0.0.1:3306/smart-community?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
     #    username: root
     #    password: slgo^Root_!Q@W#E)P(O*I
-    url: jdbc:log4jdbc:mysql://hbjpsoft.mysql.rds.aliyuncs.com:3306/enterprise_federation?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-    username: bus
-    password: bus
+    url: jdbc:log4jdbc:mysql://mysql57/smart-bus?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+    username: root
+    password: jpsoft8121234
   devtools:
     restart:
       enabled: true
@@ -23,7 +23,7 @@ spring:
     username: admin
     password: jpsoft
     #虚拟host 可以不设置,使用server默认host
-    virtual-host: enterprise-prod
+    virtual-host: smart-bus-test
 logger:
   level: WARN
   dir: /usr/local/tomcat/api-logs
@@ -36,7 +36,8 @@ springfox:
 
 wx:
   #荆楚云服务器内不能访问自身域名
-  commonAccessTokenUrl: http://192.168.0.1:8080/weixin/token
+  commonAccessTokenUrl: "http://ykt.xiaoxinda.com/weixin/token"
+  stationRemindTemplateId: "Ilxy2TX264A3RHqRyDZqL_xUDxi9OuBNeJoDOBfMRHg"
   pay:
     #车信达
     appId: wx93675268c87a5a46
@@ -56,14 +57,13 @@ wx:
     portalUrl: "http://xpgj.xiaoxinda.com/prod/business/#/"
 
   jpsoft:
-    appId: wx343bf93d2a3dc8af
-    appSecret: ac61fa669a7a79c7d2a8188ff7ddaef6
-    #mchId: 1509055881
-    mchId: 1531793091
+    appId: wx907e84ad32e6e142
+    appSecret: 1d891ee3f4cc8002ff0330d1e04acf2c
+    mchId: 1509055881
     subMchId: 1523544111
-    mchKey: jpsoft11111111111111111111111111
-    notifyUrl: http://xpgjapi.xiaoxinda.com/wxPay/wxJsapiPayNotify
-    refundUrl: http://xpgjapi.xiaoxinda.com/wxPay/wxJsapiRefundNotify
+    mchKey: xxd33333333333333333333333333333
+    notifyUrl: http://ykt-test.xiaoxinda.com/jp-housekeeper-server/wxPay/wxJsapiPayNotify
+    refundUrl: http://ykt-test.xiaoxinda.com/jp-housekeeper-server/wxPay/wxJsapiRefundNotify
     ip: 101.37.31.116
     certPath: /usr/local/tomcat/webapps/cert/xiaoxinda/apiclient_cert.p12
     temporaryUrl: http://ykt.xiaoxinda.com/wxPay/wxJsapiPayTemporaryNotify