mac 支持 /home 文件夹,无需特殊处理
client 调整,将中文去除掉
This commit is contained in:
@@ -182,7 +182,6 @@ public class AdminNettyController extends BaseApiController {
|
|||||||
|
|
||||||
private static String getDocument(String barcode, String barcodeSn) throws IOException, InvalidFormatException {
|
private static String getDocument(String barcode, String barcodeSn) throws IOException, InvalidFormatException {
|
||||||
String newFilePath = "/home/test/" + barcodeSn + ".docx";
|
String newFilePath = "/home/test/" + barcodeSn + ".docx";
|
||||||
// String newFilePath = "/Users/limqhz/home/test/" + barcodeSn + ".docx";
|
|
||||||
XWPFDocument document = new XWPFDocument();
|
XWPFDocument document = new XWPFDocument();
|
||||||
XWPFParagraph paragraph = document.createParagraph();
|
XWPFParagraph paragraph = document.createParagraph();
|
||||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF8"?>
|
<?xml version="1.0" encoding="UTF8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<jmxConfigurator />
|
<jmxConfigurator />
|
||||||
<property name="LOG_HOME" value="./logs/api"/>
|
<property name="LOG_HOME" value="/home/jar/logs/api"/>
|
||||||
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
|||||||
@@ -18,6 +18,6 @@ public class EnterClick implements ActionListener {
|
|||||||
DoorService doorService = new OldDoorService();
|
DoorService doorService = new OldDoorService();
|
||||||
doorService.enterOpenDoor();
|
doorService.enterOpenDoor();
|
||||||
// 开门
|
// 开门
|
||||||
logger.error("开门成功!!!!!!!");
|
logger.error("test open enter door success !!!!!!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,6 @@ public class OutClick implements ActionListener {
|
|||||||
DoorService doorService = new OldDoorService();
|
DoorService doorService = new OldDoorService();
|
||||||
doorService.outOpenDoor();
|
doorService.outOpenDoor();
|
||||||
// 开门
|
// 开门
|
||||||
logger.error("开门成功!!!!!!!");
|
logger.error("test out open door success !!!!!!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class TestCodeClick implements ActionListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
logger.error("发送验证二维码消息!!!=========" + barcode.getText());
|
logger.error("sending barcode msg to api !!!=========" + barcode.getText());
|
||||||
ClientThread.getInstance().checkBarcode(barcode.getText());
|
ClientThread.getInstance().checkBarcode(barcode.getText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -30,11 +29,17 @@ public class LogService {
|
|||||||
session.connect(3000);
|
session.connect(3000);
|
||||||
}
|
}
|
||||||
ChannelSftp sftp = (ChannelSftp) session.openChannel("sftp");
|
ChannelSftp sftp = (ChannelSftp) session.openChannel("sftp");
|
||||||
File file = new File("/home/venue/logs/common-default.log");
|
File file1 = new File("/home/venue/logs/common-default.log");
|
||||||
if (file.exists()) {
|
File file2 = new File("/home/venue/logs/common-error.log");
|
||||||
|
if (file1.exists() || file2.exists()) {
|
||||||
sftp.connect();
|
sftp.connect();
|
||||||
sftp.put(new FileInputStream(file), "/home/uploadlog/" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client.log");
|
if (file1.exists()){
|
||||||
logger.info("上传日志成功");
|
sftp.put(new FileInputStream(file1), "/home/uploadlog/" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client-common.log");
|
||||||
|
}
|
||||||
|
if (file2.exists()) {
|
||||||
|
sftp.put(new FileInputStream(file2), "/home/uploadlog/" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client-error.log");
|
||||||
|
}
|
||||||
|
logger.info("upload logs success");
|
||||||
}
|
}
|
||||||
if (sftp != null) {
|
if (sftp != null) {
|
||||||
sftp.disconnect();
|
sftp.disconnect();
|
||||||
@@ -43,7 +48,7 @@ public class LogService {
|
|||||||
session.disconnect();
|
session.disconnect();
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.error("上传日志失败",e);
|
logger.error("upload log fail",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class MessageService {
|
|||||||
DoorService doorService = new OldDoorService();
|
DoorService doorService = new OldDoorService();
|
||||||
doorService.enterOpenDoor();
|
doorService.enterOpenDoor();
|
||||||
// 开门
|
// 开门
|
||||||
logger.info("开门成功!!!");
|
logger.info("open enter door success!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +75,7 @@ public class MessageService {
|
|||||||
DoorService doorService = new OldDoorService();
|
DoorService doorService = new OldDoorService();
|
||||||
doorService.outOpenDoor();
|
doorService.outOpenDoor();
|
||||||
// 开门
|
// 开门
|
||||||
logger.info("开门成功!!!");
|
logger.info("open out door success!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class OldDoorService implements DoorService {
|
|||||||
OpenDoor openDoor = new OpenDoor(openDoorParameter);
|
OpenDoor openDoor = new OpenDoor(openDoorParameter);
|
||||||
boolean command = connector.AddCommand(openDoor);
|
boolean command = connector.AddCommand(openDoor);
|
||||||
if (!command) {
|
if (!command) {
|
||||||
logger.error("入场开门命令执行失败");
|
logger.error("enter door open command exec fail");
|
||||||
}
|
}
|
||||||
if (openDoor.getIsTimeout()) {
|
if (openDoor.getIsTimeout()) {
|
||||||
logger.info("----in open door timeout ----");
|
logger.info("----in open door timeout ----");
|
||||||
@@ -57,7 +57,7 @@ public class OldDoorService implements DoorService {
|
|||||||
OpenDoor openDoor = new OpenDoor(openDoorParameter);
|
OpenDoor openDoor = new OpenDoor(openDoorParameter);
|
||||||
boolean command = connector.AddCommand(openDoor);
|
boolean command = connector.AddCommand(openDoor);
|
||||||
if (!command) {
|
if (!command) {
|
||||||
logger.error("出场开门命令执行失败");
|
logger.error("out door open command exec fail");
|
||||||
}
|
}
|
||||||
if (openDoor.getIsTimeout()) {
|
if (openDoor.getIsTimeout()) {
|
||||||
logger.info("----out open door timeout ----");
|
logger.info("----out open door timeout ----");
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class ClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||||
logger.info("接收服务器响应msg:[" + msg + "]");
|
logger.info("get server msg:[" + msg + "]");
|
||||||
VenueMessage message = JsonUtils.decode(msg, VenueMessage.class);
|
VenueMessage message = JsonUtils.decode(msg, VenueMessage.class);
|
||||||
MessageService.getInstance().execute(message);
|
MessageService.getInstance().execute(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class ClientThread extends Thread{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("链接失败,发送二维码失败",e);
|
logger.error("link netty server fail ,send barcode fail",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,11 +93,11 @@ public class ClientThread extends Thread{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void doConnect() {
|
public void doConnect() {
|
||||||
logger.info("现在开始链接了");
|
logger.info("connecting");
|
||||||
if (closed) {
|
if (closed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("连接 = " + remoteHost + " " + remotePort);
|
logger.info("connect info = " + remoteHost + " " + remotePort);
|
||||||
future = bootstrap.connect(new InetSocketAddress(remoteHost, remotePort));
|
future = bootstrap.connect(new InetSocketAddress(remoteHost, remotePort));
|
||||||
future.addListener(new ChannelFutureListener() {
|
future.addListener(new ChannelFutureListener() {
|
||||||
public void operationComplete(ChannelFuture f) throws Exception {
|
public void operationComplete(ChannelFuture f) throws Exception {
|
||||||
@@ -106,9 +106,9 @@ public class ClientThread extends Thread{
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (!f.isSuccess()) {
|
if (!f.isSuccess()) {
|
||||||
doConnect();
|
doConnect();
|
||||||
logger.info("等待连接");
|
logger.info("waiting connection");
|
||||||
} else {
|
} else {
|
||||||
logger.info("已连接");
|
logger.info("connected!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 2, TimeUnit.SECONDS);
|
}, 2, TimeUnit.SECONDS);
|
||||||
|
|||||||
@@ -30,21 +30,21 @@ public class MessageHandler {
|
|||||||
public static String checkBarcode(String barcode) {
|
public static String checkBarcode(String barcode) {
|
||||||
String decrypt = AesUtil.decrypt(barcode);
|
String decrypt = AesUtil.decrypt(barcode);
|
||||||
if (decrypt == null) {
|
if (decrypt == null) {
|
||||||
logger.error("二维码不合法" + barcode);
|
logger.error("barcode unable to decrypt" + barcode);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 这个二维码是线下的二维码
|
// 这个二维码是线下的二维码
|
||||||
if (!decrypt.startsWith("venue-")){
|
if (!decrypt.startsWith("venue-")){
|
||||||
VenueBarCode venueBarCode = MakeCode.decodeCode(barcode);
|
VenueBarCode venueBarCode = MakeCode.decodeCode(barcode);
|
||||||
if (venueBarCode == null) {
|
if (venueBarCode == null) {
|
||||||
logger.error("二维码不合法" + barcode);
|
logger.error("user barcode can't not decodeCode" + barcode);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VenueMessage venueMessage = new VenueMessage();
|
VenueMessage venueMessage = new VenueMessage();
|
||||||
venueMessage.setMessageType(MessageType.SCAN_CODE);
|
venueMessage.setMessageType(MessageType.SCAN_CODE);
|
||||||
venueMessage.setMessage(barcode);
|
venueMessage.setMessage(barcode);
|
||||||
logger.info("核销二维码===" + barcode);
|
logger.info("use barcode to api ===" + barcode);
|
||||||
return EncodeMsg.INSTANCE.encode(venueMessage);
|
return EncodeMsg.INSTANCE.encode(venueMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public class ClientService {
|
|||||||
|
|
||||||
public static void main(String[] args) throws IOException, InterruptedException {
|
public static void main(String[] args) throws IOException, InterruptedException {
|
||||||
File file = new File("/home/venue/client/venue.conf");
|
File file = new File("/home/venue/client/venue.conf");
|
||||||
// File file = new File("/Users/limqhz/home/venue/client/venue.conf");
|
|
||||||
FileReader fileReader = new FileReader(file);
|
FileReader fileReader = new FileReader(file);
|
||||||
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||||
String line = bufferedReader.readLine();
|
String line = bufferedReader.readLine();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF8"?>
|
<?xml version="1.0" encoding="UTF8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<jmxConfigurator />
|
<jmxConfigurator />
|
||||||
<property name="LOG_HOME" value="./logs/oms"/>
|
<property name="LOG_HOME" value="/home/jar/logs/oms"/>
|
||||||
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ public class VenueBarcodeUtil {
|
|||||||
public static String generateBarcode(String barcodeValue,String fileName) {
|
public static String generateBarcode(String barcodeValue,String fileName) {
|
||||||
try {
|
try {
|
||||||
String geneFilePath = "/home/test/" + fileName;
|
String geneFilePath = "/home/test/" + fileName;
|
||||||
// String geneFilePath = "/Users/limqhz/home/test/" + fileName;
|
|
||||||
makeBarcode(geneFilePath,barcodeValue);
|
makeBarcode(geneFilePath,barcodeValue);
|
||||||
return geneFilePath;
|
return geneFilePath;
|
||||||
}catch (WriterException e) {
|
}catch (WriterException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user