//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package nckd.jimin.jyyy.hr.wtc.wtss.formplugin.web.pc;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import kd.bos.bill.BillShowParameter;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.dataentity.serialization.SerializationUtils;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.EntryType;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.exception.KDBizException;
import kd.bos.ext.form.control.CustomControl;
import kd.bos.extplugin.PluginFilter;
import kd.bos.form.CloseCallBack;
import kd.bos.form.FormShowParameter;
import kd.bos.form.IFormView;
import kd.bos.form.MobileFormShowParameter;
import kd.bos.form.OpenStyle;
import kd.bos.form.ShowType;
import kd.bos.form.StyleCss;
import kd.bos.form.cardentry.CardEntry;
import kd.bos.form.container.Container;
import kd.bos.form.container.Tab;
import kd.bos.form.control.Control;
import kd.bos.form.control.Label;
import kd.bos.form.control.events.RowClickEvent;
import kd.bos.form.control.events.RowClickEventListener;
import kd.bos.form.control.events.TabSelectEvent;
import kd.bos.form.control.events.TabSelectListener;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.events.ClosedCallBackEvent;
import kd.bos.form.events.CustomEventArgs;
import kd.bos.form.events.HyperLinkClickEvent;
import kd.bos.form.events.HyperLinkClickListener;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.list.ListFilterParameter;
import kd.bos.list.ListShowParameter;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QFilter;
import kd.hr.hbp.common.util.HRDateTimeUtils;
import kd.hr.hbp.common.util.HRMapUtils;
import kd.sdk.wtc.wtbs.business.custom.WTCCustomControlExtPlugin;
import kd.sdk.wtc.wtbs.common.enums.WTCApplyType;
import kd.sdk.wtc.wtbs.common.enums.WTCBillType;
import kd.sdk.wtc.wtss.business.homepage.BeforeShowApplyPageEvent;
import kd.sdk.wtc.wtss.business.homepage.BillReplaceExtPlugin;
import kd.wtc.wtbs.business.bill.BillCommonService;
import kd.wtc.wtbs.business.extplugin.WTCPluginProxy;
import kd.wtc.wtbs.business.extplugin.WTCPluginProxyFactory;
import kd.wtc.wtbs.business.mobile.MobileCommonServiceHelper;
import kd.wtc.wtbs.business.web.attperiod.PerAttPeriodQueryServiceImpl;
import kd.wtc.wtbs.common.model.mobile.AbnormalDealModel;
import kd.wtc.wtbs.common.model.period.PerAttPeriod;
import kd.wtc.wtbs.common.model.period.PerAttPeriodQueryParam;
import kd.wtc.wtbs.common.util.Tuple;
import kd.wtc.wtbs.common.util.WTCCollectionIndexUtil;
import kd.wtc.wtbs.common.util.WTCCollections;
import kd.wtc.wtbs.common.util.WTCDateUtils;
import kd.wtc.wtbs.common.util.WTCInteDateUtil;
import kd.wtc.wtbs.common.util.WTCMaps;
import kd.wtc.wtbs.common.util.WTCSerializationUtils;
import kd.wtc.wtbs.common.util.WTCStringUtils;
import kd.wtc.wtbs.common.util.third.collect.Lists;
import kd.wtc.wtbs.common.util.third.util.CollectionUtils;
import kd.wtc.wtbs.common.util.third.util.NumberUtils;
import kd.wtc.wtbs.formplugin.util.WTCFormUtils;
import kd.wtc.wtp.business.attconfirm.impl.AttConfirmQueryServiceImpl;
import kd.wtc.wtp.common.enums.attconfirm.AttConRecordStatusEnum;
import kd.wtc.wtp.common.enums.attconfirm.AttConfirmDataStatusEnum;
import kd.wtc.wtp.common.model.attconfirm.AttConfirmRecordModel;
import kd.wtc.wtp.common.model.attconfirm.AttConfirmRecordQueryParam;
import kd.wtc.wtss.business.attstatistics.AttConfirmServiceHelper;
import kd.wtc.wtss.business.servicehelper.common.HomePageServiceHelper;
import kd.wtc.wtss.business.servicehelper.common.QuotaStatisticIndexService;
import kd.wtc.wtss.business.servicehelper.common.SchemaServiceHelper;
import kd.wtc.wtss.business.servicehelper.mobile.MobileHomePageBusiness;
import kd.wtc.wtss.business.servicehelper.mobile.MobileHomePageServiceHelper;
import kd.wtc.wtss.business.servicehelper.pc.PersonHomePCBusiness;
import kd.wtc.wtss.business.servicehelper.pc.PersonHomePCCountBusiness;
import kd.wtc.wtss.business.servicehelper.pc.StaffPCAppConfigService;
import kd.wtc.wtss.business.servicehelper.summaryconf.SummaryConfigDetailService;
import kd.wtc.wtss.common.constants.PersonHomePCConstants;
import kd.wtc.wtss.common.constants.StaffPCAppConfigConstants;
import kd.wtc.wtss.common.dto.DailySource;
import kd.wtc.wtss.common.dto.MobileHomeConf;
import kd.wtc.wtss.common.dto.mobilehome.AttRecordModel;
import kd.wtc.wtss.common.dto.mobilehome.CalendarGetDataModel;
import kd.wtc.wtss.common.dto.mobilehome.CalendarInitModel;
import kd.wtc.wtss.common.dto.mobilehome.DateDataModel;
import kd.wtc.wtss.common.dto.mobilehome.DateStateModel;
import kd.wtc.wtss.common.dto.summaryconf.SummaryConfDetail;
import kd.wtc.wtss.common.enums.UnitDataEnum;
import kd.wtc.wtss.common.utils.WTSSDateUtils;

public class WtssPersonHomePCPluginEx extends AbstractFormPlugin implements RowClickEventListener, PersonHomePCConstants, TabSelectListener, BeforeF7SelectListener, HyperLinkClickListener {
    private static final Log LOG = LogFactory.getLog(WtssPersonHomePCPluginEx.class);

    public WtssPersonHomePCPluginEx() {
    }

