コード例 #1
0
 /**
  * {@link PayCCPC} 转 {@link PayInfoResponse}
  *
  * @param payCCPC
  * @return
  */
 private PayInfoResponse payCCPCToPayInfoResponse(PayCCPC payCCPC) {
   PayInfoResponse payInfoResponse = new PayInfoResponse();
   payInfoResponse.setTransRefNo(payCCPC.getPayNo());
   payInfoResponse.setTransToken(payCCPC.getUpSno());
   payInfoResponse.setRmtAccNo(StringUtils.cardNoFilter(payCCPC.getRmtAccNo()));
   payInfoResponse.setRmtBankName(payCCPC.getRmtBankName());
   payInfoResponse.setBnyAccNo(StringUtils.cardNoFilter(payCCPC.getBnyAccNo()));
   payInfoResponse.setBnyAccName(payCCPC.getBnyAccName());
   payInfoResponse.setBnyAmt(payCCPC.getBnyAmt().toPlainString());
   payInfoResponse.setBnyBankName(payCCPC.getBnyBankName());
   payInfoResponse.setRemitFee(
       payCCPC.getFee() == null ? "0.00" : payCCPC.getFee().toPlainString());
   payInfoResponse.setRemitStatus(payCCPC.getRemitStatus().toString());
   payInfoResponse.setTransCode(payCCPC.getErrCode());
   payInfoResponse.setTimestamp(DateUtils.dateToString(payCCPC.getRmtTime()));
   payInfoResponse.setTransMsg(payCCPC.getErrMsg());
   payInfoResponse.setIsNeedBillInfo(payCCPC.getIsNeedBillInfo());
   payInfoResponse.setRmtElecsignStatus(
       (payCCPC.getRmtElecsignStatus().intValue() == 0
               ? Const.VLDSTATE_INVALID
               : Const.VLDSTATE_VALID)
           + "");
   payInfoResponse.setBnyElecsignStatus(
       (payCCPC.getBnyElecsignStatus().intValue() == 0
               ? Const.VLDSTATE_INVALID
               : Const.VLDSTATE_VALID)
           + "");
   payInfoResponse.setRemark(payCCPC.getRemark());
   payInfoResponse.setNotifyMobile(payCCPC.getNotifyMobile());
   return payInfoResponse;
 }
 private CreditcardFeeQueryTradeRequestEntity packUp(
     CupsTrmnl cupsTrmnl, UlinkplusKeyManage ulinkplusKeyManage, UlinkplusRequestInfo request)
     throws TransferFailedException {
   // 消费报文打包
   // {2,3,4,11,22,25,41,42,48,49,64}
   CreditcardFeeQueryTradeRequestEntity requestEntity = new CreditcardFeeQueryTradeRequestEntity();
   requestEntity.setCardNo(request.getCardNo()); // 2
   requestEntity.setProcessCode("310000"); // 3
   requestEntity.setTransAmt(StringUtils.amtToBCD(request.getAmount())); // 4
   requestEntity.setTrmnlFlowNo(cupsTrmnl.getTrmnlFlowNo()); // 11
   requestEntity.setPosEntryMode("012"); // 22
   requestEntity.setServiceCode("92"); // 25
   requestEntity.setTrmnlNo(cupsTrmnl.getTrmnlNo());
   requestEntity.setTrmnlMrchNo(cupsTrmnl.getMrchNo());
   // 位置	长度	格式	内容	说明
   // 0	2	n2	用法标志	“PA”
   // 2	2	n2	帐单号码类型	08
   // 4	19	Ans19	信用卡卡码	左对齐,右补空格
   // 23	11	N11	手机号码
   // 34	1	ans1	结束标志	#
   // PA086222040000000001   #
   requestEntity.setSelfDefined48(
       ("PA08" + StringUtils.rightPad(request.getCreditcardNo(), 19, " ") + "#").getBytes());
   requestEntity.setCurrency(Currency.CNY.getCodeN());
   requestEntity.setMacCode(new byte[8]);
   cupsTrmnlService.updateCupsTrmnlFlowNo(cupsTrmnl);
   return requestEntity;
 }
