You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package Tools.MaxKb;
|
|
|
|
|
|
|
|
|
|
import Tools.MaxKb.Model.MaxKbModel;
|
|
|
|
|
import Tools.MaxKb.Util.MaxKbCallUtil;
|
|
|
|
|
import Tools.MaxKb.Util.MaxKbDb;
|
|
|
|
|
import com.jfinal.kit.PropKit;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class UploadMaxKBFile {
|
|
|
|
|
|
|
|
|
|
public static MaxKbModel mm = new MaxKbModel();
|
|
|
|
|
|
|
|
|
|
//知识库id,不知道id的可以从知识库的地址栏获取
|
|
|
|
|
static String zskId = "0dbf473a-c352-11ef-a5a3-0242ac120003";
|
|
|
|
|
|
|
|
|
|
//获取知识库上传文档接口
|
|
|
|
|
static String uploadFile = "D:\\dsWork\\QingLong\\Doc\\MaxKB\\各学校人员和班级统计【结果】.xlsx";
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
//加载配置文件
|
|
|
|
|
PropKit.use("MaxKb.properties");
|
|
|
|
|
|
|
|
|
|
//初始化数据库
|
|
|
|
|
MaxKbDb.Init();
|
|
|
|
|
|
|
|
|
|
//获取数据集名称
|
|
|
|
|
String dataSetName = PropKit.get("dataSetName");
|
|
|
|
|
List<Record> list = mm.getDataSetList(dataSetName);
|
|
|
|
|
if (list.size() > 1) {
|
|
|
|
|
System.out.println("数据集:【" + dataSetName + "】名称重复,请检查后重新运行!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (list.isEmpty()) {
|
|
|
|
|
System.out.println("数据集:【" + dataSetName + "】不存在,请检查后重新运行!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println(list);
|
|
|
|
|
|
|
|
|
|
//获取身份识别
|
|
|
|
|
// String authCode = MaxKbCallUtil.getAuthorization();
|
|
|
|
|
// //测试上传文件到知识库
|
|
|
|
|
// String id = MaxKbCallUtil.uploadQA(authCode, zskId, uploadFile);
|
|
|
|
|
// System.out.println("生成的文档ID=" + id);
|
|
|
|
|
}
|
|
|
|
|
}
|