    public void registerListener(EventObject eventObject) {
        super.registerListener(eventObject);
        this.addClickListeners(new String[]{"flexmore", "labelmore", "configap", "labelquestion1", "labelquestion2", "labelquestion3", "btn_attcon"});
        CardEntry appContainer = (CardEntry)this.getView().getControl("fastappentryentity");
        appContainer.addRowClickListener(this);
        CardEntry qtEntryEntityCountContainer = (CardEntry)this.getView().getControl("qtentryentitycount");
        qtEntryEntityCountContainer.addRowClickListener(this);
        qtEntryEntityCountContainer.addHyperClickListener(this);
        Tab tab = (Tab)this.getControl("tabap");
        tab.addTabSelectListener(this);
        Container container = (Container)this.getControl("attstavector");
        container.addClickListener(this);
        this.addBeforeF7SelectListener("attperiodentry");
        this.addBeforeF7SelectListener("attperiod");
    }

    private void addBeforeF7SelectListener(String key) {
        BasedataEdit personAddEdit = (BasedataEdit)this.getView().getControl(key);
        personAddEdit.addBeforeF7SelectListener(this);
    }

    public void beforeBindData(EventObject eventObject) {
        super.beforeBindData(eventObject);
        LOG.info("pcpersonhome beforeBindData begin...");
        this.initCalendar();
        Long userId = MobileCommonServiceHelper.getInstance().getUserId();
        Long employeeId = MobileCommonServiceHelper.getInstance().getEmployeeId();
        this.getPageCache().put("cache_id_userid", String.valueOf(userId));
        this.getPageCache().put("cache_id_employeeid", String.valueOf(employeeId));
        String queryDate = WTCDateUtils.date2Str(new Date(), "yyyy-MM-dd");
        Map<String, String> attFile = MobileHomePageServiceHelper.getAttFileWithEmployeeId(employeeId, queryDate);
        if (HRMapUtils.isEmpty(attFile)) {
            this.initControlWithoutValidValue();
            this.getView().showErrorNotification(ResManager.loadKDString("您无有效的考勤档案，请联系管理员。", "PersonHomePCPlugin_0", "wtc-wtss-formplugin", new Object[0]));
        } else {
            long schemeId = MobileHomePageBusiness.getInstance().getSchemeIdWithWorkspace(attFile, "A");
            if (schemeId == 0L) {
                this.initControlWithoutValidValue();
                this.getView().showErrorNotification(ResManager.loadKDString("您未关联假勤自助方案，请联系管理员。", "PersonHomePCPlugin_1", "wtc-wtss-formplugin", new Object[0]));
            } else {
                DynamicObject ruleByScheme = SchemaServiceHelper.getInstance().queryRuleByScheme(schemeId, "A");
                long ruleId = ruleByScheme.getLong("id");
                Long attfileBoid = Long.parseLong((String)attFile.get("boid"));
                LOG.info("pcpersonhome archives schemeId:{} attfileBoid:{}", schemeId, attfileBoid);
                this.getPageCache().put("cache_scheme_id", String.valueOf(schemeId));
                this.getPageCache().put("cache_attfile_boid", String.valueOf(attfileBoid));
                this.getPageCache().put("cache_rule_id", String.valueOf(ruleId));
                long quotaConfigId = ruleByScheme.getLong("quotaconfig.id");
                StaffPCAppConfigService.initFastApp(ruleId, this.getView());
                this.initPersonCount(userId, schemeId, quotaConfigId, attfileBoid, employeeId);
                this.initCommonProblem(schemeId);
            }
        }
    }

    public void propertyChanged(PropertyChangedArgs propertyChangedArgs) {
        super.propertyChanged(propertyChangedArgs);
        String fieldKey = propertyChangedArgs.getProperty().getName();
        Object newValue = WTCCollectionIndexUtil.getEleFromArr(propertyChangedArgs.getChangeSet(), 0).isPresent() ? ((ChangeData)WTCCollectionIndexUtil.getEleFromArr(propertyChangedArgs.getChangeSet(), 0).get()).getNewValue() : null;
        Object oldValue = WTCCollectionIndexUtil.getEleFromArr(propertyChangedArgs.getChangeSet(), 0).isPresent() ? ((ChangeData)WTCCollectionIndexUtil.getEleFromArr(propertyChangedArgs.getChangeSet(), 0).get()).getOldValue() : null;
        long userId = Long.parseLong(this.getView().getPageCache().get("cache_id_userid"));
        long employeeId = Long.parseLong(this.getView().getPageCache().get("cache_id_employeeid"));
        LOG.info("pcteamhome.beforeBindData.userid:{}", userId);
        long schemeId = Long.parseLong(this.getView().getPageCache().get("cache_scheme_id"));
        Date date;
        if (fieldKey.equals("daydate")) {
            if (this.reSetOldVal(oldValue, newValue, "daydate")) {
                return;
            }

            date = (Date)newValue;
            String nowDateStr = WTCDateUtils.date2Str(date, "yyyy-MM-dd");
            //PersonHomePCCountBusiness.getInstance().setDateDetail(userId, nowDateStr, schemeId, this.getView(), employeeId);
            CalendarGetDataModel queryDateModel = new CalendarGetDataModel();
            queryDateModel.setChooseDay(nowDateStr);
            List<String> dateRange = (List)WTCDateUtils.getDateRange(WTCDateUtils.getBeginDayOfMonth(date), WTCDateUtils.getEndDayOfMonth(date)).stream().map((datex) -> {
                return WTCDateUtils.date2Str(datex, "yyyy-MM-dd");
            }).collect(Collectors.toList());
            queryDateModel.setDateList(dateRange);
            this.initCalendarState(queryDateModel, true);
        } else if (fieldKey.equals("attperiodentry")) {
            DynamicObject dynamicObject = this.getModel().getDataEntity().getDynamicObject("attperiodentry");
            Long personAttPeriodId = dynamicObject.getLong("id");
            PerAttPeriodQueryServiceImpl instance = PerAttPeriodQueryServiceImpl.getInstance();
            PerAttPeriodQueryParam queryParam = new PerAttPeriodQueryParam();
            queryParam.setExtendQFilter(new QFilter("id", "=", personAttPeriodId));
            List<PerAttPeriod> perAttPeriod = instance.queryPerAttPeriodEntity(queryParam);
            if (!CollectionUtils.isEmpty(perAttPeriod)) {
                PerAttPeriod entry = (PerAttPeriod)perAttPeriod.get(0);
                this.getView().getPageCache().put("PerAttId", String.valueOf(personAttPeriodId));
                String personAttPeriodIdStr = entry.getId();
                this.getView().getPageCache().put("PerAttIdStr", personAttPeriodIdStr);
                long attFileBid = entry.getFileBoId();
                this.getView().getPageCache().put("cache_attfile_boid", String.valueOf(attFileBid));
                LOG.info("mobilehome initStatistic query begin...");
                Map<String, Object> summaryConfig = SummaryConfigDetailService.getInstance().queryInfo(userId, "A", personAttPeriodIdStr, schemeId, 2, attFileBid);
                LOG.info("mobilehome initStatistic query end...");
                List<SummaryConfDetail> showSummary = (List)summaryConfig.get("show");
                this.setDatePreDetail(showSummary);
            }

            AttConfirmServiceHelper.instance().updateBtnAttConfirmVisible(this.getView());
        } else if ("qtdate".equals(fieldKey)) {
            if (this.reSetOldVal(oldValue, newValue, "qtdate")) {
                return;
            }

            date = this.getView().getModel().getDataEntity().getDate("qtdate");
            if (date == null) {
                date = new Date();
                this.getView().getModel().getDataEntity().set("qtdate", date);
            }

            QuotaStatisticIndexService.getInstance().setQuotaDetail(schemeId, userId, date, this.getView(), "2", employeeId);
        }

    }