コード例 #3
0
 @Override
 public RemittanceAccountResponsePage queryRmtAccount(Long usrId, String mrchNo) {
   RemittanceAccountResponsePage remittanceAccountResponsePage =
       new RemittanceAccountResponsePage();
   // 是否设置是否密码
   boolean isSetPayPwd = false;
   MrchUsr mrchUsr = mrchUsrService.findById(usrId);
   if (mrchUsr != null) {
     if (StringUtils.isNotBlank(mrchUsr.getPayPwd())) {
       isSetPayPwd = true;
     }
   }
   // 查询账户信息
   List<RemittanceAccountResponse> lists = new ArrayList<RemittanceAccountResponse>();
   try {
     lists = remitProcess.queryRmtAccount(mrchNo);
     remittanceAccountResponsePage.setMrchNo(mrchNo);
     remittanceAccountResponsePage.setIsRegisterRemit(true);
   } catch (Exception e) {
     remittanceAccountResponsePage.setIsRegisterRemit(false);
   }
   remittanceAccountResponsePage.setIsSetPayPwd(isSetPayPwd);
   remittanceAccountResponsePage.setRmtAccounts(lists);
   return remittanceAccountResponsePage;
 }
コード例 #4
0
 @Override
 public boolean addPayPwd(Long usrId, String payPwd) {
   boolean addSuccess = false;
   MrchUsr mrchUsr = mrchUsrService.findById(usrId);
   if (mrchUsr == null || (!mrchUsr.isUsrState())) {
     logger.info("用户[" + usrId + "]不存在或者用户被禁用");
     throw new AppRTException(AppExCode.MRCH_USR_UNAVAILABLE, "用户不存在或者用户被禁用!");
   }
   if (StringUtils.isNotBlank(mrchUsr.getPayPwd())) {
     throw new AppRTException(AppExCode.PAY_PWD_SETTED, "支付密码已设置,无法重新设置!");
   }
   mrchUsr.setPayPwd(StringUtils.trim(payPwd));
   mrchUsrService.updateMrchUsr(mrchUsr);
   addSuccess = true;
   return addSuccess;
 }
