Example usage for org.apache.commons.lang3 StringUtils isNoneBlank

List of usage examples for org.apache.commons.lang3 StringUtils isNoneBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isNoneBlank.

Prototype

public static boolean isNoneBlank(final CharSequence... css) 

Source Link

Document

Checks if none of the CharSequences are blank ("") or null and whitespace only..

 StringUtils.isNoneBlank(null)             = false StringUtils.isNoneBlank(null, "foo")      = false StringUtils.isNoneBlank(null, null)       = false StringUtils.isNoneBlank("", "bar")        = false StringUtils.isNoneBlank("bob", "")        = false StringUtils.isNoneBlank("  bob  ", null)  = false StringUtils.isNoneBlank(" ", "bar")       = false StringUtils.isNoneBlank("foo", "bar")     = true 

Usage

From source file:com.dominion.salud.mpr.negocio.report.tratamientos.impl.DispensacionesReportImpl.java

/**
 *
 * @param parametros/*from w w w  .j  ava2 s.  co m*/
 * @return
 * @throws com.dominion.salud.mpr.negocio.service.exception.InformeSinDatosException
 * @throws com.dominion.salud.mpr.negocio.service.exception.InformeException
 */
@Override
public String listadoDispensacionDetalladoReport(Map<String, Object> parametros)
        throws InformeSinDatosException, InformeException {
    logger.debug("Generando el listado: " + MPR_LISTADO_DISPENSACIONES_DETALLADO);

    logger.debug("     Parametros del listado: ");
    logger.debug("          idAcuerdo: " + parametros.get("idAcuerdo"));
    logger.debug("          txtAcuerdo: " + parametros.get("txtAcuerdo"));
    logger.debug("          idCentro: " + parametros.get("idCentro"));
    logger.debug("          txtCentro: " + parametros.get("txtCentro"));
    logger.debug("          fecIniDisp: " + parametros.get("fecIniDisp"));
    logger.debug("          fecFinDisp: " + parametros.get("fecFinDisp"));

    //CONVERSION DE PARAMETROS DE ENTRADA
    logger.debug("     Iniciando la conversion de parametros para el listado");
    SimpleDateFormat ddmmyyyy = new SimpleDateFormat("dd/MM/yyyy");
    Date fecIniDisp = null;
    Date fecFinDisp = null;

    try {
        if (StringUtils.isNoneBlank((String) parametros.get("fecIniDisp"))) {
            logger.debug("          Iniciando la conversion de fecIniDisp: "
                    + (String) parametros.get("fecIniDisp"));
            fecIniDisp = ddmmyyyy.parse((String) parametros.get("fecIniDisp"));
            logger.debug("          Conversion de fecIniDisp: " + (String) parametros.get("fecIniDisp")
                    + " realizada correctamente: " + fecIniDisp);
        }
    } catch (ParseException pe) {
        logger.warn("No se ha podido parsear fecIniDisp: " + parametros.get("fecIniDisp"));
    }

    try {
        if (StringUtils.isNoneBlank((String) parametros.get("fecFinDisp"))) {
            logger.debug("          Iniciando la conversion de fecFinDisp: "
                    + (String) parametros.get("fecFinDisp"));
            fecFinDisp = ddmmyyyy.parse((String) parametros.get("fecFinDisp"));
            logger.debug("          Conversion de fecFinDisp: " + (String) parametros.get("fecFinDisp")
                    + " realizada correctamente: " + fecFinDisp);
        }
    } catch (ParseException pe) {
        logger.warn("No se ha podido parsear fecFinDisp: " + parametros.get("fecFinDisp"));
    }

    Long idCentro = null;
    if (StringUtils.isNotBlank((String) parametros.get("idCentro"))) {
        logger.debug("          Iniciando la conversion de idCentro: " + (String) parametros.get("idCentro"));
        idCentro = NumberUtils.toLong((String) parametros.get("idCentro"));
        logger.debug("          Conversion de idCentro: " + (String) parametros.get("idCentro")
                + " realizada correctamente: " + idCentro);
    }

    Long idAcuerdo = null;
    if (StringUtils.isNotBlank((String) parametros.get("idAcuerdo"))) {
        logger.debug("          Iniciando la conversion de idAcuerdo: " + (String) parametros.get("idAcuerdo"));
        idAcuerdo = NumberUtils.toLong((String) parametros.get("idAcuerdo"));
        logger.debug("          Conversion de idAcuerdo: " + (String) parametros.get("idAcuerdo")
                + " realizada correctamente: " + idAcuerdo);
    }
    logger.debug("     Finaliza la conversion de parametros para el listado");

    //OBTENCION DE DATOS PARA POBLAR EL LISTADO
    logger.debug("     Iniciando la obtencion de informacion para el listado");
    List<Dispensaciones> dispensacioneses = new ArrayList<>();
    dispensacioneses = dispensacionesService.findListadoDispensacionesDetallado(idCentro, idAcuerdo, fecIniDisp,
            fecFinDisp);
    logger.debug("          Se han obtenido: " + dispensacioneses.size() + " resultados");
    if (dispensacioneses.size() <= 0) {
        throw new InformeSinDatosException("No se han obtenido resultados");
    }
    logger.debug("     Finaliza la obtencion de informacion para el listado");

    //GENERACION DEL INFORME
    try {
        logger.debug("     Localizando la plantilla del listado: "
                + getClass().getClassLoader().getResource(MPR_LISTADO_DISPENSACIONES_DETALLADO));
        JasperReport reporte = (JasperReport) JRLoader
                .loadObject(getClass().getClassLoader().getResource(MPR_LISTADO_DISPENSACIONES_DETALLADO));
        logger.debug("     Plantilla del listado localizada correctamente");

        logger.debug("     Completando los datos del listado");
        JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, parametros,
                new JRBeanCollectionDataSource(dispensacioneses));
        logger.debug("     Datos del listado completados correctamente");

        logger.debug("     Generando el listado en la ubicacion: " + MPRConstantes._MPR_RESOURCES
                + new Date().getTime() + ".pdf");
        String ruta = reportPDFtoFile(jasperPrint,
                MPRConstantes._MPR_RESOURCES + new Date().getTime() + ".pdf");
        logger.debug("     Listado generado correctamente en la ubicacion: " + ruta);

        logger.debug("Listado: " + MPR_LISTADO_DISPENSACIONES_DETALLADO + " generado correctamente");
        return ruta;
    } catch (Exception e) {
        throw new InformeException(e);
    }
}

