提交 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);
}
......@@ -9,6 +9,7 @@ import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.model.*;
import com.clx.performance.param.pc.*;
import com.clx.performance.service.OwnerAccountService;
import com.clx.performance.struct.OwnerAccountStruct;
import com.clx.performance.utils.excel.ExcelData;
import com.clx.performance.utils.excel.ExcelField;
import com.clx.performance.utils.excel.ExcelSheet;
......@@ -31,7 +32,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@Slf4j
......@@ -55,6 +58,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
private final OwnerBindCardRecordDao ownerBindCardRecordDao;
private final OwnerAccountStruct ownerAccountStruct;
@Override
public IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param) {
return ownerAccountDao.pageList(param);
......@@ -72,7 +77,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
@Override
public List<OwnerAccountVO> accountInfo(Long ownerUserNo) {
return ownerAccountDao.accountInfo(ownerUserNo);
return ownerAccountStruct.convertList(ownerAccountDao.accountInfo(ownerUserNo));
}
@Override
......@@ -95,12 +100,28 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
@Override
@Transactional(rollbackFor = Exception.class)
public Long accountCaseOut(OwnerCaseOutParam param) {
BigDecimal caseOutBalance = param.getCaseOutBalance();
LocalDateTime now = LocalDateTime.now();
while (true) {
//冻结账户可用金额
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(param.getOwnerUserNo(), param.getAccountType());
OwnerAccount update = new OwnerAccount();
update.setUsableBalance(caseOutBalance.negate());
update.setFrozenBalance(caseOutBalance);
update.setModifyTime(account.getModifyTime());
update.setId(account.getId());
int flag = ownerAccountDao.updateAccount(update, now);
if (flag > 0) {
break;
}
}
//提现记录
OwnerCaseOut entity = new OwnerCaseOut();
entity.setAccountType(param.getAccountType());
entity.setCaseOutNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.CASE_OUT.getCode()));
entity.setOwnerUserNo(param.getOwnerUserNo());
entity.setCaseOutBalance(param.getCaseOutBalance());
entity.setStatus(OwnerAccountEnum.CaseOutStatus.PENDING_PAYMENT.getCode());
entity.setCaseOutBank(param.getCaseOutBank());
entity.setCaseOutBankNumber(param.getCaseOutBankNumber());
......@@ -108,7 +129,6 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
ownerCaseOutDao.saveEntity(entity);
//插入冻结流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
BigDecimal caseOutBalance = param.getCaseOutBalance();
runningWaterRecord.setOwnerName("测试");
runningWaterRecord.setMobile("11111111111");
runningWaterRecord.setCreateBy("操作人测试");
......@@ -119,13 +139,6 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
runningWaterRecord.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
runningWaterRecord.setRunningWaterNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.CASE_OUT_FROZEN.getCode()));
ownerRunningWaterRecordDao.saveEntity(runningWaterRecord);
//冻结账户可用金额
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(param.getOwnerUserNo(), param.getAccountType());
OwnerAccount update = new OwnerAccount();
update.setUsableBalance(account.getUsableBalance().subtract(caseOutBalance));
update.setFrozenBalance(account.getFrozenBalance().add(caseOutBalance));
update.setId(account.getId());
ownerAccountDao.updateEntityByKey(update);
return entity.getCaseOutNo();
}
......@@ -148,12 +161,27 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
entity.setStatus(OwnerAccountEnum.TopUpStatus.APPROVAL_REJECTION.getCode());
ownerTopUpDao.updateEntityByKey(entity);
} else {
//给对应账户增加金额
BigDecimal topUpBalance = ownerTopUp.getTopUpBalance();
LocalDateTime now = LocalDateTime.now();
while (true) {
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(param.getOwnerUserNo(), param.getAccountType());
OwnerAccount update = new OwnerAccount();
update.setAccountBalance(topUpBalance);
update.setUsableBalance(topUpBalance);
update.setId(account.getId());
update.setModifyTime(account.getModifyTime());
int flag = ownerAccountDao.updateAccount(update, now);
if (flag > 0) {
break;
}
}
entity.setId(param.getId());
entity.setStatus(OwnerAccountEnum.TopUpStatus.APPROVAL_APPROVE.getCode());
ownerTopUpDao.updateEntityByKey(entity);
//需要插入充值流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
BigDecimal topUpBalance = ownerTopUp.getTopUpBalance();
runningWaterRecord.setOwnerName("测试");
runningWaterRecord.setMobile("11111111111");
runningWaterRecord.setCreateBy("操作人测试");
......@@ -166,14 +194,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
runningWaterRecord.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.TOP_UP.getCode());
runningWaterRecord.setRunningWaterNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.TOP_UP_SUCCESS.getCode()));
ownerRunningWaterRecordDao.saveEntity(runningWaterRecord);
//给对应账户增加金额
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(param.getOwnerUserNo(), param.getAccountType());
OwnerAccount update = new OwnerAccount();
update.setAccountBalance(account.getAccountBalance().add(topUpBalance));
update.setUsableBalance(account.getUsableBalance().add(topUpBalance));
update.setId(account.getId());
ownerAccountDao.updateEntityByKey(update);
}
}
......@@ -206,6 +227,16 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
if (platformPayBalance.compareTo(caseOutBalance) != 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "货主提现金额和平台支付金额不一致");
}
//给对应账户减少金额
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(ownerCaseOut.getOwnerUserNo(), ownerCaseOut.getAccountType());
OwnerAccount update = new OwnerAccount();
update.setAccountBalance(account.getAccountBalance().subtract(caseOutBalance));
update.setUsableBalance(account.getUsableBalance().subtract(caseOutBalance));
update.setFrozenBalance(account.getFrozenBalance().subtract(caseOutBalance));
update.setId(account.getId());
ownerAccountDao.updateEntityByKey(update);
//插入提现成功流水
OwnerRunningWaterRecord runningWaterRecord = new OwnerRunningWaterRecord();
runningWaterRecord.setOwnerName("测试");
......@@ -220,15 +251,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
runningWaterRecord.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.CASE_OUT_SUCCESS.getCode());
runningWaterRecord.setRunningWaterNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.CASE_OUT_SUCCESS.getCode()));
ownerRunningWaterRecordDao.saveEntity(runningWaterRecord);
//给对应账户减少金额
OwnerAccount account = ownerAccountDao.getAccountByOwnerUserNoAndAccountType(ownerCaseOut.getOwnerUserNo(), ownerCaseOut.getAccountType());
OwnerAccount update = new OwnerAccount();
update.setAccountBalance(account.getAccountBalance().subtract(caseOutBalance));
update.setUsableBalance(account.getUsableBalance().subtract(caseOutBalance));
update.setFrozenBalance(account.getFrozenBalance().subtract(caseOutBalance));
update.setId(account.getId());
ownerAccountDao.updateEntityByKey(update);
}
@Override
......@@ -377,6 +400,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
record.setOwnerBank(param.getOwnerAccountBank());
record.setOpenAccountBank(param.getOwnerAccountBank());
record.setAccountBankName(param.getOwnerAccountName());
record.setBankCardNumber(param.getOwnerBankAccount());
record.setCreateBy("曹做人");
ownerBindCardRecordDao.saveEntity(record);
}
......@@ -395,4 +419,90 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
ownerInfoFeign.unBindOwnerBindCard(param);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void ownerAccountFrozen(Long ownerUserNo) {
String mobile = "";
String ownerName = "";
BigDecimal frozenBalance = new BigDecimal(12);
BigDecimal ensureBalance = new BigDecimal(14);
Integer orderId = 9;
String orderNo = "123";
LocalDateTime now = LocalDateTime.now();
//List<OwnerAccount> updateList = new LinkedList<>();
while (true) {
int flag = 0;
//updateList.clear();
List<OwnerAccount> accountList = ownerAccountDao.accountInfo(ownerUserNo);
for (OwnerAccount ownerAccount : accountList) {
OwnerAccount entity = new OwnerAccount();
entity.setAccountType(ownerAccount.getAccountType());
entity.setId(ownerAccount.getId());
entity.setModifyTime(ownerAccount.getModifyTime());
if (ownerAccount.getAccountType().equals(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode())) {
if (ownerAccount.getUsableBalance().compareTo(frozenBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主保证金账户可用余额不够冻结");
}
//冻结金额
entity.setFrozenBalance(ownerAccount.getFrozenBalance().subtract(frozenBalance));
//可用余额
entity.setUsableBalance(ownerAccount.getUsableBalance().subtract(frozenBalance));
//updateList.add(entity);
flag += ownerAccountDao.updateAccount(entity, now);
} else {
if (ownerAccount.getUsableBalance().compareTo(ensureBalance) < 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主预付运费账户可用余额不够冻结");
}
//冻结金额
entity.setFrozenBalance(ownerAccount.getFrozenBalance().subtract(ensureBalance));
//可用余额
entity.setUsableBalance(ownerAccount.getUsableBalance().subtract(ensureBalance));
//updateList.add(entity);
flag += ownerAccountDao.updateAccount(entity, now);
}
}
if (flag == 2) {
break;
}
}
//插入保证金冻结流水
OwnerRunningWaterRecord marginAccount = new OwnerRunningWaterRecord();
marginAccount.setOwnerName(ownerName);
marginAccount.setMobile(mobile);
marginAccount.setCreateBy("操作人");
marginAccount.setOrderId(orderId);
marginAccount.setOrderNo(orderNo);
marginAccount.setRelationId(null);
marginAccount.setAccountBalance(ensureBalance);
marginAccount.setOwnerUserNo(ownerUserNo);
marginAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode());
marginAccount.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
marginAccount.setRunningWaterNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.FROZEN.getCode()));
ownerRunningWaterRecordDao.saveEntity(marginAccount);
//插入预付运费冻结流水
OwnerRunningWaterRecord prepaidFreight = new OwnerRunningWaterRecord();
prepaidFreight.setOwnerName(ownerName);
prepaidFreight.setMobile(mobile);
prepaidFreight.setCreateBy("操作人");
prepaidFreight.setOrderId(orderId);
prepaidFreight.setOrderNo(orderNo);
prepaidFreight.setRelationId(null);
prepaidFreight.setAccountBalance(frozenBalance);
prepaidFreight.setOwnerUserNo(ownerUserNo);
prepaidFreight.setAccountType(OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode());
prepaidFreight.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
prepaidFreight.setRunningWaterNo(idGenerateSnowFlake.nextId(IdTypeEnum.Type.FROZEN.getCode()));
ownerRunningWaterRecordDao.saveEntity(prepaidFreight);
}
}
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论