Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

Joburgess vor 5 Jahren
Ursprung
Commit
d26bc6d873

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentWithdrawDao.java

@@ -5,5 +5,5 @@ import com.ym.mec.common.dal.BaseDAO;
 
 public interface StudentWithdrawDao extends BaseDAO<String, StudentWithdraw> {
 
-	
-}
+    StudentWithdraw getByUserId(Long userId);
+}

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CashAccountDetail.java

@@ -1,10 +1,14 @@
 package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
 
 public class CashAccountDetail extends QueryInfo {
     private Integer userId;
 
+    @ApiModelProperty(value = "交易类型", required = true)
+    private String type;
+
     public Integer getUserId() {
         return userId;
     }
@@ -12,4 +16,12 @@ public class CashAccountDetail extends QueryInfo {
     public void setUserId(Integer userId) {
         this.userId = userId;
     }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
 }

+ 54 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/WithdrawDto.java

@@ -2,12 +2,31 @@ package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.ApiModelProperty;
+import java.math.BigDecimal;
 
+/**
+ * @program: mec
+ * @description: 提现
+ * @author: xw
+ * @create: 2019-09-23 17:12
+ */
 public class WithdrawDto extends QueryInfo {
 
-    @ApiModelProperty(value = "最新课次",required = false)
+    @ApiModelProperty(value = "用户id",required = false)
     private Integer userId;
 
+    @ApiModelProperty(value = "银行卡号", required = true)
+    private String bankCardNo;
+
+    @ApiModelProperty(value = "提现金额", required = true)
+    private BigDecimal amount;
+
+    @ApiModelProperty(value = "交易类型", required = true)
+    private Integer TransType;
+
+    public WithdrawDto() {
+    }
+
     public Integer getUserId() {
         return userId;
     }
@@ -15,4 +34,38 @@ public class WithdrawDto extends QueryInfo {
     public void setUserId(Integer userId) {
         this.userId = userId;
     }
+
+    public String getBankCardNo() {
+        return bankCardNo;
+    }
+
+    public void setBankCardNo(String bankCardNo) {
+        this.bankCardNo = bankCardNo;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public Integer getTransType() {
+        return TransType;
+    }
+
+    public void setTransType(Integer transType) {
+        TransType = transType;
+    }
+
+    @Override
+    public String toString() {
+        return "WithdrawDto{" +
+                "userId=" + userId +
+                ", bankCardNo='" + bankCardNo + '\'' +
+                ", amount=" + amount +
+                ", TransType=" + TransType +
+                '}';
+    }
 }

+ 134 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/WithdrawInfoDto.java

@@ -0,0 +1,134 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @program: mec
+ * @description: 学员详情(提现)
+ * @author: xw
+ * @create: 2019-09-24 19:10
+ */
+public class WithdrawInfoDto implements Serializable {
+
+    @ApiModelProperty(value = "提现交易流水号",required = false)
+    private String withdrawId;
+    @ApiModelProperty(value = "申请时间",required = false)
+    private String dateTime;
+    @ApiModelProperty(value = "提现金额",required = false)
+    private BigDecimal amount;
+    @ApiModelProperty(value = "账户金额",required = false)
+    private BigDecimal balance;
+    @ApiModelProperty(value = "提现账户",required = false)
+    private String transTypeName;
+    @ApiModelProperty(value = "账户号",required = false)
+    private String accountNo;
+    @ApiModelProperty(value = "提现状态",required = false)
+    private String withdrawStatus;
+    @ApiModelProperty(value = "支付账号",required = false)
+    private String payAccountNo;
+    @ApiModelProperty(value = "支付渠道",required = false)
+    private String payChannel;
+    @ApiModelProperty(value = "交易流水号",required = false)
+    private String transactionalNo;
+
+    public WithdrawInfoDto() {
+    }
+
+    public String getWithdrawId() {
+        return withdrawId;
+    }
+
+    public void setWithdrawId(String withdrawId) {
+        this.withdrawId = withdrawId;
+    }
+
+    public String getDateTime() {
+        return dateTime;
+    }
+
+    public void setDateTime(String dateTime) {
+        this.dateTime = dateTime;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public BigDecimal getBalance() {
+        return balance;
+    }
+
+    public void setBalance(BigDecimal balance) {
+        this.balance = balance;
+    }
+
+    public String getTransTypeName() {
+        return transTypeName;
+    }
+
+    public void setTransTypeName(String transTypeName) {
+        this.transTypeName = transTypeName;
+    }
+
+    public String getAccountNo() {
+        return accountNo;
+    }
+
+    public void setAccountNo(String accountNo) {
+        this.accountNo = accountNo;
+    }
+
+    public String getWithdrawStatus() {
+        return withdrawStatus;
+    }
+
+    public void setWithdrawStatus(String withdrawStatus) {
+        this.withdrawStatus = withdrawStatus;
+    }
+
+    public String getPayAccountNo() {
+        return payAccountNo;
+    }
+
+    public void setPayAccountNo(String payAccountNo) {
+        this.payAccountNo = payAccountNo;
+    }
+
+    public String getPayChannel() {
+        return payChannel;
+    }
+
+    public void setPayChannel(String payChannel) {
+        this.payChannel = payChannel;
+    }
+
+    public String getTransactionalNo() {
+        return transactionalNo;
+    }
+
+    public void setTransactionalNo(String transactionalNo) {
+        this.transactionalNo = transactionalNo;
+    }
+
+    @Override
+    public String toString() {
+        return "WithdrawInfoDto{" +
+                "withdrawId='" + withdrawId + '\'' +
+                ", dateTime='" + dateTime + '\'' +
+                ", amount=" + amount +
+                ", balance=" + balance +
+                ", transTypeName='" + transTypeName + '\'' +
+                ", accountNo='" + accountNo + '\'' +
+                ", withdrawStatus='" + withdrawStatus + '\'' +
+                ", payAccountNo='" + payAccountNo + '\'' +
+                ", payChannel='" + payChannel + '\'' +
+                ", transactionalNo='" + transactionalNo + '\'' +
+                '}';
+    }
+}

+ 37 - 24
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysUserCashAccountDetail.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.dal.entity;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
 
+import com.ym.mec.biz.dal.enums.TransTypeEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -17,65 +18,69 @@ public class SysUserCashAccountDetail {
 	/** 序号 */
 	@ApiModelProperty(value = "序号",required = false)
 	private Long id;
-	
+
 	/** 用户编号 */
 	@ApiModelProperty(value = "用户编号",required = false)
 	private Integer userId;
-	
+
 	/** 交易流水号 */
 	@ApiModelProperty(value = "交易流水号",required = false)
 	private String transNo;
-	
+
 	/** 交易类型 (RECHARGE 充值,WITHDRAW 提现,PAY_FEE 缴费,REFUNDS 退费,FILL_ACCOUNT 人工补账) */
 	@ApiModelProperty(value = "交易类型",required = false)
 	private PlatformCashAccountDetailTypeEnum type;
-	
+
+	/** 交易方式1.微信,2支付宝,3快捷*/
+	@ApiModelProperty(value = "交易方式",required = false)
+	private TransTypeEnum transType;
+
 	/** 交易状态(1,交易中;2,成功交易;-1,交易失败;) */
 	@ApiModelProperty(value = "交易状态",required = false)
 	private DealStatusEnum status;
-	
+
 	/** 交易金额 */
 	@ApiModelProperty(value = "交易金额",required = false)
 	private BigDecimal amount;
-	
+
 	/** 账户可用余额 */
 	@ApiModelProperty(value = "账户可用余额",required = false)
 	private BigDecimal balance;
-	
+
 	/** 描述 */
 	@ApiModelProperty(value = "描述",required = false)
 	private String description;
-	
+
 	/** 后台备注 */
 	@ApiModelProperty(value = "后台备注",required = false)
 	private String comment;
-	
+
 	/** 创建时间 */
 	private java.util.Date createTime;
-	
+
 	/** 修改时间 */
 	private java.util.Date updateTime;
-	
+
 	public void setId(Long id){
 		this.id = id;
 	}
-	
+
 	public Long getId(){
 		return this.id;
 	}
-			
+
 	public void setUserId(Integer userId){
 		this.userId = userId;
 	}
-	
+
 	public Integer getUserId(){
 		return this.userId;
 	}
-			
+
 	public void setTransNo(String transNo){
 		this.transNo = transNo;
 	}
-	
+
 	public String getTransNo(){
 		return this.transNo;
 	}
@@ -115,35 +120,43 @@ public class SysUserCashAccountDetail {
 	public void setDescription(String description){
 		this.description = description;
 	}
-	
+
 	public String getDescription(){
 		return this.description;
 	}
-			
+
 	public void setComment(String comment){
 		this.comment = comment;
 	}
-	
+
 	public String getComment(){
 		return this.comment;
 	}
-			
+
 	public void setCreateTime(java.util.Date createTime){
 		this.createTime = createTime;
 	}
-	
+
 	public java.util.Date getCreateTime(){
 		return this.createTime;
 	}
-			
+
 	public void setUpdateTime(java.util.Date updateTime){
 		this.updateTime = updateTime;
 	}
-	
+
 	public java.util.Date getUpdateTime(){
 		return this.updateTime;
 	}
-			
+
+	public TransTypeEnum getTransType() {
+		return transType;
+	}
+
+	public void setTransType(TransTypeEnum transType) {
+		this.transType = transType;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 4 - 2
mec-common/common-core/src/main/java/com/ym/mec/common/enums/TransTypeEnum.java → mec-biz/src/main/java/com/ym/mec/biz/dal/enums/TransTypeEnum.java

@@ -1,5 +1,6 @@
-package com.ym.mec.common.enums;
+package com.ym.mec.biz.dal.enums;
 
+import com.ym.mec.common.enums.BaseEnum;
 import java.util.Arrays;
 
 /**
@@ -8,7 +9,7 @@ import java.util.Arrays;
  * @author: xw
  * @create: 2019-09-24 16:00
  */
-public enum TransTypeEnum {
+public enum TransTypeEnum implements BaseEnum<Integer, TransTypeEnum> {
 
     WECHAT(1, "微信"),
     ALIPAY(2, "支付宝"),
@@ -23,6 +24,7 @@ public enum TransTypeEnum {
         this.description = description;
     }
 
+    @Override
     public Integer getCode() {
         return code;
     }

+ 19 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/StudentWithdrawService.java

@@ -1,8 +1,26 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dto.CashAccountDetail;
+import com.ym.mec.biz.dal.dto.WithdrawDto;
+import com.ym.mec.biz.dal.dto.WithdrawInfoDto;
 import com.ym.mec.biz.dal.entity.StudentWithdraw;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
 public interface StudentWithdrawService extends BaseService<String, StudentWithdraw> {
 
-}
+    /**
+     * 确认提现
+     * @param withdrawDto
+     * @return
+     */
+    boolean confirmWithdraw(WithdrawDto withdrawDto);
+
+    /**
+     * 根据学员id查询提现记录
+     * @param cashAccountDetail
+     * @return
+     */
+    PageInfo<WithdrawInfoDto> queryWithdrawPage(CashAccountDetail cashAccountDetail);
+
+}

+ 134 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentWithdrawServiceImpl.java

@@ -1,17 +1,41 @@
 package com.ym.mec.biz.service.impl;
 
+import com.google.common.collect.Lists;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dto.CashAccountDetail;
+import com.ym.mec.biz.dal.dto.WithdrawDto;
+import com.ym.mec.biz.dal.dto.WithdrawInfoDto;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
+import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
+import com.ym.mec.biz.service.SysUserCashAccountDetailService;
+import com.ym.mec.biz.service.SysUserCashAccountService;
+import com.ym.mec.biz.dal.enums.TransTypeEnum;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.utils.DateUtils;
+import com.ym.mec.util.string.IdWorker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
-
 import com.ym.mec.biz.dal.dao.StudentWithdrawDao;
 import com.ym.mec.biz.dal.entity.StudentWithdraw;
 import com.ym.mec.biz.service.StudentWithdrawService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 @Service
 public class StudentWithdrawServiceImpl extends BaseServiceImpl<String, StudentWithdraw>  implements StudentWithdrawService {
-	
+
 	@Autowired
 	private StudentWithdrawDao studentWithdrawDao;
 
@@ -19,5 +43,111 @@ public class StudentWithdrawServiceImpl extends BaseServiceImpl<String, StudentW
 	public BaseDAO<String, StudentWithdraw> getDAO() {
 		return studentWithdrawDao;
 	}
-	
-}
+
+	private static final Logger log = LoggerFactory.getLogger(StudentWithdrawServiceImpl.class);
+
+//	@Qualifier("auth-server")
+//	@Autowired
+//	private SysUserFeignService sysUserFeignService;
+	@Autowired
+	private SysUserCashAccountService cashAccountService;
+	@Autowired
+	private SysUserCashAccountDetailService cashAccountDetailService;
+	@Autowired
+	private SysUserCashAccountDetailService accountDetailService;
+
+	private Lock lock = new ReentrantLock();
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public boolean confirmWithdraw(WithdrawDto withdrawDto) {
+		try {
+//			SysUser sysUser = sysUserFeignService.queryUserInfo();
+//			if (Objects.isNull(sysUser)) {
+//				throw new BizException("请重新登录");
+//			}
+			lock.lock();
+			SysUserCashAccount sysUserCashAccount = cashAccountService.get(withdrawDto.getUserId().intValue());
+			if (Objects.isNull(sysUserCashAccount)){
+				throw new BizException("账户不存在!");
+			}
+			//校验银行账户余额
+			if (sysUserCashAccount.getBalance().compareTo(withdrawDto.getAmount()) < 0) {
+				throw new BizException("余额不足,提现失败!");
+			}
+			//第三方提现到用户银行卡
+			//用户个人虚拟账户金额减少
+			updateCashAccount(sysUserCashAccount, withdrawDto);
+			//生成提现记录(缺少银行流水号,交易状态,用户承担的费用,平台承担的费用)
+			saveStudentWithdraw(withdrawDto);
+		} catch (Exception e) {
+			log.error("用户提现出现异常 {}", e.getMessage(), e);
+			throw new BizException(e.getMessage());
+		} finally {
+			lock.unlock();
+		}
+		return true;
+	}
+
+	@Override
+	public PageInfo<WithdrawInfoDto> queryWithdrawPage(CashAccountDetail cashAccountDetail) {
+		PageInfo<WithdrawInfoDto> result = new PageInfo<>();
+		cashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.WITHDRAW.getCode());
+		PageInfo<SysUserCashAccountDetail> accountDetailPageInfo = accountDetailService.queryPage(cashAccountDetail);
+		List<WithdrawInfoDto> dataList = Lists.newArrayList();
+		accountDetailPageInfo.getRows().forEach(data ->{
+			WithdrawInfoDto withdrawInfoDto = new WithdrawInfoDto();
+			StudentWithdraw studentWithdraw = studentWithdrawDao.getByUserId(data.getUserId().longValue());
+			withdrawInfoDto.setWithdrawId(studentWithdraw.getId());
+			withdrawInfoDto.setDateTime(DateUtils.date2ChineseDate(studentWithdraw.getCreateTime()));
+			withdrawInfoDto.setAmount(data.getAmount());
+			withdrawInfoDto.setBalance(data.getBalance());
+			withdrawInfoDto.setTransTypeName(TransTypeEnum.getDescriptionByCode(data.getTransType().getCode()));
+			withdrawInfoDto.setAccountNo(studentWithdraw.getBankCardNo());
+			withdrawInfoDto.setWithdrawStatus(studentWithdraw.getStatus().getMsg());
+			//支付账号
+			dataList.add(withdrawInfoDto);
+		});
+		BeanUtils.copyProperties(accountDetailPageInfo, result);
+		result.setRows(dataList);
+		return result;
+	}
+
+	/**
+	 * 修改用户账户余额,保存账户明细
+	 *
+	 * @param withdrawDto
+	 */
+	private void updateCashAccount(SysUserCashAccount sysUserCashAccount, WithdrawDto withdrawDto) {
+		BigDecimal balance = sysUserCashAccount.getBalance().subtract(withdrawDto.getAmount());
+		SysUserCashAccount account = new SysUserCashAccount();
+		account.setUserId(sysUserCashAccount.getUserId());
+		account.setBalance(balance);
+		account.setUpdateTime(new Date());
+		cashAccountService.update(account);
+		SysUserCashAccountDetail cashAccountDetail = new SysUserCashAccountDetail();
+		cashAccountDetail.setUserId(withdrawDto.getUserId());
+		cashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.WITHDRAW);
+		cashAccountDetail.setAmount(withdrawDto.getAmount());
+		cashAccountDetail.setBalance(balance);
+		cashAccountDetail.setCreateTime(new Date());
+		cashAccountDetailService.insert(cashAccountDetail);
+	}
+
+	/**
+	 * 保存提现记录
+	 *
+	 * @param withdrawDto
+	 */
+	private void saveStudentWithdraw(WithdrawDto withdrawDto) {
+		IdWorker idWorker = new IdWorker(0, 0);
+		StudentWithdraw studentWithdraw = new StudentWithdraw();
+		studentWithdraw.setId(idWorker.nextId());
+		studentWithdraw.setUserId(withdrawDto.getUserId().longValue());
+		studentWithdraw.setBankCardNo(withdrawDto.getBankCardNo());
+		studentWithdraw.setAmount(withdrawDto.getAmount());
+		studentWithdraw.setCreateTime(new Date());
+		insert(studentWithdraw);
+	}
+
+}

+ 12 - 2
mec-biz/src/main/resources/config/mybatis/StudentWithdrawMapper.xml

@@ -23,7 +23,7 @@
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="StudentWithdraw">
-		SELECT * FROM student_withdraw WHERE id_ = #{id} 
+		SELECT * FROM student_withdraw WHERE id_ = #{id}
 	</select>
 
     <!-- 全查询 -->
@@ -84,7 +84,7 @@
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
-		DELETE FROM student_withdraw WHERE id_ = #{id} 
+		DELETE FROM student_withdraw WHERE id_ = #{id}
 	</delete>
 
     <!-- 分页查询 -->
@@ -108,4 +108,14 @@
             </if>
         </where>
 	</select>
+
+    <select id="getByUserId" resultMap="StudentWithdraw" parameterType="Long">
+        SELECT * FROM student_withdraw
+        <where>
+            <if test="userId != null">
+                user_id_ = #{userId}
+            </if>
+        </where>
+        LIMIT 1
+    </select>
 </mapper>

+ 10 - 4
mec-biz/src/main/resources/config/mybatis/SysUserCashAccountDetailMapper.xml

@@ -11,6 +11,7 @@
         <result column="user_id_" property="userId"/>
         <result column="trans_no_" property="transNo"/>
         <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="trans_type_" property="transType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="amount_" property="amount"/>
         <result column="balance_" property="balance"/>
@@ -22,7 +23,7 @@
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="SysUserCashAccountDetail">
-		SELECT * FROM sys_user_cash_account_detail WHERE id_ = #{id} 
+		SELECT * FROM sys_user_cash_account_detail WHERE id_ = #{id}
 	</select>
 
     <!-- 全查询 -->
@@ -39,8 +40,10 @@
         </selectKey>
         -->
         INSERT INTO sys_user_cash_account_detail
-        (id_,user_id_,trans_no_,type_,status_,amount_,balance_,description_,comment_,create_time_,update_time_)
-        VALUES(#{id},#{userId},#{transNo},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{amount},#{balance},#{description},#{comment},now(),now())
+        (id_,user_id_,trans_no_,type_,trans_type_, status_,amount_,balance_,description_,comment_,create_time_,update_time_)
+        VALUES(#{id},#{userId},#{transNo},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+        ,#{transType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{amount},#{balance},#{description},#{comment},now(),now())
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -74,13 +77,16 @@
             <if test="type != null">
                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
+            <if test="transType != null">
+                trans_type_ = #{transType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
         </set>
         WHERE id_ = #{id}
     </update>
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
-		DELETE FROM sys_user_cash_account_detail WHERE id_ = #{id} 
+		DELETE FROM sys_user_cash_account_detail WHERE id_ = #{id}
 	</delete>
 
     <!-- 分页查询 -->

+ 11 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/utils/DateUtils.java

@@ -13,6 +13,8 @@ import java.util.List;
  */
 public class DateUtils {
 
+    private static final String CHINESE_DATA_FORMAT = "yyyy年MM月dd日 HH:mm:ss";
+
     /**
      * @Author: Joburgess
      * @Date: 2019/9/23
@@ -32,6 +34,15 @@ public class DateUtils {
         return dates;
     }
 
+    /**
+     * 时间转换为中文格式
+     * @param date
+     * @return
+     */
+    public static String date2ChineseDate(Date date){
+        return new SimpleDateFormat(CHINESE_DATA_FORMAT).format(date);
+    }
+
     public static void main(String[] args) throws ParseException {
         SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
         List<Date> mondayCount = getWeekDays(simpleDateFormat.parse("2019-9-23"), simpleDateFormat.parse("2019-10-23"), Calendar.SUNDAY);

+ 41 - 0
mec-student/src/main/java/com/ym/mec/student/controller/WithdrawController.java

@@ -0,0 +1,41 @@
+package com.ym.mec.student.controller;
+
+import com.ym.mec.biz.dal.dto.CashAccountDetail;
+import com.ym.mec.biz.dal.dto.WithdrawDto;
+import com.ym.mec.biz.service.StudentWithdrawService;
+import com.ym.mec.common.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @program: mec
+ * @description: 提现
+ * @author: xw
+ * @create: 2019-09-23 17:12
+ */
+@RestController
+@RequestMapping("withdraw")
+@Api(tags = "提现服务")
+public class WithdrawController extends BaseController {
+
+    @Autowired
+    private StudentWithdrawService withdrawService;
+
+    @PostMapping("confirm")
+    @ApiOperation(value = "确认提现")
+    public Object confirmWithdraw(@RequestBody WithdrawDto withdrawDto) {
+        withdrawService.confirmWithdraw(withdrawDto);
+        return succeed();
+    }
+
+    @PostMapping("page")
+    @ApiOperation(value = "学员提现详情")
+    public Object getInfo(@RequestBody CashAccountDetail cashAccountDetail) {
+        return succeed(withdrawService.queryWithdrawPage(cashAccountDetail));
+    }
+}