コード例 #5
0
  @Override
  public CCPCBillInfo queryCCPCBillInfo(String mrchNo, String rmtAccNo, String payNo) {
    CCPCBillInfo billInfo = null;
    PayCCPC payCCPC = payCCPCService.findPayCCPCByPayNoAndMrchNo(payNo, mrchNo);
    if (payCCPC != null) {
      if (StringUtils.isNotBlank(rmtAccNo)) {
        if (payCCPC.getRmtAccNo().equals(rmtAccNo)) {
          throw new AppRTException(
              AppExCode.ILLEGAL_PARAMS,
              "非法数据,transRefNo["
                  + payNo
                  + "]对应rmtAccNo["
                  + rmtAccNo
                  + "],但查出的是rmtAccNo["
                  + payCCPC.getRmtAccNo()
                  + "]");
        }
      }
      billInfo = XPOSPClientUtils.payCCPCToCCPCBillInfo(payCCPC);

      String elecsignsPath =
          XpospSysProperty.getESignaturePath()
              + payCCPC.getMrchNo()
              + File.separatorChar
              + payCCPC.getStoreNo()
              + File.separatorChar;
      String rmtElecSignDataFileName =
          payNo + "-rmt" + "." + XPOSPClientUtils.ESIGNATURE_PICTURE_SUFFIX;
      String bnyElecSignDataFileName =
          payNo + "-bny" + "." + XPOSPClientUtils.ESIGNATURE_PICTURE_SUFFIX;
      File remitElecSignDataFile = new File(elecsignsPath + rmtElecSignDataFileName);
      File bnyElecSignDataFile = new File(elecsignsPath + bnyElecSignDataFileName);
      if (remitElecSignDataFile.exists()) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        BufferedImage image;
        try {
          image = ImageIO.read(remitElecSignDataFile);
          ImageIO.write(image, XPOSPClientUtils.BILLINFO_PICTURE_SUFFIX, out);
          billInfo.setRmtElecsignData(CodecUtils.hexString(out.toByteArray()));
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      if (bnyElecSignDataFile.exists()) {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        BufferedImage image;
        try {
          image = ImageIO.read(bnyElecSignDataFile);
          ImageIO.write(image, XPOSPClientUtils.BILLINFO_PICTURE_SUFFIX, out);
          billInfo.setBnyElecsignData(CodecUtils.hexString(out.toByteArray()));
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
    return billInfo;
  }
コード例 #6
0
  @Override
  public Page<Device> queryDeviceByCon(
      String batchNo, String devSn, String devKsn, int startIndex, int pageSize) throws Exception {

    if (StringUtils.isBlank(batchNo) && StringUtils.isBlank(devSn) && StringUtils.isBlank(devKsn)) {
      return null;
    }

    List<Object> params = new ArrayList<Object>();
    StringBuilder sb = new StringBuilder();

    sb.append("from " + Device.class.getName() + " dev");

    sb.append(" where 1=1");

    if (StringUtils.isNotBlank(batchNo)) {
      sb.append(" and dev.batchNo like ?");
      params.add("%" + batchNo + "%");
    }

    if (StringUtils.isNotBlank(devSn)) {
      sb.append(" and dev.devSn like ?");
      params.add("%" + devSn + "%");
    }

    if (StringUtils.isNotBlank(devKsn)) {
      sb.append(" and dev.devKsn like ?");
      params.add("%" + devKsn + "%");
    }

    sb.append(" order by dev.devId asc");

    return find(sb.toString(), startIndex, pageSize, params.toArray(new Object[params.size()]));
  }
コード例 #7
0
  private IcScriptUploadTradeRequestEntity packUp(
      CupsTrmnl cupsTrmnl, CupsKeyManage cupsKeyManage, PepsiColaRequestInfo request)
      throws TransferFailedException {
    if (request.getIcScript() == null) {
      throw new TransferFailedException(
          AppExCode.ILLEGAL_PARAMS, "isScript upload failed! IcScript objet is null");
    }
    PayCups originalPayCups = payCupsService.findPayCups(request.getOriginalPayNo());
    // 脚本上送打包
    IcScriptUploadTradeRequestEntity entity = new IcScriptUploadTradeRequestEntity();
    entity.setCardNo(originalPayCups.getCardNo()); // 2 卡号
    entity.setProcessCode(originalPayCups.getProcessCode()); // 3 未选卡种
    String amount = null;
    if (originalPayCups.getTransAmt() != null
        || BigDecimal.ZERO.compareTo(originalPayCups.getTransAmt()) != 0) {
      amount = com.newland.base.util.StringUtils.amtToBCD(originalPayCups.getTransAmt());
    }
    entity.setTransAmt(amount); // 4 交易金额
    entity.setTrmnlFlowNo(cupsTrmnl.getTrmnlFlowNo()); // 11 终端流水号
    entity.setPosEntryMode(originalPayCups.getPosEntryMode()); // 22 卡输入方式
    if (StringUtils.isBlank(originalPayCups.getIcData())) { // 磁条卡
      entity.setSelfDefined60(
          Const.SD60_1_MSGTYPE_CONTROL
              + cupsTrmnl.getTrmnlBatchNo()); // 60 自定义域 22(交易类型码)+000001(批次号)+000(网络管理信息码)
    } else { // IC卡
      entity.setCardSeqNum(originalPayCups.getCardSeqNum()); // IC卡必须上送该域
      byte[] icData = getIcData(originalPayCups.getIcData(), request.getIcScript());
      entity.setIcData(icData); // 55 IC卡数据
      String selfDefined60 =
          Const.SD60_1_MSGTYPE_CONTROL
              + cupsTrmnl.getTrmnlBatchNo()
              + Const.SD60_3_IC_CRIPT_UPLOAD
              + Const.SD60_4_TERMINAL_READING_ABILITY_CONTACT_ICCARD
              + Const.SD60_5_IC_SERVICE_CODE_NORMAL;
      entity.setSelfDefined60(selfDefined60);
    }
    entity.setTrmnlRefferNo(originalPayCups.getTrmnlReferNo()); // 37
    entity.setTrmnlNo(originalPayCups.getTrmnlNo()); // 41 终端号
    entity.setTrmnlMrchNo(originalPayCups.getTrmnlMrchNo()); // 42 终端商户号
    entity.setCurrency(originalPayCups.getCurrency()); // 49 货币代码
    entity.setOriginalMessage(
        originalPayCups.getTrmnlBatchNo()
            + originalPayCups.getTrmnlFlowNo()
            + originalPayCups.getTransDate()); // 61 原批次号+原流水号
    entity.setMacCode(new byte[8]); // 64 mac

    return entity;
  }
コード例 #8
0
 @Override
 public boolean updatePayPwd(Long usrId, String loginPasswd, String newPayPwd) {
   boolean updateSuccess = false;
   MrchUsr mrchUsr = mrchUsrService.findById(usrId);
   if (mrchUsr == null || (!mrchUsr.isUsrState())) {
     logger.info("用户[" + usrId + "]不存在或者用户被禁用");
     throw new AppRTException(AppExCode.MRCH_USR_UNAVAILABLE, "用户不存在或者用户被禁用!");
   }
   if (StringUtils.isBlank(mrchUsr.getPayPwd())) {
     throw new AppRTException(
         AppExCode.PAY_PWD_NOT_EXIST, "mrchUsr[" + usrId + "] payPwd not exitst");
   }
   if (mrchUsr.getUsrPwd().equals(loginPasswd)) {
     mrchUsr.setPayPwd(newPayPwd);
     mrchUsrService.updateMrchUsr(mrchUsr);
     updateSuccess = true;
   } else {
     throw new AppRTException(AppExCode.MRCH_USR_PWD_ERROR, "修改支付密码失败,登录密码有误!");
   }
   return updateSuccess;
 }
コード例 #9
0
  @Override
  public PayInfoResponse pay(PayInfoRequest request) {
    Long usrId = request.getUsrId();
    Assert.notNull(usrId, "usrId should not be null!");
    // 支付密码校验
    MrchUsr mrchUsr = mrchUsrService.findById(usrId);
    if (mrchUsr == null || (!mrchUsr.isUsrState())) {
      throw new AppRTException(
          AppExCode.MRCH_USR_UNAVAILABLE, "mrchUsr[" + usrId + "] not exist or disable!");
    }
    if (StringUtils.isBlank(mrchUsr.getPayPwd())) {
      throw new AppRTException(
          AppExCode.PAY_PWD_NOT_EXIST, "mrchUsr[" + usrId + "] payPwd not exitst");
    }
    if (!mrchUsr.getPayPwd().equalsIgnoreCase(request.getPayPwd())) {
      throw new AppRTException(AppExCode.PAY_PWD_ERROR, "payPwd error");
    }
    // 商户、门店校验
    Merchant merchant = merchantService.findMerchantByMrchNo(request.getMrchNo());
    if (merchant == null || !merchant.isAvailable()) {
      throw new AppRTException(
          AppExCode.MERCHANT_NOT_AVAILABLE, "merchant not exist!" + request.getMrchNo());
    }

    Store store = null;
    if (StringUtils.isNotBlank(request.getStoreNo())) {
      store = storeService.findByStoreNo(request.getStoreNo());
      if (store == null || !store.isAvailable()) {
        throw new AppRTException(
            AppExCode.STORE_NOT_AVAILABLE, "store not exist!" + request.getStoreNo());
      }
    }
    /** 交易流水是否重复* */
    String upSno = request.getTransToken();
    PayCCPC tempPayCCPC = payCCPCService.findPayCCPCByUpSno(upSno);
    if (tempPayCCPC != null) {
      logger.error("payCCPC[upSno:" + upSno + "] exist!!!");
      throw new AppRTException(AppExCode.TRADE_EXIST, "payCCPC[upSno:" + upSno + "] exist");
    }

    // 设置常用联系人 如果不存在则新增
    if (request.getIsFavoriteBnyAcc() != null) {
      if (request.getIsFavoriteBnyAcc()) {
        CCPCAccount temp =
            cCPCAccountService.findCCPCAccount(mrchUsr.getUsrLogin(), request.getBnyAccNo());
        if (temp == null) {
          CCPCAccount ccpcAccount = new CCPCAccount();
          ccpcAccount.setMrchNo(request.getMrchNo());
          ccpcAccount.setUsrLogin(mrchUsr.getUsrLogin());
          ccpcAccount.setRmtAccNo(request.getRmtAccNo());
          ccpcAccount.setBnyAccNo(request.getBnyAccNo());
          ccpcAccount.setBnyAccName(request.getBnyAccName());
          ccpcAccount.setBnyBankName(request.getBnyBankName());
          CCPCBank ccpcBank = ccpcBankService.findCCPCBankByBankName(request.getBnyBankName());
          ccpcAccount.setAbbrName(ccpcBank == null ? "DEFAULT" : ccpcBank.getAbbrName());
          cCPCAccountService.addCCPCAccount(ccpcAccount);
        }
      }
    }

    /** 构造支付流水* */
    String payNo = payNoGenerator.generate();
    Coordinate location = request.getLocation();

    /** 保存电子签名* */
    // 电子签名格式 payNo-transType.png
    boolean isSaveRmtEsignSuccess = false;
    boolean isSaveBnyEsignSuccess = false;
    if (request.getIsNeedBillInfo() != null && request.getIsNeedBillInfo()) {
      String rmtElecSignDataFileName =
          payNo + "-rmt" + "." + XPOSPClientUtils.ESIGNATURE_PICTURE_SUFFIX;
      String bnyElecSignDataFileName =
          payNo + "-bny" + "." + XPOSPClientUtils.ESIGNATURE_PICTURE_SUFFIX;
      isSaveRmtEsignSuccess =
          XPOSPClientUtils.saveElecsignPic(
              rmtElecSignDataFileName,
              request.getMrchNo(),
              request.getStoreNo(),
              request.getRmtElecsignData());
      isSaveBnyEsignSuccess =
          XPOSPClientUtils.saveElecsignPic(
              bnyElecSignDataFileName,
              request.getMrchNo(),
              request.getStoreNo(),
              request.getBnyElecsignData());
      request.setRmtElecsignData(null); // 由于电子签名数据量大,保存成功后清空
      request.setBnyElecsignData(null); // 由于电子签名数据量大,保存成功后清空
    }

    PayCCPC payCCPC = new PayCCPC();
    payCCPC.setPayNo(payNo);
    payCCPC.setMrchNo(request.getMrchNo());
    payCCPC.setMrchName(merchant.getMrchName());
    payCCPC.setStoreNo(request.getStoreNo());
    payCCPC.setStoreName(store == null ? null : store.getStoreName());
    payCCPC.setOperatorName(mrchUsr.getUsrName());
    payCCPC.setUpSno(upSno);
    payCCPC.setImei(request.getImei());
    payCCPC.setLatitude(location == null ? null : location.getLatitude());
    payCCPC.setLongitude(location == null ? null : location.getLongitude());
    payCCPC.setRmtAccNo(request.getRmtAccNo());
    payCCPC.setRmtBankName(request.getRmtBankName());
    payCCPC.setBnyAccNo(request.getBnyAccNo());
    payCCPC.setBnyAccName(request.getBnyAccName());
    payCCPC.setBnyBankName(request.getBnyBankName());
    payCCPC.setIsNeedBillInfo(
        request.getIsNeedBillInfo() == null ? false : request.getIsNeedBillInfo());
    payCCPC.setNotifyMobile(request.getNotifyMobile());
    payCCPC.setRmtElecsignStatus(
        isSaveRmtEsignSuccess ? Const.VLDSTATE_VALID : Const.VLDSTATE_INVALID);
    payCCPC.setBnyElecsignStatus(
        isSaveBnyEsignSuccess ? Const.VLDSTATE_VALID : Const.VLDSTATE_INVALID);
    payCCPC.setCnaps(request.getCnaps());
    payCCPC.setBnyAmt(request.getBnyAmt());
    payCCPC.setBnyRealAmt(request.getBnyAmt());
    payCCPC.setRemitStatus(CCPCConfig.REMIT_STATUS_CCPC_PROCESSING);
    payCCPC.setUsrLogin(mrchUsr.getUsrLogin());
    payCCPC.setRemark(request.getRemark());
    payCCPCService.addPayCCPC(payCCPC);
    // 对外付款
    payCCPC = remitProcess.pay(payCCPC);
    PayInfoResponse response = payCCPCToPayInfoResponse(payCCPC);
    return response;
  }
  public UlinkplusResponseInfo process(
      CupsTrmnl cupsTrmnl, UlinkplusKeyManage ulinkplusKeyManage, UlinkplusRequestInfo request)
      throws TransferFailedException {
    logger.info("ulinkplus渠道信用卡手续费查询开始...");
    // 1.组装报文
    CreditcardFeeQueryTradeRequestEntity requestEntity =
        packUp(cupsTrmnl, ulinkplusKeyManage, request);

    // TODO 是否需要记录交易流水

    // 1.2mac计算
    byte[] iso_8583_main = requestEntity.pack();
    byte[] input = ArrayUtils.subarray(iso_8583_main, 6, iso_8583_main.length - 8); // 去除body head
    byte[] macKey = CodecUtils.hex2byte(ulinkplusKeyManage.getTrmnlMacKey());

    //		byte[] mac = MacUtils.tCountMAC_CBC(input, macKey);
    //		input = ArrayUtils.subarray(iso_8583_main, 0, iso_8583_main.length-8);
    //		iso_8583_main = ArrayUtils.addAll(input, mac);

    byte[] mac;
    try {
      mac = CodecUtils.hex2byte(hsmService.calculateMAC_LOCALLIFE(macKey, input));
      input = ArrayUtils.subarray(iso_8583_main, 0, iso_8583_main.length - 8);
      iso_8583_main = ArrayUtils.addAll(input, mac);
    } catch (HSMException e) {
      String hsmRespCode = XPOSPClientUtils.getCode(e);
      if (!AppExCode.UNKNOWN.equals(hsmRespCode)) {
        hsmRespCode = Const.TP_BEGIN_HSM + hsmRespCode;
      }
      logger.error(
          "ulinkplus credicard fee query failed,when calculate mac form hsm error code["
              + hsmRespCode
              + "]");
      throw new TransferFailedException(
          hsmRespCode,
          "ulinkplus credicard fee query failed,when calculate mac form hsm error code["
              + hsmRespCode
              + "]");
    }
    // 1.3组装报文报文头
    byte[] iso_8583_body =
        ArrayUtils.addAll(
            XPOSPClientUtils.getTpduHeader(XpospSysProperty.getUlinkPlusQmf1TPDU()).pack(),
            iso_8583_main);
    String iso_8583_body_length =
        StringUtils.leftPad(Integer.toHexString(iso_8583_body.length), 4, "0");
    byte[] iso_8583_length = ISOUtils.hex2byte(iso_8583_body_length);
    byte[] iso_8583 = ArrayUtils.addAll(iso_8583_length, iso_8583_body);

    // 2.发送报文
    byte[] respData =
        TCPUtils.getInstance().sendReciveMsg(iso_8583, XpospSysProperty.getUlinkPlusQMFIP_PORT());

    // 3.解析报文
    UlinkplusResponseInfo response = new UlinkplusResponseInfo();
    try {
      CreditcardFeeQueryTradeResponseEntity responseEntity = unpack(respData);
      // CreditcardFeeQueryTradeResponseEntity responseEntity = getResponseData(null);
      String isoRespCode = responseEntity.getRespCode();
      if (!Const.ISO_RESPCODE_OK.equals(isoRespCode)) {
        isoRespCode = XPOSPClientUtils.getRespCode(isoRespCode);
        isoRespCode =
            Const.TP_BEGIN_ISO + StringUtils.leftPad("" + Integer.parseInt(isoRespCode), 3, "0");

        logger.info(
            "pay via ulinkplus failed,iso error code[" + responseEntity.getRespCode() + "]");
        throw new TransferFailedException(
            isoRespCode,
            "pay via ulinkplus failed,iso error code[" + responseEntity.getRespCode() + "]");
      }

      // 响应
      try {
        String selfDefined48 = new String(responseEntity.getSelfDefined48(), "GBK");
        logger.debug("信用卡还款手续费查询,48域信息:" + selfDefined48);
        // 位置	长度	格式	内容	说明
        // 0	2	n2	用法标志	“PA”
        // 2	2	n2	帐单号码类型	08
        // 4	12	n12	还款总金额	右对齐,左补空格
        // 16	12	n12	手续费	右对齐,左补空格
        // 28	12	n12	还款金额	右对齐,左补空格
        // 40	100	Ans100	终端提示信息	左对齐,右补空格
        // 140	11	N11	手机号码	左对齐,右补空格
        // 151	1	ans1	结束标志	#
        response.setFee(
            StringUtils.amtToBigDecimal(StringUtils.trimToEmpty(selfDefined48.substring(16, 28)))
                .toPlainString());
        response.setMsgTip(
            StringUtils.trimToEmpty(selfDefined48.substring(40, selfDefined48.length() - 12)));
      } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
      }
    } catch (RuntimeException e) {
      // 更新终端流水
      cupsTrmnlService.updateCupsTrmnlFlowNo(cupsTrmnl);
      throw e;
    }

    logger.info("ulinkplus渠道手机充值结束...");
    return response;
  }