Example usage for javax.servlet.http HttpServletRequest getRealPath

List of usage examples for javax.servlet.http HttpServletRequest getRealPath

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getRealPath.

Prototype

public String getRealPath(String path);

Source Link

Usage

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping("/fileUploadX2.do")
public void fileUploadX2(HttpServletRequest request, HttpServletResponse response, SessionStatus status)
        throws Exception {
    //System.out.println(" ? uuid--"+request.getParameter("uuid"));
    String chkType = request.getHeader("Content-Type");

    if (chkType == null) {
        return;//from ww  w  .  jav  a2  s  .  c  om
    }

    request.setCharacterEncoding("utf-8");
    String contextRealPath = request.getSession().getServletContext().getRealPath("/");
    String PATH = request.getParameter("PATH");
    String savePath = contextRealPath + PATH;
    //   System.out.println("savePath------@@-----"+savePath);
    //   int maxSize = 500 * 1024 * 1024; //   ? ? 500MB() 

    PlatformData resData = new PlatformData();
    VariableList resVarList = resData.getVariableList();
    String sMsg = " A ";
    try {
        MultipartHttpServletRequest msReq = (MultipartHttpServletRequest) request;
        Iterator<String> filesd = msReq.getFileNames();

        String dir = request.getRealPath("images/egovframework/board_img");
        while (filesd.hasNext()) {
            sMsg += "D ";
            //String name = (String)files.nextElement();
            String name = filesd.next();
            //   System.out.println("? ^^-----"+name);
            MultipartFile mfile = msReq.getFile(name);

            //?
            String genId = UUID.randomUUID().toString();

            //?
            String originalFileName = mfile.getOriginalFilename();
            //?
            String saveFileName = genId;

            //         System.out.println("???="+ originalFileName);
            System.out.println("??=" + saveFileName);

            String savePathh = dir + "/" + saveFileName;

            mfile.transferTo(new File(savePathh));

            System.out.println(name + "??");
            System.out.println("? ?-" + genId);
            //??
            SampleVO vo = new SampleVO();
            vo.setiOriName(originalFileName);
            vo.setiFileName(saveFileName);
            vo.setiSize((int) mfile.getSize());
            vo.setiUrl(savePathh);
            vo.setiUuid("thumbnail");
            sampleService.uploadImg(vo);

            //? ?  
            //updateThumbnail
            Product pVO = new Product();
            pVO.setP_uuid(request.getParameter("uuid"));
            System.out.println(" uuid-" + request.getParameter("uuid"));

            String thumbnail = "http://localhost:8778/sample/images/egovframework/board_img/" + saveFileName;
            pVO.setP_thumbnail(thumbnail);
            sampleService.updateThumbnail(pVO);
            status.setComplete();

        }

        resVarList.add("ErrorCode", 200);
        resVarList.add("ErrorMsg", "SUCC");
    } catch (Exception e) {
        resVarList.add("ErrorCode", 500);
        resVarList.add("ErrorMsg", sMsg + " " + e);

    }

    HttpPlatformResponse res = new HttpPlatformResponse(response);
    res.setData(resData);
    res.sendData();

}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping("/deleteProduct.do")
public void deleteProduct(@ModelAttribute("searchVO") SampleDefaultVO searchVO, @RequestParam("seq") int seq,
        SessionStatus status, HttpServletRequest request, HttpServletResponse response, Model model)
        throws Exception {
    int nErrorCode = 0;
    String strErrorMsg = "START";

    HttpPlatformRequest pReq = new HttpPlatformRequest(request);
    pReq.receiveData();//????  ??  

    PlatformData iData = pReq.getData();

    System.out.println("x? ?  :  seq -" + seq);

    Product productVO = new Product();
    productVO.setP_seq(seq);//from  ww  w . j  av  a 2s.c o m

    //   
    //   SampleVO sampleVO = new SampleVO();
    //   sampleVO.setbSeq(id);
    //   

    //?///////////////////////////////////////////////////////////////////////////////////////////////      

    Product productVO2 = new Product();
    productVO2 = sampleService.selectProduct(productVO);

    String uuid = productVO2.getP_uuid();
    String thumbnail = productVO2.getP_thumbnail();

    SampleVO sam2 = new SampleVO();
    sam2.setbUuid(uuid);

    //? ? 
    if (thumbnail.equals(
            "http://localhost:8778/sample/images/egovframework/example/48d896f7-9ec8-456e-a0bc-06c1ff5f854c")) {//?
        System.out.println(" ? ?.");
    } else {//?? ?

        String dir = request.getRealPath("images/egovframework/board_img");
        String deleteThumb = thumbnail.substring(thumbnail.length() - 36);
        System.out.println(" ?? uuid :" + deleteThumb);
        String deleteThumbDir = dir + "/" + deleteThumb;
        System.out.println(" ? url" + deleteThumbDir);
        File f = new File(deleteThumbDir); //? 
        f.delete(); //? 
        System.out.println("? ?? ?.");
    }

    SampleVO iVo = new SampleVO();
    SampleVO iVo2 = new SampleVO();
    List<SampleVO> imgList = (List<SampleVO>) sampleService.selectImgList(sam2);

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

        int imgSeq = imgList.get(i).getiSeq();
        System.out.println("imgseq======" + imgSeq);
        iVo.setiSeq(imgSeq);
        System.out.println(" ?? ===" + imgList.get(i).getiSeq());
        //? ? ?? 
        iVo2 = sampleService.selectImg(iVo); //? 
        System.out.println(" +? ====" + iVo2.getiUrl());
        File f = new File(iVo2.getiUrl().toString()); //? 
        f.delete(); //? 

        sampleService.deleteImg(iVo);
        status.setComplete();

    }

    //////////////////////////////////////////////////////////////////////////////////////////////////   
    sampleService.deleteProduct(productVO);
    status.setComplete();

    nErrorCode = 0;
    strErrorMsg = "SUCC";
    PlatformData oData = new PlatformData();
    VariableList varList = oData.getVariableList();

    varList.add("ErrorCode", nErrorCode);
    varList.add("ErrorMsg", strErrorMsg);

    HttpPlatformResponse pRes = new HttpPlatformResponse(response, PlatformType.CONTENT_TYPE_XML, "UTF-8");
    pRes.setData(oData);
    //send data
    pRes.sendData();

}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/boardUpdate.do", method = RequestMethod.POST)
public String updateBoard(@RequestPart(required = false, value = "file") List<MultipartFile> imgFile,
        SessionStatus status, Model model, HttpServletRequest request, @RequestParam("bName") String bName,
        @RequestParam("bPass") String bPass, @RequestParam("bTitle") String bTitle,
        @RequestParam("bSeq") int bSeq, @RequestParam("bContent") String bContent,
        @RequestParam("imgChk") int[] imgChk, @RequestParam("bUuid") String bUuid) throws Exception {
    SampleVO iVo = new SampleVO();
    SampleVO iVo2 = new SampleVO();

    for (int i = 0; i < imgChk.length; i++) {
        //?? 99  99? 

        int imgSeq = imgChk[i];

        switch (imgSeq) {
        case 999:

            break;

        default:/*from  ww  w  .j  av a 2  s .  c o  m*/
            iVo.setiSeq(imgSeq);
            System.out.println(" ?? ===" + imgChk[i]);
            //? ? ?? 
            iVo2 = sampleService.selectImg(iVo); //? 
            System.out.println(" +? ====" + iVo2.getiUrl());
            File f = new File(iVo2.getiUrl().toString()); //? 
            f.delete(); //? 

            sampleService.deleteImg(iVo);
            status.setComplete();
            break;
        }

    }

    SampleVO sampleVO = new SampleVO();
    System.out.println("dd");
    sampleVO.setbSeq(bSeq);
    sampleVO.setbName(bName);
    sampleVO.setbPass(bPass);
    sampleVO.setbTitle(bTitle);
    sampleVO.setbContent(bContent);

    sampleService.updateSample(sampleVO);
    status.setComplete();

    if (!imgFile.isEmpty()) {
        String dir = request.getRealPath("images/egovframework/board_img");
        System.out.println("dd" + imgFile.size());
        for (int i = 0; i < imgFile.size() - 1; i++) {
            //?
            String genId = UUID.randomUUID().toString();

            //?
            String originalFileName = imgFile.get(i).getOriginalFilename();
            //?
            //   String saveFileName = genId+"."+originalFileName;
            String saveFileName = genId;
            String savePath = dir + "/" + saveFileName;
            imgFile.get(i).transferTo(new File(savePath));
            SampleVO vo = new SampleVO();

            vo.setiOriName(originalFileName);
            vo.setiFileName(saveFileName);
            vo.setiSize((int) imgFile.get(i).getSize());
            vo.setiUrl(savePath);
            vo.setiUuid(bUuid);
            sampleService.uploadImg(vo);
            status.setComplete();
        }
    }

    return "forward:/egovSampleList.do";
    //   model.addAttribute("main", "goFreebbs.jsp");
    //   return "sample/home";   
}

