|
|
@@ -5,6 +5,7 @@ import com.uas.dfs.service.FileClient;
|
|
|
import com.uas.platform.b2b.dao.CommonDao;
|
|
|
import com.uas.platform.b2b.model.Attach;
|
|
|
import com.uas.platform.b2b.model.PurchaseOrderAll;
|
|
|
+import com.uas.platform.b2b.ps.InquiryUtils;
|
|
|
import com.uas.platform.b2b.service.AttachService;
|
|
|
import com.uas.platform.b2b.service.PurchaseOrderService;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
@@ -43,8 +44,6 @@ public class FileController {
|
|
|
@Autowired
|
|
|
private CommonDao commonDao;
|
|
|
|
|
|
- private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
|
|
|
-
|
|
|
/**
|
|
|
* 文件下载
|
|
|
*
|
|
|
@@ -53,12 +52,14 @@ public class FileController {
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
@RequestMapping("/{fileId}")
|
|
|
- public void download(@PathVariable("fileId") long fileId, HttpServletResponse response) throws IOException {
|
|
|
+ public void download(@PathVariable("fileId") long fileId, HttpServletResponse response) throws Exception {
|
|
|
Attach attach = attachService.getAttach(fileId);
|
|
|
- if(attach == null) {
|
|
|
- throw new IllegalArgumentException("附件不存在");
|
|
|
+ if (attach == null) {
|
|
|
+ attach = InquiryUtils.getAttach(fileId);
|
|
|
+ if (attach == null) {
|
|
|
+ throw new IllegalArgumentException("附件不存在");
|
|
|
+ }
|
|
|
}
|
|
|
- logger.log(SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu(), "附件下载", attach.getName() + "下载", "关联附件id: " + attach.getId());
|
|
|
response.addHeader("Content-Disposition", "attachment;filename=" + new String(attach.getName().getBytes("utf-8"), "iso-8859-1"));
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
response.setContentType("application/octec-stream");
|
|
|
@@ -111,7 +112,6 @@ public class FileController {
|
|
|
StringBuffer idString = null;
|
|
|
String url = null;
|
|
|
if (!CollectionUtils.isEmpty(attaches)) {
|
|
|
- logger.log(SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu(),"附件下载", "采购单附件批量下载", "关联订单id: " + id);
|
|
|
for (Attach attach : attaches) {
|
|
|
if (attach.getPath().startsWith("http://dfs.ubtob.com")) {// 存储在dfs存储服务器,去dfs存储服务器下载
|
|
|
// TODO dfs服务器上打包下载
|