|
@@ -2,6 +2,8 @@ package cn.com.usky.iot.controller;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.ServletContext;
|
|
|
+import javax.servlet.http.HttpServlet;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
import cn.com.usky.iot.auth.TokenAuthBO;
|
|
@@ -36,7 +38,9 @@ public class ExcelController {
|
|
|
|
|
|
@Autowired
|
|
|
private TokenAuthService tokenAuthService;
|
|
|
-
|
|
|
+ public static String getPath(HttpServletRequest request){
|
|
|
+ return request.getServletContext().getRealPath("");
|
|
|
+ }
|
|
|
|
|
|
//导出
|
|
|
@RequestMapping(value = "/exportexl", method = {RequestMethod.GET, RequestMethod.POST})
|
|
@@ -59,7 +63,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.fileDormExport("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.fileDormExport(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -87,7 +91,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.waterDormExport("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.waterDormExport(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -115,7 +119,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.rtuDormExport("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.rtuDormExport(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -143,7 +147,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.fireAlarmExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.fireAlarmExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -171,7 +175,9 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.EfireAlarmExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+
|
|
|
+
|
|
|
+ String ret = excelController.excelService.EfireAlarmExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -199,7 +205,8 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.waterAlarmExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+
|
|
|
+ String ret = excelController.excelService.waterAlarmExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -227,7 +234,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.RTUAlarmExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.RTUAlarmExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -255,7 +262,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.liftAlarmExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.liftAlarmExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -283,7 +290,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.DormExport("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.DormExport(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -311,7 +318,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.patrolplanExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.patrolplanExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -339,7 +346,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.inspectionrecordExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.inspectionrecordExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -367,7 +374,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.checkrecordExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.checkrecordExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -395,7 +402,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.routeExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.routeExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -423,7 +430,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.inspectorsExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.inspectorsExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -451,7 +458,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.patrolpointExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.patrolpointExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -479,7 +486,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.qrcodeanalysisExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.qrcodeanalysisExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -507,7 +514,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.maintenanceplanExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.maintenanceplanExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -535,7 +542,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.checkrecord2Excel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.checkrecord2Excel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -563,7 +570,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.maintenancerecordExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.maintenancerecordExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -591,7 +598,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.route2Excel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.route2Excel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -619,7 +626,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.maintenanceExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.maintenanceExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -647,7 +654,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.maintenancepersonExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.maintenancepersonExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -675,7 +682,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.qrcodeanalysis2Excel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.qrcodeanalysis2Excel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -703,7 +710,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.XjInspectionPointsExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.XjInspectionPointsExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -731,7 +738,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.XjInspectionPointsExcel1("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.XjInspectionPointsExcel1(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -760,7 +767,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.XjInspectorsExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.XjInspectorsExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -788,7 +795,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.XjPlanMasterExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.XjPlanMasterExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -817,7 +824,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.XjPlanMasterExcel1("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.XjPlanMasterExcel1(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -845,7 +852,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.XjSpotOperationRecordExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.XjSpotOperationRecordExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -874,7 +881,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.XjSpotOperationRecordExcel1("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.XjSpotOperationRecordExcel1(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -903,7 +910,7 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- String ret = excelController.excelService.EventProcessingExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ String ret = excelController.excelService.EventProcessingExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -937,8 +944,8 @@ public class ExcelController {
|
|
|
jsonObject.put("V_LOGINNAME", o.getVLoginname());
|
|
|
jsonObject.put("V_PASSWORD", o.getVPassword());
|
|
|
try {
|
|
|
- //String ret = excelController.excelService.VideoAlarmExcel("/var/lib/tomcat/webapps/YtIoT/",queryJson);
|
|
|
- String ret = excelController.excelService.VideoAlarmExcel("/var/lib/tomcat/webapps/YtIoT/", jsonObject.toString());
|
|
|
+ //String ret = excelController.excelService.VideoAlarmExcel(getPath(request),queryJson);
|
|
|
+ String ret = excelController.excelService.VideoAlarmExcel(getPath(request), jsonObject.toString());
|
|
|
mav.addObject("ret_str", ret);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|