You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
4.7 KiB
Java
123 lines
4.7 KiB
Java
package com.engine.tjbankSocket.impl;
|
|
|
|
import com.engine.tjbankSocket.SocketExecute;
|
|
import com.engine.util.XMLUtils;
|
|
import com.icbc.api.internal.apache.http.impl.cookie.S;
|
|
import weaver.conn.RecordSet;
|
|
import weaver.conn.RecordSetTrans;
|
|
import weaver.general.BaseBean;
|
|
import weaver.general.GCONST;
|
|
import weaver.general.StringUtil;
|
|
import weaver.general.Util;
|
|
import weaver.interfaces.workflow.action.Action;
|
|
import weaver.soa.workflow.request.RequestService;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
public class CWGLSocketExecute extends BaseBean implements SocketExecute {
|
|
@Override
|
|
public String execute(String param) {
|
|
Map<String, String> paramMap = XMLUtils.parseXMLToMap(param);
|
|
writeLog("paramMap==="+paramMap);
|
|
String oaTrvlBnsExpnsAcctNo = paramMap.get("oaTrvlBnsExpnsAcctNo");
|
|
String apprvrNo = paramMap.get("apprvrNo");
|
|
String apprvrName = paramMap.get("apprvrName");
|
|
String flowStatus = paramMap.get("flowStatus");
|
|
String sgntrOpn = paramMap.get("sgntrOpn");
|
|
sgntrOpn = apprvrName + "(" + apprvrNo + "):" + sgntrOpn;
|
|
Map<String, String> resultMap = null;
|
|
int userid = 0;
|
|
try {
|
|
resultMap = getBeanByOAnum(oaTrvlBnsExpnsAcctNo, "formtable_main_281");
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return XMLUtils.CW2XML(paramMap, "1", e.getMessage());
|
|
}
|
|
try {
|
|
userid = getHrmidByWorkCode(apprvrNo);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
String id = resultMap.get("id");
|
|
int requestid = Util.getIntValue(resultMap.get("requestid"));
|
|
writeLog("requestid==="+requestid);
|
|
if (requestid == 0) {
|
|
return XMLUtils.CW2XML(paramMap, "1", "流程未找到");
|
|
}
|
|
if (userid == 0) {
|
|
return XMLUtils.CW2XML(paramMap, "1", "人员未找到");
|
|
}
|
|
RequestService requestService = new RequestService();
|
|
boolean istrue = false;
|
|
if ("0".equals(flowStatus)) {
|
|
sgntrOpn = sgntrOpn + "(驳回)";
|
|
istrue = requestService.nextNodeByReject(requestid, 1, sgntrOpn);
|
|
} else if ("1".equals(flowStatus)) {
|
|
sgntrOpn = sgntrOpn + "(记账前退单)";
|
|
istrue = requestService.nextNodeByReject(requestid, 1, sgntrOpn);
|
|
} else if ("2".equals(flowStatus)) {
|
|
sgntrOpn = sgntrOpn + "(记账后退单)";
|
|
istrue = requestService.nextNodeByReject(requestid, 1, sgntrOpn);
|
|
} else {
|
|
istrue = requestService.nextNodeBySubmit(null, requestid, 1, sgntrOpn);
|
|
}
|
|
writeLog("istrue==="+istrue);
|
|
if (istrue) {
|
|
try {
|
|
updateStatus(requestid, flowStatus);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return XMLUtils.CW2XML(paramMap, "1", e.getMessage());
|
|
}
|
|
return XMLUtils.CW2XML(paramMap, "0", "");
|
|
} else {
|
|
return XMLUtils.CW2XML(paramMap, "1", "流程提交失败");
|
|
}
|
|
}
|
|
|
|
private void updateStatus(int requestid, String flowStatus) throws Exception {
|
|
try {
|
|
RecordSet recordSet = new RecordSet();
|
|
recordSet.executeUpdate("update formtable_main_281 set cwxtzt = ? where requestId = ?", flowStatus, requestid);
|
|
} catch (Exception e) {
|
|
throw new Exception("更新状态失败");
|
|
}
|
|
}
|
|
|
|
|
|
public Map<String, String> getBeanByOAnum(String oaTrvlBnsExpnsAcctNo, String tableName) throws Exception {
|
|
RecordSet recordSet = new RecordSet();
|
|
HashMap<String, String> resultMap = new HashMap<>();
|
|
String sql = "select * from " + tableName + " where djbh = ?";
|
|
recordSet.executeQuery(sql, oaTrvlBnsExpnsAcctNo);
|
|
if (recordSet.next()) {
|
|
resultMap.put("id", Util.null2String(recordSet.getString("id")));
|
|
resultMap.put("requestid", Util.null2String(recordSet.getString("requestid")));
|
|
return resultMap;
|
|
} else {
|
|
throw new Exception("编号对应单据不存在");
|
|
}
|
|
}
|
|
|
|
public int getHrmidByWorkCode(String workcode) throws Exception {
|
|
RecordSet recordSet = new RecordSet();
|
|
String sql = "select id from HRMRESOURCE where workcode = ?";
|
|
recordSet.executeQuery(sql, workcode);
|
|
if (recordSet.next()) {
|
|
return Util.getIntValue(recordSet.getString("id"));
|
|
} else {
|
|
throw new Exception("审批人不存在");
|
|
}
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
|
|
String rootPath = "D:\\WEAVER2\\ecology\\";
|
|
GCONST.setRootPath(rootPath);
|
|
GCONST.setServerName("ecology");
|
|
|
|
}
|
|
|
|
}
|