From source file:egovframework.example.sample.web.EgovSampleController.java

@RequestMapping(value = "/qnaModify.do", method = RequestMethod.POST)
public String qnaModify(@RequestPart(required = false, value = "file") List<MultipartFile> imgFile,
        SessionStatus status, Model model, HttpServletRequest request, @RequestParam("type") String type,
        @RequestParam("bName") String bName, @RequestParam("bPass") String bPass,
        @RequestParam("bTitle") String bTitle, @RequestParam("bSeq") int bSeq,
        @RequestParam("bContent") String bContent, @RequestParam("imgChk") int[] imgChk,
        @RequestParam("bUuid") String bUuid) throws Exception {
    SampleVO iVo = new SampleVO();
    SampleVO iVo2 = new SampleVO();

    for (int i = 0; i < imgChk.length; i++) {
        //?? 99  99? 

        int imgSeq = imgChk[i];

        switch (imgSeq) {
        case 999:

            break;

        default:/*from w  w w  . ja v a 2 s. com*/
            iVo.setiSeq(imgSeq);
            System.out.println(" ?? ===" + imgChk[i]);
            //? ? ?? 
            iVo2 = sampleService.selectImg(iVo); //? 
            System.out.println(" +? ====" + iVo2.getiUrl());
            File f = new File(iVo2.getiUrl().toString()); //? 
            f.delete(); //? 

            sampleService.deleteImg(iVo);
            status.setComplete();
            break;
        }

    }
    QnaVO qnaVO = new QnaVO();
    qnaVO.setQ_seq(bSeq);
    qnaVO.setQ_type(type);
    qnaVO.setQ_name(bName);
    qnaVO.setQ_pass(bPass);
    qnaVO.setQ_title(bTitle);
    qnaVO.setQ_content(bContent);

    sampleService.updateQnA(qnaVO);
    status.setComplete();

    if (!imgFile.isEmpty()) {
        String dir = request.getRealPath("images/egovframework/board_img");
        System.out.println("dd" + imgFile.size());
        for (int i = 0; i < imgFile.size() - 1; i++) {
            //?
            String genId = UUID.randomUUID().toString();

            //?
            String originalFileName = imgFile.get(i).getOriginalFilename();
            //?
            //   String saveFileName = genId+"."+originalFileName;
            String saveFileName = genId;
            String savePath = dir + "/" + saveFileName;
            imgFile.get(i).transferTo(new File(savePath));
            SampleVO vo = new SampleVO();

            vo.setiOriName(originalFileName);
            vo.setiFileName(saveFileName);
            vo.setiSize((int) imgFile.get(i).getSize());
            vo.setiUrl(savePath);
            vo.setiUuid(bUuid);
            sampleService.uploadImg(vo);
            status.setComplete();
        }
    }
    QnaVO qvo = sampleService.selectQna(qnaVO);
    int qseq = qvo.getQ_pseq();
    return "forward:/selectProduct.do?searchKeyword2=not&pageIndex=1&selectedId=" + qseq;

}

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

