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