    private boolean reSetOldVal(Object oldVal, Object newVal, String key) {
        if (newVal == null) {
            this.getModel().beginInit();
            this.getModel().setValue(key, oldVal);
            this.getModel().endInit();
            return true;
        } else {
            return false;
        }
    }

    private void initPersonCount(long userId, long schemeId, long quotaConfigId, Long attfileBid, long employeeId) {
        List<PerAttPeriod> userAllPeriods = MobileHomePageServiceHelper.getUserAllPeriodsSimpleWithEmployeeId(employeeId);
        if (CollectionUtils.isEmpty(userAllPeriods)) {
            this.getView().setVisible(Boolean.FALSE, new String[]{"nckd_flexpanelap", "dateflex", "perflex", "qtflex", "attstavector"});
            this.getView().showErrorNotification(ResManager.loadKDString("您的档案未有人员考勤期间，导致首页数据无法查看，请联系管理员。", "PersonHomePCPlugin_2", "wtc-wtss-formplugin", new Object[0]));
        } else {
            this.getView().setVisible(Boolean.FALSE, new String[]{"attperiod", "flexattperoidconf", "perflex", "qtdate", "qtflex"});
            Date nowDate = WTCDateUtils.addDays(new Date(), -1);
            String nowDateStr = WTCDateUtils.date2Str(nowDate, "yyyy-MM-dd");
            this.getPageCache().put("cache_date", nowDateStr);
            this.getPageCache().put("current_statistic_mode", "mode_day");
            this.getModel().setValue("daydate", nowDate);
            List<Long> PerAttIds = new ArrayList(userAllPeriods.size());
            long nowTime = nowDate.getTime();
            String personAttPeriodId = ((PerAttPeriod)userAllPeriods.get(0)).getPrimaryId() + "";
            String attPeriodId = ((PerAttPeriod)userAllPeriods.get(0)).getAttPeriodId() + "";
            String personAttPeriodIdStr = ((PerAttPeriod)userAllPeriods.get(0)).getId();
            Iterator var19 = userAllPeriods.iterator();

            while(var19.hasNext()) {
                PerAttPeriod periodReport = (PerAttPeriod)var19.next();
                if (periodReport.getPerAttBeginDate().getTime() < nowDate.getTime()) {
                    PerAttIds.add(periodReport.getPrimaryId());
                }

                HRDateTimeUtils.format(periodReport.getPerAttBeginDate(), "yyyy-MM-dd");
                if (nowTime >= periodReport.getPerAttBeginDate().getTime() && nowTime <= periodReport.getPerAttEndDate().getTime()) {
                    personAttPeriodId = periodReport.getPrimaryId() + "";
                    attPeriodId = periodReport.getAttPeriodId() + "";
                    personAttPeriodIdStr = periodReport.getId();
                }
            }

            //this.getModel().setValue("attperiodentry", personAttPeriodId);
            //this.getModel().setValue("attperiod", attPeriodId);
            this.getPageCache().put("PerAttIds", SerializationUtils.toJsonString(PerAttIds));
            this.getPageCache().put("PerAttId", personAttPeriodId);
            this.getPageCache().put("PerAttIdStr", personAttPeriodIdStr);
            LOG.info("mobilehome initStatistic query begin...");
            Map<String, Object> summaryConfig = SummaryConfigDetailService.getInstance().queryInfo(userId, "A", personAttPeriodIdStr, schemeId, 2, attfileBid);
            LOG.info("mobilehome initStatistic query end...");
            List<SummaryConfDetail> showSummary = (List)summaryConfig.get("show");
            this.setDatePreDetail(showSummary);
            //PersonHomePCCountBusiness.getInstance().setDateDetail(userId, nowDateStr, schemeId, this.getView(), employeeId);
            AttConfirmServiceHelper.instance().updateBtnAttConfirmVisible(this.getView());
            if (quotaConfigId == 0L) {
                this.getView().setVisible(Boolean.FALSE, new String[]{"qttabpage"});
            } else {
                this.getPageCache().put("quotaconfig.id", quotaConfigId + "");
                Date date = this.getView().getModel().getDataEntity().getDate("qtdate");
                QuotaStatisticIndexService.getInstance().setQuotaDetail(schemeId, userId, date, this.getView(), "2", employeeId);
            }
        }
    }

    private void setDatePreDetail(List<SummaryConfDetail> showSummary) {
        DynamicObjectCollection dynamicObjects = this.getModel().getDataEntity(true).getDynamicObjectCollection("perentryentitycount");
        EntryType entryType;
        if (CollectionUtils.isNotEmpty(dynamicObjects) && WTCStringUtils.isEmpty(this.getPageCache().get("perentryentitycounttype"))) {
            entryType = (EntryType)((DynamicObject)dynamicObjects.get(0)).getDynamicObjectType();
            this.getPageCache().put("perentryentitycounttype", WTCSerializationUtils.serializeToBase64(entryType));
        }

        if (CollectionUtils.isEmpty(showSummary)) {
            this.getModel().deleteEntryData("perentryentitycount");
        } else {
            entryType = this.getPerEntryEntityType(dynamicObjects);
            this.getModel().deleteEntryData("perentryentitycount");
            if (entryType != null) {
                Iterator var5 = showSummary.iterator();

                while(var5.hasNext()) {
                    SummaryConfDetail summaryConfDetail = (SummaryConfDetail)var5.next();
                    DynamicObject dynamicObject = new DynamicObject(entryType);
                    dynamicObject.set("datasouvaluepre", summaryConfDetail.getAttItemValue());
                    //dynamicObject.set("datasounamepre", summaryConfDetail.getName() + "(" + UnitDataEnum.getRetDesc(summaryConfDetail.getUnit()) + ")");
                    dynamicObjects.add(dynamicObject);
                }

                this.getView().updateView("perentryentitycount");
            }
        }
    }