public Map putXsdBalanceReportParamMap(Long id, HttpServletRequest request) {

    Map map = new HashMap();
    // ??//from  w  w w  .jav a2 s.co  m
    TbBusinessBalance tbBusinessBalance = this.findById(id);
    // ??
    TmStockOut tmStockOut = tmStockOutService.findById(tbBusinessBalance.getTmStockOut().getId());

    // ?
    TbCustomer tbCustomer = tbCustomerService.findById(tmStockOut.getCustomerBill());

    // ??
    TmCompany tmCompany = tmCompanyService.acquireUniqueTmCompany();

    // ??
    List<TbMaintianVo> maintianvos = new ArrayList<TbMaintianVo>();
    // ?
    List<TmStockOutDetVo> tmStockOutDetVos = tmStockOutService
            .getCustomerSellDetailByTmStockOutId(tmStockOut.getId(), Constants.BALANCE_ALL);

    // 
    List<TbBusinessBalanceItem> tbBusinessBalanceItemList = tbBusinessBalanceItemService
            .findGroupTbBusinessBalanceItemListByTbBusinessBalanceId(tbBusinessBalance.getId());
    // ?--??
    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) {

                    for (TbMaintianVo _tbMaintianVo : maintianvosTemp) {

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

                            flag = true;

                            break;

                        }

                    }

                }

            }

            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())) {

                    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))) {

                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());

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

    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);
    }

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

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

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

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

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

    // 
    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("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(null));

    // ???-
    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())) {

        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.selfsoft.business.service.impl.TbFixEntrustServiceImpl.java

public Map putEntrustBalanceReportParamMap(Long id, HttpServletRequest request) {

    Map map = new HashMap();
    // ?//from   ww w . ja v  a2s . 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 v a2  s  .c o  m*/
    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;

}