|  | @@ -0,0 +1,888 @@
 | 
	
		
			
				|  |  | +package fi.ar.formplugin;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.serialization.SerializationUtils;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.utils.ObjectUtils;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.utils.StringUtils;
 | 
	
		
			
				|  |  | +import kd.bos.entity.filter.FilterValue;
 | 
	
		
			
				|  |  | +import kd.bos.report.plugin.*;
 | 
	
		
			
				|  |  | +import kd.bos.context.*;
 | 
	
		
			
				|  |  | +import kd.fi.arapcommon.report.acctagev2.AcctageParam;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang.*;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.resource.*;
 | 
	
		
			
				|  |  | +import kd.bos.entity.*;
 | 
	
		
			
				|  |  | +import kd.bos.form.field.*;
 | 
	
		
			
				|  |  | +import kd.bos.form.control.*;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.stream.*;
 | 
	
		
			
				|  |  | +import kd.bplat.scmc.report.conf.*;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.events.*;
 | 
	
		
			
				|  |  | +import kd.bplat.scmc.report.core.*;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.utils.*;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.entity.*;
 | 
	
		
			
				|  |  | +import kd.fi.arapcommon.report.acctage.*;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.serialization.*;
 | 
	
		
			
				|  |  | +import kd.bos.orm.query.*;
 | 
	
		
			
				|  |  | +import kd.bos.servicehelper.*;
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.*;
 | 
	
		
			
				|  |  | +import kd.fi.arapcommon.helper.*;
 | 
	
		
			
				|  |  | +import kd.fi.arapcommon.report.*;
 | 
	
		
			
				|  |  | +import kd.fi.arapcommon.util.*;
 | 
	
		
			
				|  |  | +import kd.bos.servicehelper.basedata.*;
 | 
	
		
			
				|  |  | +import kd.bos.bill.*;
 | 
	
		
			
				|  |  | +import kd.bos.report.*;
 | 
	
		
			
				|  |  | +import kd.bos.entity.report.*;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  | +import java.util.function.*;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.metadata.*;
 | 
	
		
			
				|  |  | +import kd.bos.entity.property.*;
 | 
	
		
			
				|  |  | +import kd.bos.entity.filter.*;
 | 
	
		
			
				|  |  | +import kd.bos.report.filter.*;
 | 
	
		
			
				|  |  | +import kd.bos.dataentity.metadata.clr.*;
 | 
	
		
			
				|  |  | +import kd.bos.form.container.*;
 | 
	
		
			
				|  |  | +import kd.bos.form.*;
 | 
	
		
			
				|  |  | +import kd.bos.list.*;
 | 
	
		
			
				|  |  | +import kd.bos.form.events.*;
 | 
	
		
			
				|  |  | +import kd.bos.entity.datamodel.*;
 | 
	
		
			
				|  |  | +import kd.bos.form.field.events.*;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * @author cjz
 | 
	
		
			
				|  |  | + * @date 2024/10/30 17:34
 | 
	
		
			
				|  |  | + * @description:标准报表改造
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +public class AcctageForm extends AbstractReportFormPlugin implements HyperLinkClickListener
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    private List<Long> orgIds;
 | 
	
		
			
				|  |  | +    private ReportConf confCache;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public AcctageForm() {
 | 
	
		
			
				|  |  | +        this.orgIds = null;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void registerListener(final EventObject e) {
 | 
	
		
			
				|  |  | +        super.registerListener(e);
 | 
	
		
			
				|  |  | +        final ReportList list = (ReportList)this.getControl("reportlistap");
 | 
	
		
			
				|  |  | +        list.addHyperClickListener((HyperLinkClickListener)this);
 | 
	
		
			
				|  |  | +        final BasedataEdit orgCtrl = (BasedataEdit)this.getControl("orgs");
 | 
	
		
			
				|  |  | +        orgCtrl.addBeforeF7SelectListener(beforeF7SelectEvent -> {
 | 
	
		
			
				|  |  | +            final ListShowParameter showParameter = (ListShowParameter)beforeF7SelectEvent.getFormShowParameter();
 | 
	
		
			
				|  |  | +            showParameter.getListFilterParameter().setFilter(new QFilter("id", "in", (Object)this.getOrgIds()));
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        final BasedataEdit billTypeEdit = (BasedataEdit)this.getControl("billtypes");
 | 
	
		
			
				|  |  | +        billTypeEdit.addBeforeF7SelectListener(listener -> {
 | 
	
		
			
				|  |  | +            final ListShowParameter formShowParameter = (ListShowParameter)listener.getFormShowParameter();
 | 
	
		
			
				|  |  | +            final String billScope = (String)this.getModel().getValue("sourceentity");
 | 
	
		
			
				|  |  | +            final List<String> billScopes = new LinkedList<String>();
 | 
	
		
			
				|  |  | +            if ("ALL".equals(billScope)) {
 | 
	
		
			
				|  |  | +                if (this.isAr()) {
 | 
	
		
			
				|  |  | +                    billScopes.add("ar_finarbill");
 | 
	
		
			
				|  |  | +                    billScopes.add("ar_busbill");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else {
 | 
	
		
			
				|  |  | +                    billScopes.add("ap_finapbill");
 | 
	
		
			
				|  |  | +                    billScopes.add("ap_busbill");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (billScope.contains("fin")) {
 | 
	
		
			
				|  |  | +                if (this.isAr()) {
 | 
	
		
			
				|  |  | +                    billScopes.add("ar_finarbill");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else {
 | 
	
		
			
				|  |  | +                    billScopes.add("ap_finapbill");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (billScope.contains("bus")) {
 | 
	
		
			
				|  |  | +                if (this.isAr()) {
 | 
	
		
			
				|  |  | +                    billScopes.add("ar_busbill");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else {
 | 
	
		
			
				|  |  | +                    billScopes.add("ap_busbill");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            formShowParameter.getListFilterParameter().setFilter(new QFilter("billformid", "in", (Object)billScopes));
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void initDefaultQueryParam(final ReportQueryParam queryParam) {
 | 
	
		
			
				|  |  | +        if (EmptyUtils.isEmpty(this.getModel().getValue("orgs"))) {
 | 
	
		
			
				|  |  | +            this.orgIds = this.getOrgIds();
 | 
	
		
			
				|  |  | +            if (this.orgIds != null && this.orgIds.size() > 0) {
 | 
	
		
			
				|  |  | +                long orgId = RequestContext.get().getOrgId();
 | 
	
		
			
				|  |  | +                if (!this.orgIds.contains(orgId)) {
 | 
	
		
			
				|  |  | +                    orgId = this.orgIds.get(0);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                this.getModel().setValue("orgs", (Object)new Object[] { orgId });
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        this.setCompareDateComboItems();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private List<Long> getOrgIds() {
 | 
	
		
			
				|  |  | +        if (this.orgIds == null) {
 | 
	
		
			
				|  |  | +            final List<DynamicObject> orgs = OrgHelper.getAuthorizedInitializedOrgs(this.getView().getEntityId(), "47150e89000000ac", this.isAr());
 | 
	
		
			
				|  |  | +            this.orgIds = (List)orgs.stream().map((org) -> {
 | 
	
		
			
				|  |  | +                return org.getLong("id");
 | 
	
		
			
				|  |  | +            }).distinct().collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return this.orgIds;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private boolean isAr() {
 | 
	
		
			
				|  |  | +        return StringUtils.contains(this.getView().getEntityId(), "ar_");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void setCompareDateComboItems() {
 | 
	
		
			
				|  |  | +        final String sourceEntity = (String)this.getModel().getValue("sourceentity");
 | 
	
		
			
				|  |  | +        final List<ComboItem> comboItems = new ArrayList<ComboItem>(64);
 | 
	
		
			
				|  |  | +        List<ComboItem> combo = new ArrayList<ComboItem>(64);
 | 
	
		
			
				|  |  | +        if ("ALL".equals(sourceEntity) || "finpaidbill".equals(sourceEntity)) {
 | 
	
		
			
				|  |  | +            final ComboItem comboItem = new ComboItem(new LocaleString(ResManager.loadKDString("\u6309\u5355\u636e\u65e5\u671f", "AcctageForm_6", "fi-arapcommon", new Object[0])), "bizdate");
 | 
	
		
			
				|  |  | +            comboItems.add(comboItem);
 | 
	
		
			
				|  |  | +            this.setStandard(comboItems);
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if ("paidbill".equals(sourceEntity)) {
 | 
	
		
			
				|  |  | +            final ComboItem bizDateItem = new ComboItem(new LocaleString(ResManager.loadKDString("\u6309\u4e1a\u52a1\u65e5\u671f", "AcctageForm_7", "fi-arapcommon", new Object[0])), "bizdate");
 | 
	
		
			
				|  |  | +            comboItems.add(bizDateItem);
 | 
	
		
			
				|  |  | +            final String recDate = ResManager.loadKDString("\u6536\u6b3e\u65e5\u671f", "AcctageForm_8", "fi-arapcommon", new Object[0]);
 | 
	
		
			
				|  |  | +            final String payDate = ResManager.loadKDString("\u4ed8\u6b3e\u65e5\u671f", "AcctageForm_9", "fi-arapcommon", new Object[0]);
 | 
	
		
			
				|  |  | +            final ComboItem payDateItem = new ComboItem(new LocaleString(ResManager.loadKDString("\u6309%s", "AcctageForm_10", "fi-arapcommon", new Object[] { this.isAr() ? recDate : payDate })), this.isAr() ? "payeedate" : "paydate");
 | 
	
		
			
				|  |  | +            comboItems.add(payDateItem);
 | 
	
		
			
				|  |  | +            this.setStandard(comboItems);
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        final Set<String> allSourceEntityKeys = this.buildSourceEntityKeys(sourceEntity);
 | 
	
		
			
				|  |  | +        List<DateTimeProp> datePropIntersection = null;
 | 
	
		
			
				|  |  | +        for (final String entityKey : allSourceEntityKeys) {
 | 
	
		
			
				|  |  | +            final List<DateTimeProp> dateProps = EntityMetadataUtils.getDateProps(entityKey);
 | 
	
		
			
				|  |  | +            if (datePropIntersection == null) {
 | 
	
		
			
				|  |  | +                datePropIntersection = dateProps;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else {
 | 
	
		
			
				|  |  | +                final Iterator<DateTimeProp> iterator = datePropIntersection.iterator();
 | 
	
		
			
				|  |  | +                while (iterator.hasNext()) {
 | 
	
		
			
				|  |  | +                    final DateTimeProp next = iterator.next();
 | 
	
		
			
				|  |  | +                    boolean contains = false;
 | 
	
		
			
				|  |  | +                    for (final DateTimeProp p : dateProps) {
 | 
	
		
			
				|  |  | +                        if (p.getName().equals(next.getName())) {
 | 
	
		
			
				|  |  | +                            contains = true;
 | 
	
		
			
				|  |  | +                            break;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    if (!contains) {
 | 
	
		
			
				|  |  | +                        iterator.remove();
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (datePropIntersection != null) {
 | 
	
		
			
				|  |  | +            for (final DateTimeProp prop : datePropIntersection) {
 | 
	
		
			
				|  |  | +                final String value = prop.getName();
 | 
	
		
			
				|  |  | +                if (!StringUtils.contains(value, "createtime") && !StringUtils.contains(value, "modifytime") && !StringUtils.contains(value, "updatetime") && !"auditdate".equals(value) && !"exratedate".equals(value)) {
 | 
	
		
			
				|  |  | +                    if ("premduedate".equals(prop.getName())) {
 | 
	
		
			
				|  |  | +                        continue;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    final IDataEntityType parent = prop.getParent();
 | 
	
		
			
				|  |  | +                    final String displayName = prop.getDisplayName().getLocaleValue();
 | 
	
		
			
				|  |  | +                    if (parent instanceof EntryType) {
 | 
	
		
			
				|  |  | +                        continue;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    final ComboItem comboItem2 = new ComboItem(new LocaleString(ResManager.loadKDString("\u6309%s", "AcctageForm_10", "fi-arapcommon", new Object[] { displayName })), value);
 | 
	
		
			
				|  |  | +                    comboItems.add(comboItem2);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if ("ap_finapbill".equals(sourceEntity) || "ar_finarbill".equals(sourceEntity)) {
 | 
	
		
			
				|  |  | +            final ComboItem comboItem3 = new ComboItem(new LocaleString(ResManager.loadKDString("\u6309\u8ba1\u5212\u884c\u5230\u671f\u65e5", "AcctageForm_0", "fi-arapcommon", new Object[0])), "planduedate");
 | 
	
		
			
				|  |  | +            comboItems.add(comboItem3);
 | 
	
		
			
				|  |  | +            this.setStandard(comboItems);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        combo=comboItems.subList(0,2);
 | 
	
		
			
				|  |  | +        this.setStandard(combo);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private Set<String> buildSourceEntityKeys(final String sourceEntity) {
 | 
	
		
			
				|  |  | +        final Set<String> allSourceEntityKeys = new HashSet<String>(4);
 | 
	
		
			
				|  |  | +        if (sourceEntity.contains("fin")) {
 | 
	
		
			
				|  |  | +            if (this.isAr()) {
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ar_finarbill");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else {
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ap_finapbill");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (sourceEntity.contains("bus")) {
 | 
	
		
			
				|  |  | +            if (this.isAr()) {
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ar_busbill");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else {
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ap_busbill");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if ("finpaidbill".equals(sourceEntity) || "paidbill".equals(sourceEntity)) {
 | 
	
		
			
				|  |  | +            if (this.isAr()) {
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("cas_recbill");
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ar_receivedbill");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else {
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("cas_paybill");
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ap_paidbill");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if ("ALL".equals(sourceEntity)) {
 | 
	
		
			
				|  |  | +            if (this.isAr()) {
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("cas_recbill");
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ar_receivedbill");
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ar_busbill");
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ar_finarbill");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else {
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("cas_paybill");
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ap_paidbill");
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ap_busbill");
 | 
	
		
			
				|  |  | +                allSourceEntityKeys.add("ap_finapbill");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return allSourceEntityKeys;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void setStandard(final List<ComboItem> comboItems) {
 | 
	
		
			
				|  |  | +        final ComboEdit comboEdit = (ComboEdit)this.getControl("standard");
 | 
	
		
			
				|  |  | +        comboEdit.setComboItems((List)comboItems);
 | 
	
		
			
				|  |  | +        this.getModel().setValue("standard", (Object)"duedate");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void afterCreateNewData(final EventObject e) {
 | 
	
		
			
				|  |  | +        super.afterCreateNewData(e);
 | 
	
		
			
				|  |  | +        this.resetFilterGrid();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void resetFilterGrid() {
 | 
	
		
			
				|  |  | +        final FilterGrid filterGrid = (FilterGrid)this.getView().getControl("commonfs");
 | 
	
		
			
				|  |  | +        final List<Map<String, Object>> filterColumns = (List<Map<String, Object>>)filterGrid.getFilterColumns();
 | 
	
		
			
				|  |  | +        final List<Map<String, Object>> cols = new ArrayList<Map<String, Object>>(filterColumns.size());
 | 
	
		
			
				|  |  | +        String fieldName = null;
 | 
	
		
			
				|  |  | +        for (final Map<String, Object> info : filterColumns) {
 | 
	
		
			
				|  |  | +            fieldName = (String) info.get("fieldName");
 | 
	
		
			
				|  |  | +            if (this.filterGrid(fieldName)) {
 | 
	
		
			
				|  |  | +                cols.add(info);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        filterGrid.setFilterColumns((List)cols);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private boolean filterGrid(final String fieldName) {
 | 
	
		
			
				|  |  | +        final String[] split = fieldName.split("\\.");
 | 
	
		
			
				|  |  | +        final Set<String> removedPros = new HashSet<String>();
 | 
	
		
			
				|  |  | +        removedPros.add("org");
 | 
	
		
			
				|  |  | +        removedPros.add("asstacttype");
 | 
	
		
			
				|  |  | +        removedPros.add("asstact");
 | 
	
		
			
				|  |  | +        removedPros.add("currency");
 | 
	
		
			
				|  |  | +        removedPros.add("basecurrency");
 | 
	
		
			
				|  |  | +        removedPros.add("entitykey");
 | 
	
		
			
				|  |  | +        removedPros.add("billtype");
 | 
	
		
			
				|  |  | +        removedPros.add("bizdate");
 | 
	
		
			
				|  |  | +        removedPros.add("comparedate");
 | 
	
		
			
				|  |  | +        removedPros.add("id");
 | 
	
		
			
				|  |  | +        removedPros.add("quotation");
 | 
	
		
			
				|  |  | +        removedPros.add("exchangerate");
 | 
	
		
			
				|  |  | +        removedPros.add("paymentbilltype");
 | 
	
		
			
				|  |  | +        removedPros.add("entryid");
 | 
	
		
			
				|  |  | +        removedPros.add("planseq");
 | 
	
		
			
				|  |  | +        return !removedPros.contains(split[0]);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void beforeFieldPostBack(final BeforeFieldPostBackEvent e) {
 | 
	
		
			
				|  |  | +        super.beforeFieldPostBack(e);
 | 
	
		
			
				|  |  | +        final Control source = (Control)e.getSource();
 | 
	
		
			
				|  |  | +        final String key = source.getKey();
 | 
	
		
			
				|  |  | +        final Object value = e.getValue();
 | 
	
		
			
				|  |  | +        final boolean showLocalAmt = (boolean)this.getModel().getValue("showlocalamt");
 | 
	
		
			
				|  |  | +        if ("showqtycols".equals(key)) {
 | 
	
		
			
				|  |  | +            final List<String> qtyCols = (List)Stream.of(((String)value).split(",")).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +            if (!qtyCols.contains("balance")) {
 | 
	
		
			
				|  |  | +                this.getView().showTipNotification(ResManager.loadKDString("\u201c\u6c47\u603b\u503c\u201d\u4e2d\u9009\u9879\u201c\u4f59\u989d\u201d\u5fc5\u9009\u3002", "AcctageForm_1", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
 | 
	
		
			
				|  |  | +                e.setCancel(true);
 | 
	
		
			
				|  |  | +                this.getView().updateView(key);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (showLocalAmt && !qtyCols.contains("balanceloc")) {
 | 
	
		
			
				|  |  | +                this.getView().showTipNotification(ResManager.loadKDString("\u663e\u793a\u6298\u672c\u5e01\u65f6\u201c\u6c47\u603b\u503c\u201d\u4e2d\u9009\u9879\u201c\u4f59\u989d\u6298\u672c\u5e01\u201d\u5fc5\u9009\u3002", "AcctageForm_2", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
 | 
	
		
			
				|  |  | +                e.setCancel(true);
 | 
	
		
			
				|  |  | +                this.getView().updateView(key);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if ("showkeycols".equals(key)) {
 | 
	
		
			
				|  |  | +            final List<String> keyCols =  (List)Stream.of(((String)value).split(",")).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +            if (!keyCols.contains("asstacttype")) {
 | 
	
		
			
				|  |  | +                this.getView().showTipNotification(ResManager.loadKDString("\u201c\u7edf\u8ba1\u7ef4\u5ea6\u201d\u4e2d\u9009\u9879\u201c\u5f80\u6765\u7c7b\u578b\u201d\u5fc5\u9009\u3002", "AcctageForm_3", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
 | 
	
		
			
				|  |  | +                e.setCancel(true);
 | 
	
		
			
				|  |  | +                this.getView().updateView(key);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (!keyCols.contains("currency")) {
 | 
	
		
			
				|  |  | +                this.getView().showTipNotification(ResManager.loadKDString("\u201c\u7edf\u8ba1\u7ef4\u5ea6\u201d\u4e2d\u9009\u9879\u201c\u5e01\u79cd\u201d\u5fc5\u9009\u3002", "AcctageForm_4", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
 | 
	
		
			
				|  |  | +                e.setCancel(true);
 | 
	
		
			
				|  |  | +                this.getView().updateView(key);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (showLocalAmt && !keyCols.contains("basecurrency")) {
 | 
	
		
			
				|  |  | +                this.getView().showTipNotification(ResManager.loadKDString("\u663e\u793a\u6298\u672c\u5e01\u65f6\u201c\u7edf\u8ba1\u7ef4\u5ea6\u201d\u4e2d\u9009\u9879\u201c\u672c\u4f4d\u5e01\u201d\u5fc5\u9009\u3002", "AcctageForm_5", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
 | 
	
		
			
				|  |  | +                e.setCancel(true);
 | 
	
		
			
				|  |  | +                this.getView().updateView(key);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//    public void propertyChanged(final PropertyChangedArgs e) {
 | 
	
		
			
				|  |  | +//        super.propertyChanged(e);
 | 
	
		
			
				|  |  | +//        final String key = e.getProperty().getName();
 | 
	
		
			
				|  |  | +//        final IDataModel m = this.getModel();
 | 
	
		
			
				|  |  | +//        if ("sourceentity".equals(key)) {
 | 
	
		
			
				|  |  | +//            this.setCompareDateComboItems();
 | 
	
		
			
				|  |  | +//            final Object billScope = m.getValue("sourceentity");
 | 
	
		
			
				|  |  | +//            m.setValue("billtypes", (Object)new Object[0]);
 | 
	
		
			
				|  |  | +//            m.setValue("paymentbilltypes", (Object)new Object[0]);
 | 
	
		
			
				|  |  | +//            if ("ar_finarbill".equals(billScope) || "ap_finapbill".equals(billScope) || "paidbill".equals(billScope) || "finpaidbill".equals(billScope)) {
 | 
	
		
			
				|  |  | +//                this.getModel().setValue("onlycontainsamount", (Object)Boolean.FALSE);
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//        else if (("showbybill".equals(key) || "showlocalamt".equals(key)) && "showlocalamt".equals(key)) {
 | 
	
		
			
				|  |  | +//            final ChangeData[] changeDatas = e.getChangeSet();
 | 
	
		
			
				|  |  | +//            final Object newValue = changeDatas[0].getNewValue();
 | 
	
		
			
				|  |  | +//            final boolean isShowLocalAmt = (boolean)newValue;
 | 
	
		
			
				|  |  | +//            final ReportConf conf = this.getReportConf();
 | 
	
		
			
				|  |  | +//            final List<BigTableColConf> bigTableColConfs = (List<BigTableColConf>)conf.getBigTableColConf();
 | 
	
		
			
				|  |  | +//            final List<String> cols = bigTableColConfs.stream().filter(colConf -> "B".equals(colConf.getCalType())).map((Function<? super Object, ?>)BigTableColConf::getCol).collect((Collector<? super Object, ?, List<String>>)Collectors.toList());
 | 
	
		
			
				|  |  | +//            if (!isShowLocalAmt) {
 | 
	
		
			
				|  |  | +//                cols.removeIf(col -> StringUtils.endsWith(col, "loc"));
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//            m.setValue("showqtycols", (Object)String.join(",", cols));
 | 
	
		
			
				|  |  | +//            final String showkeycols = (String)m.getValue("showkeycols");
 | 
	
		
			
				|  |  | +//            final List<String> dims = Stream.of(showkeycols.split(",")).filter(s -> EmptyUtils.isNotEmpty(s)).collect((Collector<? super String, ?, List<String>>)Collectors.toList());
 | 
	
		
			
				|  |  | +//            if (isShowLocalAmt) {
 | 
	
		
			
				|  |  | +//                if (!dims.contains("basecurrency")) {
 | 
	
		
			
				|  |  | +//                    dims.add("basecurrency");
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//            else if (dims.contains("basecurrency")) {
 | 
	
		
			
				|  |  | +//                dims.remove("basecurrency");
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//            m.setValue("showkeycols", (Object)String.join(",", dims));
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    protected final ReportConf getReportConf() {
 | 
	
		
			
				|  |  | +        if (this.confCache == null) {
 | 
	
		
			
				|  |  | +            this.confCache = ReportDataHandle.loadReportConf(this.getModel().getDataEntityType().getName());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return this.confCache;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public boolean verifyQuery(final ReportQueryParam queryParam) {
 | 
	
		
			
				|  |  | +        boolean verify = super.verifyQuery(queryParam);
 | 
	
		
			
				|  |  | +        final FilterInfo filterInfo = queryParam.getFilter();
 | 
	
		
			
				|  |  | +        final DynamicObjectCollection orgs = queryParam.getFilter().getDynamicObjectCollection("orgs");
 | 
	
		
			
				|  |  | +        if (orgs == null || orgs.isEmpty()) {
 | 
	
		
			
				|  |  | +            this.getView().showTipNotification(ResManager.loadKDString("\u7ed3\u7b97\u7ec4\u7ec7\u4e0d\u80fd\u4e3a\u7a7a\u3002", "AcctageForm_11", "fi-arapcommon", new Object[0]), Integer.valueOf(3000));
 | 
	
		
			
				|  |  | +            verify = false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if ("planduedate".equals(filterInfo.getString("standard"))) {
 | 
	
		
			
				|  |  | +            final List<Long> ids = (List)orgs.stream().map((orgx) -> {
 | 
	
		
			
				|  |  | +                return orgx.getLong("id");
 | 
	
		
			
				|  |  | +            }).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +            final Map<Long, Object> settleModelMap = SystemParameterHelper.batchGetAppParameter(this.isAr(), ids, this.isAr() ? "ar_003" : "ap_003");
 | 
	
		
			
				|  |  | +            final List<Long> materialSettleOrgIds = new ArrayList<Long>(2);
 | 
	
		
			
				|  |  | +            for (final Map.Entry<Long, Object> entry : settleModelMap.entrySet()) {
 | 
	
		
			
				|  |  | +                if ("1".equals(entry.getValue())) {
 | 
	
		
			
				|  |  | +                    materialSettleOrgIds.add(entry.getKey());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (!ObjectUtils.isEmpty((Object)materialSettleOrgIds)) {
 | 
	
		
			
				|  |  | +                final String message = ResManager.loadKDString("\u4ee5\u4e0b\u7ec4\u7ec7\u7684\u7ed3\u7b97\u6a21\u578b\u4e3a\u6309\u7269\u6599\u884c\u7ed3\u7b97\uff0c\u4e0d\u5141\u8bb8\u6309\u8ba1\u5212\u884c\u5230\u671f\u65e5\u7edf\u8ba1\u8d26\u9f84\uff0c\u8bf7\u4fee\u6539\u3002", "AcctageForm_20", "fi-arapcommon", new Object[0]);
 | 
	
		
			
				|  |  | +                final StringBuilder sb = new StringBuilder();
 | 
	
		
			
				|  |  | +                for (final DynamicObject org2 : orgs) {
 | 
	
		
			
				|  |  | +                    if (materialSettleOrgIds.contains(org2.getLong("id"))) {
 | 
	
		
			
				|  |  | +                        sb.append(org2.getString("name")).append('\uff1b');
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                this.getView().showMessage(message, sb.toString(), MessageTypes.Default);
 | 
	
		
			
				|  |  | +                verify = false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (filterInfo.getString("date") == null) {
 | 
	
		
			
				|  |  | +            this.getView().showTipNotification(ResManager.loadKDString("\u8bf7\u6307\u5b9a\u67e5\u8be2\u65e5\u671f\u3002", "AcctageForm_12", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +            verify = false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (filterInfo.getString("standard") == null) {
 | 
	
		
			
				|  |  | +            this.getView().showTipNotification(ResManager.loadKDString("\u8bf7\u9009\u62e9\u8d26\u9f84\u8ba1\u7b97\u6807\u51c6\u3002", "AcctageForm_13", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +            verify = false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (filterInfo.getString("sourceentity") == null) {
 | 
	
		
			
				|  |  | +            this.getView().showTipNotification(ResManager.loadKDString("\u8bf7\u9009\u62e9\u6570\u636e\u8303\u56f4\u3002", "AcctageForm_14", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +            verify = false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (this.getGroupsValidator()) {
 | 
	
		
			
				|  |  | +            verify = false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (this.existEntries(queryParam)) {
 | 
	
		
			
				|  |  | +            this.getView().showTipNotification(ResManager.loadKDString("\u67e5\u8be2\u5931\u8d25\u3002\u5931\u8d25\u539f\u56e0\uff1a\u4f9b\u5e94\u94fe\u4e91-\u4e1a\u52a1\u8bbe\u7f6e-\u6781\u901f\u62a5\u8868-\u62a5\u8868\u5b57\u6bb5\u6620\u5c04\u914d\u7f6e-\u201c\u5b57\u6bb5\u6620\u5c04\u914d\u7f6e\u201d\uff0c\u201c\u6765\u6e90\u5b57\u6bb5\u6807\u8bc6\u201d\u4e0d\u5141\u8bb8\u6765\u6e90\u4e8e\u591a\u4e2a\u5206\u5f55\u3002\u8bf7\u4fee\u6539\u540e\u91cd\u65b0\u67e5\u8be2\u3002", "AcctageForm_21", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +            verify = false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return verify;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private boolean getGroupsValidator() {
 | 
	
		
			
				|  |  | +        final String groupStr = this.getPageCache().get("groups");
 | 
	
		
			
				|  |  | +        List<AcctageGroup> groups;
 | 
	
		
			
				|  |  | +        if (ObjectUtils.isEmpty((Object)groupStr)) {
 | 
	
		
			
				|  |  | +            groups = AcctageHelper.getGroupsWithAgingGroup(this.isAr() ? "ar_acctagesetting" : "ap_acctagesetting");
 | 
	
		
			
				|  |  | +            if (groups.isEmpty()) {
 | 
	
		
			
				|  |  | +                groups = this.getDefaultAgingGroup();
 | 
	
		
			
				|  |  | +                return groups.isEmpty();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else {
 | 
	
		
			
				|  |  | +            groups = (List<AcctageGroup>) SerializationUtils.fromJsonStringToList(groupStr, (Class)AcctageGroup.class);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return groups.isEmpty();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private boolean existEntries(final ReportQueryParam queryParam) {
 | 
	
		
			
				|  |  | +        boolean existEntries = false;
 | 
	
		
			
				|  |  | +        final FilterInfo filterInfo = queryParam.getFilter();
 | 
	
		
			
				|  |  | +        final String srcEntity = filterInfo.getString("sourceentity");
 | 
	
		
			
				|  |  | +        if ("ap_finapbill".equals(srcEntity) || "ar_finarbill".equals(srcEntity) || "finbusbill".equals(srcEntity) || "finpaidbill".equals(srcEntity) || "ALL".equals(srcEntity)) {
 | 
	
		
			
				|  |  | +            final QFilter statusFilter = new QFilter("status", "=", (Object)Boolean.TRUE);
 | 
	
		
			
				|  |  | +            final QFilter reportFilter = new QFilter("report", "=", (Object)this.getView().getEntityId());
 | 
	
		
			
				|  |  | +            final Map<Object, DynamicObject> reportConf = (Map<Object, DynamicObject>)BusinessDataServiceHelper.loadFromCache("scmc_report_conf", new QFilter[] { statusFilter, reportFilter });
 | 
	
		
			
				|  |  | +            if (ObjectUtils.isEmpty((Object)reportConf)) {
 | 
	
		
			
				|  |  | +                return existEntries;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            final DynamicObject[] cfs = reportConf.values().toArray(new DynamicObject[0]);
 | 
	
		
			
				|  |  | +            final Set<Long> colMapIds = new HashSet<Long>(2);
 | 
	
		
			
				|  |  | +            for (final DynamicObject row : cfs[0].getDynamicObjectCollection("srcentry")) {
 | 
	
		
			
				|  |  | +                final String srcNumber = row.getDynamicObject("srcentity").getString("number");
 | 
	
		
			
				|  |  | +                final boolean blockStatus = row.getBoolean("blockstatus");
 | 
	
		
			
				|  |  | +                if (blockStatus && ("ar_finarbill".equals(srcNumber) || "ap_finapbill".equals(srcNumber))) {
 | 
	
		
			
				|  |  | +                    colMapIds.add(row.getDynamicObject("colmap").getLong("id"));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (ObjectUtils.isEmpty((Object)colMapIds)) {
 | 
	
		
			
				|  |  | +                return existEntries;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            final QFilter idFilter = new QFilter("id", "in", (Object)colMapIds);
 | 
	
		
			
				|  |  | +            final Map<Object, DynamicObject> reportColMap = (Map<Object, DynamicObject>)BusinessDataServiceHelper.loadFromCache("scmc_report_colmap", new QFilter[] { idFilter });
 | 
	
		
			
				|  |  | +            if (ObjectUtils.isEmpty((Object)reportColMap)) {
 | 
	
		
			
				|  |  | +                return existEntries;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            for (final DynamicObject reportCol : reportColMap.values().toArray(new DynamicObject[0])) {
 | 
	
		
			
				|  |  | +                final String mapInfoJsonStr = reportCol.getString("mapinfo_tag");
 | 
	
		
			
				|  |  | +                if (ObjectUtils.isEmpty((Object)mapInfoJsonStr)) {
 | 
	
		
			
				|  |  | +                    return existEntries;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                final JSONObject colInfo = JSONObject.parseObject(mapInfoJsonStr);
 | 
	
		
			
				|  |  | +                final JSONArray fullSrcCols = colInfo.getJSONArray("fullsrccol");
 | 
	
		
			
				|  |  | +                final Set<Object> fullSrcColSet = new HashSet<Object>((Collection<?>)fullSrcCols);
 | 
	
		
			
				|  |  | +                String entryKey = "";
 | 
	
		
			
				|  |  | +                for (final Object value : fullSrcColSet) {
 | 
	
		
			
				|  |  | +                    final String[] split = ((String)value).split("\\.");
 | 
	
		
			
				|  |  | +                    if (split.length == 2) {
 | 
	
		
			
				|  |  | +                        if (ObjectUtils.isEmpty((Object)entryKey)) {
 | 
	
		
			
				|  |  | +                            entryKey = split[0];
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        else {
 | 
	
		
			
				|  |  | +                            if (!entryKey.equals(split[0])) {
 | 
	
		
			
				|  |  | +                                existEntries = true;
 | 
	
		
			
				|  |  | +                                break;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            continue;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (!ObjectUtils.isEmpty((Object)entryKey)) {
 | 
	
		
			
				|  |  | +                    queryParam.getCustomParam().put("entryName", entryKey);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return existEntries;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void beforeQuery(final ReportQueryParam queryParam) {
 | 
	
		
			
				|  |  | +        super.beforeQuery(queryParam);
 | 
	
		
			
				|  |  | +        final AcctageParam param = this.buildReportParam(queryParam);
 | 
	
		
			
				|  |  | +        final Object hyperLinkClickLineName = this.getView().getFormShowParameter().getCustomParams().get("hyperLinkClickLineName");
 | 
	
		
			
				|  |  | +        if (hyperLinkClickLineName != null) {
 | 
	
		
			
				|  |  | +            this.getView().setVisible(Boolean.FALSE, new String[] { "reportfilterap" });
 | 
	
		
			
				|  |  | +            param.setHyperLinkClick(true);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else {
 | 
	
		
			
				|  |  | +            param.setHyperLinkClick(false);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        queryParam.getCustomParam().put(AcctageParam.class.getName(), param);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private AcctageParam buildReportParam(final ReportQueryParam queryParam) {
 | 
	
		
			
				|  |  | +        final AcctageParam param = new AcctageParam();
 | 
	
		
			
				|  |  | +        final FilterInfo filterInfo = queryParam.getFilter();
 | 
	
		
			
				|  |  | +        final String entity = (String)filterInfo.getFilterItem("sourceentity").getValue();
 | 
	
		
			
				|  |  | +        param.setEntities(this.buildSourceEntityKeys(entity));
 | 
	
		
			
				|  |  | +        final String compareDateFieldKey = filterInfo.getString("standard");
 | 
	
		
			
				|  |  | +        final String compareDateAlias = kd.fi.arapcommon.util.StringUtils.removePrefix(compareDateFieldKey);
 | 
	
		
			
				|  |  | +        param.setCompareDateField(compareDateFieldKey, compareDateAlias);
 | 
	
		
			
				|  |  | +        param.setBillTypes((List<DynamicObject>)filterInfo.getDynamicObjectCollection("billtypes"));
 | 
	
		
			
				|  |  | +        param.setPaymentType(this.isAr() ? "cas_receivingbilltype" : "cas_paymentbilltype");
 | 
	
		
			
				|  |  | +        param.setPaymentTypePks(DynamicObjectHelper.getIdList((Collection<DynamicObject>)filterInfo.getDynamicObjectCollection("paymentbilltypes")));
 | 
	
		
			
				|  |  | +        param.setOrgIds(DynamicObjectHelper.getIdList((Collection<DynamicObject>)filterInfo.getDynamicObjectCollection("orgs")));
 | 
	
		
			
				|  |  | +        param.setCurrencyIds(DynamicObjectHelper.getIdList((Collection<DynamicObject>)filterInfo.getDynamicObjectCollection("q_currency")));
 | 
	
		
			
				|  |  | +        final String asstactType = filterInfo.getString("q_asstacttype");
 | 
	
		
			
				|  |  | +        if (!ObjectUtils.isEmpty((Object)asstactType)) {
 | 
	
		
			
				|  |  | +            param.setAsstactType(asstactType);
 | 
	
		
			
				|  |  | +            final DynamicObjectCollection acctacts = filterInfo.getDynamicObjectCollection(param.getAsstactType());
 | 
	
		
			
				|  |  | +            param.setAsstactPks(ReportHelper.getBasedataIds((List<DynamicObject>)acctacts));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        Date queryDate = filterInfo.getDate("date");
 | 
	
		
			
				|  |  | +        if (queryDate != null) {
 | 
	
		
			
				|  |  | +            queryDate = DateUtils.getDataFormat(queryDate, false);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        param.setQueryDate(queryDate);
 | 
	
		
			
				|  |  | +        param.setRecoverHistoryData(true);
 | 
	
		
			
				|  |  | +        param.setGroups(this.getGroups());
 | 
	
		
			
				|  |  | +        param.setHyperLinkClick(filterInfo.getBoolean("isHyperLinkClickByGroup"));
 | 
	
		
			
				|  |  | +        param.setShowLocalAmt(filterInfo.getBoolean("showlocalamt"));
 | 
	
		
			
				|  |  | +        param.setShowByBill(filterInfo.getBoolean("showbybill"));
 | 
	
		
			
				|  |  | +        param.setContainsUnaudit(filterInfo.getBoolean("containsunaudit"));
 | 
	
		
			
				|  |  | +        param.setOnlyContainsAmount(filterInfo.getBoolean("onlycontainsamount"));
 | 
	
		
			
				|  |  | +        final Object entryName = queryParam.getCustomParam().get("entryName");
 | 
	
		
			
				|  |  | +        if (!ObjectUtils.isEmpty(entryName)) {
 | 
	
		
			
				|  |  | +            param.setEntryName(entryName.toString());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return param;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private List<AcctageGroup> getGroups() {
 | 
	
		
			
				|  |  | +        final String groupStr = this.getPageCache().get("groups");
 | 
	
		
			
				|  |  | +        List<AcctageGroup> groups;
 | 
	
		
			
				|  |  | +        if (ObjectUtils.isEmpty((Object)groupStr)) {
 | 
	
		
			
				|  |  | +            groups = AcctageHelper.getGroupsWithAgingGroup(this.isAr() ? "ar_acctagesetting" : "ap_acctagesetting");
 | 
	
		
			
				|  |  | +            if (groups.isEmpty()) {
 | 
	
		
			
				|  |  | +                groups = this.getDefaultAgingGroup();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else {
 | 
	
		
			
				|  |  | +            groups = (List<AcctageGroup>)SerializationUtils.fromJsonStringToList(groupStr, (Class)AcctageGroup.class);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        groups.add(0, new AcctageGroup(ResManager.loadKDString("\u672a\u5230\u671f", "AcctageForm_15", "fi-arapcommon", new Object[0]), null, -1));
 | 
	
		
			
				|  |  | +        final Object hyperLinkClickLineName = this.getView().getFormShowParameter().getCustomParam("hyperLinkClickLineName");
 | 
	
		
			
				|  |  | +        final List<AcctageGroup> hyperLinkClickGroups = new LinkedList<AcctageGroup>();
 | 
	
		
			
				|  |  | +        if (hyperLinkClickLineName != null) {
 | 
	
		
			
				|  |  | +            for (int i = 0; i < groups.size(); ++i) {
 | 
	
		
			
				|  |  | +                if (AcctageHelper.getAmountFieldName(groups.get(i), "balance").equals(String.valueOf(hyperLinkClickLineName))) {
 | 
	
		
			
				|  |  | +                    hyperLinkClickGroups.add(groups.get(i));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (hyperLinkClickGroups != null && hyperLinkClickGroups.size() > 0) {
 | 
	
		
			
				|  |  | +            return hyperLinkClickGroups;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return groups;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private List<AcctageGroup> getDefaultAgingGroup() {
 | 
	
		
			
				|  |  | +        final List<AcctageGroup> groups = new ArrayList<AcctageGroup>(8);
 | 
	
		
			
				|  |  | +        final DynamicObjectCollection orgs = (DynamicObjectCollection)this.getModel().getValue("orgs");
 | 
	
		
			
				|  |  | +        final List<Long> ids = new ArrayList<Long>(8);
 | 
	
		
			
				|  |  | +        final List<Long> groupIds = new ArrayList<Long>(8);
 | 
	
		
			
				|  |  | +        for (final DynamicObject org : orgs) {
 | 
	
		
			
				|  |  | +            final long orgId = ((DynamicObject)org.get("fbasedataid")).getLong("id");
 | 
	
		
			
				|  |  | +            ids.add(orgId);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (ids.size() <= 0) {
 | 
	
		
			
				|  |  | +            return groups;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        final String entityName = this.isAr() ? "ar_accrualaging" : "ap_accrualaging";
 | 
	
		
			
				|  |  | +        final QFilter filter = new QFilter("enable", "=", (Object)Boolean.TRUE);
 | 
	
		
			
				|  |  | +        filter.and(new QFilter("isdefault", "=", (Object)Boolean.TRUE));
 | 
	
		
			
				|  |  | +        if (this.isAr()) {
 | 
	
		
			
				|  |  | +            filter.and(new QFilter("grouptype", "ftlike", (Object)"1"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        final DynamicObjectCollection standardGroups = BaseDataServiceHelper.queryBaseData(entityName, Long.valueOf(ids.get(0)), filter, "id");
 | 
	
		
			
				|  |  | +        for (final DynamicObject standardGroup : standardGroups) {
 | 
	
		
			
				|  |  | +            groupIds.add(standardGroup.getLong("id"));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (ids.size() > 1) {
 | 
	
		
			
				|  |  | +            for (int i = 1; i < ids.size(); ++i) {
 | 
	
		
			
				|  |  | +                final DynamicObjectCollection validateGroups = BaseDataServiceHelper.queryBaseData(entityName, Long.valueOf(ids.get(i)), filter, "id");
 | 
	
		
			
				|  |  | +                if (validateGroups.size() != groupIds.size()) {
 | 
	
		
			
				|  |  | +                    this.getView().showTipNotification(ResManager.loadKDString("\u6240\u9009\u7ec4\u7ec7\u7684\u8d26\u9f84\u5206\u7ec4\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002", "AcctageForm_17", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +                    return groups;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                for (final DynamicObject group : validateGroups) {
 | 
	
		
			
				|  |  | +                    if (!groupIds.contains(group.getLong("id"))) {
 | 
	
		
			
				|  |  | +                        this.getView().showTipNotification(ResManager.loadKDString("\u6240\u9009\u7ec4\u7ec7\u7684\u8d26\u9f84\u5206\u7ec4\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002", "AcctageForm_17", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +                        return groups;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (groupIds.size() < 1) {
 | 
	
		
			
				|  |  | +            this.getView().showTipNotification(ResManager.loadKDString("\u7ec4\u7ec7\u6ca1\u6709\u9ed8\u8ba4\u7684\u8d26\u9f84\u5206\u7ec4\uff0c\u8bf7\u5148\u7ef4\u62a4\u8d26\u9f84\u5206\u7ec4\u3002", "AcctageForm_18", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +            return groups;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        final DynamicObject agingGroup = BusinessDataServiceHelper.loadSingle((Object)groupIds.get(0), this.isAr() ? "ar_accrualaging" : "ap_accrualaging");
 | 
	
		
			
				|  |  | +        final DynamicObjectCollection entries = agingGroup.getDynamicObjectCollection("entry");
 | 
	
		
			
				|  |  | +        for (final DynamicObject entry : entries) {
 | 
	
		
			
				|  |  | +            final AcctageGroup group2 = new AcctageGroup(entry.getString("e_section"), entry.getInt("e_startday"), entry.getBoolean("e_isdaymore") ? null : Integer.valueOf(entry.getInt("e_endday")));
 | 
	
		
			
				|  |  | +            groups.add(group2);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return groups;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void hyperLinkClick(final HyperLinkClickEvent evt) {
 | 
	
		
			
				|  |  | +        final String fieldName = evt.getFieldName();
 | 
	
		
			
				|  |  | +        if ("billno".equals(fieldName)) {
 | 
	
		
			
				|  |  | +            final ReportList list = (ReportList)this.getControl("reportlistap");
 | 
	
		
			
				|  |  | +            final DynamicObject rowData = list.getReportModel().getRowData(evt.getRowIndex());
 | 
	
		
			
				|  |  | +            final BillShowParameter parameter = new BillShowParameter();
 | 
	
		
			
				|  |  | +            parameter.setFormId(rowData.getString("entitykey"));
 | 
	
		
			
				|  |  | +            parameter.setPkId((Object)rowData.getLong("id"));
 | 
	
		
			
				|  |  | +            parameter.setStatus(OperationStatus.VIEW);
 | 
	
		
			
				|  |  | +            parameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
 | 
	
		
			
				|  |  | +            parameter.setHasRight(true);
 | 
	
		
			
				|  |  | +            this.getView().showForm((FormShowParameter)parameter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else {
 | 
	
		
			
				|  |  | +            final ReportShowParameter parameter2 = new ReportShowParameter();
 | 
	
		
			
				|  |  | +            final FormShowParameter reportParameter = this.getView().getFormShowParameter();
 | 
	
		
			
				|  |  | +            parameter2.setFormId(reportParameter.getFormId());
 | 
	
		
			
				|  |  | +            parameter2.getOpenStyle().setTargetKey(reportParameter.getOpenStyle().getTargetKey());
 | 
	
		
			
				|  |  | +            parameter2.getOpenStyle().setShowType(reportParameter.getFormConfig().getShowType());
 | 
	
		
			
				|  |  | +            final ReportList reportList = (ReportList)evt.getSource();
 | 
	
		
			
				|  |  | +            final IReportListModel reportModel = reportList.getReportModel();
 | 
	
		
			
				|  |  | +            final DynamicObject rowData2 = reportModel.getRowData(evt.getRowIndex());
 | 
	
		
			
				|  |  | +            final Map<String, Object> customParams = this.getCustomParams(rowData2);
 | 
	
		
			
				|  |  | +            customParams.put("hyperLinkClickLineName", fieldName);
 | 
	
		
			
				|  |  | +            parameter2.setCustomParams((Map)customParams);
 | 
	
		
			
				|  |  | +            this.getView().showForm((FormShowParameter)parameter2);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private Map<String, Object> getCustomParams(final DynamicObject rowData) {
 | 
	
		
			
				|  |  | +        final Map<String, Object> customParams = new HashMap<String, Object>(2);
 | 
	
		
			
				|  |  | +        final Map<String, Object> dimensionData = new HashMap<String, Object>(4);
 | 
	
		
			
				|  |  | +        customParams.put("isopenbyhyperlink", Boolean.TRUE);
 | 
	
		
			
				|  |  | +        dimensionData.put("org", rowData.get("org"));
 | 
	
		
			
				|  |  | +        dimensionData.put("orgs", rowData.get("org"));
 | 
	
		
			
				|  |  | +        dimensionData.put("asstacttype", rowData.get("asstacttype"));
 | 
	
		
			
				|  |  | +        dimensionData.put("asstact", rowData.get("asstact"));
 | 
	
		
			
				|  |  | +        dimensionData.put("currency", rowData.get("currency"));
 | 
	
		
			
				|  |  | +        final List<String> sysDimensions = new ArrayList<String>(Arrays.asList("org", "asstacttype", "asstact", "currency"));
 | 
	
		
			
				|  |  | +        final String showKeyCols = (String)this.getModel().getValue("showkeycols");
 | 
	
		
			
				|  |  | +        final List<String> showKeyColList = Stream.of(showKeyCols.split(",")).filter(EmptyUtils::isNotEmpty).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        for (String s : showKeyColList) {
 | 
	
		
			
				|  |  | +            if (sysDimensions.contains(s)) {
 | 
	
		
			
				|  |  | +                continue;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            Object value = rowData.get(s);
 | 
	
		
			
				|  |  | +            if (value instanceof DynamicObject) {
 | 
	
		
			
				|  |  | +                s += ".number";
 | 
	
		
			
				|  |  | +                value = ((DynamicObject)value).getString("number");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            dimensionData.put(s, value);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        customParams.put("rowData", dimensionData);
 | 
	
		
			
				|  |  | +        return customParams;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void beforeBindData(final EventObject e) {
 | 
	
		
			
				|  |  | +        super.beforeBindData(e);
 | 
	
		
			
				|  |  | +        final FormShowParameter formShowParameter = this.getView().getFormShowParameter();
 | 
	
		
			
				|  |  | +        if (formShowParameter == null) {
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        final Map<String, Object> customParams = (Map<String, Object>)formShowParameter.getCustomParams();
 | 
	
		
			
				|  |  | +        if (customParams == null) {
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        final Boolean isOpenByHyperlink = (Boolean) customParams.get("isopenbyhyperlink");
 | 
	
		
			
				|  |  | +        if (isOpenByHyperlink != null && isOpenByHyperlink) {
 | 
	
		
			
				|  |  | +            this.setQueryConditionDeassign(customParams);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private void setQueryConditionDeassign(final Map<String, Object> customParams) {
 | 
	
		
			
				|  |  | +        final IDataModel parentModel = this.getView().getParentView().getModel();
 | 
	
		
			
				|  |  | +        final List<String> filterFieldKeys = this.getFilterFieldKeys();
 | 
	
		
			
				|  |  | +        final IDataModel m = this.getModel();
 | 
	
		
			
				|  |  | +        final DataEntityPropertyCollection properties = m.getDataEntityType().getProperties();
 | 
	
		
			
				|  |  | +        final Map<String, Object> rowData = (Map<String, Object>) customParams.get("rowData");
 | 
	
		
			
				|  |  | +        for (final String originalFieldKey : filterFieldKeys) {
 | 
	
		
			
				|  |  | +            Object value = null;
 | 
	
		
			
				|  |  | +            String propKey = originalFieldKey;
 | 
	
		
			
				|  |  | +            if (originalFieldKey.startsWith("q_")) {
 | 
	
		
			
				|  |  | +                propKey = originalFieldKey.substring(2);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if ("bd_customer".equals(originalFieldKey) || "bd_supplier".equals(originalFieldKey) || "bos_user".equals(originalFieldKey)) {
 | 
	
		
			
				|  |  | +                propKey = "asstact";
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (rowData.get(propKey) != null) {
 | 
	
		
			
				|  |  | +                value = rowData.get(propKey);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (ObjectUtils.isEmpty(value)) {
 | 
	
		
			
				|  |  | +                value = parentModel.getValue(originalFieldKey);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            final IDataEntityProperty prop = (IDataEntityProperty)properties.get((String) originalFieldKey);
 | 
	
		
			
				|  |  | +            if (prop instanceof MulBasedataProp) {
 | 
	
		
			
				|  |  | +                value = this.getMutlBasedataPks(value);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if (prop instanceof ItemClassProp && value instanceof Map) {
 | 
	
		
			
				|  |  | +                value = ((Map)value).get("id");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            m.setValue(originalFieldKey, value);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        final List<String> sysDimensions = new ArrayList<String>(Arrays.asList("org", "asstacttype", "asstact", "currency"));
 | 
	
		
			
				|  |  | +        final List<SimpleFilterRow> rows = new LinkedList<SimpleFilterRow>();
 | 
	
		
			
				|  |  | +        final String showKeyCols = (String)this.getModel().getValue("showkeycols");
 | 
	
		
			
				|  |  | +        final List<String> showKeyColList = Stream.of(showKeyCols.split(",")).filter(EmptyUtils::isNotEmpty).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        for (final String s : showKeyColList) {
 | 
	
		
			
				|  |  | +            if (!sysDimensions.contains(s)) {
 | 
	
		
			
				|  |  | +                final List<FilterValue> filterValues = new LinkedList<FilterValue>();
 | 
	
		
			
				|  |  | +                final FilterValue filterValue = new FilterValue();
 | 
	
		
			
				|  |  | +                String key = s;
 | 
	
		
			
				|  |  | +                Object value2 = rowData.get(key);
 | 
	
		
			
				|  |  | +                if (value2 == null) {
 | 
	
		
			
				|  |  | +                    key = s + ".number";
 | 
	
		
			
				|  |  | +                    value2 = rowData.get(key);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (value2 == null) {
 | 
	
		
			
				|  |  | +                    continue;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                filterValue.setValue(value2);
 | 
	
		
			
				|  |  | +                filterValues.add(filterValue);
 | 
	
		
			
				|  |  | +                final SimpleFilterRow row = new SimpleFilterRow("", "17", key, "", "0", (List)filterValues);
 | 
	
		
			
				|  |  | +                row.setValue((List)filterValues);
 | 
	
		
			
				|  |  | +                rows.add(row);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!ObjectUtils.isEmpty((Object)rows)) {
 | 
	
		
			
				|  |  | +            final FilterCondition filterCondition = new FilterCondition();
 | 
	
		
			
				|  |  | +            filterCondition.setFilterRow((List)rows);
 | 
	
		
			
				|  |  | +            final FilterGrid filterGrid = (FilterGrid)this.getView().getControl("commonfs");
 | 
	
		
			
				|  |  | +            filterGrid.SetValue(filterCondition);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        m.setValue("showbybill", (Object)Boolean.TRUE);
 | 
	
		
			
				|  |  | +        this.getView().setVisible(Boolean.FALSE, new String[] { "groupset_btn" });
 | 
	
		
			
				|  |  | +        final ReportFilter control = (ReportFilter)this.getControl("reportfilterap");
 | 
	
		
			
				|  |  | +        control.search();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private Object getMutlBasedataPks(Object value) {
 | 
	
		
			
				|  |  | +        if (value instanceof DynamicObjectCollection) {
 | 
	
		
			
				|  |  | +            final DynamicObjectCollection temCollectionValue = (DynamicObjectCollection)value;
 | 
	
		
			
				|  |  | +            final List<Object> pks = new ArrayList<Object>(((DynamicObjectCollection)value).size());
 | 
	
		
			
				|  |  | +            for (final DynamicObject eachValue : temCollectionValue) {
 | 
	
		
			
				|  |  | +                pks.add(eachValue.getDynamicObject("fbasedataid").getPkValue());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            value = pks.toArray(new Object[0]);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (value instanceof DynamicObject) {
 | 
	
		
			
				|  |  | +            value = new Object[] { ((DynamicObject)value).getPkValue() };
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (value instanceof Map) {
 | 
	
		
			
				|  |  | +            final Object id = ((Map)value).get("id");
 | 
	
		
			
				|  |  | +            value = new Object[] { Long.valueOf(id.toString()) };
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return value;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private List<String> getFilterFieldKeys() {
 | 
	
		
			
				|  |  | +        final Container fixFilterContainer = (Container)this.getView().getControl("fsap");
 | 
	
		
			
				|  |  | +        final Container commFilterContainer = (Container)this.getView().getControl("commonfs");
 | 
	
		
			
				|  |  | +        final Container showFilterContainer = (Container)this.getView().getControl("flexpanelap1");
 | 
	
		
			
				|  |  | +        final Container moreFilterContainer = (Container)this.getView().getControl("reportmorefilterpanelap");
 | 
	
		
			
				|  |  | +        final List<Control> filterItems = new ArrayList<Control>(8);
 | 
	
		
			
				|  |  | +        filterItems.addAll(fixFilterContainer.getItems());
 | 
	
		
			
				|  |  | +        filterItems.addAll(commFilterContainer.getItems());
 | 
	
		
			
				|  |  | +        filterItems.addAll(showFilterContainer.getItems());
 | 
	
		
			
				|  |  | +        filterItems.addAll(moreFilterContainer.getItems());
 | 
	
		
			
				|  |  | +        final List<String> filterFieldKeys = (List)filterItems.stream().map(Control::getKey).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +        return filterFieldKeys;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void afterDoOperation(final AfterDoOperationEventArgs args) {
 | 
	
		
			
				|  |  | +        super.afterDoOperation(args);
 | 
	
		
			
				|  |  | +        final String key = args.getOperateKey();
 | 
	
		
			
				|  |  | +        if ("groupset".equals(key)) {
 | 
	
		
			
				|  |  | +            final ListShowParameter lsp = ShowFormHelper.createShowListForm(this.isAr() ? "ar_accrualaging" : "ap_accrualaging", false, 2);
 | 
	
		
			
				|  |  | +            final ListFilterParameter lfp = new ListFilterParameter();
 | 
	
		
			
				|  |  | +            final DynamicObjectCollection orgs = (DynamicObjectCollection)this.getModel().getValue("orgs");
 | 
	
		
			
				|  |  | +            final List<Long> ids = new ArrayList<Long>(8);
 | 
	
		
			
				|  |  | +            final List<Long> groupIds = new ArrayList<Long>(8);
 | 
	
		
			
				|  |  | +            for (final DynamicObject org : orgs) {
 | 
	
		
			
				|  |  | +                final long orgId = ((DynamicObject)org.get("fbasedataid")).getLong("id");
 | 
	
		
			
				|  |  | +                ids.add(orgId);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (ids.size() <= 0) {
 | 
	
		
			
				|  |  | +                this.getView().showTipNotification(ResManager.loadKDString("\u7ed3\u7b97\u7ec4\u7ec7\u4e3a\u7a7a\uff0c\u8bf7\u5148\u9009\u62e9\u7ed3\u7b97\u7ec4\u7ec7\u3002", "AcctageForm_19", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            final String entityName = this.isAr() ? "ar_accrualaging" : "ap_accrualaging";
 | 
	
		
			
				|  |  | +            final QFilter filter = new QFilter("enable", "=", (Object)Boolean.TRUE);
 | 
	
		
			
				|  |  | +            if (this.isAr()) {
 | 
	
		
			
				|  |  | +                filter.and(new QFilter("grouptype", "ftlike", (Object)"1"));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            final DynamicObjectCollection standardGroups = BaseDataServiceHelper.queryBaseData(entityName, Long.valueOf(ids.get(0)), filter, "id");
 | 
	
		
			
				|  |  | +            for (final DynamicObject standardGroup : standardGroups) {
 | 
	
		
			
				|  |  | +                groupIds.add(standardGroup.getLong("id"));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (ids.size() > 1) {
 | 
	
		
			
				|  |  | +                for (int i = 1; i < ids.size(); ++i) {
 | 
	
		
			
				|  |  | +                    final DynamicObjectCollection groups = BaseDataServiceHelper.queryBaseData(entityName, Long.valueOf(ids.get(i)), filter, "id");
 | 
	
		
			
				|  |  | +                    if (groups.size() != groupIds.size()) {
 | 
	
		
			
				|  |  | +                        this.getView().showTipNotification(ResManager.loadKDString("\u6240\u9009\u7ec4\u7ec7\u7684\u8d26\u9f84\u5206\u7ec4\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002", "AcctageForm_17", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +                        return;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    for (final DynamicObject group : groups) {
 | 
	
		
			
				|  |  | +                        if (!groupIds.contains(group.getLong("id"))) {
 | 
	
		
			
				|  |  | +                            this.getView().showTipNotification(ResManager.loadKDString("\u6240\u9009\u7ec4\u7ec7\u7684\u8d26\u9f84\u5206\u7ec4\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002", "AcctageForm_17", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +                            return;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (groupIds.size() < 1) {
 | 
	
		
			
				|  |  | +                this.getView().showTipNotification(ResManager.loadKDString("\u7ec4\u7ec7\u65e0\u53ef\u7528\u8d26\u9f84\u5206\u7ec4\uff0c\u8bf7\u5148\u7ef4\u62a4\u8d26\u9f84\u5206\u7ec4\u3002", "AcctageForm_16", "fi-arapcommon", new Object[0]));
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            final QFilter filter2 = new QFilter("id", "in", (Object)groupIds);
 | 
	
		
			
				|  |  | +            lfp.setFilter(filter2);
 | 
	
		
			
				|  |  | +            lsp.setListFilterParameter(lfp);
 | 
	
		
			
				|  |  | +            final CloseCallBack closeCallBack = new CloseCallBack(this.getPluginName(), "aginggroup");
 | 
	
		
			
				|  |  | +            lsp.setCloseCallBack(closeCallBack);
 | 
	
		
			
				|  |  | +            this.getView().showForm((FormShowParameter)lsp);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public void closedCallBack(final ClosedCallBackEvent closedCallBackEvent) {
 | 
	
		
			
				|  |  | +        super.closedCallBack(closedCallBackEvent);
 | 
	
		
			
				|  |  | +        final String actionId = closedCallBackEvent.getActionId();
 | 
	
		
			
				|  |  | +        if ("aginggroup".equals(actionId)) {
 | 
	
		
			
				|  |  | +            final ListSelectedRowCollection rows = (ListSelectedRowCollection)closedCallBackEvent.getReturnData();
 | 
	
		
			
				|  |  | +            final boolean isAr = this.isAr();
 | 
	
		
			
				|  |  | +            if (rows != null && rows.size() > 0) {
 | 
	
		
			
				|  |  | +                final Long groupId = (Long)rows.get(0).getPrimaryKeyValue();
 | 
	
		
			
				|  |  | +                final DynamicObject agingGroup = BusinessDataServiceHelper.loadSingle((Object)groupId, isAr ? "ar_accrualaging" : "ap_accrualaging");
 | 
	
		
			
				|  |  | +                final List<AcctageGroup> groups = new ArrayList<AcctageGroup>(64);
 | 
	
		
			
				|  |  | +                final DynamicObjectCollection entries = agingGroup.getDynamicObjectCollection("entry");
 | 
	
		
			
				|  |  | +                for (final DynamicObject entry : entries) {
 | 
	
		
			
				|  |  | +                    final AcctageGroup group = new AcctageGroup(entry.getString("e_section"), entry.getInt("e_startday"), entry.getBoolean("e_isdaymore") ? null : Integer.valueOf(entry.getInt("e_endday")));
 | 
	
		
			
				|  |  | +                    groups.add(group);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                if (groups.size() > 0) {
 | 
	
		
			
				|  |  | +                    AcctageHelper.saveGroupSetting(groups, isAr, isAr ? "ar_acctagesetting" : "ap_acctagesetting");
 | 
	
		
			
				|  |  | +                    this.getPageCache().put("groups", SerializationUtils.toJsonString((Object)groups));
 | 
	
		
			
				|  |  | +                    this.getView().invokeOperation("refresh");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |