|
|
|
@ -4,15 +4,24 @@ import com.sztzjy.digital_credit.annotation.AnonymousAccess;
|
|
|
|
|
import com.sztzjy.digital_credit.entity.StuMachineLearning;
|
|
|
|
|
import com.sztzjy.digital_credit.service.StuExperimentTrainByCreditService;
|
|
|
|
|
import com.sztzjy.digital_credit.util.ResultEntity;
|
|
|
|
|
import com.sztzjy.digital_credit.util.file.IFileUtil;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import javax.validation.constraints.NotBlank;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author 17803
|
|
|
|
@ -30,6 +39,13 @@ public class StuExperimentTrainByCreditController {
|
|
|
|
|
private StuExperimentTrainByCreditService experimentTrainByCreditService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${file.path}")
|
|
|
|
|
private String filePath;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
IFileUtil iFileUtil;
|
|
|
|
|
|
|
|
|
|
@ApiOperation("前端校验数据(自动保存接口)")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@PostMapping("/trainByPublicSave")
|
|
|
|
@ -41,10 +57,39 @@ public class StuExperimentTrainByCreditController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("查看统一功能")
|
|
|
|
|
@GetMapping("/preAllView")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
public ResponseEntity<byte[]> preViewByContract(
|
|
|
|
|
@RequestParam(required = true,name = "name")@NotBlank @ApiParam("文件类型名如:负债信息概要/参保信息样板") String name) throws IOException {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("负债信息概要","/credit/**");
|
|
|
|
|
map.put("参保信息样板","/credit/**");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String fileUrl = map.get(name);
|
|
|
|
|
|
|
|
|
|
// 模拟加载公章图片的数据(假设在硬盘上的某个路径下)
|
|
|
|
|
String imagePath = filePath + fileUrl;
|
|
|
|
|
// 替换为你的实际路径
|
|
|
|
|
byte[] sealBytes = Files.readAllBytes(Paths.get(imagePath));
|
|
|
|
|
|
|
|
|
|
// 构建HTTP响应,设置Content-Type为image/png
|
|
|
|
|
return ResponseEntity.ok().contentType(MediaType.IMAGE_PNG).body(sealBytes);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 担保协议书
|
|
|
|
|
|
|
|
|
|
@PostMapping("/downloadDoc")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("下载担保协议书")
|
|
|
|
|
public void download(HttpServletResponse response){
|
|
|
|
|
iFileUtil.download(response,"/credit/**");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|