package com.changhong.epc.count.service.system.func.set.aggregate; import com.changhong.epc.bean.count.MasterInfo; import com.changhong.epc.count.service.count.model.UnitInfo; import com.changhong.epc.count.service.system.func.set.AbsFuncSupper; import com.changhong.epc.bean.count.MeInfo; import com.changhong.epc.count.service.tool.SystemFunTool; import com.googlecode.aviator.runtime.type.AviatorObject; import com.iemsoft.framework.cloud.core.tools.ObjectUtil; import java.util.List; import java.util.Map; import java.util.Objects; /** * 获得行程个数(字符串类型) * @Title: journeySum * @param @param jList * @param @param mdCode * @param @param cpnVal * @param @return 设定文件 * @return Integer 返回类型 * @throws */ public class UnitSumStr extends AbsFuncSupper { @Override public AviatorObject call(Map env) { List jList = getJourneyList(env); return getAviatorLong(jList.size()); } @Override public AviatorObject call(Map env, AviatorObject arg1) { List jList = getJourneyList(env); String mdCode = SystemFunTool.getMeInfoProp(arg1, env, MeInfo::getMdCode); String cpnVal = SystemFunTool.getStringVal(arg1, env); Integer sum = 0; if(ObjectUtil.notEmpty(jList)) { for (UnitInfo journeyInfo : jList) { String val = SystemFunTool.getStringVal(arg1, env); MasterInfo mi = journeyInfo.binarySearch(new MasterInfo(mdCode, "", cpnVal)); if (mi != null && Objects.equals(Objects.toString(mi.getMeVal()), cpnVal)) { sum++; } } } return getAviatorLong(sum); } @Override public String getName() { return FUNC_UNIT_SUMSTR; } }