    public void click(EventObject evt) {
        super.click(evt);
        Control control = (Control)evt.getSource();
        Long ruleId = Long.parseLong(this.getView().getPageCache().get("cache_rule_id"));
        String key = control.getKey();
        Tab tab = (Tab)this.getControl("tabap");
        String staType = tab.getCurrentTab();
        switch (key) {
            case "flexmore":
            case "labelmore":
                ListShowParameter showParameter = new ListShowParameter();
                showParameter.getOpenStyle().setShowType(ShowType.Modal);
                showParameter.setFormId("wtss_problemlist");
                this.getView().showForm(showParameter);
                break;
            case "configap":
                FormShowParameter formShowParameter = new FormShowParameter();
                formShowParameter.setFormId("wtss_appconfig");
                OpenStyle openStyle = formShowParameter.getOpenStyle();
                Optional.ofNullable(openStyle).ifPresent((style) -> {
                    style.setShowType(ShowType.Modal);
                });
                formShowParameter.setCustomParam("ruleId", ruleId);
                formShowParameter.setCloseCallBack(new CloseCallBack(this, "appConfig"));
                this.getView().showForm(formShowParameter);
                break;
            case "labelquestion1":
                PersonHomePCBusiness.getInstance().goToProblemDetail(this.getView(), 1);
                break;
            case "labelquestion2":
                PersonHomePCBusiness.getInstance().goToProblemDetail(this.getView(), 2);
                break;
            case "labelquestion3":
                PersonHomePCBusiness.getInstance().goToProblemDetail(this.getView(), 3);
                break;
            case "attstavector":
                if ("daytabpage".equals(staType)) {
                    this.showConfigPage(this.getView(), "A");
                } else if ("pertabpage".equals(staType)) {
                    this.showConfigPage(this.getView(), "B");
                } else if ("qttabpage".equals(staType)) {
                    this.showConfigPage(this.getView(), "C");
                }
        }

    }

    public void afterDoOperation(AfterDoOperationEventArgs evt) {
        super.afterDoOperation(evt);
        String opKey = evt.getOperateKey();
        if ("attconf".equals(opKey) && evt.getOperationResult().isSuccess()) {
            this.showAttConfirmPage();
        }

    }

    private void showConfigPage(IFormView view, String configType) {
        FormShowParameter showParameter = new FormShowParameter();
        showParameter.getOpenStyle().setShowType(ShowType.Modal);
        showParameter.setFormId("wtss_countcig");
        Long ruleId = Long.parseLong(this.getView().getPageCache().get("cache_rule_id"));
        long schemeId = Long.parseLong(this.getPageCache().get("cache_scheme_id"));
        String nowDateStr = this.getView().getPageCache().get("cache_date");
        String personAttPeriodIdStr = this.getPageCache().get("PerAttIdStr");
        Map<String, Object> configParams = new HashMap(3);
        configParams.put("cache_rule_id", ruleId);
        configParams.put("cache_schemeId_id", schemeId);
        configParams.put("perioddate", nowDateStr);
        configParams.put("configtype", configType);
        configParams.put("cache_attfile_boid", Long.parseLong(view.getPageCache().get("cache_attfile_boid")));
        configParams.put("PerAttIdStr", personAttPeriodIdStr);
        configParams.put("quotaconfig.id", this.getPageCache().get("quotaconfig.id"));
        CloseCallBack callBack = new CloseCallBack(this, "saveconfig");
        showParameter.setCloseCallBack(callBack);
        showParameter.setCustomParams(configParams);
        showParameter.setCaption(ResManager.loadKDString("考勤统计", "AttStaVectorName", "wtc-wtss-formplugin", new Object[0]));
        view.showForm(showParameter);
    }

