完善优化代码(可能出错)
parent
44d4571c2e
commit
5174791347
File diff suppressed because it is too large
Load Diff
@ -1,42 +0,0 @@
|
||||
package com.emr.util;
|
||||
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* 关于作用域的操作
|
||||
* @Author:
|
||||
* @Date:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class ActionScopeUtils {
|
||||
|
||||
public static HttpSession getSession(HttpServletRequest request){
|
||||
return request.getSession();
|
||||
}
|
||||
|
||||
public static HttpServletRequest getRequest(){
|
||||
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
}
|
||||
|
||||
public static void setSessionAttribute(String key,Object value){
|
||||
getSession(getRequest()).setAttribute(key,value);
|
||||
}
|
||||
|
||||
public static Object getSessionAttribute(String key){
|
||||
return getSession(getRequest()).getAttribute(key);
|
||||
}
|
||||
|
||||
public static void setRequestAttribute(String key,Object value){
|
||||
getRequest().setAttribute(key,value);
|
||||
}
|
||||
|
||||
public static Object getRequestAttribute(String key){
|
||||
return getRequest().getAttribute(key);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.emr.util;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
|
||||
/**
|
||||
* @ProjectName:
|
||||
* @Description:
|
||||
* @Param 传输参数
|
||||
* @Return
|
||||
* @Author: 曾文和
|
||||
* @CreateDate: 2020/8/4 14:18
|
||||
* @UpdateUser: 曾文和
|
||||
* @UpdateDate: 2020/8/4 14:18
|
||||
* @UpdateRemark: 更新说明
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class ExceptionPrintUtil {
|
||||
private static Logger log = Logger.getLogger("errorMsg");
|
||||
public static void printException(Exception e){
|
||||
//方法名
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
e.printStackTrace(new PrintStream(baos));
|
||||
String exception = baos.toString();
|
||||
log.error(exception);
|
||||
try {
|
||||
baos.flush();
|
||||
baos.close();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
/**
|
||||
* Copyright (C), 2015-2019
|
||||
* Author: HJL
|
||||
* Date: 2019/8/1 10:54
|
||||
* Description:
|
||||
*/
|
||||
package com.emr.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ReadFile {
|
||||
|
||||
/*
|
||||
* 读取指定路径下的文件名和目录名
|
||||
*/
|
||||
public void getFileList(String path,List divList) {
|
||||
File file = new File(path);
|
||||
|
||||
File[] fileList = file.listFiles();
|
||||
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
if (fileList[i].isFile()) {
|
||||
String fileName = fileList[i].getName();
|
||||
System.out.println("文件:" + fileName);
|
||||
}
|
||||
|
||||
if (fileList[i].isDirectory()) {
|
||||
//if(divList.indexOf(fileList[i].getName())!=-1) {
|
||||
String fileName = fileList[i].getName();
|
||||
System.out.println("目录:" + fileName);
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void printFile(File file) {
|
||||
if (file.isFile()) {
|
||||
System.out.println("您给定的是一个文件"); // 判断给定目录是否是一个合法的目录,如果不是,输出提示
|
||||
} else {
|
||||
File[] fileLists = file.listFiles(); // 如果是目录,获取该目录下的内容集合
|
||||
|
||||
for (int i = 0; i < fileLists.length; i++) { // 循环遍历这个集合内容
|
||||
System.out.println(fileLists[i].getName()); //输出元素名称
|
||||
if (fileLists[i].isDirectory()) { //判断元素是不是一个目录
|
||||
printFile(fileLists[i]); //如果是目录,继续调用本方法来输出其子目录
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
printFile(new File("D:\\"));
|
||||
|
||||
// ReadFile rf = new ReadFile();
|
||||
// List list=new ArrayList();
|
||||
// list.add("log");
|
||||
// list.add("logs");
|
||||
// rf.getFileList("D:\\", list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,111 +0,0 @@
|
||||
/**
|
||||
* Copyright (C), 2015-2019
|
||||
* Author: HJL
|
||||
* Date: 2019/8/1 16:07
|
||||
* Description:
|
||||
*/
|
||||
package com.emr.util;
|
||||
|
||||
import org.apache.axis.client.Call;
|
||||
import org.apache.axis.client.Service;
|
||||
import org.apache.cxf.endpoint.Client;
|
||||
import org.apache.cxf.endpoint.Endpoint;
|
||||
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
|
||||
import org.apache.cxf.service.model.BindingInfo;
|
||||
import org.apache.cxf.service.model.BindingOperationInfo;
|
||||
import org.apache.pdfbox.multipdf.PDFMergerUtility;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
public class test {
|
||||
|
||||
private static String[] getFiles(String folder) throws IOException {
|
||||
File _folder = new File(folder);
|
||||
String[] filesInFolder;
|
||||
|
||||
if (_folder.isDirectory()) {
|
||||
filesInFolder = _folder.list();
|
||||
return filesInFolder;
|
||||
} else {
|
||||
throw new IOException("Path is not a directory");
|
||||
}
|
||||
}
|
||||
|
||||
private static void pdfToPdf(String folder,String fileName) throws Exception {
|
||||
PDFMergerUtility mergePdf = new PDFMergerUtility();
|
||||
String[] filesInFolder = getFiles(folder);
|
||||
for (int i = 0; i < filesInFolder.length; i++){
|
||||
mergePdf.addSource(folder + File.separator + filesInFolder[i]);
|
||||
System.out.println(filesInFolder[i]);
|
||||
}
|
||||
mergePdf.setDestinationFileName(folder + File.separator + fileName);
|
||||
System.out.println(folder);
|
||||
mergePdf.mergeDocuments();
|
||||
System.out.print("done");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
// String folder = "D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\uploads\\pdfFiles";
|
||||
// String fileName = "mergedTest.pdf";
|
||||
//pdfToPdf(folder, fileName);
|
||||
|
||||
//String str = "D:\\project_js\\EMR_Medical_Record\\src\\main\\webapp\\static\\img\\uploads\\4\\a.jpg";
|
||||
//获得第一个点的位置
|
||||
// int index = str.indexOf("\\static");
|
||||
//String result = str.substring(0,index+1);
|
||||
//输出结果
|
||||
///System.out.println(str.substring(index, str.length()));
|
||||
// JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
|
||||
// Client client = dcf.createClient(HomepageDictionary);
|
||||
// Object[] objects = client.invoke("getInfosByUserId", token, "emr_medical_record");
|
||||
// System.out.println(client);
|
||||
// try {
|
||||
// String endpoint = "http://120.27.212.36:9999/filing/services/HomepageDictionary?wsdl";
|
||||
// //String endpoint = "http://localhost:8080/ca3/services/caSynrochnized?wsdl";
|
||||
// //直接引用远程的wsdl文件
|
||||
// //以下都是套路
|
||||
// Service service = new Service();
|
||||
// Call call = (Call) service.createCall();
|
||||
// call.setTargetEndpointAddress(endpoint);
|
||||
// call.setOperationName(new QName("http://interfaces.ann.com/", "CheckData"));
|
||||
//
|
||||
// //call.setOperationName("CheckData");//WSDL里面描述的接口名称
|
||||
// call.addParameter("masterId", org.apache.axis.encoding.XMLType.XSD_DATE, javax.xml.rpc.ParameterMode.IN);//接口的参数
|
||||
// call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型
|
||||
// String temp = "02e4ba493dc643c9926926662327995e";
|
||||
// String result = (String) call.invoke(new Object[]{temp});
|
||||
// //给方法传递参数,并且调用方法
|
||||
//
|
||||
// System.out.println("result is " + result);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// System.err.println(e.toString());
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
String method = "CheckData";
|
||||
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
|
||||
Client client = factory.createClient("http://120.27.212.36:9999/filing/services/HomepageDictionary?wsdl");
|
||||
// Endpoint endpoint2 = client.getEndpoint();
|
||||
// QName opName = new QName(endpoint2.getService().getName().getNamespaceURI(), method);
|
||||
// BindingInfo bindingInfo = endpoint2.getEndpointInfo().getBinding();
|
||||
// if (bindingInfo.getOperation(opName) == null) {
|
||||
// for (BindingOperationInfo operationInfo : bindingInfo.getOperations()) {
|
||||
// if (method.equals(operationInfo.getName().getLocalPart())) {
|
||||
// opName = operationInfo.getName();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Object[] res = null;
|
||||
res = client.invoke("CheckData","02e4ba493dc643c9926926662327995e");
|
||||
String xml = (String) res[0];
|
||||
System.err.println("@@@@@@@@@@@@@@@@@" + xml);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
|
||||
xmlns:activiti="http://activiti.org/bpmn" targetNamespace="Examples"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL
|
||||
http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd">
|
||||
|
||||
<process id="leave_process" name="某公司请假流程">
|
||||
<startEvent id="leave" name="请假申请"></startEvent>
|
||||
|
||||
<userTask id="dept_manager" name="部门经理审批"></userTask>
|
||||
<userTask id="boss" name="总经理审批"></userTask>
|
||||
<userTask id="hr" name="HR审批"></userTask>
|
||||
<sequenceFlow id="flow1" sourceRef="leave" targetRef="dept_manager"></sequenceFlow>
|
||||
<sequenceFlow id="flow2" sourceRef="dept_manager" targetRef="boss">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${day >= 3}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
<sequenceFlow id="flow3" sourceRef="boss" targetRef="hr"></sequenceFlow>
|
||||
<sequenceFlow id="flow4" sourceRef="dept_manager" targetRef="hr">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${day < 3}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
<sequenceFlow id="flow5" sourceRef="hr" targetRef="end"></sequenceFlow>
|
||||
|
||||
<endEvent id="end" name="结束"></endEvent>
|
||||
</process>
|
||||
|
||||
</definitions>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue