|
|
|
@ -3,6 +3,7 @@ package com.docus.server.report.listener;
|
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
|
import com.docus.infrastructure.web.api.CommonResult;
|
|
|
|
|
import com.docus.infrastructure.web.api.ResultCode;
|
|
|
|
@ -19,10 +20,15 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.context.event.EventListener;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import sun.misc.BASE64Encoder;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.concurrent.locks.Lock;
|
|
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
|
|
|
|
|
@ -128,4 +134,63 @@ public class ReportDownListener {
|
|
|
|
|
HTTP_POST_LOCK.unlock();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
|
BASE64Encoder encoder = new BASE64Encoder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String url="http://192.168.161.102:9291/api/downplatform/scansionReportBatch";
|
|
|
|
|
// String url="http://127.0.0.1:9291/api/downplatform/scansionReportBatch";
|
|
|
|
|
Map<String, Object> bodyMap=new HashMap<>();
|
|
|
|
|
Map<String, Object> patientMap=new HashMap<>();
|
|
|
|
|
patientMap.put("patientid","8099350542");
|
|
|
|
|
List<Map<String, Object>> scanfiles=new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FileInputStream inputStream = new FileInputStream("d://wyb.png");
|
|
|
|
|
// System.out.println(inputStream.available());
|
|
|
|
|
// byte[] bytes = new byte[inputStream.available()];
|
|
|
|
|
// inputStream.read(bytes,0,inputStream.available());
|
|
|
|
|
// inputStream.close();
|
|
|
|
|
// String base641 = encoder.encode(bytes);
|
|
|
|
|
// Map<String, Object> scanfile1Map=new HashMap<>();
|
|
|
|
|
// scanfile1Map.put("assortid","docustestAssortID");
|
|
|
|
|
// scanfile1Map.put("downurl",base641);
|
|
|
|
|
// scanfile1Map.put("filestoragetype",1);
|
|
|
|
|
// scanfile1Map.put("filetitle","嘉时测试图片1");
|
|
|
|
|
// scanfile1Map.put("filetype","2");
|
|
|
|
|
// scanfile1Map.put("serialnum","嘉时测试图片1");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileInputStream inputStream2 = new FileInputStream("d://jianli_02.jpg");
|
|
|
|
|
System.out.println(inputStream2.available());
|
|
|
|
|
byte[] bytes2 = new byte[inputStream2.available()];
|
|
|
|
|
inputStream2.read(bytes2,0,inputStream2.available());
|
|
|
|
|
inputStream2.close();
|
|
|
|
|
String base642 = encoder.encode(bytes2);
|
|
|
|
|
Map<String, Object> scanfile2Map=new HashMap<>();
|
|
|
|
|
scanfile2Map.put("assortid","docustestAssortID");
|
|
|
|
|
scanfile2Map.put("downurl",base642);
|
|
|
|
|
scanfile2Map.put("filestoragetype",1);
|
|
|
|
|
scanfile2Map.put("filetitle","嘉时测试图片2");
|
|
|
|
|
scanfile2Map.put("filetype","2");
|
|
|
|
|
scanfile2Map.put("serialnum","嘉时测试图片2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// scanfiles.add(scanfile1Map);
|
|
|
|
|
scanfiles.add(scanfile2Map);
|
|
|
|
|
bodyMap.put("patient",patientMap);
|
|
|
|
|
bodyMap.put("ip","wybtest");
|
|
|
|
|
bodyMap.put("collectorid","docus测试扫描");
|
|
|
|
|
bodyMap.put("scanfiles",scanfiles);
|
|
|
|
|
bodyMap.put("scanusercode","docus测试");
|
|
|
|
|
bodyMap.put("scanusername","docus测试");
|
|
|
|
|
HttpRequest post = HttpUtil.createPost(url);
|
|
|
|
|
post.timeout(5 * 1000);
|
|
|
|
|
post.header("Content-Type", "application/json; charset=utf-8");
|
|
|
|
|
post.body(JSON.toJSONString(bodyMap));
|
|
|
|
|
HttpResponse response = post.execute();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|