DownloadAction.java
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.cjs.site.action.info;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.cjs.site.biz.info.DownloadBiz;
import com.cjs.site.model.download.DownInfo;
import com.cjs.site.util.web.ActionUtil;
/**
* 下载
*
* @author tongyufu
*
*/
@Controller
public class DownloadAction {
@Autowired
private DownloadBiz download;
/**页面中转*/
@RequestMapping("/download")
public String toDownLoad() {
return "info/download.jsp";
}
/** 文件下载 */
/*
public ResponseEntity<byte[]> download(String file, Integer type,
HttpServletRequest request) throws IOException {
DownInfo downInfo = new DownInfo();
downInfo.setSort(type);
downInfo.setDownIp(ActionUtil.getIP());
downInfo.setDownTime(new Date());
download.addDownLoad(downInfo);
return download.download(file, request);
}*/
/** 客户端下载 */
@RequestMapping("/downloadFile")
public void download2(String file, Integer type, HttpServletRequest request,
HttpServletResponse response) {
DownInfo downInfo = new DownInfo();
if (type != null) {
downInfo.setSort(type);
} else {
downInfo.setSort(0);
}
downInfo.setDownIp(ActionUtil.getIP());
downInfo.setDownTime(new Date());
download.addDownLoad(downInfo);
download.download2(file, request, response);
}
/**下载统计*/
public String getCount() {
download.getCount();
return null;
}
}