作者:前年老妖 | 来源:互联网 | 2023-09-07 13:22
本文由编程笔记#小编为大家整理,主要介绍了java 共同变量相关的知识,希望对你有一定的参考价值。
package com.zjft.bpe.itms_sx.cofferLedger;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zjft.bpe.stdlib.exception.ParamNotExistException;
import com.zjft.bpe.stdlib.util.ModuleUtil;
import com.zjft.log.ZjLogger;
import com.zjft.zjfz.datamodule.BizDataModule;
import com.zjft.zjfz.engine.IWFEngine;
import com.zjft.zjfz.util.LoggerUtil;
import com.zjft.zjfz.wfactivety.WFActivity;
import com.zjft.zjfz.wfdata.WFData;
public class CommonVariable {
public static String cashString = "";
public static String atmString = "";
public static String metalString = "";
public static String otherString = "";
private final static String TYPE = "type";
private final static String RESULTLIST = "resultList";
public String process(IWFEngine engine, WFActivity activity, WFData wfd, String wfName)
throws ParamNotExistException, com.zjft.bpe.stdlib.exception.UnrecognizedScopeException {
BizDataModule dm = wfd.getDataModule();
ZjLogger logger = LoggerUtil.getLog(dm.getChannelId(), dm.getTxCode());
ModuleUtil moduleUtil = new ModuleUtil(wfd, wfd.getDataModule(), activity, logger);
String type = moduleUtil.getParamValue(TYPE);
JSONArray resultList = JSONArray.parseArray(moduleUtil.getParamValue(RESULTLIST));
try {
if(type.equals("cash")) {
//判断结果cash结果是否为账实一致
if(judgeIferror(resultList).equals("error")) {
cashString="现金核查结果为账实不符";
}
}else if(type.equals("atm")) {
//判断结果atm结果是否为账实一致
if(judgeIferror(resultList).equals("error")) {
atmString="ATM核查结果为账实不符";
}
}else if(type.equals("metal")) {
//判断结果metal结果是否为账实一致
if(judgeIferror(resultList).equals("error")) {
metalString="贵金属核查结果为账实不符";
}
}else if(type.equals("other")) {
//判断结果other结果是否为账实一致
if(judgeIferror(resultList).equals("error")) {
otherString="其他物品核查结果为账实不符";
}
}
}catch (Exception e) {
logger.error("异常:", e);
return "fail";
}
return "ok";
}
public static String judgeIferror(JSONArray resultList) {
for(int i=0;i JSONObject temp = resultList.getJSONObject(i);
if(temp.getString("firmResult").equals("2")) {
return "error";
}
}
return "ok";
}
}