|
|
@@ -6,7 +6,6 @@ import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.sql.SQLException;
|
|
|
-import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -14,6 +13,7 @@ import javax.servlet.ServletException;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.uas.report.util.*;
|
|
|
import org.dom4j.DocumentException;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -24,13 +24,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import com.uas.report.service.FileService;
|
|
|
import com.uas.report.service.PrintService;
|
|
|
-import com.uas.report.util.ArrayUtils;
|
|
|
-import com.uas.report.util.CollectionUtils;
|
|
|
-import com.uas.report.util.FileUtils;
|
|
|
-import com.uas.report.util.Platform;
|
|
|
-import com.uas.report.util.ReportConstants;
|
|
|
-import com.uas.report.util.ReportUtils;
|
|
|
-import com.uas.report.util.StringUtils;
|
|
|
|
|
|
import net.sf.jasperreports.engine.JRException;
|
|
|
|
|
|
@@ -45,7 +38,7 @@ import net.sf.jasperreports.engine.JRException;
|
|
|
@RequestMapping("/print")
|
|
|
public class PrintController {
|
|
|
|
|
|
- private static final long timestamp = new Date().getTime();
|
|
|
+ private static final long timestamp = System.currentTimeMillis();
|
|
|
|
|
|
@Autowired
|
|
|
private PrintService printService;
|
|
|
@@ -82,11 +75,10 @@ public class PrintController {
|
|
|
* @throws JRException
|
|
|
* @throws ServletException
|
|
|
*/
|
|
|
- @RequestMapping()
|
|
|
+ @RequestMapping
|
|
|
public void print(String userName, String profile, String reportName, String whereCondition, String otherParameters,
|
|
|
String printType, String title, HttpServletRequest request, HttpServletResponse response)
|
|
|
throws JRException, IOException, DocumentException, SQLException, ServletException {
|
|
|
- userName = userName == null ? null : userName.toUpperCase();
|
|
|
// printType为空,默认进入预览页
|
|
|
if (StringUtils.isEmpty(printType)) {
|
|
|
printType = ReportConstants.PRINT_TYPE_PREVIEW;
|
|
|
@@ -149,7 +141,6 @@ public class PrintController {
|
|
|
public void export(String userName, String profile, String reportName, String whereCondition,
|
|
|
String otherParameters, String exportFileType, Boolean flush, String title, HttpServletRequest request,
|
|
|
HttpServletResponse response) throws JRException, IOException, DocumentException, SQLException {
|
|
|
- userName = userName == null ? null : userName.toUpperCase();
|
|
|
ReportUtils.checkParameters(userName, reportName);
|
|
|
String masterOfJrxml = printService.getMasterOfJrxml(userName, reportName);
|
|
|
if (StringUtils.isEmpty(exportFileType)) {
|
|
|
@@ -232,7 +223,6 @@ public class PrintController {
|
|
|
public String getPdfPath(String userName, final String profile, final String reportName,
|
|
|
final String whereCondition, final String otherParameters, Boolean flush, HttpServletRequest request,
|
|
|
HttpServletResponse response) throws JRException, IOException, DocumentException, SQLException {
|
|
|
- userName = userName == null ? null : userName.toUpperCase();
|
|
|
ReportUtils.checkParameters(userName, reportName);
|
|
|
String masterOfJrxml = printService.getMasterOfJrxml(userName, reportName);
|
|
|
|
|
|
@@ -286,7 +276,6 @@ public class PrintController {
|
|
|
public Map<String, Object> getPdfData(String userName, String profile, String reportName, String whereCondition,
|
|
|
String otherParameters, HttpServletRequest request, HttpServletResponse response)
|
|
|
throws JRException, IOException, DocumentException, SQLException {
|
|
|
- userName = userName == null ? null : userName.toUpperCase();
|
|
|
ReportUtils.checkParameters(userName, reportName);
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
// 判断是否过载
|
|
|
@@ -304,7 +293,7 @@ public class PrintController {
|
|
|
/**
|
|
|
* 获取该模板在当前条件下的结果数目
|
|
|
*
|
|
|
- * @param userName不为null;当前账套用户名
|
|
|
+ * @param userName 不为null;当前账套用户名
|
|
|
* @param profile
|
|
|
* 用于标识请求源(B2C、B2B)是正式、测试还是开发版本:prod、test、dev
|
|
|
* @param reportName
|
|
|
@@ -326,7 +315,6 @@ public class PrintController {
|
|
|
public int getCount(String userName, String profile, String reportName, String whereCondition,
|
|
|
String otherParameters, HttpServletRequest request, HttpServletResponse response)
|
|
|
throws SQLException, IOException, DocumentException {
|
|
|
- userName = userName == null ? null : userName.toUpperCase();
|
|
|
ReportUtils.checkParameters(userName, reportName);
|
|
|
return printService.getCount(userName, profile, reportName, whereCondition, otherParameters);
|
|
|
}
|