/**
   * 订单支付成功确认
   *
   * @param orderCode
   * @param memberPin
   * @param payChannel
   * @param payCode
   * @param payTime
   * @return
   */
  @RequestMapping(value = "/update/orderPaySuccessConfirm", method = RequestMethod.POST)
  @ResponseBody
  public RestResultDTO orderPaySuccessConfirm(
      String memberPin,
      String orderCode,
      Integer payMoney,
      Integer payChannel,
      String payCode,
      String payTime) {
    RestResultDTO restResultDTO = new RestResultDTO();
    try {
      CommonValidateUtil.notEmpty(memberPin, "会员不能为空");
      if (!CommonValidateUtil.validateFixedLengthDigital(orderCode, 20)) {
        throw new IllegalArgumentException("请输入正确的订单号");
      }

      Validate.notNull(payMoney, "支付金额不能为空");

      if (payMoney <= 0) {
        throw new IllegalArgumentException("请输入正确的支付金额");
      }

      Validate.notNull(payChannel, "支付渠道不能为空");
      Validate.notNull(OrderPayChannelEnum.get(payChannel), "支付渠道不能为空");

      if (!CommonValidateUtil.validateRangeLengthStr(payCode, 1, 50)) {
        throw new IllegalArgumentException("支付编码不能为空");
      }
      CommonValidateUtil.notEmpty(payTime, "支付时间不能为空");

      restResultDTO =
          orderCreateAndPayService.orderPaySuccessConfirm(
              memberPin,
              orderCode,
              payMoney,
              payChannel,
              payCode,
              DateOperator.parse(payTime, "yyyyMMddHHmmss"));

      /*----- 校验订单上的产品副本是否已和保险公司对接成功 -----*/
      Order order = orderRelatedQueryService.getByOrderCode(orderCode);

      if (order != null && order.getId() != null) {
        if (!order.getProductDocked())
          restResultDTO.setBody(CustomCode.NO_CALL_AUTOMATIC_INS_ACCEPT_INTER);
      }

    } catch (Exception e) {
      exceptionDeal(restResultDTO, e, "orderPaySuccessConfirm", "订单支付成功确认失败");
    }

    return restResultDTO;
  }
 /**
  * 干系人证件号码校验
  *
  * @param stackholderCat
  * @param paperCat
  * @param paperNo
  */
 public static void stackholderPaperNoValidator(
     String stackholderCat, Byte paperCat, String paperNo) {
   // 证件号码
   CommonValidateUtil.notEmpty(paperNo, "证件号码不能为空[" + stackholderCat + "]");
   if (PaperCatEnum.IDENTITY_CARD.getValue().equals(String.valueOf(paperCat.intValue()))) {
     if (!CommonValidateUtil.validateIdentityCardNum(paperNo)) {
       throw new IllegalArgumentException("请输入正确的身份证号码[" + stackholderCat + "]");
     }
   } else if (PaperCatEnum.OFFICIAL_CARD.getValue().equals(String.valueOf(paperCat.intValue()))) {
     if (!CommonValidateUtil.validateDigital(paperNo)) {
       throw new IllegalArgumentException("请输入正确的军人证号码[" + stackholderCat + "]");
     }
   }
 }
  /**
   * 订单可否支付确认
   *
   * @param request
   * @param orderCode
   * @return
   */
  @RequestMapping(value = "/query/orderBePaidConfirm", method = RequestMethod.POST)
  @ResponseBody
  public RestResultDTO orderBePaidConfirm(String orderCode) {
    RestResultDTO restResultDTO = new RestResultDTO();
    try {
      if (!CommonValidateUtil.validateFixedLengthDigital(orderCode, 20)) {
        throw new IllegalArgumentException("请输入正确的订单号");
      }

      Order order = orderRelatedQueryService.getByOrderCode(orderCode);
      restResultDTO.initStatus(StatusCode.OK);
      if (order != null) {
        if (order.getOrderStatus() == OrderStatusEnum.CREATED.getValue()) {
          restResultDTO.setBody(JhjMoneyUtil.getInstance().getMoneyString(order.getTotalPrice()));
        } else {
          restResultDTO.initStatus(StatusCode.INTERNAL_SERVER_ERROR);
          restResultDTO.setMessage("订单已支付或已关闭,不能再支付");
        }
      } else {
        restResultDTO.initStatus(StatusCode.NOT_FOUND);
      }
    } catch (Exception e) {
      exceptionDeal(restResultDTO, e, "orderBePaidConfirm", "订单可否支付确认失败");
    }

    return restResultDTO;
  }
 /**
  * 干系人证件有效期校验
  *
  * @param stackholderCat
  * @param paperValiPeriod
  */
 public static void stackholderPaperPeriodValidator(
     String stackholderCat, String paperValiPeriod) {
   // 证件号码有效期
   if (!CommonValidateUtil.validatePaperValiPeriod(paperValiPeriod)) {
     throw new IllegalArgumentException("请输入正确的证件有效期[" + stackholderCat + "]");
   }
 }
 /**
  * 干系人地址校验
  *
  * @param stackholderCat
  * @param addr
  */
 public static void stackholderAddrValidator(String stackholderCat, String addr) {
   // 地址
   CommonValidateUtil.notEmpty(addr, "地址不能为空[" + stackholderCat + "]");
   if (addr.length() > 75) {
     throw new IllegalArgumentException("地址的长度不能大于75[" + stackholderCat + "]");
   }
 }
  /**
   * 分页查询订单列表
   *
   * @param query
   * @return
   */
  @RequestMapping(value = "/query/pageGetOrders", method = RequestMethod.POST)
  @ResponseBody
  public RestResultDTO pageGetPartialFiledsViewListByQuery(OrderQuery query) {
    RestResultDTO restResponse = new RestResultDTO();
    query.setId(null);
    query.setMemberName(null);
    query.setOrderCode(null);
    try {
      CommonValidateUtil.notEmpty(query.getMemberPin(), "会员不能为空");
      PaginatedList<PartialFiledsOrderVO> list =
          orderRelatedQueryService.pageGetPartialFiledsViewListByQuery(query);
      PageList<PartialFiledsOrderVO> pageList =
          new PageList<PartialFiledsOrderVO>(
              list.getPageSize(),
              list.getIndex(),
              list.getTotalItem(),
              list.getTotalPage(),
              list.isFirstPage(),
              list.isLastPage(),
              list);
      restResponse.setBody(pageList);
      restResponse.initStatus(StatusCode.OK);
    } catch (Exception e) {
      exceptionDeal(restResponse, e, "pageGetPartialFiledsViewListByQuery", "查询订单列表失败");
    }

    return restResponse;
  }
  /**
   * 干系人姓名校验
   *
   * @param stackholderCat
   * @param name
   */
  public static void stackholderNameValidator(String stackholderCat, String name) {

    // 姓名
    CommonValidateUtil.notEmpty(name, "姓名不能为空[" + stackholderCat + "]");
    if (name.length() > 20) {
      throw new IllegalArgumentException("姓名的长度不能大于20[" + stackholderCat + "]");
    }
  }
  /**
   * 干系人电子邮箱校验
   *
   * @param stackholderCat
   * @param email
   */
  public static void stackholderEmailValidator(String stackholderCat, String email) {

    String errorTip = "请输入 正确的电子邮箱[" + stackholderCat + "]";

    // 电子邮箱
    if (!CommonValidateUtil.validateEmail(email)) {
      throw new IllegalArgumentException(errorTip);
    }
  }
  /**
   * 干系人手机号码校验
   *
   * @param stackholderCat
   * @param mobile
   */
  public static void stackholderMobileValidator(String stackholderCat, String mobile) {

    String errorTip = "请输入 正确的手机号码[" + stackholderCat + "]";

    // 手机号码
    if (!CommonValidateUtil.validateMobile(mobile)) {
      throw new IllegalArgumentException(errorTip);
    }
  }
  /**
   * 订单支付失败确认
   *
   * @param memberPin
   * @param orderCode
   * @param reason
   * @return
   */
  @RequestMapping(value = "/update/orderPayFailureConfirm", method = RequestMethod.POST)
  @ResponseBody
  public RestResultDTO orderPayFailureConfirm(String memberPin, String orderCode, String reason) {
    RestResultDTO restResultDTO = new RestResultDTO();
    try {
      CommonValidateUtil.notEmpty(memberPin, "会员不能为空");
      if (!CommonValidateUtil.validateFixedLengthDigital(orderCode, 20)) {
        throw new IllegalArgumentException("请输入正确的订单号");
      }

      if (!CommonValidateUtil.validateRangeLengthStr(reason, 1, 50)) {
        throw new IllegalArgumentException("请输入正确的失败原因");
      }
      orderCreateAndPayService.orderPayFailureConfirm(memberPin, orderCode, reason);
      restResultDTO.initStatus(StatusCode.OK);
    } catch (Exception e) {
      exceptionDeal(restResultDTO, e, "orderPayFailureConfirm", "订单支付失败确认失败");
    }
    return restResultDTO;
  }
  /**
   * 干系人国籍校验
   *
   * @param stackholderCat
   * @param nationality
   */
  public static void stackholderNationalityValidator(String stackholderCat, String nationality) {

    String errorTip = "请输入 正确的国籍[" + stackholderCat + "]";

    if (CommonValidateUtil.isEmpty(nationality)) {
      throw new IllegalArgumentException(errorTip);
    }

    // 非法的国籍
    if (NationalityEnum.get(nationality) == null) throw new IllegalArgumentException(errorTip);
  }
 @RequestMapping(value = "/query/getOrderDetail", method = RequestMethod.POST)
 @ResponseBody
 public RestResultDTO getDetail(String orderCode, String memberPin) {
   RestResultDTO restResponse = new RestResultDTO();
   try {
     CommonValidateUtil.notEmpty(memberPin, "会员不能为空");
     if (CommonValidateUtil.validateFixedLengthDigital(orderCode, 20)) {
       // Order entity = orderRelatedQueryService.getByOrderCodeAndMemPin(orderCode, memberPin);
       Order entity = orderRelatedQueryService.getByOrderCode(orderCode);
       if (entity != null && entity.getMemberPin().equals(memberPin)) {
         restResponse.setBody(new OrderVO(entity));
       }
     }
     restResponse.initStatus(StatusCode.OK);
     // logRequest(request.getRemoteAddr(), "查询订单[订单号]", orderCode, "成功");
   } catch (Exception e) {
     exceptionDeal(restResponse, e, "getDetail", "查询订单失败[订单号]");
   }
   return restResponse;
 }
 /**
  * 干系人邮编校验
  *
  * @param stackholderCat
  * @param zip
  */
 public static void stackholderZipValidator(String stackholderCat, String zip) {
   // 邮编
   if (!CommonValidateUtil.validateZipcode(zip)) {
     throw new IllegalArgumentException("请输入正确的邮编[" + stackholderCat + "]");
   }
 }