|
@@ -16,14 +16,16 @@
|
|
*/
|
|
*/
|
|
package org.springblade.archive.service.impl;
|
|
package org.springblade.archive.service.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+
|
|
|
|
+import com.aliyun.oss.OSSClient;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
|
+
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
-import com.google.common.collect.Lists;
|
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
@@ -32,6 +34,7 @@ import org.springblade.archive.entity.ArchivesAuto;
|
|
import org.springblade.archive.service.IArchiveAutoPdfService;
|
|
import org.springblade.archive.service.IArchiveAutoPdfService;
|
|
import org.springblade.archive.service.IArchiveProjectConfigService;
|
|
import org.springblade.archive.service.IArchiveProjectConfigService;
|
|
import org.springblade.archive.utils.ArchiveTreeUtil;
|
|
import org.springblade.archive.utils.ArchiveTreeUtil;
|
|
|
|
+import org.springblade.archive.utils.FileTransJavaDemo;
|
|
import org.springblade.archive.utils.FileUtils;
|
|
import org.springblade.archive.utils.FileUtils;
|
|
import org.springblade.archive.vo.ArchivesAutoVO;
|
|
import org.springblade.archive.vo.ArchivesAutoVO;
|
|
import org.springblade.archive.mapper.ArchivesAutoMapper;
|
|
import org.springblade.archive.mapper.ArchivesAutoMapper;
|
|
@@ -70,7 +73,11 @@ import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.FileInputStream;
|
|
|
|
+import java.io.IOException;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
@@ -315,6 +322,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
return vo;
|
|
return vo;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据搜索获取档案柜
|
|
* 根据搜索获取档案柜
|
|
* @param archivesAuto
|
|
* @param archivesAuto
|
|
@@ -2029,14 +2037,78 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
log.error("自动组卷报错。"+e.getMessage()+"--projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId);
|
|
log.error("自动组卷报错。"+e.getMessage()+"--projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId);
|
|
//设置自动组卷结束
|
|
//设置自动组卷结束
|
|
- contractClient.updateIsArchivesAutoById(contractId,0);
|
|
|
|
|
|
+ contractClient.updateIsArchivesAutoById(contractId, 0);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<User> getArchiveDestroyUser() {
|
|
public List<User> getArchiveDestroyUser() {
|
|
return autoMapper.getArchiveDestroyUser();
|
|
return autoMapper.getArchiveDestroyUser();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 语音搜索
|
|
|
|
+ *
|
|
|
|
+ * @param file
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public R searchInfo(MultipartFile file) throws IOException {
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+ String fileUrl = FileUtils.getSysLocalFileUrl();
|
|
|
|
+
|
|
|
|
+ File fileInfo = org.springblade.common.utils.FileUtils.convert(file);
|
|
|
|
+ BladeFile data = iossClient.updateFile(file.getBytes(), "testInfo.wav");
|
|
|
|
+ String token = "cc96fcdce38f49f1af2298a949d39800";
|
|
|
|
+ String appkey = "7T7TkowOxND01n1y";
|
|
|
|
+ // SpeechRecognizerRESTfulDemo demo = new SpeechRecognizerRESTfulDemo(appkey, token);
|
|
|
|
+
|
|
|
|
+/* String fileName = "/Users/hongchuangyanfa/Downloads/nls-sample-16k.wav" ;//SpeechRecognizerRESTfulDemo.class.getClassLoader().getResource("/Users/hongchuangyanfa/Downloads/nls-sample-16k.wav").getPath();
|
|
|
|
+ String format = "pcm";
|
|
|
|
+ int sampleRate = 16000;
|
|
|
|
+ boolean enablePunctuationPrediction = true;
|
|
|
|
+ boolean enableInverseTextNormalization = true;
|
|
|
|
+ boolean enableVoiceDetection = false;
|
|
|
|
+ String dataInfo = demo.process(fileInfo, format, sampleRate, enablePunctuationPrediction, enableInverseTextNormalization, enableVoiceDetection);
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ //System.out.println("123");
|
|
|
|
+ //System.out.println(dataInfo);
|
|
|
|
+ //JSONObject json = new JSONObject();
|
|
|
|
+ //json.put("year","2023");
|
|
|
|
+
|
|
|
|
+ final String accessKeyId = "LTAI5tMwtPCL85iXbUtjLTxD";
|
|
|
|
+ final String accessKeySecret = "WiUW5ag7HhQZPNoMAoQSC5LuxD2kLw";
|
|
|
|
+ final String appKey = "IxV21DxuzHuc8Oe4";
|
|
|
|
+ // String fileUrl = FileUtils.getSysLocalFileUrl()+"/voiceInfo/123456.wav";
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ///String fileLink = "http://fileinfo.hczcxx.cn/voiceInfo/c574b9f3-f4fe-43db-abeb-5c5f24a15eb4.wav";
|
|
|
|
+ String fileLink = data.getLink();
|
|
|
|
+ FileTransJavaDemo demo = new FileTransJavaDemo(accessKeyId, accessKeySecret);
|
|
|
|
+ // 第一步:提交录音文件识别请求,获取任务ID用于后续的识别结果轮询。
|
|
|
|
+ String taskId = demo.submitFileTransRequest(appKey, fileLink);
|
|
|
|
+ if (taskId != null) {
|
|
|
|
+ System.out.println("录音文件识别请求成功,task_id: " + taskId);
|
|
|
|
+ } else {
|
|
|
|
+ System.out.println("录音文件识别请求失败!");
|
|
|
|
+ }
|
|
|
|
+ // 第二步:根据任务ID轮询识别结果。
|
|
|
|
+ String result = demo.getFileTransResult(taskId);
|
|
|
|
+ if (result != null) {
|
|
|
|
+ System.out.println("录音文件识别结果查询成功:" + result);
|
|
|
|
+ JSONObject dataInfo = JSONObject.parseObject(result);
|
|
|
|
+ JSONArray word = dataInfo.getJSONArray("Words");
|
|
|
|
+ JSONArray sentences = dataInfo.getJSONArray("Sentences");
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ System.out.println("录音文件识别结果查询失败!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return R.data(json);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|