| | |
| | | import com.yeshi.fanli.dto.vip.VIPSearchResult;
|
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.bus.help.AppPageNotification;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | |
| | | import com.yeshi.fanli.vo.recommend.RecommendJumpInfoVO;
|
| | | import com.yeshi.fanli.vo.search.GoodsDocParseResultVO;
|
| | |
|
| | | import net.sf.json.JSON;
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | acceptData.getPlatform(),
|
| | | acceptData.getVersion()))));
|
| | | // 跳转详情
|
| | | if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(),
|
| | | if (VersionUtil.greaterThan_2_1_3(acceptData.getPlatform(),
|
| | | acceptData.getVersion())) {
|
| | | buildGoodsClick(data, goods, acceptData, gson);
|
| | | }
|
| | |
| | | orderHongBaoMoneyComputeService.getShowComputeRate(
|
| | | acceptData.getPlatform(),
|
| | | acceptData.getVersion()))));
|
| | | // if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(),
|
| | | // acceptData.getVersion())) {
|
| | | // buildGoodsClick(data, goods, acceptData, gson);
|
| | | // }
|
| | | // if
|
| | | // (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(),
|
| | | // acceptData.getVersion())) {
|
| | | // buildGoodsClick(data, goods, acceptData,
|
| | | // gson);
|
| | | // }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
| | | JSONObject params = new JSONObject();
|
| | | params.put("id", goods.getGoodsId() + "");
|
| | | params.put("from", "猜你喜欢");
|
| | | |
| | | String type="";
|
| | | switch(goods.getGoodsType()){
|
| | |
|
| | | String type = "";
|
| | | switch (goods.getGoodsType()) {
|
| | | case Constant.SOURCE_TYPE_TAOBAO:
|
| | | type="goodsdetail";
|
| | | type = "goodsdetail";
|
| | | break;
|
| | | case Constant.SOURCE_TYPE_JD:
|
| | | type="goodsdetail_jd";
|
| | | type = "goodsdetail_jd";
|
| | | break;
|
| | | case Constant.SOURCE_TYPE_PDD:
|
| | | type="goodsdetail_pdd";
|
| | | type = "goodsdetail_pdd";
|
| | | break;
|
| | | case Constant.SOURCE_TYPE_VIP:
|
| | | type="goodsdetail_vip";
|
| | | type = "goodsdetail_vip";
|
| | | break;
|
| | | case Constant.SOURCE_TYPE_SUNING:
|
| | | type="goodsdetail_suning";
|
| | | type = "goodsdetail_suning";
|
| | | break;
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | RecommendJumpInfoVO left = new RecommendJumpInfoVO(
|
| | | "去看看", jumpDetailV2Service.getByTypeCache(type,
|
| | | Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())),
|
| | | params);
|
| | | data.put("left", gson.toJson(left));
|
| | | |
| | | // 去网页
|
| | | params = new JSONObject();
|
| | | params.put("url", "http://www.baidu.com");
|
| | |
|
| | | RecommendJumpInfoVO right = new RecommendJumpInfoVO("有更高返利?", jumpDetailV2Service.getByTypeCache("web",
|
| | | RecommendJumpInfoVO left = new RecommendJumpInfoVO("去看看", jumpDetailV2Service.getByTypeCache(type,
|
| | | Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())), params);
|
| | | data.put("right", gson.toJson(right));
|
| | | data.put("left", gson.toJson(left));
|
| | |
|
| | | // 去网页
|
| | | String rightValue = configService.getByVersion(ConfigKeyEnum.clipboardRecommendGoodsMakeMore.name(),
|
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(rightValue)) {
|
| | | data.remove("left");
|
| | | } else {
|
| | | params = new JSONObject();
|
| | | params.put("url", "http://www.baidu.com");
|
| | |
|
| | | RecommendJumpInfoVO right = new RecommendJumpInfoVO("有更高返利?", jumpDetailV2Service.getByTypeCache("web",
|
| | | Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())),
|
| | | params);
|
| | | data.put("right", gson.toJson(right));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | |
| | | cloudAlipayJumpLink("cloud_alipay_jump_link","云发单支付跳转地址"), |
| | | cloudAlipayReturnLink("cloud_alipay_return_link","云发单支付成功后返回哪个前端页面"), |
| | | cloudAlipayNotifyLink("cloud_alipay_notify_link","云发单支付成功后回调地址"); |
| | | cloudAlipayNotifyLink("cloud_alipay_notify_link","云发单支付成功后回调地址"), |
| | | |
| | | clipboardRecommendGoodsMakeMore("clipboard_recommend_goods_make_more_link","根据粘贴板推荐商品赚更多链接") |
| | | ; |
| | | |
| | | |
| | | |
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | 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.xxl.job.core.biz.model.ReturnT;
|
| | | import com.xxl.job.core.handler.annotation.XxlJob;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.dto.jd.JDCommissionInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDFilter;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | |
| | | @Resource
|
| | | private PinDuoDuoCacheUtil pinDuoDuoCacheUtil;
|
| | |
|
| | | @Scheduled(cron = "0 5 0/1 * * ? ")
|
| | | public void addFreeGoods() {
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @XxlJob("freeGoodsCouponJob-addFreeGoods")
|
| | | public ReturnT<String> startPreOrderTeamIncome(String param) throws Exception {
|
| | | updateGoodsTB();
|
| | | |
| | | updateGoodsPDD();
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 更新淘宝商品-免单
|
| | | */
|
| | |
| | | listdel.add(freeGood);
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | // 比例限制: 金比高于60%
|
| | | if (itemDetail.getTkrates() == null || itemDetail.getTkrates() < 60) {
|
| | | listdel.add(freeGood);
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief tbGoods = TaoBaoGoodsFactory.create(itemDetail);
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(tbGoods, params);
|
| | | if (detailVO.getCouponPrice() == null) {
|
| | | if (detailVO.getCouponPrice() != null) {
|
| | | if (detailVO.getCouponPrice().compareTo(limitPrice) > 0)
|
| | | continue;
|
| | | } else if (detailVO.getZkPrice().compareTo(limitPrice) > 0) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | boolean saveResult = freeGoodsCouponService.saveFreeGoods(detailVO);
|
| | | if (saveResult) {
|
| | | listNew.add(detailVO);
|
| | |
| | | // 比例限制: 金比高于60%
|
| | | if (goods.getTkrates() == null || goods.getTkrates() < 60)
|
| | | continue;
|
| | | |
| | |
|
| | | boolean exist = false;
|
| | | if (listNew.size() > 0) {
|
| | | for (GoodsDetailVO goodsDetailVO : listNew) {
|
| | |
| | | listdel.add(freeGood);
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | // 比例限制: 金比高于60%
|
| | | JDCommissionInfo commissionInfo = goodsInfo.getCommissionInfo();
|
| | | if (commissionInfo == null) {
|
| | |
| | | }
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertJDGoods(goodsInfo, params);
|
| | | |
| | | if (detailVO.getCouponPrice() == null) {
|
| | |
|
| | | if (detailVO.getCouponPrice() != null) {
|
| | | if (detailVO.getCouponPrice().compareTo(limitPrice) > 0)
|
| | | continue;
|
| | | } else if (detailVO.getZkPrice().compareTo(limitPrice) > 0) {
|
| | | continue;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | boolean saveResult = freeGoodsCouponService.saveFreeGoods(detailVO);
|
| | | if (saveResult) {
|
| | | listNew.add(detailVO);
|
| | |
| | | listdel.add(freeGood);
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | // 比例限制: 金比高于60%
|
| | | BigDecimal promotionRate = new BigDecimal(goodsInfo.getPromotionRate());
|
| | | BigDecimal promotionRate = new BigDecimal(goodsInfo.getPromotionRate());
|
| | | if (promotionRate.compareTo(BigDecimal.valueOf(600)) < 0)
|
| | | continue;
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertPDDGoods(goodsInfo, params);
|
| | | if (detailVO.getCouponPrice() == null) {
|
| | | if (detailVO.getCouponPrice() != null) {
|
| | | if (detailVO.getCouponPrice().compareTo(limitPrice) > 0)
|
| | | continue;
|
| | | } else if (detailVO.getZkPrice().compareTo(limitPrice) > 0) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | boolean saveResult = freeGoodsCouponService.saveFreeGoods(detailVO);
|
| | | if (saveResult) {
|
| | | listNew.add(detailVO);
|
| | |
| | | // 不足补齐
|
| | | if (listNew.size() < maxNum) {
|
| | | // 筛选范围列表
|
| | | List<PDDSearchRange> rangeList = new ArrayList<>(); |
| | | List<PDDSearchRange> rangeList = new ArrayList<>();
|
| | | // 券后价小于2元
|
| | | rangeList.add(new PDDSearchRange(0L,0, 200L)); |
| | | rangeList.add(new PDDSearchRange(0L, 0, 200L));
|
| | | // 比例60%以上
|
| | | rangeList.add(new PDDSearchRange(600L, 2, 1000L));
|
| | | |
| | |
|
| | | PDDSearchFilter pddfilter = new PDDSearchFilter();
|
| | | pddfilter.setRangeList(rangeList);
|
| | | for (int page = 1; page < 1000; page++) {
|
| | |
| | | boolean exist = false;
|
| | | if (listNew.size() > 0) {
|
| | | for (GoodsDetailVO goodsDetailVO : listNew) {
|
| | | if (goodsDetailVO.getGoodsId().equalsIgnoreCase(goods.getGoodsId()+ "")) {
|
| | | if (goodsDetailVO.getGoodsId().equalsIgnoreCase(goods.getGoodsId() + "")) {
|
| | | exist = true;
|
| | | break;
|
| | | }
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.xxl.job.core.biz.model.ReturnT;
|
| | | import com.xxl.job.core.handler.annotation.XxlJob;
|
| | | import com.yeshi.fanli.dto.taobao.haodanku.HDKGoodsListResultDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRankings;
|
| | | import com.yeshi.fanli.entity.goods.PullNewGoods;
|
| | | import com.yeshi.fanli.entity.taobao.haodanku.HDKGoodsDetail;
|
| | | import com.yeshi.fanli.service.inter.goods.PullNewGoodsService;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankingsService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.taobao.HaoDanKuApiUtil;
|
| | |
|
| | | @Component
|
| | |
| | |
|
| | | @Resource
|
| | | private PullNewGoodsService pullNewGoodsService;
|
| | | |
| | | |
| | | @XxlJob("pullNewJob-addPullNewGoods")
|
| | | public ReturnT<String> addPullNewGoods(String param) throws Exception {
|
| | | addPullNewGoods();
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | | |
| | | |
| | | @XxlJob("pullNewJob-updateReward")
|
| | | public ReturnT<String> updateReward(String param) throws Exception {
|
| | | updateReward();
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 拉新商品
|
| | | */
|
| | | @Scheduled(cron = "0 30 1 * * ? ")
|
| | | private void addPullNewGoods() {
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | | |
| | | Integer array[] = {1,2,3,4,5,6,7,8,9,10,11,12,15};
|
| | | for (Integer catId: array) {
|
| | | Integer minId = 1;
|
| | |
| | |
|
| | |
|
| | | // 每天00点10执行 : 更改排行榜上的奖金
|
| | | @Scheduled(cron = "0 15 0 * * ? ")
|
| | | public void updateReward() {
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 更新人数
|
| | | int showNum = 15;
|
| | |
| | | if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO) {
|
| | | if (mianDan) {
|
| | | try {
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo(),commonOrder.getSourceType());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | throw new HongBaoException(12, "免单券退款出错");
|
| | |
| | | if (goods != null) {
|
| | | try {
|
| | | if (userSystemCouponService.updateCouponRecordUsed(commonOrder.getUserInfo().getId(),
|
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId())))
|
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId()),commonOrder.getSourceType()))
|
| | | mianDanMoney = payMent;
|
| | | } catch (NumberFormatException e) {
|
| | | throw new HongBaoException(10, "免单商品处理出错");
|
| | |
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {// 设置免单券失效
|
| | | commonOrder.setPayment(new BigDecimal(0));// 订单失效后的付款金额设置为0
|
| | | try {
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo(),commonOrder.getSourceType());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | }
|
| | | // 通知免单到账
|
| | | try {
|
| | | userSystemCouponService.updateStateByArrivalAccount(orderId);
|
| | | userSystemCouponService.updateStateByArrivalAccount(orderId,sourceType);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | hongBao.setMoney(new BigDecimal(0));
|
| | | if (mianDan) {
|
| | | try {
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo(),commonOrder.getSourceType());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | throw new HongBaoException(12, "免单券退款出错");
|
| | |
| | |
|
| | | try {
|
| | | if (userSystemCouponService.updateCouponRecordUsed(commonOrder.getUserInfo().getId(),
|
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId())))
|
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId()),commonOrder.getSourceType()))
|
| | | mianDanMoney = payMent;
|
| | | } catch (NumberFormatException e) {
|
| | | throw new HongBaoException(10, "免单商品处理出错");
|
| | |
| | | }
|
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {// 设置免单券失效
|
| | | try {
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo(),commonOrder.getSourceType());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | BigDecimal money = orderHongBaoMoneyComputeService.computeFanliMoney(commonOrder, buyerLevel);
|
| | | // 免单处理
|
| | | boolean mianDan = false;
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(commonOrder.getSourceType(),
|
| | | commonOrder.getOrderNo());
|
| | | if (orderList != null && orderList.size() == 1) {// 只有1个订单才参与免单
|
| | | BigDecimal payMent = commonOrder.getPayment();
|
| | |
| | | if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO) {
|
| | | if (mianDan) {
|
| | | try {
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo(),commonOrder.getSourceType());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | throw new HongBaoException(12, "免单券退款出错");
|
| | |
| | | if (goods != null) {
|
| | | try {
|
| | | if (userSystemCouponService.updateCouponRecordUsed(commonOrder.getUserInfo().getId(),
|
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId())))
|
| | | commonOrder.getOrderNo(), payMent, Long.parseLong(goods.getGoodsId()),commonOrder.getSourceType()))
|
| | | mianDanMoney = payMent;
|
| | | } catch (NumberFormatException e) {
|
| | | throw new HongBaoException(10, "免单商品处理出错");
|
| | |
| | | } else if (commonOrder.getState() == CommonOrder.STATE_SX) {// 设置免单券失效
|
| | | commonOrder.setPayment(new BigDecimal(0));// 订单失效后的付款金额设置为0
|
| | | try {
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo());
|
| | | userSystemCouponService.updateStateByDrawback(commonOrder.getOrderNo(),commonOrder.getSourceType());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|