|
|
|
@ -13,9 +13,7 @@ import com.alibaba.excel.write.metadata.fill.FillConfig;
|
|
|
|
|
import com.alibaba.excel.write.metadata.fill.FillWrapper;
|
|
|
|
|
import com.sztzjy.digital_credit.annotation.AnonymousAccess;
|
|
|
|
|
import com.sztzjy.digital_credit.entity.*;
|
|
|
|
|
import com.sztzjy.digital_credit.mapper.StuFinancialStatementsMapper;
|
|
|
|
|
import com.sztzjy.digital_credit.mapper.StuOperationAssetAnalysisModuleMapper;
|
|
|
|
|
import com.sztzjy.digital_credit.mapper.StuScoreModuleMapper;
|
|
|
|
|
import com.sztzjy.digital_credit.mapper.*;
|
|
|
|
|
import com.sztzjy.digital_credit.util.excel.FilePortUtil;
|
|
|
|
|
|
|
|
|
|
import com.sztzjy.digital_credit.util.file.IFileUtil;
|
|
|
|
@ -64,10 +62,168 @@ public class StuExportToExcelController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuOperationAssetAnalysisModuleMapper operationAssetAnalysisModuleMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuProfitAbilityMapper profitAbilityMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuSolvencyMapper solvencyMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuOperatingCapacityMapper operatingCapacityMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuGrowthAbilityMapper growthAbilityMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StuDuPontAnalysisMapper duPontAnalysisMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("财务指标")
|
|
|
|
|
@GetMapping("/financialIndexExport")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
public void financialIndexExport(HttpServletResponse response, @RequestParam("userId") String userId) {
|
|
|
|
|
Map<String, Object> sheetMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
//盈利能力
|
|
|
|
|
StuProfitAbilityExample profitAbilityExample = new StuProfitAbilityExample();
|
|
|
|
|
profitAbilityExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuProfitAbility> profitAbilityList = profitAbilityMapper.selectByExample(profitAbilityExample);
|
|
|
|
|
if (!profitAbilityList.isEmpty()){
|
|
|
|
|
|
|
|
|
|
sheetMap.put("data1", profitAbilityList.get(0).getGrossMargin());
|
|
|
|
|
sheetMap.put("data2", profitAbilityList.get(0).getReturnAssetRoa());
|
|
|
|
|
sheetMap.put("data3", profitAbilityList.get(0).getReturnEquityRoe());
|
|
|
|
|
sheetMap.put("data4", profitAbilityList.get(0).getNetOperatProfitMargin());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//偿债能力
|
|
|
|
|
StuSolvencyExample solvencyExample = new StuSolvencyExample();
|
|
|
|
|
solvencyExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuSolvency> stuSolvencyList = solvencyMapper.selectByExample(solvencyExample);
|
|
|
|
|
if (!stuSolvencyList.isEmpty()){
|
|
|
|
|
|
|
|
|
|
//与模板对应字段-值设置
|
|
|
|
|
|
|
|
|
|
sheetMap.put("data5", stuSolvencyList.get(0).getCurrentRatio());
|
|
|
|
|
sheetMap.put("data6", stuSolvencyList.get(0).getAssetLiabilityRatio());
|
|
|
|
|
sheetMap.put("data7", stuSolvencyList.get(0).getEquityRatio());
|
|
|
|
|
sheetMap.put("data8", stuSolvencyList.get(0).getEquityMultiplier());
|
|
|
|
|
|
|
|
|
|
sheetMap.put("data9", stuSolvencyList.get(0).getQuickRatio());
|
|
|
|
|
sheetMap.put("data10", stuSolvencyList.get(0).getCashRatio());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//营运能力
|
|
|
|
|
StuOperatingCapacityExample operatingCapacityExample = new StuOperatingCapacityExample();
|
|
|
|
|
operatingCapacityExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuOperatingCapacity> operatingCapacityList = operatingCapacityMapper.selectByExample(operatingCapacityExample);
|
|
|
|
|
if (!operatingCapacityList.isEmpty()){
|
|
|
|
|
|
|
|
|
|
//与模板对应字段-值设置
|
|
|
|
|
sheetMap.put("data11", operatingCapacityList.get(0).getTotalAssetTurnover());
|
|
|
|
|
sheetMap.put("data12", operatingCapacityList.get(0).getCurrentAssetTurnover());
|
|
|
|
|
sheetMap.put("data13", operatingCapacityList.get(0).getAccountsReceivalTurnoverRate());
|
|
|
|
|
sheetMap.put("data14", operatingCapacityList.get(0).getInventoryTurnoverRate());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//成长能力
|
|
|
|
|
StuGrowthAbilityExample growthAbilityExample = new StuGrowthAbilityExample();
|
|
|
|
|
growthAbilityExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuGrowthAbility> growthAbilityList = growthAbilityMapper.selectByExample(growthAbilityExample);
|
|
|
|
|
if (!growthAbilityList.isEmpty()){
|
|
|
|
|
|
|
|
|
|
//与模板对应字段-值设置
|
|
|
|
|
sheetMap.put("data15", growthAbilityList.get(0).getYearGrowth());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//杜邦分析
|
|
|
|
|
StuDuPontAnalysisExample duPontAnalysisExample = new StuDuPontAnalysisExample();
|
|
|
|
|
duPontAnalysisExample.createCriteria().andUserIdEqualTo(userId);
|
|
|
|
|
List<StuDuPontAnalysis> duPontAnalysisList = duPontAnalysisMapper.selectByExample(duPontAnalysisExample);
|
|
|
|
|
if (!duPontAnalysisList.isEmpty()){
|
|
|
|
|
|
|
|
|
|
//与模板对应字段-值设置
|
|
|
|
|
sheetMap.put("data16", duPontAnalysisList.get(0).getNetOperatProfitMargin());
|
|
|
|
|
sheetMap.put("data17", duPontAnalysisList.get(0).getTotalAssetTurnover());
|
|
|
|
|
sheetMap.put("data18", duPontAnalysisList.get(0).getEquityMultiplier());
|
|
|
|
|
sheetMap.put("data19", duPontAnalysisList.get(0).getNetPrifitMarginTotalAsset());
|
|
|
|
|
sheetMap.put("data20", duPontAnalysisList.get(0).getReturnEquity());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExcelWriter excelWriter = null;
|
|
|
|
|
InputStream inputStream = null;
|
|
|
|
|
ServletOutputStream outputStream = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
ClassPathResource classPathResource = new ClassPathResource("/template/财务指标.xls");
|
|
|
|
|
inputStream = classPathResource.getInputStream();
|
|
|
|
|
outputStream = response.getOutputStream();
|
|
|
|
|
|
|
|
|
|
excelWriter = EasyExcel.write(outputStream).inMemory(Boolean.TRUE).withTemplate(inputStream).excelType(ExcelTypeEnum.XLS).build();
|
|
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
|
|
|
|
//FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
|
|
|
|
excelWriter.fill(sheetMap, writeSheet);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String fileName = URLEncoder.encode("财务指标", "UTF-8").replaceAll("\\+", "%20");
|
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xls");
|
|
|
|
|
excelWriter.finish();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}finally {
|
|
|
|
|
// 千万别忘记finish 会帮忙关闭流
|
|
|
|
|
if (excelWriter != null) {
|
|
|
|
|
excelWriter.finish();
|
|
|
|
|
}
|
|
|
|
|
//关闭流
|
|
|
|
|
if (outputStream != null) {
|
|
|
|
|
try {
|
|
|
|
|
outputStream.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (inputStream != null) {
|
|
|
|
|
try {
|
|
|
|
|
inputStream.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO
|
|
|
|
|
// 财务指标Excel 未导出
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|