|
|
|
@ -7,25 +7,34 @@ 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.util.MyExcelListenerImport;
|
|
|
|
|
import com.sztzjy.digital_credit.service.StuRateService;
|
|
|
|
|
import com.sztzjy.digital_credit.util.ConvertUtil;
|
|
|
|
|
|
|
|
|
|
import com.sztzjy.digital_credit.util.ResultEntity;
|
|
|
|
|
import com.sztzjy.digital_credit.util.excel.MyExcelListener ;
|
|
|
|
|
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;
|
|
|
|
@ -37,10 +46,6 @@ import java.util.List;
|
|
|
|
|
public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoEntryService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private StuPersonalCreditService stuPersonalCreditService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuBaseInfoMapper stuBaseInfoMapper;
|
|
|
|
|
|
|
|
|
@ -63,15 +68,14 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuOperatingCapacityMapper operatingCapacityMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuPersonalCreditService stuPersonalCreditService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuSolvencyMapper solvencyMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 基本信息查询
|
|
|
|
|
* @param userId
|
|
|
|
@ -191,7 +195,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());
|
|
|
|
|
|
|
|
|
@ -204,7 +208,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());
|
|
|
|
|
}
|
|
|
|
@ -245,7 +249,7 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
public ResultEntity saveCreditRecordsInfoByAuto(StuCreditRecords creditRecords) {
|
|
|
|
|
//查询有无数据,有数据就更新,没有数据就保存
|
|
|
|
|
StuCreditRecordsExample creditRecordsExample = new StuCreditRecordsExample();
|
|
|
|
|
creditRecordsExample.createCriteria().andUserIdEqualTo(creditRecords.getUserId());
|
|
|
|
|
creditRecordsExample.createCriteria().andUserIdEqualTo(creditRecords.getId());
|
|
|
|
|
|
|
|
|
|
List<StuCreditRecords> stuCreditRecordsList = creditRecordsMapper.selectByExample(creditRecordsExample);
|
|
|
|
|
if (!stuCreditRecordsList.isEmpty()){
|
|
|
|
@ -309,7 +313,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()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -324,7 +328,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());
|
|
|
|
|
|
|
|
|
@ -339,20 +343,20 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity importFinancialStatements(MultipartFile file, String module) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
//获取文件的输入流
|
|
|
|
|
EasyExcel.read(file.getInputStream(), StuFinancialStatements.class, new MyExcelListenerImport(financialStatementsMapper,module)).sheet().doRead();
|
|
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.OK,"导入成功!");
|
|
|
|
|
|
|
|
|
|
}catch (IOException exception){
|
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST,"导入失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// @Override
|
|
|
|
|
// public ResultEntity importFinancialStatements(MultipartFile file, String module) {
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// try {
|
|
|
|
|
// //获取文件的输入流
|
|
|
|
|
// EasyExcel.read(file.getInputStream(), StuFinancialStatements.class, new MyExcelListener(financialStatementsMapper,module)).sheet().doRead();
|
|
|
|
|
//
|
|
|
|
|
// return new ResultEntity(HttpStatus.OK,"导入成功!");
|
|
|
|
|
//
|
|
|
|
|
// }catch (IOException exception){
|
|
|
|
|
// return new ResultEntity(HttpStatus.BAD_REQUEST,"导入失败!");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询财务报表
|
|
|
|
@ -488,7 +492,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());
|
|
|
|
@ -502,7 +506,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());
|
|
|
|
|
}
|
|
|
|
@ -578,7 +582,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 {
|
|
|
|
@ -589,7 +593,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());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -663,7 +667,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());
|
|
|
|
|
|
|
|
|
@ -676,7 +680,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());
|
|
|
|
|
}
|
|
|
|
@ -756,7 +760,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()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -770,7 +774,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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -846,7 +850,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());
|
|
|
|
@ -859,7 +863,7 @@ 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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -958,6 +962,9 @@ public class StuEnterPriseByInfoEntryServiceImpl implements StuEnterPriseByInfoE
|
|
|
|
|
public ResultEntity getFinancialDuPontAnalysisSelect(String userId) {
|
|
|
|
|
StuDuPontAnalysisExample duPontAnalysisExample = new StuDuPontAnalysisExample();
|
|
|
|
|
duPontAnalysisExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<StuDuPontAnalysis> duPontAnalysisList = duPontAnalysisMapper.selectByExample(duPontAnalysisExample);
|
|
|
|
|
if (duPontAnalysisList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|