fllmoyu 4 年之前
父节点
当前提交
a521815154

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

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

+ 11 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/service/impl/GpsServiceImpl.java

@@ -336,6 +336,7 @@ public class GpsServiceImpl implements GpsService {
                 }
 
                 if(frontToEnd){
+                    int n = 0;
                     for (int i=0;i<stationInfoList.size();i++) {
                         StationInfo stationInfo = stationInfoList.get(i);
 
@@ -348,9 +349,14 @@ public class GpsServiceImpl implements GpsService {
                            currentStationId = stationInfo.getId();
                            break;
                         }
+                        n++;
+                        if (n>=2){
+                            break;
+                        }
                     }
                 }
                 else{
+                    int n = 0;
                     for (int i=stationInfoList.size() - 1;i>=0;i--) {
                         StationInfo stationInfo = stationInfoList.get(i);
 
@@ -363,6 +369,11 @@ public class GpsServiceImpl implements GpsService {
                             currentStationId = stationInfo.getId();
                             break;
                         }
+                        n++;
+                        if (n>=2){
+                            break;
+                        }
+
                     }
                 }
 

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

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

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

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

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

+ 39 - 23
common/src/main/java/com/jpsoft/bus/modules/merchant/entity/WithdrawalRecord.java

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

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

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

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

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

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

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

+ 330 - 4
web/src/main/java/com/jpsoft/bus/modules/mobile/controller/MerchantApiController.java

@@ -10,10 +10,7 @@ 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.CompanyInfoService;
-import com.jpsoft.bus.modules.bus.service.ShiftInfoService;
-import com.jpsoft.bus.modules.bus.service.StationInfoService;
-import com.jpsoft.bus.modules.bus.service.VehicleInfoService;
+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;
@@ -21,10 +18,14 @@ 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 io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -39,6 +40,7 @@ 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;
 
@@ -58,9 +60,21 @@ public class MerchantApiController {
     @Autowired
     private CompanyInfoService companyInfoService;
 
+    @Autowired
+    private DriverInfoService driverInfoService;
+
+    @Autowired
+    private RouteInfoService routeInfoService;
+
+    @Autowired
+    private PassengerInfoService passengerInfoService;
+
     @Autowired
     private CapitalInfoService capitalInfoService;
 
+    @Autowired
+    private WithdrawalRecordService withdrawalRecordService;
+
     @Autowired
     private MergeOrderInfoService mergeOrderInfoService;
 
@@ -573,5 +587,317 @@ public class MerchantApiController {
         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(vehicleInfoList,"wechat",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),false);
+                BigDecimal alipayTodaySum = orderInfoService.paySum(vehicleInfoList,"alipay",DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()),false);
+                todayRevenue = (wechatTodaySum == null?BigDecimal.ZERO:wechatTodaySum).add(alipayTodaySum==null?BigDecimal.ZERO:alipayTodaySum);
+
+            }
+
+            Map<String,Object> map = new HashMap<>();
+            map.put("withdrawalAmount",withdrawalAmount);
+            map.put("todayRevenue",todayRevenue);
+            map.put("onlineTotalRevenue",onlineTotalRevenue);
+            map.put("alreadyWithdrawalAmount",alreadyWithdrawalAmount);
+            map.put("account",accountInfo);
+
+
+            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("withdrawal")
+    @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("提现金额不可超过可提现金额");
+            }
+
+
+
+
+
+            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;
+    }
 
 }