fixbug 按次收费余额不足就下订单

音乐多次播放有问题,上传日志有问题
This commit is contained in:
2023-12-14 22:23:23 +08:00
parent 8ada48034d
commit 1a66c5df1b
4 changed files with 22 additions and 29 deletions

View File

@@ -16,28 +16,24 @@ public class LogService {
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
static Session session;
public void uploadLog(String password) {
public void uploadLog() {
try {
if (session == null) {
JSch jsch = new JSch();
String serverIp = System.getProperty(NettyConstant.VENUE_SERVER_IP);
session = jsch.getSession("root", serverIp, 22);
session.setPassword(System.getProperty(NettyConstant.VENUE_CHECK_PWD));
session.setConfig("StrictHostKeyChecking", "no");
session.connect(3000);
}
JSch jsch = new JSch();
String serverIp = System.getProperty(NettyConstant.VENUE_SERVER_IP);
Session session = jsch.getSession("root", serverIp, 22);
session.setPassword(System.getProperty(NettyConstant.VENUE_CHECK_PWD));
session.setConfig("StrictHostKeyChecking", "no");
session.connect(3000);
ChannelSftp sftp = (ChannelSftp) session.openChannel("sftp");
File file1 = new File("/home/venue/logs/common-default.log");
File file2 = new File("/home/venue/logs/common-error.log");
if (file1.exists() || file2.exists()) {
sftp.connect();
if (file1.exists()){
sftp.put(new FileInputStream(file1), "/home/uploadlog/" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client-common.log");
sftp.put(new FileInputStream(file1), "/home/uploadlog/comm-" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client.log");
}
if (file2.exists()) {
sftp.put(new FileInputStream(file2), "/home/uploadlog/" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client-error.log");
sftp.put(new FileInputStream(file2), "/home/uploadlog/error-" + System.getProperty(NettyConstant.VENUE_CLIENT_SN) + "-" + sdf.format(new Date()) + "-client.log");
}
logger.info("upload logs success");
}

View File

@@ -55,7 +55,7 @@ public class MessageService {
private void sendLog() {
LogService logService = new LogService();
logService.uploadLog(System.getProperty(NettyConstant.VENUE_CHECK_PWD));
logService.uploadLog();
}
/**

View File

@@ -15,27 +15,24 @@ public enum PlayMusicService {
private static ArrayListPlayList byeVoice = new ArrayListPlayList();
// PlayList stopUsingVoice = new ArrayListPlayList();
static {
public void playHello(){
File hello = new File("/home/venue/client/hello.mp3");
if (hello.exists()){
helloVoice.addAudioFile(hello);
player.setPlayList(helloVoice);
player.play();
player.close();
}
File bye = new File("/home/venue/client/bye.mp3");
if (bye.exists()){
byeVoice.addAudioFile(bye);
}
}
public void playHello(){
player.setPlayList(helloVoice);
player.play();
player.close();
}
public void playBye(){
player.setPlayList(byeVoice);
player.play();
player.close();
File bye = new File("/home/venue/client/bye.mp3");
if (bye.exists()){
byeVoice.addAudioFile(bye);
player.setPlayList(byeVoice);
player.play();
player.close();
}
}
}

View File

@@ -259,9 +259,9 @@ public class VenueService extends BaseServiceImpl {
if (effOrder <= 0) {
// 单次订单已超时 需要重新付费
synchronized (("scancode-in" + memberId).intern()) {
createBarcodeTimeOrder(memberId,venueId,timePayHour);
if (memberService.isMoneyEnough(memberId, price)) {
logger.info("用户" + memberId + "使用余额核销订单");
createBarcodeTimeOrder(memberId,venueId,timePayHour);
createMemberMoneyLog(MoneyLogEnum.JOIN.value, price, memberId, 1, PayTypeEnum.BALANCE.value, null,
venue.getId(), venue.getType());
} else {