Commit 64b6577f authored by machengbo's avatar machengbo

提现审核完善

parent 0312e0ad
package com.jz.common.enums;
/**
* 交易流水类型
*
* @author Bellamy
* @since 2020-12-07 14:30:23
*/
public enum TradeFlowEnum {
/**
* 提现
*/
TX("TX", "01"),
/**
* 充值
*/
CZ("CZ", "02"),
/**
* 付款(订单)
*/
FK("FK", "03"),
/**
* 收款
*/
SK("SK", "04"),
/**
* 续费
*/
XF("XF", "05"),
;
private String code;
private String value;
TradeFlowEnum(String code, String value) {
this.code = code;
this.value = value;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static TradeFlowEnum get(String code) {
if (code == null) {
return null;
}
for (TradeFlowEnum status : values()) {
if (status.getCode().equalsIgnoreCase(code)) {
return status;
}
}
return null;
}
}
......@@ -58,6 +58,15 @@ public class FinanceTradeFlow implements Serializable {
*/
private String delFlag;
/**
* 资产id
*/
private Long assetsId;
/**
* 资产结余
*/
private BigDecimal balanceMoney;
public Long getTradeFlowId() {
return tradeFlowId;
......@@ -139,4 +148,19 @@ public class FinanceTradeFlow implements Serializable {
this.delFlag = delFlag;
}
public Long getAssetsId() {
return assetsId;
}
public void setAssetsId(Long assetsId) {
this.assetsId = assetsId;
}
public BigDecimal getBalanceMoney() {
return balanceMoney;
}
public void setBalanceMoney(BigDecimal balanceMoney) {
this.balanceMoney = balanceMoney;
}
}
\ No newline at end of file
package com.jz.manage.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.FinanceTradeFlow;
import com.jz.manage.moduls.entity.FinanceTradeFlow;
/**
* 企业客户交易流水(TFinanceTradeFlow)表数据库访问层
......
......@@ -6,12 +6,15 @@ import com.jz.common.bean.BasePageBean;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.enums.AuditStatusEnum;
import com.jz.common.enums.TradeFlowEnum;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.finance.platForm.*;
import com.jz.manage.moduls.entity.FinanceCashOut;
import com.jz.manage.moduls.entity.FinanceCustomerAssets;
import com.jz.manage.moduls.entity.FinanceTradeFlow;
import com.jz.manage.moduls.mapper.FinanceCashOutDao;
import com.jz.manage.moduls.mapper.FinanceCustomerAssetsDao;
import com.jz.manage.moduls.mapper.FinanceTradeFlowDao;
import com.jz.manage.moduls.mapper.PlatformTradeFlowInfoDao;
import com.jz.manage.moduls.service.PlatformTradeFlowInfoService;
import org.apache.commons.lang3.StringUtils;
......@@ -49,6 +52,9 @@ public class PlatformTradeFlowInfoServiceImpl implements PlatformTradeFlowInfoSe
@Autowired
private FinanceCustomerAssetsDao financeCustomerAssetsDao;
@Autowired
private FinanceTradeFlowDao financeTradeFlowDao;
@Override
public PlatFormMoneyAndDepartDto queryPlatFormMoneyAndDepart(Map map) throws Exception {
return platformTradeFlowInfoDao.queryPlatFormMoneyAndDepart(map);
......@@ -157,36 +163,48 @@ public class PlatformTradeFlowInfoServiceImpl implements PlatformTradeFlowInfoSe
return platformTradeFlowInfoDao.queryCashOutByid(cashOutId);
}
/**
* 提现管理--提现审核
*
* @return
* @author Bellamy
* @since 2020-12-06
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> uptCashOutInfoAuditByid(CashOutAuditRequest cashOutAuditRequest) throws Exception {
FinanceCashOut cashOut = new FinanceCashOut();
//提现id
if (StringUtils.isNotEmpty(cashOutAuditRequest.getCashOutId())) {
cashOut.setCashOutId(Long.valueOf(cashOutAuditRequest.getCashOutId()));
}
//审核意见
if (StringUtils.isNotEmpty(cashOutAuditRequest.getRejectReason())) {
cashOut.setRejectReason(cashOutAuditRequest.getRejectReason());
}
//审核状态
cashOut.setAuditStatus(cashOutAuditRequest.getAuditStatus());
cashOut.setAuditTime(new Date());
//cashOut.setAuditPerson();
//更新提现状态
//1.更新提现状态
int len = financeCashOutDao.updateById(cashOut);
if (len > 0) {
logger.info("#####################修改提现状态成功#####################");
//审核通过,修改个人资产,总金额减去提现金额,从冻结金额减去
if (AuditStatusEnum.YSH.getValue().equals(cashOutAuditRequest.getAuditStatus())) {
//查询出提现金额
FinanceCashOut cashOutObj = financeCashOutDao.selectById(cashOutAuditRequest.getCashOutId());
//查询出提现金额
String cashOutMoney = cashOutObj.getCashOutMoney().toString();
BigDecimal txMoney = new BigDecimal(cashOutMoney); //提现金额
if (StringUtils.isNotEmpty(cashOutObj.getAssetsId().toString())) {
FinanceCustomerAssets assetsObj = financeCustomerAssetsDao.selectById(cashOutObj.getAssetsId().toString());
String totalMoney = assetsObj.getTotalMoney().toString();
BigDecimal totalMoneyObj = new BigDecimal(totalMoney); //总金额
totalMoneyObj = totalMoneyObj.subtract(txMoney);
String totalMoney = assetsObj.getTotalMoney().toString(); //总金额
BigDecimal totalMoneyObj = new BigDecimal(totalMoney);
String frozenMoney = assetsObj.getFrozenMoney().toString();//冻结金额
BigDecimal frozenMoneyObJ = new BigDecimal(frozenMoney);
//2.审核通过,修改个人资产,总金额减去提现金额,从冻结金额减去
if (AuditStatusEnum.YSH.getValue().equals(cashOutAuditRequest.getAuditStatus())) {
totalMoneyObj = totalMoneyObj.subtract(txMoney);
frozenMoneyObJ = frozenMoneyObJ.subtract(txMoney);
FinanceCustomerAssets financeCustomerAssets = new FinanceCustomerAssets();
......@@ -196,7 +214,36 @@ public class PlatformTradeFlowInfoServiceImpl implements PlatformTradeFlowInfoSe
//financeCustomerAssets.setUptPerson();
financeCustomerAssets.setUptTime(new Date());
financeCustomerAssetsDao.updateById(financeCustomerAssets);
logger.info("#####################修改资产金额态成功#####################");
logger.info("#####################提现通过---修改资产金额态成功#####################");
//3.商城流水添加一条流水记录
FinanceTradeFlow financeTradeFlow = new FinanceTradeFlow();
financeTradeFlow.setCreTime(new Date());
financeTradeFlow.setTradeMoney(txMoney);
financeTradeFlow.setAssetsId(cashOutObj.getAssetsId());
financeTradeFlow.setTradeType(TradeFlowEnum.TX.getValue());
financeTradeFlow.setTradeFlowNumber("123132");
financeTradeFlow.setBalanceMoney(assetsObj.getUseMoney());
//financeTradeFlow.setCashOutId();
//financeTradeFlow.setCrePerson();
financeTradeFlowDao.insert(financeTradeFlow);
logger.info("#####################商城提现流水记录添加成功#####################");
} else if (AuditStatusEnum.WTG.getValue().equals(cashOutAuditRequest.getAuditStatus())) {
//3.审核不通过,修改个人资产,可用金额加上提现金额,从冻结金额减去
String useMoney = assetsObj.getUseMoney().toString(); //可用金额
BigDecimal useMoneyObj = new BigDecimal(useMoney);
useMoneyObj = useMoneyObj.add(txMoney);
frozenMoneyObJ = frozenMoneyObJ.subtract(txMoney);
FinanceCustomerAssets financeCustomerAssets = new FinanceCustomerAssets();
financeCustomerAssets.setAssetsId(cashOutObj.getAssetsId());
financeCustomerAssets.setUseMoney(useMoneyObj);
financeCustomerAssets.setFrozenMoney(frozenMoneyObJ);
//financeCustomerAssets.setUptPerson();
financeCustomerAssets.setUptTime(new Date());
financeCustomerAssetsDao.updateById(financeCustomerAssets);
logger.info("#####################提现审核拒绝---修改资产金额态成功#####################");
}
}
return Result.ok();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment