|
|
@@ -1,6 +1,8 @@
|
|
|
package com.txz.cif.web;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
@@ -14,6 +16,7 @@ import com.txz.cif.web.bo.AccountFlowBO;
|
|
|
import com.txz.cif.web.bo.AccountInfoBO;
|
|
|
import com.txz.cif.web.bo.AccountWalletInfoBO;
|
|
|
import com.txz.cif.web.para.AccountFlowParam;
|
|
|
+import com.txz.cif.web.vo.AccountFreezdVO;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -25,6 +28,7 @@ import tk.mybatis.mapper.entity.Example.Criteria;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -120,7 +124,7 @@ public class AccountApiController extends AbstractApiController {
|
|
|
AccountWalletInfoBO bo = new AccountWalletInfoBO();
|
|
|
bo.setBalance(wallet.getBalance());
|
|
|
bo.setFreezeAmount(wallet.getFreezeAmount());
|
|
|
- bo.setCanUserFreezeAmount(wallet.getBalance().subtract(wallet.getFreezeAmount()));
|
|
|
+ bo.setAvailableAmount(wallet.getBalance().subtract(wallet.getFreezeAmount()));
|
|
|
return ResultGenerator.genSuccessResult(bo);
|
|
|
}
|
|
|
|
|
|
@@ -128,7 +132,7 @@ public class AccountApiController extends AbstractApiController {
|
|
|
* 冻结列表
|
|
|
*/
|
|
|
@GetMapping("getFreeds")
|
|
|
- public Result<PageInfo<List<AccountFreezd>>> getFreeds(AccountFlowParam param, HttpServletRequest request) {
|
|
|
+ public Result<PageInfo<List<AccountFreezdVO>>> getFreeds(AccountFlowParam param, HttpServletRequest request) {
|
|
|
Long userId = authService.getTokenUserId(request);
|
|
|
if (userId == null) {
|
|
|
return ResultGenerator.genFailResult(ResultCode.OAUTH_INVALID_ACCESS_TOKEN);
|
|
|
@@ -141,7 +145,22 @@ public class AccountApiController extends AbstractApiController {
|
|
|
.andEqualTo("userId", userId)
|
|
|
;
|
|
|
c.setOrderByClause("create_time desc");
|
|
|
- return ResultGenerator.genSuccessResult(new PageInfo(accountFreezdService.findByCondition(c)));
|
|
|
+ List<AccountFreezd> accountFreezds = accountFreezdService.findByCondition(c);
|
|
|
+ if (CollectionUtil.isEmpty(accountFreezds)) {
|
|
|
+ return ResultGenerator.genSuccessResult(new PageInfo());
|
|
|
+ }
|
|
|
+ PageInfo pageInfo = new PageInfo(accountFreezds);
|
|
|
+
|
|
|
+ List<AccountFreezd> list = pageInfo.getList();
|
|
|
+
|
|
|
+ List<AccountFreezdVO> result = new ArrayList<>();
|
|
|
+ for (AccountFreezd accountFreezd : list) {
|
|
|
+ AccountFreezdVO freezdVO = BeanUtil.copyProperties(accountFreezd, AccountFreezdVO.class);
|
|
|
+ freezdVO.setFreezeAmount(freezdVO.getAmount().subtract(freezdVO.getUnfreezeAmount()));
|
|
|
+ result.add(freezdVO);
|
|
|
+ }
|
|
|
+ pageInfo.setList(result);
|
|
|
+ return ResultGenerator.genSuccessResult(pageInfo);
|
|
|
}
|
|
|
|
|
|
|