Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.dto.jd.JDCategoryInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.ShamUser;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoodsClass;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | |
| | | if (couponInfo != null) {
|
| | | // 券链接处理
|
| | | String materialId = "https://item.jd.com/" + id + ".html";
|
| | | String url = JDApiUtil.convertLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON + "", null);
|
| | | String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(),
|
| | | JDApiUtil.POSITION_COUPON + "", null);
|
| | | couponInfo.setLink(url);
|
| | | }
|
| | |
|
| | |
| | | if (couponInfo != null) {
|
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | } else {
|
| | | jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + "");
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "",
|
| | | uid + "");
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | String jumpLink = null;
|
| | | String materialId = "https://item.jd.com/" + id + ".html";
|
| | |
|
| | | jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null + "");
|
| | | jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("native", true);
|
| | |
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "listSimpleGoods", method = RequestMethod.POST)
|
| | | public void listSimpleGoods(AcceptData acceptData, String goodsInfo, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(goodsInfo)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "商品信息为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | net.sf.json.JSONArray array = net.sf.json.JSONArray.fromObject(goodsInfo);
|
| | |
|
| | | List<CommonGoods> commonGoodsList = new ArrayList<>();
|
| | |
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject obj = array.optJSONObject(i);
|
| | | CommonGoods cg = new CommonGoods();
|
| | | cg.setGoodsId(obj.optLong("goodsId"));
|
| | | cg.setGoodsType(obj.optInt("goodsType"));
|
| | | commonGoodsList.add(cg);
|
| | | }
|
| | |
|
| | | if (commonGoodsList.size() > 9) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "最多同时获取9条数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 分离各个平台的商品信息
|
| | | List<Long> tbGoodsList = new ArrayList<>();
|
| | | List<Long> jdGoodsList = new ArrayList<>();
|
| | | List<Long> pddGoodsList = new ArrayList<>();
|
| | |
|
| | | List<String> keyList = new ArrayList<>();
|
| | |
|
| | | for (CommonGoods cg : commonGoodsList) {
|
| | | keyList.add(cg.getGoodsId() + "-" + cg.getGoodsType());
|
| | | if (cg.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | tbGoodsList.add(cg.getGoodsId());
|
| | | } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_JD) {
|
| | | jdGoodsList.add(cg.getGoodsId());
|
| | | } else if (cg.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
|
| | | pddGoodsList.add(cg.getGoodsId());
|
| | | }
|
| | | }
|
| | |
|
| | | Map<String, GoodsDetailVO> tempGoodsList = new HashMap<>();
|
| | |
|
| | | ConfigParamsDTO params = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
|
| | | hongBaoManageService.getShareRate(), new BigDecimal(80));
|
| | |
|
| | | if (tbGoodsList.size() > 0) {
|
| | | List<TaoBaoGoodsBrief> goodsList = null;
|
| | | try {
|
| | | goodsList = TaoKeApiUtil.getBatchGoodsInfo(tbGoodsList);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (goodsList != null)
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | goods.setTkRate(new BigDecimal(0));
|
| | | tempGoodsList.put(goods.getAuctionId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
|
| | | GoodsDetailVOFactory.convertTaoBao(goods, params));
|
| | | }
|
| | | }
|
| | | if (jdGoodsList.size() > 0) {
|
| | | List<JDGoods> goodsList = JDApiUtil.getGoodsDetail(jdGoodsList);
|
| | | for (JDGoods goods : goodsList) {
|
| | | tempGoodsList.put(goods.getSkuId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
|
| | | GoodsDetailVOFactory.convertJDGoods(goods, params));
|
| | | }
|
| | | }
|
| | | if (pddGoodsList.size() > 0) {
|
| | | List<PDDGoodsDetail> goodsList = PinDuoDuoApiUtil.listGoodsDetail(pddGoodsList);
|
| | | for (PDDGoodsDetail goods : goodsList) {
|
| | | tempGoodsList.put(goods.getGoodsId() + "-" + Constant.SOURCE_TYPE_TAOBAO,
|
| | | GoodsDetailVOFactory.convertPDDGoods(goods, params));
|
| | | }
|
| | | }
|
| | | List<GoodsDetailVO> voList = new ArrayList<>();
|
| | | Gson gson = JsonUtil.getApiCommonGson();
|
| | | for (String key : keyList) {
|
| | | GoodsDetailVO vo = tempGoodsList.get(key);
|
| | | if (vo != null) {
|
| | | voList.add(vo);
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(gson.toJson(voList)));
|
| | | }
|
| | | }
|
| | |
| | | private UserTaoLiJinRecordService userTaoLiJinRecordService;
|
| | |
|
| | | /**
|
| | | * 获取淘宝的分享链接
|
| | | *
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * -用户ID
|
| | | * @param auctionId-商品ID
|
| | | * @param goodsId-商品ID
|
| | | * @param source
|
| | | * @param totalNum
|
| | | * @param goodsType
|
| | | * @param needGoods
|
| | | * -是否需要商品信息
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "createShareInfo")
|
| | | public void createShareInfo(AcceptData acceptData, Long uid, Long goodsId, String source, Integer totalNum,
|
| | | Integer goodsType, HttpServletRequest request, PrintWriter out) {
|
| | | Integer goodsType, Boolean needGoods, HttpServletRequest request, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
|
| | | return;
|
| | |
| | |
|
| | | // 淘宝
|
| | | if (goodsType == null || goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | createTaoBaoShare(acceptData, uid, goodsId, totalNum, source, request, out);
|
| | | createTaoBaoShare(acceptData, uid, goodsId, totalNum, source, needGoods, request, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | // 京东
|
| | | if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | createJDShare(acceptData, uid, goodsId, source, out);
|
| | | createJDShare(acceptData, uid, goodsId, source, needGoods, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | // 拼多多
|
| | | if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | createPDDShare(acceptData, uid, goodsId, source, out);
|
| | | createPDDShare(acceptData, uid, goodsId, source, needGoods, out);
|
| | | return;
|
| | | }
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | public void createTaoBaoShare(AcceptData acceptData, Long uid, Long goodsId, Integer totalNum, String source,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | Boolean needGoods, HttpServletRequest request, PrintWriter out) {
|
| | | if (needGoods == null)
|
| | | needGoods = false;
|
| | |
|
| | | UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | UserInfoExtra userExtraInfo = userInfoExtraService.getUserInfoExtra(uid);
|
| | | String inviteCode = null;
|
| | |
| | | // 测试
|
| | |
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, goodsId, relationId);
|
| | |
|
| | | if (taoBaoLink != null && taoBaoLink.getGoods() != null && needGoods) {
|
| | | ConfigParamsDTO dto = new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
|
| | | hongBaoManageService.getShareRate(), new BigDecimal(80));
|
| | | GoodsDetailVO goodsInfo = GoodsDetailVOFactory.convertTaoBao(taoBaoLink.getGoods(), dto);
|
| | | shareInfo.setGoodsInfo(goodsInfo);
|
| | | }
|
| | |
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | |
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | public void createJDShare(AcceptData acceptData, Long uid, Long goodsId, String source, PrintWriter out) {
|
| | | public void createJDShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods,
|
| | | PrintWriter out) {
|
| | | JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
|
| | | if (jdGoods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "该商品已下架"));
|
| | |
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | String materialId = "https://item.jd.com/" + goodsId + ".html";
|
| | | String jumpLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
|
| | | String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
|
| | | uid + "");
|
| | |
|
| | | ShareInfoVO shareInfo = new ShareInfoVO();
|
| | | shareInfo.setClickUrl(jumpLink);
|
| | |
| | | shareInfo.setRule(configService.get("share_rule_link_jd"));
|
| | | shareInfo.setPictUrl(jdGoods.getPicUrl());
|
| | | shareInfo.setCommentTexts(new ArrayList<>());
|
| | |
|
| | | if (needGoods)
|
| | | shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertJDGoods(jdGoods, new ConfigParamsDTO(
|
| | | hongBaoManageService.getFanLiRate(), hongBaoManageService.getShareRate(), new BigDecimal(80))));
|
| | |
|
| | | String shareText = "";
|
| | | boolean hasCoupon = false;
|
| | |
| | | * @param source
|
| | | * @param out
|
| | | */
|
| | | public void createPDDShare(AcceptData acceptData, Long uid, Long goodsId, String source, PrintWriter out) {
|
| | | public void createPDDShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods,
|
| | | PrintWriter out) {
|
| | | PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
|
| | | if (goods == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "该商品已下架"));
|
| | |
| | | shareInfo.setCommentTexts(new ArrayList<>());
|
| | | shareInfo.setRule(configService.get("share_rule_link_pdd"));
|
| | | shareInfo.setPictUrl(goods.getGoodsImageUrl());
|
| | | if (needGoods) {
|
| | | shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertPDDGoods(goods, new ConfigParamsDTO(
|
| | | hongBaoManageService.getFanLiRate(), hongBaoManageService.getShareRate(), new BigDecimal(80))));
|
| | | }
|
| | |
|
| | | String template = "";
|
| | | boolean hasCoupon = false;
|
| | |
| | | couponUrl = couponInfo.getLink();
|
| | | }
|
| | | String materialId = "https://item.jd.com/" + goodsId + ".html";
|
| | | String shortLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
|
| | | String shortLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
|
| | | uid + "");
|
| | |
|
| | | String content = shareGoodsTextTemplateService.createContentByTemplateJD(template, uid, goods, shortLink,
|
| | | hasCoupon);
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserGoodsStorageService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
| | | @Resource
|
| | | private UserGoodsStorageService userGoodsStorageService;
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 单个商品加入选品库
|
| | | * 单个商品加入选品库
|
| | | *
|
| | | * @param callback
|
| | | * @param storageIds
|
| | |
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (goodsType == null) {
|
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | UserGoodsStorage userGoodsStorage = userGoodsStorageService.getByUidAndAuctionId(uid, id, goodsType);
|
| | | boolean storageState = false;
|
| | |
| | | userGoodsStorageService.save(uid, set, goodsType);
|
| | | storageState = true;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("storageState", storageState);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 批量添加选品库
|
| | | *
|
| | | * @param acceptData
|
| | | * @param uid 用户id
|
| | | * @param ids 简版商品id
|
| | | * @param uid
|
| | | * 用户id
|
| | | * @param ids
|
| | | * 简版商品id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "addStorage", method = RequestMethod.POST)
|
| | |
| | | * 查询用户选品库数据
|
| | | *
|
| | | * @param acceptData
|
| | | * @param page 页码 初始值 1
|
| | | * @param uid 用户id
|
| | | * @param page
|
| | | * 页码 初始值 1
|
| | | * @param uid
|
| | | * 用户id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getlist", method = RequestMethod.POST)
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 分享商品返回二维码图片
|
| | | *
|
| | |
| | | out.print(JsonUtil.loadFalseResult("分享商品不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | |
| | |
|
| | | try {
|
| | | Gson gson = new Gson();
|
| | | List<Long> listStorageID = gson.fromJson(storageIds, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | if (listStorageID == null || listStorageID.size() < 9) {
|
| | | out.print(JsonUtil.loadFalseResult("分享商品数量不足"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (listStorageID.size() != 9) {
|
| | | out.print(JsonUtil.loadFalseResult("分享商品数量只能是9个"));
|
| | | return;
|
| | | List<Long> listStorageID = gson.fromJson(storageIds, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | |
|
| | | if (listStorageID == null || listStorageID.size() < 9) {
|
| | | out.print(JsonUtil.loadFalseResult("分享商品数量不足"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (listStorageID.size() != 9) {
|
| | | out.print(JsonUtil.loadFalseResult("分享商品数量只能是9个"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject data = userGoodsStorageService.createShareV2(uid, listStorageID, true);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } else {
|
| | | JSONObject data = userGoodsStorageService.createShareV2(uid, listStorageID, false);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | JSONObject data = userGoodsStorageService.createShareV2(uid, listStorageID);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserGoodsStorageException e) {
|
| | | out.print(JsonUtil.loadFalseResult("分享失败"));
|
| | | e.printStackTrace();
|
| | |
| | | }
|
| | |
|
| | | String materialId = "https://item.jd.com/" + id + ".html";
|
| | | String jumpLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid);
|
| | | String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid);
|
| | |
|
| | | int priceType = 1;
|
| | | BigDecimal price = jdGoods.getPrice();
|
| | |
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, "100", null)));
|
| | | }
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(array)));
|
| | | |
| | | |
| | |
|
| | |
|
| | | |
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | int insertSelective(UserInfo record);
|
| | |
|
| | | UserInfo selectByPrimaryKey(Long id);
|
| | | UserInfo selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 查询有效的
|
| | |
| | | List<UserInfo> listByClosed(@Param("appId") String appId, @Param("phone") String phone);
|
| | |
|
| | | long countAvaiableUser();
|
| | | |
| | |
|
| | | /**
|
| | | * 查询满足自动提现用户
|
| | | * |
| | | * @param start
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | |
| | | List<UserInfo> getAutoExtractUser(@Param("start") int start, @Param("count") int count,
|
| | | @Param("money") BigDecimal money, @Param("beganDate") String beganDate, @Param("endDate") String endDate);
|
| | |
|
| | | /**
|
| | | * 根据type检索
|
| | | * @param type
|
| | | * @param start
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<UserInfo> listByType(@Param("type")int type,@Param("start") long start, @Param("count")int count);
|
| | |
|
| | | long countByType(int type);
|
| | |
|
| | | /**
|
| | | * 查询满足自动提现用户
|
| | |
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<UserInfo> getAutoExtractUser(@Param("start") int start, @Param("count") int count, @Param("money") BigDecimal money,
|
| | | @Param("beganDate") String beganDate, @Param("endDate") String endDate);
|
| | | |
| | | |
| | | /**
|
| | | * 查询满足自动提现用户
|
| | | * @param start
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<UserInfo> getAutoExtractUserTo1212(@Param("start") int start, @Param("count") int count);
|
| | | List<UserInfo> getAutoExtractUserTo1212(@Param("start") int start, @Param("count") int count); |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.integral;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
| | | import com.yeshi.fanli.entity.integral.CodePublishRecord;
|
| | |
|
| | | public interface CodePublishRecordMapper extends BaseMapper<CodePublishRecord> {
|
| | | |
| | |
|
| | | /**
|
| | | * 查询近3天发布记录
|
| | | * |
| | | * @return
|
| | | */
|
| | | List<CodePublishRecord> listValid(@Param("start") long start, @Param("count") int count, @Param("validTime")long validTime);
|
| | | |
| | | |
| | | List<CodePublishRecord> listValid(@Param("start") long start, @Param("count") int count,
|
| | | @Param("validTime") long validTime);
|
| | |
|
| | | /**
|
| | | * 根据最小时间查询
|
| | | * @param start
|
| | | * @param count
|
| | | * @param minTime
|
| | | * @return
|
| | | */
|
| | | List<CodePublishRecord> listByMinTime(@Param("start") long start, @Param("count") int count,
|
| | | @Param("minTime") Date minTime);
|
| | |
|
| | | long countValid(@Param("validTime") long validTime);
|
| | | |
| | | |
| | |
|
| | | long countValidRecord(@Param("uid") long uid, @Param("validTime") long validTime);
|
| | | } |
| | |
| | | @Expose
|
| | | private String lastLoginIp;// 最近一次登录IP
|
| | |
|
| | | @Column(name = "tuiguang_code")
|
| | | @Column(name = "type")
|
| | | @Expose
|
| | | private String tuiGuangCode;// 推广码
|
| | | private Integer type;// 用户类型 0-普通用户 1-虚拟用户
|
| | |
|
| | | @Column(name = "appid")
|
| | | @Expose
|
| | |
| | | @Transient
|
| | | @Expose
|
| | | private String rankIcon;// 等级图标
|
| | | |
| | |
|
| | | // 性别: 1-女 2-男
|
| | | // 性别: 1-女 2-男
|
| | | @Transient
|
| | | @Expose
|
| | | private Integer sex;
|
| | | |
| | |
|
| | | // 微信号
|
| | | @Transient
|
| | | @Expose
|
| | | private String weiXin;
|
| | | |
| | |
|
| | | // 微信提示语
|
| | | @Transient
|
| | | @Expose
|
| | |
| | | private String rankNamePicture;// 等级名称图片
|
| | | @Transient
|
| | | private String taoBaoUid;// 淘宝的用户ID
|
| | | |
| | | //是否为VIP
|
| | |
|
| | | // 是否为VIP
|
| | | @Transient
|
| | | @Expose
|
| | | private boolean vip;
|
| | | |
| | | |
| | |
|
| | | public boolean isVip() {
|
| | | return vip;
|
| | | }
|
| | |
| | | this.appId = appId;
|
| | | }
|
| | |
|
| | | public String getTuiGuangCode() {
|
| | | return tuiGuangCode;
|
| | | }
|
| | |
|
| | | public void setTuiGuangCode(String tuiGuangCode) {
|
| | | this.tuiGuangCode = tuiGuangCode;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
| | | public void setPayPassword(String payPassword) {
|
| | | this.payPassword = payPassword;
|
| | | }
|
| | | |
| | |
|
| | | public Integer getSex() {
|
| | | return sex;
|
| | | }
|
| | |
| | | this.weiXinTip = weiXinTip;
|
| | | }
|
| | |
|
| | | public Integer getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(Integer type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int hashCode() {
|
| | | final int prime = 31;
|
| | |
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | // 发布有效时间
|
| | | // 发布有效时间 3天
|
| | | public static final long VALIDTIME = 3*24*60*60;
|
| | |
|
| | | @Expose
|
New file |
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.integral.CodePublishRecord;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | /**
|
| | | * 邀请码发布
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class ShameUserInviteCodePublishJOB {
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private CodePublishRecordService codePublishRecordService;
|
| | |
|
| | | // 7点到23点每10分钟执行一次
|
| | | @Scheduled(cron = "0 0/10 7-23 * * ? ")
|
| | | public void publish() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | long time = System.currentTimeMillis();
|
| | | int day = TimeUtil.getDayDifferenceCount(new Date(TimeUtil.convertToTimeTemp("2019-11-28", "yyyy-MM-dd")),
|
| | | new Date());
|
| | | int count = (day + 1) * 3;
|
| | | if (count > 33)
|
| | | count = 33;
|
| | | List<CodePublishRecord> list = codePublishRecordService.listByMinTime(0, 200,
|
| | | new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(time, "yyyyMMdd"), "yyyyMMddd")));
|
| | | int shameCount = 0;
|
| | | for (CodePublishRecord record : list) {
|
| | | UserInfo user = userInfoService.selectByPKey(record.getUid());
|
| | | if (user != null && user.getType() == 1)
|
| | | shameCount++;
|
| | | }
|
| | |
|
| | | if (shameCount > 33) {// 不再添加
|
| | | return;
|
| | | }
|
| | | int leftCount = count - shameCount;
|
| | | if (leftCount <= 0)
|
| | | return;
|
| | |
|
| | | long publishLeftCount = (TimeUtil
|
| | | .convertToTimeTemp(TimeUtil.getGernalTime(time + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMddd") - time)
|
| | | / (1000 * 60 * 10L);
|
| | | // 今天还剩下的分钟数
|
| | | if (leftCount > count * publishLeftCount / 102) {
|
| | | // 计算本次是否发布
|
| | | int start = (int) (Math.random() * 1000);
|
| | | List<UserInfo> userList = userInfoService.listByType(1, start, 1);
|
| | | try {
|
| | | Thread.sleep((int) (Math.random() * 1000 * 60 * 3L));
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (userList != null && userList.size() > 0) {
|
| | | codePublishRecordService.publishInviteCode(userList.get(0).getId());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <result column="last_logintime" property="lastLoginTime"
|
| | | jdbcType="BIGINT" />
|
| | | <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" />
|
| | | <result column="tuiguang_code" property="tuiGuangCode"
|
| | | jdbcType="VARCHAR" />
|
| | | <result column="type" property="type" jdbcType="INTEGER" />
|
| | | <result column="appid" property="appId" jdbcType="VARCHAR" />
|
| | | <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" />
|
| | | <result column="pay_password" property="payPassword" jdbcType="VARCHAR" />
|
| | |
| | | <result column="last_logintime" property="lastLoginTime"
|
| | | jdbcType="BIGINT" />
|
| | | <result column="loginip" property="lastLoginIp" jdbcType="VARCHAR" />
|
| | | <result column="tuiguang_code" property="tuiGuangCode"
|
| | | jdbcType="VARCHAR" />
|
| | | <result column="type" property="type" jdbcType="INTEGER" />
|
| | | <result column="appid" property="appId" jdbcType="VARCHAR" />
|
| | | <result column="my_hongBao" property="myHongBao" jdbcType="DECIMAL" />
|
| | | <result column="pay_password" property="payPassword" jdbcType="VARCHAR" />
|
| | |
| | | <result column="showDate" property="showDate" jdbcType="VARCHAR" />
|
| | | <result column="showValue" property="showValue" jdbcType="VARCHAR" />
|
| | | </resultMap>
|
| | | |
| | | <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,tuiguang_code,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc
|
| | |
|
| | | <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc
|
| | | </sql>
|
| | | <!-- 不能查询缓存 -->
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | |
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user
|
| | | (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,tuiguang_code,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc)
|
| | | (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,sid,rank,phone,state,state_desc)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{tuiGuangCode,jdbcType=VARCHAR},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system.id,jdbcType=BIGINT},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR})
|
| | | (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system.id,jdbcType=BIGINT},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | |
| | | <if test="createtime != null">createtime,</if>
|
| | | <if test="lastLoginTime != null">last_logintime,</if>
|
| | | <if test="lastLoginIp != null">loginip,</if>
|
| | | <if test="tuiGuangCode != null">tuiguang_code,</if>
|
| | | <if test="type != null">type,</if>
|
| | | <if test="appId != null">appid,</if>
|
| | | <if test="myHongBao != null">my_hongBao,</if>
|
| | | <if test="payPassword != null">pay_password,</if>
|
| | |
| | | <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if>
|
| | | <if test="lastLoginTime != null">#{lastLoginTime,jdbcType=BIGINT},</if>
|
| | | <if test="lastLoginIp != null">#{lastLoginIp,jdbcType=VARCHAR},</if>
|
| | | <if test="tuiGuangCode != null">#{tuiGuangCode,jdbcType=VARCHAR},</if>
|
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if>
|
| | | <if test="appId != null">#{appId,jdbcType=VARCHAR},</if>
|
| | | <if test="myHongBao != null">#{myHongBao,jdbcType=DECIMAL},</if>
|
| | | <if test="payPassword != null">#{payPassword,jdbcType=VARCHAR},</if>
|
| | |
| | | #{portrait,jdbcType=VARCHAR},createtime =
|
| | | #{createtime,jdbcType=BIGINT},last_logintime =
|
| | | #{lastLoginTime,jdbcType=BIGINT},loginip =
|
| | | #{lastLoginIp,jdbcType=VARCHAR},tuiguang_code =
|
| | | #{tuiGuangCode,jdbcType=VARCHAR},appid =
|
| | | #{lastLoginIp,jdbcType=VARCHAR},type =
|
| | | #{type,jdbcType=INTEGER},appid =
|
| | | #{appId,jdbcType=VARCHAR},my_hongBao =
|
| | | #{myHongBao,jdbcType=DECIMAL},pay_password =
|
| | | #{payPassword,jdbcType=VARCHAR},sid =
|
| | |
| | | <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if>
|
| | | <if test="lastLoginTime != null">last_logintime=#{lastLoginTime,jdbcType=BIGINT},</if>
|
| | | <if test="lastLoginIp != null">loginip=#{lastLoginIp,jdbcType=VARCHAR},</if>
|
| | | <if test="tuiGuangCode != null">tuiguang_code=#{tuiGuangCode,jdbcType=VARCHAR},</if>
|
| | | <if test="type != null">type=#{type,jdbcType=INTEGER},</if>
|
| | | <if test="appId != null">appid=#{appId,jdbcType=VARCHAR},</if>
|
| | | <if test="myHongBao != null">my_hongBao=#{myHongBao,jdbcType=DECIMAL},</if>
|
| | | <if test="payPassword != null">pay_password=#{payPassword,jdbcType=VARCHAR},</if>
|
| | |
| | | yeshi_ec_user u
|
| | | where u.state=0
|
| | | </select>
|
| | | |
| | |
|
| | | <select id="getAutoExtractUser" resultMap="BaseResultMap">
|
| | | SELECT u.* FROM `yeshi_ec_user_info_extra` t
|
| | | LEFT JOIN `yeshi_ec_user` u ON u.`id` = t.`uie_uid`
|
| | | WHERE t.`uie_auto_extract` = 1 AND t.uie_active_time <![CDATA[>=]]> #{beganDate} AND t.uie_active_time <![CDATA[<]]> #{endDate}
|
| | | AND (t.`uie_mark` IS NULL OR t.`uie_mark` = '') |
| | | AND u.`state` = 0 AND u.`my_hongBao` <![CDATA[>=]]> #{money} |
| | | AND u.`wx_open_id` IS NOT NULL AND LENGTH(TRIM(u.`wx_open_id`)) <![CDATA[>]]> 0
|
| | | AND u.`wx_open_id` NOT LIKE 'o_b9%'
|
| | | LEFT JOIN `yeshi_ec_user`
|
| | | u ON u.`id` = t.`uie_uid`
|
| | | WHERE t.`uie_auto_extract` = 1 AND
|
| | | t.uie_active_time <![CDATA[>=]]>
|
| | | #{beganDate} AND t.uie_active_time <![CDATA[<]]>
|
| | | #{endDate}
|
| | | AND (t.`uie_mark` IS NULL OR t.`uie_mark` = '')
|
| | | AND u.`state`
|
| | | = 0 AND u.`my_hongBao` <![CDATA[>=]]>
|
| | | #{money}
|
| | | AND u.`wx_open_id` IS NOT NULL AND
|
| | | LENGTH(TRIM(u.`wx_open_id`)) <![CDATA[>]]>
|
| | | 0
|
| | | AND u.`wx_open_id` NOT LIKE 'o_b9%'
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | |
|
| | |
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listByType" resultMap="BaseResultMap">
|
| | | select * from yeshi_ec_user u
|
| | | where u.type=#{type} limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | | <select id="countByType" resultType="java.lang.Long"
|
| | | parameterType="java.lang.Integer">
|
| | | select count(*) from
|
| | | yeshi_ec_user u where u.type=#{0}
|
| | | </select>
|
| | |
|
| | | </mapper>
|
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | |
|
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.integral.CodePublishRecordMapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.integral.CodePublishRecord">
|
| | | <id column="pr_id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="pr_uid" property="uid" jdbcType="BIGINT"/>
|
| | | <result column="pr_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
| | | </resultMap>
|
| | | |
| | | <resultMap id="BaseResultVOMap" type="com.yeshi.fanli.entity.integral.CodePublishRecord">
|
| | | <id column="pr_id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="pr_uid" property="uid" jdbcType="BIGINT"/>
|
| | | <result column="pr_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
|
| | | <result column="portrait" property="portrait" jdbcType="VARCHAR"/>
|
| | | <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/>
|
| | | </resultMap>
|
| | | |
| | | <sql id="Base_Column_List">pr_id,pr_uid,pr_create_time</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
| | | <include refid="Base_Column_List"/>from yeshi_ec_code_publish_record where pr_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_code_publish_record where pr_id = #{id,jdbcType=BIGINT}</delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_code_publish_record (pr_id,pr_uid,pr_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_code_publish_record
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">pr_id,</if>
|
| | | <if test="uid != null">pr_uid,</if>
|
| | | <if test="createTime != null">pr_create_time,</if>
|
| | | </trim>values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord">update yeshi_ec_code_publish_record set pr_uid = #{uid,jdbcType=BIGINT},pr_create_time = #{createTime,jdbcType=TIMESTAMP} where pr_id = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord">update yeshi_ec_code_publish_record
|
| | | <set>
|
| | | <if test="uid != null">pr_uid=#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="createTime != null">pr_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | </set> where pr_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | |
| | | <select id="listValid" resultMap="BaseResultVOMap">
|
| | | SELECT p.*,u.`nick_name`,u.`portrait`,e.`uie_invite_code` FROM yeshi_ec_code_publish_record p
|
| | | LEFT JOIN `yeshi_ec_user` u ON u.`id` = p.`pr_uid`
|
| | | LEFT JOIN `yeshi_ec_user_info_extra` e ON e.`uie_uid` = p.`pr_uid`
|
| | | WHERE TIMESTAMPDIFF(SECOND,p.`pr_create_time`,NOW())<![CDATA[<]]> #{validTime}
|
| | | ORDER BY p.`pr_create_time` DESC
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | | |
| | | <select id="countValid" resultType="Long">
|
| | | SELECT IFNULL(COUNT(pr_id),0) FROM yeshi_ec_code_publish_record
|
| | | WHERE TIMESTAMPDIFF(SECOND,`pr_create_time`,NOW())<![CDATA[<]]> #{validTime}
|
| | | </select>
|
| | | |
| | | <select id="countValidRecord" resultType="Long">
|
| | | SELECT IFNULL(COUNT(pr_id),0) FROM yeshi_ec_code_publish_record
|
| | | WHERE pr_uid = #{uid} AND TIMESTAMPDIFF(SECOND,`pr_create_time`,NOW())<![CDATA[<]]> #{validTime}
|
| | | </select>
|
| | | |
| | | <resultMap id="BaseResultMap"
|
| | | type="com.yeshi.fanli.entity.integral.CodePublishRecord">
|
| | | <id column="pr_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="pr_uid" property="uid" jdbcType="BIGINT" />
|
| | | <result column="pr_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
| | | </resultMap>
|
| | |
|
| | | <resultMap id="BaseResultVOMap"
|
| | | type="com.yeshi.fanli.entity.integral.CodePublishRecord">
|
| | | <id column="pr_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="pr_uid" property="uid" jdbcType="BIGINT" />
|
| | | <result column="pr_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR" />
|
| | | <result column="portrait" property="portrait" jdbcType="VARCHAR" />
|
| | | <result column="uie_invite_code" property="inviteCode"
|
| | | jdbcType="VARCHAR" />
|
| | | </resultMap>
|
| | |
|
| | | <sql id="Base_Column_List">pr_id,pr_uid,pr_create_time</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_code_publish_record where pr_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_code_publish_record where pr_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_code_publish_record (pr_id,pr_uid,pr_create_time) values
|
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_code_publish_record
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">pr_id,</if>
|
| | | <if test="uid != null">pr_uid,</if>
|
| | | <if test="createTime != null">pr_create_time,</if>
|
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord">update
|
| | | yeshi_ec_code_publish_record set pr_uid =
|
| | | #{uid,jdbcType=BIGINT},pr_create_time =
|
| | | #{createTime,jdbcType=TIMESTAMP} where pr_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.integral.CodePublishRecord">
|
| | | update yeshi_ec_code_publish_record
|
| | | <set>
|
| | | <if test="uid != null">pr_uid=#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="createTime != null">pr_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | </set>
|
| | | where pr_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | |
|
| | | <select id="listValid" resultMap="BaseResultVOMap">
|
| | | SELECT p.*,u.`nick_name`,u.`portrait`,e.`uie_invite_code` FROM
|
| | | yeshi_ec_code_publish_record p
|
| | | LEFT JOIN `yeshi_ec_user` u ON u.`id` = p.`pr_uid`
|
| | | LEFT JOIN `yeshi_ec_user_info_extra` e ON e.`uie_uid` = p.`pr_uid`
|
| | | WHERE TIMESTAMPDIFF(SECOND,p.`pr_create_time`,NOW())<![CDATA[<]]>
|
| | | #{validTime}
|
| | | ORDER BY p.`pr_create_time` DESC
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listByMinTime" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_code_publish_record p where p.`pr_create_time` >=
|
| | | #{minTime}
|
| | | ORDER BY p.`pr_create_time` DESC
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | |
|
| | | <select id="countValid" resultType="Long">
|
| | | SELECT IFNULL(COUNT(pr_id),0) FROM yeshi_ec_code_publish_record
|
| | | WHERE TIMESTAMPDIFF(SECOND,`pr_create_time`,NOW())<![CDATA[<]]>
|
| | | #{validTime}
|
| | | </select>
|
| | |
|
| | | <select id="countValidRecord" resultType="Long">
|
| | | SELECT IFNULL(COUNT(pr_id),0) FROM yeshi_ec_code_publish_record
|
| | | WHERE pr_uid = #{uid} AND TIMESTAMPDIFF(SECOND,`pr_create_time`,NOW())<![CDATA[<]]>
|
| | | #{validTime}
|
| | | </select>
|
| | |
|
| | | </mapper>
|
| | |
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.aliyun.openservices.ons.api.SendResult;
|
| | | import com.aliyun.openservices.ons.api.transaction.LocalTransactionExecuter;
|
| | | import com.aliyun.openservices.ons.api.transaction.TransactionProducer;
|
| | | import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
|
| | |
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTagConstant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Service
|
| | |
| | | if (order.getValidCode() == 2)
|
| | | return;
|
| | |
|
| | | // 根据ext1与subUnionId跟单
|
| | | String uidStr = order.getExt1();
|
| | | if (StringUtil.isNullOrEmpty(uidStr))
|
| | | uidStr = order.getOrderItemList().get(0).getSubUnionId();
|
| | |
|
| | | Long uid = null;
|
| | | if (!StringUtil.isNullOrEmpty(uidStr) && NumberUtil.isNumeric(uidStr))
|
| | | uid = Long.parseLong(uidStr);
|
| | |
| | | userInfoMapper.updateByPrimaryKeySelective(userInfo);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void register(UserInfo userInfo) throws UserAccountException {
|
| | | if (!StringUtil.isNullOrEmpty(userInfo.getPhone())) {
|
| | |
| | |
|
| | | @Service
|
| | | public class UserGoodsStorageServiceImpl implements UserGoodsStorageService {
|
| | | |
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | |
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService manageService;
|
| | |
|
| | | @Resource
|
| | | private UserGoodsStorageMapper userGoodsStorageMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserShareGoodsRecordService userShareGoodsRecordService;
|
| | | @Resource
|
| | |
| | | public int deleteBatchByPrimaryKey(List<Long> list) {
|
| | | return userGoodsStorageMapper.deleteBatchByPrimaryKey(list);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 根据主键 、uid 批量删除
|
| | | * |
| | | * @param list
|
| | | * @return
|
| | | */
|
| | |
| | | public List<UserGoodsStorage> listQueryByUid(long start, int count, Long uid, Integer source) {
|
| | | return userGoodsStorageMapper.listQueryByUid(start, count, uid, source);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public UserGoodsStorage getByUidAndAuctionId(Long uid, Long auctionId, Integer goodsType) {
|
| | | return userGoodsStorageMapper.getByUidAndAuctionId(uid, auctionId, goodsType);
|
| | |
| | | public long countQueryByUid(Long uid, Integer source) {
|
| | | return userGoodsStorageMapper.countQueryByUid(uid, source);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void save(Long uid, Set<Long> auctionIds, Integer goodsType) throws UserGoodsStorageException {
|
| | |
|
| | |
| | | for (Long auctionId : auctionIds) {
|
| | | CommonGoods commonGoods = null;
|
| | | if (goodsType == null) {
|
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO;
|
| | | } |
| | | |
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO;
|
| | | }
|
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | // 京东 |
| | | // 京东
|
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(auctionId);
|
| | | if (jdGoods == null) {
|
| | | jdGoods = JDApiUtil.getGoodsDetail(auctionId);
|
| | |
| | | throw new UserGoodsStorageException(1, auctionId + "商品已下架");
|
| | | }
|
| | | commonGoods = CommonGoodsFactory.create(jdGoods);
|
| | | |
| | |
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | // 拼多多 |
| | | // 拼多多
|
| | | PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(auctionId);
|
| | | if (pddGoods == null) {
|
| | | throw new UserGoodsStorageException(1, auctionId + "商品已下架");
|
| | |
| | | throw new UserGoodsStorageException(1, auctionId + "商品已下架");
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | if (commonGoods != null) {
|
| | | try {
|
| | | commonGoodsService.addOrUpdateCommonGoods(commonGoods);
|
| | |
| | | userGoodsStorageMapper.updateByPrimaryKeySelective(goodsStorage);
|
| | | } else {
|
| | | goodsStorage = new UserGoodsStorage();
|
| | | goodsStorage.setUid(uid);;
|
| | | goodsStorage.setUid(uid);
|
| | | ;
|
| | | goodsStorage.setState(UserGoodsStorage.STATE_NORMAL);
|
| | | goodsStorage.setCommonGoods(commonGoods);
|
| | | goodsStorage.setCreateTime(new Date());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Transactional
|
| | | public void addCommonGoods(Long uid, Set<Long> ids) throws UserGoodsStorageException {
|
| | |
| | | userGoodsStorageMapper.updateByPrimaryKeySelective(goodsStorage);
|
| | | } else {
|
| | | goodsStorage = new UserGoodsStorage();
|
| | | goodsStorage.setUid(uid);;
|
| | | goodsStorage.setUid(uid);
|
| | | ;
|
| | | goodsStorage.setState(UserGoodsStorage.STATE_NORMAL);
|
| | | goodsStorage.setCommonGoods(commonGoods);
|
| | | goodsStorage.setCreateTime(new Date());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public JSONArray getMyStorage(int page, int pageSize, Long uid, Integer source) throws UserGoodsStorageException {
|
| | | |
| | |
|
| | | JSONArray array = new JSONArray();
|
| | |
|
| | | List<UserGoodsStorage> listStorage = listQueryByUid(page , pageSize, uid, source);
|
| | | List<UserGoodsStorage> listStorage = listQueryByUid(page, pageSize, uid, source);
|
| | | if (listStorage == null || listStorage.size() == 0) {
|
| | | return array;
|
| | | }
|
| | | |
| | |
|
| | | if (source == null) {
|
| | | source = Constant.SOURCE_TYPE_TAOBAO;
|
| | | }
|
| | | |
| | |
|
| | | List<TaoBaoGoodsBrief> listTaoKeGoods = null;
|
| | | if (source == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | List<Long> listGid = new ArrayList<Long>();
|
| | |
| | | }
|
| | | listGid.add(commonGoods.getGoodsId());
|
| | | }
|
| | | |
| | |
|
| | | // API网络接口验证是否在售
|
| | | try {
|
| | | listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | BigDecimal rate = manageService.getFanLiRate();
|
| | |
|
| | | BigDecimal rate = manageService.getFanLiRate();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | |
| | |
|
| | | for (UserGoodsStorage userGoodsStorage : listStorage) {
|
| | | CommonGoods commonGoods = userGoodsStorage.getCommonGoods();
|
| | | if (commonGoods == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | int state = 0;
|
| | | Integer goodsType = commonGoods.getGoodsType();
|
| | | |
| | | if (listTaoKeGoods != null && listTaoKeGoods.size() > 0 |
| | | && goodsType != null && goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | state = 1; // 默认停售
|
| | |
|
| | | if (listTaoKeGoods != null && listTaoKeGoods.size() > 0 && goodsType != null
|
| | | && goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | state = 1; // 默认停售
|
| | | Long goodsId = commonGoods.getGoodsId();
|
| | | for (TaoBaoGoodsBrief taoKeGoods: listTaoKeGoods) {
|
| | | for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) {
|
| | | Long auctionId = taoKeGoods.getAuctionId();
|
| | | if (goodsId == auctionId || goodsId.equals(auctionId)) {
|
| | | state = 0; // 在售
|
| | |
| | | }
|
| | | commonGoods.setState(state);
|
| | | TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(commonGoods);
|
| | | |
| | |
|
| | | // 判断是否已分享
|
| | | Integer storageState = userGoodsStorage.getState();
|
| | | if (storageState != null && storageState == UserGoodsStorage.STATE_SHARED) {
|
| | |
| | | goodsBrief.setState(2); // 已分享状态 优先显示已下架
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | String json = gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, rate.toString(), null));
|
| | | |
| | |
|
| | | JSONObject dataObject = new JSONObject();
|
| | | dataObject.put("storageId", userGoodsStorage.getId());
|
| | | dataObject.put("goods", json);
|
| | | array.add(dataObject);
|
| | | }
|
| | | |
| | |
|
| | | return array;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public boolean isExistStorage(Long uid, Long auctionId, Integer goodType) {
|
| | | boolean state = false;
|
| | |
| | | }
|
| | | return state;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public JSONObject shareGoods(Long uid, List<Long> listStorageID) |
| | | public JSONObject shareGoods(Long uid, List<Long> listStorageID)
|
| | | throws UserGoodsStorageException, UserShareGoodsRecordException {
|
| | | List<UserGoodsStorage> listStorage = userGoodsStorageMapper.listQueryByIds(listStorageID);
|
| | | if (listStorage == null || listStorage.size() == 0) {
|
| | | throw new UserGoodsStorageException(1, "选品库商品不存在");
|
| | | }
|
| | | |
| | |
|
| | | List<UserGoodsStorage> listResult = new ArrayList<UserGoodsStorage>();
|
| | | // 还原顺序 用于制图
|
| | | for (Long sid: listStorageID) {
|
| | | for (UserGoodsStorage torage: listStorage) {
|
| | | for (Long sid : listStorageID) {
|
| | | for (UserGoodsStorage torage : listStorage) {
|
| | | Long id = torage.getId();
|
| | | if (sid == id || sid.equals(id)) {
|
| | | listResult.add(torage);
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal totalMoney = new BigDecimal(0.00);
|
| | | List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
|
| | | |
| | |
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | | for (UserGoodsStorage userGoodsStorage: listResult) {
|
| | | for (UserGoodsStorage userGoodsStorage : listResult) {
|
| | | CommonGoods commonGoods = userGoodsStorage.getCommonGoods();
|
| | | TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(commonGoods);
|
| | | listGoodsBrief.add(goodsBrief);
|
| | | |
| | |
|
| | | BigDecimal money = TaoBaoUtil.getGoodsHongBaoMoney(goodsBrief, rate);
|
| | | totalMoney = MoneyBigDecimalUtil.add(totalMoney, money);
|
| | | }
|
| | | |
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorage(uid, listGoodsBrief, listStorageID);
|
| | |
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorage(uid, listGoodsBrief,
|
| | | listStorageID);
|
| | | FileUploadResult uploadResult = new FileUploadResult();
|
| | | uploadResult.setUrl(shareRecord.getSharePictureUrl());
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("revenue", listGoodsBrief.size() + "个商品预估分享奖金:¥"+totalMoney);
|
| | | data.put("revenue", listGoodsBrief.size() + "个商品预估分享奖金:¥" + totalMoney);
|
| | | data.put("shareId", shareRecord.getRedisKey());
|
| | | data.put("shareImg", uploadResult);
|
| | | data.put("notifyDesc", configService.get("goods_share_multiple_notify"));
|
| | | return data;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public JSONObject createShareV2(Long uid, List<Long> listStorageID) throws UserGoodsStorageException, UserShareGoodsRecordException {
|
| | | public JSONObject createShareV2(Long uid, List<Long> listStorageID, boolean needDrawPicture)
|
| | | throws UserGoodsStorageException, UserShareGoodsRecordException {
|
| | | List<UserGoodsStorage> listStorage = userGoodsStorageMapper.listQueryByIds(listStorageID);
|
| | | if (listStorage == null || listStorage.size() == 0) {
|
| | | throw new UserGoodsStorageException(1, "选品库商品不存在");
|
| | | }
|
| | | |
| | |
|
| | | List<UserGoodsStorage> listResult = new ArrayList<UserGoodsStorage>();
|
| | | // 还原顺序 用于制图
|
| | | for (Long sid: listStorageID) {
|
| | | for (UserGoodsStorage torage: listStorage) {
|
| | | for (Long sid : listStorageID) {
|
| | | for (UserGoodsStorage torage : listStorage) {
|
| | | Long id = torage.getId();
|
| | | if (sid == id || sid.equals(id)) {
|
| | | listResult.add(torage);
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal totalMoney = new BigDecimal(0.00);
|
| | | List<CommonGoods> listCommonGoods = new ArrayList<CommonGoods>();
|
| | | |
| | |
|
| | | Integer goodsType = null;
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | | for (UserGoodsStorage userGoodsStorage: listResult) {
|
| | | for (UserGoodsStorage userGoodsStorage : listResult) {
|
| | | CommonGoods commonGoods = userGoodsStorage.getCommonGoods();
|
| | | BigDecimal money = CommonGoodsUtil.getCommission(commonGoods, rate);
|
| | | totalMoney = MoneyBigDecimalUtil.add(totalMoney, money);
|
| | | listCommonGoods.add(commonGoods);
|
| | | |
| | |
|
| | | if (goodsType == null) {
|
| | | goodsType = commonGoods.getGoodsType();
|
| | | }
|
| | | }
|
| | | |
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorageV2(uid, listCommonGoods, listStorageID);
|
| | |
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorageV2(uid, listCommonGoods,
|
| | | listStorageID, needDrawPicture);
|
| | | FileUploadResult uploadResult = new FileUploadResult();
|
| | | uploadResult.setUrl(shareRecord.getSharePictureUrl());
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("revenue", listCommonGoods.size() + "个商品预估分享奖金:¥"+totalMoney);
|
| | | data.put("revenue", listCommonGoods.size() + "个商品预估分享奖金:¥" + totalMoney);
|
| | | data.put("shareId", shareRecord.getRedisKey());
|
| | | data.put("shareImg", uploadResult);
|
| | | |
| | |
|
| | | // 提示语不同
|
| | | if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | // 京东
|
| | |
| | | userInfo.setNickName(nickName);
|
| | | userInfoMapper.updateByPrimaryKeySelective(userInfo);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<UserInfo> getAutoExtractUser(int start, int count, BigDecimal minSurplus, String beganDate,String endDate) {
|
| | | public List<UserInfo> getAutoExtractUser(int start, int count, BigDecimal minSurplus, String beganDate,
|
| | | String endDate) {
|
| | | return userInfoMapper.getAutoExtractUser(start, count, minSurplus, beganDate, endDate);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<UserInfo> listByType(int type, int page, int count) {
|
| | | return userInfoMapper.listByType(type, (page - 1) * count, count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByType(int type) {
|
| | | return userInfoMapper.countByType(type);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserInfo> getAutoExtractUserTo1212(int start, int count) {
|
| | | return userInfoMapper.getAutoExtractUserTo1212(start, count);
|
| | |
| | |
|
| | | @Resource
|
| | | private UserGoodsStorageService userGoodsStorageService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public int insert(UserShareGoodsRecord record) {
|
| | |
| | | public long countQueryByUid(Long uid, String source) {
|
| | | return userShareGoodsRecordMapper.countQueryByUid(uid, source);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<UserShareGoodsGroup> listByRecordId(Long shareId) {
|
| | | return userShareGoodsGroupService.listByRecordId(shareId);
|
| | | return userShareGoodsGroupService.listByRecordId(shareId);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | String shareType = shareRecord.getShareType();
|
| | | if (StringUtil.isNullOrEmpty(shareType)) {
|
| | | shareRecord.setShareType(UserShareGoodsRecord.SHARETYPE_SINGLE);
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal totalMoney = shareRecord.getTotalMoney();
|
| | | if (totalMoney == null) {
|
| | | shareRecord.setTotalMoney(new BigDecimal(0));
|
| | |
| | | if (StringUtil.isNullOrEmpty(shareType)) {
|
| | | shareRecord.setShareType(UserShareGoodsRecord.SHARETYPE_SINGLE);
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal totalMoney = shareRecord.getTotalMoney();
|
| | | if (totalMoney == null) {
|
| | | shareRecord.setTotalMoney(new BigDecimal(0));
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void saveSingleShareRecord(Long uid, Long goodsId, Integer goodsType)
|
| | | throws UserShareGoodsRecordException {
|
| | | public void saveSingleShareRecord(Long uid, Long goodsId, Integer goodsType) throws UserShareGoodsRecordException {
|
| | | if (goodsId == null) {
|
| | | throw new UserShareGoodsRecordException(1, "分享商品不能为空");
|
| | | }
|
| | |
| | | /**
|
| | | * 生成分享图
|
| | | *
|
| | | * @param uid 用户id
|
| | | * @param shareId 分享记录id
|
| | | * @param source 来源
|
| | | * @param uid
|
| | | * 用户id
|
| | | * @param shareId
|
| | | * 分享记录id
|
| | | * @param source
|
| | | * 来源
|
| | | * @param listGoods
|
| | | * @return
|
| | | * @throws UserShareGoodsRecordException
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public ShareGoodsRecordDTO addRecordGoodsDetail(Long uid, Long auctionId, Integer goodsType, boolean isTaolijin) throws UserShareGoodsRecordException {
|
| | | public ShareGoodsRecordDTO addRecordGoodsDetail(Long uid, Long auctionId, Integer goodsType, boolean isTaolijin)
|
| | | throws UserShareGoodsRecordException {
|
| | | if (auctionId == null || uid == null || uid <= 0) {
|
| | | throw new UserShareGoodsRecordException(1, "传递参数不正确");
|
| | | }
|
| | |
| | | recordDTO.setSource(ShareSourceTypeEnum.goodsDetail);
|
| | |
|
| | | // 分享id
|
| | | String key = StringUtil.Md5(uid + "#GoodsDetail#" + auctionId + "#Type#"+ goodsType);
|
| | | String key = StringUtil.Md5(uid + "#GoodsDetail#" + auctionId + "#Type#" + goodsType);
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public ShareGoodsRecordDTO addRecordGoodsStorage(Long uid, List<TaoBaoGoodsBrief> listGoodsBrief, List<Long> listStorageID)
|
| | | throws UserShareGoodsRecordException {
|
| | | public ShareGoodsRecordDTO addRecordGoodsStorage(Long uid, List<TaoBaoGoodsBrief> listGoodsBrief,
|
| | | List<Long> listStorageID) throws UserShareGoodsRecordException {
|
| | | if (uid == null || uid <= 0 || listGoodsBrief == null || listGoodsBrief.size() == 0) {
|
| | | throw new UserShareGoodsRecordException(1, "传递参数不正确");
|
| | | }
|
| | |
| | | userShareGoodsRecordMapper.insertSelective(record);
|
| | |
|
| | | List<CommonGoods> listCommonGoods = new ArrayList<CommonGoods>();
|
| | | for (TaoBaoGoodsBrief goodsBrief: listGoodsBrief) {
|
| | | for (TaoBaoGoodsBrief goodsBrief : listGoodsBrief) {
|
| | | listCommonGoods.add(CommonGoodsFactory.create(goodsBrief));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | Long id = record.getId();
|
| | | // 分享链接
|
| | | String shareUrl = getShareUrl(record);
|
| | |
| | |
|
| | | return recordDTO;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public ShareGoodsRecordDTO addRecordGoodsStorageV2(Long uid, List<CommonGoods> listGoods, List<Long> listStorageID)
|
| | | throws UserShareGoodsRecordException {
|
| | | public ShareGoodsRecordDTO addRecordGoodsStorageV2(Long uid, List<CommonGoods> listGoods, List<Long> listStorageID,
|
| | | boolean needDrawPicture) throws UserShareGoodsRecordException {
|
| | | if (uid == null || uid <= 0 || listGoods == null || listGoods.size() == 0) {
|
| | | throw new UserShareGoodsRecordException(1, "传递参数不正确");
|
| | | }
|
| | |
| | | // 分享链接
|
| | | String shareUrl = getShareUrlV2(record);
|
| | | // 分享二维码链接
|
| | | FileUploadResult uploadResult = drawingSharePicture(uid, id, shareUrl, listGoods);
|
| | |
|
| | | ShareGoodsRecordDTO recordDTO = new ShareGoodsRecordDTO();
|
| | | recordDTO.setUid(uid);
|
| | |
| | | recordDTO.setShareUrl(shareUrl);
|
| | | recordDTO.setListId(listStorageID);
|
| | | recordDTO.setListGoods(listGoods);
|
| | | recordDTO.setSharePictureUrl(uploadResult.getUrl());
|
| | | if (needDrawPicture) {
|
| | | FileUploadResult uploadResult = drawingSharePicture(uid, id, shareUrl, listGoods);
|
| | | recordDTO.setSharePictureUrl(uploadResult.getUrl());
|
| | | }
|
| | | recordDTO.setSource(ShareSourceTypeEnum.storage);
|
| | |
|
| | | // 缓存分享商品信息
|
| | |
| | | userShareGoodsRecordMapper.insertSelective(record);
|
| | |
|
| | | List<CommonGoods> listCommonGoods = new ArrayList<CommonGoods>();
|
| | | for (TaoBaoGoodsBrief goodsBrief: listGoodsBrief) {
|
| | | for (TaoBaoGoodsBrief goodsBrief : listGoodsBrief) {
|
| | | listCommonGoods.add(CommonGoodsFactory.create(goodsBrief));
|
| | | }
|
| | | |
| | |
|
| | | Long id = record.getId();
|
| | | // 分享链接
|
| | | String shareUrl = getShareUrl(record);
|
| | |
| | | userShareGoodsRecordMapper.insertSelective(record);
|
| | |
|
| | | List<CommonGoods> listCommonGoods = new ArrayList<CommonGoods>();
|
| | | for (TaoBaoGoodsBrief goodsBrief: listGoodsBrief) {
|
| | | for (TaoBaoGoodsBrief goodsBrief : listGoodsBrief) {
|
| | | listCommonGoods.add(CommonGoodsFactory.create(goodsBrief));
|
| | | }
|
| | | |
| | |
|
| | | Long id = record.getId();
|
| | | // 分享链接
|
| | | String shareUrl = getShareUrl(record);
|
| | |
| | | ShareSourceTypeEnum source = recordDTO.getSource();
|
| | | if (ShareSourceTypeEnum.goodsDetail.equals(source)) {
|
| | | // 商品详情分享
|
| | | saveSingleShareRecord(recordDTO.getUid(), recordDTO.getAuctionId(),recordDTO.getGoodsType());
|
| | | saveSingleShareRecord(recordDTO.getUid(), recordDTO.getAuctionId(), recordDTO.getGoodsType());
|
| | | } else if (ShareSourceTypeEnum.activity.equals(source)) {
|
| | | // 动态分享
|
| | | UserShareGoodsRecord shareRecord = new UserShareGoodsRecord();
|
| | |
| | | updateByPrimaryKeySelective(shareRecord);
|
| | |
|
| | | List<CommonGoods> listGoods = recordDTO.getListGoods();
|
| | | if (listGoods != null && listGoods.size() > 1) |
| | | if (listGoods != null && listGoods.size() > 1)
|
| | | singleGoods = false;
|
| | | |
| | |
|
| | | // 保存商品信息
|
| | | multipleGoodsShareRecord(shareId, recordDTO.getListGoods());
|
| | |
|
| | | } else if (ShareSourceTypeEnum.storage.equals(source)) {
|
| | | // 分享库分享
|
| | | singleGoods = false;
|
| | | |
| | |
|
| | | UserShareGoodsRecord shareRecord = new UserShareGoodsRecord();
|
| | | shareRecord.setId(shareId);
|
| | | shareRecord.setShareState(1);
|
| | |
| | |
|
| | | // 保存商品信息
|
| | | multipleGoodsShareRecord(shareId, recordDTO.getListGoods());
|
| | | |
| | |
|
| | | // 更新选品库商品状态 为已分享
|
| | | List<Long> listId = recordDTO.getListId();
|
| | | if (listId != null && listId.size() > 0) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 清理缓存
|
| | | redisManager.removeCommonString(shareKey);
|
| | | |
| | |
|
| | | if (singleGoods) {
|
| | | if (taolijin) {
|
| | | integralGetService.addShareTLJGoods(uid);
|
| | |
| | | }
|
| | | return url;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 分享链接
|
| | | *
|
| | |
| | | Long uid = shareRecord.getUid();
|
| | | Long shareId = shareRecord.getId();
|
| | |
|
| | | String url = String.format("http://%s/share_mushGoods_1.6.0.html?uid=%s&shareId=%s",
|
| | | configService.getH5Host(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), shareId + "");
|
| | | String url = String.format("http://%s/share_mushGoods_1.6.0.html?uid=%s&shareId=%s", configService.getH5Host(),
|
| | | AESUtil.encrypt(uid + "", Constant.UIDAESKEY), shareId + "");
|
| | |
|
| | | String shortLink = HttpUtil.getShortLink(url);
|
| | | if (!StringUtil.isNullOrEmpty(shortLink)) {
|
| | |
| | | /**
|
| | | * 生成分享图
|
| | | *
|
| | | * @param uid 用户id
|
| | | * @param shareId 分享记录id
|
| | | * @param source 来源
|
| | | * @param uid
|
| | | * 用户id
|
| | | * @param shareId
|
| | | * 分享记录id
|
| | | * @param source
|
| | | * 来源
|
| | | * @param listGoods
|
| | | * @return
|
| | | * @throws UserShareGoodsRecordException
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.integral.CodePublishRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.integral.CodePublishRecord;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.CodePublishRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private CodePublishRecordMapper codePublishRecordMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Override
|
| | | public CodePublishRecord selectByPrimaryKey(Long id) {
|
| | | return codePublishRecordMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void publishInviteCode(Long uid) {
|
| | | CodePublishRecord codePublishRecord = new CodePublishRecord();
|
| | |
| | | codePublishRecord.setCreateTime(new Date());
|
| | | codePublishRecordMapper.insertSelective(codePublishRecord);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countValidRecord(Long uid){
|
| | | public long countValidRecord(Long uid) {
|
| | | return codePublishRecordMapper.countValidRecord(uid, CodePublishRecord.VALIDTIME);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<CodePublishRecord> listValid(long start, int count) {
|
| | | |
| | | List<CodePublishRecord> listValid = codePublishRecordMapper.listValid(start, count, CodePublishRecord.VALIDTIME);
|
| | |
|
| | | List<CodePublishRecord> listValid = codePublishRecordMapper.listValid(start, count,
|
| | | CodePublishRecord.VALIDTIME);
|
| | | if (listValid == null || listValid.size() == 0) {
|
| | | return listValid;
|
| | | }
|
| | | |
| | | for (int i = 0; i < listValid.size(); i ++) {
|
| | |
|
| | | for (int i = 0; i < listValid.size(); i++) {
|
| | | CodePublishRecord codePublishRecord = listValid.get(i);
|
| | | String inviteCode = codePublishRecord.getInviteCode();
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | |
| | | i--;
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | String index = inviteCode.substring(0, 1);
|
| | | String end = inviteCode.substring(inviteCode.length()-1, inviteCode.length());
|
| | | String end = inviteCode.substring(inviteCode.length() - 1, inviteCode.length());
|
| | | codePublishRecord.setInviteCode("TA的邀请码:" + index + "****" + end);
|
| | | |
| | |
|
| | | String nickName = codePublishRecord.getNickName();
|
| | | if(StringUtil.isNullOrEmpty(nickName)) {
|
| | | if (StringUtil.isNullOrEmpty(nickName)) {
|
| | | nickName = "K****6";
|
| | | } else if (nickName.length() == 1) {
|
| | | // 一个字
|
| | |
| | | } else {
|
| | | // 两个字及其以上
|
| | | String index2 = nickName.substring(0, 1);
|
| | | String end2 = nickName.substring(nickName.length()-1, nickName.length());
|
| | | String end2 = nickName.substring(nickName.length() - 1, nickName.length());
|
| | | nickName = index2 + "****" + end2;
|
| | | }
|
| | | codePublishRecord.setNickName(nickName);
|
| | | |
| | |
|
| | | UserInfo user = userInfoService.selectByPKey(codePublishRecord.getUid());
|
| | |
|
| | | long firstTeam = threeSaleSerivce.countFirstTeam(codePublishRecord.getUid(), 1);
|
| | | long secondTeam = threeSaleSerivce.countSecondTeam(codePublishRecord.getUid(), 1);
|
| | | codePublishRecord.setTeam(firstTeam + secondTeam);
|
| | | if (user != null && user.getType() == 1) {// 假用户
|
| | | long s = Integer
|
| | | .parseInt((206 * (6365705L - codePublishRecord.getUid()) / (6365705L - 6315822L) + 82) + "");
|
| | | codePublishRecord.setTeam(s + codePublishRecord.getTeam());
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | return listValid;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CodePublishRecord> listByMinTime(long start, int count, Date minTime) {
|
| | | return codePublishRecordMapper.listByMinTime(start, count, minTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countValid() {
|
| | | return codePublishRecordMapper.countValid(CodePublishRecord.VALIDTIME);
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
| | | * 创建分享
|
| | | * @param uid
|
| | | * @param listStorageID
|
| | | * @param needDrawPicture是否需要绘图
|
| | | * @return
|
| | | * @throws UserGoodsStorageException
|
| | | * @throws UserShareGoodsRecordException
|
| | | */
|
| | | public JSONObject createShareV2(Long uid, List<Long> listStorageID)
|
| | | public JSONObject createShareV2(Long uid, List<Long> listStorageID,boolean needDrawPicture)
|
| | | throws UserGoodsStorageException, UserShareGoodsRecordException;
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void saveUserInfo(String nickName, Long uid) throws UserInfoException;
|
| | |
|
| | | |
| | | /**
|
| | | * 获取可提现用户列表
|
| | | * |
| | | * @param page
|
| | | * @param count
|
| | | */
|
| | | public List<UserInfo> getAutoExtractUser(int page, int count, BigDecimal minSurplus, String beganDate,String endDate);
|
| | | public List<UserInfo> getAutoExtractUser(int page, int count, BigDecimal minSurplus, String beganDate,
|
| | | String endDate);
|
| | |
|
| | | /**
|
| | | * 根据类型获取
|
| | | * |
| | | * @param type
|
| | | * @param page
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<UserInfo> listByType(int type, int page, int count);
|
| | |
|
| | | /**
|
| | | * 根据类型计数
|
| | | * |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public long countByType(int type);
|
| | |
|
| | | /**
|
| | | * 双12预售开启时,开启对休眠老用户的唤醒工作,在2019.1.1到2019.6.18期间产生过订单,并且2019.6.18号后未再活跃,并且账户余额大于1元,并且绑定了微信的用户有2468人
|
| | |
| | | public List<UserShareGoodsGroup> listByRecordId(Long shareId);
|
| | |
|
| | | public ShareGoodsRecordDTO addRecordGoodsStorageV2(Long uid, List<CommonGoods> listCommonGoods,
|
| | | List<Long> listStorageID) throws UserShareGoodsRecordException;
|
| | | List<Long> listStorageID,boolean needDrawPicture) throws UserShareGoodsRecordException;
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.user.integral;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.integral.CodePublishRecord;
|
| | |
| | |
|
| | | /**
|
| | | * 查询近3天发布记录
|
| | | * |
| | | * @return
|
| | | */
|
| | | public List<CodePublishRecord> listValid(long start, int count);
|
| | | |
| | | |
| | | public long countValid();
|
| | |
|
| | | /**
|
| | | * 根据最小时间查询
|
| | | * |
| | | * @param start
|
| | | * @param count
|
| | | * @param minTime
|
| | | * @return
|
| | | */
|
| | | public List<CodePublishRecord> listByMinTime(long start, int count, Date minTime);
|
| | |
|
| | | public long countValid();
|
| | |
|
| | | public CodePublishRecord selectByPrimaryKey(Long id);
|
| | |
|
| | |
|
| | | /**
|
| | | * 发布
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public void publishInviteCode(Long uid);
|
| | |
|
| | |
|
| | | public long countValidRecord(Long uid);
|
| | | }
|
| | |
| | | } else {
|
| | | cg.setCouponAmount(new BigDecimal(0));
|
| | | }
|
| | | cg.setCouponLeftCount(1);
|
| | | cg.setCouponTotalCount(1);
|
| | | }
|
| | |
|
| | | JDCommissionInfo commissionInfo = goods.getCommissionInfo();
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public static String convertLink(String materialId, String couponUrl, String positionId, String ext1) {
|
| | | public static String convertLink1(String materialId, String couponUrl, String positionId, String ext1) {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("materialId", materialId);
|
| | | json.put("siteId", APP_ID);
|
| | |
| | | return resultJson.optJSONObject("data").optString("clickURL");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 转链接-短连接
|
| | | * |
| | | * @param materialId
|
| | | * @param couponUrl
|
| | | * @param positionId
|
| | | * @param ext1
|
| | | * @return
|
| | | */
|
| | | public static String convertShortLink(String materialId, String couponUrl, String positionId, String ext1) {
|
| | | String url = convertLink(materialId, couponUrl, positionId, ext1);
|
| | | // 暂时注释
|
| | | // if (!StringUtil.isNullOrEmpty(url)) {
|
| | | // url = HttpUtil.getShortLink(url);
|
| | | // }
|
| | | return url;
|
| | | public static String convertLinkWithSubUnionId(String materialId, String couponUrl, String positionId,
|
| | | String subUnionId) {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("materialId", materialId);
|
| | | json.put("siteId", APP_ID);
|
| | | json.put("positionId", positionId);
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(couponUrl))
|
| | | json.put("couponUrl", couponUrl);
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(subUnionId))
|
| | | json.put("subUnionId", subUnionId);
|
| | | |
| | | //1:长链, 2 :短链 ,3: 长链+短链
|
| | | json.put("chainType", 3);
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("promotionCodeReq", json);
|
| | |
|
| | | String result = baseRequest2("jd.union.open.promotion.bysubunionid.get", null, root);
|
| | |
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | result = resultJson.optJSONObject("jd_union_open_promotion_bysubunionid_get_response").optString("result");
|
| | | System.out.println(result);
|
| | | if (result == null) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | resultJson = JSONObject.fromObject(result);
|
| | | return resultJson.optJSONObject("data").optString("shortURL");
|
| | | }
|
| | |
|
| | |
|
| | | public static JDGoods queryGoodsDetail(Long skuId) {
|
| | | List<Long> skuIdList = new ArrayList<>();
|
| | |
| | | }
|
| | | };
|
| | | Collections.sort(couponInfoList, cm);
|
| | | // if (couponInfoList.size() > 0) {
|
| | | // // 设置券信息为最接近的一个
|
| | | // for (int i = couponInfoList.size() - 1; i >= 0; i--) {
|
| | | // if (couponInfoList.get(i).getQuota().compareTo(goods.getPrice()) <= 0) {
|
| | | // goods.setCouponInfo(couponInfoList.get(i));
|
| | | // break;
|
| | | // }
|
| | | // }
|
| | | // if (goods.getCouponInfo() == null)
|
| | | // goods.setCouponInfo(couponInfoList.get(0));
|
| | | // }
|
| | | // |
| | | // if (couponInfoList.size() > 0) {
|
| | | // // 设置券信息为最接近的一个
|
| | | // for (int i = couponInfoList.size() - 1; i >= 0; i--) {
|
| | | // if
|
| | | // (couponInfoList.get(i).getQuota().compareTo(goods.getPrice())
|
| | | // <= 0) {
|
| | | // goods.setCouponInfo(couponInfoList.get(i));
|
| | | // break;
|
| | | // }
|
| | | // }
|
| | | // if (goods.getCouponInfo() == null)
|
| | | // goods.setCouponInfo(couponInfoList.get(0));
|
| | | // }
|
| | | //
|
| | | goods.setCouponInfoList(couponInfoList);
|
| | |
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static void test() {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("materialId", "https://item.jd.com/32376790478.html");
|
| | | json.put("ext1", "437032");
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("promotionCodeReq", json);
|
| | | String result = baseRequest2("jd.union.open.promotion.bysubunionid.get", null, root);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return new PDDGoodsResult(totalCount, goodsList);
|
| | | }
|
| | |
|
| | | public static List<PDDGoodsDetail> listGoodsDetail(List<Long> goodsIds) {
|
| | | PDDSearchFilter filter = new PDDSearchFilter();
|
| | | Long[] ids = new Long[goodsIds.size()];
|
| | | goodsIds.toArray(ids);
|
| | | filter.setGoodsIdList(ids);
|
| | | PDDGoodsResult result = searchGoods(filter);
|
| | | if (result != null)
|
| | | return result.getGoodsList();
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 运营频道商品查询API
|
| | | *
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取商品详情
|
| | | *
|
| | | * @param goodsId
|
| | | */
|
| | | public static PDDShopResult getShopList(Integer page,Long catId) {
|
| | | public static PDDShopResult getShopList(Integer page, Long catId) {
|
| | | JSONArray arrayType = new JSONArray();
|
| | | arrayType.add(3);
|
| | | |
| | |
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.merchant.list.get");
|
| | | if (catId != null)
|
| | | map.put("cat_id", catId +"");
|
| | | map.put("cat_id", catId + "");
|
| | | if (page != null)
|
| | | map.put("page_number", page +"");
|
| | | |
| | | map.put("page_number", page + "");
|
| | |
|
| | | if (page != null)
|
| | | map.put("page_number", page +"");
|
| | | |
| | | map.put("page_number", page + "");
|
| | |
|
| | | map.put("merchant_type_list", arrayType.toString());
|
| | | |
| | |
|
| | | String result = baseRequest(map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | JSONObject root = resultJson.optJSONObject("merchant_list_response");
|
| | | if (root != null) {
|
| | | int totalCount = root.optInt("total");
|
| | | |
| | |
|
| | | JSONArray array = root.optJSONArray("mall_search_info_vo_list");
|
| | | Type type = new TypeToken<List<PDDShopDetail>>() {}.getType();
|
| | | Type type = new TypeToken<List<PDDShopDetail>>() {
|
| | | }.getType();
|
| | | List<PDDShopDetail> listShop = new Gson().fromJson(array.toString(), type);
|
| | | return new PDDShopResult(totalCount, listShop);
|
| | | }
|
| | |
| | |
|
| | | @Expose
|
| | | private String wxErCode;// 微信二维码内容
|
| | | |
| | | @Expose
|
| | | private GoodsDetailVO goodsInfo;
|
| | |
|
| | | public GoodsDetailVO getGoodsInfo() {
|
| | | return goodsInfo;
|
| | | }
|
| | |
|
| | | public void setGoodsInfo(GoodsDetailVO goodsInfo) {
|
| | | this.goodsInfo = goodsInfo;
|
| | | }
|
| | |
|
| | | public List<String> getCommentTexts() {
|
| | | return commentTexts;
|
| | |
| | | mongo.dbname=flq
|
| | | mongo.port=27017
|
| | | mongo.port=27016
|
| | | #开发环境
|
| | | mongo.host=192.168.1.253
|
| | | mongo.username=admin
|
| | | mongo.password=123456
|
| | | #mongo.host=192.168.1.253
|
| | | #mongo.username=admin
|
| | | #mongo.password=123456
|
| | |
|
| | | #mongo.host=193.112.35.168
|
| | | #mongo.username=yeshi
|
| | | #mongo.password=Yeshi2016@
|
| | | mongo.host=193.112.35.168
|
| | | mongo.username=yeshi
|
| | | mongo.password=Yeshi2016@
|
| | |
|
| | | mongo.connectionsPerHost=8
|
| | | mongo.threadsAllowedToBlockForConnectionMultiplier=4
|
| | |
| | | redis.addr=193.112.34.40
|
| | | redis.addr=192.168.1.253
|
| | | redis.port=6379 |
| | | redis.auth=123456
|
| | | redis.max_total=1024 |
| | |
| | | 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_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80 |
| | | |
| | | |
| | |
| | | <beans xmlns="http://www.springframework.org/schema/beans"
|
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <!-- |
| | | <import resource="classpath:/rocket/consumer.xml" />
|
| | | <import resource="classpath:/rocket/system-coupon-consumer.xml"/>
|
| | | -->
|
| | | <import resource="classpath:/rocket/producer.xml" />
|
| | | <import resource="classpath:/rocket/transactionProducer.xml" />
|
| | | </beans> |
| | |
| | | public static int count = 0;
|
| | |
|
| | | @Test
|
| | | public void test1() { |
| | | // List<TaoBaoGoodsBrief> list= TaoKeApiUtil.guessLikeByAuctionId(550439753563L,6);
|
| | | // System.out.println(list);
|
| | | TaoBaoUtil.getTBDetailImageWithSize(597016140493L);
|
| | | // System.out.println(goods);
|
| | | // DaTaoKeApiUtil.getGoodsDetailByGoodsId(558195316187L); |
| | | public void test1() {
|
| | | // List<TaoBaoGoodsBrief> list=
|
| | | // TaoKeApiUtil.guessLikeByAuctionId(550439753563L,6);
|
| | | // System.out.println(list);
|
| | | // TaoBaoUtil.getTBDetailImageWithSize(597016140493L);
|
| | | // System.out.println(goods);
|
| | | // DaTaoKeApiUtil.getGoodsDetailByGoodsId(558195316187L);
|
| | | try {
|
| | | TaoKeApiUtil.specialConvertCoupon(608512721647L, new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET, TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT));
|
| | | } catch (Exception e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Test
|