XMTT 6 gadi atpakaļ
vecāks
revīzija
79bca42afe

+ 14 - 0
src/main/java/com/ekexiu/project/bridge/envdata/EnvDataService.java

@ -9,6 +9,7 @@ import org.jfw.apt.web.annotation.param.JdbcConn;
9 9
import java.sql.Connection;
10 10
import java.sql.SQLException;
11 11
import java.util.List;
12
import java.util.concurrent.atomic.AtomicBoolean;
12 13
import java.util.concurrent.atomic.AtomicReference;
13 14
14 15
/**
@ -17,6 +18,7 @@ import java.util.concurrent.atomic.AtomicReference;
17 18
@Path("/envData")
18 19
public class EnvDataService {
19 20
    private AtomicReference<List<EnvData>> lastData = new AtomicReference<List<EnvData>>();
21
    public static AtomicBoolean dolog=new AtomicBoolean(false);
20 22
21 23
    @Autowrie
22 24
    private EnvDataDao envDataDao;
@ -36,6 +38,18 @@ public class EnvDataService {
36 38
        this.lastData.set(lastData);
37 39
    }
38 40
41
    @Path("/openlog")
42
    @Get
43
    public void openlog() {
44
        dolog.set(true);
45
    }
46
47
    @Path("/closelog")
48
    @Get
49
    public void closelog() {
50
        dolog.set(false);
51
    }
52
39 53
    @Path("/byTime")
40 54
    @Get
41 55
    public List<EnvData> query(@JdbcConn Connection con, @DefaultValue("\"00000000000000\"") String bt, @DefaultValue("\"99999999999999\"") String et) throws SQLException {

+ 8 - 0
src/main/java/com/ekexiu/project/bridge/servlet/EnvDataServlet.java

@ -133,6 +133,10 @@ public class EnvDataServlet extends HttpServlet {
133 133
                            throw new IOException("a");
134 134
                        }
135 135
                    }
136
                    if (EnvDataService.dolog.get()) {
137
                        System.out.print("head:");
138
                        headtoString(head, 0, head.length);
139
                    }
136 140
                    len = head[51] & 0xFF;
137 141
                    len <<= 8;
138 142
                    len += head[50] & 0xFF;
@ -157,6 +161,10 @@ public class EnvDataServlet extends HttpServlet {
157 161
                            throw new IOException("a");
158 162
                        }
159 163
                    }
164
                    if (EnvDataService.dolog.get()) {
165
                        System.out.print("body:");
166
                        headtoString(body, 0, body.length);
167
                    }
160 168
                    String createTime = DateUtil.formatDateTime(System.currentTimeMillis());
161 169
                    len = body.length;
162 170
                    offset = 0;