|
|
|
@ -7,12 +7,9 @@ import com.jiashi.dao.DataQuery;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
@ -38,7 +35,7 @@ public class UpdateService {
|
|
|
|
|
String uniUrl = "http://192.168.8.74";
|
|
|
|
|
List<CardInfo> cardInfos = null;
|
|
|
|
|
ExecutorService executor2 = Executors.newFixedThreadPool(2);
|
|
|
|
|
ExecutorService executor = Executors.newFixedThreadPool(5);
|
|
|
|
|
ExecutorService executor = Executors.newFixedThreadPool(12);
|
|
|
|
|
do {
|
|
|
|
|
try{
|
|
|
|
|
cardInfos = this.updateData();
|
|
|
|
@ -53,24 +50,24 @@ public class UpdateService {
|
|
|
|
|
dataQuery.updateBatchState(cardInfo,5);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
String dir = "c:\\pic\\"+cardInfo.getId();
|
|
|
|
|
// 创建File对象
|
|
|
|
|
File directory = new File(dir);
|
|
|
|
|
|
|
|
|
|
// 判断目录是否存在
|
|
|
|
|
if (!directory.exists()) {
|
|
|
|
|
// 目录不存在,创建目录
|
|
|
|
|
boolean created = directory.mkdirs();
|
|
|
|
|
if (created) {
|
|
|
|
|
log.info("目录创建成功:" + dir);
|
|
|
|
|
} else {
|
|
|
|
|
log.info("目录创建失败:" + dir);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Future> futures = new ArrayList<>();
|
|
|
|
|
for (Picture picture : pictures) {
|
|
|
|
|
Future future = executor.submit(() -> {
|
|
|
|
|
try {
|
|
|
|
|
String dir = "d:\\pic\\"+picture.getFileid();
|
|
|
|
|
// 创建File对象
|
|
|
|
|
File directory = new File(dir);
|
|
|
|
|
|
|
|
|
|
// 判断目录是否存在
|
|
|
|
|
if (!directory.exists()) {
|
|
|
|
|
// 目录不存在,创建目录
|
|
|
|
|
boolean created = directory.mkdirs();
|
|
|
|
|
if (created) {
|
|
|
|
|
log.info("目录创建成功:" + dir);
|
|
|
|
|
} else {
|
|
|
|
|
log.info("目录创建失败:" + dir);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String cmd = "C:\\Debug\\lianzhong.exe 003 192.168.8.74 " + cardInfo.getId() + " " + picture.getPicid() + " " + cardInfo.getPatno() + " " + cardInfo.getOutdateStr() + " " + picture.getPicname() + " " + picture.getFileUrl() + " " + uniUrl + " " + picture.getRotatedegree();
|
|
|
|
|
log.info(cmd);
|
|
|
|
|
java.lang.Process process = java.lang.Runtime.getRuntime().exec(cmd);//执行命令生成cube
|
|
|
|
@ -97,7 +94,11 @@ public class UpdateService {
|
|
|
|
|
List<UploadInfo> uploadInfos = new ArrayList<>();
|
|
|
|
|
for(Picture picture : pictures){
|
|
|
|
|
files.add(new File(picture.getFileUrl()));
|
|
|
|
|
UploadInfo uploadInfo = new UploadInfo(cardInfo.getPatno(), cardInfo.getOutdateStr2(), picture.getPicname(), picture.getPicname(), picture.getPickind(), cardInfo.getId(), cardInfo.getPatname(), cardInfo.getIndateStr(), cardInfo.getPatsex());
|
|
|
|
|
UploadInfo uploadInfo = new UploadInfo(cardInfo.getPatno(), cardInfo.getOutdateStr2(), picture.getPicname(), picture.getPicname(),
|
|
|
|
|
picture.getPickind(), cardInfo.getId(), cardInfo.getPatname(),
|
|
|
|
|
cardInfo.getIndateStr(), cardInfo.getPatsex(),cardInfo.getPatnum(),
|
|
|
|
|
cardInfo.getIcdecode11(),cardInfo.getIcdename11(), cardInfo.getMjwesticde(),cardInfo.getMjwestname(),
|
|
|
|
|
cardInfo.getOutdeptname(),cardInfo.getPatciticard(),cardInfo.getOutwardname(),cardInfo.getIndeptname(),cardInfo.getIndeptcode());
|
|
|
|
|
uploadInfos.add(uploadInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -108,20 +109,21 @@ public class UpdateService {
|
|
|
|
|
params.add(new FormField("uploadFileParams", s));
|
|
|
|
|
log.info("请求参数:"+s);
|
|
|
|
|
// 上传
|
|
|
|
|
try {
|
|
|
|
|
CommonResult commonResult = FileUploader.uploadFilesWithParams(files, "http://10.2.130.59:8712/api/downplatform/fileUploadJpg", params);
|
|
|
|
|
if(commonResult.getCode()==0){
|
|
|
|
|
dataQuery.updateBatchState(cardInfo,3);
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
dataQuery.updateBatchState(cardInfo,4);
|
|
|
|
|
log.error(commonResult.getMsg());
|
|
|
|
|
}
|
|
|
|
|
dataQuery.updateBatchState(cardInfo,4);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
dataQuery.updateBatchState(cardInfo,4);
|
|
|
|
|
log.error(e.getMessage(),e);
|
|
|
|
|
}
|
|
|
|
|
// try {
|
|
|
|
|
// CommonResult commonResult = FileUploader.uploadFilesWithParams(files, "http://10.2.130.59:8712/api/downplatform/fileUploadJpg", params);
|
|
|
|
|
// if(commonResult.getCode()==0){
|
|
|
|
|
// dataQuery.updateBatchState(cardInfo,3);
|
|
|
|
|
//
|
|
|
|
|
// }else{
|
|
|
|
|
// dataQuery.updateBatchState(cardInfo,4);
|
|
|
|
|
// log.error(commonResult.getMsg());
|
|
|
|
|
// }
|
|
|
|
|
// dataQuery.updateBatchState(cardInfo,4);
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// dataQuery.updateBatchState(cardInfo,4);
|
|
|
|
|
// log.error(e.getMessage(),e);
|
|
|
|
|
// }
|
|
|
|
|
dataQuery.updateBatchState(cardInfo,4);
|
|
|
|
|
// 删除文件
|
|
|
|
|
// String dir = "d:\\pic\\"+cardInfo.getId();
|
|
|
|
|
// File file = new File(dir);
|
|
|
|
|