/** * 处理.K米APP批量获取会员信息 * * @param param * @param model */ private void handleMemberInfo(KDynamicReqParam param, Model model) { // 校验参数非空 ValidationUtils.rejectEmpty( new Object[] {param.get("customerid")}, new String[] {"customerid"}); // 获取K米APP会员ID getCustomerid(param.any(), model); }
/** * 获取参数值 * * @param param * @param model */ private void handleGetParamers(KDynamicReqParam param, Model model) { // 校验商家信息参数 validationCompanyInfo(param, model); // 其他参数信息校验 ValidationUtils.rejectEmpty(new Object[] {param.get("data")}, new String[] {"data"}); // 其他参数 model.addAttribute(OTHER_PARAM, param.any()); }
/** * 商家密码更新 * * @param param * @param model */ private void handleUpdateCompanyPSWD(KDynamicReqParam param, Model model) { // 校验商家信息参数 validationCompanyInfo(param, model); // 密码非空校验 ValidationUtils.rejectEmpty( new Object[] {param.get("newcompanypsw")}, new String[] {"newcompanypsw"}); model.addAttribute(OTHER_PARAM, param.any()); }
/** * 商家信息校验及参数填充 * * @param param * @param model */ private void validationCompanyInfo(KDynamicReqParam param, Model model) { ValidationUtils.rejectEmpty(new Object[] {param.getCompanyid()}, new String[] {"companyid"}); // 获取商家信息 getCompany(param.getCompanyid(), model); // 获取商家公众号 getWechatPubInfoID(param.getCompanyid(), model); }
@Test public void testBindCardInfo() throws Exception { String actionPath = "/Km/bindCardInfo"; KDynamicReqParam param = new KDynamicReqParam(); param.setCompanyid(1197); param.setAccess_token(accessToken); param.set("cardnum", "5000028"); BaseDto pDto = HttpClientUtils.post(ip + actionPath, param, BaseDto.class); System.out.println(pDto); }
/** * 处理K米APP获取绑卡信息 * * @param param * @param model */ private void handleBindCardInfo(KDynamicReqParam param, Model model) { // 校验参数非空 ValidationUtils.rejectEmpty( new Object[] {param.getCompanyid(), param.get("cardnum")}, new String[] {"companyid", "cardnum"}); // 获取商家信息 getCompany(param.getCompanyid(), model); // 获取商家公众号 getWechatPubInfoID(param.getCompanyid(), model); // 其他参数 getOtherParam(param.any(), model); }
@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); } }
@Test public void testUpdateMemberInfo() throws Exception { String actionPath = "/Km/updateMemberInfo"; KDynamicReqParam param = new KDynamicReqParam(); param.setCompanyid(1197); param.setAccess_token(accessToken); param.set("kmid", "000000023"); param.set("membername", "林龙灯3"); param.set("sex", "男"); param.set("birthday", "1988-10-21"); param.set("mobile", "18960863890"); BaseDto pDto = HttpClientUtils.post(ip + actionPath, param, BaseDto.class); System.out.println(pDto); }
/** * K米APP完善会员资料 * * @param param * @param model */ private void handleUpdateMemberInfo(KDynamicReqParam param, Model model) { ValidationUtils.rejectEmpty( new Object[] { param.getCompanyid(), param.get("kmid"), param.get("membername"), param.get("sex"), param.get("mobile"), param.get("birthday") }, new String[] {"companyid", "kmid", "membername", "sex", "mobile", "birthday"}); // 获取商家信息 getCompany(param.getCompanyid(), model); // 获取商家公众号 getWechatPubInfoID(param.getCompanyid(), model); // 其他参数 getOtherParam(param.any(), model); }
/** * 处理K米APP绑卡,校验参数,注入商家信息,微信公众号,其他参数 * * @param param * @param model */ private void handleBindCard(KDynamicReqParam param, Model model) { // 非空校验 ValidationUtils.rejectEmpty( new Object[] { param.getCompanyid(), param.get("customerid"), param.get("cardnum"), param.get("moblie"), }, new String[] {"companyid", "customerid", "cardnum", "moblie"}); // 获取商家信息 getCompany(param.getCompanyid(), model); // 获取商家公众号 getWechatPubInfoID(param.getCompanyid(), model); // 其他参数 getOtherParam(param.any(), model); // 获取K米APP会员ID getCustomerid(param.any(), model); }
/** * K米APP获取会员消费记录 * * @param param * @param model */ private void handleMemberConsumeInfo(KDynamicReqParam param, Model model) { // 校验参数非空 ValidationUtils.rejectEmpty( new Object[] { param.getCompanyid(), param.get("kmid"), param.get("begintime"), param.get("endtime") }, new String[] {"companyid", "kmid", "begintime", "endtime"}); // 获取商家信息 getCompany(param.getCompanyid(), model); // 获取商家公众号 getWechatPubInfoID(param.getCompanyid(), model); // 其他参数 getOtherParam(param.any(), model); }
@Test public void testMemberConsumeInfo() throws Exception { String actionPath = "/Km/memberConsumeInfo"; KDynamicReqParam param = new KDynamicReqParam(); param.setCompanyid(1197); param.setAccess_token(accessToken); param.set("kmid", "111111"); param.set("begintime", "2015-01-01 00:00:00"); param.set("endtime", "2015-06-23 23:59:59"); BaseDto pDto = HttpClientUtils.post(ip + actionPath, param, BaseDto.class); System.out.println(pDto); }
/** * 在线会员申请 * * @param param * @param model */ private void handleApplyForMember(KDynamicReqParam param, Model model) { // 校验商家信息参数 validationCompanyInfo(param, model); // 查询该功能是否开启 checkParamer( param.getCompanyid(), AppConstants.KM_ONLINE_CUSTOMER, AppConstants.PARAMER_ACTIVE); // 其他参数信息校验 ValidationUtils.rejectEmpty( new Object[] { param.getAsInteger("customerid"), param.getAsInteger("gradeid"), param.getAsString("membername"), param.getAsString("sex"), param.getAsString("mobile"), param.getAsString("birthday") }, new String[] {"customerid", "gradeid", "membername", "sex", "mobile", "birthday"}); // 其他参数 param.get("papertype"),param.get("papernumber"), model.addAttribute(OTHER_PARAM, param.any()); }
/** * 根据电子会员卡id获取会员信息 * * @param param * @param model */ private void handlememberInfoByKmID(KDynamicReqParam param, Model model) { ValidationUtils.rejectEmpty(new Object[] {param.get("kmid")}, new String[] {"kmid"}); model.addAttribute(KMID, param.get("kmid")); }