提交 32a101ff authored 作者: huyufan's avatar huyufan

创建账户和冻结保证金接口开发

上级 ad3b1cd9
package com.clx.performance.param.pc.owner;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class CreteAccountParam {
private Long userNo;
private String name;
private String mobile;
}
package com.clx.performance.param.pc.owner;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.math.BigDecimal;
@Getter
@Setter
@NoArgsConstructor
@ToString
public class FrozenAccountParam {
private Long userNo;
private String mobile;
private String ownerName;
private BigDecimal frozenBalance;
private BigDecimal ensureBalance;
private Integer orderId;
private String orderNo;
}
...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.enums.OwnerAccountEnum; import com.clx.performance.enums.OwnerAccountEnum;
import com.clx.performance.model.OwnerTransferInfo; import com.clx.performance.model.OwnerTransferInfo;
import com.clx.performance.param.pc.*; import com.clx.performance.param.pc.*;
import com.clx.performance.param.pc.owner.CreteAccountParam;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.service.*; import com.clx.performance.service.*;
import com.clx.performance.vo.pc.*; import com.clx.performance.vo.pc.*;
import com.clx.user.feign.OwnerInfoFeign; import com.clx.user.feign.OwnerInfoFeign;
...@@ -165,11 +167,16 @@ public class OwnerAccountController { ...@@ -165,11 +167,16 @@ public class OwnerAccountController {
} }
@ApiOperation(value = "冻结保证金", notes = "<br>By:胡宇帆") @ApiOperation(value = "冻结保证金", notes = "<br>By:胡宇帆")
@PostMapping("/ownerBindCardPageList11") @PostMapping("/ownerAccountFrozen")
public Result<Object> ownerAccountFrozen(Long ownerUserNo) { public Result<Object> ownerAccountFrozen(FrozenAccountParam param) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo(); ownerAccountService.ownerAccountFrozen(param);
ownerAccountService.ownerAccountFrozen(ownerUserNo); return Result.ok();
}
@ApiOperation(value = "创建账户", notes = "<br>By:胡宇帆")
@PostMapping("/createAccount")
public Result<Object> createAccount(CreteAccountParam param) {
ownerAccountService.createAccount(param);
return Result.ok(); return Result.ok();
} }
} }
...@@ -43,7 +43,7 @@ public class OwnerAccount implements HasKey<Integer> { ...@@ -43,7 +43,7 @@ public class OwnerAccount implements HasKey<Integer> {
* 联系电话 * 联系电话
*/ */
@TableField("mobile") @TableField("mobile")
private Integer mobile; private String mobile;
/** /**
* 账户类型;1:保证金 2:预付运费 * 账户类型;1:保证金 2:预付运费
*/ */
......
...@@ -3,6 +3,8 @@ package com.clx.performance.service; ...@@ -3,6 +3,8 @@ package com.clx.performance.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.model.OwnerTransferInfo; import com.clx.performance.model.OwnerTransferInfo;
import com.clx.performance.param.pc.*; import com.clx.performance.param.pc.*;
import com.clx.performance.param.pc.owner.CreteAccountParam;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.vo.pc.OwnerAccountRunningWaterRecordVO; import com.clx.performance.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.performance.vo.pc.OwnerAccountVO; import com.clx.performance.vo.pc.OwnerAccountVO;
import com.clx.user.param.pc.owner.UpdateOwnerBindCardFeignParam; import com.clx.user.param.pc.owner.UpdateOwnerBindCardFeignParam;
...@@ -64,5 +66,7 @@ public interface OwnerAccountService { ...@@ -64,5 +66,7 @@ public interface OwnerAccountService {
void unBindOwnerBindCard(OwnerBindCardParam param); void unBindOwnerBindCard(OwnerBindCardParam param);
void ownerAccountFrozen(Long ownerUserNo); void ownerAccountFrozen(FrozenAccountParam param);
void createAccount(CreteAccountParam param);
} }
package com.clx.performance.service.impl; package com.clx.performance.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.component.IdGenerateSnowFlake; import com.clx.performance.component.IdGenerateSnowFlake;
import com.clx.performance.dao.*; import com.clx.performance.dao.*;
...@@ -8,6 +10,8 @@ import com.clx.performance.enums.OwnerAccountEnum; ...@@ -8,6 +10,8 @@ import com.clx.performance.enums.OwnerAccountEnum;
import com.clx.performance.enums.PerformanceResultEnum; import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.model.*; import com.clx.performance.model.*;
import com.clx.performance.param.pc.*; import com.clx.performance.param.pc.*;
import com.clx.performance.param.pc.owner.CreteAccountParam;
import com.clx.performance.param.pc.owner.FrozenAccountParam;
import com.clx.performance.service.OwnerAccountService; import com.clx.performance.service.OwnerAccountService;
import com.clx.performance.struct.OwnerAccountStruct; import com.clx.performance.struct.OwnerAccountStruct;
import com.clx.performance.utils.excel.ExcelData; import com.clx.performance.utils.excel.ExcelData;
...@@ -81,9 +85,9 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -81,9 +85,9 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
List<OwnerAccountVO> list = ownerAccountStruct.convertList(ownerAccountDao.accountInfo(ownerUserNo)); List<OwnerAccountVO> list = ownerAccountStruct.convertList(ownerAccountDao.accountInfo(ownerUserNo));
for (OwnerAccountVO ownerAccountVO : list) { for (OwnerAccountVO ownerAccountVO : list) {
if (OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode().equals(ownerAccountVO.getAccountType())) { if (OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode().equals(ownerAccountVO.getAccountType())) {
result.put(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getMsg(), ownerAccountVO); result.put("marginAccount", ownerAccountVO);
} else { } else {
result.put(OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getMsg(), ownerAccountVO); result.put("prepaidFreightAccount", ownerAccountVO);
} }
} }
return result; return result;
...@@ -399,7 +403,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -399,7 +403,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
if (!result.succeed()) { if (!result.succeed()) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前参数未查询到有效数据"); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前参数未查询到有效数据");
} }
if (result.succeed() && StringUtils.isNotBlank(result.getData().getOwnerAccountBank())) { if (result.succeed() && ObjectUtil.isNotNull(result.getData()) && StringUtils.isNotBlank(result.getData().getOwnerAccountBank())) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主存在绑定银行卡,请先解绑银行卡后再进行绑定操作"); throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主存在绑定银行卡,请先解绑银行卡后再进行绑定操作");
} }
...@@ -451,20 +455,19 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -451,20 +455,19 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void ownerAccountFrozen(Long ownerUserNo) { public void ownerAccountFrozen(FrozenAccountParam param) {
String mobile = ""; String mobile = param.getMobile();
String ownerName = ""; Long userNo = param.getUserNo();
BigDecimal frozenBalance = new BigDecimal(12); String ownerName = param.getOwnerName();
BigDecimal ensureBalance = new BigDecimal(14); BigDecimal frozenBalance = param.getFrozenBalance();
Integer orderId = 9; BigDecimal ensureBalance = param.getEnsureBalance();
String orderNo = "123"; Integer orderId = param.getOrderId();
String orderNo = param.getOrderNo();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
//List<OwnerAccount> updateList = new LinkedList<>();
while (true) { while (true) {
int flag = 0; int flag = 0;
//updateList.clear(); List<OwnerAccount> accountList = ownerAccountDao.accountInfo(userNo);
List<OwnerAccount> accountList = ownerAccountDao.accountInfo(ownerUserNo);
for (OwnerAccount ownerAccount : accountList) { for (OwnerAccount ownerAccount : accountList) {
OwnerAccount entity = new OwnerAccount(); OwnerAccount entity = new OwnerAccount();
entity.setAccountType(ownerAccount.getAccountType()); entity.setAccountType(ownerAccount.getAccountType());
...@@ -508,7 +511,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -508,7 +511,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
marginAccount.setRelationId(null); marginAccount.setRelationId(null);
marginAccount.setAccountBalance(ensureBalance); marginAccount.setAccountBalance(ensureBalance);
marginAccount.setOwnerUserNo(ownerUserNo); marginAccount.setOwnerUserNo(userNo);
marginAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode()); marginAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode());
marginAccount.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode()); marginAccount.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
...@@ -525,7 +528,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -525,7 +528,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
prepaidFreight.setRelationId(null); prepaidFreight.setRelationId(null);
prepaidFreight.setAccountBalance(frozenBalance); prepaidFreight.setAccountBalance(frozenBalance);
prepaidFreight.setOwnerUserNo(ownerUserNo); prepaidFreight.setOwnerUserNo(userNo);
prepaidFreight.setAccountType(OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode()); prepaidFreight.setAccountType(OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode());
prepaidFreight.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode()); prepaidFreight.setRunningWaterType(OwnerAccountEnum.RunningWaterStatus.FROZEN.getCode());
...@@ -534,4 +537,21 @@ public class OwnerAccountServiceImpl implements OwnerAccountService { ...@@ -534,4 +537,21 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void createAccount(CreteAccountParam param) {
List<OwnerAccount> accountList = ownerAccountDao.accountInfo(param.getUserNo());
if (CollectionUtil.isNotEmpty(accountList)) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, "当前货主已创建账户");
}
OwnerAccount ownerAccount = new OwnerAccount();
ownerAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.PREPAID_FREIGHT_ACCOUNT.getCode());
ownerAccount.setOwnerUserName(param.getName());
ownerAccount.setOwnerUserNo(param.getUserNo());
ownerAccount.setMobile(param.getMobile());
ownerAccountDao.saveEntity(ownerAccount);
ownerAccount.setAccountType(OwnerAccountEnum.AccountTypeStatus.MARGIN_ACCOUNT.getCode());
ownerAccountDao.saveEntity(ownerAccount);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论