修改cusBaseAction,新增异常回调方法
parent
665107e3cf
commit
062b998ce5
|
@ -31,7 +31,7 @@ log
|
||||||
/src/test/resources/application.properties
|
/src/test/resources/application.properties
|
||||||
/src/test/resources/application.xml
|
/src/test/resources/application.xml
|
||||||
/src/main/resources/file
|
/src/main/resources/file
|
||||||
|
/src/*/resources/ssl/
|
||||||
DirectoryV2.xml
|
DirectoryV2.xml
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2885,7 +2885,7 @@ public class Util extends weaver.general.Util {
|
||||||
public static String actionFailException(RequestManager requestManager, String msg) {
|
public static String actionFailException(RequestManager requestManager, String msg) {
|
||||||
requestManager.setMessageid(System.currentTimeMillis() + "");
|
requestManager.setMessageid(System.currentTimeMillis() + "");
|
||||||
requestManager.setMessagecontent(msg);
|
requestManager.setMessagecontent(msg);
|
||||||
throw new CustomerException(msg);
|
throw new CustomerException(msg, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,11 +12,7 @@ import weaver.workflow.request.RequestManager;
|
||||||
import weaver.workflow.workflow.WorkflowBillComInfo;
|
import weaver.workflow.workflow.WorkflowBillComInfo;
|
||||||
import weaver.workflow.workflow.WorkflowComInfo;
|
import weaver.workflow.workflow.WorkflowComInfo;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>基础的action,实现一些基础的参数</h1>
|
* <h1>基础的action,实现一些基础的参数</h1>
|
||||||
|
@ -30,16 +26,12 @@ public abstract class CusBaseAction implements Action {
|
||||||
* 全局日志对象
|
* 全局日志对象
|
||||||
*/
|
*/
|
||||||
protected final Logger log = Util.getLogger();
|
protected final Logger log = Util.getLogger();
|
||||||
|
private final Map<String, CusBaseActionHandleFunction> actionHandleMethod = new HashMap<>();
|
||||||
/**
|
/**
|
||||||
* 全局requestInfo对象
|
* 全局requestInfo对象
|
||||||
*/
|
*/
|
||||||
protected RequestInfo requestInfo;
|
protected RequestInfo requestInfo;
|
||||||
|
|
||||||
|
|
||||||
private final Map<String, CusBaseActionHandleFunction> actionHandleMethod = new HashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>初始化流程默认的处理方法</h2>
|
* <h2>初始化流程默认的处理方法</h2>
|
||||||
*/
|
*/
|
||||||
|
@ -88,19 +80,40 @@ public abstract class CusBaseAction implements Action {
|
||||||
}
|
}
|
||||||
cusBaseActionHandleFunction.handle(requestId, billTable, workflowId, user, requestManager);
|
cusBaseActionHandleFunction.handle(requestId, billTable, workflowId, user, requestManager);
|
||||||
} catch (CustomerException e) {
|
} catch (CustomerException e) {
|
||||||
e.printStackTrace();
|
if (e.getCode() != null && e.getCode() == 500) {
|
||||||
Util.actionFail(requestManager, e.getMessage());
|
Util.actionFail(requestManager, e.getMessage());
|
||||||
return Action.FAILURE_AND_CONTINUE;
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
if (this.exceptionCallback(e, requestManager)) {
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (this.exceptionCallback(e, requestManager)) {
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>程序执行异常回调</h2>
|
||||||
|
*
|
||||||
|
* @param e 异常信息
|
||||||
|
* @param requestManager requestManager对象
|
||||||
|
* @return 是否阻止action往下提交,true- 阻止, false-放行
|
||||||
|
*/
|
||||||
|
public boolean exceptionCallback(Exception e, RequestManager requestManager) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error(Util.logStr("execute action fail, exception message is [{}], error stack trace msg is: \n{}",
|
log.error(Util.logStr("execute action fail, exception message is [{}], error stack trace msg is: \n{}",
|
||||||
e.getMessage(), Util.getErrString(e)));
|
e.getMessage(), Util.getErrString(e)));
|
||||||
Util.actionFail(requestManager, e.getMessage());
|
Util.actionFail(requestManager, e.getMessage());
|
||||||
return Action.FAILURE_AND_CONTINUE;
|
return true;
|
||||||
}
|
|
||||||
return Action.SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>流程其他流转类型处理方法注册</h2>
|
* <h2>流程其他流转类型处理方法注册</h2>
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package weaver.youhong.ai.pcn.hrorganization.service;
|
package weaver.youhong.ai.pcn.hrorganization.service;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import ebu7common.youhong.ai.sftp.SftpConnectUtil;
|
||||||
|
import weaver.general.GCONST;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>人员组织架构同步逻辑处理</h1>
|
* <h1>人员组织架构同步逻辑处理</h1>
|
||||||
*
|
*
|
||||||
|
@ -11,4 +18,21 @@ package weaver.youhong.ai.pcn.hrorganization.service;
|
||||||
public class OrganizationAsyncService {
|
public class OrganizationAsyncService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* csv文件数据
|
||||||
|
*/
|
||||||
|
public List<List<String>> getRemoteFileData(String fileName) {
|
||||||
|
String userName = Util.getCusConfigValue("sftpUserName");
|
||||||
|
String ipAddress = Util.getCusConfigValue("sftpIp");
|
||||||
|
String sftpPort = Util.getCusConfigValue("sftpPort");
|
||||||
|
SftpConnectUtil sftpConnectUtil = new SftpConnectUtil(
|
||||||
|
userName,
|
||||||
|
GCONST.getRootPath() + "sftp" + File.separatorChar + "HR_Digital_PROD.pem",
|
||||||
|
null,
|
||||||
|
ipAddress,
|
||||||
|
Integer.parseInt(sftpPort), 1000 * 100);
|
||||||
|
sftpConnectUtil.close();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -44,6 +44,7 @@ public class TestOrganization extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void testStaticLog() {
|
public void testStaticLog() {
|
||||||
log.info("哈哈哈好的方式");
|
log.info("哈哈哈好的方式");
|
||||||
|
log.info(this.getClass().getResource("/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue