提交 f1408560 作者: xiaowang

提现功能开发

上级 2c2f5908
package com.mmc.iuav.user.model.dto.wallet;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author 作者 lw
* @version 创建时间:2023.8.28 11:08:54
* @explain 类说明
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WithdrawalApplyDTO implements Serializable {
private static final long serialVersionUID = -5782430067900145219L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "申请人的用户ID")
private Integer userAccountId;
@ApiModelProperty(value = "申请金额")
private BigDecimal applyAmt;
@ApiModelProperty(value = "状态: 0平台处理中 1提现成功 2提现失败")
private Integer applyStatus;
@ApiModelProperty(value = "开户人")
private String empName;
@ApiModelProperty(value = "开户银行-支行名称")
private String bankName;
@ApiModelProperty(value = "收款账号")
private String payAccount;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "流水编号")
private String outerTradeNo;
@ApiModelProperty(value = "手机号")
private String phoneNum;
@ApiModelProperty(value = "提现方式-微信(wechat)-支付宝(alipay)-银行卡(bank_card)", required = true, example = "wechat")
private String settleType;
@ApiModelProperty(value = "处理信息")
private String tradeResult;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
package com.mmc.iuav.user.model.dto.xzsz;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @Author LW
* @date 2023/8/29 14:25
* 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UsableCashPoolingDTO {
@ApiModelProperty(value = "商户企业名称")
private String companyName;
@ApiModelProperty(value = "可用余额(含税费金额)")
private String taxFundName;
@ApiModelProperty(value = "税源地名称")
private BigDecimal availableBalance;
@ApiModelProperty(value = "交易渠道")
private String tradesChannel;
}
package com.mmc.iuav.user.model.qo.wallet;
/**
* @author 作者 geDuo
* @version 创建时间:2021年10月29日 下午2:25:08
* @explain 类说明
*/
import com.mmc.iuav.group.Freeze;
import com.mmc.iuav.group.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WithdrawalApplyQO implements Serializable {
private static final long serialVersionUID = -2185498289462506967L;
@ApiModelProperty(value = "关键字", example = "666")
private String keyword;
@ApiModelProperty(value = "开始时间", example = "2023-08-28 00:00:00")
private String startTime;
@ApiModelProperty(value = "结束时间", example = "2023-08-28 23:59:59")
private String endTime;
@ApiModelProperty(value = "状态: 0提现申请中 1提现成功 2提现失败", example = "0")
private Integer applyStatus;
@ApiModelProperty(value = "通道标识-微信(wechat)-支付宝(alipay)-银行卡(bank_card)", required = true, example = "wechat")
private String settleType;
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.iuav.user.model.dto.wallet; package com.mmc.iuav.user.model.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
...@@ -82,7 +82,12 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -82,7 +82,12 @@ public enum ResultEnum implements BaseErrorInfoInterface {
WX_NOT_SEND_MSG_PARAM_ERROR("5029", "userId和openId至少一个不为空"), WX_NOT_SEND_MSG_PARAM_ERROR("5029", "userId和openId至少一个不为空"),
APPLET_USER_ACCESS_TOKE_ERROR("5031", "获取accessToken签名校验失败"), APPLET_USER_ACCESS_TOKE_ERROR("5031", "获取accessToken签名校验失败"),
WX_NOT_REL_ERROR("5028", "获取微信公众号用户信息失败"), WX_NOT_REL_ERROR("5028", "获取微信公众号用户信息失败"),
DELETE_PASS_ERROR("5029", "已通过认证的不可删除"); DELETE_PASS_ERROR("5029", "已通过认证的不可删除"),
// 提现相关
WITHDRAWAL_APPLY_STATUS_ERROR("40001", "审批状态有误"),
WITHDRAWAL_INFO_NOT_FIND_ERROR("40002", "提现申请单信息不存在"),
WITHDRAWAL_REPEAT_CHECK_ERROR("40003", "提现申请单已被审批,切勿重复审批。");
/** /**
* 错误码 * 错误码
......
...@@ -2,19 +2,15 @@ package com.mmc.iuav.user.controller.wallet; ...@@ -2,19 +2,15 @@ package com.mmc.iuav.user.controller.wallet;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.controller.BaseController; import com.mmc.iuav.user.controller.BaseController;
import com.mmc.iuav.user.model.dto.wallet.WithdrawalApplyDTO;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO; import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.qo.wallet.WithdrawalApplyQO;
import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO; import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO;
import com.mmc.iuav.user.service.xzsz.WithdrawalService; import com.mmc.iuav.user.service.xzsz.WithdrawalService;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -38,8 +34,6 @@ public class WithdrawalController extends BaseController { ...@@ -38,8 +34,6 @@ public class WithdrawalController extends BaseController {
return withdrawalService.apply(applyWithdrawalVO, this.getUserLoginInfoFromRedis(request).getUserAccountId()); return withdrawalService.apply(applyWithdrawalVO, this.getUserLoginInfoFromRedis(request).getUserAccountId());
} }
// 提现查询
@ApiOperation(value = "个人提现明细列表") @ApiOperation(value = "个人提现明细列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("withdrawalList") @PostMapping("withdrawalList")
...@@ -47,6 +41,21 @@ public class WithdrawalController extends BaseController { ...@@ -47,6 +41,21 @@ public class WithdrawalController extends BaseController {
return withdrawalService.withdrawalList(this.getUserLoginInfoFromRedis(request).getUserAccountId(), walletFlowQO); return withdrawalService.withdrawalList(this.getUserLoginInfoFromRedis(request).getUserAccountId(), walletFlowQO);
} }
// 全部用户提现列表 @ApiOperation(value = "PC端-提现管理-分页查询")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WithdrawalApplyDTO.class)})
@PostMapping("listPageWithdrawalApply")
public ResultBody listPageWithdrawalApply(
@ApiParam(value = "提现管理查询QO", required = true) @RequestBody WithdrawalApplyQO param) {
return ResultBody.success(withdrawalService.listPageWithdrawalApply(param));
}
@ApiOperation(value = "PC端-提现管理-审批")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("approveWithdrawalApply")
public ResultBody approveWithdrawalApply(@ApiParam(value = "申请单ID", required = true) @RequestParam Integer id,
@ApiParam(value = "状态: 0提现申请中 1审批通过 2审批未通过", required = true) @RequestParam Integer applyStatus,
@ApiParam(value = "备注") String remark,
HttpServletRequest request) {
return ResultBody.success(withdrawalService.approveWithdrawalApply(id, applyStatus, this.getUserLoginInfoFromRedis(request).getUserAccountId(), remark));
}
} }
...@@ -47,7 +47,7 @@ public class XzController extends BaseController { ...@@ -47,7 +47,7 @@ public class XzController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("getUsableCashPooling") @PostMapping("getUsableCashPooling")
public ResultBody getUsableCashPooling() { public ResultBody getUsableCashPooling() {
return xzService.xzService(); return ResultBody.success(xzService.getUsableCashPooling());
} }
@ApiOperation(value = "签约状态查询") @ApiOperation(value = "签约状态查询")
......
...@@ -5,6 +5,7 @@ import com.mmc.iuav.user.entity.wallet.PayLogDO; ...@@ -5,6 +5,7 @@ import com.mmc.iuav.user.entity.wallet.PayLogDO;
import com.mmc.iuav.user.entity.wallet.PayWalletDO; import com.mmc.iuav.user.entity.wallet.PayWalletDO;
import com.mmc.iuav.user.entity.wallet.WithdrawalLogDO; import com.mmc.iuav.user.entity.wallet.WithdrawalLogDO;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO; import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.qo.wallet.WithdrawalApplyQO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
...@@ -34,9 +35,15 @@ public interface PayWalletDao { ...@@ -34,9 +35,15 @@ public interface PayWalletDao {
List<WithdrawalLogDO> getWithdrawalListByUserAccountId(WalletFlowQO param); List<WithdrawalLogDO> getWithdrawalListByUserAccountId(WalletFlowQO param);
XzWithdrawalApplyDO withdrawalApplyById(Integer id); XzWithdrawalApplyDO getWithdrawalApplyById(Integer id);
List<WithdrawalLogDO> listPayWithdrawalLog(Integer id); List<WithdrawalLogDO> listPayWithdrawalLog(Integer id);
int countPayWithdrawalLog(WalletFlowQO param); int countPayWithdrawalLog(WalletFlowQO param);
int countWithdrawalApply(WithdrawalApplyQO param);
List<XzWithdrawalApplyDO> listPageWithdrawalApply(WithdrawalApplyQO param);
void updateWithdrawalApply(XzWithdrawalApplyDO apply);
} }
...@@ -2,6 +2,7 @@ package com.mmc.iuav.user.entity; ...@@ -2,6 +2,7 @@ package com.mmc.iuav.user.entity;
import com.mmc.iuav.user.entity.wallet.UserBillingDetailVO; import com.mmc.iuav.user.entity.wallet.UserBillingDetailVO;
import com.mmc.iuav.user.enums.SettleTypeEnum; import com.mmc.iuav.user.enums.SettleTypeEnum;
import com.mmc.iuav.user.model.dto.wallet.WithdrawalApplyDTO;
import com.mmc.iuav.user.model.vo.XzWithdrawalVO; import com.mmc.iuav.user.model.vo.XzWithdrawalVO;
import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO; import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO;
import com.mmc.iuav.user.util.PrivacyUtil; import com.mmc.iuav.user.util.PrivacyUtil;
...@@ -53,6 +54,10 @@ public class XzWithdrawalApplyDO implements Serializable { ...@@ -53,6 +54,10 @@ public class XzWithdrawalApplyDO implements Serializable {
private String errorMessage; private String errorMessage;
private BigDecimal chargeAmount; private BigDecimal chargeAmount;
private Date createTime; private Date createTime;
private String remark;
private Integer approveUser;
private Date approveTime;
public XzWithdrawalApplyDO(XzWithdrawalVO xzWithdrawalVO) { public XzWithdrawalApplyDO(XzWithdrawalVO xzWithdrawalVO) {
this.userAccountId = xzWithdrawalVO.getUserAccountId(); this.userAccountId = xzWithdrawalVO.getUserAccountId();
...@@ -88,14 +93,21 @@ public class XzWithdrawalApplyDO implements Serializable { ...@@ -88,14 +93,21 @@ public class XzWithdrawalApplyDO implements Serializable {
payAccount = PrivacyUtil.encryptBankAcct(payAccount); payAccount = PrivacyUtil.encryptBankAcct(payAccount);
String name = "提现"; String name = "提现";
if (this.applyStatus == 0) { if (this.applyStatus == 0) {
name = "银行处理中"; name = "平台处理中";
} else if (this.applyStatus == 1) { } else if (this.applyStatus == 1) {
name = "提现成功"; name = "审批通过";
} else if (this.applyStatus == 2) { } else if (this.applyStatus == 2) {
name = "提现失败"; name = "审批未通过";
} }
return UserBillingDetailVO.builder().userAccountId(userAccountId) return UserBillingDetailVO.builder().userAccountId(userAccountId)
.payNo(outerTradeNo).payTime(payTime).account(payAccount) .payNo(outerTradeNo).payTime(payTime).account(payAccount)
.name(name).id(id).build(); .name(name).id(id).build();
} }
public WithdrawalApplyDTO buildWithdrawalApplyDTO() {
return WithdrawalApplyDTO.builder().id(id).userAccountId(userAccountId).applyAmt(new BigDecimal(payAmount))
.applyStatus(applyStatus).empName(empName).bankName(bankName).payAccount(payAccount)
.remark(remark).outerTradeNo(outerTradeNo).phoneNum(empPhone).settleType(settleType)
.tradeResult(tradeResult).createTime(createTime).build();
}
} }
...@@ -50,6 +50,8 @@ public class WithdrawalLogDO implements Serializable { ...@@ -50,6 +50,8 @@ public class WithdrawalLogDO implements Serializable {
*/ */
private BigDecimal salaryFreeze; private BigDecimal salaryFreeze;
private BigDecimal salaryPaid;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
......
package com.mmc.iuav.user.enums;
/**
* @author 作者 geDuo
* @version 创建时间:2021年10月29日 下午2:43:14
* @explain 类说明
*/
public enum WithdrawalApplyStatus {
TXSQ(0, "提现申请中"), TXCG(1, "提现成功"), TXSB(2, "提现失败");
private Integer code;
private String name;
WithdrawalApplyStatus(Integer code, String name) {
this.code = code;
this.name = name;
}
public void setCode(Integer code) {
this.code = code;
}
public Integer getCode() {
return this.code;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
}
...@@ -13,8 +13,8 @@ import com.mmc.iuav.user.entity.wallet.UserBillingDetailVO; ...@@ -13,8 +13,8 @@ import com.mmc.iuav.user.entity.wallet.UserBillingDetailVO;
import com.mmc.iuav.user.entity.wallet.WithdrawalLogDO; import com.mmc.iuav.user.entity.wallet.WithdrawalLogDO;
import com.mmc.iuav.user.enums.PayMethodEnums; import com.mmc.iuav.user.enums.PayMethodEnums;
import com.mmc.iuav.user.model.dto.wallet.PayWalletDTO; import com.mmc.iuav.user.model.dto.wallet.PayWalletDTO;
import com.mmc.iuav.user.model.dto.wallet.WithdrawalInfoVO;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO; import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.vo.WithdrawalInfoVO;
import com.mmc.iuav.user.model.vo.wallet.FlyerWalletFlowVO; import com.mmc.iuav.user.model.vo.wallet.FlyerWalletFlowVO;
import com.mmc.iuav.user.model.vo.wallet.PublisherWalletFlowVO; import com.mmc.iuav.user.model.vo.wallet.PublisherWalletFlowVO;
import com.mmc.iuav.user.model.vo.wallet.TopUpOrderVO; import com.mmc.iuav.user.model.vo.wallet.TopUpOrderVO;
...@@ -502,7 +502,7 @@ public class PayWalletServiceImpl implements PayWalletService { ...@@ -502,7 +502,7 @@ public class PayWalletServiceImpl implements PayWalletService {
PayLogDO payLogDO = payWalletDao.getPayLogById(id); PayLogDO payLogDO = payWalletDao.getPayLogById(id);
return ResultBody.success(payLogDO.buildUserBillingDetailVO()); return ResultBody.success(payLogDO.buildUserBillingDetailVO());
} else { } else {
XzWithdrawalApplyDO apply = payWalletDao.withdrawalApplyById(id); XzWithdrawalApplyDO apply = payWalletDao.getWithdrawalApplyById(id);
UserBillingDetailVO detail = apply.buildUserBillingDetailVO(); UserBillingDetailVO detail = apply.buildUserBillingDetailVO();
List<WithdrawalLogDO> rebates = payWalletDao.listPayWithdrawalLog(apply.getId()); List<WithdrawalLogDO> rebates = payWalletDao.listPayWithdrawalLog(apply.getId());
detail.buildSchedules(rebates); detail.buildSchedules(rebates);
......
package com.mmc.iuav.user.service.xzsz; package com.mmc.iuav.user.service.xzsz;
import com.mmc.iuav.page.PageResult;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO; import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.qo.wallet.WithdrawalApplyQO;
import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO; import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO;
/** /**
...@@ -12,4 +14,8 @@ public interface WithdrawalService { ...@@ -12,4 +14,8 @@ public interface WithdrawalService {
ResultBody apply(ApplyWithdrawalVO applyWithdrawalVO, Integer userAccountId); ResultBody apply(ApplyWithdrawalVO applyWithdrawalVO, Integer userAccountId);
ResultBody withdrawalList(Integer userAccountId, WalletFlowQO walletFlowQO); ResultBody withdrawalList(Integer userAccountId, WalletFlowQO walletFlowQO);
PageResult listPageWithdrawalApply(WithdrawalApplyQO param);
ResultBody approveWithdrawalApply(Integer id, Integer applyStatus, Integer userAccountId, String remark);
} }
...@@ -3,6 +3,7 @@ package com.mmc.iuav.user.service.xzsz; ...@@ -3,6 +3,7 @@ package com.mmc.iuav.user.service.xzsz;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO; import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.dto.xzsz.UsableCashPoolingDTO;
import com.mmc.iuav.user.model.vo.XzAuthVO; import com.mmc.iuav.user.model.vo.XzAuthVO;
import com.mmc.iuav.user.model.vo.XzWithdrawalVO; import com.mmc.iuav.user.model.vo.XzWithdrawalVO;
import com.mmc.iuav.user.xzsz.SingleSubmitResp; import com.mmc.iuav.user.xzsz.SingleSubmitResp;
...@@ -17,7 +18,7 @@ public interface XzService { ...@@ -17,7 +18,7 @@ public interface XzService {
ResultBody getCashPooling(); ResultBody getCashPooling();
ResultBody xzService(); UsableCashPoolingDTO getUsableCashPooling();
String getContractScope(XzAuthVO xzAuthVO); String getContractScope(XzAuthVO xzAuthVO);
......
...@@ -13,10 +13,15 @@ import com.mmc.iuav.user.entity.XzAuthDO; ...@@ -13,10 +13,15 @@ import com.mmc.iuav.user.entity.XzAuthDO;
import com.mmc.iuav.user.entity.XzWithdrawalApplyDO; import com.mmc.iuav.user.entity.XzWithdrawalApplyDO;
import com.mmc.iuav.user.entity.wallet.PayWalletDO; import com.mmc.iuav.user.entity.wallet.PayWalletDO;
import com.mmc.iuav.user.entity.wallet.WithdrawalLogDO; import com.mmc.iuav.user.entity.wallet.WithdrawalLogDO;
import com.mmc.iuav.user.enums.WithdrawalApplyStatus;
import com.mmc.iuav.user.enums.WithdrawalMethod; import com.mmc.iuav.user.enums.WithdrawalMethod;
import com.mmc.iuav.user.model.dto.wallet.WithdrawalApplyDTO;
import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO; import com.mmc.iuav.user.model.qo.wallet.WalletFlowQO;
import com.mmc.iuav.user.model.qo.wallet.WithdrawalApplyQO;
import com.mmc.iuav.user.model.vo.XzWithdrawalVO;
import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO; import com.mmc.iuav.user.model.vo.wallet.ApplyWithdrawalVO;
import com.mmc.iuav.user.service.xzsz.WithdrawalService; import com.mmc.iuav.user.service.xzsz.WithdrawalService;
import com.mmc.iuav.user.service.xzsz.XzService;
import com.mmc.iuav.user.util.TDateUtil; import com.mmc.iuav.user.util.TDateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -50,6 +55,9 @@ public class WithdrawalServiceImpl implements WithdrawalService { ...@@ -50,6 +55,9 @@ public class WithdrawalServiceImpl implements WithdrawalService {
@Autowired @Autowired
private PayWalletDao payWalletDao; private PayWalletDao payWalletDao;
@Autowired
private XzService xzService;
@Override @Override
@Transactional @Transactional
public ResultBody apply(ApplyWithdrawalVO applyWithdrawalVO, Integer userAccountId) { public ResultBody apply(ApplyWithdrawalVO applyWithdrawalVO, Integer userAccountId) {
...@@ -95,6 +103,7 @@ public class WithdrawalServiceImpl implements WithdrawalService { ...@@ -95,6 +103,7 @@ public class WithdrawalServiceImpl implements WithdrawalService {
withdrawalLogDO.setPayNo(payNo); withdrawalLogDO.setPayNo(payNo);
withdrawalLogDO.setPayTime(new Date()); withdrawalLogDO.setPayTime(new Date());
withdrawalLogDO.setSalaryFreeze(applyWithdrawalVO.getPayAmount()); withdrawalLogDO.setSalaryFreeze(applyWithdrawalVO.getPayAmount());
withdrawalLogDO.setSalaryPaid(new BigDecimal(0));
withdrawalLogDO.setXzWithdrawalApplyId(xzWithdrawalApplyDO.getId()); withdrawalLogDO.setXzWithdrawalApplyId(xzWithdrawalApplyDO.getId());
withdrawalLogDO.setUserAccountId(userAccountId); withdrawalLogDO.setUserAccountId(userAccountId);
withdrawalLogDO.setPayMethod(WithdrawalMethod.TXDJ.getCode()); withdrawalLogDO.setPayMethod(WithdrawalMethod.TXDJ.getCode());
...@@ -132,4 +141,93 @@ public class WithdrawalServiceImpl implements WithdrawalService { ...@@ -132,4 +141,93 @@ public class WithdrawalServiceImpl implements WithdrawalService {
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, withdrawalLogList.stream() return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, withdrawalLogList.stream()
.map(WithdrawalLogDO::buildUserBillingDetailVO).collect(Collectors.toList()))); .map(WithdrawalLogDO::buildUserBillingDetailVO).collect(Collectors.toList())));
} }
@Override
public PageResult listPageWithdrawalApply(WithdrawalApplyQO param) {
int count = payWalletDao.countWithdrawalApply(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<XzWithdrawalApplyDO> list = payWalletDao.listPageWithdrawalApply(param);
List<WithdrawalApplyDTO> pageList = list.stream().map(XzWithdrawalApplyDO::buildWithdrawalApplyDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
@Override
@Transactional
public ResultBody approveWithdrawalApply(Integer id, Integer applyStatus, Integer approveUserAccountId, String remark) {
if (!WithdrawalApplyStatus.TXCG.getCode().toString().equals(applyStatus.toString())
&& !WithdrawalApplyStatus.TXSB.getCode().toString().equals(applyStatus.toString())) {
return ResultBody.error(ResultEnum.WITHDRAWAL_APPLY_STATUS_ERROR);
}
// 查询申请单信息
XzWithdrawalApplyDO applyInfo = payWalletDao.getWithdrawalApplyById(id);
if (applyInfo == null) {
return ResultBody.error(ResultEnum.WITHDRAWAL_INFO_NOT_FIND_ERROR);
}
if (!(WithdrawalApplyStatus.TXSQ.getCode().toString()).equals(applyInfo.getApplyStatus().toString())) {
return ResultBody.error(ResultEnum.WITHDRAWAL_REPEAT_CHECK_ERROR);
}
// 获取当前用户钱包信息
PayWalletDO wallet = payWalletDao.getPayWalletByUser(applyInfo.getUserAccountId());
// 修改申请单的操作人信息
XzWithdrawalApplyDO apply = new XzWithdrawalApplyDO();
apply.setId(id);
apply.setApplyStatus(applyStatus);
apply.setRemark(remark);
apply.setApproveUser(approveUserAccountId);
apply.setApproveTime(new Date());
payWalletDao.updateWithdrawalApply(apply);
if (WithdrawalApplyStatus.TXCG.getCode().toString().equals(applyStatus.toString())) {
// 如果判断审批状态是成功,那么就调用小猪结算提现接口
XzWithdrawalVO xzWithdrawalVO = new XzWithdrawalVO();
xzWithdrawalVO.setUserAccountId(applyInfo.getUserAccountId());
xzWithdrawalVO.setMonth(applyInfo.getMonth());
xzWithdrawalVO.setOuterTradeNo(applyInfo.getOuterTradeNo());
xzWithdrawalVO.setEmpName(applyInfo.getEmpName());
xzWithdrawalVO.setEmpPhone(applyInfo.getEmpPhone());
xzWithdrawalVO.setLicenseType(applyInfo.getLicenseType());
xzWithdrawalVO.setLicenseId(applyInfo.getLicenseId());
xzWithdrawalVO.setSettleType(applyInfo.getSettleType());
xzWithdrawalVO.setPayAccount(applyInfo.getPayAccount());
xzWithdrawalVO.setBankName(applyInfo.getBankName());
xzWithdrawalVO.setPositionName(applyInfo.getPositionName());
xzWithdrawalVO.setPayAmount(applyInfo.getPayAmount());
xzService.singleSubmit(xzWithdrawalVO);
} else {
// 审批未通过 退回金额 解除冻结
// 生成提现流水编号
String payNo = "T" + TDateUtil.getDateStr(new Date(), TDateUtil.TYPE) + applyInfo.getUserAccountId() + CodeUtil.getRandomNum(4);
// 记录流水记录
WithdrawalLogDO withdrawalLogDO = new WithdrawalLogDO();
withdrawalLogDO.setPayNo(payNo);
withdrawalLogDO.setPayTime(new Date());
withdrawalLogDO.setSalaryPaid(BigDecimal.valueOf(applyInfo.getPayAmount()));
withdrawalLogDO.setXzWithdrawalApplyId(applyInfo.getId());
withdrawalLogDO.setUserAccountId(applyInfo.getUserAccountId());
withdrawalLogDO.setPayMethod(WithdrawalMethod.TXSB.getCode());
withdrawalLogDO.setSalaryFreeze(new BigDecimal(0));
payWalletDao.insertWithdrawalLog(withdrawalLogDO);
// 修改钱包信息,钱包冻结金额
PayWalletDO payWalletDO = new PayWalletDO();
payWalletDO.setPid(wallet.getPid());
payWalletDO.setUserAccountId(applyInfo.getUserAccountId());
payWalletDO.setSalaryAmt(wallet.getSalaryAmt().add(BigDecimal.valueOf(applyInfo.getPayAmount())));
payWalletDO.setSalaryFreeze(wallet.getSalaryFreeze().subtract(BigDecimal.valueOf(applyInfo.getPayAmount())));
int updateCount = payWalletDao.updatePayWallet(payWalletDO);
if (updateCount != 1) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultBody.error("操作失败,请稍后重试!");
}
}
return ResultBody.success();
}
} }
...@@ -6,9 +6,12 @@ import cn.hutool.json.JSONObject; ...@@ -6,9 +6,12 @@ import cn.hutool.json.JSONObject;
import com.mmc.iuav.http.HttpsRequestUtil; import com.mmc.iuav.http.HttpsRequestUtil;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.constant.UserSystemConstant; import com.mmc.iuav.user.constant.UserSystemConstant;
import com.mmc.iuav.user.dao.wallet.PayWalletDao;
import com.mmc.iuav.user.dao.xzsz.XzDao; import com.mmc.iuav.user.dao.xzsz.XzDao;
import com.mmc.iuav.user.entity.XzAuthDO; import com.mmc.iuav.user.entity.XzAuthDO;
import com.mmc.iuav.user.entity.XzWithdrawalApplyDO;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO; import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.dto.xzsz.UsableCashPoolingDTO;
import com.mmc.iuav.user.model.vo.XzAuthVO; import com.mmc.iuav.user.model.vo.XzAuthVO;
import com.mmc.iuav.user.model.vo.XzWithdrawalVO; import com.mmc.iuav.user.model.vo.XzWithdrawalVO;
import com.mmc.iuav.user.service.xzsz.XzService; import com.mmc.iuav.user.service.xzsz.XzService;
...@@ -30,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -30,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
...@@ -50,6 +54,9 @@ public class XzServiceImpl implements XzService { ...@@ -50,6 +54,9 @@ public class XzServiceImpl implements XzService {
@Autowired @Autowired
private XzDao xzDao; private XzDao xzDao;
@Resource
private PayWalletDao payWalletDao;
@Override @Override
public ResultBody getTaxFundList() { public ResultBody getTaxFundList() {
PiggyOpenBasicsClient piggyOpenBasicsClient = PiggyOpenBasicsClient.getInstanse(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzDomain()); PiggyOpenBasicsClient piggyOpenBasicsClient = PiggyOpenBasicsClient.getInstanse(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzDomain());
...@@ -70,14 +77,14 @@ public class XzServiceImpl implements XzService { ...@@ -70,14 +77,14 @@ public class XzServiceImpl implements XzService {
} }
@Override @Override
public ResultBody xzService() { public UsableCashPoolingDTO getUsableCashPooling() {
PiggyOpenBasicsClient piggyOpenBasicsClient = PiggyOpenBasicsClient.getInstanse(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzDomain()); PiggyOpenBasicsClient piggyOpenBasicsClient = PiggyOpenBasicsClient.getInstanse(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzDomain());
JSONObject jsonObject = piggyOpenBasicsClient.getTaxFundCashPooling(PiggyBasicsVo.builder() JSONObject jsonObject = piggyOpenBasicsClient.getTaxFundCashPooling(PiggyBasicsVo.builder()
.appKey(userSystemConstant.getXzAppKey()) .appKey(userSystemConstant.getXzAppKey())
.taxFundID("8ae605f565884a1f9a5e91d5a661ce58") .taxFundID("8ae605f565884a1f9a5e91d5a661ce58")
.build()); .build());
System.out.println(jsonObject.toString()); System.out.println(jsonObject.toString());
return ResultBody.success(jsonObject.get("data")); return jsonObject.get("data", UsableCashPoolingDTO.class);
} }
@Override @Override
...@@ -101,7 +108,7 @@ public class XzServiceImpl implements XzService { ...@@ -101,7 +108,7 @@ public class XzServiceImpl implements XzService {
if (jsonObject1.get("data") != null) { if (jsonObject1.get("data") != null) {
// TODO 添加认证结果 // TODO 添加认证结果
String signedResult = this.getSignedResult(xzAuthVO); String signedResult = this.getSignedResult(xzAuthVO);
return "合同签署完毕"; return "合同签署完毕";
} else { } else {
Map<String, Integer> userInfo = new HashMap<String, Integer>(); Map<String, Integer> userInfo = new HashMap<String, Integer>();
...@@ -178,7 +185,6 @@ public class XzServiceImpl implements XzService { ...@@ -178,7 +185,6 @@ public class XzServiceImpl implements XzService {
@Override @Override
public SingleSubmitResp singleSubmit(XzWithdrawalVO xzWithdrawalVO) { public SingleSubmitResp singleSubmit(XzWithdrawalVO xzWithdrawalVO) {
xzWithdrawalVO.setNotifyUrl(userSystemConstant.getWithdrawNotify());
PiggySingleWithdrawalApiV2Client v2Client = PiggySingleWithdrawalApiV2Client.getInstanse(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzDomain()); PiggySingleWithdrawalApiV2Client v2Client = PiggySingleWithdrawalApiV2Client.getInstanse(userSystemConstant.getXzAppSecret(), userSystemConstant.getXzDomain());
JSONObject jsonObject = v2Client.singleSubmit(PiggySingleWithdrawV2Vo.builder() JSONObject jsonObject = v2Client.singleSubmit(PiggySingleWithdrawV2Vo.builder()
.appKey(userSystemConstant.getXzAppKey()) .appKey(userSystemConstant.getXzAppKey())
...@@ -268,14 +274,20 @@ public class XzServiceImpl implements XzService { ...@@ -268,14 +274,20 @@ public class XzServiceImpl implements XzService {
if (data.getNotifyType().equals("submitResult")) { if (data.getNotifyType().equals("submitResult")) {
// 对上报的数据进行业务校验,例如:是否超限、是否有余额、是否有电签、参数是否准确等等前置校验。如果校验成功,订单进入待发队列等待发放 // 对上报的数据进行业务校验,例如:是否超限、是否有余额、是否有电签、参数是否准确等等前置校验。如果校验成功,订单进入待发队列等待发放
log.info("deal submitResult"); log.info("deal submitResult");
data.getOuterTradeNo(); // 根据订单编号修改信息
XzWithdrawalApplyDO xzWithdrawalApplyDO = new XzWithdrawalApplyDO();
xzWithdrawalApplyDO.setOuterTradeNo(data.getOuterTradeNo());
xzWithdrawalApplyDO.setSubmitStatus(data.getTradeStatus());
xzWithdrawalApplyDO.setTradeResult(data.getTradeResult());
xzWithdrawalApplyDO.setTaxFundId(userSystemConstant.getTaxFundId());
payWalletDao.updateWithdrawalApply(xzWithdrawalApplyDO);
} else if (data.getNotifyType().equals("tradeResult")) { } else if (data.getNotifyType().equals("tradeResult")) {
// 根据银行\微信\支付宝的反馈,推送订单的发放结果,发放成功\发放失败 // 根据银行\微信\支付宝的反馈,推送订单的发放结果,发放成功\发放失败
// todo 待处理
log.info("deal tradeResult"); log.info("deal tradeResult");
} }
} else { } else {
log.info("xzWithdrawNotify fail:{}", notify.toString()); log.info("xzWithdrawNotify fail:{}", notify);
} }
return "success"; return "success";
} }
......
...@@ -28,8 +28,10 @@ ...@@ -28,8 +28,10 @@
pay_no, pay_no,
pay_method, pay_method,
pay_time, pay_time,
salary_freeze) salary_freeze,
values (#{userAccountId}, #{xzWithdrawalApplyId}, #{payNo}, #{payMethod}, #{payTime}, #{salaryFreeze}) salary_paid)
values (#{userAccountId}, #{xzWithdrawalApplyId}, #{payNo}, #{payMethod}, #{payTime}, #{salaryFreeze},
#{salaryPaid})
</insert> </insert>
<update id="updatePayWallet"> <update id="updatePayWallet">
update pay_wallet update pay_wallet
...@@ -55,6 +57,70 @@ ...@@ -55,6 +57,70 @@
</set> </set>
where user_account_id = #{userAccountId} and pid = #{pid} where user_account_id = #{userAccountId} and pid = #{pid}
</update> </update>
<update id="updateWithdrawalApply">
update xz_withdrawal_apply
<set>
<if test="applyStatus != null">
apply_status = #{applyStatus},
</if>
<if test="approveUser != null">
approve_user = #{approveUser},
</if>
<if test="approveTime != null">
approve_time = #{approveTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
<if test="chargeAmount != null">
charge_amount = #{chargeAmount},
</if>
<if test="tradeStatus != null">
trade_status = #{tradeStatus},
</if>
<if test="tradeResult != null">
trade_result = #{tradeResult},
</if>
<if test="remarks != null">
remarks = #{remarks},
</if>
<if test="taxFundId != null">
tax_fund_id = #{taxFundId},
</if>
<if test="wechatAppId !=null">
wechat_app_id = #{wechatAppId},
</if>
<if test="tradeTime !=null">
trade_time = #{tradeTime},
</if>
<if test="frontLogNo !=null">
front_log_no = #{frontLogNo},
</if>
<if test="tradeFailCode !=null">
trade_fail_code = #{tradeFailCode},
</if>
<if test="submitStatus !=null">
submit_status = #{submitStatus},
</if>
<if test="errorCode != null">
error_code = #{errorCode},
</if>
<if test="errorMessage != null">
error_message =#{errorMessage}
</if>
</set>
<where>
<if test="id != null">
id = #{id}
</if>
<if test="outerTradeNo != null">
outer_trade_no = #{outerTradeNo}
</if>
</where>
</update>
<select id="getPayWalletByUser" resultType="com.mmc.iuav.user.entity.wallet.PayWalletDO"> <select id="getPayWalletByUser" resultType="com.mmc.iuav.user.entity.wallet.PayWalletDO">
select id, select id,
...@@ -154,7 +220,7 @@ ...@@ -154,7 +220,7 @@
order by create_time DESC order by create_time DESC
limit #{pageNo},#{pageSize} limit #{pageNo},#{pageSize}
</select> </select>
<select id="withdrawalApplyById" resultType="com.mmc.iuav.user.entity.XzWithdrawalApplyDO"> <select id="getWithdrawalApplyById" resultType="com.mmc.iuav.user.entity.XzWithdrawalApplyDO">
select id, select id,
user_account_id, user_account_id,
bank_name, bank_name,
...@@ -198,7 +264,7 @@ ...@@ -198,7 +264,7 @@
create_time create_time
from withdrawal_log from withdrawal_log
where xz_withdrawal_apply_id = #{id} where xz_withdrawal_apply_id = #{id}
order by pb.pay_time asc order by pay_time asc
</select> </select>
<select id="countPayWithdrawalLog" resultType="java.lang.Integer"> <select id="countPayWithdrawalLog" resultType="java.lang.Integer">
select count(*) select count(*)
...@@ -215,4 +281,101 @@ ...@@ -215,4 +281,101 @@
</if> </if>
</where> </where>
</select> </select>
<select id="countWithdrawalApply" resultType="java.lang.Integer">
select count(*)
from xz_withdrawal_apply
<where>
1 = 1
<if test="applyStatus != null">
and apply_status = #{applyStatus}
</if>
<if test="startTime != null and startTime != '' ">
and create_time &gt;=
STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d
%H:%i:%s')
</if>
<if test="channelTag != null and channelTag != '' ">
and settle_type = #{settleType}
</if>
<if test="keyword != null and keyword != '' ">
and (
emp_name like CONCAT('%',#{keyword},'%')
or
emp_phone like CONCAT('%',#{keyword},'%')
or pay_account like
CONCAT('%',#{keyword},'%')
or outer_trade_no like
CONCAT('%',#{keyword},'%')
)
</if>
</where>
</select>
<select id="listPageWithdrawalApply" resultType="com.mmc.iuav.user.entity.XzWithdrawalApplyDO">
select id,
user_account_id,
apply_status,
bank_name,
bank_remo,
emp_num,
emp_name,
emp_phone,
license_id,
license_type,
`month`,
notify_url,
outer_trade_no,
pay_account,
pay_amount,
position_name,
remarks,
settle_type,
tax_fund_id,
wechat_app_id,
trade_status,
trade_time,
front_log_no,
trade_fail_code,
trade_result,
submit_status,
error_code,
error_message,
charge_amount,
create_time,
pay_time,
remark
from xz_withdrawal_apply
<where>
1 = 1
<if test="applyStatus != null">
and apply_status = #{applyStatus}
</if>
<if test="startTime != null and startTime != '' ">
and create_time &gt;=
STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d
%H:%i:%s')
</if>
<if test="channelTag != null and channelTag != '' ">
and settle_type = #{settleType}
</if>
<if test="keyword != null and keyword != '' ">
and (
emp_name like CONCAT('%',#{keyword},'%')
or
emp_phone like CONCAT('%',#{keyword},'%')
or pay_account like
CONCAT('%',#{keyword},'%')
or outer_trade_no like
CONCAT('%',#{keyword},'%')
)
</if>
</where>
order by pb.create_time desc
limit #{pageNo},#{pageSize}
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论