kongdeqiang
2023-03-01 29082c356872abc0c1208e8b4870d1ba1fa7afe7
src/main/java/com/boying/controller/car/PlateServlet2.java
@@ -11,9 +11,11 @@
import com.boying.entity.led.ResultData;
import com.boying.service.*;
import com.boying.util.DateUtilOther;
import com.boying.util.StringUtil;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.sun.media.jfxmedia.track.Track;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
@@ -24,7 +26,9 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sound.sampled.AudioFormat;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
@@ -51,7 +55,7 @@
    private final TicketService ticketService;
    private final CostRuleService costRuleService;
    private final WhiteListService whiteListService;
    private final String LEDURL = "http://localhost:9988/LedShow/IGetResultDataAllLine";
    private final String LEDURL = "http://192.168.31.212:9988/LedShow/IGetResultDataAllLine";
    /**
     * 回复开闸
@@ -498,12 +502,22 @@
                .execute()
                .body();
        ResultData resultData = JSON.parseObject(s1,ResultData.class);
        byte[] dataX = new byte[resultData.getLength()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLength());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        open(request,response,data1);//入场开闸
        String[] split = resultData.getDatas().split("-");
        String[] dataX = new String[resultData.getLenth()];
        System.arraycopy(split,0,dataX,0,resultData.getLenth());
        String s2 = StringUtil.toStr(dataX);
        byte[] bytes = StringUtil.HexString2Bytes(s2);
        for (byte aByte : bytes) {
            System.out.print(aByte+" ");
        }
        System.out.println();
        String data1 = new String("gb2312");
        data1 = Base64.getMimeEncoder().encodeToString(bytes);
       // String data2 = data1.replace("\n", "");
        String data3  = data1.replaceAll("\r\n", "");
        System.out.println();
        System.out.println(data3);
        open(request,response,data3);//入场开闸
    }
    public void inLedFullShow(String ledId, String carNo, Integer parkId,HttpServletRequest request, HttpServletResponse response) throws IOException {
@@ -548,8 +562,8 @@
                .execute()
                .body();
        ResultData resultData = JSON.parseObject(s1,ResultData.class);
        byte[] dataX = new byte[resultData.getLength()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLength());
        byte[] dataX = new byte[resultData.getLenth()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
@@ -579,8 +593,8 @@
                .execute()
                .body();
        ResultData resultData = JSON.parseObject(s1,ResultData.class);
        byte[] dataX = new byte[resultData.getLength()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLength());
        byte[] dataX = new byte[resultData.getLenth()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        if(type == 0){
@@ -624,8 +638,8 @@
                .execute()
                .body();
        ResultData resultData = JSON.parseObject(s1,ResultData.class);
        byte[] dataX = new byte[resultData.getLength()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLength());
        byte[] dataX = new byte[resultData.getLenth()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        if(type == 0){
@@ -667,8 +681,8 @@
                .execute()
                .body();
        ResultData resultData = JSON.parseObject(s1,ResultData.class);
        byte[] dataX = new byte[resultData.getLength()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLength());
        byte[] dataX = new byte[resultData.getLenth()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        noOpen(request,response,data1);
@@ -705,8 +719,8 @@
                .execute()
                .body();
        ResultData resultData = JSON.parseObject(s1,ResultData.class);
        byte[] dataX = new byte[resultData.getLength()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLength());
        byte[] dataX = new byte[resultData.getLenth()];
        System.arraycopy(resultData.getDatas(),0,dataX,0,resultData.getLenth());
        String data1 = Base64.getMimeEncoder().encodeToString(dataX) + "=";
        data1 = data1.replaceAll("\r\n", "");
        noOpen(request,response,data1);