|
|
|
@ -71,44 +71,72 @@ public class ContractInvestmentServiceImpl implements ContractInvestmentService
|
|
|
|
|
* 上传尽调报告
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public ResultEntity<String> uploadDueDiligenceReport(MultipartFile file, ReportUploadDto reportNameType) {
|
|
|
|
|
//返回文件上传路径
|
|
|
|
|
String filePath = fileUtil.upload(file);
|
|
|
|
|
//获取文件名
|
|
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
|
|
//截取文件后缀
|
|
|
|
|
String fileExtension = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
|
|
|
|
|
if (!fileExtension.equals(".pdf") && !fileExtension.equals(".doc") && !fileExtension.equals(".docx")) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "文件必须为word或pdf!");
|
|
|
|
|
}
|
|
|
|
|
//查看文件是否已经上传
|
|
|
|
|
List<TrainingReport> trainingReports = getTrainingReports(reportNameType.getFlowId(), reportNameType.getReportNameType());
|
|
|
|
|
if (trainingReports.size() > 0) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!");
|
|
|
|
|
} else { //只允许提交一次
|
|
|
|
|
TrainingReport trainingReport = new TrainingReport();
|
|
|
|
|
trainingReport.setId(IdUtil.fastSimpleUUID());
|
|
|
|
|
trainingReport.setFlowId(reportNameType.getFlowId());
|
|
|
|
|
trainingReport.setSchoolId(reportNameType.getSchoolId());
|
|
|
|
|
trainingReport.setUrl(filePath);
|
|
|
|
|
String filename = file.getOriginalFilename();
|
|
|
|
|
trainingReport.setReportName(filename);
|
|
|
|
|
trainingReport.setUploadtime(new Date());
|
|
|
|
|
trainingReport.setStep(reportNameType.getReportNameType());
|
|
|
|
|
trainingReportMapper.insert(trainingReport);
|
|
|
|
|
//(每个2分,共4分)
|
|
|
|
|
if ("尽调报告".equals(reportNameType.getReportNameType())){
|
|
|
|
|
//investmentSigningDiligenceReportScore
|
|
|
|
|
public ResultEntity<String> uploadDueDiligenceReport(List<MultipartFile> files , ReportUploadDto reportNameType) {
|
|
|
|
|
|
|
|
|
|
performanceScoreService.calculateScoreByModule("investmentSigningDiligenceReportScore", 2, reportNameType.getFlowId());
|
|
|
|
|
int count = 0;
|
|
|
|
|
for (MultipartFile file : files) {
|
|
|
|
|
|
|
|
|
|
}else if ("估值报告".equals(reportNameType.getReportNameType())){
|
|
|
|
|
//investmentSigningVlauationReportScore
|
|
|
|
|
performanceScoreService.calculateScoreByModule("investmentSigningVlauationReportScore", 2, reportNameType.getFlowId());
|
|
|
|
|
//返回文件上传路径
|
|
|
|
|
String filePath = fileUtil.upload(file);
|
|
|
|
|
//获取文件名
|
|
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
|
|
|
|
|
|
|
|
//截取文件后缀
|
|
|
|
|
String fileExtension = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase();
|
|
|
|
|
if (!fileExtension.equals(".pdf") && !fileExtension.equals(".doc") && !fileExtension.equals(".docx")) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "文件必须为word或pdf!");
|
|
|
|
|
}
|
|
|
|
|
//查看文件是否已经上传
|
|
|
|
|
List<TrainingReport> trainingReports = getTrainingReports(reportNameType.getFlowId(), reportNameType.getReportNameType());
|
|
|
|
|
|
|
|
|
|
//一个两个做判断
|
|
|
|
|
|
|
|
|
|
if ("尽调报告".equals(reportNameType.getReportNameType())){
|
|
|
|
|
if (trainingReports.size() > 0 ) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!");
|
|
|
|
|
} else { //只允许提交一次
|
|
|
|
|
TrainingReport trainingReport = new TrainingReport();
|
|
|
|
|
trainingReport.setId(IdUtil.fastSimpleUUID());
|
|
|
|
|
trainingReport.setFlowId(reportNameType.getFlowId());
|
|
|
|
|
trainingReport.setSchoolId(reportNameType.getSchoolId());
|
|
|
|
|
trainingReport.setUrl(filePath);
|
|
|
|
|
String filename = file.getOriginalFilename();
|
|
|
|
|
trainingReport.setReportName(filename);
|
|
|
|
|
trainingReport.setUploadtime(new Date());
|
|
|
|
|
trainingReport.setStep(reportNameType.getReportNameType());
|
|
|
|
|
trainingReportMapper.insert(trainingReport);
|
|
|
|
|
//(每个2分,共4分)
|
|
|
|
|
if ("尽调报告".equals(reportNameType.getReportNameType())){
|
|
|
|
|
//investmentSigningDiligenceReportScore
|
|
|
|
|
|
|
|
|
|
performanceScoreService.calculateScoreByModule("investmentSigningDiligenceReportScore", 2, reportNameType.getFlowId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else if ("估值报告".equals(reportNameType.getReportNameType())){
|
|
|
|
|
if (trainingReports.size() >= 2 ) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不允许重复提交!");
|
|
|
|
|
}else {
|
|
|
|
|
TrainingReport trainingReport = new TrainingReport();
|
|
|
|
|
trainingReport.setId(IdUtil.fastSimpleUUID());
|
|
|
|
|
trainingReport.setFlowId(reportNameType.getFlowId());
|
|
|
|
|
trainingReport.setSchoolId(reportNameType.getSchoolId());
|
|
|
|
|
trainingReport.setUrl(filePath);
|
|
|
|
|
String filename = file.getOriginalFilename();
|
|
|
|
|
trainingReport.setReportName(filename);
|
|
|
|
|
trainingReport.setUploadtime(new Date());
|
|
|
|
|
trainingReport.setStep(reportNameType.getReportNameType());
|
|
|
|
|
trainingReportMapper.insert(trainingReport);
|
|
|
|
|
count++;
|
|
|
|
|
if (count == 1)
|
|
|
|
|
{
|
|
|
|
|
performanceScoreService.calculateScoreByModule("investmentSigningVlauationReportScore", 2, reportNameType.getFlowId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "报告上传成功!");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "报告上传成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|