| | |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | String key = StringUtil.Md5("taobao-code-" + code);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoCode, code);
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key)))
|
| | | return;
|
| | | redisManager.cacheCommonString(key, 1 + "", 5);
|
| | |
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | List<TaoBaoOrder> orders = map.get(key);
|
| | | String redisKey = "addorderqueue-" + key;
|
| | | String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.addOrderQueue, key);
|
| | | // redis做频率限制
|
| | | if (Constant.IS_OUTNET) {
|
| | | try {
|
| | |
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | if (id == null)
|
| | | return;
|
| | | page = page < 1 ? 1 : page;
|
| | | String key = String.format("getCouponListByClass-%s-%s", id + "", page + "");
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.couponByClass, id + "-" + page);
|
| | | String resultStr = "";
|
| | |
|
| | | if (Constant.IS_OUTNET)
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | | *
|
| | | */
|
| | | // if (Constant.IS_OUTNET) {
|
| | | String key = "linkParse-" + acceptData.getDevice() + "-" + id;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaolinkParse, acceptData.getDevice() + "-" + id);
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | out.print(JsonUtil.loadFalseResult(11, "请求频率限制"));
|
| | |
| | | nextTime.set(Calendar.MILLISECOND, 0);
|
| | |
|
| | | JSONArray array = null;
|
| | | String timekey = String.format("spikeGoods_hour-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | | String cachekey = String.format("spikeGoodsList-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | | String timekey = RedisKeyEnum.getRedisKey(RedisKeyEnum.spikeGoodsHour,acceptData.getPlatform() +"-"+acceptData.getVersion());
|
| | | String cachekey = RedisKeyEnum.getRedisKey(RedisKeyEnum.spikeGoodsList,acceptData.getPlatform() +"-"+acceptData.getVersion());
|
| | |
|
| | | String timeValue = redisManager.getCommonString(timekey);
|
| | | if (timeValue == null || !timeValue.equals(hour + "")) {
|
| | |
| | | import com.yeshi.fanli.service.inter.user.SMSService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | |
| | | String cachekey = null;
|
| | | if (type == 1) {
|
| | | // 登录验证码
|
| | | cachekey = "sendMSNLoginCount" + phone;
|
| | | cachekey = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLoginCount, phone + "" );
|
| | | } else if (type == 2) {
|
| | | // 绑定验证码
|
| | | cachekey = "sendMSNBindCount" + phone;
|
| | | cachekey = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSBindCount, phone + "" );
|
| | | }
|
| | |
|
| | | if (cachekey == null) {
|
| | |
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String key = "bindalipay-" + uid;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.bindAlipay, uid + "");
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "服务器繁忙,请稍后重试"));
|
| | | return;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String key = "bindalipay-" + uid;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.bindAlipay, uid + "");
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | | out.print(JsonUtil.loadFalseResult(1001, "服务器繁忙,请稍后重试"));
|
| | | return;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String key = "bindalipay-" + uid;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.bindAlipay, uid + "");
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | | out.print(JsonUtil.loadFalseResult(1001, "服务器繁忙,请稍后重试"));
|
| | | return;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.invite.MsgInviteDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.msg.MsgAccountDetailService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | }
|
| | |
|
| | | // String key = "recommend-goods-user-" + uid;
|
| | | String key = "recommend-goods-user-" + device;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.recommendGoodsUser, device);
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (canAdd && StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | | if (Constant.IS_OUTNET)
|
| | |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "请绑定淘宝")));
|
| | | return;
|
| | | }
|
| | | String elmeLink = redisManager.getCommonString("elme-link-" + uid);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.elmeLink, uid + "");
|
| | | String elmeLink = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(elmeLink)) {
|
| | | elmeLink = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_ELEME_PID.split("_")[3],
|
| | | "1571715733668", userInfoExtra.getRelationId());
|
| | | if (!StringUtil.isNullOrEmpty(elmeLink)) {
|
| | | redisManager.cacheCommonString("elme-link-" + uid, elmeLink, 60 * 60);// 缓存1个小时
|
| | | redisManager.cacheCommonString(key, elmeLink, 60 * 60);// 缓存1个小时
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | |
| | | if (wxUnionId == null || wxUnionId.trim().length() == 0)
|
| | | throw new UserInfoExtraException(1, "微信授权失败");
|
| | |
|
| | | String activeWX = StringUtil.Md5("activeWX:" + weiXinUser.getUnionid());
|
| | | redisManager.cacheCommonString(activeWX, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("activeWX:" + weiXinUser.getUnionid()));
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
|
| | |
|
| | | // 邀请关系用户信息
|
| | | UserInfo userInfo = userInfoExtraService.getInviterInfo(uid, wxUnionId);
|
| | |
| | | data.put("nickName", userInfo.getNickName());
|
| | | data.put("portrait", userInfo.getPortrait());
|
| | | data.put("tips", "确认要成为TA的直接粉丝吗?邀请关系一旦建立不可更改。");
|
| | | data.put("key", activeWX);
|
| | | data.put("key", key);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | | }
|
| | |
|
| | | JSONArray array = null;
|
| | | String timekey = String.format("spikeGoods_hour_new-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | | String cachekey = String.format("spikeGoodsList_new-%s-%s", acceptData.getPlatform(), acceptData.getVersion());
|
| | | String timekey = RedisKeyEnum.getRedisKey(RedisKeyEnum.spikeGoodsHourNew,acceptData.getPlatform() +"-"+acceptData.getVersion());
|
| | | String cachekey = RedisKeyEnum.getRedisKey(RedisKeyEnum.spikeGoodsListNew,acceptData.getPlatform() +"-"+acceptData.getVersion());
|
| | |
|
| | | |
| | | Calendar nowCalendar = Calendar.getInstance();
|
| | | nowCalendar.setTimeInMillis(nowTime);
|
| | | int hour = nowCalendar.get(Calendar.HOUR_OF_DAY);
|
| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String key = "s11-superhongbao-" + info.getRelationId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11SuperHongBao, info.getRelationId() +"");
|
| | | String token = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | | try {
|
| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String key = "s11-superhongbao-" + info.getRelationId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11SuperHongBao, info.getRelationId() +"");
|
| | | String token = null;
|
| | | token = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(token)) {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String key = "s11-yushou-" + info.getRelationId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11YuShou, info.getRelationId() + "");
|
| | | String token = null;
|
| | | if (Constant.IS_OUTNET)
|
| | | token = redisManager.getCommonString(key);
|
| | |
| | | private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
|
| | |
|
| | | /**
|
| | | * 站内信提醒队员添加微信号
|
| | | * 专属邀请码条件
|
| | | *
|
| | | * @param acceptData
|
| | | * @param uid
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | JSONArray array1 = new JSONArray();
|
| | | array1.add("1.邀请码可帮助好友激活邀请功能;");
|
| | | array1.add("2.好友通过你的邀请码激活邀请功能后,将成为你的直接粉丝,未来产生的订单你都有奖金;");
|
| | | array1.add("3.邀请码具有唯一性。");
|
| | | |
| | | JSONObject desc1 = new JSONObject();
|
| | | desc1.put("title", "邀请码的作用");
|
| | | desc1.put("content",array1);
|
| | | |
| | | JSONArray array2 = new JSONArray();
|
| | | array2.add("1.你可以自由设置4~12位简单易记的邀请码;");
|
| | | array2.add("2.专属邀请码是对你和你的团队尊贵身份的彰显。");
|
| | | |
| | | JSONObject desc2 = new JSONObject();
|
| | | desc2.put("title", "专属邀请码优势");
|
| | | desc2.put("content",array2);
|
| | | |
| | | JSONArray array = new JSONArray();
|
| | | array.add(desc1);
|
| | | array.add(desc2);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("desc", array);
|
| | | data.put("num", threeSaleSerivce.countFirstTeam(uid, 1));
|
| | | data.put("limit", Constant.INVITE_CODRE_TAILOR_LIMIT);
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.service.inter.user.wx.WXMPUserLoginService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | |
| | |
|
| | | UserInfo lastUserInfo = null;
|
| | | if (!StringUtil.isNullOrEmpty(userData)) {
|
| | | String key = StringUtil.Md5("wxmp-user-login-" + acceptData.getAppId() + "-" + acceptData.getOpenId());
|
| | | String data = redisManager.getCommonString(key);
|
| | | String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin, StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
|
| | | String data = redisManager.getCommonString(redisKey);
|
| | | if (!StringUtil.isNullOrEmpty(data)) {
|
| | | lastUserInfo = new Gson().fromJson(data, UserInfo.class);
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String key = StringUtil.Md5("wxmp-user-login-" + acceptData.getAppId() + "-" + acceptData.getOpenId());
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin, StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
|
| | |
|
| | | UserInfo user = new Gson().fromJson(redisManager.getCommonString(key), UserInfo.class);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户数据为空"));
|
| | |
| | | private void printWXMPLoginResult(String appId, String openId, WXMPLoginResult result, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | String key = StringUtil.Md5("wxmp-user-login-" + appId + "-" + openId);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin, StringUtil.Md5(appId + "-" + openId));
|
| | |
|
| | | switch (result.getCode()) {
|
| | | case WXMPLoginResult.CODE_SUCCESS:
|
| | | UserInfo user = userInfoService.selectAvailableByPrimaryKey(result.getUser().getId());
|
| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.cmq.JDOrderCMQManager;
|
| | |
| | | /**
|
| | | * 做频率限制
|
| | | */
|
| | | String key = "jd-order-" + order.getOrderId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.JDOrder, order.getOrderId() + "" );
|
| | | String result = redisManager.getCommonString(key);
|
| | | // 判断
|
| | |
|
| | |
| | | import com.yeshi.fanli.exception.pdd.PDDOrderException;
|
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.cmq.PDDOrderCMQManager;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | |
| | | /**
|
| | | * 做频率限制
|
| | | */
|
| | | String key = "pdd-order-" + order.getOrderSn();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.PDDOrder, order.getOrderSn() + "" );
|
| | | String result = redisManager.getCommonString(key);
|
| | | // if (!StringUtil.isNullOrEmpty(result))
|
| | | // continue;
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | String redisKey = "addorderqueue-" + key;
|
| | | String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.addOrderQueue, key);
|
| | | // redis做频率限制
|
| | | try {
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(redisKey))) {
|
| | |
| | | List<TaoBaoOrder> taoBaoOrderList = taoBaoOrderService.getTaoBaoOrderByOrderId(lo.getOrderId());
|
| | | // 清除频率限制
|
| | | if (taoBaoOrderList != null && taoBaoOrderList.size() > 0) {
|
| | | String key = "addorderqueue-" + lo.getOrderId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.addOrderQueue, lo.getOrderId());
|
| | |
|
| | | redisManager.removeCommonString(key);
|
| | | addOrder(taoBaoOrderList);
|
| | | LogHelper.test("自动处理淘宝订单:" + lo.getOrderId());
|
| | |
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | List<TaoBaoOrder> orders = map.get(key);
|
| | | String redisKey = "addorderqueue-" + TaoBaoOrderUtil.getOrderDataHashCode(orders);
|
| | | ;
|
| | | String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.addOrderQueue, TaoBaoOrderUtil.getOrderDataHashCode(orders));
|
| | | // redis做频率限制
|
| | | try {
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(redisKey))) {
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoCouponUtil;
|
| | |
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> getTaoBaoCouponList(int page) {
|
| | | System.out.println("进入了方法");
|
| | | String key = "cachecoupon-" + page;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoCachecoupon, page +"");
|
| | | String resultStr = "";
|
| | | try {
|
| | | resultStr = redisManager.getCommonString(key);
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
| | | * @return
|
| | | */
|
| | | public String getLabelIdByRedis(String key, String title) throws Exception {
|
| | |
|
| | | key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, key);
|
| | | String value = redisManager.getCommonString(key);
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String orderId = its.next();
|
| | | String key = "addorder-" + TaoBaoOrderUtil.getOrderDataHashCode(map.get(orderId));
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.addOrder, TaoBaoOrderUtil.getOrderDataHashCode(map.get(orderId)));
|
| | | // redis做频率限制
|
| | | try {
|
| | | if (Constant.IS_OUTNET) {
|
| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.special.S11Service;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
| | | @Cacheable(value = "s11Cache", key = "'getPreSaleGoodsCache'+#page")
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> getPreSaleGoodsCache(int page) {
|
| | | String key = "s11_presale_goods-" + page;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11PresaleGoods, page +"");
|
| | | try {
|
| | | String resultStr = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(resultStr)) {
|
| | |
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(8452, page, Constant.PAGE_SIZE);
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null && result.getTaoBaoGoodsBriefs().size() > 0) {
|
| | | try {
|
| | | redisManager.cacheCommonString("s11_presale_goods-" + page,
|
| | | new Gson().toJson(result.getTaoBaoGoodsBriefs()), 60 * 60);// 缓存1小时
|
| | | redisManager.cacheCommonString(key, new Gson().toJson(result.getTaoBaoGoodsBriefs()), 60 * 60);// 缓存1小时
|
| | | } catch (Exception e) {
|
| | | }
|
| | | return result.getTaoBaoGoodsBriefs();
|
| | |
| | | sf.setPage(page);
|
| | | sf.setPageSize(Constant.PAGE_SIZE);
|
| | |
|
| | | String key = "s11_presale_goods-type-" + type + "-" + page;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11PresaleGoodsType, type + "-" + page);
|
| | | try {
|
| | | String resultStr = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(resultStr)) {
|
| | |
| | | import com.yeshi.fanli.service.inter.user.SMSService;
|
| | | import com.yeshi.fanli.util.AliyunSMSUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TencentSMSUtil;
|
| | |
| | | if (limit)
|
| | | throw new SMSException(1001, "请过60秒再试");
|
| | |
|
| | | String key = StringUtil.Md5("sms-login-tencent-latest-" + phone);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("sms-login-tencent-latest-" + phone));
|
| | |
|
| | | String msgCode = StringUtil.getVerifyCode(codeLength);
|
| | | // 验证码模板
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.FileUtil;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | |
| | | // 清空限制
|
| | | redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
|
| | | // 清理次数
|
| | | redisManager.removeCommonString("sendMSNLoginCount" + phone);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLoginCount, phone);
|
| | | redisManager.removeCommonString(key);
|
| | |
|
| | |
|
| | | // 采用redis事务防止一个手机号多次注册问题
|
| | | String watchKey = StringUtil.Md5("REGISTER:" + phone);
|
| | |
| | |
|
| | | UserInfo userInfo = userInfoMapper.getEffectiveUserInfoByWXUnionId(weiXinUser.getUnionid());
|
| | | if (userInfo == null) {
|
| | | String longinKey = StringUtil.Md5("WXLogin:" + weiXinUser.getUnionid());
|
| | | redisManager.cacheCommonString(longinKey, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
|
| | | throw new UserAccountException(101, longinKey);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5("WXLogin:" + weiXinUser.getUnionid()));
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
|
| | | throw new UserAccountException(101, key);
|
| | | }
|
| | | // 更新账户登录信息
|
| | | updateLonginInfo(userInfo, loginType, request);
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.ImageUtil;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory;
|
| | |
| | | recordDTO.setSource(ShareSourceTypeEnum.goodsDetail);
|
| | |
|
| | | // 分享id
|
| | | String key = StringUtil.Md5(uid + "#GoodsDetail#" + auctionId + "#Type#" + goodsType);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5(uid + "#GoodsDetail#" + auctionId + "#Type#" + goodsType));
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | |
| | | recordDTO.setSource(ShareSourceTypeEnum.storage);
|
| | |
|
| | | // 缓存分享商品信息
|
| | | String key = StringUtil.Md5(uid + "#GoodsStorage#" + id);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5(uid + "#GoodsStorage#" + id));
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | |
| | | recordDTO.setSource(ShareSourceTypeEnum.storage);
|
| | |
|
| | | // 缓存分享商品信息
|
| | | String key = StringUtil.Md5(uid + "#GoodsStorage#" + id);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey,StringUtil.Md5(uid + "#GoodsStorage#" + id));
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | |
| | | recordDTO.setSharePictureUrl(uploadResult.getUrl());
|
| | | recordDTO.setSource(ShareSourceTypeEnum.activity);
|
| | | // 缓存分享商品信息
|
| | | String key = StringUtil.Md5(uid + "#Activity#" + id);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5(uid + "#Activity#" + id));
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | |
| | | recordDTO.setSource(ShareSourceTypeEnum.activity);
|
| | |
|
| | | // 缓存分享商品信息
|
| | | String key = StringUtil.Md5(uid + "#Dynamic#" + id);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, StringUtil.Md5(uid + "#Dynamic#" + id));
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | |
| | | throw new UserShareGoodsRecordException(1, "传递参数不正确");
|
| | | }
|
| | | ShareGoodsRecordDTO recordDTO = null;
|
| | | String value = redisManager.getCommonString(shareKey);
|
| | | String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, shareKey);
|
| | | String value = redisManager.getCommonString(redisKey);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | recordDTO = JsonUtil.getSimpleGson().fromJson(value, ShareGoodsRecordDTO.class);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | // 清理缓存
|
| | | redisManager.removeCommonString(shareKey);
|
| | | redisManager.removeCommonString(redisKey);
|
| | |
|
| | | if (singleGoods) {
|
| | | if (taolijin) {
|
| | |
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | |
| | | * @return
|
| | | */
|
| | | public String parseGoodsIdByJDShortUrl(String shortLink) {
|
| | | String key = "jd-link-to-goods-" + StringUtil.Md5(shortLink);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.JDShortUrl, StringUtil.Md5(shortLink));
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | return value;
|
| | |
| | | public void saveTaoBaoGoodsBriefTemp(TaoBaoGoodsBrief goods) {
|
| | | if (goods == null)
|
| | | return;
|
| | | String key = "taobao-goods-temp-" + goods.getAuctionId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsTemp, goods.getAuctionId() + "");
|
| | | if (Constant.IS_OUTNET) {
|
| | | // 暂存4个小时的分享
|
| | | cacheCommonString(key, JsonUtil.getSimpleGson().toJson(goods), 60 * 60 * 4);
|
| | |
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBaoGoodsTemp(Long auctionId) {
|
| | | String key = "taobao-goods-temp-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsTemp, auctionId + "");
|
| | | String value = getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | return JsonUtil.getSimpleGson().fromJson(value, TaoBaoGoodsBrief.class);
|
| | |
| | | * @param auctionId
|
| | | */
|
| | | public void deleteTaoBaoGoodsBrief(Long auctionId) {
|
| | | String key = "taobao-goods-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoods, auctionId + "");
|
| | | if (Constant.IS_OUTNET)
|
| | | removeKey(key);
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBaoGoodsBrief(long auctionId) throws TaobaoGoodsDownException {
|
| | | long startTime = System.currentTimeMillis();
|
| | | String key = "taobao-goods-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoods, auctionId + "");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | | }
|
| | |
|
| | | public List<ImageInfo> getTaoBaoGoodsDetailImgs(long auctionId) {
|
| | | String key = "taobao-goods-detailimgs-size-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsDetailimgs, auctionId + "");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | |
|
| | | public String getXCXCouponToken(TaoBaoGoodsBrief tb) {
|
| | | List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID);
|
| | | String key = "taobao-couple-xcx-" + tb.getAuctionId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoCoupleXCX, tb.getAuctionId() + "");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | | * @param ip
|
| | | */
|
| | | public boolean ipFrequencyLimit(String ip, String apiName) {
|
| | | String key = ip + "-" + StringUtil.Md5(apiName);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, ip + "-" + StringUtil.Md5(apiName));
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | long count = jedis.incr(key);
|
| | |
| | | }
|
| | |
|
| | | public boolean frequencyLimit(String key, int timeS, int num) {
|
| | | key = "frequency-" + key;
|
| | | key = RedisKeyEnum.getRedisKey(RedisKeyEnum.frequencyLimit, key);
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | long count = jedis.incr(key);
|
| | |
| | | * @return
|
| | | */
|
| | | public List<String> getTBImg(Long auctionId) {
|
| | | String key = "taobao-img-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoImgs, auctionId + "");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | | * @return
|
| | | */
|
| | | public TaoBaoShopInfo getTBShopInfo(String shopTitle, Long sellerId, Long auctionId) {
|
| | | String key = "taobao-shop-" + sellerId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoShop, sellerId +"");
|
| | | String value = "";
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
| | | public boolean isSmsFrequencyLimit(String phone, int type) {
|
| | | if (!Constant.IS_OUTNET)
|
| | | return false;
|
| | | String key = "sms-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMS, phone + "-" + type);
|
| | | String value = getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(value))
|
| | | return false;
|
| | |
| | | public void sendSms(String phone, int type) {
|
| | | if (!Constant.IS_OUTNET)
|
| | | return;
|
| | | String key = "sms-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMS, phone + "-" + type);
|
| | | setString(key, "1", 10);
|
| | | }
|
| | |
|
| | | public void clearSMSFrequencyLimit(String phone, int type) {
|
| | | if (!Constant.IS_OUTNET)
|
| | | return;
|
| | | String key = "sms-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMS, phone + "-" + type);
|
| | | removeKey(key);
|
| | | }
|
| | |
|
| | |
| | | */
|
| | |
|
| | | public void saveSMSVCode(String phone, int type, String code) {
|
| | | String key = "smscode-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + type);
|
| | | // 保存2分钟
|
| | | setString(key, code, 120);
|
| | | }
|
| | |
| | | public String getSMSVCode(String phone, int type) {
|
| | | // if (!Constant.IS_OUTNET)
|
| | | // return "";
|
| | | String key = "smscode-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + type);
|
| | | // 保存2分钟
|
| | | return getString(key);
|
| | | }
|
| | |
| | | public void clearSMSVCode(String phone, int type) {
|
| | | // if (!Constant.IS_OUTNET)
|
| | | // return;
|
| | | String key = "smscode-" + phone + "-" + type;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSVCode, phone + "-" + type);
|
| | | removeKey(key);
|
| | | }
|
| | |
|
| | |
| | | * 保存绑定支付宝短信验证码的正确性
|
| | | */
|
| | | public void saveBindAlipayAccountSMSState(String phone) {
|
| | | String key = "smsstate-alipay-" + phone;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSStateAlipay, phone + "" );
|
| | | // 验证后十分钟有效
|
| | | setString(key, "1", 10 * 60);
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public boolean isBindAlipayAccountSMSStateValid(String phone) {
|
| | | String key = "smsstate-alipay-" + phone;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSStateAlipay, phone + "" );
|
| | | return !StringUtil.isNullOrEmpty(getString(key));
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | public void setInviteShortLink(long uid, String shortlink) {
|
| | | String value = "";
|
| | | String key = "invite-shortlink-" + uid;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.inviteShortLink, uid + "" );
|
| | | if (Constant.IS_OUTNET) {
|
| | |
|
| | | value = getCommonString(key);
|
| | |
| | | * @return
|
| | | */
|
| | | public String getInviteShortLink(long uid) {
|
| | |
|
| | | String value = "";
|
| | | String key = "invite-shortlink-" + uid;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.inviteShortLink, uid + "" );
|
| | | if (Constant.IS_OUTNET)
|
| | | value = getCommonString(key);
|
| | |
|
| | |
| | | * @param token
|
| | | */
|
| | | public void saveCommonTaoToken(Long auctionId, String token) {
|
| | | String key = "taobao-common-token-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoTokenCommon, auctionId + "" );
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | // 口令缓存10天
|
| | |
| | | * @return
|
| | | */
|
| | | public String getCommonTaoToken(Long auctionId) {
|
| | | String key = "taobao-common-token-" + auctionId;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoTokenCommon, auctionId + "" );
|
| | | if (Constant.IS_OUTNET) {
|
| | | return getCommonString(key);
|
| | | }
|
| | |
| | | * @param token
|
| | | */
|
| | | public void saveTLJToken(String url, String token) {
|
| | | String key = "taobao-tlj-token-" + StringUtil.Md5(url);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoTokenTLJ, StringUtil.Md5(url));
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | // 口令缓存10天
|
| | |
| | | * @return
|
| | | */
|
| | | public String getTLJToken(String url) {
|
| | | String key = "taobao-common-token-" + StringUtil.Md5(url);
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoTokenTLJ, StringUtil.Md5(url));
|
| | | if (Constant.IS_OUTNET) {
|
| | | return getCommonString(key);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public JDGoods getJDGoods(long goodsId) {
|
| | | String key = "jingdong-goods-" + goodsId;
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.jingDongGoods, goodsId +"");
|
| | | String value = getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(goodsId);
|
| | |
| | | }
|
| | |
|
| | | public PDDGoodsDetail getPDDGoodsDetail(long goodsId) {
|
| | | String key = "pinduoduo-goods-" + goodsId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.pinDuoDuoGoods, goodsId +"");
|
| | |
|
| | | String value = getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | |
| | | try {
|
| | | HongBaoV2 hongbao = map.get(handler);
|
| | | if (hongbao != null) {
|
| | | String key = "hongbao-fanli-" + hongbao.getId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.hongBaoFanLi, hongbao.getId() + "");
|
| | | if (StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | | // 处理之后要隔2小时再次进行处理
|
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);
|
| | |
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | |
| | | * @param time
|
| | | */
|
| | | public void cacheSearchGoods(String device, Long time) {
|
| | | redisManager.cacheCommonString("integral-seacrh-goods-" + device, time + "", 60 * 5);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.seacrhGoods, device);
|
| | | redisManager.cacheCommonString(key, time + "", 60 * 5);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return
|
| | | */
|
| | | public Long getLastSearchTime(String device) {
|
| | | String value = redisManager.getCommonString("integral-seacrh-goods-" + device);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.seacrhGoods, device);
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(value))
|
| | | return null;
|
| | | return Long.parseLong(value);
|
| | |
| | | * @param device
|
| | | */
|
| | | public void clearSearchTime(String device) {
|
| | | redisManager.removeCommonString("integral-seacrh-goods-" + device);
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.seacrhGoods, device);
|
| | | redisManager.removeCommonString(key);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | |
| | | return;
|
| | | }
|
| | | // 保存20分钟
|
| | | String key = "JD-goods-" + goods.getSkuId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.JDGoods, goods.getSkuId() + "" );
|
| | | redisManager.cacheCommonString(key, new Gson().toJson(goods), 60 * 20);
|
| | | }
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public JDGoods getGoodsInfo(long goodsId){
|
| | | String key = "JD-goods-" + goodsId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.JDGoods, goodsId + "");
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | return JsonUtil.getSimpleGson().fromJson(value, JDGoods.class);
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | |
| | | return;
|
| | | }
|
| | | // 保存20分钟
|
| | | String key = "PDD-goods-" + goods.getGoodsId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.PDDGoods, goods.getGoodsId() + "" );
|
| | | redisManager.cacheCommonString(key, new Gson().toJson(goods), 60 * 20);
|
| | | }
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public PDDGoodsDetail getGoodsInfo(long goodsId){
|
| | | String key = "PDD-goods-" + goodsId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.PDDGoods, goodsId + "");
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | return JsonUtil.getSimpleGson().fromJson(value, PDDGoodsDetail.class);
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | |
| | | public void saveCommonTaoBaoGoodsInfo(TaoBaoGoodsBrief goods) {
|
| | | if (goods == null || goods.getAuctionId() == null)
|
| | | return;
|
| | | String key = "taobao-goods-common-" + goods.getAuctionId();
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsCommon, goods.getAuctionId() + "");
|
| | | // 保存20分钟
|
| | | redisManager.cacheCommonString(key, new Gson().toJson(goods), 60 * 20);
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public TaoBaoGoodsBrief getCommonTaoBaoGoodsInfo(long auctionId) {
|
| | | String key = "taobao-goods-common-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsCommon, auctionId + "");
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (!StringUtil.isNullOrEmpty(value)) {
|
| | | return new Gson().fromJson(value, TaoBaoGoodsBrief.class);
|
| | |
| | | * @return
|
| | | */
|
| | | public boolean canAddToUpdateQueue(Long auctionId) {
|
| | | String key = "tb-u-q-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoQueue, auctionId + "");
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(value))
|
| | | return true;
|
| | |
| | | * @param auctionId
|
| | | */
|
| | | public void addAddToQueueHistory(Long auctionId) {
|
| | | String key = "tb-u-q-" + auctionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoQueue, auctionId + "");
|
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 有效期2个小时
|
| | | }
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public boolean needUpdate(Long actionId) {
|
| | | String key = "tb-u-" + actionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoUpdate, actionId + "");
|
| | | String value = redisManager.getCommonString(key);
|
| | | if (StringUtil.isNullOrEmpty(value))
|
| | | return true;
|
| | |
| | | * @return
|
| | | */
|
| | | public void addUpdateHistory(Long actionId) {
|
| | | String key = "tb-u-" + actionId;
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoUpdate, actionId + "");
|
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 1);// 有效期1个小时
|
| | | }
|
| | |
|