|
|
@ -37,8 +37,7 @@ import org.springframework.web.multipart.MultipartFile; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.File; |
|
|
|
import java.io.*; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -144,6 +143,38 @@ public class DgApplyAmountInfoController implements DgApplyAmountInfoControllerA |
|
|
|
return ResponseResult.SUCCESS(list); |
|
|
|
return ResponseResult.SUCCESS(list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 下载单个文件 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param response |
|
|
|
|
|
|
|
* @param fileName |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@RequestMapping("/download") |
|
|
|
|
|
|
|
public String download(HttpServletResponse response, @RequestParam("fileName") String fileName) { |
|
|
|
|
|
|
|
File file = new File(PromptSuccess.FILE_URL_PATH + fileName); |
|
|
|
|
|
|
|
if (file.exists()) { |
|
|
|
|
|
|
|
response.setContentType("application/force-download;charset=UTF-8"); |
|
|
|
|
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName =" + fileName); |
|
|
|
|
|
|
|
byte[] buffer = new byte[1024]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try (FileInputStream inputStream = new FileInputStream(file); |
|
|
|
|
|
|
|
OutputStream outStream = response.getOutputStream(); |
|
|
|
|
|
|
|
BufferedInputStream buffStream = new BufferedInputStream(inputStream);) { |
|
|
|
|
|
|
|
int i = 0; |
|
|
|
|
|
|
|
while ((i = buffStream.read(buffer)) != -1) { |
|
|
|
|
|
|
|
outStream.write(buffer); |
|
|
|
|
|
|
|
outStream.write(buffer, 0, i); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "download success"; |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("download error {}", e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除服务上的文件 |
|
|
|
* 删除服务上的文件 |
|
|
|
* @param filePath 路径 |
|
|
|
* @param filePath 路径 |
|
|
@ -212,6 +243,8 @@ public class DgApplyAmountInfoController implements DgApplyAmountInfoControllerA |
|
|
|
if(response.getPresenterId().equals(res.get("id"))){//如果提单人id相同情况下,就往对象里面赋值
|
|
|
|
if(response.getPresenterId().equals(res.get("id"))){//如果提单人id相同情况下,就往对象里面赋值
|
|
|
|
response.setAccount(JSONObject.toJSONString(res.get("account")).replace("\"","")); |
|
|
|
response.setAccount(JSONObject.toJSONString(res.get("account")).replace("\"","")); |
|
|
|
response.setDeptName(JSONObject.toJSONString(res.get("deptName")).replace("\"","")); |
|
|
|
response.setDeptName(JSONObject.toJSONString(res.get("deptName")).replace("\"","")); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
response.setAccount("客户"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|