diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerAppletController.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerAppletController.java index 51d94877..5e540f56 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerAppletController.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerAppletController.java @@ -102,9 +102,9 @@ public class CustomerAppletController { */ @GetMapping("/get/record") @ApiOperation(value = "获取申请记录", response = ApplicationRecordResponse.class) - public ResponseResult getApplicationRecord(Integer type, Integer status) { + public ResponseResult getApplicationRecord(@RequestParam("page") Integer page, @RequestParam("size") Integer size, Integer type, Integer status) { - return ResponseResult.SUCCESS(customerAppletService.getApplicationRecord(type, status)); + return ResponseResult.SUCCESS(customerAppletService.getApplicationRecord(page, size, type, status)); } /** @@ -112,7 +112,7 @@ public class CustomerAppletController { */ @GetMapping("/get/apply/mount") @ApiOperation(value = "获取已申请额度") - public ResponseResult getApplyMount(){ + public ResponseResult getApplyMount() { return ResponseResult.SUCCESS(customerAppletService.getApplyMount()); } diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerAppletDao.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerAppletDao.java index de6538e0..86ff1f59 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerAppletDao.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerAppletDao.java @@ -1,6 +1,8 @@ package com.daqing.financial.crms.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.daqing.framework.domain.crms.CustomerEntity; import com.daqing.framework.domain.crms.ext.ApplicationRecordPO; import com.daqing.framework.domain.crms.ext.ApplyDetailPO; @@ -29,7 +31,9 @@ public interface CustomerAppletDao extends BaseMapper { Integer getCompanyId(Integer customerId); - List getApplicationRecord(@Param("companyId")Integer companyId, @Param("status")Integer status); + IPage getApplicationRecord(Page page, @Param("companyId")Integer companyId, @Param("status")Integer status); + + List getApplyMount(Integer companyId); ApplyDetailPO getApplyDetail(Integer id); } diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerAppletService.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerAppletService.java index 52b7c817..a4028a77 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerAppletService.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerAppletService.java @@ -6,6 +6,7 @@ import com.daqing.financial.crms.model.request.PersonalAppletRequest; import com.daqing.financial.crms.model.response.ApplicationRecordResponse; import com.daqing.financial.crms.model.response.ApplyDetailResponse; import com.daqing.framework.domain.crms.CustomerEntity; +import com.daqing.framework.utils.PageUtils; import java.util.List; import java.util.Map; @@ -30,7 +31,7 @@ public interface CustomerAppletService extends IService { Boolean updateCompany(CompanyAppletRequest companyAppletRequest); - List getApplicationRecord(Integer type, Integer status); + PageUtils getApplicationRecord(Integer page, Integer size, Integer type, Integer status); Map getApplyMount(); diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerAppletServiceImpl.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerAppletServiceImpl.java index b76f82d6..6775a612 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerAppletServiceImpl.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerAppletServiceImpl.java @@ -1,6 +1,8 @@ package com.daqing.financial.crms.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.daqing.financial.crms.dao.CompanyCustomerDao; import com.daqing.financial.crms.dao.CustomerAppletDao; @@ -24,12 +26,17 @@ import com.daqing.framework.domain.crms.response.CrmsCode; import com.daqing.framework.exception.ExceptionCast; import com.daqing.framework.model.response.CommonCode; import com.daqing.framework.model.response.PromptSuccess; +import com.daqing.framework.util.RedisUtil; +import com.daqing.framework.utils.PageUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.util.*; /** @@ -309,8 +316,13 @@ public class CustomerAppletServiceImpl extends ServiceImpl getApplicationRecord(Integer type, Integer status) { + public PageUtils getApplicationRecord(Integer page, Integer size, Integer type, Integer status) { + if (page == null || size == null || page < 1 || size < 1) { + page = 1; + size = 10; + } List applicationRecordResponseList = new ArrayList<>(); + IPage applicationRecordResponseIPage = new Page<>(); // 获取客户的登录信息/暂时没有个人类型申请信息,所以个人类型返回空而企业类型返回所有 if (type == null || (type != 0 && type != 1) || type == 1) { Integer customerId = this.getBaseMapper().getCustomerId(Integer.parseInt(this.getUserId()), 1); @@ -319,7 +331,8 @@ public class CustomerAppletServiceImpl extends ServiceImpl applicationRecordPOList = this.getBaseMapper().getApplicationRecord(companyId, status); + IPage iPage = this.getBaseMapper().getApplicationRecord(new Page(page, size), companyId, status); + List applicationRecordPOList = iPage.getRecords(); for (ApplicationRecordPO applicationRecordPO : applicationRecordPOList) { ApplicationRecordResponse applicationRecordResponse = new ApplicationRecordResponse(); // 状态为已受理、审核中、拒绝、驳回、已撤销情况 @@ -338,8 +351,11 @@ public class CustomerAppletServiceImpl extends ServiceImpl applicationRecordPOList = this.getBaseMapper().getApplicationRecord(companyId, null); Double company = 0.00; - for (ApplicationRecordPO applicationRecordPO : applicationRecordPOList) { - company += applicationRecordPO.getApplyAmount(); - } Map map = new HashMap<>(); map.put("company", company); + // 个人类型暂时没有 map.put("personal", 0.00); + Integer customerId = this.getBaseMapper().getCustomerId(Integer.parseInt(this.getUserId()), 1); + // 如果查询不到认证信息,直接返回0.00 + if (customerId == null) { + map.put("company", company); + } else { + Integer companyId = this.getBaseMapper().getCompanyId(customerId); + // 查询申请记录信息 + List applicationRecordPOList = this.getBaseMapper().getApplyMount(companyId); + for (ApplicationRecordPO applicationRecordPO : applicationRecordPOList) { + company += applicationRecordPO.getApplyAmount(); + } + map.put("company", company); + } return map; } @@ -412,13 +431,13 @@ public class CustomerAppletServiceImpl extends ServiceImpl + + +