Example usage for java.lang IllegalAccessException printStackTrace

List of usage examples for java.lang IllegalAccessException printStackTrace

Introduction

In this page you can find the example usage for java.lang IllegalAccessException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:gr.abiss.calipso.CalipsoServiceImpl.java

/**
 * @param history/*from   ww w .ja  v a2 s  . com*/
 * @param item
 */
public void runStateChangePlugins(History history, Item item, Integer state) {
    // assets to create based on Item info?
    AbstractItem abstractItem = history != null ? history : item;
    logger.info("RUNNING PLUGINS (" + state + "), item state: "
            + abstractItem.getSpace().getMetadata().getStatusValue(abstractItem.getStatus()));

    // run plugins

    Map<Integer, String> pluginsMap = abstractItem.getSpace().getMetadata().getStatesPluginMap();

    if (abstractItem.getStatus() != null && MapUtils.isNotEmpty(pluginsMap)) {
        String pluginClassNames = pluginsMap.get(abstractItem.getStatus());
        logger.info("pluginClassNames:" + pluginClassNames + ", status: "
                + (abstractItem != null ? abstractItem.getStatus() : null));
        logger.info("Running plugins for status: " + abstractItem.getStatus() + ", plugins: "
                + pluginsMap.get(abstractItem.getStatus()));
        if (pluginClassNames != null && pluginClassNames.length() > 0) {

            String[] pluginNames = pluginClassNames.split(" ");
            for (int i = 0; i < pluginNames.length; i++) {
                String pluginClassName = pluginNames[i];
                if (StringUtils.isNotBlank(pluginClassName)) {

                    logger.debug("Loading plugin class: " + pluginClassName);
                    // "clazz" is the class name to load
                    Class clazz = null;
                    try {
                        clazz = Class.forName(pluginClassName);
                        AbstractStatePlugin plugin = (AbstractStatePlugin) clazz.newInstance();
                        if (state.equals(AbstractStatePlugin.PRE_STATE_CHANGE)) {
                            plugin.executePreStateChange(this, item);
                        } else if (state.equals(AbstractStatePlugin.PRE_HISTORY_SAVE)) {
                            plugin.executePreHistoryChange(this, history);
                        } else if (state.equals(AbstractStatePlugin.POST_STATE_CHANGE)) {
                            plugin.executePostStateChange(this, history);
                        }

                    } catch (ClassNotFoundException e) {
                        logger.error("Cannot load State Plugin class: " + pluginClassName, e);
                        e.printStackTrace();
                    } catch (InstantiationException ie) {
                        logger.error("Cannot instantiate State Plugin class: " + pluginClassName, ie);
                        ie.printStackTrace();
                    } catch (IllegalAccessException iae) {
                        logger.error("Cannot load State Plugin class: " + pluginClassName, iae);
                        iae.printStackTrace();
                    }

                }
            }

        }
    }
}

From source file:org.sakaiproject.tool.assessment.ui.listener.evaluation.HistogramListener.java