    public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
        super.closedCallBack(closedCallBackEvent);
        String actionId = closedCallBackEvent.getActionId();
        Long ruleId = Long.parseLong(this.getView().getPageCache().get("cache_rule_id"));
        switch (actionId) {
            case "appConfig":
                StaffPCAppConfigService.initFastApp(ruleId, this.getView());
                break;
            case "selectAttper":
                Map<String, String> returnData = (Map)closedCallBackEvent.getReturnData();
                if (returnData != null && returnData.size() > 0) {
                    this.getModel().setValue("attperiodentry", returnData.get("pkvalue"));
                    this.getModel().setValue("attperiod", returnData.get("attperiod"));
                }
                break;
            case "saveconfig":
                Long userId = Long.parseLong(this.getPageCache().get("cache_id_userid"));
                Long employeeId = Long.parseLong(this.getPageCache().get("cache_id_employeeid"));
                long schemeId = Long.parseLong(this.getPageCache().get("cache_scheme_id"));
                Long attFileBid = Long.parseLong(this.getPageCache().get("cache_attfile_boid"));
                Date queryDate = this.getModel().getDataEntity().getDate("daydate");
                String nowDateStr = WTCDateUtils.date2Str(queryDate, "yyyy-MM-dd");
                PersonHomePCCountBusiness.getInstance().setDateDetail(userId, nowDateStr, schemeId, this.getView(), employeeId);
                LOG.info("pcpersonhome initStatistic query begin...");
                String personAttPeriodIdStr = this.getView().getPageCache().get("PerAttIdStr");
                Map<String, Object> summaryConfig = SummaryConfigDetailService.getInstance().queryInfo(userId, "A", personAttPeriodIdStr, schemeId, 2, attFileBid);
                LOG.info("pcpersonhome initStatistic query end...");
                List<SummaryConfDetail> showSummary = (List)summaryConfig.get("show");
                this.setDatePreDetail(showSummary);
                String cacheQuotaConfigId = this.getPageCache().get("quotaconfig.id");
                long quotaConfigId = NumberUtils.isDigits(cacheQuotaConfigId) ? Long.parseLong(cacheQuotaConfigId) : 0L;
                if (quotaConfigId != 0L) {
                    Date date = this.getView().getModel().getDataEntity().getDate("qtdate");
                    QuotaStatisticIndexService.getInstance().setQuotaDetail(schemeId, userId, date, this.getView(), "2", employeeId);
                }
                break;
            case "attconf":
                AttConfirmServiceHelper.instance().updateBtnAttConfirmVisible(this.getView());
                String confirmDate = this.getPageCache().get("confirmDate");
                if (WTCDateUtils.str2Date(confirmDate, "yyyy-MM-dd") != null) {
                    this.setAttRecordData(confirmDate);
                }
        }

    }

    public void entryRowClick(RowClickEvent evt) {
        RowClickEventListener.super.entryRowClick(evt);
        CardEntry cardEntry = (CardEntry)evt.getSource();
        String entryKey = cardEntry.getEntryKey();
        if ("fastappentryentity".equals(entryKey)) {
            int openIndex = this.getModel().getEntryCurrentRowIndex("fastappentryentity");
            String openText = (String)this.getModel().getValue("fastname", openIndex);
            String app = StaffPCAppConfigConstants.getBillNumber(openText);
            if (WTCStringUtils.isEmpty(app)) {
                return;
            }

            switch (app) {
                case "A":
                    this.showAddNewPage("wtabm_vaapplyself", true);
                    break;
                case "B":
                    this.showAddNewPage("wtom_otbillself", true);
                    break;
                case "C":
                    this.showAddNewPage("wts_swshiftselfbill", true);
                    break;
                case "D":
                    this.showAddNewPage("wtam_busitripselfbill", true);
                    break;
                case "E":
                    this.showAddNewPage("wtpm_supsignself", true);
                    break;
                case "M":
                    this.showAddNewPage("wtam_attconfirmbill", false);
            }
        } else if ("qtentryentitycount".equals(entryKey)) {
            this.showQTLineDetailList();
        }

    }

    public void customEvent(CustomEventArgs cea) {
        String key = cea.getKey();
        String eventName = cea.getEventName();
        LOG.info("pcpersonhome key:{} eventName:{} eventArgs:{} ", new Object[]{key, eventName, cea.getEventArgs()});
        if (StringUtils.isEmpty(this.getPageCache().get("cache_normal_init"))) {
            if ("customcalendar".equals(key) && "getDateData".equals(eventName)) {
                CalendarGetDataModel getDate = (CalendarGetDataModel)SerializationUtils.fromJsonString(cea.getEventArgs(), CalendarGetDataModel.class);
                this.initCalendarState(getDate, false);
                this.getModel().setValue("daydate", getDate.getChooseDay());
            } else if ("customcalendar".equals(key) && "getAttRecord".equals(eventName)) {
                this.setAttRecordData(cea.getEventArgs());
                this.getModel().setValue("daydate", cea.getEventArgs());
            } else if ("customcalendar".equals(key) && "abnormalDeal".equals(eventName)) {
                AbnormalDealModel abnormalDealModel = (AbnormalDealModel)SerializationUtils.fromJsonString(cea.getEventArgs(), AbnormalDealModel.class);
                PersonHomePCBusiness.getInstance().showAddNewFormForAbnormal(this.getView(), abnormalDealModel);
            } else if ("customcalendar".equals(key) && "attConfirm".equals(eventName)) {
                JSONObject jsonEventArgs = JSONObject.parseObject(cea.getEventArgs());
                Object jsonAttConfirmId = jsonEventArgs.get("attConfirmId");
                if (jsonAttConfirmId != null) {
                    this.getPageCache().put("attConfirmId", String.valueOf(jsonAttConfirmId));
                    this.getPageCache().put("confirmDate", String.valueOf(jsonEventArgs.get("confirmDate")));
                    this.getView().invokeOperation("attconf");
                }
            }

        }
    }

    private void initCalendar() {
        String chooseDay = WTSSDateUtils.getLastDateString();
        LOG.info("pcpersonhome chooseDay : {}", chooseDay);
        CustomControl customcontrol = (CustomControl)this.getView().getControl("customcalendar");
        Map<String, Object> data = new HashMap(16);
        CalendarInitModel calendarInitModel = new CalendarInitModel();
        calendarInitModel.setEarliestMonth("2015-01");
        calendarInitModel.setChooseDay(chooseDay);
        data.put("event", "init");
        data.put("args", calendarInitModel);
        customcontrol.setData(data);
    }

    private void initCalendarState(CalendarGetDataModel getDate, Boolean isLocateDate) {
        long userId = Long.parseLong(this.getView().getPageCache().get("cache_id_userid"));
        long employeeId = Long.parseLong(this.getView().getPageCache().get("cache_id_employeeid"));
        long schemeId = Long.parseLong(this.getView().getPageCache().get("cache_scheme_id"));
        CustomControl customcontrol = (CustomControl)this.getView().getControl("customcalendar");
        Map<String, Object> data = new HashMap(16);
        Set<Long> abnormalConfig = SchemaServiceHelper.getInstance().getAbnormalConfig(schemeId, "A");
        String yearMonth = StringUtils.substring(getDate.getChooseDay(), 0, 7);
        Date beginDayOfMonth = WTCDateUtils.getBeginDayOfMonth(yearMonth);
        Date lastDayOfMonth = WTCDateUtils.getLastDayOfMonth(yearMonth);
        Map<Long, Tuple<Date, Date>> tupleMap = HomePageServiceHelper.getInstance().getAttFileMapWithEmployeeId(employeeId, beginDayOfMonth, lastDayOfMonth);
        LOG.info("pcpersonhome initCalendarState queryScheduleInfoByAttFileBoId begin... abnormalConfig:{} tupleMap:{}", abnormalConfig, tupleMap);
        Map<String, Map<String, Object>> scheduleInfo = HomePageServiceHelper.getInstance().queryScheduleInfoByMultiBo(userId, tupleMap, getDate.getChooseDay(), abnormalConfig);
        Map<String, List<DailySource>> dailySourceData = SchemaServiceHelper.getInstance().getPeriodAttItems(schemeId, "A", userId, (String)getDate.getDateList().get(0), (String)getDate.getDateList().get(getDate.getDateList().size() - 1), tupleMap, 2);
        if (scheduleInfo != null && LOG.isDebugEnabled()) {
            LOG.debug("pcpersonhome initCalendarState scheduleInfo:{}", SerializationUtils.toJsonString(scheduleInfo));
        }

        List<DateStateModel> dateStateModels = HomePageServiceHelper.getInstance().getCalendarData(tupleMap, getDate, scheduleInfo, dailySourceData);
        String dateStateStrings = "";
        if (!CollectionUtils.isEmpty(dateStateModels)) {
            dateStateStrings = SerializationUtils.serializeToBase64(dateStateModels);
            this.getView().getPageCache().put("cache_id_date_state", dateStateStrings);
        }

        List<AttRecordModel> attRecordModel = HomePageServiceHelper.getInstance().getSignCardDetailWithEmployeeId(employeeId, schemeId, getDate.getChooseDay(), "0", dateStateStrings, false, (String)null);
        DateDataModel dateDataModel = new DateDataModel();
        dateDataModel.setDateList(dateStateModels);
        dateDataModel.setAttRecord(attRecordModel);
        data.put("event", "dateData");
        data.put("isLocateDate", isLocateDate);
        data.put("args", dateDataModel);
        HomePageServiceHelper.getInstance().setAttConfirmByDate(data, employeeId, WTCDateUtils.str2Date(getDate.getChooseDay(), "yyyy-MM-dd"));
        HomePageServiceHelper.getInstance().setData(data, attRecordModel, getDate.getChooseDay(), employeeId);
        final WTCPluginProxy<WTCCustomControlExtPlugin> workCalendarExtPlugin = (WTCPluginProxy<WTCCustomControlExtPlugin>)WTCPluginProxyFactory.create((Object)null, (Class)WTCCustomControlExtPlugin.class, "kd.sdk.wtc.wtss.business.homepage.WorkCalendarCustomExt", (PluginFilter)null);
        if (workCalendarExtPlugin.hasPlugin()) {
            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(data));
            Map<String, Object> request = WTCMaps.JsonToMap(jsonObject);
            request.put("attPersonId", userId);
            request.put("type", "pc");
            workCalendarExtPlugin.invokeReplace((hrPlugin) -> {
                hrPlugin.setCustomData(this.getView().getPageId(), "dateData", request);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("WorkCalendarCustomExt.class:{},eventName:{}", hrPlugin.getClass().getName(), "dateData");
                }

            });
            customcontrol.setData(request);
        } else {
            customcontrol.setData(data);
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("pcpersonhome initCalendarState dateDataModel:{}", SerializationUtils.toJsonString(dateDataModel));
        }

    }

    private void setAttRecordData(String date) {
        CustomControl customcontrol = (CustomControl)this.getView().getControl("customcalendar");
        Map<String, Object> data = new HashMap(16);
        long employeeId = Long.parseLong(this.getView().getPageCache().get("cache_id_employeeid"));
        long schemeId = Long.parseLong(this.getView().getPageCache().get("cache_scheme_id"));
        String dateState = this.getView().getPageCache().get("cache_id_date_state");
        List<AttRecordModel> attRecordModel = HomePageServiceHelper.getInstance().getSignCardDetailWithEmployeeId(employeeId, schemeId, date, "0", dateState, false, (String)null);
        if (LOG.isDebugEnabled()) {
            LOG.debug("pcpersonhome attRecord:{}", SerializationUtils.toJsonString(attRecordModel));
        }

        attRecordModel.sort(Comparator.comparing(AttRecordModel::getDate));
        data.put("event", "attRecord");
        data.put("attRecord", attRecordModel);
        HomePageServiceHelper.getInstance().setAttConfirmByDate(data, employeeId, WTCDateUtils.str2Date(date, "yyyy-MM-dd"));
        HomePageServiceHelper.getInstance().setData(data, attRecordModel, date, employeeId);
        final WTCPluginProxy<WTCCustomControlExtPlugin> workCalendarExtPlugin = (WTCPluginProxy<WTCCustomControlExtPlugin>)WTCPluginProxyFactory.create((Object)null, (Class)WTCCustomControlExtPlugin.class, "kd.sdk.wtc.wtss.business.homepage.WorkCalendarCustomExt", (PluginFilter)null);
        if (workCalendarExtPlugin.hasPlugin()) {
            JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(data));
            Map<String, Object> request = WTCMaps.JsonToMap(jsonObject);
            long userId = Long.parseLong(this.getView().getPageCache().get("cache_id_userid"));
            request.put("attPersonId", userId);
            request.put("type", "pc");
            workCalendarExtPlugin.invokeReplace((hrPlugin) -> {
                hrPlugin.setCustomData(this.getView().getPageId(), "attRecord", request);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("WorkCalendarCustomExt.class:{},eventName:{}", hrPlugin.getClass().getName(), "attRecord");
                }

            });
            customcontrol.setData(request);
        } else {
            customcontrol.setData(data);
        }

    }

    private void initCommonProblem(Long schemeId) {
        MobileHomeConf mobileHomeConf = SchemaServiceHelper.getInstance().getSchemeForHome(schemeId, "A");
        if (mobileHomeConf != null && mobileHomeConf.isShowProblem()) {
            if (CollectionUtils.isEmpty(mobileHomeConf.getProblems())) {
                this.getView().setVisible(Boolean.FALSE, new String[]{"flexmore", "flexproblem1", "flexproblem2", "flexproblem3"});
                this.getView().setVisible(Boolean.TRUE, new String[]{"comproblemdeftflex"});
            } else {
                this.getView().setVisible(Boolean.FALSE, new String[]{"comproblemdeftflex"});
                String problemsString = SerializationUtils.serializeToBase64(mobileHomeConf.getProblems());
                LOG.info("pcpersonhome initCommonProblem problemsString: {}", problemsString);
                this.getView().getPageCache().put("cache_commproblem", problemsString);
                List<MobileHomeConf.CommProblem> problems = mobileHomeConf.getProblems();
                if (problems.size() >= 1) {
                    if (problems.size() == 1) {
                        this.getView().setVisible(Boolean.FALSE, new String[]{"flexproblem2"});
                        this.getView().setVisible(Boolean.FALSE, new String[]{"flexproblem3"});
                    } else if (problems.size() == 2) {
                        this.getView().setVisible(Boolean.FALSE, new String[]{"flexproblem3"});
                        ((Label)this.getControl("labelquestion2")).setText("2." + ((MobileHomeConf.CommProblem)problems.get(1)).getProblem());
                        ((Label)this.getControl("labeltime2")).setText(WTCInteDateUtil.formatDateBySysTzAndUserFmt(((MobileHomeConf.CommProblem)problems.get(1)).getModifyTime()));
                    } else {
                        ((Label)this.getControl("labelquestion2")).setText("2." + ((MobileHomeConf.CommProblem)problems.get(1)).getProblem());
                        ((Label)this.getControl("labeltime2")).setText(WTCInteDateUtil.formatDateBySysTzAndUserFmt(((MobileHomeConf.CommProblem)problems.get(1)).getModifyTime()));
                        ((Label)this.getControl("labelquestion3")).setText("3." + ((MobileHomeConf.CommProblem)problems.get(2)).getProblem());
                        ((Label)this.getControl("labeltime3")).setText(WTCInteDateUtil.formatDateBySysTzAndUserFmt(((MobileHomeConf.CommProblem)problems.get(2)).getModifyTime()));
                    }

                    ((Label)this.getControl("labelquestion1")).setText("1." + ((MobileHomeConf.CommProblem)problems.get(0)).getProblem());
                    ((Label)this.getControl("labeltime1")).setText(WTCInteDateUtil.formatDateBySysTzAndUserFmt(((MobileHomeConf.CommProblem)problems.get(0)).getModifyTime()));
                }
            }
        } else {
            LOG.info("pcpersonhome initCommonProblem isShowProblem false");
            this.getView().setVisible(Boolean.FALSE, new String[]{"flexcommproblem"});
        }
    }

    public void tabSelected(TabSelectEvent tabSelectEvent) {
        String tabKey = tabSelectEvent.getTabKey();
        if (tabKey.equals("daytabpage")) {
            this.getView().setVisible(Boolean.TRUE, new String[]{"daydate", "dateflex"});
            this.getView().setVisible(Boolean.FALSE, new String[]{"attperiod", "flexattperoidconf", "perflex", "qtflex", "qtdate"});
        } else if (tabKey.equals("pertabpage")) {
            this.getView().setVisible(Boolean.TRUE, new String[]{"attperiod", "flexattperoidconf", "perflex"});
            this.getView().setVisible(Boolean.FALSE, new String[]{"daydate", "dateflex", "qtdate", "qtflex"});
        } else {
            this.getView().setVisible(Boolean.TRUE, new String[]{"qtdate", "qtflex"});
            this.getView().setVisible(Boolean.FALSE, new String[]{"daydate", "dateflex", "attperiod", "flexattperoidconf", "perflex"});
        }

    }

    public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
        beforeF7SelectEvent.setCancel(true);
        ListShowParameter listShowParameter = new ListShowParameter();
        listShowParameter.getOpenStyle().setShowType(ShowType.Modal);
        listShowParameter.setLookUp(true);
        listShowParameter.setHasRight(true);
        Object[] periodIds = new Object[1];
        DynamicObject dynamicObject = this.getModel().getDataEntity().getDynamicObject("attperiodentry");
        if (dynamicObject != null) {
            periodIds[0] = dynamicObject.get("id");
        }

        listShowParameter.setSelectedRows(periodIds);
        listShowParameter.setFormId("wtss_attperiod_f7list");
        listShowParameter.setBillFormId("wtss_perattperiodquery");
        listShowParameter.setCaption(ResManager.loadKDString("人员考勤期间", "PersonHomePCPlugin_5", "wtc-wtss-formplugin", new Object[0]));
        StyleCss style = new StyleCss();
        style.setWidth("1000");
        style.setHeight("600");
        listShowParameter.getOpenStyle().setInlineStyleCss(style);
        CloseCallBack callBack = new CloseCallBack(this, "selectAttper");
        listShowParameter.setCloseCallBack(callBack);
        listShowParameter.setParentPageId(this.getView().getPageId());
        listShowParameter.setMultiSelect(false);
        listShowParameter.setCustomParam("multiType", Boolean.FALSE);
        List<Long> PerAttIds = (List)SerializationUtils.fromJsonString(this.getView().getPageCache().get("PerAttIds"), List.class);
        List<QFilter> qFilters = Lists.newArrayList();
        qFilters.add(new QFilter("id", "in", PerAttIds));
        ListFilterParameter filterList = new ListFilterParameter(qFilters, (String)null);
        listShowParameter.setListFilterParameter(filterList);
        this.getView().showForm(listShowParameter);
    }

    public void hyperLinkClick(HyperLinkClickEvent hyperLinkClickEvent) {
        this.showQTLineDetailList();
    }

    private void initControlWithoutValidValue() {
        this.getPageCache().put("cache_normal_init", "true");
        this.getView().setVisible(Boolean.FALSE, new String[]{"flexmore", "flexproblem1", "flexproblem2", "flexproblem3"});
        this.getView().setVisible(Boolean.FALSE, new String[]{"fastappentryentity", "configap"});
        this.getView().setVisible(Boolean.FALSE, new String[]{"nckd_flexpanelap", "dateflex", "perflex", "qtflex", "attstavector"});
    }

    private void showAddNewPage(String formId, boolean isAddNew) {
        WTCBillType billType = (WTCBillType)BillCommonService.getInstance().BILL_TYPE_MAP.get(formId);
        BeforeShowApplyPageEvent beforeShowApplyPageEvent = new BeforeShowApplyPageEvent(billType, WTCApplyType.SELF, new BillShowParameter());
        WTCPluginProxy<BillReplaceExtPlugin> proxy = WTCPluginProxyFactory.create(BillReplaceExtPlugin.class, "kd.sdk.wtc.wtss.business.homepage.BillReplaceExtPlugin");
        proxy.invokeReplace((plugin) -> {
            plugin.beforeShowApplyPage(beforeShowApplyPageEvent);
        });
        FormShowParameter formShowParameter = beforeShowApplyPageEvent.getFormShowParameter();
        if (BillCommonService.getInstance().hasFormId(beforeShowApplyPageEvent)) {
            this.getView().showForm(formShowParameter);
        } else {
            IFormView view = this.getView();
            String key;
            String pageId;
            if (isAddNew) {
                BillShowParameter parameter = PersonHomePCBusiness.getInstance().getBillShowParameter(view.getFormShowParameter().getAppId(), formId, view);
                if (parameter == null) {
                    return;
                }

                key = formId + "_addNewPageId";
                pageId = view.getPageCache().get(key);
                if (StringUtils.isNotBlank(pageId)) {
                    parameter.setPageId(pageId);
                } else {
                    view.getPageCache().put(key, parameter.getPageId());
                }

                view.showForm(parameter);
            } else {
                ListShowParameter listShowParameter = WTCFormUtils.getListShowParameter(formId, ShowType.MainNewTabPage);
                key = formId + "_listPageId";
                pageId = view.getPageCache().get(key);
                if (StringUtils.isNotBlank(pageId)) {
                    listShowParameter.setPageId(pageId);
                } else {
                    view.getPageCache().put(key, listShowParameter.getPageId());
                }

                view.showForm(listShowParameter);
            }

        }
    }

    private void showQTLineDetailList() {
        int openIndex = this.getModel().getEntryCurrentRowIndex("qtentryentitycount");
        String openName = (String)this.getModel().getValue("datasounameqt", openIndex);
        String quotaConfigId = String.valueOf(this.getModel().getValue("quotasourceid", openIndex));
        List<Long> quotaDetailIdList = JSON.parseArray(this.getView().getPageCache().get(quotaConfigId), Long.class);
        ListShowParameter listShowParameter = new ListShowParameter();
        ListFilterParameter listFilterParameter = new ListFilterParameter();
        List<QFilter> qFilters = Lists.newArrayList();
        qFilters.add(new QFilter("id", "in", quotaDetailIdList));
        listFilterParameter.setQFilters(qFilters);
        listShowParameter.setListFilterParameter(listFilterParameter);
        listShowParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
        listShowParameter.setBillFormId("wtss_qtlinedetaillayout");
        listShowParameter.setPageId("wtss_qtlinedetaillayout" + this.getView().getPageId() + quotaConfigId);
        listShowParameter.setCustomParam("selectYear", WTCDateUtils.date2Str(this.getModel().getDataEntity().getDate("qtdate"), "yyyy"));
        listShowParameter.setCaption(ResManager.loadKDString("定额明细-{0}", "PersonHomePCPlugin_3", "wtc-wtss-formplugin", new Object[]{openName}));
        this.getView().showForm(listShowParameter);
    }

    private void showAttConfirmPage() {
        Long attConfirmId;
        try {
            attConfirmId = Long.valueOf(this.getPageCache().get("attConfirmId"));
        } catch (Exception var9) {
            LOG.warn("PersonHomePCPlugin.showAttConfirmPage.getAttConfirmIdError:{}", var9.getMessage());
            throw new KDBizException(ResManager.loadKDString("获取考勤确认记录数据异常，请联系管理员处理。", "PersonHomePCPlugin_6", "wtc-wtss-formplugin", new Object[0]));
        }

        if (attConfirmId != 0L) {
            AttConfirmRecordQueryParam queryParam = new AttConfirmRecordQueryParam();
            queryParam.setIds(Collections.singleton(attConfirmId));
            queryParam.setQueryNotEffect(true);
            List<AttConfirmRecordModel> recordModels = AttConfirmQueryServiceImpl.getInstance().queryAttConfirmRecordModelList(queryParam);
            if (!WTCCollections.isEmpty(recordModels)) {
                AttConfirmRecordModel currentRecordModel = (AttConfirmRecordModel)recordModels.get(0);
                AttConRecordStatusEnum status = currentRecordModel.getStatus();
                AttConfirmDataStatusEnum dataStatus = currentRecordModel.getDataStatus();
                if (AttConRecordStatusEnum.SEND.equals(status) && AttConfirmDataStatusEnum.EFFECT.equals(dataStatus)) {
                    MobileFormShowParameter showParameter = new MobileFormShowParameter();
                    showParameter.setFormId("wtss_attconfirmlistpc");
                    showParameter.getOpenStyle().setShowType(ShowType.Modal);
                    showParameter.setParentPageId(this.getView().getPageId());
                    showParameter.setCloseCallBack(new CloseCallBack(this, "attconf"));
                    showParameter.setCustomParam("cache_attfile_boid", this.getPageCache().get("cache_attfile_boid"));
                    showParameter.setCustomParam("cache_id_employeeid", this.getPageCache().get("cache_id_employeeid"));
                    showParameter.setCustomParam("currentrecordid", String.valueOf(attConfirmId));
                    showParameter.setCustomParam("confirmtype", currentRecordModel.getType().getCode());
                    this.getView().showForm(showParameter);
                } else {
                    FormShowParameter detailParameter = new FormShowParameter();
                    OpenStyle openStyle = new OpenStyle();
                    openStyle.setShowType(ShowType.Modal);
                    detailParameter.setOpenStyle(openStyle);
                    detailParameter.setParentPageId(this.getView().getPageId());
                    detailParameter.setFormId("wtam_attconfirmbill");
                    detailParameter.setCloseCallBack(new CloseCallBack(this, "attconf"));
                    detailParameter.setCustomParam("attConfirmBillId", attConfirmId);
                    detailParameter.setCustomParam("source", "personhome");
                    detailParameter.setCustomParam("attfile", Long.valueOf(this.getPageCache().get("cache_attfile_boid")));
                    this.getView().showForm(detailParameter);
                }

            }
        }
    }

    private EntryType getPerEntryEntityType(DynamicObjectCollection dynamicObjects) {
        String entryTypeJSONStr = this.getPageCache().get("perentryentitycounttype");
        EntryType entryType;
        if (WTCStringUtils.isEmpty(entryTypeJSONStr)) {
            if (!WTCCollections.isNotEmpty(dynamicObjects)) {
                return null;
            }

            entryType = (EntryType)((DynamicObject)dynamicObjects.get(0)).getDynamicObjectType();
            this.getPageCache().put("perentryentitycounttype", WTCSerializationUtils.toJsonString(entryType));
        } else {
            try {
                entryType = (EntryType)WTCSerializationUtils.deSerializeFromBase64(entryTypeJSONStr);
            } catch (Exception var5) {
                LOG.warn("PersonHomePCPlugin.getPerEntryEntityType.Error:", var5);
                throw new KDBizException(ResManager.loadKDString("获取期间统计数据失败，请联系管理员。", "PersonHomePCPlugin_7", "wtc-wtss-formplugin", new Object[0]));
            }
        }

        return entryType;
    }
}
