提交 5b79fb68 authored 作者: huyufan's avatar huyufan

资金管理

上级 65d99db5
......@@ -17,6 +17,7 @@ public enum IdTypeEnum {
CASE_OUT_FROZEN(3L, "提现冻结"),
CASE_OUT_SUCCESS(4L, "提现成功"),
TOP_UP_SUCCESS(5L, "充值成功"),
FROZEN(6L, "冻结")
;
private final Long code;
private final String msg;
......
......@@ -14,5 +14,5 @@ import lombok.Setter;
public class PageOwnerBindCardRecordListParam extends PageParam {
@ApiModelProperty(value = "货主用户编码")
private Long ownerUserNo;
private Long userNo;
}
......@@ -23,5 +23,5 @@ public class PageOwnerCaseOutListParam extends PageParam {
private Integer accountType;
@ApiModelProperty(value = "货主用户编码")
private Long ownerUserNo;
private Long userNo;
}
......@@ -23,5 +23,5 @@ public class PageOwnerTopUpListParam extends PageParam {
private Integer accountType;
@ApiModelProperty(value = "货主用户编码")
private Long ownerUserNo;
private Long userNo;
}
......@@ -67,4 +67,7 @@ public class OwnerAccountVO {
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "修改时间")
private LocalDateTime modifyTime;
}
\ No newline at end of file
......@@ -11,6 +11,8 @@ import com.clx.user.vo.pc.owner.OwnerBindCardVO;
import com.msl.common.base.PageData;
import com.msl.common.convertor.aspect.UnitCovert;
import com.msl.common.result.Result;
import com.msl.user.data.UserSessionData;
import com.msl.user.utils.TokenUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
......@@ -48,8 +50,9 @@ public class OwnerAccountController {
@ApiOperation(value = "账户信息", notes = "<br>By:胡宇帆")
@GetMapping("/accountInfo")
@UnitCovert(param = false)
public Result<List<OwnerAccountVO>> accountInfo(@RequestParam Long ownerUserNo) {
List<OwnerAccountVO> accountVOList = ownerAccountService.accountInfo(ownerUserNo);
public Result<List<OwnerAccountVO>> accountInfo() {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
List<OwnerAccountVO> accountVOList = ownerAccountService.accountInfo(loginUserInfo.getUserNo());
return Result.ok(accountVOList);
}
......@@ -57,6 +60,8 @@ public class OwnerAccountController {
@PostMapping("/ownerTopUpPageList")
@UnitCovert(param = false)
public Result<PageData<OwnerTopUpVO>> ownerTopUpPageList(@RequestBody PageOwnerTopUpListParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setUserNo(loginUserInfo.getUserNo());
IPage<OwnerTopUpVO> page = ownerTopUpService.ownerTopUpPageList(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
......@@ -65,6 +70,8 @@ public class OwnerAccountController {
@PostMapping("/ownerCaseOutPageList")
@UnitCovert(param = false)
public Result<PageData<OwnerCaseOutVO>> ownerCaseOutPageList(@RequestBody PageOwnerCaseOutListParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setUserNo(loginUserInfo.getUserNo());
IPage<OwnerCaseOutVO> page = ownerCaseOutService.ownerCaseOutPageList(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
......@@ -74,6 +81,9 @@ public class OwnerAccountController {
@PostMapping("/accountTopUp")
@UnitCovert(param = false)
public Result<Long> accountTopUp(@RequestBody OwnerTopUpParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setOwnerUserNo(loginUserInfo.getUserNo());
Long id = ownerAccountService.accountTopUp(param);
return Result.ok(id);
}
......@@ -82,6 +92,9 @@ public class OwnerAccountController {
@PostMapping("/accountCaseOut")
@UnitCovert(param = false)
public Result<Long> accountCaseOut(@RequestBody OwnerCaseOutParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setOwnerUserNo(loginUserInfo.getUserNo());
Long id = ownerAccountService.accountCaseOut(param);
return Result.ok(id);
}
......@@ -118,13 +131,18 @@ public class OwnerAccountController {
@ApiOperation(value = "获取货主信息绑卡信息", notes = "<br>By:胡宇帆")
@GetMapping("/getOwnerBindCard")
public Result<OwnerBindCardVO> getOwnerBindCard(@RequestParam("userNo") @NotNull(message = "userNo不能为空") Long userNo) {
return Result.ok(ownerAccountService.getOwnerBindCard(userNo));
public Result<OwnerBindCardVO> getOwnerBindCard() {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
return Result.ok(ownerAccountService.getOwnerBindCard(loginUserInfo.getUserNo()));
}
@ApiOperation(value = "绑定货主银行卡")
@PostMapping({"/bindOwnerBindCard"})
Result<Object> bindOwnerBindCard(@RequestBody UpdateOwnerBindCardFeignParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setUserNo(loginUserInfo.getUserNo());
param.setName(loginUserInfo.getUserName());
ownerAccountService.bindOwnerBindCard(param);
return Result.ok();
}
......@@ -132,6 +150,9 @@ public class OwnerAccountController {
@ApiOperation(value = "解绑货主银行卡")
@PostMapping({"/unBindOwnerBindCard"})
Result<Object> unBindOwnerBindCard(@RequestBody UpdateOwnerBindCardFeignParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setUserNo(loginUserInfo.getUserNo());
param.setName(loginUserInfo.getUserName());
ownerAccountService.unBindOwnerBindCard(param);
return Result.ok();
}
......@@ -140,7 +161,18 @@ public class OwnerAccountController {
@PostMapping("/ownerBindCardPageList")
@UnitCovert(param = false)
public Result<PageData<OwnerBindCardRecordVO>> ownerBindCardPageList(@RequestBody PageOwnerBindCardRecordListParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
param.setUserNo(loginUserInfo.getUserNo());
IPage<OwnerBindCardRecordVO> page = ownerBindCardRecordService.ownerBindCardPageList(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
@ApiOperation(value = "冻结保证金", notes = "<br>By:胡宇帆")
@PostMapping("/ownerBindCardPageList11")
public Result<Object> ownerAccountFrozen(Long ownerUserNo) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
ownerAccountService.ownerAccountFrozen(ownerUserNo);
return Result.ok();
}
}
......@@ -7,12 +7,15 @@ import com.clx.performance.param.pc.PageOwnerAccountListParam;
import com.clx.performance.vo.pc.OwnerAccountVO;
import com.msl.common.dao.BaseDao;
import java.time.LocalDateTime;
import java.util.List;
public interface OwnerAccountDao extends BaseDao<OwnerAccountMapper, OwnerAccount, Integer> {
IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param);
List<OwnerAccountVO> accountInfo(Long ownerUserNo);
List<OwnerAccount> accountInfo(Long ownerUserNo);
OwnerAccount getAccountByOwnerUserNoAndAccountType(Long ownerUserNo,Integer accountType);
OwnerAccount getAccountByOwnerUserNoAndAccountType(Long ownerUserNo, Integer accountType);
int updateAccount(OwnerAccount account, LocalDateTime now);
}
......@@ -12,13 +12,12 @@ import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
@Repository
public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAccount, Integer> implements OwnerAccountDao {
@Autowired
private OwnerAccountStruct ownerAccountStruct;
@Override
public IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param) {
......@@ -28,9 +27,9 @@ public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAc
}
@Override
public List<OwnerAccountVO> accountInfo(Long ownerUserNo) {
List<OwnerAccount> list = baseMapper.selectList(lQrWrapper().eq(OwnerAccount::getOwnerUserNo, ownerUserNo));
return ownerAccountStruct.convertList(list);
public List<OwnerAccount> accountInfo(Long ownerUserNo) {
return baseMapper.selectList(lQrWrapper().eq(OwnerAccount::getOwnerUserNo, ownerUserNo));
}
@Override
......@@ -38,5 +37,15 @@ public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAc
return baseMapper.selectOne(lQrWrapper().eq(OwnerAccount::getAccountType, accountType).eq(OwnerAccount::getOwnerUserNo, ownerUserNo));
}
@Override
public int updateAccount(OwnerAccount account, LocalDateTime now) {
return baseMapper.updateAccount(account, now);
// if (flag) {
// baseMapper.addAccount(account, now);
// } else {
// baseMapper.subAccount(account, now);
// }
}
}
......@@ -10,6 +10,9 @@ import com.clx.performance.vo.pc.OwnerAccountVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
import java.time.LocalDateTime;
import java.util.List;
/**
* 货主账户
*/
......@@ -18,4 +21,10 @@ public interface OwnerAccountMapper extends BaseMapper<OwnerAccount> {
@SelectProvider(type = OwnerAccountSqlProvider.class, method = "pageList")
IPage<OwnerAccountVO> pageList(Page<OwnerAccountVO> page, PageOwnerAccountListParam param);
@SelectProvider(type = OwnerAccountSqlProvider.class, method = "updateAccount")
int updateAccount(OwnerAccount account, LocalDateTime now);
// @SelectProvider(type = OwnerAccountSqlProvider.class, method = "subAccount")
// int subAccount(OwnerAccount account, LocalDateTime now);
}
\ No newline at end of file
......@@ -75,6 +75,9 @@ public class OwnerAccount implements HasKey<Integer> {
@TableField("create_time")
private LocalDateTime createTime;
@TableField("modify_time")
private LocalDateTime modifyTime;
@KeyColumn("id")
@Override
public Integer gainKey() {
......
......@@ -62,4 +62,6 @@ public interface OwnerAccountService {
void bindOwnerBindCard(UpdateOwnerBindCardFeignParam param);
void unBindOwnerBindCard(UpdateOwnerBindCardFeignParam param);
void ownerAccountFrozen(Long ownerUserNo);
}
package com.clx.performance.sqlProvider;
import cn.hutool.core.util.ObjectUtil;
import com.clx.order.enums.OrderEnum;
import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.OwnerAccount;
import com.clx.performance.param.pc.PageOwnerAccountListParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
public class OwnerAccountSqlProvider {
public String pageList(@Param("param") PageOwnerAccountListParam param) {
......@@ -30,4 +37,29 @@ public class OwnerAccountSqlProvider {
return sql;
}
public String updateAccount(OwnerAccount account, LocalDateTime now) {
StringBuffer sqlList = new StringBuffer();
sqlList.append("update owner_account set usable_balance = usable_balance +" +
account.getUsableBalance() + ",frozen_balance = frozen_balance +"
+ account.getUsableBalance() + ",account_balance = account_balance +"
+ account.getAccountBalance()+
",modify_time=" + now
+ "where id = " + account.getId() + "and modify_time = " + account.getModifyTime()
);
return sqlList.toString();
}
//
// public String subAccount(OwnerAccount account, LocalDateTime now) {
// StringBuffer sqlList = new StringBuffer();
//
// sqlList.append("update owner_account set usable_balance = usable_balance -" +
// account.getUsableBalance() + ",frozen_balance = frozen_balance -"
// + account.getUsableBalance() + ",modify_time=" + now
// + "where id = " + account.getId() + "and modify_time = " + account.getModifyTime()
// );
//
// return sqlList.toString();
// }
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论