Commit 5caeba35 authored by zhangc's avatar zhangc

Merge branch 'dm_dev' of gitlab.ioubuy.cn:yaobenzhang/dm_project into dm_dev

parents bf394c75 76a52875
alter table t_finance_customer_assets add remark text COMMENT '备注';
alter table t_platform_log add caller_type char(2) NOT NULL COMMENT '调用类型:01商城用户,02平台用户';
\ No newline at end of file
......@@ -2,14 +2,17 @@ package com.jz.dm.mall.moduls.controller.finance;
import com.jz.common.base.BaseController;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCashOutDto;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCashOutRequest;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerBalanceRequest;
import com.jz.dm.mall.moduls.service.FinanceTradeFlowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
......@@ -46,8 +49,109 @@ public class FinanceTradeFlowController extends BaseController {
map.put("assetsId", 1); //企业资产账户id
map.put("departmentId", 1); //企业ID
FinanceCustomerAssetsDto dto = financeTradeFlowService.queryAccountMoneyByMap(map);
result.setResult(dto);
result.setData(dto);
return result;
}
/**
* 保存充值金额
*
* @author Bellamy
* @since 2020-12-03
*/
@PostMapping(value = "/getAccountMoney")
@ApiOperation(value = "充值----保存充值金额", notes = "保存充值金额")
@ApiParam()
public Result<Object> uptAccountMoney(@RequestBody FinanceCustomerBalanceRequest customerBalanceRequest, HttpServletRequest requset) throws Exception {
if(StringUtils.isEmpty(customerBalanceRequest.getAssetsId().toString())){ //企业资产id
return Result.error("参数不能为空!");
}
if(StringUtils.isEmpty(customerBalanceRequest.getBalanceMoney().toString())){ //充值金额
return Result.error("参数不能为空!");
}
Boolean str = financeTradeFlowService.uptAccountMoney(customerBalanceRequest);
if(!str){
return Result.error("提交失败!");
}
return Result.ok("提交成功!");
}
/**
* 充值----获取企业账户余额
*
* @author Bellamy
* @since 2020-12-03
*/
@GetMapping(value = "/cashOutAccountMoney")
@ApiOperation(value = "提现----获取账户余额", notes = "获取账户余额")
public Result<FinanceCustomerAssetsDto> getCashOutAccountMoney(HttpServletRequest requset) throws Exception {
Result<FinanceCustomerAssetsDto> result = new Result<>();
//requset.getSession().getAttribute(""); //从session中获取商城用户的 id,和企业资产账户id
Map map = new HashMap();
map.put("assetsId", 1); //企业资产账户id
map.put("departmentId", 1); //企业ID
FinanceCustomerAssetsDto dto = financeTradeFlowService.queryAccountMoneyByMap(map);
result.setData(dto);
return result;
}
/**
* 是否存在提现为审核接口
*
* @author Bellamy
* @since 2020-12-03
*/
@GetMapping(value = "/cashOutAuditStutas")
@ApiOperation(value = "提现----是否存在提现为审核接口", notes = "获取可提现金额")
public Result<Object> getCashOutAuditStutas(HttpServletRequest requset) throws Exception {
Result<Object> result = new Result<>();
//requset.getSession().getAttribute(""); //从session中获取商城用户的 id,和企业资产账户id
Map map = new HashMap();
map.put("assetsId", 1); //企业资产账户id
map.put("departmentId", 1); //企业ID
FinanceCashOutDto dto = financeTradeFlowService.getCashOutAuditStutas(map);
if(dto.getCashOutMoney() != null){
result.setData(dto.getCashOutMoney());
result.setMessage("存在提现审核记录!");
} else {
result.setMessage("不存在!");
}
return result;
}
/**
* 保存提现金额
*
* @author Bellamy
* @since 2020-12-03
*/
@PostMapping(value = "/addCashOutMoney")
@ApiOperation(value = "提现----保存提现金额", notes = "保存提现金额")
public Result<Object> addCashOutMoney(@RequestBody FinanceCashOutRequest financeCashOutRequest, HttpServletRequest requset) throws Exception {
if(financeCashOutRequest.getCashOutMoney() == null){ //提现金额
return Result.error("参数不能为空!");
}
Result<Object> result = financeTradeFlowService.addCashOutMoney(financeCashOutRequest);
return result;
}
/**
* 订单管理列表(分页查询)
*
* @author Bellamy
*/
/*@PostMapping(value = "/list")
@ApiOperation(value = "订单管理列表(分页查询)", notes = "订单列表(分页查询)")
public PageInfoResponse<FinanceTradeFlow> queryPageList(HttpServletRequest req) throws Exception {
PageInfoResponse<FinanceTradeFlow> pageInfo = new PageInfoResponse<FinanceTradeFlow>();
Map map = new HashMap();
try {
pageInfo = financeTradeFlowService.findListTradeFlow(map,req);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}*/
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.finance.bean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 商城企业客户资产(TFinanceCustomerAssets)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:38
*/
@ApiModel
public class CustomerAssetsRequest implements Serializable {
private static final long serialVersionUID = -86484762300825431L;
/**
* 资产id
*/
@TableId(value = "assets_id",type = IdType.AUTO)
@ApiModelProperty(value = "资产id")
private Long assetsId;
/**
* 企业id
*/
@ApiModelProperty(value = "企业id")
private Long departmentId;
/**
* 可用金额
*/
@ApiModelProperty(value = "可用金额")
private BigDecimal useMoney;
/**
* 冻结金额
*/
@ApiModelProperty(value = "冻结金额")
private BigDecimal frozenMoney;
/**
* 总金额
*/
@ApiModelProperty(value = "总金额")
private BigDecimal totalMoney;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date uptTime;
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private String uptPerson;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
public Long getAssetsId() {
return assetsId;
}
public void setAssetsId(Long assetsId) {
this.assetsId = assetsId;
}
public Long getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Long departmentId) {
this.departmentId = departmentId;
}
public BigDecimal getUseMoney() {
return useMoney;
}
public void setUseMoney(BigDecimal useMoney) {
this.useMoney = useMoney;
}
public BigDecimal getFrozenMoney() {
return frozenMoney;
}
public void setFrozenMoney(BigDecimal frozenMoney) {
this.frozenMoney = frozenMoney;
}
public BigDecimal getTotalMoney() {
return totalMoney;
}
public void setTotalMoney(BigDecimal totalMoney) {
this.totalMoney = totalMoney;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.finance.bean;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 提现申请(TFinanceCashOut)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:37
*/
@ApiModel
public class FinanceCashOutDto implements Serializable {
private static final long serialVersionUID = 584623943576096734L;
/**
* 提现id
*/
private Long cashOutId;
/**
* 资产id
*/
private Long assetsId;
/**
* 提现金额
*/
private BigDecimal cashOutMoney;
/**
* 提现时间
*/
private Date cashOutTime;
/**
* 审核时间
*/
private Date auditTime;
/**
* 审核人
*/
private String auditPerson;
/**
* 驳回原因
*/
private String rejectReason;
/**
* 付款时间
*/
private Date payTime;
/**
* 付款人
*/
private String payPerson;
/**
* 备注
*/
private String remark;
/**
* 审核状态:01待审核,02审核通过,03未通过
*/
private String auditStatus;
/**
* 创建人
*/
private String crePerson;
/**
* 创建时间
*/
private Date creTime;
/**
* 删除标识
*/
private String delFlag;
public Long getCashOutId() {
return cashOutId;
}
public void setCashOutId(Long cashOutId) {
this.cashOutId = cashOutId;
}
public Long getAssetsId() {
return assetsId;
}
public void setAssetsId(Long assetsId) {
this.assetsId = assetsId;
}
public BigDecimal getCashOutMoney() {
return cashOutMoney;
}
public void setCashOutMoney(BigDecimal cashOutMoney) {
this.cashOutMoney = cashOutMoney;
}
public Date getCashOutTime() {
return cashOutTime;
}
public void setCashOutTime(Date cashOutTime) {
this.cashOutTime = cashOutTime;
}
public Date getAuditTime() {
return auditTime;
}
public void setAuditTime(Date auditTime) {
this.auditTime = auditTime;
}
public String getAuditPerson() {
return auditPerson;
}
public void setAuditPerson(String auditPerson) {
this.auditPerson = auditPerson;
}
public String getRejectReason() {
return rejectReason;
}
public void setRejectReason(String rejectReason) {
this.rejectReason = rejectReason;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public String getPayPerson() {
return payPerson;
}
public void setPayPerson(String payPerson) {
this.payPerson = payPerson;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.finance.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 提现申请(TFinanceCashOut)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:37
*/
@ApiModel(value = "接口请求参数对象", description = "接口请求参数对象")
public class FinanceCashOutRequest implements Serializable {
private static final long serialVersionUID = 584623943576096734L;
/**
* 资产id
*/
@ApiModelProperty(value = "企业资产id")
private Long assetsId;
/**
* 提现金额
*/
@ApiModelProperty(value = "提现金额")
private BigDecimal cashOutMoney;
/**
* 备注
*/
@ApiModelProperty(value = "提现备注")
private String remark;
public Long getAssetsId() {
return assetsId;
}
public void setAssetsId(Long assetsId) {
this.assetsId = assetsId;
}
public BigDecimal getCashOutMoney() {
return cashOutMoney;
}
public void setCashOutMoney(BigDecimal cashOutMoney) {
this.cashOutMoney = cashOutMoney;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.finance.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 企业客户充值记录(TFinanceCustomerBalance)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:38
*/
@ApiModel
public class FinanceCustomerBalanceRequest implements Serializable {
private static final long serialVersionUID = -13102196689933511L;
/**
* 企业客户资产id
*/
@ApiModelProperty(value = "企业客户资产id")
private Long assetsId;
/**
* 充值金额
*/
@ApiModelProperty(value = "充值金额")
private BigDecimal balanceMoney;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
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;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 提现申请(TFinanceCashOut)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:37
*/
@TableName("t_finance_cash_out")
@ApiModel
public class FinanceCashOut implements Serializable {
private static final long serialVersionUID = 584623943576096734L;
/**
* 提现id
*/
private Long cashOutId;
/**
* 资产id
*/
private Long assetsId;
/**
* 提现金额
*/
private BigDecimal cashOutMoney;
/**
* 提现时间
*/
private Date cashOutTime;
/**
* 审核时间
*/
private Date auditTime;
/**
* 审核人
*/
private String auditPerson;
/**
* 驳回原因
*/
private String rejectReason;
/**
* 付款时间
*/
private Date payTime;
/**
* 付款人
*/
private String payPerson;
/**
* 备注
*/
private String remark;
/**
* 审核状态:01待审核,02审核通过,03未通过
*/
private String auditStatus;
/**
* 创建人
*/
private String crePerson;
/**
* 创建时间
*/
private Date creTime;
/**
* 删除标识
*/
private String delFlag;
public Long getCashOutId() {
return cashOutId;
}
public void setCashOutId(Long cashOutId) {
this.cashOutId = cashOutId;
}
public Long getAssetsId() {
return assetsId;
}
public void setAssetsId(Long assetsId) {
this.assetsId = assetsId;
}
public BigDecimal getCashOutMoney() {
return cashOutMoney;
}
public void setCashOutMoney(BigDecimal cashOutMoney) {
this.cashOutMoney = cashOutMoney;
}
public Date getCashOutTime() {
return cashOutTime;
}
public void setCashOutTime(Date cashOutTime) {
this.cashOutTime = cashOutTime;
}
public Date getAuditTime() {
return auditTime;
}
public void setAuditTime(Date auditTime) {
this.auditTime = auditTime;
}
public String getAuditPerson() {
return auditPerson;
}
public void setAuditPerson(String auditPerson) {
this.auditPerson = auditPerson;
}
public String getRejectReason() {
return rejectReason;
}
public void setRejectReason(String rejectReason) {
this.rejectReason = rejectReason;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public String getPayPerson() {
return payPerson;
}
public void setPayPerson(String payPerson) {
this.payPerson = payPerson;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
......@@ -23,8 +23,8 @@ public class FinanceCustomerAssets implements Serializable {
/**
* 资产id
*/
@TableId(value = "customer_id",type = IdType.AUTO)
@ApiModelProperty(value = "企业id")
@TableId(value = "assets_id",type = IdType.AUTO)
@ApiModelProperty(value = "资产id")
private Long assetsId;
/**
* 企业id
......@@ -71,6 +71,11 @@ public class FinanceCustomerAssets implements Serializable {
*/
@ApiModelProperty(value = "删除标识")
private String delFlag;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
public Long getAssetsId() {
......@@ -153,4 +158,11 @@ public class FinanceCustomerAssets implements Serializable {
this.delFlag = delFlag;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 企业客户充值记录(TFinanceCustomerBalance)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:38
*/
@TableName("t_finance_customer_balance")
@ApiModel
public class FinanceCustomerBalance implements Serializable {
private static final long serialVersionUID = -13102196689933511L;
/**
* 充值id
*/
private Long customerBalanceId;
/**
* 企业客户资产id
*/
private Long assetsId;
/**
* 充值金额
*/
private BigDecimal balanceMoney;
/**
* 备注
*/
private String remark;
/**
* 创建时间
*/
private Date creTime;
/**
* 创建人
*/
private String crePerson;
/**
* 删除标识
*/
private String delFlag;
/**
* 审核状态:01待审核,02审核通过,03未通过
*/
private String auditStatus;
/**
* 审核意见
*/
private String rejectReason;
public Long getCustomerBalanceId() {
return customerBalanceId;
}
public void setCustomerBalanceId(Long customerBalanceId) {
this.customerBalanceId = customerBalanceId;
}
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;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
public String getRejectReason() {
return rejectReason;
}
public void setRejectReason(String rejectReason) {
this.rejectReason = rejectReason;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.entity.FinanceCustomerAssets;
import com.jz.dm.mall.moduls.entity.FinanceCustomerBalance;
/**
* 商城企业客户资产(TFinanceCustomerAssets)表数据库访问层
......@@ -12,4 +12,7 @@ import com.jz.dm.mall.moduls.entity.FinanceCustomerAssets;
*/
public interface FinanceCustomerAssetsDao extends BaseMapper<FinanceCustomerAssets> {
int uptAccountMoney(FinanceCustomerAssets financeCustomerAssets) throws Exception;
int addCoustomerCzMoney(FinanceCustomerBalance financeCustomerBalance) throws Exception;
}
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCashOutDto;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto;
import com.jz.dm.mall.moduls.entity.FinanceCashOut;
import com.jz.dm.mall.moduls.entity.FinanceTradeFlow;
import java.util.List;
import java.util.Map;
/**
......@@ -16,5 +19,9 @@ import java.util.Map;
public interface FinanceTradeFlowDao extends BaseMapper<FinanceTradeFlow> {
FinanceCustomerAssetsDto queryAccountMoneyByMap(Map map) throws Exception ;
FinanceCustomerAssetsDto queryAccountMoneyByMap(Map map) throws Exception;
List<FinanceCashOutDto> getCashOutAuditStutas(Map map) throws Exception;
int addCashOutMoney(FinanceCashOut financeCashOut) throws Exception;
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCashOutDto;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCashOutRequest;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerBalanceRequest;
import java.util.Map;
......@@ -13,5 +17,11 @@ import java.util.Map;
public interface FinanceTradeFlowService {
FinanceCustomerAssetsDto queryAccountMoneyByMap(Map map) throws Exception ;
FinanceCustomerAssetsDto queryAccountMoneyByMap(Map map) throws Exception;
Boolean uptAccountMoney(FinanceCustomerBalanceRequest financeCustomerBalanceRequest) throws Exception;
FinanceCashOutDto getCashOutAuditStutas(Map map) throws Exception;
Result<Object> addCashOutMoney(FinanceCashOutRequest financeCashOutRequest) throws Exception;
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.enums.AuditStatusEnum;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCashOutDto;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCashOutRequest;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto;
import com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerBalanceRequest;
import com.jz.dm.mall.moduls.entity.FinanceCashOut;
import com.jz.dm.mall.moduls.entity.FinanceCustomerAssets;
import com.jz.dm.mall.moduls.entity.FinanceCustomerBalance;
import com.jz.dm.mall.moduls.mapper.FinanceCustomerAssetsDao;
import com.jz.dm.mall.moduls.mapper.FinanceTradeFlowDao;
import com.jz.dm.mall.moduls.service.FinanceTradeFlowService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -15,13 +30,105 @@ import java.util.Map;
* @since 2020-12-01 10:41:39
*/
@Service("financeTradeFlowService")
@Transactional
public class FinanceTradeFlowServiceImpl implements FinanceTradeFlowService {
@Autowired
private FinanceTradeFlowDao financeTradeFlowDao;
@Autowired
private FinanceCustomerAssetsDao financeCustomerAssetsDao;
@Override
public FinanceCustomerAssetsDto queryAccountMoneyByMap(Map map) throws Exception {
return financeTradeFlowDao.queryAccountMoneyByMap(map);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean uptAccountMoney(FinanceCustomerBalanceRequest customerBalanceRequest) throws Exception {
//1.充值记录表中加数据
FinanceCustomerBalance financeCustomerBalance = new FinanceCustomerBalance();
financeCustomerBalance.setAssetsId(customerBalanceRequest.getAssetsId());//企业资产id
financeCustomerBalance.setBalanceMoney(customerBalanceRequest.getBalanceMoney()); //充值金额
//financeCustomerBalance.setCrePerson();
financeCustomerBalance.setCreTime(new Date());
financeCustomerBalance.setAuditStatus("01"); //待审核
financeCustomerBalance.setRemark(customerBalanceRequest.getRemark()); //备注
int len = financeCustomerAssetsDao.addCoustomerCzMoney(financeCustomerBalance);
/* //2.更新企业资产账户
int len = financeCustomerAssetsDao.uptAccountMoney(financeCustomerBalanceRequest);
//3.在流水记录中添加数据*/
return len > 0;
}
@Override
public FinanceCashOutDto getCashOutAuditStutas(Map map) throws Exception {
//查询当前企业账户,存在的提现未审核的记录
BigDecimal auditMoney = new BigDecimal("0");
List<FinanceCashOutDto> list = financeTradeFlowDao.getCashOutAuditStutas(map);
if (list.size() > 0 && list != null) {
for (FinanceCashOutDto dto : list) {
auditMoney = auditMoney.add(new BigDecimal(dto.getCashOutMoney().toString())); //累加提现待审核 金额
}
}
FinanceCashOutDto returnDto = new FinanceCashOutDto();
returnDto.setCashOutMoney(auditMoney);
return returnDto;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> addCashOutMoney(FinanceCashOutRequest financeCashOutRequest) throws Exception {
Result<Object> result = new Result<>();
Long assetId = financeCashOutRequest.getAssetsId(); // 企业资产id
BigDecimal cashOutMoney = new BigDecimal(financeCashOutRequest.getCashOutMoney().toString()); //提现金额
FinanceCashOut financeCashOut = new FinanceCashOut();
BeanUtils.copyProperties(financeCashOutRequest, financeCashOut);
financeCashOut.setCreTime(new Date()); //创建时间
financeCashOut.setCashOutTime(new Date()); //提现时间
financeCashOut.setAuditStatus(AuditStatusEnum.DSH.getValue()); //待审核
//financeCashOut.setCrePerson();
//添加一条提现记录
int len = financeTradeFlowDao.addCashOutMoney(financeCashOut);
if (len == 0) {
result.setMessage("提交失败!");
result.setCode(500);
return result;
}
// 查询 当前企业 可用余额 冻结金额
Map map = new HashMap();
map.put("assetId", assetId);
FinanceCustomerAssetsDto dto = financeTradeFlowDao.queryAccountMoneyByMap(map);
BigDecimal useMoney = new BigDecimal(dto.getUseMoney().toString()); //可用金额
if (useMoney != null && cashOutMoney != null) {
if (useMoney.compareTo(cashOutMoney) > -1) { //可用大于等于提现
useMoney = useMoney.subtract(cashOutMoney); //可用 减去 提现
BigDecimal djMoney = new BigDecimal(dto.getFrozenMoney().toString()); //冻结金额
djMoney = djMoney.add(cashOutMoney); //累计冻结金额
//修改企业资产 金额
FinanceCustomerAssets assets = new FinanceCustomerAssets();
assets.setUptTime(new Date());
//assets.setUptPerson();
assets.setUseMoney(useMoney);
assets.setFrozenMoney(djMoney);
assets.setAssetsId(assetId);
int lens = financeCustomerAssetsDao.uptAccountMoney(assets);
if (lens == 0) {
result.setMessage("提交失败!");
result.setCode(500);
return result;
}
} else {
result.setMessage("提交失败!");
result.setCode(500);
return result;
}
}
return result;
}
}
\ No newline at end of file
......@@ -127,4 +127,32 @@
delete from t_finance_customer_assets where assets_id = #{assetsId}
</delete>
<update id="uptAccountMoney" parameterType="com.jz.dm.mall.moduls.entity.FinanceCustomerAssets">
update t_finance_customer_assets
<set>
<if test="useMoney != null">
use_money = #{useMoney},
</if>
<if test="totalMoney != null">
total_money = #{totalMoney},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="uptPerson != null and uptPerson != ''">
upt_person = #{uptPerson},
</if>
<if test="remark != null">
remark = #{remark},
</if>
</set>
where assets_id = #{assetsId}
</update>
<!--添加一条充值记录-->
<insert id="addCoustomerCzMoney" keyProperty="cashOutId" useGeneratedKeys="true">
insert into t_finance_customer_balance(assets_id, balance_money, remark, cre_time, cre_person, audit_status)
values (#{assetsId}, #{balanceMoney}, #{remark}, #{creTime}, #{crePerson}, #{auditStatus})
</insert>
</mapper>
\ No newline at end of file
......@@ -3,18 +3,36 @@
<mapper namespace="com.jz.dm.mall.moduls.mapper.FinanceTradeFlowDao">
<!--商城 充值 只有已审核(认证)企业-->
<select id="queryAccountMoneyByMap" resultType="com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto" parameterType="map">
<select id="queryAccountMoneyByMap"
resultType="com.jz.dm.mall.moduls.controller.finance.bean.FinanceCustomerAssetsDto" parameterType="map">
select
assets_id as assetsId,
department_id as departmentId,
use_money as useMoney,
frozen_money as frozenMoney,
total_money as totalMoney
t.assets_id as assetsId,
t.department_id as departmentId,
t.use_money as useMoney,
t.frozen_money as frozenMoney,
t.total_money as totalMoney
from t_finance_customer_assets t
left join t_department t1 on t.department_id=t1.department_id and t1.audit_status='02'
where 1=1
<if test="assetsId != null">and assets_id = #{assetsId}</if>
<if test="departmentId != null">and department_id = #{departmentId}</if>
<if test="assetsId != null">and t.assets_id = #{assetsId}</if>
<if test="departmentId != null">and t.department_id = #{departmentId}</if>
</select>
<select id="getCashOutAuditStutas" resultType="com.jz.dm.mall.moduls.controller.finance.bean.FinanceCashOutDto"
parameterType="map">
select
assets_id as assetsId,
cash_out_money as cashOutMoney,
audit_status as auditStatus
from t_finance_cash_out
where 1=1 and audit_status ='01' and assets_id = #{assetsId}
</select>
<insert id="addCashOutMoney" keyProperty="customerBalanceId" useGeneratedKeys="true">
insert into t_finance_cash_out(assets_id, cash_out_money, cash_out_time, audit_time, audit_person,
reject_reason, pay_time, pay_person, remark, audit_status, cre_person, cre_time, del_flag)
values (#{assetsId}, #{cashOutMoney}, #{cashOutTime}, #{auditTime}, #{auditPerson}, #{rejectReason},
#{payTime}, #{payPerson}, #{remark}, #{auditStatus}, #{crePerson}, #{creTime}, #{delFlag})
</insert>
</mapper>
\ No newline at end of file
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