文件OSS上传

This commit is contained in:
haozq 2025-12-25 15:12:16 +08:00
parent 01a8a3256e
commit b71e854c27
11 changed files with 223 additions and 98 deletions

View File

@ -5,43 +5,17 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="30706c6d-35cd-44ba-b6ec-9865ccea7a75" name="Changes" comment="文件OSS上传"> <list default="true" id="30706c6d-35cd-44ba-b6ec-9865ccea7a75" name="Changes" comment="文件OSS上传">
<change afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/file/UploadFileController.java" afterDir="false" /> <change afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/controller/ResourceFileController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/file/UploadService.java" afterDir="false" /> <change afterPath="$PROJECT_DIR$/realname-app/src/main/resources/file/aqgzs.pdf" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/file/config/OssConfig.java" afterDir="false" /> <change afterPath="$PROJECT_DIR$/realname-app/src/main/resources/file/ygxy.pdf" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/file/utils/OssUtil.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/CustomDedupeResponseHeaderGatewayFilterFactory.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/PdfPreviewGlobalFilter.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/file/UploadFileController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/file/UploadService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/file/config/OssConfig.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/file/utils/OssUtil.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/file/UploadFileController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/file/UploadService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/file/config/OssConfig.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/file/utils/OssUtil.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-czl-service/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/hn-czl-service/pom.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/config/BnsSecurityConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/config/BnsSecurityConfig.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/project/controller/ProgressController.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-czl-service/src/main/java/com/bonus/hn/bearing/capacity/backstage/project/controller/ProgressController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/config/ContextPathConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/config/ContextPathConfig.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/OssSignFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-gateway/bonus-gateway/src/main/java/com/bonus/gateway/filter/OssSignFilter.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/controller/LdlzRecordController.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/ldlz/controller/LdlzRecordController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/web/controller/common/CommonController.java" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/java/com/bns/web/controller/common/CommonController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/resources/mapper/ldlz/LdlzRecordProblemMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/hn-ldlz/ldlz-admin/src/main/resources/mapper/ldlz/LdlzRecordProblemMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/real-name/src/main/java/com/bonus/hnrn/rnbmw/file/utils/OssUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/real-name/src/main/java/com/bonus/hnrn/rnbmw/file/utils/OssUtil.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/config/TokenFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/config/TokenFilter.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/config/TokenFilter.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/config/TokenFilter.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/controller/UserController.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/controller/UserController.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/entity/ContractBean.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/entity/ContractBean.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/dao/SysLogsDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/dao/SysLogsDao.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/entity/WorkerPhotoBean.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/entity/WorkerPhotoBean.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/util/Ajax.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/util/Ajax.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/util/AttachmentService.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/util/AttachmentService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/util/PdfUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/core/util/PdfUtil.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/offline/dao/OffLineDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/offline/dao/OffLineDao.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/PersonEinAuditServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/PersonEinAuditServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/PersonIdentifyServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/PersonIdentifyServiceImpl.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/PersonIdentifyServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/PersonIdentifyServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/WorkPersonServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/WorkPersonServiceImpl.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/WorkPersonServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/java/com/bonus/hnrn/rnama/person/service/WorkPersonServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/resources/bootstrap.yml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/realname-app/src/main/resources/mappers/person/WorkPersonMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/resources/mappers/person/WorkPersonMapper.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/realname-app/src/main/resources/mappers/person/PersonIdentifyMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/realname-app/src/main/resources/mappers/person/PersonIdentifyMapper.xml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -81,67 +55,67 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;Maven.HnRealNameBmw [clean].executor&quot;: &quot;Run&quot;, "Maven.HnRealNameBmw [clean].executor": "Run",
&quot;Maven.HnRealNameBmw [install].executor&quot;: &quot;Run&quot;, "Maven.HnRealNameBmw [install].executor": "Run",
&quot;Maven.HnRealNameMmw [clean].executor&quot;: &quot;Run&quot;, "Maven.HnRealNameMmw [clean].executor": "Run",
&quot;Maven.HnRealNameMmw [install].executor&quot;: &quot;Run&quot;, "Maven.HnRealNameMmw [install].executor": "Run",
&quot;Maven.hn-czl-service [clean].executor&quot;: &quot;Run&quot;, "Maven.hn-czl-service [clean].executor": "Run",
&quot;Maven.hn-czl-service [install].executor&quot;: &quot;Run&quot;, "Maven.hn-czl-service [install].executor": "Run",
&quot;Maven.hn-gateway [clean].executor&quot;: &quot;Run&quot;, "Maven.hn-gateway [clean].executor": "Run",
&quot;Maven.hn-gateway [install].executor&quot;: &quot;Run&quot;, "Maven.hn-gateway [install].executor": "Run",
&quot;Maven.hn_czl_screen [clean].executor&quot;: &quot;Run&quot;, "Maven.hn_czl_screen [clean].executor": "Run",
&quot;Maven.hn_czl_screen [install].executor&quot;: &quot;Run&quot;, "Maven.hn_czl_screen [install].executor": "Run",
&quot;Maven.ldlz [clean].executor&quot;: &quot;Run&quot;, "Maven.ldlz [clean].executor": "Run",
&quot;Maven.ldlz [install].executor&quot;: &quot;Run&quot;, "Maven.ldlz [install].executor": "Run",
&quot;Maven.real-name [clean].executor&quot;: &quot;Run&quot;, "Maven.real-name [clean].executor": "Run",
&quot;Maven.real-name [install].executor&quot;: &quot;Run&quot;, "Maven.real-name [install].executor": "Run",
&quot;Maven.real-name-screen [clean].executor&quot;: &quot;Run&quot;, "Maven.real-name-screen [clean].executor": "Run",
&quot;Maven.real-name-screen [install].executor&quot;: &quot;Run&quot;, "Maven.real-name-screen [install].executor": "Run",
&quot;Maven.realname-app [clean].executor&quot;: &quot;Run&quot;, "Maven.realname-app [clean].executor": "Run",
&quot;Maven.realname-app [install].executor&quot;: &quot;Run&quot;, "Maven.realname-app [install].executor": "Run",
&quot;RequestMappingsPanelOrder0&quot;: &quot;0&quot;, "RequestMappingsPanelOrder0": "0",
&quot;RequestMappingsPanelOrder1&quot;: &quot;1&quot;, "RequestMappingsPanelOrder1": "1",
&quot;RequestMappingsPanelWidth0&quot;: &quot;75&quot;, "RequestMappingsPanelWidth0": "75",
&quot;RequestMappingsPanelWidth1&quot;: &quot;75&quot;, "RequestMappingsPanelWidth1": "75",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;, "RunOnceActivity.git.unshallow": "true",
&quot;SONARLINT_PRECOMMIT_ANALYSIS&quot;: &quot;true&quot;, "SONARLINT_PRECOMMIT_ANALYSIS": "true",
&quot;Spring Boot.BonusGatewayApplication.executor&quot;: &quot;Debug&quot;, "Spring Boot.BonusGatewayApplication.executor": "Debug",
&quot;Spring Boot.CzlScreenApplication.executor&quot;: &quot;Run&quot;, "Spring Boot.CzlScreenApplication.executor": "Run",
&quot;Spring Boot.CzlServiceApplication.executor&quot;: &quot;Debug&quot;, "Spring Boot.CzlServiceApplication.executor": "Debug",
&quot;Spring Boot.HnRealNameBmwApplication.executor&quot;: &quot;Debug&quot;, "Spring Boot.HnRealNameBmwApplication.executor": "Debug",
&quot;Spring Boot.LdlzApplication.executor&quot;: &quot;Debug&quot;, "Spring Boot.LdlzApplication.executor": "Debug",
&quot;Spring Boot.RealNameAppApplication.executor&quot;: &quot;Debug&quot;, "Spring Boot.RealNameAppApplication.executor": "Debug",
&quot;Spring Boot.RnamaApplication.executor&quot;: &quot;Run&quot;, "Spring Boot.RnamaApplication.executor": "Run",
&quot;Spring Boot.RnmwApplication.executor&quot;: &quot;Run&quot;, "Spring Boot.RnmwApplication.executor": "Run",
&quot;git-widget-placeholder&quot;: &quot;main&quot;, "git-widget-placeholder": "main",
&quot;kotlin-language-version-configured&quot;: &quot;true&quot;, "kotlin-language-version-configured": "true",
&quot;last_opened_file_path&quot;: &quot;F:/workspace/idea/hn_cloud_service/realname-app/src/main/java/com/bonus/hnrn/rnama/core&quot;, "last_opened_file_path": "F:/workspace/idea/hn_cloud_service/realname-app/src/main/resources/file",
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;, "node.js.detected.package.eslint": "true",
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;, "node.js.detected.package.tslint": "true",
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;, "node.js.selected.package.eslint": "(autodetect)",
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;, "node.js.selected.package.tslint": "(autodetect)",
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;, "nodejs_package_manager_path": "npm",
&quot;project.structure.last.edited&quot;: &quot;Project&quot;, "project.structure.last.edited": "Project",
&quot;project.structure.proportion&quot;: &quot;0.15&quot;, "project.structure.proportion": "0.15",
&quot;project.structure.side.proportion&quot;: &quot;0.43843496&quot;, "project.structure.side.proportion": "0.43843496",
&quot;run.configurations.included.in.services&quot;: &quot;true&quot;, "run.configurations.included.in.services": "true",
&quot;settings.editor.selected.configurable&quot;: &quot;reference.settings.project.maven.importing&quot;, "settings.editor.selected.configurable": "reference.settings.project.maven.importing",
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot; "vue.rearranger.settings.migration": "true"
} }
}</component> }]]></component>
<component name="ReactorSettings"> <component name="ReactorSettings">
<option name="notificationShown" value="true" /> <option name="notificationShown" value="true" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CopyFile.RECENT_KEYS">
<recent name="F:\workspace\idea\hn_cloud_service\realname-app\src\main\resources\file" />
<recent name="F:\workspace\idea\hn_cloud_service\realname-app\src\main\java\com\bonus\hnrn\rnama\core" /> <recent name="F:\workspace\idea\hn_cloud_service\realname-app\src\main\java\com\bonus\hnrn\rnama\core" />
<recent name="F:\workspace\idea\hn_cloud_service\hn-ldlz\ldlz-admin\src\main\java\com\bns\ldlz" /> <recent name="F:\workspace\idea\hn_cloud_service\hn-ldlz\ldlz-admin\src\main\java\com\bns\ldlz" />
<recent name="F:\workspace\idea\hn_cloud_service\hn-czl-service\src\main\java\com\bonus\hn\bearing\capacity\backstage" /> <recent name="F:\workspace\idea\hn_cloud_service\hn-czl-service\src\main\java\com\bonus\hn\bearing\capacity\backstage" />
<recent name="F:\workspace\idea\hn_cloud_service\real-name\src\main\resources\mappers" /> <recent name="F:\workspace\idea\hn_cloud_service\real-name\src\main\resources\mappers" />
<recent name="F:\workspace\idea\hn_cloud_service\real-name\src\main\java\com\bonus\hnrn\rnbmw" />
</key> </key>
<key name="MoveFile.RECENT_KEYS"> <key name="MoveFile.RECENT_KEYS">
<recent name="F:\workspace\idea\hn_cloud_service\hn-ldlz\ldlz-admin\src\main\resources\mapper\ldlz" /> <recent name="F:\workspace\idea\hn_cloud_service\hn-ldlz\ldlz-admin\src\main\resources\mapper\ldlz" />
@ -290,7 +264,7 @@
<workItem from="1765847372970" duration="757000" /> <workItem from="1765847372970" duration="757000" />
<workItem from="1765855068157" duration="57024000" /> <workItem from="1765855068157" duration="57024000" />
<workItem from="1766108031136" duration="37559000" /> <workItem from="1766108031136" duration="37559000" />
<workItem from="1766389415424" duration="51545000" /> <workItem from="1766389415424" duration="59537000" />
</task> </task>
<task id="LOCAL-00001" summary="修改新增用户"> <task id="LOCAL-00001" summary="修改新增用户">
<option name="closed" value="true" /> <option name="closed" value="true" />
@ -508,7 +482,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1766485046206</updated> <updated>1766485046206</updated>
</task> </task>
<option name="localTasksCounter" value="28" /> <task id="LOCAL-00028" summary="文件OSS上传">
<option name="closed" value="true" />
<created>1766633422277</created>
<option name="number" value="00028" />
<option name="presentableId" value="LOCAL-00028" />
<option name="project" value="LOCAL" />
<updated>1766633422277</updated>
</task>
<option name="localTasksCounter" value="29" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">

