This commit is contained in:
77
2024-03-23 16:09:12 +08:00
parent 0c302b1b93
commit ad5232a98d
4 changed files with 35 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import com.bashi.common.utils.MessageUtils;
import com.bashi.common.utils.PageUtils; import com.bashi.common.utils.PageUtils;
import com.bashi.common.utils.SecurityUtils; import com.bashi.common.utils.SecurityUtils;
import com.bashi.dk.domain.Borrow; import com.bashi.dk.domain.Borrow;
import com.bashi.dk.dto.admin.resp.BorrowAdminVO;
import com.bashi.dk.dto.app.req.BorrowStartReq; import com.bashi.dk.dto.app.req.BorrowStartReq;
import com.bashi.dk.dto.app.resp.BorrowInfo; import com.bashi.dk.dto.app.resp.BorrowInfo;
import com.bashi.dk.dto.app.resp.LoanProcessResp; import com.bashi.dk.dto.app.resp.LoanProcessResp;
@@ -82,13 +83,18 @@ public class AppBorrowController {
@GetMapping("/page") @GetMapping("/page")
@ApiOperation(value = "分页查询贷款我的贷款") @ApiOperation(value = "分页查询贷款我的贷款")
public TableDataInfo<Borrow> page(PageParams pageParams){ public TableDataInfo<BorrowAdminVO> page(PageParams pageParams){
Long customerId = SecurityUtils.getLoginUser().getCustomer().getId(); Long customerId = SecurityUtils.getLoginUser().getCustomer().getId();
LambdaQueryWrapper<Borrow> query = Wrappers.lambdaQuery(Borrow.class) LambdaQueryWrapper<Borrow> query = Wrappers.lambdaQuery(Borrow.class)
.eq(Borrow::getCustomerId,customerId) .eq(Borrow::getCustomerId,customerId)
.orderByDesc(Borrow::getCreateTime); .orderByDesc(Borrow::getCreateTime);
IPage<Borrow> page = borrowService.page(Condition.getPage(pageParams), query); IPage<Borrow> page = borrowService.page(Condition.getPage(pageParams), query);
return PageUtils.buildDataInfo(page); TableDataInfo<BorrowAdminVO> info = PageUtils.buildDataInfo(page, BorrowAdminVO::new);
List<BorrowAdminVO> rows = info.getRows();
for (BorrowAdminVO row : rows) {
row.setDefaultCoinUnit(homeSettingService.getHomeSetting().getDefaultCoinUnit());
}
return info;
} }

View File

@@ -2,10 +2,14 @@ package com.bashi.dk.controller.app;
import com.bashi.common.core.domain.AjaxResult; import com.bashi.common.core.domain.AjaxResult;
import com.bashi.common.core.domain.entity.Customer; import com.bashi.common.core.domain.entity.Customer;
import com.bashi.common.utils.BeanContextUtils;
import com.bashi.common.utils.BeanConvertUtil;
import com.bashi.common.utils.SecurityUtils; import com.bashi.common.utils.SecurityUtils;
import com.bashi.dk.domain.CustomerInfo; import com.bashi.dk.domain.CustomerInfo;
import com.bashi.dk.dto.admin.resp.CustomerAdminVO;
import com.bashi.dk.service.CustomerInfoService; import com.bashi.dk.service.CustomerInfoService;
import com.bashi.dk.service.CustomerService; import com.bashi.dk.service.CustomerService;
import com.bashi.dk.service.HomeSettingService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -20,13 +24,17 @@ public class AppCustomerController {
private CustomerInfoService customerInfoService; private CustomerInfoService customerInfoService;
@Autowired @Autowired
private CustomerService customerService; private CustomerService customerService;
@Autowired
private HomeSettingService homeSettingService;
@GetMapping("/info") @GetMapping("/info")
@ApiOperation(value = "客户信息") @ApiOperation(value = "客户信息")
public AjaxResult<Customer> info(){ public AjaxResult<Customer> info(){
Customer customer = SecurityUtils.getLoginUser().getCustomer(); Customer customer = SecurityUtils.getLoginUser().getCustomer();
customer = customerService.getById(customer.getId()); customer = customerService.getById(customer.getId());
return AjaxResult.success(customer); CustomerAdminVO customerAdminVO = BeanConvertUtil.convertTo(customer, CustomerAdminVO::new);
customerAdminVO.setDefaultCoinUnit(homeSettingService.getHomeSetting().getDefaultCoinUnit());
return AjaxResult.success(customerAdminVO);
} }
@GetMapping("/card/info") @GetMapping("/card/info")

View File

@@ -0,0 +1,9 @@
package com.bashi.dk.dto.admin.resp;
import com.bashi.dk.domain.Borrow;
import lombok.Data;
@Data
public class BorrowAdminVO extends Borrow {
private String defaultCoinUnit;
}

View File

@@ -0,0 +1,9 @@
package com.bashi.dk.dto.admin.resp;
import com.bashi.common.core.domain.entity.Customer;
import lombok.Data;
@Data
public class CustomerAdminVO extends Customer {
private String defaultCoinUnit;
}