private void doScoreStatistics(HistogramQuestionScoresBean qbean, ArrayList scores) {
    // here scores contain ItemGradingData
    Map assessmentMap = getAssessmentStatisticsMap(scores);

    // test to see if it gets back empty map
    if (assessmentMap.isEmpty()) {
        qbean.setNumResponses(0);/* w  ww  .  j  ava2s. c  om*/
    }

    try {
        BeanUtils.populate(qbean, assessmentMap);

        // quartiles don't seem to be working, workaround
        qbean.setQ1((String) assessmentMap.get("q1"));
        qbean.setQ2((String) assessmentMap.get("q2"));
        qbean.setQ3((String) assessmentMap.get("q3"));
        qbean.setQ4((String) assessmentMap.get("q4"));
        //qbean.setTotalScore( (String) assessmentMap.get("maxScore"));

        HistogramBarBean[] bars = new HistogramBarBean[qbean.getColumnHeight().length];

        // SAK-1933: if there is no response, do not show bars at all 
        // do not check if assessmentMap is empty, because it's never empty.
        if (scores.size() == 0) {
            bars = new HistogramBarBean[0];
        } else {
            for (int i = 0; i < qbean.getColumnHeight().length; i++) {
                bars[i] = new HistogramBarBean();
                bars[i].setColumnHeight(Integer.toString(qbean.getColumnHeight()[i]));
                bars[i].setNumStudents(qbean.getNumStudentCollection()[i]);
                if (qbean.getNumStudentCollection()[i] > 1) {
                    bars[i].setNumStudentsText(qbean.getNumStudentCollection()[i] + " Responses");
                } else {
                    bars[i].setNumStudentsText(qbean.getNumStudentCollection()[i] + " Response");

                }
                //  bars[i].setNumStudentsText(qbean.getNumStudentCollection()[i] +
                // " Responses");
                bars[i].setRangeInfo(qbean.getRangeCollection()[i]);
                bars[i].setLabel(qbean.getRangeCollection()[i]);
            }
        }
        qbean.setHistogramBars(bars);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
}

From source file:com.selfsoft.business.service.impl.TbFixEntrustServiceImpl.java

public Map putEntrustBalanceReportParamMap(Long id, HttpServletRequest request) {

    Map map = new HashMap();
    // ?/*  w  ww  . j  a  v a2 s.c  o  m*/
    TbFixEntrust tbFixEntrust = this.findById(id);

    // ?
    TbCustomer tbCustomer = tbCustomerService.findById(tbFixEntrust.getTbCustomer().getId());
    // ?
    TbCarInfo tbCarInfo = tbCarInfoService.findById(tbFixEntrust.getTbCarInfo().getId());
    // ??
    TmCompany tmCompany = tmCompanyService.acquireUniqueTmCompany();

    // ?
    List<TbFixEntrustContent> tbFixEntrustContentList = tbFixEntrustContentService
            .findTbFixEnTrustContentListByTbFixEntrustId(tbFixEntrust.getId());

    /**
     * add 2010-12-17 ccr
     */
    List<TbFixEntrustContent> tbFixEntrustContentListPage = new ArrayList<TbFixEntrustContent>();

    List<TbFixEntrustContent> tbFixEntrustContentListTemp = new ArrayList<TbFixEntrustContent>();

    List<TbFixEntrustContent> tbFixEntrustContentListAdd = new ArrayList<TbFixEntrustContent>();

    if (null != tbFixEntrustContentList && tbFixEntrustContentList.size() > 0) {

        for (int i = 0; i < tbFixEntrustContentList.size(); i++) {

            boolean flag = false;

            if (tbFixEntrustContentListTemp.size() == 0) {

                tbFixEntrustContentListTemp.add(tbFixEntrustContentList.get(i));

            } else {
                if (tbFixEntrustContentListTemp.size() > 1) {

                    for (TbFixEntrustContent _tbFixEntrustContent : tbFixEntrustContentListTemp) {

                        if (_tbFixEntrustContent.getStationName()
                                .equals(tbFixEntrustContentList.get(i).getStationName())
                                && _tbFixEntrustContent.getTbWorkingInfo().getId()
                                        .equals(tbFixEntrustContentList.get(i).getTbWorkingInfo().getId())
                                && _tbFixEntrustContent.getFreesymbol()
                                        .equals(tbFixEntrustContentList.get(i).getFreesymbol())

                        ) {

                            flag = true;

                            break;

                        }

                    }

                }

            }

            if (flag) {

                continue;

            } else {

                tbFixEntrustContentListTemp.add(tbFixEntrustContentList.get(i));

            }

            TbFixEntrustContent temp = tbFixEntrustContentList.get(i);

            TbFixEntrustContent tempCopy = new TbFixEntrustContent();

            BigDecimal d = new BigDecimal(temp.getFixHourAll());

            BigDecimal d2 = new BigDecimal(temp.getFixHour());

            for (int j = i + 1; j < tbFixEntrustContentList.size(); j++) {

                if (temp.getStationName().equals(tbFixEntrustContentList.get(j).getStationName())
                        && temp.getTbWorkingInfo().getId()
                                .equals(tbFixEntrustContentList.get(j).getTbWorkingInfo().getId())
                        && temp.getFreesymbol().equals(tbFixEntrustContentList.get(j).getFreesymbol())) {

                    d = d.add(new BigDecimal(tbFixEntrustContentList.get(j).getFixHourAll()));

                    d2 = d2.add(new BigDecimal(tbFixEntrustContentList.get(j).getFixHour()));

                }

            }

            try {
                BeanUtils.copyProperties(tempCopy, temp);
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            tempCopy.setFixHourAll(d.doubleValue());

            tempCopy.setFixHour(d2.doubleValue());

            if (!tempCopy.getFreesymbol().equals(1d) || !tempCopy.getFixHourAll().equals(0d)) {

                tbFixEntrustContentListAdd.add(tempCopy);

            }

        }

    }

    if (tbFixEntrustContentListAdd.size() == 0) {

        TbFixEntrustContent t = new TbFixEntrustContent();

        t.setStationName("");

        tbFixEntrustContentListAdd.add(t);

    }

    // ??
    /*
     * List<TbMaintianVo> maintianvos = tbMaintainPartContentService
     * .getTbMaintianDetailVosByEntrustId(tbFixEntrust.getId(),
     * Constants.BALANCE_ALL);
     */
    /* update by baijx ?? */
    //      List<TbMaintianVo> maintianvos = tbMaintainPartContentService
    //            .getTbMaintianDetailVosByEntrustIdPrint(tbFixEntrust.getId(),
    //                  Constants.BALANCE_ALL);
    List<TbMaintainPartContent> result = tbMaintainPartContentService
            .getViewEntrustMaintianContent(tbFixEntrust.getId());
    List<TbMaintianVo> maintianvos = null;

    if (result != null && result.size() > 0) {
        maintianvos = tbMaintainPartContentService.getTbMaintianDetailVos(result.get(0).getMaintainCode());

    }

    // ?
    List<TmStockOutDetVo> tmStockOutDetVos = tmStockOutService
            .getSellDetailByEntrustCode(tbFixEntrust.getEntrustCode(), Constants.BALANCE_ALL);
    // 
    // List<TbBusinessBalanceItem> tbBusinessBalanceItemList =
    // tbBusinessBalanceItemService.findGroupTbBusinessBalanceItemListByTbBusinessBalanceId(tbBusinessBalance.getId());
    List<TbBusinessBalanceItem> tbBusinessBalanceItemList = new ArrayList<TbBusinessBalanceItem>();
    // ???
    if (null == maintianvos) {
        maintianvos = new ArrayList<TbMaintianVo>();
    }

    if (null != tmStockOutDetVos && tmStockOutDetVos.size() > 0) {

        for (TmStockOutDetVo tmStockOutDetVo : tmStockOutDetVos) {

            TbMaintianVo tbMaintianVo = new TbMaintianVo();

            tbMaintianVo.setPartId(tmStockOutDetVo.getPartinfoId());

            tbMaintianVo.setHouseName(tmStockOutDetVo.getHouseName());

            tbMaintianVo.setPartCode(tmStockOutDetVo.getPartCode());

            tbMaintianVo.setPartName(tmStockOutDetVo.getPartName());

            tbMaintianVo.setUnitName(tmStockOutDetVo.getUnitName());

            tbMaintianVo.setPrice(tmStockOutDetVo.getPrice());

            tbMaintianVo.setPartQuantity(tmStockOutDetVo.getQuantity());

            tbMaintianVo.setTotal(tmStockOutDetVo.getTotal());

            tbMaintianVo.setIsFree(tmStockOutDetVo.getIsFree());

            maintianvos.add(tbMaintianVo);
        }

    }

    /**
     * add by ccr 2010-12-18
     */
    List<TbMaintianVo> maintianvosTemp = new ArrayList<TbMaintianVo>();

    List<TbMaintianVo> maintianvosAdd = new ArrayList<TbMaintianVo>();

    if (maintianvos.size() > 0) {

        for (int i = 0; i < maintianvos.size(); i++) {

            boolean flag = false;

            if (maintianvosTemp.size() == 0) {

                maintianvosTemp.add(maintianvos.get(i));

            } else {

                if (maintianvosTemp.size() > 1) {

                    int l = 0;

                    for (TbMaintianVo _tbMaintianVo : maintianvosTemp) {

                        if (_tbMaintianVo.getPartId().equals(maintianvos.get(i).getPartId())
                                && _tbMaintianVo.getIsFree().equals(maintianvos.get(i).getIsFree())
                                && _tbMaintianVo.getPrice().equals(maintianvos.get(i).getPrice())) {

                            // maintianvosTemp.set(l, maintianvos.get(i));

                            flag = true;

                            break;

                        }

                        l++;

                    }

                }

            }

            if (flag) {

                continue;

            } else {

                maintianvosTemp.add(maintianvos.get(i));

            }

            TbMaintianVo temp = maintianvos.get(i);

            BigDecimal d1 = new BigDecimal(temp.getPartQuantity());

            BigDecimal d2 = new BigDecimal(temp.getTotal());

            for (int j = i + 1; j < maintianvos.size(); j++) {

                if (temp.getPartId().equals(maintianvos.get(j).getPartId())
                        && temp.getIsFree().equals(maintianvos.get(j).getIsFree())
                        && temp.getPrice().equals(maintianvos.get(j).getPrice())) {

                    temp.setPrice(maintianvos.get(j).getPrice());

                    d1 = d1.add(new BigDecimal(maintianvos.get(j).getPartQuantity()));

                    d2 = d2.add(new BigDecimal(maintianvos.get(j).getTotal()));

                }

            }

            temp.setPartQuantity(d1.doubleValue());

            temp.setTotal(d2.doubleValue());

            if (!temp.getIsFree().equals(1L) || !temp.getPartQuantity().equals(0d)) {

                /*
                 * temp.setPrice(new BigDecimal(temp.getTotal()).divide(new
                 * BigDecimal(temp.getPartQuantity()),2,
                 * BigDecimal.ROUND_HALF_UP).setScale(2,
                 * BigDecimal.ROUND_HALF_UP).doubleValue());
                 */

                maintianvosAdd.add(temp);

            }

        }

    }

    TbCardHis tbCardHis = null;

    // if (null != tbCardHisService.findCardHisByBalanceId(tbBusinessBalance
    // .getId())
    // && tbCardHisService.findCardHisByBalanceId(
    // tbBusinessBalance.getId()).size() > 0) {
    //
    // tbCardHis = tbCardHisService.findCardHisByBalanceId(
    // tbBusinessBalance.getId()).get(0);
    //
    // }

    Map reportParameters = new HashMap();
    // ??
    reportParameters.put("balanceCode", "");
    // ?
    reportParameters.put("entrustCode", tbFixEntrust.getEntrustCode());

    if (null != tbCardHis) {

        reportParameters.put("oriCardSaving", tbCardHis.getOriCardSaving());

        reportParameters.put("giveMoney", Double.valueOf(tbCardHis.getGiveMoney()));

        reportParameters.put("aftCardSaving", tbCardHis.getAftCardSaving());

    } else {

        reportParameters.put("oriCardSaving", 0.00D);

        reportParameters.put("giveMoney", 0.00D);

        reportParameters.put("aftCardSaving", 0.00D);
    }

    if (null != tmStockOutDetVos && tmStockOutDetVos.size() > 0) {
        // ??
        reportParameters.put("stockOutCode", tmStockOutDetVos.get(0).getStockOutCode());
    }

    if ("?????".equals(tmCompany.getCompanyName().trim())) {

        reportParameters.put("stockOutCode",
                CommonMethod.parseDateToString(tbFixEntrust.getFixDate(), "yyyy-MM-dd HH:mm:ss"));
    }

    // ?
    reportParameters.put("licenseCode", tbCarInfo.getLicenseCode());

    if (null != tbCarInfo.getTmCarModelType()) {
        // 
        reportParameters.put("modelType", tbCarInfo.getTmCarModelType().getModelName());
    }

    // 
    reportParameters.put("customerName", tbCustomer.getCustomerName());

    // 
    reportParameters.put("balanceDate",
            CommonMethod.parseDateToString(tbFixEntrust.getFixDate(), "yyyy-MM-dd"));

    // 
    reportParameters.put("payPatten", "");

    // ?
    reportParameters.put("fixType", tbFixEntrust.getTmFixType().getFixType());

    // ?
    reportParameters.put("chassisCode", tbCarInfo.getChassisCode());

    // ??
    reportParameters.put("engineCode", tbCarInfo.getEngineCode());

    // 
    reportParameters.put("purchaseDate",
            CommonMethod.parseDateToString(tbCarInfo.getPurchaseDate(), "yyyy-MM-dd"));

    // ?
    reportParameters.put("phone",
            tbCustomer.getPhone() == null ? ""
                    : tbCustomer.getPhone().trim() + "  " + tbCustomer.getTelephone() == null ? ""
                            : tbCustomer.getTelephone().trim());

    // ?
    reportParameters.put("address", tbCustomer.getAddress());

    // 
    /*
     * reportParameters.put("kilo", tbCarInfo.getKilo() == null ? "" :
     * String .valueOf(tbCarInfo.getKilo()));
     */
    reportParameters.put("kilo", tbFixEntrust.getEnterStationKilo() == null ? ""
            : String.valueOf(tbFixEntrust.getEnterStationKilo()));

    // 
    reportParameters.put("remark", tbFixEntrust.getRemark());

    // ??
    reportParameters.put("companyName", tmCompany.getCompanyName());

    reportParameters.put("companyAddress", tmCompany.getCompanyAddress());

    reportParameters.put("companyPhone", tmCompany.getCompanyPhone());

    reportParameters.put("companyTaxCode", tmCompany.getTaxCode());

    reportParameters.put("companyAccount", tmCompany.getCompanyAccount());

    reportParameters.put("serviceLeader", tmCompany.getServiceLeader());

    reportParameters.put("companyZipCode", tmCompany.getCompanyZipCode());

    reportParameters.put("companyBankName", tmCompany.getBankName());
    // ??

    // ?
    reportParameters.put("userRealName", tbFixEntrust.getTmUser().getUserRealName());
    // 
    // reportParameters.put("jsUserRealName",
    // tbBusinessBalance.getTmUser().getUserRealName());
    // ?
    reportParameters.put("printDate", CommonMethod.parseDateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
    // ?
    reportParameters.put("SUBREPORT_DIR", request.getRealPath("/reportfiles/") + "/");
    // ???-

    reportParameters.put("subdatasource_0", new JRBeanCollectionDataSource(tbFixEntrustContentListAdd));

    // ???-
    // List<TbBusinessBalanceItem> tbBusinessBalanceItemListSend = new
    // ArrayList<TbBusinessBalanceItem>();
    //
    // if (null != tbBusinessBalanceItemList
    // && tbBusinessBalanceItemList.size() > 0) {
    //
    // for (TbBusinessBalanceItem tbBusinessBalanceItem :
    // tbBusinessBalanceItemList) {
    //
    // if ("XLCLF".equals(tbBusinessBalanceItem.getBalanceItemCode())) {
    //
    // reportParameters.put("xlclf",
    // tbBusinessBalanceItem.getBalanceItemTotal());
    //
    // continue;
    // }
    //
    // if ("XLGSF".equals(tbBusinessBalanceItem.getBalanceItemCode())) {
    //
    // reportParameters.put("xlgsf",
    // tbBusinessBalanceItem.getBalanceItemTotal());
    //
    // continue;
    // }
    //
    // if ("SE".equals(tbBusinessBalanceItem.getBalanceItemCode())) {
    //
    // reportParameters.put("taxAmount",
    // tbBusinessBalanceItem.getBalanceItemTotal());
    //
    // continue;
    // }
    //
    // if ("ZJE".equals(tbBusinessBalanceItem.getBalanceItemCode())) {
    //
    // reportParameters.put("totalAmount",
    // tbBusinessBalanceItem.getBalanceItemTotal());
    //
    // continue;
    // }
    // if ("XSJE".equals(tbBusinessBalanceItem.getBalanceItemCode())) {
    //
    // reportParameters.put("xsje",
    // tbBusinessBalanceItem.getBalanceItemTotal());
    //
    // continue;
    // }
    // tbBusinessBalanceItemListSend.add(tbBusinessBalanceItem);
    //
    // }
    //
    // }

    List<TbMaintainPartContent> tcList = tbMaintainPartContentService
            .getViewEntrustMaintianContent(tbFixEntrust.getId());

    if (null != tcList && tcList.size() > 0) {

        tbFixEntrust.setStockOutPartTotal(
                new BigDecimal(tcList.get(0).getTotalPrice()).setScale(2, BigDecimal.ROUND_HALF_UP));

    }

    tbFixEntrust.setFixHourTotal(new BigDecimal(
            tbFixEntrustContentService.countTbFixEnTrustContentByTbFixEntrustId(tbFixEntrust.getId()))
                    .setScale(2, BigDecimal.ROUND_HALF_UP));

    tbFixEntrust.setSolePartTotal(
            new BigDecimal(tmStockOutService.getTotalPriceByEntrustCode(tbFixEntrust.getEntrustCode()))
                    .setScale(2, BigDecimal.ROUND_HALF_UP));

    reportParameters.put("xlclf", tbFixEntrust.getStockOutPartTotal().doubleValue());

    reportParameters.put("xlgsf", tbFixEntrust.getFixHourTotal().doubleValue());

    reportParameters.put("xsje", tbFixEntrust.getSolePartTotal().doubleValue());

    tbFixEntrust.setAllTotal(tbFixEntrust.getFixHourTotal()
            .add(tbFixEntrust.getStockOutPartTotal().add(tbFixEntrust.getSolePartTotal())));

    // ??
    reportParameters.put("totalAmount", tbFixEntrust.getAllTotal().doubleValue());
    // ???
    // reportParameters.put("partFavourAmount",this.calcItemFavourAmount(tbBusinessBalance,
    // "XLCLF"));
    // ?
    // reportParameters.put("fixFavourAmount",this.calcItemFavourAmount(tbBusinessBalance,
    // "XLGSF"));
    // ?
    // reportParameters.put("soleFavourAmount",this.calcItemFavourAmount(tbBusinessBalance,
    // "XSJE"));
    // ??
    //reportParameters.put("subdatasource_1", new JRBeanCollectionDataSource(tbBusinessBalanceItemListSend));

    map.put("reportParameters", reportParameters);

    map.put("dataSourceList", maintianvosAdd);

    if ("?????".equals(tmCompany.getCompanyName().trim())) {

        reportParameters.put("purchaseDate",
                CommonMethod.parseDateToString(tbCarInfo.getProductDate(), "yyyy-MM-dd"));

        map.put("jrxmlPath", "/reportfiles/tbBusinessBalance_gxnndz.jrxml");

    } else if ("?".equals(tmCompany.getCompanyName().trim())) {

        map.put("jrxmlPath", "/reportfiles/tbBusinessBalance_hbhs.jrxml");
    }

    else {

        map.put("jrxmlPath", "/reportfiles/tbBusinessBalance_pre.jrxml");

    }

    map.put("reportTpl", "/tbMaintianVo_WXFL_pdf_tpl.properties");

    return map;

}

From source file:com.selfsoft.business.service.impl.TbBusinessBalanceServiceImpl.java

public Map putEntrustBalanceReportParamMap(Long id, HttpServletRequest request) {

    Map map = new HashMap();
    // ??/*w ww.j a va  2s. c  om*/
    TbBusinessBalance tbBusinessBalance = this.findById(id);
    // ?
    TbFixEntrust tbFixEntrust = tbFixEntrustService.findById(tbBusinessBalance.getTbFixEntrust().getId());
    // ?
    TbCustomer tbCustomer = tbCustomerService.findById(tbFixEntrust.getTbCustomer().getId());
    // ?
    TbCarInfo tbCarInfo = tbCarInfoService.findById(tbFixEntrust.getTbCarInfo().getId());
    // ??
    TmCompany tmCompany = tmCompanyService.acquireUniqueTmCompany();

    // ?
    List<TbFixEntrustContent> tbFixEntrustContentList = tbFixEntrustContentService
            .findTbFixEnTrustContentListByTbFixEntrustId(tbFixEntrust.getId());

    /**
     * add 2010-12-17 ccr
     */
    List<TbFixEntrustContent> tbFixEntrustContentListPage = new ArrayList<TbFixEntrustContent>();

    List<TbFixEntrustContent> tbFixEntrustContentListTemp = new ArrayList<TbFixEntrustContent>();

    List<TbFixEntrustContent> tbFixEntrustContentListAdd = new ArrayList<TbFixEntrustContent>();

    if (null != tbFixEntrustContentList && tbFixEntrustContentList.size() > 0) {

        for (int i = 0; i < tbFixEntrustContentList.size(); i++) {

            boolean flag = false;

            if (tbFixEntrustContentListTemp.size() == 0) {

                tbFixEntrustContentListTemp.add(tbFixEntrustContentList.get(i));

            } else {
                if (tbFixEntrustContentListTemp.size() > 1) {

                    for (TbFixEntrustContent _tbFixEntrustContent : tbFixEntrustContentListTemp) {

                        if (_tbFixEntrustContent.getStationName()
                                .equals(tbFixEntrustContentList.get(i).getStationName())
                                && _tbFixEntrustContent.getTbWorkingInfo().getId()
                                        .equals(tbFixEntrustContentList.get(i).getTbWorkingInfo().getId())
                                && _tbFixEntrustContent.getFreesymbol()
                                        .equals(tbFixEntrustContentList.get(i).getFreesymbol())

                        ) {

                            flag = true;

                            break;

                        }

                    }

                }

            }

            if (flag) {

                continue;

            } else {

                tbFixEntrustContentListTemp.add(tbFixEntrustContentList.get(i));

            }

            TbFixEntrustContent temp = tbFixEntrustContentList.get(i);

            TbFixEntrustContent tempCopy = new TbFixEntrustContent();

            BigDecimal d = new BigDecimal(temp.getFixHourAll());

            BigDecimal d2 = new BigDecimal(temp.getFixHour());

            for (int j = i + 1; j < tbFixEntrustContentList.size(); j++) {

                if (temp.getStationName().equals(tbFixEntrustContentList.get(j).getStationName())
                        && temp.getTbWorkingInfo().getId()
                                .equals(tbFixEntrustContentList.get(j).getTbWorkingInfo().getId())
                        && temp.getFreesymbol().equals(tbFixEntrustContentList.get(j).getFreesymbol())) {

                    d = d.add(new BigDecimal(tbFixEntrustContentList.get(j).getFixHourAll()));

                    d2 = d2.add(new BigDecimal(tbFixEntrustContentList.get(j).getFixHour()));

                }

            }

            try {
                BeanUtils.copyProperties(tempCopy, temp);
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            tempCopy.setFixHourAll(d.doubleValue());

            tempCopy.setFixHour(d2.doubleValue());

            if (!tempCopy.getFreesymbol().equals(1L)
                    || (!tempCopy.getFixHourAll().equals(0d) && tempCopy.getFreesymbol().equals(1L))) {

                tbFixEntrustContentListAdd.add(tempCopy);

            }

        }

    }

    if (tbFixEntrustContentListAdd.size() == 0) {

        TbFixEntrustContent t = new TbFixEntrustContent();

        t.setStationName("");

        tbFixEntrustContentListAdd.add(t);

    }

    // ??
    /*
    List<TbMaintianVo> maintianvos = tbMaintainPartContentService
    .getTbMaintianDetailVosByEntrustId(tbFixEntrust.getId(),
          Constants.BALANCE_ALL);
          */
    /*update by baijx ??*/
    List<TbMaintianVo> maintianvos = tbMaintainPartContentService
            .getTbMaintianDetailVosByEntrustIdPrint(tbFixEntrust.getId(), Constants.BALANCE_ALL);
    // ?
    List<TmStockOutDetVo> tmStockOutDetVos = tmStockOutService
            .getSellDetailByEntrustCode(tbFixEntrust.getEntrustCode(), Constants.BALANCE_ALL);
    // 
    List<TbBusinessBalanceItem> tbBusinessBalanceItemList = tbBusinessBalanceItemService
            .findGroupTbBusinessBalanceItemListByTbBusinessBalanceId(tbBusinessBalance.getId());

    // ???
    if (null == maintianvos) {
        maintianvos = new ArrayList<TbMaintianVo>();
    }

    if (null != tmStockOutDetVos && tmStockOutDetVos.size() > 0) {

        for (TmStockOutDetVo tmStockOutDetVo : tmStockOutDetVos) {

            TbMaintianVo tbMaintianVo = new TbMaintianVo();

            tbMaintianVo.setPartId(tmStockOutDetVo.getPartinfoId());

            tbMaintianVo.setHouseName(tmStockOutDetVo.getHouseName());

            tbMaintianVo.setPartCode(tmStockOutDetVo.getPartCode());

            tbMaintianVo.setPartName(tmStockOutDetVo.getPartName());

            tbMaintianVo.setUnitName(tmStockOutDetVo.getUnitName());

            tbMaintianVo.setPrice(tmStockOutDetVo.getPrice());

            tbMaintianVo.setPartQuantity(tmStockOutDetVo.getQuantity());

            tbMaintianVo.setTotal(tmStockOutDetVo.getTotal());

            tbMaintianVo.setIsFree(tmStockOutDetVo.getIsFree());

            maintianvos.add(tbMaintianVo);
        }

    }

    /**
     * add by ccr 2010-12-18
     */
    List<TbMaintianVo> maintianvosTemp = new ArrayList<TbMaintianVo>();

    List<TbMaintianVo> maintianvosAdd = new ArrayList<TbMaintianVo>();

    if (maintianvos.size() > 0) {

        for (int i = 0; i < maintianvos.size(); i++) {

            boolean flag = false;

            if (maintianvosTemp.size() == 0) {

                maintianvosTemp.add(maintianvos.get(i));

            } else {

                if (maintianvosTemp.size() > 1) {

                    int l = 0;

                    for (TbMaintianVo _tbMaintianVo : maintianvosTemp) {

                        if (_tbMaintianVo.getPartId().equals(maintianvos.get(i).getPartId())
                                && _tbMaintianVo.getIsFree().equals(maintianvos.get(i).getIsFree())
                                && _tbMaintianVo.getPrice().equals(maintianvos.get(i).getPrice())) {

                            // maintianvosTemp.set(l, maintianvos.get(i));

                            flag = true;

                            break;

                        }

                        l++;

                    }

                }

            }

            if (flag) {

                continue;

            } else {

                maintianvosTemp.add(maintianvos.get(i));

            }

            TbMaintianVo temp = maintianvos.get(i);

            BigDecimal d1 = new BigDecimal(temp.getPartQuantity());

            BigDecimal d2 = new BigDecimal(temp.getTotal());

            for (int j = i + 1; j < maintianvos.size(); j++) {

                if (temp.getPartId().equals(maintianvos.get(j).getPartId())
                        && temp.getIsFree().equals(maintianvos.get(j).getIsFree())
                        && temp.getPrice().equals(maintianvos.get(j).getPrice())) {

                    temp.setPrice(maintianvos.get(j).getPrice());

                    d1 = d1.add(new BigDecimal(maintianvos.get(j).getPartQuantity()));

                    d2 = d2.add(new BigDecimal(maintianvos.get(j).getTotal()));

                }

            }

            temp.setPartQuantity(d1.doubleValue());

            temp.setTotal(d2.doubleValue());

            if (!temp.getIsFree().equals(1L)
                    || (!temp.getPartQuantity().equals(0d) && temp.getIsFree().equals(1L))) {

                /*
                 * temp.setPrice(new BigDecimal(temp.getTotal()).divide(new
                 * BigDecimal(temp.getPartQuantity()),2,
                 * BigDecimal.ROUND_HALF_UP).setScale(2,
                 * BigDecimal.ROUND_HALF_UP).doubleValue());
                 */

                maintianvosAdd.add(temp);

            }

        }

    }

    TbCardHis tbCardHis = null;

    if (null != tbCardHisService.findCardHisByBalanceId(tbBusinessBalance.getId())
            && tbCardHisService.findCardHisByBalanceId(tbBusinessBalance.getId()).size() > 0) {

        tbCardHis = tbCardHisService.findCardHisByBalanceId(tbBusinessBalance.getId()).get(0);

    }

    Map reportParameters = new HashMap();
    // ??
    reportParameters.put("balanceCode", tbBusinessBalance.getBalanceCode());
    // ?
    reportParameters.put("entrustCode", tbFixEntrust.getEntrustCode());

    if (null != tbCardHis) {

        reportParameters.put("oriCardSaving", tbCardHis.getOriCardSaving());

        reportParameters.put("giveMoney", Double.valueOf(tbCardHis.getGiveMoney()));

        reportParameters.put("aftCardSaving", tbCardHis.getAftCardSaving());

    } else {

        reportParameters.put("oriCardSaving", 0.00D);

        reportParameters.put("giveMoney", 0.00D);

        reportParameters.put("aftCardSaving", 0.00D);
    }

    if (null != tmStockOutDetVos && tmStockOutDetVos.size() > 0) {
        // ??
        reportParameters.put("stockOutCode", tmStockOutDetVos.get(0).getStockOutCode());
    }

    if ("?????".equals(tmCompany.getCompanyName().trim())) {

        reportParameters.put("stockOutCode",
                CommonMethod.parseDateToString(tbFixEntrust.getFixDate(), "yyyy-MM-dd HH:mm:ss"));
    }

    // ?
    reportParameters.put("licenseCode", tbCarInfo.getLicenseCode());

    if (null != tbCarInfo.getTmCarModelType()) {
        // 
        reportParameters.put("modelType", tbCarInfo.getTmCarModelType().getModelName());
    }

    // 
    reportParameters.put("customerName", tbCustomer.getCustomerName());

    // 
    reportParameters.put("balanceDate",
            CommonMethod.parseDateToString(tbBusinessBalance.getBananceDate(), "yyyy-MM-dd"));

    // 
    reportParameters.put("payPatten", tbBusinessBalance.getPayPatternShow());

    // ?
    reportParameters.put("fixType", tbFixEntrust.getTmFixType().getFixType());

    // ?
    reportParameters.put("chassisCode", tbCarInfo.getChassisCode());

    // ??
    reportParameters.put("engineCode", tbCarInfo.getEngineCode());

    // 
    reportParameters.put("purchaseDate",
            CommonMethod.parseDateToString(tbCarInfo.getPurchaseDate(), "yyyy-MM-dd"));

    // ?
    reportParameters.put("phone",
            tbCustomer.getPhone() == null ? ""
                    : tbCustomer.getPhone().trim() + "  " + tbCustomer.getTelephone() == null ? ""
                            : tbCustomer.getTelephone().trim());

    // ?
    reportParameters.put("address", tbCustomer.getAddress());

    // 
    /*
     * reportParameters.put("kilo", tbCarInfo.getKilo() == null ? "" :
     * String .valueOf(tbCarInfo.getKilo()));
     */
    reportParameters.put("kilo", tbFixEntrust.getEnterStationKilo() == null ? ""
            : String.valueOf(tbFixEntrust.getEnterStationKilo()));

    // 
    reportParameters.put("remark", tbBusinessBalance.getRemark());

    // ??
    reportParameters.put("companyName", tmCompany.getCompanyName());

    reportParameters.put("companyAddress", tmCompany.getCompanyAddress());

    reportParameters.put("companyPhone", tmCompany.getCompanyPhone());

    reportParameters.put("companyTaxCode", tmCompany.getTaxCode());

    reportParameters.put("companyAccount", tmCompany.getCompanyAccount());

    reportParameters.put("serviceLeader", tmCompany.getServiceLeader());

    reportParameters.put("companyZipCode", tmCompany.getCompanyZipCode());

    reportParameters.put("companyBankName", tmCompany.getBankName());
    // ??

    // ?
    reportParameters.put("userRealName", tbFixEntrust.getTmUser().getUserRealName());
    // 
    reportParameters.put("jsUserRealName", tbBusinessBalance.getTmUser().getUserRealName());
    // ?
    reportParameters.put("printDate", CommonMethod.parseDateToString(new Date(), "yyyy-MM-dd HH:mm:ss"));
    // ?
    reportParameters.put("SUBREPORT_DIR", request.getRealPath("/reportfiles/") + "/");
    // ???-

    reportParameters.put("subdatasource_0", new JRBeanCollectionDataSource(tbFixEntrustContentListAdd));

    // ???-
    List<TbBusinessBalanceItem> tbBusinessBalanceItemListSend = new ArrayList<TbBusinessBalanceItem>();

    if (null != tbBusinessBalanceItemList && tbBusinessBalanceItemList.size() > 0) {

        for (TbBusinessBalanceItem tbBusinessBalanceItem : tbBusinessBalanceItemList) {

            if ("XLCLF".equals(tbBusinessBalanceItem.getBalanceItemCode())) {

                reportParameters.put("xlclf", tbBusinessBalanceItem.getBalanceItemTotal());

                continue;
            }

            if ("XLGSF".equals(tbBusinessBalanceItem.getBalanceItemCode())) {

                reportParameters.put("xlgsf", tbBusinessBalanceItem.getBalanceItemTotal());

                continue;
            }

            if ("SE".equals(tbBusinessBalanceItem.getBalanceItemCode())) {

                reportParameters.put("taxAmount", tbBusinessBalanceItem.getBalanceItemTotal());

                continue;
            }

            if ("ZJE".equals(tbBusinessBalanceItem.getBalanceItemCode())) {

                reportParameters.put("totalAmount", tbBusinessBalanceItem.getBalanceItemTotal());

                continue;
            }
            if ("XSJE".equals(tbBusinessBalanceItem.getBalanceItemCode())) {

                reportParameters.put("xsje", tbBusinessBalanceItem.getBalanceItemTotal());

                continue;
            }
            tbBusinessBalanceItemListSend.add(tbBusinessBalanceItem);

        }

    }
    // ??
    reportParameters.put("soleAmount", new BigDecimal(reportParameters.get("totalAmount").toString())
            .subtract(new BigDecimal(reportParameters.get("taxAmount").toString())).doubleValue());
    // ???
    reportParameters.put("partFavourAmount", this.calcItemFavourAmount(tbBusinessBalance, "XLCLF"));
    // ?
    reportParameters.put("fixFavourAmount", this.calcItemFavourAmount(tbBusinessBalance, "XLGSF"));
    // ?
    reportParameters.put("soleFavourAmount", this.calcItemFavourAmount(tbBusinessBalance, "XSJE"));
    // ??
    reportParameters.put("subdatasource_1", new JRBeanCollectionDataSource(tbBusinessBalanceItemListSend));

    map.put("reportParameters", reportParameters);

    map.put("dataSourceList", maintianvosAdd);

    if ("?????".equals(tmCompany.getCompanyName().trim())) {

        reportParameters.put("purchaseDate",
                CommonMethod.parseDateToString(tbCarInfo.getProductDate(), "yyyy-MM-dd"));

        map.put("jrxmlPath", "/reportfiles/tbBusinessBalance_gxnndz.jrxml");

    } else if ("?".equals(tmCompany.getCompanyName().trim())) {

        map.put("jrxmlPath", "/reportfiles/tbBusinessBalance_hbhs.jrxml");
    }

    else {

        map.put("jrxmlPath", "/reportfiles/tbBusinessBalance.jrxml");

    }

    map.put("reportTpl", "/tbMaintianVo_WXFL_pdf_tpl.properties");

    return map;

}

From source file:com.xpn.xwiki.XWiki.java

public static Object callPrivateMethod(Object obj, String methodName, Class<?>[] classes, Object[] args) {
    try {/*from  ww  w . ja  v a 2 s  .  c o m*/
        Method method = obj.getClass().getDeclaredMethod(methodName, classes);
        method.setAccessible(true);
        return method.invoke(obj, args);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
        return null;
    } catch (NoSuchMethodException e) {
        return null;
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:com.uas.document.DocumentDAO.java

@Override
public String moveDocuments(ArrayList<DocumentDTO> documents) {

    try {/*from   w ww . j a  v a  2  s. c  o m*/
        //No esta agarrando bien el origen
        if (!verificaSiEsDescendiente(documents)) {

            DocumentFacade doFac = new DocumentFacade();
            DocumentDTO documentoOriginal = new DocumentDTO();
            DocumentDTO documentoDestino = new DocumentDTO();
            try {
                BeanUtils.copyProperties(documentoOriginal, documents.get(0));
                BeanUtils.copyProperties(documentoDestino, documents.get(1));
            } catch (IllegalAccessException ex) {
                Logger.getLogger(DocumentDAO.class.getName()).log(Level.SEVERE, null, ex);
            } catch (InvocationTargetException ex) {
                Logger.getLogger(DocumentDAO.class.getName()).log(Level.SEVERE, null, ex);
            }

            ///////////////////////////////////
            documentoOriginal = doFac.getDocument(documentoOriginal);
            //System.out.println("documentoOriginal : " + documentoOriginal.getFullPathToFolder());
            //System.out.println("documentoOriginal : " + documentoOriginal.getFullPathToFolderInDeleted());
            //////////////////////////////////
            DocumentRelationshipDTO drDto = new DocumentRelationshipDTO();
            drDto.setIdDocumentChild(documentoOriginal.getId());
            DocumentRelationshipFacade fac = new DocumentRelationshipFacade();
            fac.deleteDocumentRelationship(drDto);
            ///////////////////////////////////
            if (documentoDestino.getId() == documentoOriginal.getId()) {
                return null;
            }
            if (documentoDestino.getId() != 1) {

                try {
                    BeanUtils.copyProperties(documentoDestino, doFac.getDocument(documentoDestino));
                } catch (IllegalAccessException ex) {
                    Logger.getLogger(DocumentDAO.class.getName()).log(Level.SEVERE, null, ex);
                } catch (InvocationTargetException ex) {
                    Logger.getLogger(DocumentDAO.class.getName()).log(Level.SEVERE, null, ex);
                }
                if (documentoOriginal.getIdArea() != documentoDestino.getIdArea()) {

                    documentoOriginal.setIdArea(documentoDestino.getIdArea());
                    if (documentoOriginal.getIsFolder()) {
                        getAllDescendants(documentoOriginal);
                    }

                    doFac.updateDocument2ParaMove(documentoOriginal);

                }

                drDto = new DocumentRelationshipDTO();
                drDto.setIdDocumentChild(documentoOriginal.getId());
                drDto.setIdDocumentParent(documentoDestino.getId());
                fac.createDocumentRelationship(drDto);
            } else {

                PropertiesFacade pDto = new PropertiesFacade();
                String pathTrash = pDto.obtenerValorPropiedad("pathForTrash");
                String fullPathOriginal = pDto.obtenerValorPropiedad("pathForFiles");

                documentoDestino
                        .setFullPathToFolder(fullPathOriginal + documentoOriginal.getArea().getFolderName());
                documentoDestino
                        .setFullPathToFolderInDeleted(pathTrash + documentoOriginal.getArea().getFolderName());

            }

            String pathOrigen = "";
            String pathDestino = "";

            if (documentoOriginal.getAscendenteBorrado()) {
                pathOrigen = documentoOriginal.getFullPathToFolderInDeleted();
            } else {
                pathOrigen = documentoOriginal.getFullPathToFolder();
            }

            //Si el documento origen esta borrado...
            //checar si es necesario que los de documento original
            if (documentoDestino.getAscendenteBorrado() || documentoOriginal.getDeleted()) {
                pathDestino = documentoDestino.getFullPathToFolderInDeleted() + "/"
                        + documentoOriginal.getFilename();

            } else {
                pathDestino = documentoDestino.getFullPathToFolder() + "/" + documentoOriginal.getFilename();

            }
            FilesFacade fFac = new FilesFacade();
            if (fFac.verificaSiExiste(pathDestino)) {
                File f = fFac.getUniqueFilename(new File(pathDestino));
                pathDestino = f.getAbsolutePath();
                String nuevoFileName = pathDestino.substring(pathDestino.lastIndexOf("/") + 1,
                        pathDestino.length());
                documentoOriginal.setFilename(nuevoFileName);
                doFac.updateDocumentFilename(documentoOriginal);
            }

            Files.createDirectories(Paths.get(pathDestino).getParent());
            Files.move(Paths.get(pathOrigen), Paths.get(pathDestino));
            documentoDestino.setBackedUp(false);
            doFac.updateDocument2ParaMove(documentoDestino);
            return "success";
        }

    } catch (Exception ex) {
        ex.printStackTrace();
    }
    //System.out.println("Error");
    return "error1";
}

From source file:com.yucheng.cmis.pvp.app.component.PvpAuthorizeComponent.java

/**
 * ??????????????/*from  www. j  a v a 2  s  .  co m*/
 * 
 * @param pvpSerno
 *            ??
 * @throws EMPException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 * @throws Exception
 * @since 2009-09-17
 * @author modified by zhangwei
 */
public String addPvpTfCvrgExtAuthorize(String pvpSerno)
        throws EMPException, IllegalAccessException, InvocationTargetException {

    String strReturnMessage = CMISMessage.ADDDEFEAT;
    PvpTfIface pvpTfIface = (PvpTfIface) this.getComponentInterface("PvpTfImpl");
    PvpAuthorizeAgent pvpAuthorizeAgent = (PvpAuthorizeAgent) this.getAgentInstance(PUBConstant.PVPAUTHORIZE);
    PvpTfCvrgExt pvpTfCvrgExt = new PvpTfCvrgExt();

    //??
    pvpTfCvrgExt = pvpTfIface.queryPvpTfCvrgExtBySerNo(pvpSerno);
    if (pvpTfCvrgExt == null || pvpTfCvrgExt.getContNo() == null) {
        System.out.println("???");
        return strReturnMessage;
    }

    // ??
    CustomIface customIface = (CustomIface) this.getComponentInterface(CusPubConstant.CUS_IFACE);
    CusBase cusBase = customIface.getCusBase(pvpTfCvrgExt.getCusId());
    String transCusId = cusBase.getTransCusId();

    //????
    CtrTfCvrgExt ctrTfCvrgExt = null;
    CtrTfCvrgExtComponent ctrTfCvrgExtComponent = (CtrTfCvrgExtComponent) this.getComponent("CtrTfCvrgExt");
    ctrTfCvrgExt = ctrTfCvrgExtComponent.queryCtrTfCvrgExtDetail(pvpTfCvrgExt.getContNo());

    //???
    AccTfCvrg accTfCvrg = null;
    AccTfCvrgComponent accTfCvrgComponent = (AccTfCvrgComponent) this.getComponent("AccTfCvrg");
    accTfCvrg = accTfCvrgComponent.queryAccTfCvrgByContNoAndCondition(ctrTfCvrgExt.getOldContNo());

    AccTfCommComponent accTfCommComponent = (AccTfCommComponent) this.getComponent(PUBConstant.ACCTFCOMM);
    AccTfComm accTfCommIns = new AccTfComm();
    accTfCommIns = accTfCommComponent.findAccTfCommByBillNo(ctrTfCvrgExt.getOldBillNo());
    //?
    accTfCommComponent.checkConditionBeforeAuthorize("PvpTfCvrgExt", pvpSerno, ctrTfCvrgExt.getContNo());

    Context context = this.getContext();
    Connection connection = this.getConnection();
    CMISSequenceService sequenceService = (CMISSequenceService) context.getService("sequenceService");
    String loanNo = sequenceService.getSequence(TradeCodeConstant.SERNONC, "44", context, connection);

    //???
    String[] billZero = { "", "00", "0", "" };
    int billSeqCtr = ctrTfCvrgExt.getBillSeq();
    String billSeq = String.valueOf(billSeqCtr);
    billSeq = billZero[billSeq.length()] + billSeq;
    String billNo = pvpTfCvrgExt.getContNo() + billSeq; // ??? ??????
    billSeqCtr++;
    ctrTfCvrgExt.setBillSeq(billSeqCtr);

    PvpAuthorize pvpAuthorize = new PvpAuthorize();
    pvpAuthorize.setSerno(pvpSerno);
    pvpAuthorize.setLoanNo(loanNo);
    pvpAuthorize.setCusManager(pvpTfCvrgExt.getCusManager());
    pvpAuthorize.setInputBrId(pvpTfCvrgExt.getInputBrId());
    pvpAuthorize.setFinaBrId(pvpTfCvrgExt.getFinaBrId());
    pvpAuthorize.setCusId(pvpTfCvrgExt.getCusId());
    pvpAuthorize.setCusName(pvpTfCvrgExt.getCusName());
    pvpAuthorize.setContNo(pvpTfCvrgExt.getContNo());
    pvpAuthorize.setBillNo(billNo);
    pvpAuthorize.setTradeAmount(pvpTfCvrgExt.getApplyAmount());
    pvpAuthorize.setTradeDate(this.getOpenDay());
    pvpAuthorize.setTradeStatus(TradeCodeConstant.WTZ);
    pvpAuthorize.setTradeCode("0034");
    pvpAuthorize.setFieldNum(26);

    //
    pvpAuthorize.setFldvalue01("c@loanNo@" + loanNo); //?
    pvpAuthorize.setFldvalue02("c@contSerno@" + billNo); //????
    pvpAuthorize.setFldvalue03("c@contNo@" + pvpTfCvrgExt.getContNo()); //???
    pvpAuthorize.setFldvalue04("c@cusId@" + pvpTfCvrgExt.getCusId()); //?
    pvpAuthorize.setFldvalue05("c@cusName@" + pvpTfCvrgExt.getCusName()); //??
    pvpAuthorize.setFldvalue06("c@bizType@" + "0034"); //??
    pvpAuthorize.setFldvalue07("c@CurType@" + pvpTfCvrgExt.getApplyCurType()); //???
    pvpAuthorize.setFldvalue08("c@Amount@" + pvpTfCvrgExt.getNewApplyAmount()); //?
    pvpAuthorize.setFldvalue09("c@startDate@" + (String) context.getDataValue("OPENDAY")); //(?)
    pvpAuthorize.setFldvalue10("c@dueDate@" + pvpTfCvrgExt.getNewDueDate()); //?
    pvpAuthorize.setFldvalue11("c@note@" + ""); //
    pvpAuthorize.setFldvalue12("c@applyOrg@" + pvpTfCvrgExt.getFinaBrId()); //
    pvpAuthorize.setFldvalue13("c@inputDate@" + (String) context.getDataValue("OPENDAY")); //

    //?
    pvpAuthorize.setFldvalue14("c@iocNo@" + accTfCommIns.getSernoInternation()); //?
    pvpAuthorize.setFldvalue15("c@applyTerm@" + " ");
    //pvpAuthorize.setFldvalue16("c@securityMoneyRt@" + pvpTfCvrgExt.getSecurityMoneyRt());
    DecimalFormat df = new DecimalFormat("#0.00");//??
    pvpAuthorize.setFldvalue16("c@securityMoneyRt@" + 100 * pvpTfCvrgExt.getSecurityMoneyRt()); //??
    List<TfSecurityMsg> securitylist = ctrTfCvrgExtComponent.querySecurityByCont(pvpTfCvrgExt.getContNo()); //?????

    if (securitylist.size() == 0) {
        pvpAuthorize.setFldvalue17("c@securityMoneyAcNo@" + " "); //???1
        pvpAuthorize.setFldvalue18("c@securityMoneyAmt@" + " "); //???1
        pvpAuthorize.setFldvalue19("c@securityMoneyCur@" + " ");
        pvpAuthorize.setFldvalue20("c@securityMoneyType@" + " "); //???1
        pvpAuthorize.setFldvalue21("c@securityMoneyDueDate@" + " ");

        pvpAuthorize.setFldvalue22("c@securityMoneyAcNo1@" + " "); //???2
        pvpAuthorize.setFldvalue23("c@securityMoneyAmt1@" + " "); //???2
        pvpAuthorize.setFldvalue24("c@securityMoneyCur1@" + " "); //????2
        pvpAuthorize.setFldvalue25("c@securityMoneyType1@" + " "); //???1
        pvpAuthorize.setFldvalue26("c@securityMoneyDueDate1@" + " "); //????2
    } else if (securitylist.size() == 1) {
        TfSecurityMsg tfmsg = (TfSecurityMsg) securitylist.get(0);
        pvpAuthorize.setFldvalue17("c@securityMoneyAcNo@" + tfmsg.getSecurityMoneyAcNo());
        pvpAuthorize.setFldvalue18("c@securityMoneyAmt@" + df.format(tfmsg.getSecurityMoneyAmt()));
        pvpAuthorize.setFldvalue19("c@securityMoneyCur@" + tfmsg.getSecurityMoneyCur());
        pvpAuthorize.setFldvalue20("c@securityMoneyType@" + tfmsg.getSecurityMoneyType());
        pvpAuthorize.setFldvalue21("c@securityMoneyDueDate@" + tfmsg.getSecurityMoneyDueDate());

        pvpAuthorize.setFldvalue22("c@securityMoneyAcNo1@" + " ");
        pvpAuthorize.setFldvalue23("c@securityMoneyAmt1@" + " ");
        pvpAuthorize.setFldvalue24("c@securityMoneyCur1@" + " ");
        pvpAuthorize.setFldvalue25("c@securityMoneyType1@" + " ");
        pvpAuthorize.setFldvalue26("c@securityMoneyDueDate1@" + " "); //????2
    } else if (securitylist.size() == 2) {
        TfSecurityMsg tfmsg = (TfSecurityMsg) securitylist.get(0);
        pvpAuthorize.setFldvalue17("c@securityMoneyAcNo@" + tfmsg.getSecurityMoneyAcNo());
        pvpAuthorize.setFldvalue18("c@securityMoneyAmt@" + df.format(tfmsg.getSecurityMoneyAmt()));
        pvpAuthorize.setFldvalue19("c@securityMoneyCur@" + tfmsg.getSecurityMoneyCur());
        pvpAuthorize.setFldvalue20("c@securityMoneyType@" + tfmsg.getSecurityMoneyType());
        pvpAuthorize.setFldvalue21("c@securityMoneyDueDate@" + tfmsg.getSecurityMoneyDueDate());

        TfSecurityMsg tfmsg2 = (TfSecurityMsg) securitylist.get(1);
        pvpAuthorize.setFldvalue22("c@securityMoneyAcNo1@" + tfmsg2.getSecurityMoneyAcNo());
        pvpAuthorize.setFldvalue23("c@securityMoneyAmt1@" + df.format(tfmsg2.getSecurityMoneyAmt()));
        pvpAuthorize.setFldvalue24("c@securityMoneyCur1@" + tfmsg2.getSecurityMoneyCur());
        pvpAuthorize.setFldvalue25("c@securityMoneyType1@" + tfmsg2.getSecurityMoneyType());
        pvpAuthorize.setFldvalue26("c@securityMoneyDueDate1@" + tfmsg2.getSecurityMoneyDueDate());
    }

    strReturnMessage = pvpAuthorizeAgent.insertPvpAuthorize(pvpAuthorize);
    if (!strReturnMessage.equals(CMISMessage.ADDSUCCEESS)) {
        System.out.println("???");
        return strReturnMessage;
    }

    //????
    AccTfCvrgExt accTfCvrgExt = new AccTfCvrgExt();
    AccTfCvrgExtAgent accTfCvrgExtAgent = (AccTfCvrgExtAgent) this.getAgentInstance(PUBConstant.ACCTFCVRGEXT);
    BeanUtilsBean bub = new BeanUtilsBean();
    try {
        bub.copyProperties(accTfCvrgExt, pvpTfCvrgExt);
    } catch (IllegalAccessException e) {
        new ComponentException("?????");
    } catch (InvocationTargetException e) {
        new ComponentException("?????");
    }
    accTfCvrgExt.setLoanForm4("10");
    accTfCvrgExt.setCla("10");
    accTfCvrgExt.setBillNo(billNo);
    accTfCvrgExt.setAccountStatus("0");
    accTfCvrgExt.setLoanAmount(pvpTfCvrgExt.getApplyAmount());
    accTfCvrgExt.setLoanBalance(pvpTfCvrgExt.getApplyAmount());
    accTfCvrgExtAgent.insertAccTfCvrgExt(accTfCvrgExt);

    //????

    AccTfComm accTfComm = new AccTfComm();
    try {
        bub.copyProperties(accTfComm, accTfCvrgExt);
    } catch (IllegalAccessException e) {
        new ComponentException("?????");
    } catch (InvocationTargetException e) {
        new ComponentException("?????");
    }
    accTfComm.setLimitAccNo(accTfCvrgExt.getLimitAccNo());
    accTfComm.setApplyAmount(accTfCvrgExt.getNewApplyAmount());
    accTfComm.setLoanAmount(accTfCvrgExt.getNewApplyAmount());
    try {
        accTfCommComponent.addAccTfComm(accTfComm);
    } catch (Exception e) {
        accTfCommComponent.updateDomain(accTfComm);
    }

    //
    pvpTfCvrgExt.setChargeoffStatus(Constant.PVPSTATUS3);
    pvpTfCvrgExt.setBillNo(billNo);
    pvpTfIface.updatePvpTfCvrgExt(pvpTfCvrgExt);

    //?????
    ctrTfCvrgExtComponent.modifyCtrTfCvrgExt(ctrTfCvrgExt);

    //
    try {
        //???
        CreditBusinessQuartzService cbqService = new CreditBusinessQuartzService();
        cbqService.queryAccreditNotice(connection, context);
    } catch (Exception e) {
        e.printStackTrace();
        throw new ComponentException("??" + e.getMessage());
    }

    return strReturnMessage;
}

From source file:com.yucheng.cmis.pvp.app.component.PvpAuthorizeComponent.java

/**
 * ??????????????/*w  ww  .ja v  a  2s  . c  o m*/
 * 
 * @param pvpSerno
 *            ??
 * @throws EMPException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 * @throws Exception
 * @since 2009-09-17
 * @author modified by zhangwei
 */
public String addPvpTfFftAuthorize(String pvpSerno)
        throws EMPException, IllegalAccessException, InvocationTargetException {

    String strReturnMessage = CMISMessage.ADDDEFEAT;

    //?
    PvpTfFftComponent pvpTfFftComponent = (PvpTfFftComponent) this.getComponent("PvpTfFft");
    PvpTfFft pvpTfFft = new PvpTfFft();
    pvpTfFft = pvpTfFftComponent.queryPvpTfFftBySerNo(pvpSerno);
    if (pvpTfFft == null || pvpTfFft.getContNo() == null) {
        return strReturnMessage;
    }

    //??
    //      CustomIface customIface = (CustomIface) this.getComponentInterface(CusPubConstant.CUS_IFACE);
    //      CusBase cusBase = customIface.getCusBase(pvpTfFft.getCusId());
    //      String transCusId = cusBase.getTransCusId();

    //????
    CtrTfFft ctrTfFft = new CtrTfFft();
    CtrTfLocImpl ctrTfLocImpl = (CtrTfLocImpl) this.getComponentInterface("CtrTfLoc");
    ctrTfFft = ctrTfLocImpl.getCtrTfFft(pvpTfFft.getContNo());
    if (ctrTfFft == null) {
        System.out.println("????????");
        return strReturnMessage;
    }

    //?
    AccTfCommComponent accTfCommComponent = (AccTfCommComponent) this.getComponent(PUBConstant.ACCTFCOMM);
    accTfCommComponent.checkConditionBeforeAuthorize("PvpTfFft", pvpSerno, ctrTfFft.getContNo());
    // ???
    //CMISSequenceService sequenceService = (CMISSequenceService) context.getService("sequenceService");
    //String orgId = pvpTfOinvf.getInputBrId();
    //billNo = sequenceService.getSequence(orgId, "fromOrg", 15, context);
    //String loanNo = sequenceService.getSequence("CZ", "fromDate", 15, context);
    //loanNo = loanNo.substring(2);

    Context context = this.getContext();
    Connection connection = this.getConnection();
    CMISSequenceService sequenceService = (CMISSequenceService) context.getService("sequenceService");
    String loanNo = sequenceService.getSequence(TradeCodeConstant.SERNONC, "44", context, connection);

    //???
    String[] billZero = { "", "00", "0", "" };
    int billSeqCtr = ctrTfFft.getBillSeq();
    String billSeq = String.valueOf(billSeqCtr);
    billSeq = billZero[billSeq.length()] + billSeq;
    String billNo = pvpTfFft.getContNo() + billSeq; // ??? ??????
    billSeqCtr++;
    ctrTfFft.setBillSeq(billSeqCtr);

    //???
    PvpAuthorize pvpAuthorize = new PvpAuthorize();

    pvpAuthorize.setSerno(pvpSerno);
    pvpAuthorize.setLoanNo(loanNo);
    pvpAuthorize.setCusManager(pvpTfFft.getCusManager());
    pvpAuthorize.setInputBrId(pvpTfFft.getInputBrId());
    pvpAuthorize.setFinaBrId(pvpTfFft.getFinaBrId());
    pvpAuthorize.setCusId(pvpTfFft.getCusId());
    pvpAuthorize.setCusName(pvpTfFft.getCusName());
    pvpAuthorize.setContNo(pvpTfFft.getContNo());
    pvpAuthorize.setBillNo(billNo);
    pvpAuthorize.setTradeAmount(pvpTfFft.getApplyAmount());
    pvpAuthorize.setTradeDate(this.getOpenDay());
    pvpAuthorize.setTradeStatus(TradeCodeConstant.WTZ);
    pvpAuthorize.setTradeCode("0014");
    pvpAuthorize.setFieldNum(25);

    //
    pvpAuthorize.setFldvalue01("c@loanNo@" + loanNo); //?
    pvpAuthorize.setFldvalue02("c@contSerno@" + billNo); //????
    pvpAuthorize.setFldvalue03("c@contNo@" + pvpTfFft.getContNo()); //???
    pvpAuthorize.setFldvalue04("c@cusId@" + pvpTfFft.getCusId()); //?
    pvpAuthorize.setFldvalue05("c@cusName@" + pvpTfFft.getCusName()); //??
    pvpAuthorize.setFldvalue06("c@bizType@" + "0014"); //??
    pvpAuthorize.setFldvalue07("c@CurType@" + pvpTfFft.getApplyCurType()); //???
    pvpAuthorize.setFldvalue08("c@Amount@" + pvpTfFft.getApplyAmount()); //?
    pvpAuthorize.setFldvalue09("c@startDate@" + (String) context.getDataValue("OPENDAY")); //(?)
    pvpAuthorize.setFldvalue10("c@dueDate@" + checkNull(pvpTfFft.getDueDate())); //?
    pvpAuthorize.setFldvalue11("c@note@" + ""); //
    pvpAuthorize.setFldvalue12("c@applyOrg@" + pvpTfFft.getFinaBrId()); //
    pvpAuthorize.setFldvalue13("c@inputDate@" + (String) context.getDataValue("OPENDAY")); //

    //?
    //1  2?  3
    String no = "";
    String fftType = "";
    String bizTypeSub = pvpTfFft.getBizTypeSub();
    if (bizTypeSub.equals("BMTH")) {
        no = pvpTfFft.getPriceNo();
        fftType = "3";
    } else if (bizTypeSub.equals("ZMTH")) {
        no = pvpTfFft.getPriceNo();
        fftType = "2";
    } else if (bizTypeSub.equals("ZXMR")) {
        no = pvpTfFft.getBpNo();
        fftType = "1";
    } else
        throw new ComponentException("?[" + bizTypeSub + "]");

    DecimalFormat sf = new DecimalFormat("#");
    pvpAuthorize.setFldvalue14("c@bpNo@" + checkNull(no));
    pvpAuthorize.setFldvalue15("c@fftType@" + checkNull(fftType));
    pvpAuthorize.setFldvalue16("c@enterAccount@" + checkNull(pvpTfFft.getEntAccNo()));
    pvpAuthorize.setFldvalue17("c@billCurType@" + checkNull(pvpTfFft.getApplyCurType()));
    pvpAuthorize.setFldvalue18("c@billAmt@" + pvpTfFft.getApplyAmount());
    pvpAuthorize.setFldvalue19("c@applyTerm@" + String.valueOf(sf.format(pvpTfFft.getApplyTerm())));
    pvpAuthorize.setFldvalue20("c@graceTerm@" + String.valueOf(sf.format(pvpTfFft.getDaysOfGrace())));
    DecimalFormat df = new DecimalFormat("#.000000");
    pvpAuthorize.setFldvalue21("c@discRate@" + df.format(pvpTfFft.getRealityIrY() * 100));
    pvpAuthorize.setFldvalue22("c@bearTerm@" + String.valueOf(sf.format(pvpTfFft.getBearDays())));
    pvpAuthorize.setFldvalue23("c@bearRate@" + df.format(pvpTfFft.getBearRate() * 100));
    pvpAuthorize.setFldvalue24("c@withholdingFee@" + pvpTfFft.getPreAmount());
    pvpAuthorize.setFldvalue25("c@chargeFee@" + pvpTfFft.getFeeAmt());

    //?????,? modified by wxy 20110108
    int appterm = 0;
    String dueDate;
    if (!this.getOpenDay().equals(pvpTfFft.getStartDate())) {

        appterm = (int) pvpTfFft.getApplyTerm();
        dueDate = TimeUtil.ADD_DAY(this.getOpenDay(), appterm);

        pvpTfFft.setStartDate(this.getOpenDay());
        pvpTfFft.setDueDate(dueDate);

        ctrTfFft.setStartDate(this.getOpenDay());
        ctrTfFft.setDueDate(dueDate);

        pvpAuthorize.setFldvalue10("c@dueDate@" + dueDate);

    }

    //??
    PvpAuthorizeAgent pvpAuthorizeAgent = (PvpAuthorizeAgent) this.getAgentInstance(PUBConstant.PVPAUTHORIZE);
    strReturnMessage = pvpAuthorizeAgent.insertPvpAuthorize(pvpAuthorize);
    if (!strReturnMessage.equals(CMISMessage.ADDSUCCEESS)) {
        System.out.println("???");
        return strReturnMessage;
    }

    AccTfFft accTfFft = new AccTfFft();
    AccTfFftAgent AccTfFftAgent = (AccTfFftAgent) this.getAgentInstance("AccTfFft");
    BeanUtilsBean bub = new BeanUtilsBean();
    try {
        bub.copyProperties(accTfFft, pvpTfFft);
    } catch (IllegalAccessException e) {
        new ComponentException("??????");
    } catch (InvocationTargetException e) {
        new ComponentException("??????");
    }
    accTfFft.setLoanForm4("10");
    accTfFft.setCla("10");
    accTfFft.setBillNo(billNo);
    accTfFft.setAccountStatus("0");
    accTfFft.setMainBrId(pvpTfFft.getInvestigatorBrId());
    accTfFft.setLoanAmount(pvpTfFft.getApplyAmount());
    accTfFft.setLoanBalance(pvpTfFft.getApplyAmount());
    AccTfFftAgent.insertAccTfFft(accTfFft);

    //???

    AccTfComm accTfComm = new AccTfComm();
    try {
        bub.copyProperties(accTfComm, accTfFft);
    } catch (IllegalAccessException e) {
        new ComponentException("????");
    } catch (InvocationTargetException e) {
        new ComponentException("????");
    }
    accTfComm.setSendDate(this.getOpenDay());
    try {
        accTfCommComponent.addAccTfComm(accTfComm);
    } catch (Exception e) {
        accTfCommComponent.updateDomain(accTfComm);
    }

    //
    pvpTfFft.setChargeoffStatus(Constant.PVPSTATUS3);
    pvpTfFftComponent.updatePvpTfFft(pvpTfFft);

    //???
    ctrTfLocImpl.modifyCtrTfFft(ctrTfFft);

    //
    try {
        /*??
        IndexedCollection icoll = cbqService.queryAccreditNotice4Trade(
              loanNo, connection, connection, context);
        KeyedCollection reqPkg = (KeyedCollection) icoll.get(0);
                
        String hostSerNo = (String) reqPkg.get("hostSerNo").toString()
              .trim();
        pvpAuthorize.setHostSerno(hostSerNo);
        pvpAuthorize.setTradeStatus(TradeCodeConstant.YTZ);
        pvpAuthorizeAgent.modifyCMISDomain(pvpAuthorize, "PvpAuthorize");
           */

        CreditBusinessQuartzService cbqService = new CreditBusinessQuartzService();
        cbqService.queryAccreditNotice(connection, context);
    } catch (Exception e) {
        e.printStackTrace();
        throw new ComponentException("??" + e.getMessage());
    }

    return strReturnMessage;
}

From source file:com.yucheng.cmis.pvp.app.component.PvpAuthorizeComponent.java

/**
 * ????????????????/*from   w ww.  j  av  a2 s.  c  o  m*/
 * 
 * @param pvpSerno
 *            ??
 * @throws EMPException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 * @throws Exception
 * @since 2009-09-17
 * @author modified by zhangwei
 */
public String addPvpTfOiffAuthorize(String pvpSerno)
        throws EMPException, IllegalAccessException, InvocationTargetException {

    String strReturnMessage = CMISMessage.ADDDEFEAT;

    //??
    PvpTfOiffComponent pvpTfOiffComponent = (PvpTfOiffComponent) this.getComponent("PvpTfOiff");
    PvpTfOiff pvpTfOiff = new PvpTfOiff();
    pvpTfOiff = pvpTfOiffComponent.queryPvpTfOiff(pvpSerno);
    if (pvpTfOiff == null || pvpTfOiff.getContNo() == null) {
        return strReturnMessage;
    }

    //??
    CustomIface customIface = (CustomIface) this.getComponentInterface(CusPubConstant.CUS_IFACE);
    CusBase cusBase = customIface.getCusBase(pvpTfOiff.getCusId());
    String transCusId = cusBase.getTransCusId();

    //????
    CtrTfOiff ctrTfOiff = null;
    CtrTfOiffComponent ctrTfOiffComponent = (CtrTfOiffComponent) this.getComponent("CtrTfOiff");
    ctrTfOiff = ctrTfOiffComponent.queryCtrTfOiff(pvpTfOiff.getContNo());

    //?
    AccTfCommComponent accTfCommComponent = (AccTfCommComponent) this.getComponent(PUBConstant.ACCTFCOMM);
    accTfCommComponent.checkConditionBeforeAuthorize("PvpTfOiff", pvpSerno, ctrTfOiff.getContNo());

    // ?????
    //CMISSequenceService sequenceService = (CMISSequenceService) context.getService("sequenceService");
    //String orgId = pvpTfOiff.getInputBrId();
    //billNo = sequenceService.getSequence(orgId, "fromOrg", 15, context);
    //String loanNo = sequenceService.getSequence("CZ", "fromDate", 15, context);
    //loanNo = loanNo.substring(2);

    //???
    Context context = this.getContext();
    Connection connection = this.getConnection();
    CMISSequenceService sequenceService = (CMISSequenceService) context.getService("sequenceService");
    String loanNo = sequenceService.getSequence(TradeCodeConstant.SERNONC, "44", context, connection);

    //???
    String[] billZero = { "", "00", "0", "" };
    int billSeqCtr = ctrTfOiff.getBillSeq();
    String billSeq = String.valueOf(billSeqCtr);
    billSeq = billZero[billSeq.length()] + billSeq;
    String billNo = pvpTfOiff.getContNo() + billSeq; // ??? ??????
    billSeqCtr++;
    ctrTfOiff.setBillSeq(billSeqCtr);

    PvpAuthorize pvpAuthorize = new PvpAuthorize();
    pvpAuthorize.setSerno(pvpSerno);
    pvpAuthorize.setLoanNo(loanNo);
    pvpAuthorize.setCusManager(pvpTfOiff.getCusManager());
    pvpAuthorize.setInputBrId(pvpTfOiff.getInputBrId());
    pvpAuthorize.setFinaBrId(pvpTfOiff.getFinaBrId());
    pvpAuthorize.setCusId(pvpTfOiff.getCusId());
    pvpAuthorize.setCusName(pvpTfOiff.getCusName());
    pvpAuthorize.setContNo(pvpTfOiff.getContNo());
    pvpAuthorize.setBillNo(billNo);
    pvpAuthorize.setTradeAmount(pvpTfOiff.getApplyAmount());
    pvpAuthorize.setTradeDate(this.getOpenDay());
    pvpAuthorize.setTradeStatus(TradeCodeConstant.WTZ);
    pvpAuthorize.setTradeCode("0019");
    pvpAuthorize.setFieldNum(17);

    //
    pvpAuthorize.setFldvalue01("c@loanNo@" + loanNo); //?
    pvpAuthorize.setFldvalue02("c@contSerno@" + billNo); //????
    pvpAuthorize.setFldvalue03("c@contNo@" + pvpTfOiff.getContNo()); //???
    pvpAuthorize.setFldvalue04("c@cusId@" + pvpTfOiff.getCusId()); //?
    pvpAuthorize.setFldvalue05("c@cusName@" + pvpTfOiff.getCusName()); //??
    pvpAuthorize.setFldvalue06("c@bizType@" + "0019"); //??
    pvpAuthorize.setFldvalue07("c@CurType@" + pvpTfOiff.getApplyCurType()); //???
    pvpAuthorize.setFldvalue08("c@Amount@" + pvpTfOiff.getApplyAmount()); //?
    pvpAuthorize.setFldvalue09("c@startDate@" + (String) context.getDataValue("OPENDAY")); //(?)
    pvpAuthorize.setFldvalue10("c@dueDate@" + checkNull(pvpTfOiff.getDueDate())); //?
    pvpAuthorize.setFldvalue11("c@note@" + ""); //
    pvpAuthorize.setFldvalue12("c@applyOrg@" + pvpTfOiff.getFinaBrId()); //
    pvpAuthorize.setFldvalue13("c@inputDate@" + (String) context.getDataValue("OPENDAY")); //

    //?
    pvpAuthorize.setFldvalue14("c@ifNo@" + checkNull(pvpTfOiff.getIfNo())); //???          
    DecimalFormat df = new DecimalFormat("#.000000");
    pvpAuthorize.setFldvalue15("c@realityIrY@" + df.format(pvpTfOiff.getRealityIrY() * 100)); //  
    pvpAuthorize.setFldvalue16("c@enterAccount@" + checkNull(pvpTfOiff.getEnterAccount())); //?          
    pvpAuthorize.setFldvalue17("c@intCalType@" + pvpTfOiff.getIntCalType()); //?          

    //?????,? modified by wxy 20110108
    int appterm = 0;
    String dueDate;
    if (!this.getOpenDay().equals(pvpTfOiff.getStartDate())) {
        System.out.println("------------openday----" + this.getOpenDay());
        appterm = (int) pvpTfOiff.getApplyTerm();
        dueDate = TimeUtil.ADD_DAY(this.getOpenDay(), appterm);

        pvpTfOiff.setStartDate(this.getOpenDay());
        pvpTfOiff.setDueDate(dueDate);
        //pvpTfOiffComponent.updatePvpTfOiff(pvpTfOiff);

        ctrTfOiff.setStartDate(this.getOpenDay());
        ctrTfOiff.setDueDate(dueDate);
        // ctrTfOiffComponent.modifyCtrTfOiff(ctrTfOiff);
        pvpAuthorize.setFldvalue10("c@dueDate@" + dueDate);

    }

    //??
    PvpAuthorizeAgent pvpAuthorizeAgent = (PvpAuthorizeAgent) this.getAgentInstance(PUBConstant.PVPAUTHORIZE);
    strReturnMessage = pvpAuthorizeAgent.insertPvpAuthorize(pvpAuthorize);
    if (!strReturnMessage.equals(CMISMessage.ADDSUCCEESS)) {
        return strReturnMessage;
    }

    //??????
    AccTfOiff accTfOiff = new AccTfOiff();
    AccTfOiffAgent accTfOiffAgent = (AccTfOiffAgent) this.getAgentInstance("AccTfOiff");
    BeanUtilsBean bub = new BeanUtilsBean();
    try {
        bub.copyProperties(accTfOiff, pvpTfOiff);
    } catch (IllegalAccessException e) {
        new ComponentException("???????");
    } catch (InvocationTargetException e) {
        new ComponentException("???????");
    }

    accTfOiff.setBillNo(billNo);
    accTfOiff.setAccountStatus("0");
    accTfOiff.setMainBrId(pvpTfOiff.getInvestigatorBrId());
    accTfOiff.setLoanAmount(pvpTfOiff.getApplyAmount());
    accTfOiff.setLoanBalance(pvpTfOiff.getApplyAmount());
    accTfOiffAgent.insertAccTfOiff(accTfOiff);

    //????

    AccTfComm accTfComm = new AccTfComm();
    try {
        bub.copyProperties(accTfComm, accTfOiff);

    } catch (IllegalAccessException e) {
        new ComponentException("??????");
    } catch (InvocationTargetException e) {
        new ComponentException("??????");
    }

    accTfComm.setLimitAccNo(accTfOiff.getLimitAccNo());
    accTfComm.setSendDate(this.getOpenDay());
    try {
        accTfCommComponent.addAccTfComm(accTfComm);
    } catch (Exception e) {
        accTfCommComponent.updateDomain(accTfComm);
    }

    //
    pvpTfOiff.setChargeoffStatus(Constant.PVPSTATUS3);
    pvpTfOiff.setBillNo(billNo);
    pvpTfOiffComponent.updatePvpTfOiff(pvpTfOiff);

    //?????
    ctrTfOiffComponent.modifyCtrTfOiff(ctrTfOiff);

    try {
        /*??
        IndexedCollection icoll = cbqService.queryAccreditNotice4Trade(loanNo, connection, connection, context);
        KeyedCollection reqPkg = (KeyedCollection) icoll.get(0);
        String hostSerNo = (String) reqPkg.get("hostSerNo").toString().trim();
        pvpAuthorize.setHostSerno(hostSerNo);
        pvpAuthorize.setTradeStatus(TradeCodeConstant.YTZ);
        pvpAuthorizeAgent.modifyCMISDomain(pvpAuthorize, "PvpAuthorize");
         */
        CreditBusinessQuartzService cbqService = new CreditBusinessQuartzService();
        cbqService.queryAccreditNotice(connection, context);
    } catch (Exception e) {
        e.printStackTrace();
        throw new ComponentException("?????" + e.getMessage());
    }

    return strReturnMessage;
}

From source file:com.yucheng.cmis.pvp.app.component.PvpAuthorizeComponent.java

/**
 * ??????????????/* w ww.  ja  v  a 2s .  co  m*/
 * 
 * @param pvpSerno
 *            ??
 * @throws EMPException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 * @throws Exception
 * @since 2009-09-17
 * @author modified by zhangwei
 */
public String addPvpTfLocExtAuthorize(String pvpSerno)
        throws EMPException, IllegalAccessException, InvocationTargetException {

    String strReturnMessage = CMISMessage.ADDDEFEAT;

    //??
    PvpTfLocExtComponent pvpTfLocExtComponent = (PvpTfLocExtComponent) this
            .getComponent(PUBConstant.PVPTFLOCEXT);
    PvpTfLocExt pvpTfLocExt = pvpTfLocExtComponent.queryPvpTfLocExtBySerNo(pvpSerno);
    if (pvpTfLocExt == null || pvpTfLocExt.getContNo() == null) {
        return strReturnMessage;
    }

    //?
    AccTfCommComponent accTfCommComponent = (AccTfCommComponent) this.getComponent(PUBConstant.ACCTFCOMM);
    accTfCommComponent.checkConditionBeforeAuthorize("PvpTfLocExt", pvpSerno, pvpTfLocExt.getContNo());
    CtrTfCvrgComponent ctrTfCvrgComponent = (CtrTfCvrgComponent) this.getComponent("CtrTfCvrg");
    //AccTfLocComponent accTfLocComponent = (AccTfLocComponent) this.getComponent("AccTfLoc");
    //AccTfLoc accTfLoc = accTfLocComponent.queryAccTfLocByIocNo(pvpTfLocExt.getIocNo());

    //??
    CustomIface customIface = (CustomIface) this.getComponentInterface(CusPubConstant.CUS_IFACE);
    CusBase cusBase = customIface.getCusBase(pvpTfLocExt.getCusId());
    String transCusId = cusBase.getTransCusId();

    //CMISSequenceService sequenceService = (CMISSequenceService) context.getService("sequenceService");
    //String orgId = pvpTfOinvf.getInputBrId();
    //billNo = sequenceService.getSequence(orgId, "fromOrg", 15, context);
    //String loanNo = sequenceService.getSequence("CZ", "fromDate", 15, context);
    //loanNo = loanNo.substring(2);

    //???1 = ???1 + ???1
    //      double securityMoneyAmtFin = pvpTfLocExt.getSecurityAmtFin();
    double securityMoneyOld = pvpTfLocExt.getSecurityAmtOld(); //???1
    double securitymoneyAmt = pvpTfLocExt.getSecurityMoneyAmt();//???1
    double securityMoneyAmt = securitymoneyAmt; //???1
    String smt = securityMoneyAmt + "";
    if (securityMoneyAmt == 0)
        smt = "";

    //???2 = ???2 + ???2
    //      double securityMoneyAmtFin1 = pvpTfLocExt.getSecurityAmtFin1();
    double securityMoneyOld1 = pvpTfLocExt.getSecurityAmtOld1(); //???2
    double securitymoneyAmt1 = pvpTfLocExt.getSecurityMoneyAmt1(); //???2
    double securityMoneyAmt1 = securitymoneyAmt1;//???2
    String smt1 = securityMoneyAmt1 + "";
    if (securityMoneyAmt1 == 0)
        smt1 = "";

    //???
    Context context = this.getContext();
    Connection connection = this.getConnection();
    CMISSequenceService sequenceService = (CMISSequenceService) context.getService("sequenceService");
    String loanNo = sequenceService.getSequence(TradeCodeConstant.SERNONC, "44", context, connection);

    //????
    CtrTfLocExt ctrTfLocExt = null;
    CtrTfLocExtComponent ctrTfLocExtComponent = (CtrTfLocExtComponent) this.getComponent("CtrTfLocExt");
    ctrTfLocExt = ctrTfLocExtComponent.queryCtrTfLocExtDetail(pvpTfLocExt.getContNo());
    ctrTfLocExt.setBillSeq(1); //???
    //???
    String[] billZero = { "", "00", "0", "" };
    int billSeqCtr = ctrTfLocExt.getBillSeq();//???????????????
    String billSeq = String.valueOf(billSeqCtr);
    billSeq = billZero[billSeq.length()] + billSeq;
    String billNo = pvpTfLocExt.getContNo() + billSeq; // ??? ??????

    //???
    PvpAuthorize pvpAuthorize = new PvpAuthorize();
    pvpAuthorize.setSerno(pvpSerno);
    pvpAuthorize.setLoanNo(loanNo);
    pvpAuthorize.setCusManager(pvpTfLocExt.getCusManager());
    pvpAuthorize.setInputBrId(pvpTfLocExt.getInputBrId());
    pvpAuthorize.setFinaBrId(pvpTfLocExt.getFinaBrId());
    pvpAuthorize.setCusId(pvpTfLocExt.getCusId());
    pvpAuthorize.setCusName(pvpTfLocExt.getCusName());
    pvpAuthorize.setContNo(pvpTfLocExt.getContNo());
    //pvpAuthorize.setBillNo(accTfLoc.getBillNo());
    pvpAuthorize.setTradeAmount(pvpTfLocExt.getApplyAmount());
    pvpAuthorize.setTradeDate(this.getOpenDay());
    pvpAuthorize.setTradeStatus(TradeCodeConstant.WTZ);
    pvpAuthorize.setTradeCode("0024");

    pvpAuthorize.setFieldNum(26);

    //
    pvpAuthorize.setFldvalue01("c@loanNo@" + loanNo); //?
    pvpAuthorize.setFldvalue02("c@contSerno@" + pvpTfLocExt.getBillNoOld()); //????(???)
    pvpAuthorize.setFldvalue03("c@contNo@" + pvpTfLocExt.getContNo()); //???
    pvpAuthorize.setFldvalue04("c@cusId@" + pvpTfLocExt.getCusId()); //?
    pvpAuthorize.setFldvalue05("c@cusName@" + pvpTfLocExt.getCusName()); //??
    pvpAuthorize.setFldvalue06("c@bizType@" + "0024"); //??
    pvpAuthorize.setFldvalue07("c@CurType@" + pvpTfLocExt.getApplyCurType()); //???
    pvpAuthorize.setFldvalue08("c@Amount@" + pvpTfLocExt.getApplyAmountFin()); //?--???
    pvpAuthorize.setFldvalue09("c@startDate@" + (String) context.getDataValue("OPENDAY")); //(?)
    pvpAuthorize.setFldvalue10("c@dueDate@" + checkNull(pvpTfLocExt.getDueDate())); //?
    pvpAuthorize.setFldvalue11("c@note@" + ""); //
    pvpAuthorize.setFldvalue12("c@applyOrg@" + pvpTfLocExt.getFinaBrId()); //
    pvpAuthorize.setFldvalue13("c@inputDate@" + (String) context.getDataValue("OPENDAY")); //

    //?
    pvpAuthorize.setFldvalue14("c@iocNo@" + pvpTfLocExt.getIocNo()); //?
    pvpAuthorize.setFldvalue15("c@applyTerm@" + pvpTfLocExt.getApplyTerm()); //??
    pvpAuthorize.setFldvalue16("c@securityMoneyRt@" + 100 * pvpTfLocExt.getSecurityMoneyRt()); //??
    DecimalFormat df = new DecimalFormat("#0.00");
    //???
    List securitylist = ctrTfCvrgComponent.querySecurityByContNo(pvpTfLocExt.getContNo());
    if (securitylist.size() == 0) {

        pvpAuthorize.setFldvalue17("c@securityMoneyAcNo@" + " "); //???1
        pvpAuthorize.setFldvalue18("c@securityMoneyAmt@" + " "); //???1
        pvpAuthorize.setFldvalue19("c@securityMoneyCur@" + " ");
        pvpAuthorize.setFldvalue20("c@securityMoneyType@" + " "); //???1
        pvpAuthorize.setFldvalue21("c@securityMoneyDueDate@" + " ");

        pvpAuthorize.setFldvalue22("c@securityMoneyAcNo1@" + " "); //???2
        pvpAuthorize.setFldvalue23("c@securityMoneyAmt1@" + " "); //???2
        pvpAuthorize.setFldvalue24("c@securityMoneyCur1@" + " "); //????2
        pvpAuthorize.setFldvalue25("c@securityMoneyType1@" + " "); //???1
        pvpAuthorize.setFldvalue26("c@securityMoneyDueDate1@" + " "); //????2
    } else if (securitylist.size() == 1) {
        TfSecurityMsg tfmsg = (TfSecurityMsg) securitylist.get(0);
        pvpAuthorize.setFldvalue17("c@securityMoneyAcNo@" + tfmsg.getSecurityMoneyAcNo());
        pvpAuthorize.setFldvalue18("c@securityMoneyAmt@" + df.format(tfmsg.getSecurityMoneyAmt()));
        pvpAuthorize.setFldvalue19("c@securityMoneyCur@" + tfmsg.getSecurityMoneyCur());
        pvpAuthorize.setFldvalue20("c@securityMoneyType@" + tfmsg.getSecurityMoneyType());
        pvpAuthorize.setFldvalue21("c@securityMoneyDueDate@" + tfmsg.getSecurityMoneyDueDate());

        pvpAuthorize.setFldvalue22("c@securityMoneyAcNo1@" + " ");
        pvpAuthorize.setFldvalue23("c@securityMoneyAmt1@" + " ");
        pvpAuthorize.setFldvalue24("c@securityMoneyCur1@" + " ");
        pvpAuthorize.setFldvalue25("c@securityMoneyType1@" + " ");
        pvpAuthorize.setFldvalue26("c@securityMoneyDueDate1@" + " "); //????2
    } else if (securitylist.size() == 2) {
        TfSecurityMsg tfmsg = (TfSecurityMsg) securitylist.get(0);
        pvpAuthorize.setFldvalue17("c@securityMoneyAcNo@" + tfmsg.getSecurityMoneyAcNo());
        pvpAuthorize.setFldvalue18("c@securityMoneyAmt@" + df.format(tfmsg.getSecurityMoneyAmt()));
        pvpAuthorize.setFldvalue19("c@securityMoneyCur@" + tfmsg.getSecurityMoneyCur());
        pvpAuthorize.setFldvalue20("c@securityMoneyType@" + tfmsg.getSecurityMoneyType());
        pvpAuthorize.setFldvalue21("c@securityMoneyDueDate@" + tfmsg.getSecurityMoneyDueDate());

        TfSecurityMsg tfmsg2 = (TfSecurityMsg) securitylist.get(1);
        pvpAuthorize.setFldvalue22("c@securityMoneyAcNo1@" + tfmsg2.getSecurityMoneyAcNo());
        pvpAuthorize.setFldvalue23("c@securityMoneyAmt1@" + df.format(tfmsg2.getSecurityMoneyAmt()));
        pvpAuthorize.setFldvalue24("c@securityMoneyCur1@" + tfmsg2.getSecurityMoneyCur());
        pvpAuthorize.setFldvalue25("c@securityMoneyType1@" + tfmsg2.getSecurityMoneyType());
        pvpAuthorize.setFldvalue26("c@securityMoneyDueDate1@" + tfmsg2.getSecurityMoneyDueDate()); //????2

    }

    PvpAuthorizeAgent pvpAuthorizeAgent = (PvpAuthorizeAgent) this.getAgentInstance(PUBConstant.PVPAUTHORIZE);
    strReturnMessage = pvpAuthorizeAgent.insertPvpAuthorize(pvpAuthorize);
    if (!strReturnMessage.equals(CMISMessage.ADDSUCCEESS)) {
        System.out.println("???");
        return strReturnMessage;
    }

    //????
    AccTfLocExt accTfLocExt = new AccTfLocExt();
    AccTfLocExtAgent accTfLocExtAgent = (AccTfLocExtAgent) this.getAgentInstance("AccTfLocExt");
    BeanUtilsBean bub = new BeanUtilsBean();
    try {
        bub.copyProperties(accTfLocExt, pvpTfLocExt);
    } catch (IllegalAccessException e) {
        new ComponentException("???????");
    } catch (InvocationTargetException e) {
        new ComponentException("???????");
    }

    accTfLocExt.setBillNo(billNo);
    accTfLocExt.setAccountStatus("0");//
    accTfLocExt.setMainBrId(pvpTfLocExt.getInvestigatorBrId());
    accTfLocExtAgent.insertAccTfLocExt(accTfLocExt);

    //????
    AccTfComm accTfComm = new AccTfComm();
    try {
        bub.copyProperties(accTfComm, accTfLocExt);
    } catch (IllegalAccessException e) {
        new ComponentException("?????");
    } catch (InvocationTargetException e) {
        new ComponentException("?????");
    }
    accTfComm.setLimitAccNo(accTfLocExt.getLimitAccNo());
    accTfComm.setApplyAmount(accTfLocExt.getApplyAmountFin());//?????????
    accTfComm.setLoanAmount(accTfLocExt.getApplyAmountFin());//??
    try {
        accTfCommComponent.addAccTfComm(accTfComm);
    } catch (Exception e) {
        accTfCommComponent.updateDomain(accTfComm);
    }

    //
    pvpTfLocExt.setChargeoffStatus(Constant.PVPSTATUS3);
    pvpTfLocExt.setBillNo(billNo);
    pvpTfLocExtComponent.updatePvpTfLocExt(pvpTfLocExt);

    //
    try {
        /*??
        IndexedCollection icoll = cbqService.queryAccreditNotice4Trade(
              loanNo, connection, connection, context);
        KeyedCollection reqPkg = (KeyedCollection) icoll.get(0);
                
        String hostSerNo = (String) reqPkg.get("hostSerNo").toString()
              .trim();
        pvpAuthorize.setHostSerno(hostSerNo);
        pvpAuthorize.setTradeStatus(TradeCodeConstant.YTZ);
        pvpAuthorizeAgent.modifyCMISDomain(pvpAuthorize, "PvpAuthorize");
           */

        CreditBusinessQuartzService cbqService = new CreditBusinessQuartzService();
        cbqService.queryAccreditNotice(connection, context);
    } catch (Exception e) {
        e.printStackTrace();
        throw new ComponentException("???" + e.getMessage());
    }

    return strReturnMessage;
}