Commit 2ab0a811e2621d66f8f3ffb09b5f907a4a7b505e

Authored by tongzhonghao
1 parent 8362bf04

update

src/main/java/com/huaheng/framework/shiro/web/filter/online/OnlineSessionFilter.java
1 1 package com.huaheng.framework.shiro.web.filter.online;
2 2  
3   -import java.awt.image.BufferedImage;
4   -import java.io.ByteArrayInputStream;
5   -import java.io.File;
6 3 import java.io.IOException;
7   -import javax.imageio.ImageIO;
8 4 import javax.servlet.ServletRequest;
9 5 import javax.servlet.ServletResponse;
10 6  
11   -import com.huaheng.api.erp.domain.CapturePictureModule;
12   -import com.huaheng.api.erp.service.DisConnect;
13   -import com.huaheng.api.erp.service.HaveReConnect;
14   -import com.huaheng.common.constant.QuantityConstant;
15   -import com.netsdk.demo.module.LoginModule;
16   -import com.netsdk.lib.NetSDKLib;
17   -import com.sun.jna.Pointer;
18 7 import org.apache.shiro.session.Session;
19 8 import org.apache.shiro.subject.Subject;
20 9 import org.apache.shiro.web.filter.AccessControlFilter;
... ... @@ -68,14 +57,6 @@ public class OnlineSessionFilter extends AccessControlFilter
68 57 User user = ShiroUtils.getUser();
69 58 if (user != null)
70 59 {
71   - DisConnect disConnect = new DisConnect();
72   - HaveReConnect haveReConnect = new HaveReConnect();
73   - /*LoginModule.init(disConnect,haveReConnect);
74   - String camera1 = LoginModule.login("10.34.101.55", 37777, "admin", "hk999999");
75   - String camera2 = LoginModule.login("10.34.101.59", 37777, "admin", "hk999999");
76   - CapturePictureModule.setSnapRevCallBack(OnlineSessionFilter.m_CaptureReceiveCB);
77   - onlineSession.setCamera1(camera1);
78   - onlineSession.setCamera2(camera2);*/
79 60 onlineSession.setUserId(user.getId());
80 61 onlineSession.setLoginName(user.getLoginName());
81 62 onlineSession.setDeptName(user.getDept().getDeptName());
... ... @@ -90,34 +71,6 @@ public class OnlineSessionFilter extends AccessControlFilter
90 71 }
91 72 return true;
92 73 }
93   - public static final fCaptureReceiveCB m_CaptureReceiveCB = new fCaptureReceiveCB();
94   - public static class fCaptureReceiveCB implements NetSDKLib.fSnapRev{
95   - BufferedImage bufferedImage = null;
96   - @Override
97   - public void invoke(NetSDKLib.LLong lLoginID, Pointer pBuf, int RevLen, int EncodeType, int CmdSerial, Pointer dwUser) {
98   - if(pBuf != null && RevLen > 0) {
99   - File path1 = new File("static/img/Capture");
100   - if (!path1.exists()) {
101   - path1.mkdir();
102   - }
103   - String imgPath = null;
104   - imgPath =this.getClass().getResource("/").getPath()+ "static/img/Capture/carInfo.jpg";
105   - File file = new File(imgPath);
106   -// file.delete();
107   - byte[] buf = pBuf.getByteArray(0, RevLen);
108   - ByteArrayInputStream byteArrInput = new ByteArrayInputStream(buf);
109   - try {
110   - bufferedImage = ImageIO.read(byteArrInput);
111   - if(bufferedImage == null) {
112   - return;
113   - }
114   - ImageIO.write(bufferedImage, "jpg", new File(imgPath));
115   - } catch (IOException e) {
116   - e.printStackTrace();
117   - }
118   - }
119   - }
120   - }
121 74  
122 75 /**
123 76 * 表示当访问拒绝时是否已经处理了;如果返回true表示需要继续处理;如果返回false表示该拦截器实例已经处理了,将直接返回即可。
... ...
src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
... ... @@ -596,7 +596,7 @@ public class RyTask extends BaseController {
596 596 return RyTaskHolder.instance;
597 597 }
598 598  
599   - public static final OnlineSessionFilter.fCaptureReceiveCB m_CaptureReceiveCB = new OnlineSessionFilter.fCaptureReceiveCB();
  599 + public static final fCaptureReceiveCB m_CaptureReceiveCB = new fCaptureReceiveCB();
600 600 public static class fCaptureReceiveCB implements NetSDKLib.fSnapRev{
601 601 BufferedImage bufferedImage = null;
602 602  
... ... @@ -619,7 +619,7 @@ public class RyTask extends BaseController {
619 619 imgName = "material";
620 620 break;
621 621 }
622   - File path1 = new File("static/img/Capture");
  622 + File path1 = new File(this.getClass().getResource("/").getPath()+ "static/img/Capture");
623 623 if (!path1.exists()) {
624 624 path1.mkdir();
625 625 }
... ...