|
|
|
@ -7,33 +7,25 @@ package com.sztzjy.digital_credit.service.impl;
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
|
|
import com.alibaba.excel.ExcelWriter;
|
|
|
|
|
import com.alibaba.excel.util.ListUtils;
|
|
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.sztzjy.digital_credit.config.Constant;
|
|
|
|
|
import com.sztzjy.digital_credit.entity.*;
|
|
|
|
|
import com.sztzjy.digital_credit.entity.dto.StuFinancialIndexDTO;
|
|
|
|
|
import com.sztzjy.digital_credit.mapper.*;
|
|
|
|
|
import com.sztzjy.digital_credit.service.PublicMethodsService;
|
|
|
|
|
import com.sztzjy.digital_credit.service.StuEnterPriseByInfoEntryService;
|
|
|
|
|
import com.sztzjy.digital_credit.service.StuPersonalCreditService;
|
|
|
|
|
import com.sztzjy.digital_credit.service.StuRateService;
|
|
|
|
|
import com.sztzjy.digital_credit.util.ConvertUtil;
|
|
|
|
|
import com.sztzjy.digital_credit.util.MyExcelListener;
|
|
|
|
|
import com.sztzjy.digital_credit.util.MyExcelListenerImport;
|
|
|
|
|
import com.sztzjy.digital_credit.util.ResultEntity;
|
|
|
|
|
import com.sztzjy.digital_credit.util.excel.MyExcelListener ;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.annotation.Id;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.Date;
|
|
|
|
@ -45,6 +37,10 @@ import java.util.List;
|
|
|
|
|
public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoEntryService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private StuPersonalCreditService stuPersonalCreditService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuBaseInfoMapper stuBaseInfoMapper;
|
|
|
|
|
|
|
|
|
@ -67,14 +63,15 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuOperatingCapacityMapper operatingCapacityMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuPersonalCreditService stuPersonalCreditService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuSolvencyMapper solvencyMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 基本信息查询
|
|
|
|
|
* @param userId
|
|
|
|
@ -194,7 +191,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
stuBaseInfoMapper.updateByPrimaryKeySelective(stuBaseInfo);
|
|
|
|
|
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(stuBaseInfo.getUserId(),"基本信息", BigDecimal.valueOf(24-stuBaseInfo.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(stuBaseInfo.getUserId(),"企业征信", BigDecimal.valueOf(24-stuBaseInfo.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",stuBaseInfo.getErrorNumber());
|
|
|
|
|
|
|
|
|
@ -207,7 +204,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
//插入数据库
|
|
|
|
|
stuBaseInfoMapper.insertSelective(stuBaseInfo);
|
|
|
|
|
|
|
|
|
|
stuPersonalCreditService.scoreEntry(stuBaseInfo.getUserId(),"基本信息", BigDecimal.valueOf(24-stuBaseInfo.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(stuBaseInfo.getUserId(),"企业征信", BigDecimal.valueOf(24-stuBaseInfo.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",stuBaseInfo.getErrorNumber());
|
|
|
|
|
}
|
|
|
|
@ -248,7 +245,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
public ResultEntity saveCreditRecordsInfoByAuto(StuCreditRecords creditRecords) {
|
|
|
|
|
//查询有无数据,有数据就更新,没有数据就保存
|
|
|
|
|
StuCreditRecordsExample creditRecordsExample = new StuCreditRecordsExample();
|
|
|
|
|
creditRecordsExample.createCriteria().andUserIdEqualTo(creditRecords.getId());
|
|
|
|
|
creditRecordsExample.createCriteria().andUserIdEqualTo(creditRecords.getUserId());
|
|
|
|
|
|
|
|
|
|
List<StuCreditRecords> stuCreditRecordsList = creditRecordsMapper.selectByExample(creditRecordsExample);
|
|
|
|
|
if (!stuCreditRecordsList.isEmpty()){
|
|
|
|
@ -312,7 +309,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
creditRecordsMapper.updateByPrimaryKeySelective(creditRecords);
|
|
|
|
|
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(creditRecords.getUserId(),"信贷记录", BigDecimal.valueOf(16-creditRecords.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(creditRecords.getUserId(),"企业征信", BigDecimal.valueOf(16-creditRecords.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -327,7 +324,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
creditRecords.setCreateTime(new Date());
|
|
|
|
|
creditRecordsMapper.insertSelective(creditRecords);
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(creditRecords.getUserId(),"信贷记录", BigDecimal.valueOf(16-creditRecords.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(creditRecords.getUserId(),"企业征信", BigDecimal.valueOf(16-creditRecords.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",creditRecords.getErrorNumber());
|
|
|
|
|
|
|
|
|
@ -348,7 +345,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
//获取文件的输入流
|
|
|
|
|
EasyExcel.read(file.getInputStream(), StuFinancialStatements.class, new MyExcelListener(financialStatementsMapper,module)).sheet().doRead();
|
|
|
|
|
EasyExcel.read(file.getInputStream(), StuFinancialStatements.class, new MyExcelListenerImport(financialStatementsMapper,module)).sheet().doRead();
|
|
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.OK,"导入成功!");
|
|
|
|
|
|
|
|
|
@ -491,7 +488,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
profitAbilityMapper.updateByPrimaryKeySelective(profitAbility);
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
|
|
|
|
|
stuPersonalCreditService.scoreEntry(profitAbility.getUserId(),"盈利能力", BigDecimal.valueOf(7-profitAbility.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(profitAbility.getUserId(),"企业征信", BigDecimal.valueOf(7-profitAbility.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",profitAbility.getErrorNumber());
|
|
|
|
@ -505,7 +502,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
//插入数据库
|
|
|
|
|
profitAbilityMapper.insertSelective(profitAbility);
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(profitAbility.getUserId(),"盈利能力", BigDecimal.valueOf(7-profitAbility.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(profitAbility.getUserId(),"企业征信", BigDecimal.valueOf(7-profitAbility.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",profitAbility.getErrorNumber());
|
|
|
|
|
}
|
|
|
|
@ -581,7 +578,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
|
|
|
|
|
stuPersonalCreditService.scoreEntry(solvency.getUserId(),"偿债能力", BigDecimal.valueOf(7-solvency.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(solvency.getUserId(),"企业征信", BigDecimal.valueOf(7-solvency.getErrorNumber()));
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",solvency.getErrorNumber());
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
@ -592,7 +589,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
|
|
|
|
|
solvencyMapper.insertSelective(solvency);
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(solvency.getUserId(),"偿债能力", BigDecimal.valueOf(7-solvency.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(solvency.getUserId(),"企业征信", BigDecimal.valueOf(7-solvency.getErrorNumber()));
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",solvency.getErrorNumber());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -666,7 +663,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
operatingCapacity.setId(operatingCapacityList.get(0).getId());
|
|
|
|
|
operatingCapacityMapper.updateByPrimaryKeySelective(operatingCapacity);
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(operatingCapacity.getUserId(),"营运能力", BigDecimal.valueOf(8-operatingCapacity.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(operatingCapacity.getUserId(),"企业征信", BigDecimal.valueOf(8-operatingCapacity.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",operatingCapacity.getErrorNumber());
|
|
|
|
|
|
|
|
|
@ -679,7 +676,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
//插入数据库
|
|
|
|
|
operatingCapacityMapper.insertSelective(operatingCapacity);
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(operatingCapacity.getUserId(),"营运能力", BigDecimal.valueOf(8-operatingCapacity.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(operatingCapacity.getUserId(),"企业征信", BigDecimal.valueOf(8-operatingCapacity.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",operatingCapacity.getErrorNumber());
|
|
|
|
|
}
|
|
|
|
@ -759,7 +756,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
growthAbilityMapper.updateByPrimaryKeySelective(growthAbility);
|
|
|
|
|
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(growthAbility.getUserId(),"成长能力", BigDecimal.valueOf(1-growthAbility.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(growthAbility.getUserId(),"企业征信", BigDecimal.valueOf(1-growthAbility.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -773,7 +770,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
//插入数据库
|
|
|
|
|
growthAbilityMapper.insertSelective(growthAbility);
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(growthAbility.getUserId(),"成长能力", BigDecimal.valueOf(1-growthAbility.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(growthAbility.getUserId(),"企业征信", BigDecimal.valueOf(1-growthAbility.getErrorNumber()));
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",growthAbility.getErrorNumber());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -849,7 +846,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
duPontAnalysisMapper.updateByPrimaryKeySelective(duPontAnalysis);
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
|
|
|
|
|
stuPersonalCreditService.scoreEntry(duPontAnalysis.getUserId(),"杜邦分析", BigDecimal.valueOf(4-duPontAnalysis.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(duPontAnalysis.getUserId(),"企业征信", BigDecimal.valueOf(4-duPontAnalysis.getErrorNumber()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",duPontAnalysis.getErrorNumber());
|
|
|
|
@ -862,11 +859,116 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
//插入数据库
|
|
|
|
|
duPontAnalysisMapper.insertSelective(duPontAnalysis);
|
|
|
|
|
//计算分数写入用户表
|
|
|
|
|
stuPersonalCreditService.scoreEntry(duPontAnalysis.getUserId(),"杜邦分析", BigDecimal.valueOf(4-duPontAnalysis.getErrorNumber()));
|
|
|
|
|
stuPersonalCreditService.scoreEntry(duPontAnalysis.getUserId(),"企业征信", BigDecimal.valueOf(4-duPontAnalysis.getErrorNumber()));
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"保存成功!",duPontAnalysis.getErrorNumber());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 财务指标盈利能力查询
|
|
|
|
|
* @param userId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity getFinancialProfitAbilitySelect(String userId) {
|
|
|
|
|
|
|
|
|
|
StuProfitAbilityExample profitAbilityExample = new StuProfitAbilityExample();
|
|
|
|
|
profitAbilityExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuProfitAbility> profitAbilityList = profitAbilityMapper.selectByExample(profitAbilityExample);
|
|
|
|
|
if (profitAbilityList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}else {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,profitAbilityList.get(0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 财务指标盈利能力查询
|
|
|
|
|
* @param userId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity getFinancialSolvencySelect(String userId) {
|
|
|
|
|
|
|
|
|
|
StuSolvencyExample solvencyExample = new StuSolvencyExample();
|
|
|
|
|
solvencyExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
|
|
|
|
|
List<StuSolvency> stuSolvencyList = solvencyMapper.selectByExample(solvencyExample);
|
|
|
|
|
if (stuSolvencyList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}else {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,stuSolvencyList.get(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 财务指标营运能力查询
|
|
|
|
|
* @param userId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity getFinancialOperatingCapacitySelect(String userId) {
|
|
|
|
|
//查询有无数据,有数据就更新,没有数据就保存
|
|
|
|
|
StuOperatingCapacityExample operatingCapacityExample = new StuOperatingCapacityExample();
|
|
|
|
|
operatingCapacityExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
|
|
|
|
|
List<StuOperatingCapacity> operatingCapacityList = operatingCapacityMapper.selectByExample(operatingCapacityExample);
|
|
|
|
|
|
|
|
|
|
if (operatingCapacityList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}else {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,operatingCapacityList.get(0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 财务指标成长能力查询
|
|
|
|
|
* @param userId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity getFinancialGrowthAbilitySelect(String userId) {
|
|
|
|
|
StuGrowthAbilityExample growthAbilityExample = new StuGrowthAbilityExample();
|
|
|
|
|
growthAbilityExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
|
|
|
|
|
List<StuGrowthAbility> growthAbilityList = growthAbilityMapper.selectByExample(growthAbilityExample);
|
|
|
|
|
if (growthAbilityList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}else {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,growthAbilityList.get(0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 财务指标杜邦分析查询
|
|
|
|
|
* @param userId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity getFinancialDuPontAnalysisSelect(String userId) {
|
|
|
|
|
StuDuPontAnalysisExample duPontAnalysisExample = new StuDuPontAnalysisExample();
|
|
|
|
|
duPontAnalysisExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuDuPontAnalysis> duPontAnalysisList = duPontAnalysisMapper.selectByExample(duPontAnalysisExample);
|
|
|
|
|
if (duPontAnalysisList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK);
|
|
|
|
|
}else {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,duPontAnalysisList.get(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//财务指标杜邦分析提交算分
|
|
|
|
|
private StuDuPontAnalysis financialDuPontAnalysisCheck(StuDuPontAnalysis duPontAnalysis) {
|
|
|
|
|
int sum = 0;
|
|
|
|
|