package com.changhong.epc.count.service.count.execution.impl; import com.changhong.epc.bean.count.MasterInfo; import com.changhong.epc.bean.tenant.norm.extend.AppStanderExtend; import com.changhong.epc.count.service.count.data.paramiter.IParamIter; import com.changhong.epc.count.service.count.execution.DefCountCore; import com.changhong.epc.count.service.count.execution.ICounter; import com.changhong.epc.count.service.count.model.UnitInfo; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import java.util.Set; import java.util.TreeSet; /** * 主数据匹配计算器 */ @Service("simpleCounter") @Scope("prototype") public class SimpleCounterImpl implements ICounter { // @Resource DefCountCore countCore = new DefCountCoreImpl(); @Override public Boolean exeCount(AppStanderExtend row, IParamIter t) { if(t == null || t.current() == null){ return false; } return countCore.countCore(row, disMaster(t.current().getUnitInfoMdJoinAll())); } /** * 主数据去重 * @param mdJoinAll * @return */ public Set disMaster(Set mdJoinAll){ Set masterInfos = new TreeSet<>((m1, m2)->m1.getMdCode().compareTo(m2.getMdCode())); mdJoinAll.stream().forEach(mdJoin->{ if(masterInfos.contains(mdJoin)){ masterInfos.remove(mdJoin); } masterInfos.add(mdJoin); }); return masterInfos; } @Override public Double gainMoney() { return null; } }