| | |
| | | |
| | | import com.sun.media.jfxmedia.track.Track; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | * Servlet implementation class PlateServlet |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/car") |
| | | @RequestMapping("/car2") |
| | | @RequiredArgsConstructor |
| | | public class PlateServlet2 extends HttpServlet { |
| | | private static final long serialVersionUID = 1L; |
| | | private final SystemConfigProperties systemConfigProperties; |
| | | @Value("${ffpark.logPath}") |
| | | private String logPath; |
| | | // @Autowired |
| | | // private final SystemConfigProperties systemConfigProperties; |
| | | private final StringRedisTemplate redisTemplate; |
| | | private final ParkService parkService; |
| | | private final OutParkService outParkService; |
| | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | try |
| | | { |
| | | FileWriter f = new FileWriter(systemConfigProperties.getLogPath()+sdf.format(new Date())+".txt",true); |
| | | FileWriter f = new FileWriter(logPath+sdf.format(new Date())+".txt",true); |
| | | BufferedWriter bw=new BufferedWriter(f); |
| | | bw.write(txt); |
| | | bw.newLine(); |
| | |
| | | .execute() |
| | | .body(); |
| | | ResultData resultData = JSON.parseObject(s1,ResultData.class); |
| | | System.out.println(resultData); |
| | | 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); |
| | | //byte[] bytes = StringUtil.HexString2Bytes(s2); |
| | | byte[] bytes1 = StringUtil.hex2Byte(resultData.getDatas()); |
| | | byte[] bytes = StringUtil.byte2hex(bytes1); |
| | | for (byte aByte : bytes) { |
| | | System.out.print(aByte+" "); |
| | | } |
| | | System.out.println(); |
| | | String data1 = new String("gb2312"); |
| | | data1 = Base64.getMimeEncoder().encodeToString(bytes); |
| | | System.out.println("bytes.length: "+bytes.length); |
| | | //String data1 = new String("gb2312"); |
| | | String data1 = Base64.getMimeEncoder().encodeToString(bytes); |
| | | // String data2 = data1.replace("\n", ""); |
| | | String data3 = data1.replaceAll("\r\n", ""); |
| | | String data3 = data1.replaceAll("\r\n", "") + "="; |
| | | System.out.println(); |
| | | System.out.println(data3); |
| | | open(request,response,data3);//入场开闸 |