| | |
| | | list.addAll(list1); |
| | | |
| | | if (list.size() == 0) { |
| | | |
| | | pageId = 0L; |
| | | } else { |
| | | |
| | | pageId = list.get(list.size() - 1).getId(); |
| | | |
| | | // 版本过滤 |
| | | int version = Integer.parseInt(acceptData.getVersion()); |
| | | String platform = acceptData.getPlatform().toLowerCase(); |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getClass") |
| | | //TODO 改进版本过高的问题 |
| | | public void getClass(String callback, AcceptData acceptData, PrintWriter out) { |
| | | if (acceptData.getSystem() == null) |
| | | acceptData.setSystem(SystemEnum.blks); |
| | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (!sets.contains(list.get(i).getId())) { |
| | | list.remove(i--); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | public class GoodsControllerLijin { |
| | | Logger userGoodsScanLogger = LoggerFactory.getLogger("userGoodsScanLog"); |
| | | |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private TaoBaoGoodsCacheUtil taoBaoGoodsCacheUtil; |
| | | |
| | |
| | | package com.yeshi.fanli.controller.client.v1; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.Date; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinMnager; |
| | | import com.yeshi.fanli.service.inter.user.UserFunctionsLimitService; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager; |
| | | import com.yeshi.fanli.util.SystemInfoUtil; |
| | |
| | | |
| | | @Resource |
| | | private UserLijinMnager userLijinMnager; |
| | | |
| | | @Resource |
| | | private UserFunctionsLimitService userFunctionsLimitService; |
| | | |
| | | private void doTaoLiJinBuy(AcceptData acceptData, Long uid, Long auctionId, PrintWriter out) { |
| | | JSONObject data = new JSONObject(); |
| | |
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC)); |
| | | return; |
| | | } |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | // 日志记录 |
| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkException; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | private TBPidService tbPidService; |
| | | |
| | | @Resource |
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService; |
| | | |
| | | @Resource |
| | | private UserInfoExtraService userInfoExtraService; |
| | | |
| | | @Resource |
| | | private FloatADService floatADService; |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private MsgDeviceReadStateService msgDeviceReadStateService; |
| | | |
| | | @Resource |
| | | private UserTaoLiJinOriginService uerTaoLiJinOriginService; |
| | | |
| | | @Resource |
| | | private UserActiveLogService userActiveLogService; |
| | |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | @Resource |
| | | private ConvertLinkManager convertLinkManager; |
| | | |
| | | /** |
| | | * s 首页配置信息 |
| | |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.elmeLink, uid + ""); |
| | | String elmeLink = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(elmeLink)) { |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert( |
| | | elmePid.split("_")[3], "1571715733668", userInfoExtra.getRelationId()); |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | try { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, elmePid, "1571715733668", userInfoExtra.getRelationId(), false); |
| | | } catch (ConvertLinkException e) { |
| | | e.printStackTrace(); |
| | | if (StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadFalseResult(e.getMessage())); |
| | | else |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | if (dto != null) |
| | | elmeLink = dto.getShort_click_url(); |
| | | if (!StringUtil.isNullOrEmpty(elmeLink)) { |
| | |
| | | JSONObject data = new JSONObject(); |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | if (StringUtil.isNullOrEmpty(elmeResult)) { |
| | | if (share) { |
| | | dto = TaoKeApiUtil.officialActivityConvert(relationPid.split("_")[3], |
| | | activityId, userInfoExtra.getRelationId()); |
| | | } else { |
| | | dto = TaoKeApiUtil.officialActivityConvert(elmePid.split("_")[3], activityId, |
| | | userInfoExtra.getRelationId()); |
| | | try { |
| | | if (share) { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, relationPid, activityId, userInfoExtra.getRelationId(), true); |
| | | } else { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, elmePid, activityId, |
| | | userInfoExtra.getRelationId(), false); |
| | | } |
| | | } catch (ConvertLinkException e) { |
| | | if (StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadFalseResult(e.getMessage())); |
| | | else |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | |
| | | if (dto != null) { |
| | |
| | | JSONObject data = new JSONObject(); |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | if (StringUtil.isNullOrEmpty(elmeResult)) { |
| | | if (share) { |
| | | dto = TaoKeApiUtil.officialActivityConvert(relationPid.split("_")[3], |
| | | activityId, userInfoExtra.getRelationId()); |
| | | } else { |
| | | dto = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_KOUBEI_PID.split("_")[3], activityId, |
| | | userInfoExtra.getRelationId()); |
| | | |
| | | try { |
| | | if (share) { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, relationPid, |
| | | activityId, userInfoExtra.getRelationId(), true); |
| | | } else { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, TaoBaoConstant.TAOBAO_KOUBEI_PID, |
| | | activityId, userInfoExtra.getRelationId(), false); |
| | | } |
| | | } catch (ConvertLinkException e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getCode(), e.getMessage()))); |
| | | return; |
| | | } |
| | | |
| | | if (dto != null) { |
| | |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.service.inter.user.UserFunctionsLimitService; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | |
| | | |
| | | /** |
| | | * 文案转链 |
| | | * @author Administrator |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | @Controller("convertLinkControllerV2") |
| | | @RequestMapping("api/v2/convertlink") |
| | | public class ConvertLinkController { |
| | | |
| | | @Resource |
| | | private UserConvertLinkTemplateService userConvertLinkTemplateService; |
| | | @Resource |
| | | private UserConvertLinkTemplateService userConvertLinkTemplateService; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private ConvertLinkManager convertLinkManager; |
| | | @Resource |
| | | private ConvertLinkManager convertLinkManager; |
| | | |
| | | /** |
| | | * |
| | | * @Title: getCommonTextList |
| | | * @Description: 获取模板 |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param callback |
| | | * @param out |
| | | * void 返回类型 |
| | | * @throws |
| | | */ |
| | | @RequestMapping(value = "getCommonTextList") |
| | | public void getCommonTextList(AcceptData acceptData, Long uid, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | @Resource |
| | | private UserFunctionsLimitService userFunctionsLimitService; |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | /** |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param callback |
| | | * @param out void 返回类型 |
| | | * @throws |
| | | * @Title: getCommonTextList |
| | | * @Description: 获取模板 |
| | | */ |
| | | @RequestMapping(value = "getCommonTextList") |
| | | public void getCommonTextList(AcceptData acceptData, Long uid, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | |
| | | List<UserConvertLinkTemplate> list = userConvertLinkTemplateService.listByUid(uid); |
| | | if (list == null) |
| | | list = new ArrayList<>(); |
| | | JSONObject data = new JSONObject(); |
| | | |
| | | Gson gson = JsonUtil.getApiCommonGson(); |
| | | data.put("list", gson.toJson(list)); |
| | | data.put("tip", configService.getValue(ConfigKeyEnum.convertDocTip.getKey(),acceptData.getSystem())); |
| | | data.put("helpLink", configService.getValue(ConfigKeyEnum.convertDocHelpLink.getKey(),acceptData.getSystem())); |
| | | List<UserConvertLinkTemplate> list = userConvertLinkTemplateService.listByUid(uid); |
| | | if (list == null) |
| | | list = new ArrayList<>(); |
| | | |
| | | String text = redisManager.getCommonString(RedisKeyEnum.convertLinkDocTemp.getKey() + uid); |
| | | if (text != null) { |
| | | data.put("lastText", text); |
| | | redisManager.removeCommonString(RedisKeyEnum.convertLinkDocTemp.getKey() + uid); |
| | | } |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | Gson gson = JsonUtil.getApiCommonGson(); |
| | | data.put("list", gson.toJson(list)); |
| | | data.put("tip", configService.getValue(ConfigKeyEnum.convertDocTip.getKey(), acceptData.getSystem())); |
| | | data.put("helpLink", configService.getValue(ConfigKeyEnum.convertDocHelpLink.getKey(), acceptData.getSystem())); |
| | | |
| | | /** |
| | | * |
| | | * @Title: setConvertLinkDoc |
| | | * @Description: 暂存文案 |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param text |
| | | * @param callback |
| | | * @param out |
| | | * void 返回类型 |
| | | * @throws |
| | | */ |
| | | @RequestMapping(value = "setConvertLinkDoc") |
| | | public void setConvertLinkDoc(AcceptData acceptData, Long uid, String text, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | String text = redisManager.getCommonString(RedisKeyEnum.convertLinkDocTemp.getKey() + uid); |
| | | if (text != null) { |
| | | data.put("lastText", text); |
| | | redisManager.removeCommonString(RedisKeyEnum.convertLinkDocTemp.getKey() + uid); |
| | | } |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(text)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("文案为空"))); |
| | | return; |
| | | } |
| | | redisManager.cacheCommonString(RedisKeyEnum.convertLinkDocTemp.getKey() + uid, text); |
| | | |
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | /** |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param text |
| | | * @param callback |
| | | * @param out void 返回类型 |
| | | * @throws |
| | | * @Title: setConvertLinkDoc |
| | | * @Description: 暂存文案 |
| | | */ |
| | | @RequestMapping(value = "setConvertLinkDoc") |
| | | public void setConvertLinkDoc(AcceptData acceptData, Long uid, String text, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @Title: addCommonText |
| | | * @Description: 添加模板 |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param template |
| | | * @param callback |
| | | * @param out |
| | | * void 返回类型 |
| | | * @throws |
| | | */ |
| | | if (StringUtil.isNullOrEmpty(text)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("文案为空"))); |
| | | return; |
| | | } |
| | | redisManager.cacheCommonString(RedisKeyEnum.convertLinkDocTemp.getKey() + uid, text); |
| | | |
| | | @RequestMapping(value = "addCommonText") |
| | | public void addCommonText(AcceptData acceptData, Long uid, String template, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(template)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("文案为空"))); |
| | | return; |
| | | } |
| | | UserConvertLinkTemplate bean = new UserConvertLinkTemplate(); |
| | | bean.setUid(uid); |
| | | bean.setTemplate(template); |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | |
| | | try { |
| | | userConvertLinkTemplateService.addConvertLinkTemplate(bean); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | /** |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param template |
| | | * @param callback |
| | | * @param out void 返回类型 |
| | | * @throws |
| | | * @Title: addCommonText |
| | | * @Description: 添加模板 |
| | | */ |
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | @RequestMapping(value = "addCommonText") |
| | | public void addCommonText(AcceptData acceptData, Long uid, String template, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @Title: deleteCommonText |
| | | * @Description: 删除模板 |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param id |
| | | * @param callback |
| | | * @param out |
| | | * void 返回类型 |
| | | * @throws |
| | | */ |
| | | @RequestMapping(value = "deleteCommonText") |
| | | public void deleteCommonText(AcceptData acceptData, Long uid, String id, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(template)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("文案为空"))); |
| | | return; |
| | | } |
| | | UserConvertLinkTemplate bean = new UserConvertLinkTemplate(); |
| | | bean.setUid(uid); |
| | | bean.setTemplate(template); |
| | | |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("模板ID为空"))); |
| | | return; |
| | | } |
| | | try { |
| | | userConvertLinkTemplateService.addConvertLinkTemplate(bean); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | userConvertLinkTemplateService.deleteConvertLinkTemplate(id, uid); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | /** |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param id |
| | | * @param callback |
| | | * @param out void 返回类型 |
| | | * @throws |
| | | * @Title: deleteCommonText |
| | | * @Description: 删除模板 |
| | | */ |
| | | @RequestMapping(value = "deleteCommonText") |
| | | public void deleteCommonText(AcceptData acceptData, Long uid, String id, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | |
| | | @RequestMapping(value = "updateCommonText") |
| | | public void updateCommonText(AcceptData acceptData, Long uid, String id, String template, String callback, |
| | | PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("模板ID为空"))); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("模板ID为空"))); |
| | | return; |
| | | } |
| | | try { |
| | | userConvertLinkTemplateService.deleteConvertLinkTemplate(id, uid); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(template)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("模板内容为空"))); |
| | | return; |
| | | } |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | |
| | | UserConvertLinkTemplate bean = new UserConvertLinkTemplate(); |
| | | bean.setUid(uid); |
| | | bean.setTemplate(template); |
| | | bean.setId(id); |
| | | @RequestMapping(value = "updateCommonText") |
| | | public void updateCommonText(AcceptData acceptData, Long uid, String id, String template, String callback, |
| | | PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | userConvertLinkTemplateService.updateTemplate(bean); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("模板ID为空"))); |
| | | return; |
| | | } |
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | if (StringUtil.isNullOrEmpty(template)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("模板内容为空"))); |
| | | return; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @Title: convert |
| | | * @Description: 文案转链 |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param text |
| | | * @param callback |
| | | * @param out |
| | | * void 返回类型 |
| | | * @throws |
| | | */ |
| | | @RequestMapping(value = "convert") |
| | | public void convert(AcceptData acceptData, Long uid, String text, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | UserConvertLinkTemplate bean = new UserConvertLinkTemplate(); |
| | | bean.setUid(uid); |
| | | bean.setTemplate(template); |
| | | bean.setId(id); |
| | | |
| | | if (StringUtil.isNullOrEmpty(text)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("文案为空"))); |
| | | return; |
| | | } |
| | | try { |
| | | userConvertLinkTemplateService.updateTemplate(bean); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | String key = RedisKeyEnum.convertLinkDocResultTemp.getKey() + uid + "-" |
| | | + StringUtil.Md5(UUID.randomUUID().toString()); |
| | | String result = convertLinkManager.convertLinkFromText(acceptData.getSystem(),text, uid, true,true); |
| | | redisManager.cacheCommonString(key, result, 60); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("id", key); |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(""))); |
| | | } |
| | | |
| | | } |
| | | /** |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param text |
| | | * @param callback |
| | | * @param out void 返回类型 |
| | | * @throws |
| | | * @Title: convert |
| | | * @Description: 文案转链 |
| | | */ |
| | | @RequestMapping(value = "convert") |
| | | public void convert(AcceptData acceptData, Long uid, String text, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | |
| | | @RequestMapping(value = "getConvertResult") |
| | | public void getConvertResult(AcceptData acceptData, Long uid, String id, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(text)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("文案为空"))); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("文案ID为空"))); |
| | | return; |
| | | } |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.share, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | |
| | | String key =id; |
| | | String result = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(result)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("获取转链结果出错"))); |
| | | } else { |
| | | redisManager.removeCommonString(key); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("data", result); |
| | | data.put("tip", "1.转好的链接/口令有有效期,请在有效期内推广分享;\r\n" + "2.已经转好的链接/口令请不要修改,以免无法追踪到订单;\r\n" |
| | | + "3.请确保转换链接合法合规,一切违法的链接/口令产生的法律后果自行承担与本App无关。"); |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | } |
| | | try { |
| | | String key = RedisKeyEnum.convertLinkDocResultTemp.getKey() + uid + "-" |
| | | + StringUtil.Md5(UUID.randomUUID().toString()); |
| | | String result = convertLinkManager.convertLinkFromText(acceptData.getSystem(), text, uid, true, true); |
| | | redisManager.cacheCommonString(key, result, 60); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("id", key); |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "getConvertResult") |
| | | public void getConvertResult(AcceptData acceptData, Long uid, String id, String callback, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("用户未登录"))); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("文案ID为空"))); |
| | | return; |
| | | } |
| | | |
| | | String key = id; |
| | | String result = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(result)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("获取转链结果出错"))); |
| | | } else { |
| | | redisManager.removeCommonString(key); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("data", result); |
| | | data.put("tip", "1.转好的链接/口令有有效期,请在有效期内推广分享;\r\n" + "2.已经转好的链接/口令请不要修改,以免无法追踪到订单;\r\n" |
| | | + "3.请确保转换链接合法合规,一切违法的链接/口令产生的法律后果自行承担与本App无关。"); |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | import com.yeshi.fanli.exception.pdd.PDDAuthException; |
| | | import com.yeshi.fanli.exception.pdd.PDDGoodsException; |
| | | import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException; |
| | | import com.yeshi.fanli.exception.taobao.TaoBaoTokenParseException; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.manger.ClipboardContentType; |
| | | import com.yeshi.fanli.service.inter.user.UserFunctionsLimitService; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager; |
| | | import com.yeshi.fanli.service.manger.goods.jd.JDConvertLinkManager; |
| | | import com.yeshi.fanli.service.manger.goods.pdd.PDDConvertLinkManager; |
| | | import com.yeshi.fanli.service.manger.goods.suning.SuningConvertLinkManager; |
| | | import com.yeshi.fanli.service.manger.goods.tb.TBConvertLinkManager; |
| | | import com.yeshi.fanli.service.manger.goods.vipshop.VipShopConvertLinkManager; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.exception.ExceptionConstant; |
| | | import com.yeshi.fanli.util.goods.GoodsJumpUtil; |
| | | import com.yeshi.fanli.util.goods.GoodsTextUtil; |
| | | import com.yeshi.fanli.util.suning.SuningUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.util.vipshop.VipShopUtil; |
| | | import com.yeshi.fanli.vo.goods.ConvertLinkJumpVO; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import org.apache.commons.beanutils.PropertyUtils; |
| | |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkException; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | |
| | | import com.yeshi.fanli.service.inter.dynamic.ArticleOfficialService; |
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService; |
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService; |
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService; |
| | | import com.yeshi.fanli.service.inter.homemodule.CommonShareInfoService; |
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService; |
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService; |
| | | import com.yeshi.fanli.service.inter.user.QrCodeService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.inter.user.cloud.UserCloudService; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; |
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil; |
| | |
| | | private PDDConvertLinkManager pddConvertLinkManager; |
| | | |
| | | @Resource |
| | | private SuningConvertLinkManager suningConvertLinkManager; |
| | | |
| | | @Resource |
| | | private VipShopConvertLinkManager vipShopConvertLinkManager; |
| | | |
| | | @Resource |
| | | private DailyCountMomentsService dailyCountMomentsService; |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private PDDAuthService pddAuthService; |
| | | |
| | | @Resource |
| | | private UserFunctionsLimitService userFunctionsLimitService; |
| | | |
| | | |
| | | @Resource |
| | |
| | | |
| | | for (ImgInfo imgInfo : goodsEvaluate.getImgList()) { |
| | | |
| | | if (acceptData.getSystem() == SystemEnum.yhqjx||acceptData.getSystem() == SystemEnum.hsb) { |
| | | if (acceptData.getSystem() == SystemEnum.yhqjx || acceptData.getSystem() == SystemEnum.hsb) { |
| | | imgInfo.setGoods(null); |
| | | imgInfo.setGoodsVO(null); |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.share, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | |
| | | |
| | | UserExtraTaoBaoInfo taoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid); |
| | | String relationId = null; |
| | | if (taoBaoInfo != null && taoBaoInfo.getRelationId() != null && taoBaoInfo.getRelationValid() != null |
| | |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.share, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | |
| | | UserExtraTaoBaoInfo taoBaoInfo = userExtraTaoBaoInfoService.getByUid(uid); |
| | | String relationId = null; |
| | | if (taoBaoInfo != null && taoBaoInfo.getRelationId() != null && taoBaoInfo.getRelationValid() != null |
| | |
| | | String newText = text; // 非通用券需要验证 |
| | | |
| | | //特价只需要复制文字,不需要转链 |
| | | if (acceptData.getSystem() == SystemEnum.yhqjx||acceptData.getSystem() == SystemEnum.hsb) { |
| | | if (acceptData.getSystem() == SystemEnum.yhqjx || acceptData.getSystem() == SystemEnum.hsb) { |
| | | newText = GoodsTextUtil.decodeAppHtmlText(newText); |
| | | //只复制文字 |
| | | JSONObject data = new JSONObject(); |
| | |
| | | if (comment != null && (comment.getNeedSpin() == null || comment.getNeedSpin())) { |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(acceptData.getSystem(), text, uid, true, true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | } catch (ConvertLinkException e) { |
| | | if (e.getCode() != ConvertLinkException.CODE_NONE) { |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | |
| | | if (shareInfo.getNeedSpin() != null && shareInfo.getNeedSpin()) { |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(acceptData.getSystem(), text, uid, true, true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | } catch (ConvertLinkException e) { |
| | | if (e.getCode() != ConvertLinkException.CODE_NONE) { |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | |
| | | |
| | | int platformCode = Constant.getPlatformCode(acceptData.getPlatform()); |
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("web", platformCode, |
| | | Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); |
| | | Integer.parseInt(acceptData.getVersion()), acceptData.getSystem()); |
| | | JSONObject inner = new JSONObject(); |
| | | inner.put("url", jumpLink); |
| | | params = inner.toString(); |
| | |
| | | if (shareInfo.getNeedSpin() != null && shareInfo.getNeedSpin()) { |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(acceptData.getSystem(), text, uid, true, true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | } catch (ConvertLinkException e) { |
| | | if (e.getCode() != ConvertLinkException.CODE_NONE) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | imgUrl = createActivityShareImg(type, id, erCodeContent); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | } catch (ConvertLinkException e) { |
| | | if (e.getCode() != ConvertLinkException.CODE_NONE) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | |
| | | if (comment != null && (comment.getNeedSpin() == null || comment.getNeedSpin())) { |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(acceptData.getSystem(), text, uid, true, true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | } catch (ConvertLinkException e) { |
| | | if (e.getCode() != ConvertLinkException.CODE_NONE) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinMnager; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.user.*; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.util.*; |
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; |
| | | import com.yeshi.goods.facade.service.DaTaoKeGoodsDetailV2Service; |
| | | import com.yeshi.fanli.service.inter.user.ShamUserService; |
| | | import com.yeshi.fanli.service.inter.user.TBPidService; |
| | | import com.yeshi.fanli.service.inter.user.UserGoodsStorageService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService; |
| | |
| | | |
| | | @Resource |
| | | private UserLijinMnager userLijinMnager; |
| | | |
| | | @Resource |
| | | private UserFunctionsLimitService userFunctionsLimitService; |
| | | |
| | | private GoodsMoneyConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { |
| | | UserLevelEnum level = UserLevelEnum.daRen; |
| | |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | |
| | | JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(id); |
| | | if (goods == null) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架")); |
| | |
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC)); |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC)); |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | |
| | | tag = VipShopUtil.getBuyChanTag(uid); |
| | | } |
| | | } |
| | |
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC)); |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkException; |
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | |
| | | @RequestMapping("api/v2/s11") |
| | | public class S11Controller { |
| | | |
| | | @Resource |
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; |
| | | @Resource |
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | /** |
| | | * 获取超级红包分享口令 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getSuperHongBaoToken") |
| | | public void getSuperHongBaoToken(AcceptData acceptData, Long uid, String callback, PrintWriter out) { |
| | | if (uid == null || uid <= 0) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录"))); |
| | | else |
| | | out.print(JsonUtil.loadFalseResult(1, "请登录")); |
| | | return; |
| | | } |
| | | @Resource |
| | | private ConvertLinkManager convertLinkManager; |
| | | |
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid); |
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号"))); |
| | | else |
| | | out.print(JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往\"我的->个人信息\"绑定淘宝账号")); |
| | | return; |
| | | } |
| | | /** |
| | | * 获取超级红包分享口令 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getSuperHongBaoToken") |
| | | public void getSuperHongBaoToken(AcceptData acceptData, Long uid, String callback, PrintWriter out) { |
| | | if (uid == null || uid <= 0) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录"))); |
| | | else |
| | | out.print(JsonUtil.loadFalseResult(1, "请登录")); |
| | | return; |
| | | } |
| | | |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11SuperHongBao, info.getRelationId() + ""); |
| | | String token = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | try { |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253", |
| | | "1574926757600", info.getRelationId()); |
| | | String link = dto.getShort_click_url(); |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s12/banner.jpg", |
| | | "【天猫双12】上亿红包等你来拆!---板栗快省", link); |
| | | if (!StringUtil.isNullOrEmpty(token)) |
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天 |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid); |
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号"))); |
| | | else |
| | | out.print(JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往\"我的->个人信息\"绑定淘宝账号")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试"))); |
| | | else |
| | | out.print(JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试")); |
| | | return; |
| | | } |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11SuperHongBao, info.getRelationId() + ""); |
| | | String token = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | try { |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | try { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, "mm_124933865_56750082_19507100253", "1574926757600", info.getRelationId(), true); |
| | | } catch (ConvertLinkException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage())); |
| | | return; |
| | | } |
| | | |
| | | String desc = configService.getValue(ConfigKeyEnum.superHongBaoShareDesc.getKey(),acceptData.getSystem()); |
| | | desc = desc.replace("[淘口令]", token); |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(desc))); |
| | | else |
| | | out.print(JsonUtil.loadTrueResult(desc)); |
| | | return; |
| | | } |
| | | String link = dto.getShort_click_url(); |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s12/banner.jpg", |
| | | "【天猫双12】上亿红包等你来拆!---板栗快省", link); |
| | | if (!StringUtil.isNullOrEmpty(token)) |
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天 |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试"))); |
| | | else |
| | | out.print(JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试")); |
| | | return; |
| | | } |
| | | |
| | | String desc = configService.getValue(ConfigKeyEnum.superHongBaoShareDesc.getKey(), acceptData.getSystem()); |
| | | desc = desc.replace("[淘口令]", token); |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(desc))); |
| | | else |
| | | out.print(JsonUtil.loadTrueResult(desc)); |
| | | return; |
| | | } |
| | | |
| | | } |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.user.*; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager; |
| | | import com.yeshi.fanli.util.*; |
| | |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; |
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService; |
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil; |
| | | import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil; |
| | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | @Resource |
| | | private UserFunctionsLimitService userFunctionsLimitService; |
| | | |
| | | private List<ShareGoodsCommentChoiceInfo> getCommentChoiceList(String token, String link, String inviteCode, |
| | | BigDecimal fanliMoney) { |
| | | List<ShareGoodsCommentChoiceInfo> list = new ArrayList<>(); |
| | |
| | | return; |
| | | } |
| | | |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.share, new Date())) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该功能限制使用")); |
| | | return; |
| | | } |
| | | |
| | | // 淘宝 |
| | | if (goodsType == null || goodsType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | createTaoBaoShare(acceptData, uid, Long.parseLong(goodsId), totalNum, source, needGoods, request, out); |
| | |
| | | tempToken = tempToken.trim(); |
| | | |
| | | try { |
| | | tempToken= URLEncoder.encode(tempToken,"UTF-8"); |
| | | tempToken = URLEncoder.encode(tempToken, "UTF-8"); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkException; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | |
| | | @RequestMapping("api/apph5/v1/s11") |
| | | public class H5S11Controller { |
| | | |
| | | @Resource |
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; |
| | | @Resource |
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | /** |
| | | * 获取超级红包分享口令 |
| | | * @param sign |
| | | * @param uid |
| | | * @param callback |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getSuperHongBaoToken") |
| | | public void getSuperHongBaoToken(String sign, Long uid, String callback, PrintWriter out) { |
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误"))); |
| | | return; |
| | | } |
| | | @Resource |
| | | private ConvertLinkManager convertLinkManager; |
| | | |
| | | if (uid == null || uid <= 0) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录"))); |
| | | return; |
| | | } |
| | | /** |
| | | * 获取超级红包分享口令 |
| | | * |
| | | * @param sign |
| | | * @param uid |
| | | * @param callback |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getSuperHongBaoToken") |
| | | public void getSuperHongBaoToken(String sign, Long uid, String callback, PrintWriter out) { |
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误"))); |
| | | return; |
| | | } |
| | | |
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid); |
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号"))); |
| | | return; |
| | | } |
| | | if (uid == null || uid <= 0) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录"))); |
| | | return; |
| | | } |
| | | |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11SuperHongBao, info.getRelationId() + ""); |
| | | String token = null; |
| | | token = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | try { |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253", |
| | | "20150318020005224", info.getRelationId()); |
| | | String link = dto.getClick_url(); |
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid); |
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号"))); |
| | | return; |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "【天猫双12】上亿红包等你来拆!", |
| | | link); |
| | | if (!StringUtil.isNullOrEmpty(token)) |
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天 |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11SuperHongBao, info.getRelationId() + ""); |
| | | String token = null; |
| | | token = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | try { |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | try { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, "mm_124933865_56750082_19507100253", "20150318020005224", info.getRelationId(), false); |
| | | } catch (ConvertLinkException e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getCode(), e.getMessage()))); |
| | | return; |
| | | } |
| | | String link = dto.getClick_url(); |
| | | |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试"))); |
| | | return; |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "【天猫双12】上亿红包等你来拆!", |
| | | link); |
| | | if (!StringUtil.isNullOrEmpty(token)) |
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天 |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | |
| | | UserInfo user=userInfoService.selectByPKey(uid); |
| | | String desc = configService.getValue(ConfigKeyEnum.superHongBaoShareDesc.getKey(),user.getSystem()); |
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token)); |
| | | try { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc)))); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误"))); |
| | | } |
| | | } |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试"))); |
| | | return; |
| | | } |
| | | |
| | | @RequestMapping(value = "getYuShouToken") |
| | | public void getYuShouToken(String sign, Long uid, String callback, PrintWriter out) { |
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误"))); |
| | | return; |
| | | } |
| | | UserInfo user = userInfoService.selectByPKey(uid); |
| | | String desc = configService.getValue(ConfigKeyEnum.superHongBaoShareDesc.getKey(), user.getSystem()); |
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token)); |
| | | try { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc)))); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误"))); |
| | | } |
| | | } |
| | | |
| | | if (uid == null || uid <= 0) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录"))); |
| | | return; |
| | | } |
| | | @RequestMapping(value = "getYuShouToken") |
| | | public void getYuShouToken(String sign, Long uid, String callback, PrintWriter out) { |
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误"))); |
| | | return; |
| | | } |
| | | |
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid); |
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号"))); |
| | | return; |
| | | } |
| | | if (uid == null || uid <= 0) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "请登录"))); |
| | | return; |
| | | } |
| | | |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11YuShou, info.getRelationId() + ""); |
| | | String token = null; |
| | | if (Constant.IS_OUTNET) |
| | | token = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | try { |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253", |
| | | "20150318020005224", info.getRelationId()); |
| | | String link = dto.getClick_url(); |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "预售商品付定金,得奖金!", |
| | | link); |
| | | if (Constant.IS_OUTNET) |
| | | if (!StringUtil.isNullOrEmpty(token)) |
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天 |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService.getByUid(uid); |
| | | if (info == null || StringUtil.isNullOrEmpty(info.getRelationId()) || info.getRelationValid() == false) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(2, "您尚未绑定淘宝,请前往我的->个人信息 绑定淘宝账号"))); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试"))); |
| | | return; |
| | | } |
| | | UserInfo user=userInfoService.selectByPKey(uid); |
| | | String desc = configService.getValue(ConfigKeyEnum.superYuShouShareDesc.getKey(),user.getSystem()); |
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token)); |
| | | try { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc)))); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误"))); |
| | | } |
| | | } |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.S11YuShou, info.getRelationId() + ""); |
| | | String token = null; |
| | | if (Constant.IS_OUTNET) |
| | | token = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | try { |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | try { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, "mm_124933865_56750082_19507100253", |
| | | "20150318020005224", info.getRelationId(), true); |
| | | } catch (ConvertLinkException e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getCode(), e.getMessage()))); |
| | | return; |
| | | } |
| | | String link = dto.getClick_url(); |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "预售商品付定金,得奖金!", |
| | | link); |
| | | if (Constant.IS_OUTNET) |
| | | if (!StringUtil.isNullOrEmpty(token)) |
| | | redisManager.cacheCommonString(key, token, 60 * 60 * 24);// 缓存1天 |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | if (!StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, "口令生成失败,请稍后重试"))); |
| | | return; |
| | | } |
| | | UserInfo user = userInfoService.selectByPKey(uid); |
| | | String desc = configService.getValue(ConfigKeyEnum.superYuShouShareDesc.getKey(), user.getSystem()); |
| | | desc = desc.replace("[淘口令]", TaoBaoUtil.filterTaoToken(token)); |
| | | try { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(StringUtil.getBase64String(desc)))); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1002, "未知错误"))); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.user; |
| | | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | import com.yeshi.common.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.bus.homemodule.DeviceSex; |
| | | import com.yeshi.fanli.entity.bus.user.UserFunctionsLimit; |
| | | import com.yeshi.fanli.util.db.MongoSortFactory; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class UserFunctionsLimitDao extends MongodbBaseDao<UserFunctionsLimit> { |
| | | |
| | | |
| | | private Criteria[] getWheres(DaoQuery daoQuery) { |
| | | List<Criteria> whereList = new ArrayList<>(); |
| | | if (daoQuery.function != null) { |
| | | whereList.add(Criteria.where("function").is(daoQuery.function)); |
| | | } |
| | | if (daoQuery.minCreateTime != null) { |
| | | whereList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); |
| | | } |
| | | |
| | | if (daoQuery.maxCreateTime != null) { |
| | | whereList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); |
| | | } |
| | | |
| | | if (daoQuery.uid != null) { |
| | | whereList.add(Criteria.where("uid").is(daoQuery.uid)); |
| | | } |
| | | |
| | | if (daoQuery.nowDate != null) { |
| | | whereList.add(Criteria.where("startTime").lte(daoQuery.nowDate)); |
| | | whereList.add(Criteria.where("endTime").gt(daoQuery.nowDate)); |
| | | } |
| | | |
| | | Criteria[] wheres = new Criteria[whereList.size()]; |
| | | whereList.toArray(wheres); |
| | | return wheres; |
| | | } |
| | | |
| | | public List<UserFunctionsLimit> list(DaoQuery daoQuery) { |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().andOperator(getWheres(daoQuery))); |
| | | query.skip((int) daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) |
| | | query.with(new Sort(MongoSortFactory.createFromSqlSort(daoQuery.sortList))); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().andOperator(getWheres(daoQuery))); |
| | | return count(query); |
| | | } |
| | | |
| | | |
| | | public static class DaoQuery extends BaseDaoQuery { |
| | | public Date nowDate; |
| | | public Long uid; |
| | | public SystemFunction function; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | }, 1, "板栗快省", "板栗快省", false), |
| | | flq("com.fanliunion.android", "com.xyj.ec.flq-ios", new String[]{}, new SystemFunction[]{SystemFunction.share, SystemFunction.faQuan, SystemFunction.fanli}, 11, "返利联盟", "淘拼团", false), |
| | | yhqjx("com.youhuiquan.android", "com.youhuiquanjx.ios", new String[]{}, new SystemFunction[]{SystemFunction.fanli, SystemFunction.lijinSub, SystemFunction.bindPhone}, 12, "特价", "特价App", true), |
| | | hsb("com.haoshenbei.android", "com.haoshenbei.ios", new String[]{}, new SystemFunction[]{SystemFunction.fanli, SystemFunction.lijinSub, SystemFunction.bindPhone}, 12, "好省呗", "好省呗App", true), |
| | | hsb("com.hsb.shop", "com.hsb.shop.ios", new String[]{}, new SystemFunction[]{SystemFunction.fanli, SystemFunction.lijinSub, SystemFunction.bindPhone}, 12, "好省呗", "好省呗App", true), |
| | | |
| | | ; |
| | | private String packageName; |
| | |
| | | vip("超级会员"), |
| | | fanli("是否需要返利"), |
| | | lijinSub("礼金立减"), |
| | | share("是否需要分享"); |
| | | share("是否需要分享"), |
| | | recieveCoupon("领券"); |
| | | |
| | | private SystemFunction(String desc) { |
| | | |
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user; |
| | | |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @title: UserFunctionsLimit |
| | | * @description: 用户功能限制,限制用户的某些功能 |
| | | * @date 2021/9/13 19:00 |
| | | */ |
| | | public class UserFunctionsLimit { |
| | | |
| | | private String id; |
| | | private Long uid; |
| | | private SystemFunction function; |
| | | private Date startTime; |
| | | private Date endTime; |
| | | private String remarks; |
| | | private Date createTime; |
| | | private Date updateTime; |
| | | |
| | | |
| | | public Date getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public Date getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public static String createId(Long uid, SystemFunction function) { |
| | | return uid + "-" + function.name(); |
| | | } |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public SystemFunction getFunction() { |
| | | return function; |
| | | } |
| | | |
| | | public void setFunction(SystemFunction function) { |
| | | this.function = function; |
| | | } |
| | | |
| | | public String getRemarks() { |
| | | return remarks; |
| | | } |
| | | |
| | | public void setRemarks(String remarks) { |
| | | this.remarks = remarks; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.exception.goods; |
| | | |
| | | import com.yeshi.fanli.exception.BaseException; |
| | | |
| | | public class ConvertLinkException extends BaseException { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | //不包含需要转链的文本与链接 |
| | | public final static int CODE_NONE = 1; |
| | | |
| | | //功能限制 |
| | | public final static int CODE_FUNCTION_LIMIT = 300011; |
| | | |
| | | public ConvertLinkException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | public ConvertLinkException() { |
| | | super(); |
| | | } |
| | | } |
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink; |
| | | import com.yeshi.fanli.exception.dynamic.ActivityUserException; |
| | | import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkException; |
| | | import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException; |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | |
| | | if (!StringUtil.isNullOrEmpty(content) && commentInfo.getNeedSpin()) { |
| | | try { |
| | | convertLinkManager.convertLinkFromText(system, content, Constant.LINK_TOKEN_VERIFY_UID, true, false); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { |
| | | } catch (ConvertLinkException e) { |
| | | if (ConvertLinkException.CODE_NONE != e.getCode()) { |
| | | throw new GoodsEvaluateException(1, "包含不可转链的口令与链接"); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.homemodule.CommonShareInfoMapper; |
| | | import com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkException; |
| | | import com.yeshi.fanli.exception.homemodule.SpecialException; |
| | | import com.yeshi.fanli.service.inter.homemodule.CommonShareInfoService; |
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; |
| | |
| | | if (record.getNeedSpin()) { |
| | | try { |
| | | convertLinkManager.convertLinkFromText(SystemEnum.blks, record.getComment(), Constant.LINK_TOKEN_VERIFY_UID, true,false); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { |
| | | } catch (ConvertLinkException e) { |
| | | if (ConvertLinkException.CODE_NONE != e.getCode()) { |
| | | throw new SpecialException(1, "包含不可转链的口令与链接"); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | |
| | | logger.debug("新版推送开始:title-{} content-{}", new Object[]{title, content}); |
| | | //灰度测试 |
| | | if (uidList == null || uidList.size() == 0 || uidList.size() > 1) |
| | | return; |
| | | Set<Long> uidSet = new HashSet<>(); |
| | | uidSet.add(6857703L); |
| | | uidSet.add(6845887L); |
| | | |
| | | // 取消灰度测试 |
| | | // if (!uidSet.contains(uidList.get(0))) { |
| | | // if (uidList == null || uidList.size() == 0 || uidList.size() > 1) |
| | | // return; |
| | | // } |
| | | |
| | | logger.debug("新版推送开始:title-{} content-{}", new Object[]{title, content}); |
| | | |
| | | |
| | | BPushFilter filter = new BPushFilter(); |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user; |
| | | |
| | | import com.yeshi.fanli.dao.user.UserFunctionsLimitDao; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.bus.user.UserFunctionsLimit; |
| | | import com.yeshi.fanli.service.inter.user.UserFunctionsLimitService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @title: UserFunctionsLimitServiceImpl |
| | | * @description: TODO |
| | | * @date 2021/9/13 19:22 |
| | | */ |
| | | @Service |
| | | public class UserFunctionsLimitServiceImpl implements UserFunctionsLimitService { |
| | | |
| | | @Resource |
| | | private UserFunctionsLimitDao userFunctionsLimitDao; |
| | | |
| | | @Override |
| | | public void save(UserFunctionsLimit limit) throws Exception { |
| | | if (limit == null || limit.getFunction() == null || limit.getUid() == null) { |
| | | throw new Exception("参数不完整"); |
| | | } |
| | | if (limit.getCreateTime() == null) { |
| | | limit.setCreateTime(new Date()); |
| | | } |
| | | |
| | | if (limit.getStartTime() == null) { |
| | | limit.setStartTime(new Date()); |
| | | } |
| | | //默认封禁10年 |
| | | if (limit.getEndTime() == null) { |
| | | limit.setEndTime(new Date(limit.getStartTime().getTime() + 1000 * 60 * 60 * 24L * 365 * 10)); |
| | | } |
| | | |
| | | userFunctionsLimitDao.save(limit); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isLimit(Long uid, SystemFunction function, Date date) { |
| | | UserFunctionsLimitDao.DaoQuery daoQuery = new UserFunctionsLimitDao.DaoQuery(); |
| | | daoQuery.nowDate = date; |
| | | daoQuery.function = function; |
| | | daoQuery.uid = uid; |
| | | return userFunctionsLimitDao.count(daoQuery) > 0; |
| | | } |
| | | } |
| | |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkException; |
| | | import com.yeshi.fanli.exception.user.cloud.UserCloudException; |
| | | import com.yeshi.fanli.exception.user.cloud.UserCloudGoodsException; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | |
| | | try { |
| | | comment = convertLinkManager.convertLinkFromText(user.getSystem(), commentInfo.getContent(), uid, true, false); |
| | | hasToken = true; |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | } catch (ConvertLinkException e) { |
| | | if (e.getCode() != ConvertLinkException.CODE_NONE) { |
| | | throw new UserCloudException(1, e.getMsg()); |
| | | } |
| | | } catch (Exception e) { |
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user; |
| | | |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.bus.user.UserFunctionsLimit; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @title: UserFunctionsLimitService |
| | | * @projectName fanli-server |
| | | * @description: 用户功能限制服务 |
| | | * @date 2021/9/1319:19 |
| | | */ |
| | | public interface UserFunctionsLimitService { |
| | | |
| | | public void save(UserFunctionsLimit limit) throws Exception; |
| | | |
| | | public boolean isLimit(Long uid, SystemFunction function, Date date); |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.service.manger.goods; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | |
| | | |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.user.UserFunctionsLimitService; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import com.yeshi.fanli.dto.pdd.PDDPromotionUrl; |
| | | import com.yeshi.fanli.dto.taobao.api.TaoKeOfficialActivityConvertResultDTO; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.common.entity.taobao.TaoKeAppInfo; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkException; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoBuyRelationMapService; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.service.manger.goods.tb.TaoBaoTokenAuctionIdMapManager; |
| | |
| | | * String 返回类型 @throws |
| | | */ |
| | | public String convertLinkFromText(SystemEnum system, String text, Long uid, boolean share, boolean simpleToken) |
| | | throws ConvertLinkExceptionException, Exception { |
| | | throws ConvertLinkException, Exception { |
| | | String newText = convertJDLinkFromText(system, text, uid, share, simpleToken); |
| | | newText = convertPDDLinkFromText(system, newText, uid, share); |
| | | newText = convertTBLinkFromText(system, newText, uid, share, simpleToken); |
| | |
| | | } |
| | | } |
| | | if (text.equalsIgnoreCase(newText)) |
| | | throw new ConvertLinkExceptionException(ConvertLinkExceptionException.CODE_NONE, "不包含可转链的口令与链接"); |
| | | throw new ConvertLinkException(ConvertLinkException.CODE_NONE, "不包含可转链的口令与链接"); |
| | | return newText; |
| | | } |
| | | |
| | |
| | | return token; |
| | | } |
| | | |
| | | @Resource |
| | | private UserFunctionsLimitService userFunctionsLimitService; |
| | | |
| | | |
| | | //淘宝官方活动转链 |
| | | public TaoKeOfficialActivityConvertResultDTO taobaoOfficialActivityConvert(Long uid, String pid, String promotionSceneId, String relationId, boolean share) throws ConvertLinkException { |
| | | // 用户ID不为空时要验证相关的能力 |
| | | if (uid != null) { |
| | | //自购 |
| | | if (!share) { |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.fanli, new Date())) { |
| | | throw new ConvertLinkException(ConvertLinkException.CODE_FUNCTION_LIMIT, "该功能被限制"); |
| | | } |
| | | } else { |
| | | //分享 |
| | | if (userFunctionsLimitService.isLimit(uid, SystemFunction.share, new Date())) { |
| | | throw new ConvertLinkException(ConvertLinkException.CODE_FUNCTION_LIMIT, "该功能被限制"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert( |
| | | pid.split("_")[3], promotionSceneId, relationId); |
| | | return dto; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.util.db; |
| | | |
| | | import org.springframework.data.domain.Sort; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @title: MongoSortFactory |
| | | * @description: mongodb排序转换 |
| | | * @date 2021/9/13 19:13 |
| | | */ |
| | | public class MongoSortFactory { |
| | | |
| | | |
| | | public static List<Sort.Order> createFromSqlSort(List<String> sortList) { |
| | | if (sortList == null || sortList.size() == 0) |
| | | return null; |
| | | List<Sort.Order> sortOrderList = new ArrayList<>(); |
| | | for (String st : sortList) { |
| | | String[] sts = st.trim().split(" "); |
| | | if (sts.length < 2) |
| | | continue; |
| | | sortOrderList.add(new Sort.Order(Sort.Direction.valueOf(sts[1].toUpperCase()), sts[0])); |
| | | } |
| | | |
| | | return sortOrderList; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | <dubbo:annotation package="com.yeshi.fanli"></dubbo:annotation> |
| | | |
| | | <dubbo:registry address="zookeeper://172.16.16.46:2181"/> |
| | | <!--<dubbo:registry address="zookeeper://193.112.35.168:2182"/>--> |
| | | <!--<dubbo:registry address="zookeeper://172.16.16.46:2181"/>--> |
| | | <dubbo:registry address="zookeeper://193.112.35.168:2182"/> |
| | | |
| | | <!-- url=dubbo://192.168.3.122:20882/com.yeshi.goods.facade.service.TaoBaoCouponCacheService --> |
| | | |
| | |
| | | rocketmq.SecretKey=ixWg90QbYFKP6ae5xpAo2P1qwIyll5 |
| | | #测试 http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | #正式 http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | |
| | | |