代码更新
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import jcifs.smb.NtlmPasswordAuthentication;
|
||||||
import jcifs.smb.SmbFile;
|
import jcifs.smb.SmbFile;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -92,6 +93,10 @@ public class PrintServiceImpl implements PrintService {
|
|||||||
|
|
||||||
// 生成txt文件
|
// 生成txt文件
|
||||||
String filePath = "smb://10.1.3.21" + "/LMSPrinter" + "外包标签.txt";
|
String filePath = "smb://10.1.3.21" + "/LMSPrinter" + "外包标签.txt";
|
||||||
|
|
||||||
|
String url = "smb://10.1.3.21/LMSPrinter/"+"外包标签.txt";
|
||||||
|
String userName = "111";
|
||||||
|
String password = "111";
|
||||||
FileWriter fw = null;
|
FileWriter fw = null;
|
||||||
try {
|
try {
|
||||||
/* File file = new File(filePath);
|
/* File file = new File(filePath);
|
||||||
@@ -99,7 +104,13 @@ public class PrintServiceImpl implements PrintService {
|
|||||||
// 判断此文件是否存在 不存在则创建 存在则覆盖
|
// 判断此文件是否存在 不存在则创建 存在则覆盖
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
}*/
|
}*/
|
||||||
SmbFile file = new SmbFile(filePath);
|
/* SmbFile file = new SmbFile(filePath);
|
||||||
|
if (!file.exists()) {
|
||||||
|
// 判断此文件是否存在 不存在则创建 存在则覆盖
|
||||||
|
file.createNewFile();
|
||||||
|
}*/
|
||||||
|
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, userName, password);
|
||||||
|
SmbFile file = new SmbFile(url, auth);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
// 判断此文件是否存在 不存在则创建 存在则覆盖
|
// 判断此文件是否存在 不存在则创建 存在则覆盖
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
|
|||||||
Reference in New Issue
Block a user