コード例 #1
0
  @ModelAttribute
  public void populateModel(
      @RequestBody @Valid KDynamicReqParam param, HttpServletRequest request, Model model) {
    String requestURI = request.getRequestURI();
    // 验证token
    AppUtils.assertTrueAccess(authService.checkAccessToken(param.getAccess_token()));
    // K米APP获取绑卡信息
    if (requestURI.endsWith("bindCardInfo")) {
      // 数据校验,数据处理
      handleBindCardInfo(param, model);
    }
    // 处理.K米APP批量获取会员信息
    else if (requestURI.endsWith("memberInfo")) {
      handleMemberInfo(param, model);
    }
    // 处理K米APP绑卡
    else if (requestURI.endsWith("bindCard")) {
      handleBindCard(param, model);
    }
    // K米APP获取会员消费记录
    else if (requestURI.endsWith("memberConsumeInfo")) {
      handleMemberConsumeInfo(param, model);
    }
    // K米APP完善会员资料
    else if (requestURI.endsWith("updateMemberInfo")) {
      handleUpdateMemberInfo(param, model);
    }
    // 根据电子会员卡号获取会员信息
    else if (requestURI.endsWith("memberInfoByKmID")) {
      handlememberInfoByKmID(param, model);
    }

    // 获取参数
    else if (requestURI.endsWith("getParamer")) {
      handleGetParamers(param, model);
    }
    // 更新参数
    else if (requestURI.endsWith("updateParamer")) {
      handleUpdateParamer(param, model);
    }
    // 商家密码更新
    else if (requestURI.endsWith("updateCompanyPsw")) {
      handleUpdateCompanyPSWD(param, model);
    }
    // 在线会员申请
    else if (requestURI.endsWith("applyForMember")) {
      handleApplyForMember(param, model);
    }
    // 获取在线申请会员等级
    else if (requestURI.endsWith("applyMemberLevel")) {
      handleApplyMemberLevel(param, model);
    }
  }
コード例 #2
0
 @Override
 public IRespParam pushTemplate(List<BaseDto> kmTemplateList) throws Exception {
   for (BaseDto baseDto : kmTemplateList) {
     baseDto.put(TOKEN_NAME, getKmAccessToken());
     MRespParam resp = HttpClientUtils.post(getUrl(sendSMS_path), baseDto, MRespParam.class);
     if (AppUtils.checkSuccess(resp.getRet())) {
       logger.debug("向KM推送模板消息成功,{}", kmTemplateList);
     } else {
       logger.error("向KM推送模板消息失败,{}", kmTemplateList, "返回消息是:", resp);
     }
     return resp;
   }
   return null;
 }
コード例 #3
0
 @Override
 public IRespParam sendsms(KSmsReqParam param) throws Exception {
   Dto pDto = new BaseDto();
   pDto.put(TOKEN_NAME, getKmAccessToken());
   pDto.put("phoneno", param.getPhoneno());
   Dto nestedDto = new BaseDto();
   nestedDto.put("validcode", param.getValidcode());
   pDto.put("sms_content", nestedDto);
   MRespParam resp = HttpClientUtils.post(getUrl(sendSMS_path), pDto, MRespParam.class);
   if (AppUtils.checkSuccess(resp.getRet())) {
     logger.debug("发送短信成功,手机号是{}", param.getPhoneno());
   } else {
     logger.error("发送短信失败,手机号是{}", param.getPhoneno(), "返回消息是:", resp);
   }
   return resp;
 }
コード例 #4
0
 /**
  * 参数检查,不同过时直接返回
  *
  * @param paramerName 参数名
  * @param trueValue 为真时的参数值
  * @return
  */
 public void checkParamer(int companyID, String paramerName, String trueValue) {
   if (!companyService.validateParamActive(companyID, paramerName, trueValue)) {
     AppUtils.notActive();
   }
 }
コード例 #5
0
 /**
  * 获取微信公众号ID
  *
  * @param companyid
  * @param model
  */
 private void getWechatPubInfoID(int companyid, Model model) {
   Companywechatpub companywechatpub = companywechatpubRepository.findFirstByCompanyID(companyid);
   // 商家公众号
   AppUtils.assertWechatNotNull(companywechatpub);
   model.addAttribute(WECHATPUBINFOID, companywechatpub.getWechatPubInfoID());
 }
コード例 #6
0
 /**
  * 获取商户
  *
  * @param companyid
  */
 private void getCompany(int companyid, Model model) {
   Company company = companyRepository.findOne(companyid);
   // 商家不能为空
   AppUtils.assertCompanyNotNull(company);
   model.addAttribute(COMPANY, company);
 }