|
|
@@ -44,14 +44,13 @@ public class OfferDataController extends BaseController {
|
|
|
@Autowired
|
|
|
private RedisService redisService;
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 新增
|
|
|
*/
|
|
|
@PostMapping("/bb")
|
|
|
public R<Map<String, String>> add(@RequestBody LandOneCode body) {
|
|
|
try {
|
|
|
- Map<String,String> map = offerDataService.getById("11");
|
|
|
+ Map<String, String> map = offerDataService.getById("11");
|
|
|
map.put("id", map.get("id"));
|
|
|
return R.ok(map);
|
|
|
} catch (Exception e) {
|
|
|
@@ -71,12 +70,10 @@ public class OfferDataController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@PostMapping("/addEntity")
|
|
|
public R<String> addEntity(@RequestBody LandOneCode body) {
|
|
|
try {
|
|
|
- return R.fail(502,"土地统一编码信息已自动生成,无需手动添加");
|
|
|
+ return R.fail(502, "土地统一编码信息已自动生成,无需手动添加");
|
|
|
} catch (Exception e) {
|
|
|
return R.fail(e.getMessage());
|
|
|
}
|
|
|
@@ -95,25 +92,22 @@ public class OfferDataController extends BaseController {
|
|
|
String projectId = paramVo.getYwbh();
|
|
|
String immobileCode = paramVo.getYfbdcdyh();
|
|
|
String dqjd = paramVo.getDqjd();
|
|
|
- if(StringUtils.isBlank(immobileCode)){
|
|
|
- return R.fail(502,"不动产号为空,请填充");
|
|
|
+ if (StringUtils.isBlank(immobileCode)) {
|
|
|
+ return R.fail(502, "不动产号为空,请填充");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(dqjd)){
|
|
|
- return R.fail(502,"标识阶段为空,请填充");
|
|
|
+ if (StringUtils.isBlank(dqjd)) {
|
|
|
+ return R.fail(502, "标识阶段为空,请填充");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(projectId)){
|
|
|
- return R.fail(502,"项目id为空,请填充");
|
|
|
+ if (StringUtils.isBlank(projectId)) {
|
|
|
+ return R.fail(502, "项目id为空,请填充");
|
|
|
}
|
|
|
- NodeAttachment nodeAttachment = offerDataService.getThirdNodeAttachment(immobileCode,projectId,dqjd);
|
|
|
+ NodeAttachment nodeAttachment = offerDataService.getThirdNodeAttachment(immobileCode, projectId, dqjd);
|
|
|
return R.ok(nodeAttachment);
|
|
|
} catch (Exception e) {
|
|
|
- return R.fail(502,"获取附件材料失败");
|
|
|
+ return R.fail(502, "获取附件材料失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 文件下载
|
|
|
*
|
|
|
@@ -122,31 +116,33 @@ public class OfferDataController extends BaseController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/download/{signature}/{expireTime}/{attachmentId}/{dirName}/{fileName}")
|
|
|
- public ResponseEntity<Resource> uploadAttachment(@PathVariable("signature") String signature,@PathVariable("expireTime") String expireTime,
|
|
|
- @PathVariable("attachmentId") String attachmentId,@PathVariable("dirName") String dirName,
|
|
|
- @PathVariable("fileName") String fileName,
|
|
|
- HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ public ResponseEntity<Resource> uploadAttachment(@PathVariable("signature") String signature,
|
|
|
+ @PathVariable("expireTime") String expireTime,
|
|
|
+ @PathVariable("attachmentId") String attachmentId, @PathVariable("dirName") String dirName,
|
|
|
+ @PathVariable("fileName") String fileName,
|
|
|
+ HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
|
try {
|
|
|
- if(StringUtils.isBlank(signature) || Objects.isNull(expireTime) || StringUtils.isBlank(attachmentId)
|
|
|
- ||StringUtils.isBlank(dirName) ||StringUtils.isBlank(fileName)){
|
|
|
+ if (StringUtils.isBlank(signature) || Objects.isNull(expireTime) || StringUtils.isBlank(attachmentId)
|
|
|
+ || StringUtils.isBlank(dirName) || StringUtils.isBlank(fileName)) {
|
|
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
|
|
|
}
|
|
|
|
|
|
- //过期时间和签名校验
|
|
|
- String signaturePath = attachmentId+"/"+dirName+"/"+fileName;
|
|
|
- if(!ServiceUtil.isUrlValid(signaturePath,signature,Long.valueOf(expireTime))){
|
|
|
+ // 过期时间和签名校验
|
|
|
+ String signaturePath = attachmentId + "/" + dirName + "/" + fileName;
|
|
|
+ if (!ServiceUtil.isUrlValid(signaturePath, signature, Long.valueOf(expireTime))) {
|
|
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
|
|
|
}
|
|
|
|
|
|
// 写一个方法,通过id,和文件名称,文件目录,获取当前文件路径。
|
|
|
- String fullFilePath = offerDataService.getTheFile(attachmentId,dirName,fileName);
|
|
|
- if(StringUtils.isBlank(fullFilePath)){
|
|
|
+ String fullFilePath = offerDataService.getTheFile(attachmentId, dirName, fileName);
|
|
|
+ if (StringUtils.isBlank(fullFilePath)) {
|
|
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();
|
|
|
}
|
|
|
|
|
|
- //获取地址:
|
|
|
- //String uploadFile = "D:\\home\\siwei\\uploadPath\\2025\\11\\26\\测试工具列表222_20251106083212A098.xls";
|
|
|
+ // 获取地址:
|
|
|
+ // String uploadFile =
|
|
|
+ // "D:\\home\\siwei\\uploadPath\\2025\\11\\26\\测试工具列表222_20251106083212A098.xls";
|
|
|
// 构建文件的完整路径
|
|
|
Path filePath = Paths.get(fullFilePath);
|
|
|
File file = filePath.toFile();
|
|
|
@@ -167,9 +163,9 @@ public class OfferDataController extends BaseController {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + d1_name);
|
|
|
headers.setContentType(MediaType.parseMediaType(contentType));
|
|
|
-// headers.setAccessControlAllowOrigin("*");
|
|
|
+ // headers.setAccessControlAllowOrigin("*");
|
|
|
// 返回文件资源
|
|
|
- return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath)) // 可选:设置内容长度
|
|
|
+ return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath)) // 可选:设置内容长度
|
|
|
.body(resource);
|
|
|
} catch (Exception e) {
|
|
|
// 处理IO异常,例如文件不存在或无法读取
|
|
|
@@ -177,15 +173,6 @@ public class OfferDataController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 文件下载
|
|
|
*
|
|
|
@@ -194,7 +181,8 @@ public class OfferDataController extends BaseController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/download/file222/{id}/{uploadId}")
|
|
|
- public ResponseEntity<Resource> uploadAttachment222(@PathVariable("id") String id, @PathVariable("uploadId") String uploadId, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ public ResponseEntity<Resource> uploadAttachment222(@PathVariable("id") String id,
|
|
|
+ @PathVariable("uploadId") String uploadId, HttpServletRequest request, HttpServletResponse response) {
|
|
|
try {
|
|
|
String upload_id = "upliad_" + id + "_" + uploadId;
|
|
|
String uploadFile = redisService.getCacheObject(upload_id);
|
|
|
@@ -221,25 +209,15 @@ public class OfferDataController extends BaseController {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + d1_name);
|
|
|
headers.setContentType(MediaType.parseMediaType(contentType));
|
|
|
-// headers.setAccessControlAllowOrigin("*");
|
|
|
+ // headers.setAccessControlAllowOrigin("*");
|
|
|
// 返回文件资源
|
|
|
- return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath)) // 可选:设置内容长度
|
|
|
+ return ResponseEntity.ok().headers(headers).contentLength(Files.size(filePath)) // 可选:设置内容长度
|
|
|
.body(resource);
|
|
|
} catch (Exception e) {
|
|
|
// 处理IO异常,例如文件不存在或无法读取
|
|
|
-// e.printStackTrace();
|
|
|
+ // e.printStackTrace();
|
|
|
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|