From source file:com.pantuo.service.impl.AttachmentServiceImpl.java

@Override
public String savePayvoucher(HttpServletRequest request, String user_id, int main_id,
        JpaAttachment.Type file_type, String description) throws BusinessException {
    String result = "";
    try {//from   ww w . j  av  a2  s.c o m
        CustomMultipartResolver multipartResolver = new CustomMultipartResolver(
                request.getSession().getServletContext());
        log.info("userid:{},main_id:{},file_type:{}", user_id, main_id, file_type);
        if (multipartResolver.isMultipart(request)) {
            String path = request.getSession().getServletContext()
                    .getRealPath(com.pantuo.util.Constants.FILE_UPLOAD_DIR).replaceAll("WEB-INF", "");
            log.info("path=", path);
            MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
            Iterator<String> iter = multiRequest.getFileNames();
            while (iter.hasNext()) {
                MultipartFile file = multiRequest.getFile(iter.next());
                if (file != null && !file.isEmpty()) {
                    String oriFileName = file.getOriginalFilename();
                    String fn = file.getName();
                    if (StringUtils.isNoneBlank(oriFileName)) {

                        String storeName = GlobalMethods
                                .md5Encrypted((System.currentTimeMillis() + oriFileName).getBytes());
                        Pair<String, String> p = FileHelper.getUploadFileName(path,
                                storeName += FileHelper.getFileExtension(oriFileName, true));
                        File localFile = new File(p.getLeft());
                        file.transferTo(localFile);
                        AttachmentExample example = new AttachmentExample();
                        AttachmentExample.Criteria criteria = example.createCriteria();
                        criteria.andMainIdEqualTo(main_id);
                        criteria.andUserIdEqualTo(user_id);
                        criteria.andTypeEqualTo(JpaAttachment.Type.payvoucher.ordinal());
                        List<Attachment> attachments = attachmentMapper.selectByExample(example);
                        if (attachments.size() > 0) {
                            Attachment t = attachments.get(0);
                            t.setUpdated(new Date());
                            t.setName(oriFileName);
                            t.setUrl(p.getRight());
                            attachmentMapper.updateByPrimaryKey(t);
                            result = p.getRight();
                        } else {
                            Attachment t = new Attachment();
                            if (StringUtils.isNotBlank(description)) {
                                t.setDescription(description);
                            }
                            t.setMainId(main_id);
                            t.setType(file_type.ordinal());
                            t.setCreated(new Date());
                            t.setUpdated(t.getCreated());
                            t.setName(oriFileName);
                            t.setUrl(p.getRight());
                            t.setUserId(user_id);
                            attachmentMapper.insert(t);
                            result = p.getRight();
                        }
                    }
                }
            }
        }

    } catch (Exception e) {
        log.error("saveAttachment", e);
        throw new BusinessException("saveAttachment-error", e);
    }
    return result;
}

From source file:cn.bzvs.excel.imports.ExcelImportServer.java

/**
 * ??//from  w  w  w.java  2  s  .  c o  m
 * @param object
 * @param row
 * @param params
 * @param pojoClass
 * @return
 */
private boolean verifyingDataValidity(Object object, Row row, ImportParams params, Class<?> pojoClass) {
    boolean isAdd = true;
    Cell cell = null;
    if (params.isNeedVerfiy()) {
        String errorMsg = PoiValidationUtil.validation(object);
        if (StringUtils.isNotEmpty(errorMsg)) {
            cell = row.createCell(row.getLastCellNum());
            cell.setCellValue(errorMsg);
            if (object instanceof IExcelModel) {
                IExcelModel model = (IExcelModel) object;
                model.setErrorMsg(errorMsg);
            } else {
                isAdd = false;
            }
            verfiyFail = true;
        }
    }
    if (params.getVerifyHanlder() != null) {
        ExcelVerifyHanlderResult result = params.getVerifyHanlder().verifyHandler(object);
        if (!result.isSuccess()) {
            if (cell == null)
                cell = row.createCell(row.getLastCellNum());
            cell.setCellValue(
                    (StringUtils.isNoneBlank(cell.getStringCellValue()) ? cell.getStringCellValue() + "," : "")
                            + result.getMsg());
            if (object instanceof IExcelModel) {
                IExcelModel model = (IExcelModel) object;
                model.setErrorMsg(
                        (StringUtils.isNoneBlank(model.getErrorMsg()) ? model.getErrorMsg() + "," : "")
                                + result.getMsg());
            } else {
                isAdd = false;
            }
            verfiyFail = true;
        }
    }
    if (cell != null)
        cell.setCellStyle(errorCellStyle);
    return isAdd;
}

From source file:com.quancheng.saluki.boot.runner.GrpcReferenceRunner.java

private String getVersion(SalukiReference reference, String serviceName, Class<?> referenceClass) {
    Pair<String, String> groupVersion = findGroupAndVersionByServiceName(serviceName);
    if (StringUtils.isNoneBlank(reference.version())) {
        return reference.version();
    } else if (StringUtils.isNoneBlank(groupVersion.getRight())) {
        String replaceVersion = groupVersion.getRight();
        Matcher matcher = REPLACE_PATTERN.matcher(replaceVersion);
        if (matcher.find()) {
            String replace = matcher.group().substring(2, matcher.group().length() - 1).trim();
            String[] replaces = StringUtils.split(replace, ":");
            if (replaces.length == 2) {
                String realVersion = env.getProperty(replaces[0], replaces[1]);
                return realVersion;
            } else {
                throw new IllegalArgumentException("replaces formater is #{XXXservice:1.0.0}");
            }//from w w  w  . j a v a  2 s .c om
        } else {
            return replaceVersion;
        }
    } else if (this.isGenericClient(referenceClass)) {
        return StringUtils.EMPTY;
    } else {
        throw new java.lang.IllegalArgumentException("reference version can not be null or empty");
    }
}

From source file:de.elomagic.maven.http.HTTPMojo.java

