小程序申请记录分页、已申请额度未认证时显示0.00

master
river 4 years ago
parent 0f7af07b86
commit 718f211cd7
  1. 6
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerAppletController.java
  2. 6
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerAppletDao.java
  3. 3
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerAppletService.java
  4. 43
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerAppletServiceImpl.java
  5. 14
      dq-financial-crms/src/main/resources/mapper/crms/CustomerAppletDao.xml

@ -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());
}

@ -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<CustomerEntity> {
Integer getCompanyId(Integer customerId);
List<ApplicationRecordPO> getApplicationRecord(@Param("companyId")Integer companyId, @Param("status")Integer status);
IPage<ApplicationRecordPO> getApplicationRecord(Page page, @Param("companyId")Integer companyId, @Param("status")Integer status);
List<ApplicationRecordPO> getApplyMount(Integer companyId);
ApplyDetailPO getApplyDetail(Integer id);
}

@ -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<CustomerEntity> {
Boolean updateCompany(CompanyAppletRequest companyAppletRequest);
List<ApplicationRecordResponse> getApplicationRecord(Integer type, Integer status);
PageUtils getApplicationRecord(Integer page, Integer size, Integer type, Integer status);
Map getApplyMount();

@ -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<CustomerAppletDao, Cu
*/
@Transactional
@Override
public List<ApplicationRecordResponse> 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<ApplicationRecordResponse> applicationRecordResponseList = new ArrayList<>();
IPage<ApplicationRecordResponse> 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<CustomerAppletDao, Cu
}
Integer companyId = this.getBaseMapper().getCompanyId(customerId);
// 查询申请记录信息
List<ApplicationRecordPO> applicationRecordPOList = this.getBaseMapper().getApplicationRecord(companyId, status);
IPage<ApplicationRecordPO> iPage = this.getBaseMapper().getApplicationRecord(new Page(page, size), companyId, status);
List<ApplicationRecordPO> applicationRecordPOList = iPage.getRecords();
for (ApplicationRecordPO applicationRecordPO : applicationRecordPOList) {
ApplicationRecordResponse applicationRecordResponse = new ApplicationRecordResponse();
// 状态为已受理、审核中、拒绝、驳回、已撤销情况
@ -338,8 +351,11 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
}
applicationRecordResponseList.add(applicationRecordResponse);
}
// 设置分页数据
BeanUtils.copyProperties(iPage, applicationRecordResponseIPage);
applicationRecordResponseIPage.setRecords(applicationRecordResponseList);
}
return applicationRecordResponseList;
return new PageUtils(applicationRecordResponseIPage);
}
/**
@ -347,21 +363,24 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
*/
@Override
public Map getApplyMount() {
Double company = 0.00;
Map<String, Double> 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) {
ExceptionCast.cast(CrmsCode.CUSTOMER_APPLET_IS_NULL);
}
map.put("company", company);
} else {
Integer companyId = this.getBaseMapper().getCompanyId(customerId);
// 查询申请记录信息
List<ApplicationRecordPO> applicationRecordPOList = this.getBaseMapper().getApplicationRecord(companyId, null);
Double company = 0.00;
List<ApplicationRecordPO> applicationRecordPOList = this.getBaseMapper().getApplyMount(companyId);
for (ApplicationRecordPO applicationRecordPO : applicationRecordPOList) {
company += applicationRecordPO.getApplyAmount();
}
Map<String, Double> map = new HashMap<>();
map.put("company", company);
map.put("personal", 0.00);
}
return map;
}
@ -412,13 +431,13 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
* 获取当前登录用户信息
*/
private String getUserId() {
/*HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String token = request.getHeader("token");
String userId = RedisUtil.get("dq:token:" + token);
if (userId == null || userId.length() == 0) {
ExceptionCast.cast(CommonCode.GET_LOGIN_USER_FAIL);
}*/
String userId = "63";
}
// String userId = "63";
return userId;
}

@ -49,6 +49,20 @@
GROUP BY a.id
</select>
<!-- 获取已申请额度 -->
<select id="getApplyMount" parameterType="integer" resultType="com.daqing.framework.domain.crms.ext.ApplicationRecordPO">
SELECT a.id AS id,a.create_time AS apply_date,a.amount_wide AS amount_wide,a.apply_time AS apply_time,l.status AS audit_status,
a.apply_amount AS apply_amount,b.business_status AS business_status
FROM dg_apply_amount_info AS a
LEFT JOIN dg_business_process_status AS b
ON a.id = b.business_id
LEFT JOIN dg_apply_amount_list AS l
ON l.business_id = a.id
WHERE a.company_id = #{companyId}
AND (b.business_status = 2 OR l.status IN (1,2,3,4,5))
GROUP BY a.id
</select>
<!-- 获取申请记录详情 -->
<select id="getApplyDetail" parameterType="integer" resultType="com.daqing.framework.domain.crms.ext.ApplyDetailPO">
SELECT l.status AS audit_status,l.apply_content AS remark,b.business_status AS business_status

Loading…
Cancel
Save