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

资金管理

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