private void handleResponse(final Response response) throws Exception {
    HttpResponse httpResponse = response.returnResponse();
    StatusLine statusLine = httpResponse.getStatusLine();
    int statusCode = statusLine.getStatusCode();

    if (statusCode < 200 || statusCode > 299) {
        if (httpResponse.getEntity() != null) {
            getLog().info(EntityUtils.toString(httpResponse.getEntity()));
        } else {//from  w w  w  .  j  a v a  2s.  c  om
            getLog().info("Response body is empty.");
        }

        throw new Exception("Response status code " + statusCode + ": " + statusLine.getReasonPhrase());
    }

    getLog().info("Response status code " + statusCode + ": " + statusLine.getReasonPhrase());

    HttpEntity entity = httpResponse.getEntity();
    if (entity == null) {
        getLog().info("Response body is empty.");
    } else if (unpack) {
        File downloadedFile = File.createTempFile("mvn_http_plugin_", ".tmp");
        try (InputStream in = entity.getContent()) {
            Files.copy(in, downloadedFile.toPath(), StandardCopyOption.REPLACE_EXISTING);

            if (StringUtils.isNoneBlank(digest)) {
                checkFile(downloadedFile.toPath());
            }

            getLog().info("Downloaded file size: "
                    + FileUtils.byteCountToDisplaySize(new Long(downloadedFile.length()).intValue()));

            unzipToFile(downloadedFile, outputDirectory);
        } finally {
            downloadedFile.delete();
        }
    } else if (toFile != null) {
        try (InputStream in = entity.getContent()) {
            Files.copy(in, toFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
        }

        if (StringUtils.isNoneBlank(digest)) {
            checkFile(toFile.toPath());
        }

        getLog().debug("Downloaded file location: " + toFile);
        getLog().debug("Downloaded file size: "
                + FileUtils.byteCountToDisplaySize(new Long(toFile.length()).intValue()));
    } else if (printResponse) {
        getLog().info("Response content: " + IOUtil.toString(entity.getContent(), "utf-8"));
    }
}

From source file:com.hbc.api.fund.biz.service.MISFundWithdrawService.java

@Transactional
public boolean tryToTransfer(FundTransferQueryBean queryBean) {
    String drawNo = queryBean.getDrawNo();
    FundWithdrawal fundWithdrawal = fundWithdrawMapper.selectByPrimaryKey(drawNo);

    if (fundWithdrawal == null) {
        throw new FundException(FundReturnCodeEnum.ERR_NOT_FUND, "??");
    }//from  w ww. jav a  2s .  c o m

    Integer oldDrawStatus = fundWithdrawal.getDrawStatus();
    Integer oldProcessStatus = fundWithdrawal.getProcessStatus();

    if (oldDrawStatus == FundDrawStatus.HAVE_TRANSFERED.value) {
        logger.error("???|?");
        throw new FundException(FundReturnCodeEnum.ERR_UPDATE, "?");
    }

    if (oldProcessStatus == FundProcessStatus.PROCESSED.value) {
        logger.error("???|?");
        throw new FundException(FundReturnCodeEnum.ERR_UPDATE, "?");
    }

    fundWithdrawal.setPrice(queryBean.getTransferAmount());
    fundWithdrawal.setActualPrice(queryBean.getActualAmount());
    fundWithdrawal.setAdminId(queryBean.getOptId());
    fundWithdrawal.setAdminName(queryBean.getOptName());
    fundWithdrawal.setDrawStatus(FundDrawStatus.HAVE_TRANSFERED.value);
    fundWithdrawal.setProcessStatus(FundProcessStatus.PROCESSED.value);
    fundWithdrawal.setUpdateTime(new Date());
    String payAccount = queryBean.getPayAccount();

    if (StringUtils.isNoneBlank(payAccount)) {
        fundWithdrawal.setAccount(payAccount); // OPTIONAL
    }
    fundWithdrawal.setDrawComment(StringUtils.isNoneBlank(fundWithdrawal.getDrawComment())
            ? fundWithdrawal.getDrawComment()
            : "" + "->" + "??BY:" + queryBean.getOptId() + " " + queryBean.getOptName());
    logger.info(
            "??|???->{} | ?? DrawStatus:{} -> {} | ProcessStatus:{} -> {}",
            fundWithdrawal, FundDrawStatus.getStatus(oldDrawStatus),
            FundDrawStatus.getStatus(fundWithdrawal.getDrawStatus()),
            FundProcessStatus.getStatus(oldProcessStatus),
            FundProcessStatus.getStatus(fundWithdrawal.getProcessStatus()));
    int effectNumUpdateWithdraw = fundWithdrawMapper.updateByPrimaryKeySelective(fundWithdrawal);
    int effectNumUpdateAccount = 0;
    if (effectNumUpdateWithdraw > 0) {
        effectNumUpdateAccount = fundAccountService.confirmTransferToUpdateAccount(
                fundWithdrawal.getFinAccount(), queryBean.getActualAmount(),
                queryBean.getGuideId() == null ? "" : queryBean.getGuideId(), fundWithdrawal.getDrawNo());
    }
    return (effectNumUpdateWithdraw > 0 && effectNumUpdateAccount > 0);
}

From source file:com.hbc.api.fund.biz.service.FundWithdrawService.java

@Transactional
public Boolean finalDenyWithdraw(FundWithdrawDenyQueryBean queryBean) {
    FundWithdrawal fundWithdraw = fundWithdrawMapperEnhance.getFundWithdrawForUpdate(queryBean.getDrawNo());
    if (fundWithdraw == null || fundWithdraw.getProcessStatus() == FundProcessStatus.PROCESSED.value) {
        throw new BalanceException(BalanceReturnCodeEnum.WITHDRAW_DENY_DUPLICATE_SUBMITED,
                queryBean.getDrawNo());//w w  w .  ja  v  a  2s . c o  m
    }

    Integer oldDrawStatus = fundWithdraw.getDrawStatus();
    Integer oldProcessStatus = fundWithdraw.getProcessStatus();

    if (oldDrawStatus == FundDrawStatus.DELETE_TO_HIDDEN.value) {
        logger.error("???|?");
        throw new FundException(FundReturnCodeEnum.ERR_UPDATE, "?");
    }

    if (oldProcessStatus == FundProcessStatus.PROCESSED.value) {
        logger.error("???|?");
        throw new FundException(FundReturnCodeEnum.ERR_UPDATE, "?");
    }

    FundWithdrawalExample criteria = new FundWithdrawalExample();
    criteria.createCriteria().andDrawNoEqualTo(queryBean.getDrawNo());
    fundWithdraw.setUpdateTime(new Date());
    fundWithdraw.setDrawComment(queryBean.getReason());
    fundWithdraw.setDrawStatus(FundDrawStatus.DELETE_TO_HIDDEN.value);
    fundWithdraw.setProcessStatus(FundProcessStatus.PROCESSED.value);
    fundWithdraw.setActualPrice(0d);
    fundWithdraw.setDrawComment(
            StringUtils.isNoneBlank(fundWithdraw.getDrawComment()) ? fundWithdraw.getDrawComment()
                    : "" + "-> BY:" + queryBean.getOptId() + "|" + queryBean.getOptName());

    logger.info(
            "??|???->{} | ?? DrawStatus:{} -> {} | ProcessStatus:{} -> {}",
            fundWithdraw, FundDrawStatus.getStatus(oldDrawStatus),
            FundDrawStatus.getStatus(fundWithdraw.getDrawStatus()),
            FundProcessStatus.getStatus(oldProcessStatus),
            FundProcessStatus.getStatus(fundWithdraw.getProcessStatus()));
    int updateWithdrawNum = fundWithdrawMapper.updateByExampleSelective(fundWithdraw, criteria);
    return (updateWithdrawNum > 0 && this.denyTransferToUpdateAccount(queryBean.getAccountNo(),
            queryBean.getAppliedAmount(), queryBean.getGuideId()) > 0);
}

From source file:com.ihandy.quote_core.service.impl.picc.QuoteThreadPicc.java

@Override
public void run() {
    try {/* w  w w .j av  a2 s  . c o  m*/
        String LicenseNo = quoteMap.get("LicenseNo");
        //??
        Map<String, Object> carMap = this.getInfoByCarNo(LicenseNo);
        carMap.put("carNo", LicenseNo);
        //??????
        Request quoteBeforeRequest1 = new Request();
        quoteBeforeRequest1
                .setUrl("http://" + SysConfigInfo.PICC_MAIN_URL + ":8000/prpall/bindvalid/bjptBindValid.do");
        Map<String, String> quoteBeforeMap1 = new HashMap<>();
        quoteBeforeMap1.put("operatorCode", SysConfigInfo.PICC_USERNAME);
        quoteBeforeMap1.put("checkOperaType", "BJ_PT");
        quoteBeforeRequest1.setRequestParam(quoteBeforeMap1);
        QuoteBefore1Page quoteBefore1Page = new QuoteBefore1Page(1);
        quoteBefore1Page.run(quoteBeforeRequest1);
        Request quoteBeforeRequest2 = new Request();
        quoteBeforeRequest2
                .setUrl("http://" + SysConfigInfo.PICC_MAIN_URL + ":8000/prpall/bindvalid/bjptBindValid.do");
        Map<String, String> quoteBeforeMap2 = new HashMap<>();
        quoteBeforeMap1.put("operatorCode", SysConfigInfo.PICC_USERNAME);
        quoteBeforeMap1.put("comCode", "11010286");
        quoteBeforeMap1.put("agentCode", "2-110021100065");
        quoteBeforeMap1.put("106023BJ", "106023BJ");
        quoteBeforeRequest2.setRequestParam(quoteBeforeMap2);
        QuoteBefore2Page quoteBefore2Page = new QuoteBefore2Page(1);
        quoteBefore2Page.run(quoteBeforeRequest2);
        String param = null;//?
        //??
        boolean f = true;//??
        //???????
        Map<String, Object> renewalMap = CacheConstant.renewalInfo.get(LicenseNo);
        if (renewalMap == null
                || (!renewalMap.containsKey("reCiPolicyNo") && !renewalMap.containsKey("reBiPolicyNo"))) {
            f = false;
        } else {
            //???
            String owner = (String) carMap.get("owner");
            if (StringUtils.isBlank(owner)) {
                carMap.put("owner", renewalMap.get("owner"));
            }
            carMap.put("reCiPolicyNo", renewalMap.get("reCiPolicyNo"));//???
            carMap.put("reBiPolicyNo", renewalMap.get("reBiPolicyNo"));//???
            carMap.put("ciEndDate", renewalMap.get("ciEndDate"));//?
            carMap.put("biEndDate", renewalMap.get("biEndDate"));//?
            carMap.put("identifyNumber", renewalMap.get("identifyNumber"));//?
            carMap.put("mobile", renewalMap.get("mobile"));//?
            //???
            EditCheckRenewalPage editCheckRenewalPage = new EditCheckRenewalPage(1);
            Request editCheckRenewalRequest = new Request();
            editCheckRenewalRequest.setUrl("http://" + SysConfigInfo.PICC_MAIN_URL
                    + ":8000/prpall/business/editCheckRenewal.do?bizNo=" + renewalMap.get("reBiPolicyNo"));
            Response editCheckRenewalResponse = editCheckRenewalPage.run(editCheckRenewalRequest);
            Map<String, Object> editCheckRenewalMap = editCheckRenewalResponse.getResponseMap();
            if (!editCheckRenewalMap.isEmpty()) {
                String renewalFlag = String.valueOf(editCheckRenewalMap.get("renewalFlag"));
                if (!"1".equals(renewalFlag) && !"null".equals(renewalFlag)) {//??
                    carMap.putAll(editCheckRenewalMap);
                    logger.info("? API??" + LicenseNo);
                } else {//???
                    f = false;
                }
            }
        }

        if (f) {
            param = this.makeQuoteParam1(carMap, quoteMap);
        } else {
            param = this.makeQuoteParam2(carMap, quoteMap);
        }
        //
        Request request4 = new Request();
        request4.setUrl("http://" + SysConfigInfo.PICC_MAIN_URL + ":8000/prpall/business/calActualValue.do");
        Map<String, String> map4 = new HashMap<>();
        map4.put("param", param);
        request4.setRequestParam(map4);
        QuoteGetDepreciationPage quoteGetDepreciationPage = new QuoteGetDepreciationPage(1);
        Response response4 = quoteGetDepreciationPage.run(request4);//
        carMap.putAll(response4.getResponseMap());
        //???
        param = this.makeQuoteInsurParam(quoteMap, param, (String) carMap.get("purchasePrice"),
                (String) carMap.get("depreciationPrice"), Integer.parseInt(carMap.get("seatCount").toString()));
        //??????
        param = this.makeQuoteInsuredInfoParam(quoteMap, param, (String) carMap.get("owner"),
                (String) carMap.get("identifyNumber"), (String) carMap.get("mobile"));
        //? 0 ?1 
        int IsNewCar = Integer.parseInt(quoteMap.get("IsNewCar"));
        if (IsNewCar == 1) {//??
            param.replace("prpCitemCar.newCarFlag=0", "prpCitemCar.newCarFlag=1");
        }
        //prpCitemCar.useNatureCode=211&useNatureCodeBak=211&useNatureCodeTrue=211&prpCitemCar.clauseType=F42&clauseTypeBak=F42
        //?
        Map<String, Object> cacheParamMap = CacheConstant.queryparam.get(LicenseNo);
        String isPublic = "0";
        if (cacheParamMap != null) {
            isPublic = String.valueOf(cacheParamMap.get("IsPublic"));
        }
        if ("1".equals(isPublic)) {
            String code = "212";//????
            String type = "F41";//???
            param = param.replace("prpCitemCar.useNatureCode=211", "prpCitemCar.useNatureCode=" + code);
            param = param.replace("useNatureCodeBak=211", "useNatureCodeBak=" + code);
            param = param.replace("useNatureCodeTrue=211", "useNatureCodeTrue=" + code);
            param = param.replace("prpCitemCar.clauseType=F42", "prpCitemCar.clauseType=" + type);
            param = param.replace("clauseTypeBak=F42", "clauseTypeBak=" + type);
            param = param.replace("oldClauseType=F42", "oldClauseType=" + type);
            logger.info("? AIP???" + LicenseNo);
        }
        //
        String RunMiles = quoteMap.get("RunMiles");
        if (StringUtils.isNoneBlank(RunMiles)) {//??????
            param = param.replace("prpCitemCar.runMiles=", "prpCitemCar.runMiles=" + RunMiles);
        } else {
            if (IsNewCar == 1 && LicenseNo.contains("")) {//??
                param = param.replace("prpCitemCar.runMiles=", "prpCitemCar.runMiles=30000.00");
            } else {
                param = param.replace("prpCitemCar.runMiles=", "prpCitemCar.runMiles=10000.00");
            }
        }
        long startTime = System.currentTimeMillis();
        String msg = "?";
        logger.info("?  API??" + LicenseNo);
        JSONObject quoteResultJson = new JSONObject();//?BusinessStatus ?StatusMessage ????Userinfo??Item ?
        //?Item?
        JSONObject Item = new JSONObject();//JSON
        Item.put("Source", quoteMap.get("IntentionCompany"));
        QuotePage quotePage = new QuotePage(1);
        Request quoteRequest = new Request();
        quoteRequest
                .setUrl("http://" + SysConfigInfo.PICC_MAIN_URL + ":8000/prpall/business/premiumCalculate.do");
        Map<String, String> quoteParamMap = new HashMap<>();
        quoteParamMap.put("param", param);
        quoteParamMap.put("carNo", LicenseNo);
        quoteRequest.setRequestParam(quoteParamMap);
        Response quoteResponse = quotePage.run(quoteRequest);
        if (quoteResponse.getReturnCode() == SysConfigInfo.ERROR404) {
            //TODO 
            return;
        } else {
            Double total = 0D;
            Map<String, Map<String, Double>> quoteMap = quoteResponse.getResponseMap();
            for (String key : quoteMap.keySet()) {
                Map<String, Double> map = quoteMap.get(key);
                JSONObject obj = new JSONObject();//??JSON
                obj.put("BaoE", map.get("amount"));
                obj.put("BaoFei", map.get("premium"));
                total = total + map.get("premium");
                Item.put(key, obj);
            }
            Item.put("BizTotal", QuoteCalculateUtils.m2(total));
        }
        //?
        if ("1".equals(quoteMap.get("ForceTax"))) {
            param = param.replace("prpCitemKindCI.amount=", "prpCitemKindCI.amount=122000");//??
            param = param.replace("prpCitemKindCI.adjustRate=1", "prpCitemKindCI.adjustRate=0.9");//??
            param = param.replace("chooseFlagCI=0", "chooseFlagCI=1");//?
            param = param + "&prpCitemKindCI.familyNo=";
            QuoteJqxPage quoteJqxPage = new QuoteJqxPage(1);
            Request quoteJqxRequest = new Request();
            quoteJqxRequest.setUrl(
                    "http://" + SysConfigInfo.PICC_MAIN_URL + ":8000/prpall/business/caculatePremiun.do");
            Map<String, String> quoteJqxParamMap = new HashMap<>();
            quoteJqxParamMap.put("param", param);
            quoteJqxParamMap.put("carNo", LicenseNo);
            quoteJqxRequest.setRequestParam(quoteJqxParamMap);
            Response quoteJqxResponse = quoteJqxPage.run(quoteJqxRequest);
            if (quoteJqxResponse.getReturnCode() == SysConfigInfo.ERROR404) {
                msg = quoteJqxResponse.getErrMsg();
                Item.put("ForceTotal", 0);
                Item.put("TaxTotal", 0);
            } else {
                Map<String, Double> quoteJqxMap = quoteJqxResponse.getResponseMap();
                Item.put("ForceTotal", quoteJqxMap.get("netPremium"));
                Item.put("TaxTotal", quoteJqxMap.get("taxTotal"));
            }
        } else {
            Item.put("ForceTotal", 0);
            Item.put("TaxTotal", 0);
        }
        Item.put("QuoteStatus", "1");
        Item.put("QuoteResult", msg);
        quoteResultJson.put("Item", Item);
        quoteResultJson.put("BusinessStatus", "1");
        quoteResultJson.put("StatusMessage", msg);
        //?Userinfo?
        JSONObject Userinfo = new JSONObject();
        Userinfo.put("LinenseNo", LicenseNo);
        Userinfo.put("ForceExpireDate", "");
        Userinfo.put("BusinessExpireDate", "");
        Userinfo.put("BusinessStartDate", "");
        Userinfo.put("ForceStartDate", "");
        quoteResultJson.put("Userinfo", Userinfo);
        Map<String, Object> quoteResultMap = CacheConstant.quoteResultInfo.get(LicenseNo);//?
        if (quoteResultMap == null) {
            quoteResultMap = new HashMap<>();
        }
        String IntentionCompany = (String) quoteMap.get("IntentionCompany");
        quoteResultMap.put(IntentionCompany, quoteResultJson);//
        CacheConstant.quoteResultInfo.put(LicenseNo, quoteResultMap);
        logger.info("?   API???"
                + ((System.currentTimeMillis() - startTime) / 1000) + "S"
                + quoteResultJson.toJSONString());
        param = this.setFuzuHebaoJisuanParam(param);
        param = this.setSyxHebaoParam(param, LicenseNo, (String) carMap.get("identifyNumber"));
        //TODO
        List<String> list = replaceParam.get("C2102");
        for (String str : list) {
            String[] array = str.split("=");
            String str1 = null;
            if (str.contains(".profitRate")) {
                str1 = array[0] + "=200";
            } else {
                str1 = array[0] + "=2.0000";
            }
            param = param.replace(str, str1);
        }
        quoteParamMap.put("param", param);
        quoteParamMap.put("carNo", LicenseNo);
        quoteRequest.setRequestParam(quoteParamMap);
        quotePage.run(quoteRequest);
        //TODO
        if ("1".equals(quoteMap.get("ForceTax"))) {//
            param = this.setJqxHebaoParam(param, LicenseNo, (String) carMap.get("identifyNumber"));
        }
        //??
        if ("1".equals((String) quoteMap.get("IsSingleSubmit"))) {
            logger.info("? API????" + LicenseNo);
            long hebaoStartTime = System.currentTimeMillis();
            try {
                this.commitHeBaoInfo(param, LicenseNo);
            } catch (Exception e) {
                logger.error("? AIP????" + LicenseNo + ""
                        + e.getMessage());
                e.printStackTrace();
            }
            logger.info("? API?????" + LicenseNo
                    + "" + ((System.currentTimeMillis() - hebaoStartTime) / 1000) + "S");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.hubrick.vertx.s3.signature.AWS4SignatureBuilder.java

private String makeCredentialScopeValueString() {
    Preconditions.checkNotNull(date, "Date must be set to create a credential scope value");
    Preconditions.checkState(StringUtils.isNoneBlank(region),
            "Region must be set to create a credential scope value");
    Preconditions.checkState(StringUtils.isNoneBlank(service),
            "Service must be set to create a credential scope value");

    return Joiner.on('/').join(CREDENTIAL_SCOPE_DATE.format(date), region, service,
            CREDENTIAL_SCOPE_TERMINATION_STRING);
}

From source file:com.hbc.api.trade.order.service.OrderService.java

/**
 * @param orderBean/*from ww  w . ja v  a  2  s .  c o  m*/
 * @param orderNo
 */
private void buildStaticOrderBody(OrderBean orderBean) {
    orderBean.setPriceGuideBase(orderBean.getPriceGuide());
    orderBean.setOrderStatus(OrderStatus.INITSTATE.value);
    orderBean.setOrderStatusName(OrderStatus.INITSTATE.name);
    Date currentTime = new Date();
    orderBean.setCreateTime(currentTime);
    orderBean.setUpdateTime(currentTime);
    orderBean.setGuideId(TradeFinalStr.defaultGuideId);
    orderBean.setDeliverStatus(OrderDeliverStatus.init.value);
    orderBean.setDeliverType(DeliverType.Ordinary.value);
    orderBean.setPriceGuide(orderBean.getPriceChannel());
    orderBean.setUserCommentStatus(UserCommentStatus.UNSCORED.value);
    orderBean.setGuideCommentStatus(GuideCommentStatus.UNSCORED.value);
    orderBean.setSystemCommentStatus(SystemCommentStatus.UNSCORED.value);
    orderBean.setFlightIsCustom(FlightIsCustom.NORMAL.value);
    orderBean.setSerialFlag(
            orderBean.getSerialFlag() == null ? OrderSerialFlag.NORMAL.value : orderBean.getSerialFlag());
    orderBean.setIsArrivalVisa(
            orderBean.getIsArrivalVisa() == null ? VisaType.UNDEFINED.value : orderBean.getIsArrivalVisa());
    orderBean.setCargroupFlag(
            orderBean.getCargroupFlag() == null ? CarGroupFlag.NORMAL.value : orderBean.getCargroupFlag());
    orderBean.setCheckInPrice(orderBean.getCheckInPrice() == null ? 0d : orderBean.getCheckInPrice());
    orderBean.setIsReadable(IsReadable.VISIABLE.value);
    if (orderBean.getUrgentFlag() == null) {
        orderBean.setUrgentFlag(UrgentFlag.nomal.value);
    }

    // BUGFIX
    if (StringUtils.isNoneBlank(orderBean.getStartAddress()) && orderBean.getStartAddress().equals("null")) {
        orderBean.setStartAddress(null);
    }
    if (StringUtils.isNoneBlank(orderBean.getStartAddressDetail())
            && orderBean.getStartAddressDetail().equals("null")) {
        orderBean.setStartAddressDetail(null);
    }
}