View File

@ -53,7 +53,7 @@ public class BnsSecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()//开启登录配置 http.authorizeRequests()//开启登录配置
.antMatchers("/gzRealName/**","/user/**","/offLine/**","/login").permitAll() .antMatchers("/gzRealName/**","/user/**","/offLine/**","/login","/api/resource/getResourceFile").permitAll()
.anyRequest().authenticated();//表示剩余的其他接口登录之后就能访问 .anyRequest().authenticated();//表示剩余的其他接口登录之后就能访问
http.formLogin().loginProcessingUrl("/login") http.formLogin().loginProcessingUrl("/login")
//登录成功的处理器 //登录成功的处理器

View File

@ -40,7 +40,7 @@ public class TokenFilter extends OncePerRequestFilter {
throws ServletException, IOException { throws ServletException, IOException {
String token = getToken(request); String token = getToken(request);
String requestURI = request.getRequestURI(); String requestURI = request.getRequestURI();
if ("/login".equals(requestURI)) { if ("/login".equals(requestURI) || "/api/resource/getResourceFile".equals(requestURI)) {
filterChain.doFilter(request, response); filterChain.doFilter(request, response);
return; return;
}else{ }else{

View File

@ -0,0 +1,117 @@
package com.bonus.hnrn.rnama.core.controller;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import org.springframework.web.bind.annotation.RequestParam;
@RestController
@RequestMapping("/api/resource")
public class ResourceFileController {
// 固定文件根目录resources/files/
private static final String RESOURCE_ROOT = "file/";
@GetMapping("getResourceFile")
public ResponseEntity<byte[]> getResourceFile(@RequestParam String filePath) { // 显式声明@RequestParam避免参数绑定失败
try {
// 1. 入参校验避免空指针
if (filePath == null || filePath.trim().isEmpty()) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
}
String fullPath = RESOURCE_ROOT + filePath.trim();
Resource resource = new ClassPathResource(fullPath);
long originalFileSize = 0;
if (resource.exists()) {
originalFileSize = resource.contentLength();
}
// 2. 校验文件存在性
if (!resource.exists() || !resource.isReadable()) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
}
// 3. 读取文件字节流核心确保完整读取兼容JAR包
byte[] fileBytes;
try (InputStream inputStream = resource.getInputStream()) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
bos.write(buffer, 0, bytesRead);
}
fileBytes = bos.toByteArray();
// 校验读取完整性
if (fileBytes.length != originalFileSize) {
System.err.println("警告:读取的字节数与原文件大小不一致!");
}
} catch (IOException e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
}
// 4. 确定媒体类型优先PDF兜底自动识别
MediaType mediaType = MediaType.APPLICATION_PDF;
if (!filePath.endsWith(".pdf")) {
mediaType = getMediaTypeByFileName(filePath);
}
// 5. 构建响应头解决乱码/空白核心
HttpHeaders headers = new HttpHeaders();
headers.setContentType(mediaType); // 强制媒体类型
headers.setContentLength(fileBytes.length); // 明确文件大小
// 禁用缓存避免浏览器加载旧文件
headers.setCacheControl(CacheControl.noCache().noStore().getHeaderValue());
// 跨域配置完整且正确
// headers.setAccessControlAllowOrigin("*");
// List<HttpMethod> allowedMethods = Arrays.asList(HttpMethod.GET, HttpMethod.OPTIONS);
// headers.setAccessControlAllowMethods(allowedMethods);
// 关键预览模式inline避免触发下载
// 设置Content-Disposition
headers.setContentDisposition(ContentDisposition.builder("inline")
.filename(filePath, java.nio.charset.StandardCharsets.UTF_8)
.build());
// 6. 返回字节数组核心修正不再返回Resource
return ResponseEntity.ok()
.headers(headers)
.body(fileBytes);
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
}
}
/**
* 兜底的媒体类型识别
*/
private MediaType getMediaTypeByFileName(String fileName) {
if (fileName == null) {
return MediaType.APPLICATION_OCTET_STREAM;
}
String lowerName = fileName.toLowerCase();
if (lowerName.endsWith(".jpg") || lowerName.endsWith(".jpeg")) {
return MediaType.IMAGE_JPEG;
} else if (lowerName.endsWith(".png")) {
return MediaType.IMAGE_PNG;
} else if (lowerName.endsWith(".gif")) {
return MediaType.IMAGE_GIF;
} else if (lowerName.endsWith(".json")) {
return MediaType.APPLICATION_JSON;
} else {
return MediaType.APPLICATION_OCTET_STREAM;
}
}
}

View File

@ -19,6 +19,8 @@ public class ContractBean {
* 视频录制 * 视频录制
*/ */
private String videoUrl; private String videoUrl;
private String videoUrlPath;
/** /**
* 甲方身份证 * 甲方身份证
*/ */
@ -181,6 +183,8 @@ public class ContractBean {
private String messageTime; private String messageTime;
private String shortMessage; private String shortMessage;
private String personPdfUrl; private String personPdfUrl;
private String personPdfUrlPath;
private String subPdfUrl; private String subPdfUrl;
private String proId; private String proId;
private String subId; private String subId;
@ -211,7 +215,10 @@ public class ContractBean {
/** /**
* 安全协议书路径 * 安全协议书路径
*/ */
private String aqxysPath; private String aqxysPath;
private String aqxysPathUrl;
/** /**
* 安全协议书签署路径 * 安全协议书签署路径
*/ */

View File

@ -22,20 +22,31 @@ public class WorkerPhotoBean implements Serializable {
* 身份证正面照片 * 身份证正面照片
*/ */
private String frontPhoto; private String frontPhoto;
private String frontPhotoUrl;
/** /**
* 身份证反面照片 * 身份证反面照片
*/ */
private String backPhoto; private String backPhoto;
private String backPhotoUrl;
/** /**
* 人脸 * 人脸
*/ */
private String facePhoto; private String facePhoto;
private String facePhotoUrl;
/** /**
* 银行卡 * 银行卡
*/ */
private String bankPhoto; private String bankPhoto;
private String bankPhotoUrl;
/** /**
* 签名 * 签名
*/ */
private String signaturePhoto; private String signaturePhoto;
private String signaturePhotoUrl;
} }

View File

@ -38,11 +38,11 @@ public class PersonIdentifyServiceImpl implements PersonIdentifyService {
public WorkerPhotoBean selectWorkerPhotoByIdNumber(WorkerPhotoBean bean) { public WorkerPhotoBean selectWorkerPhotoByIdNumber(WorkerPhotoBean bean) {
WorkerPhotoBean ben= dao.selectWorkerPhotoByIdNumber(bean); WorkerPhotoBean ben= dao.selectWorkerPhotoByIdNumber(bean);
if(ben!=null){ if(ben!=null){
ben.setBankPhoto(uploadService.getPresignedUrl(ben.getBankPhoto())); ben.setBankPhotoUrl(uploadService.getPresignedUrl(ben.getBankPhoto()));
ben.setSignaturePhoto(uploadService.getPresignedUrl(ben.getSignaturePhoto())); ben.setSignaturePhotoUrl(uploadService.getPresignedUrl(ben.getSignaturePhoto()));
ben.setBackPhoto(uploadService.getPresignedUrl(ben.getBackPhoto())); ben.setBackPhotoUrl(uploadService.getPresignedUrl(ben.getBackPhoto()));
ben.setFacePhoto(uploadService.getPresignedUrl(ben.getFacePhoto())); ben.setFacePhotoUrl(uploadService.getPresignedUrl(ben.getFacePhoto()));
ben.setFrontPhoto(uploadService.getPresignedUrl(ben.getFrontPhoto())); ben.setFrontPhotoUrl(uploadService.getPresignedUrl(ben.getFrontPhoto()));
} }
return ben; return ben;
} }

View File

@ -278,15 +278,23 @@ public class WorkPersonServiceImpl implements WorkPersonService {
public List<ContractBean> queryList(ContractBean bean) { public List<ContractBean> queryList(ContractBean bean) {
List<ContractBean> list= workPersonDao.queryList(bean); List<ContractBean> list= workPersonDao.queryList(bean);
for (ContractBean bean2 : list) { for (ContractBean bean2 : list) {
bean2.setVideoUrl(uploadService.getPresignedUrl(bean2.getVideoUrl())); bean2.setVideoUrlPath(uploadService.getPresignedUrl(bean2.getVideoUrl()));
bean2.setPersonPdfUrl(uploadService.getPresignedUrl(bean2.getPersonPdfUrl())); bean2.setPersonPdfUrlPath(uploadService.getPresignedUrl(bean2.getPersonPdfUrl()));
bean2.setAqxysPathUrl(uploadService.getPresignedUrl(bean2.getAqcnsPath()));
} }
return list; return list;
} }
@Override @Override
public List<ContractBean> queryIsSignList(ContractBean bean) { public List<ContractBean> queryIsSignList(ContractBean bean) {
return workPersonDao.queryIsSignList(bean); List<ContractBean> list= workPersonDao.queryIsSignList(bean);
for (ContractBean bean2 : list) {
bean2.setPersonPdfUrlPath(uploadService.getPresignedUrl(bean2.getPersonPdfUrl()));
bean2.setVideoUrlPath(uploadService.getPresignedUrl(bean2.getVideoUrl()));
bean2.setAqxysPathUrl(uploadService.getPresignedUrl(bean2.getAqcnsPath()));
}
return list;
} }
@Override @Override
@ -382,7 +390,7 @@ public class WorkPersonServiceImpl implements WorkPersonService {
Map<String,String> map=uploadService.uploadLocalFile(lastFile,"app/contract/pdf"); Map<String,String> map=uploadService.uploadLocalFile(lastFile,"app/contract/pdf");
String url=uploadService.getPresignedUrl(map.get("url")); String url=uploadService.getPresignedUrl(map.get("url"));
boolean isDel=lastFile.delete(); boolean isDel=lastFile.delete();
return Ajax.ok(url,path); return Ajax.ok(url,map.get("url"));
} }
return !tf ? Ajax.ok(path) : Ajax.error(bean.getPartB() + "已存在电子合同或电子合同未签署完,请勿重复提交"); return !tf ? Ajax.ok(path) : Ajax.error(bean.getPartB() + "已存在电子合同或电子合同未签署完,请勿重复提交");
} }

Binary file not shown.

Binary file not shown.

View File

@ -969,7 +969,7 @@
,#{isXbg} ,#{isXbg}
</if> </if>
<if test="xbgContractId!=null and xbgContractId!=''"> <if test="xbgContractId!=null and xbgContractId!=''">
,,#{xbgContractId} ,#{xbgContractId}
</if> </if>
) )
</insert> </insert>