Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserMoneyDebtService userMoneyDebtService;
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponRecordService userSystemCouponRecordService;
|
| | |
|
| | | /**
|
| | | * 统计历史订单-淘宝订单
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getUserOrderList")
|
| | | public void getUserOrderList(String callback, Integer pageIndex, Integer pageSize, Integer keyType, |
| | | String key, Integer state, Integer type, Integer orderState, String startTime, String endTime,
|
| | | Integer sourceType, PrintWriter out) {
|
| | | public void getUserOrderList(String callback, Integer pageIndex, Integer pageSize, Integer keyType, String key,
|
| | | Integer state, Integer type, Integer orderState, String startTime, String endTime, Integer sourceType,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | |
| | | List<CommonOrderVO> list = commonOrderService.listQuery((pageIndex - 1) * pageSize, pageSize, keyType, key,
|
| | | state, type, orderState, startTime, endTime, sourceType);
|
| | |
|
| | | // 统计总数
|
| | | long count = commonOrderService.countQuery(keyType, key, state, type, orderState, startTime, endTime, sourceType);
|
| | | // 统计总数
|
| | | long count = commonOrderService.countQuery(keyType, key, state, type, orderState, startTime, endTime,
|
| | | sourceType);
|
| | |
|
| | | // 查询是否维权
|
| | | for (CommonOrderVO order : list) {
|
| | |
| | | UserMoneyDebtTypeEnum.order, hongBaoOrder.getHongBaoV2().getId());
|
| | | if (debt != null && debt.getLeftMoney().compareTo(new BigDecimal(0)) > 0) {
|
| | | order.setWeiQuanBackMoney(
|
| | | new BigDecimal(0).subtract(debt.getLeftMoney()).toString());//未扣除
|
| | | new BigDecimal(0).subtract(debt.getLeftMoney()).toString());// 未扣除
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getTrackAccuracyRate")
|
| | | public void getTrackAccuracyRate(String callback, Integer dateType, String year, String startTime, String endTime,int sourceType,
|
| | | PrintWriter out) {
|
| | | public void getTrackAccuracyRate(String callback, Integer dateType, String year, String startTime, String endTime,
|
| | | int sourceType, PrintWriter out) {
|
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | |
| | | JSONArray line_list = new JSONArray();
|
| | |
|
| | | List<Map<String, Object>> list = commonOrderCountService.getTrackAccuracyRate(dateType, year, startTime,
|
| | | endTime,sourceType);
|
| | | endTime, sourceType);
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "总计");
|
| | |
| | | // 统计商品数量
|
| | | long totalgoods = 0;
|
| | | // 商品id
|
| | | Long auctionId = null;
|
| | | CommonGoods commonGoods = null;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(picture)) {
|
| | | try {
|
| | | List<PushGoodsGroup> listGroup = pushGoodsGroupService.getAllInfoByPushId(pushId);
|
| | |
| | |
|
| | | PushGoodsGroup pushGoodsGroup = listGroup.get(0);
|
| | | if (pushGoodsGroup != null) {
|
| | | CommonGoods commonGoods = pushGoodsGroup.getCommonGoods();
|
| | | commonGoods = pushGoodsGroup.getCommonGoods();
|
| | | if (commonGoods != null) {
|
| | | picture = commonGoods.getPicture();
|
| | | auctionId = commonGoods.getGoodsId();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | JumpDetailV2 jumpDetail = null;
|
| | | if (totalgoods == 1) {
|
| | |
|
| | | params = JumpDetailParamsFactory.createGoodsParams(auctionId);
|
| | | params = JumpDetailParamsFactory.createGoodsParams(commonGoods.getGoodsId(),
|
| | | commonGoods.getGoodsType());
|
| | | // 单个商品跳转商品详情
|
| | | jumpDetail = jumpDetailV2Service.getByTypeCache("goodsdetail",
|
| | | Constant.getPlatformCode(acceptData.getPlatform()),
|
| | |
| | | import com.yeshi.fanli.service.inter.brand.TaoBaoShopHistoryService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private DaTaoKeGoodsService daTaoKeGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | /**
|
| | | * 店铺列表
|
| | | *
|
| | |
| | | * 店铺足迹
|
| | | *
|
| | | * @param acceptData
|
| | | * @param type 精选1, 足迹列表2
|
| | | * @param type
|
| | | * 精选1, 足迹列表2
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHistory", method = RequestMethod.POST)
|
| | |
| | | data.put("count", array.size());
|
| | | data.put("list", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | // 添加到更新列表
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(listGoodsBrief);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | data.put("baichuan", false);// 不需要采用阿里百川的方式加载webview
|
| | |
|
| | | } else if (url != null && ((url.contains("yangkeduo.com") && !url.contains("yangkeduo.com/goods.html?"))
|
| | | } else if (url != null && ((url.contains("yangkeduo.com") && !url.contains("yangkeduo.com/goods.html?")
|
| | | && !url.contains("yangkeduo.com/duo_coupon_landing.html?"))
|
| | | || (url.startsWith("https://p.pinduoduo.com/")))) {
|
| | | data.put("baichuan", false);// 不需要采用阿里百川的方式加载webview
|
| | | data.put("goodsDetail", true);// 不需要拦截商品详情
|
| | |
| | |
|
| | | List<TaoBaoGoodsBrief> updateGoodsList = new ArrayList<>();
|
| | |
|
| | | // 精选库数据为空时,网络进行查询
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | // 精选库数据小于10时,网络进行查询
|
| | | if (listQuery == null || listQuery.size() < 10) {
|
| | | long count = qualityGoodsService.countQueryClassId(gcid);
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | page = page - totalPage;
|
| | |
| | | if (couponInfo != null) {
|
| | | convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null);
|
| | | if (convertUrl != null)
|
| | | couponInfo.setLink(convertUrl.getShortUrl());
|
| | | couponInfo.setLink(convertUrl.getUrl());
|
| | | }
|
| | |
|
| | | ShopInfoVO shopInfo = goodsDetail.getShopInfo();
|
| | |
| | | extraVO.setShare(shareInfoVO);
|
| | |
|
| | | if (convertUrl != null) {
|
| | | extraVO.setCouponJumpLink(convertUrl.getShortUrl());
|
| | | extraVO.setCouponJumpLink(convertUrl.getUrl());
|
| | | extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
|
| | | }
|
| | |
|
| | |
| | | PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_FANLI + "", uid + "");
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("native", true);
|
| | | data.put("jumpLink", convertUrl.getShortUrl());
|
| | | data.put("jumpLink", convertUrl.getUrl());
|
| | | data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
| | | // 去除前后空格
|
| | | text = text.trim();
|
| | |
|
| | | if (text.length() > 256) {
|
| | | out.print(JsonUtil.loadFalseResult("值过长"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief tb = null;
|
| | | String URL_REGEX = "(((http|https)://)|(www\\.))[a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6}(:[0-9]{1,4})?(/[a-zA-Z0-9\\&%_\\./-~-]*)?";
|
| | |
| | | Pattern p = Pattern.compile(URL_REGEX);
|
| | | Matcher matcher = p.matcher(text);
|
| | | if (!matcher.find()) {// 不包含链接
|
| | | if (text.length() > 256) {
|
| | | out.print(JsonUtil.loadFalseResult("值过长"));
|
| | | return;
|
| | | }
|
| | | String pattern = "^[A-Za-z0-9-]+$";
|
| | | if (Pattern.matches(pattern, text.replace(" ", ""))) {//删除空格
|
| | | out.println(JsonUtil.loadFalseResult("不支持推荐"));
|
| | |
| | | @Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, |
| | | @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, |
| | | @Param("endTime") String endTime, @Param("source")Integer source); |
| | | |
| | | |
| | | /** |
| | | * 订单列表查询(不包含子订单) |
| | | * @param start |
| | | * @param count |
| | | * @param keyType |
| | | * @param key |
| | | * @param state |
| | | * @param type |
| | | * @param orderState |
| | | * @param startTime |
| | | * @param endTime |
| | | * @param source |
| | | * @return |
| | | */ |
| | | List<CommonOrderVO> listQueryWithNoChild(@Param("start") long start, @Param("count") int count, |
| | | @Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, |
| | | @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, |
| | | @Param("endTime") String endTime, @Param("source")Integer source); |
| | | |
| | | /** |
| | | * 统计 |
| | |
| | | long countQuery(@Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, |
| | | @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, |
| | | @Param("endTime") String endTime, @Param("source")Integer source); |
| | | |
| | | long countQueryWithNoChild(@Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, |
| | | @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, |
| | | @Param("endTime") String endTime, @Param("source")Integer source); |
| | | |
| | | /** |
| | | * 根据来源类型与订单号查询列表 |
| | |
| | | BasicDBObject fieldsObject = new BasicDBObject();
|
| | | fieldsObject.put("auctionId", 1);
|
| | | Query query = new Query();
|
| | | Criteria ca = Criteria.where("updatetime").lt(date);
|
| | | // 时区问题,需加8小时
|
| | | Criteria ca = Criteria.where("updatetime").lt(new Date(date.getTime() + 1000 * 60 * 60 * 8L));
|
| | | query.skip(start);
|
| | | query.limit(count);
|
| | | query.addCriteria(ca);
|
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.ActivityException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | /**
|
| | | * 淘宝商品更细
|
| | |
| | | return;
|
| | | brandClassShopService.updateShopGoods();
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | List<TaoBaoOrder> orders = map.get(key);
|
| | | String redisKey = "addorderqueue-" + key;
|
| | | String redisKey = "addorderqueue-" + TaoBaoOrderUtil.getOrderDataHashCode(orders);;
|
| | | // redis做频率限制
|
| | | try {
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(redisKey))) {
|
| | |
| | | FROM (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} AND (v2.`hb_type` = 1 OR v2.`hb_type` = 2) |
| | | WHERE v2.`hb_uid`= ${uid} and v2.hb_state!=4 AND (v2.`hb_type` = 1 OR v2.`hb_type` = 2) |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` <!-- 自购订单 --> |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | |
| | | FROM (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} AND v2.`hb_type` = 20 |
| | | WHERE v2.`hb_uid`= ${uid} AND v2.`hb_type` = 20 and v2.hb_state!=4 |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` <!-- 分享订单 --> |
| | | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | WHERE hb.hb_id IS NOT NULL and hb.hb_state!=4 |
| | | <if test="state != null"> |
| | | AND co.`co_state` = ${state} |
| | | </if> |
| | |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} |
| | | AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 |
| | | OR v2.`hb_type` = 21 OR v2.`hb_type` = 22 ) |
| | | OR v2.`hb_type` = 21 OR v2.`hb_type` = 22 ) and v2.hb_state!=4 |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hbp.hb_id IS NOT NULL |
| | | WHERE hbp.hb_id IS NOT NULL and hbp.hb_state!=4 |
| | | <if test="state != null"> |
| | | AND co.`co_state` = ${state} |
| | | </if> |
| | |
| | | hb.hb_id=ho.`ho_hongbao_id` |
| | | <!-- 自购订单 --> |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | WHERE hb.hb_id IS NOT NULL and hb.hb_state!=4 |
| | | <if test="day != null and day == 1"> |
| | | <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | |
| | | = 20 ) hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | <!-- 分享订单 --> |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | WHERE hb.hb_id IS NOT NULL and hb.hb_state!=4 |
| | | <if test="day != null and day == 1"> |
| | | <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | |
| | | (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR |
| | | v2.`hb_type` = 21 OR v2.`hb_type` = 22 ) ) hbp ON |
| | | hbp.hb_pid=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON |
| | | co.`co_id`=ho.`ho_order_id` WHERE hbp.hb_id IS NOT NULL |
| | | co.`co_id`=ho.`ho_order_id` WHERE hbp.hb_id IS NOT NULL and hbp.hb_state!=4 |
| | | <if test="day != null and day == 1"> |
| | | <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | |
| | | ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT |
| | | JOIN yeshi_ec_user u ON u.id = A.hb_uid |
| | | </select> |
| | | |
| | | |
| | | <select id="listQueryWithNoChild" resultMap="ThreeResultMap"> |
| | | SELECT A.*,u.id AS userId,u.`nick_name` AS userName,u.`portrait` AS |
| | | userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS |
| | | totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, |
| | | hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS |
| | | preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN |
| | | (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | <!-- 红包类型 --> |
| | | <include refid="SELECT_HONGBAO_STATE" /> |
| | | <!-- 红包状态 --> |
| | | )hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_STATE" /> |
| | | <!-- 订单状态 --> |
| | | <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> |
| | | </if> |
| | | <if test="key != null and key != '' "> |
| | | <if test="keyType == 1 ">AND co.co_order_no = ${key}</if> |
| | | <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> |
| | | </if> |
| | | <!-- 订单来源 --> |
| | | <if test="source != null">AND co.co_source_type = #{source}</if> |
| | | ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT |
| | | JOIN yeshi_ec_user u ON u.id = A.hb_uid |
| | | </select> |
| | | |
| | | |
| | | <select id="countQuery" resultType="java.lang.Long"> |
| | | SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN |
| | | (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 |
| | |
| | | <!-- 订单来源 --> |
| | | <if test="source != null">AND co.co_source_type = #{source}</if> |
| | | </select> |
| | | |
| | | |
| | | <select id="countQueryWithNoChild" resultType="java.lang.Long"> |
| | | SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN |
| | | (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | <!-- 红包类型 --> |
| | | <include refid="SELECT_HONGBAO_STATE" /> |
| | | <!-- 红包状态 --> |
| | | )hb ON hb.hb_id=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_STATE" /> |
| | | <!-- 订单状态 --> |
| | | <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> |
| | | </if> |
| | | <if test="key != null and key != '' "> |
| | | <if test="keyType == 1 ">AND co.co_order_no = ${key}</if> |
| | | <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> |
| | | </if> |
| | | <!-- 订单来源 --> |
| | | <if test="source != null">AND co.co_source_type = #{source}</if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getCouponHongbaoByOrderNo" resultMap="ResultMap"> |
| | | SELECT COALESCE(SUM(IF(hb.hb_type=1,hb.`hb_money`,0)),0)AS totalMoney, |
| | | COALESCE(SUM(IF(hb.hb_type=10,hb.`hb_money`,0)),0)AS couponMoney, |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.brand;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.entity.brand.BrandClassShop;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandClassShopGoodsService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | |
|
| | | @Service
|
| | | public class BrandClassShopGoodsServiceImpl implements BrandClassShopGoodsService {
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private BrandClassShopService brandClassShopService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listBrandShopGoods(Long sellerId, int page, int count) {
|
| | |
|
| | | return taoBaoGoodsBriefService.listByShopId((page - 1) * count, count, sellerId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countBrandShopGoods(Long sellerId) {
|
| | | return taoBaoGoodsBriefService.countByShopId(sellerId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void startUpdateGoods() {
|
| | | long count = brandClassShopService.countQuery(null, null, BrandClassShop.STATE_VALID);
|
| | | int page = (int) (count % 100 == 0 ? count / 100 : count / 100 + 1);
|
| | |
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<BrandClassShop> shopList = brandClassShopService.listQuery(i * 100, 100, null, null,
|
| | | BrandClassShop.STATE_VALID);
|
| | | // 每个品牌最多更新100个商品
|
| | | if (shopList != null)
|
| | | for (BrandClassShop shop : shopList) {
|
| | | Long sellerId = shop.getShop().getId();
|
| | | List<TaoBaoGoodsBrief> goodsList = listBrandShopGoods(sellerId, 1, 100);
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | @Override
|
| | | public List<BrandClassShop> getExistByShopIds(List<Long> list) {
|
| | |
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top,String key)
|
| | | throws BrandClassShopException {
|
| | | public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top,
|
| | | String key) throws BrandClassShopException {
|
| | |
|
| | | if (id == null) {
|
| | | throw new BrandClassShopException(1, "数据为空:请选择店铺");
|
| | |
| | | }
|
| | |
|
| | | // 自定义图片
|
| | | taoBaoShopService.changeInfo(file, shop.getId(), shopName,key);
|
| | | taoBaoShopService.changeInfo(file, shop.getId(), shopName, key);
|
| | |
|
| | | BrandClassShop updateshop = new BrandClassShop();
|
| | | updateshop.setState(state);
|
| | |
| | | for (BrandClassShop brandClassShop : listQuery) {
|
| | | TaoBaoShop shop = brandClassShop.getShop();
|
| | | if (shop != null) {
|
| | | long couponNum = commonGoodsService.countBySellerIdAndHasCoupon(shop.getId(), Constant.SOURCE_TYPE_TAOBAO);
|
| | | long couponNum = commonGoodsService.countBySellerIdAndHasCoupon(shop.getId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO);
|
| | | brandClassShop.setCouponNum(couponNum);
|
| | |
|
| | | String shopLink = shop.getShopLink();
|
| | |
| | | return data;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | @Cacheable(value = "brandCache", key = "'listEffectiveCacheV2-'+#page+'-'+#cid")
|
| | | public JSONObject listEffectiveCacheV2(int page, Long cid) {
|
| | |
| | | for (BrandClassShop brandClassShop : list) {
|
| | | TaoBaoShop shop = brandClassShop.getShop();
|
| | | if (shop != null) {
|
| | | |
| | |
|
| | | Integer userType = shop.getUserType();
|
| | | if (userType == null || userType == 0) {
|
| | | shop.setUserType(10);
|
| | | } else {
|
| | | shop.setUserType(11);
|
| | | }
|
| | | |
| | |
|
| | | String shopLink = shop.getShopLink();
|
| | | if (StringUtil.isNullOrEmpty(shopLink)) {
|
| | | shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId()));
|
| | |
| | | } else {
|
| | | taoBaoShopVO.setUserType(11);
|
| | | }
|
| | | |
| | |
|
| | | String shopLink = taoBaoShopVO.getShopLink();
|
| | | if (StringUtil.isNullOrEmpty(shopLink)) {
|
| | | taoBaoShopVO.setShopLink(TaoBaoUtil.getShopLink(taoBaoShopVO.getId()));
|
| | |
| | |
|
| | | List<GoodsDetailVO> listGoods = new ArrayList<GoodsDetailVO>();
|
| | | List<TaoBaoGoodsBrief> listGoodsBrief = taoBaoShopVO.getListGoodsBrief();
|
| | | // 商品添加到更新队列
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(listGoodsBrief);
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate,
|
| | | shareRate);
|
| | | listGoods.add(goodsDetailVO);
|
| | | }
|
| | | taoBaoShopVO.setListGoodsVO(listGoods);
|
| | |
| | |
|
| | | return data;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void addClick(Long shopId) {
|
| | | BrandClassShop brandClassShop = brandClassShopMapper.getByShopId(shopId);
|
| | |
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = TaoBaoUtil.convert(daTaoKe);
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | TaoBaoGoodsBriefExtra goodsExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | | |
| | | TaoBaoGoodsBriefExtra goodsExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(),
|
| | | null);
|
| | |
|
| | | if (!goodsExtra.isCoupon() || (goodsExtra.getState() != null && goodsExtra.getState() == 1)) {
|
| | | return addSuccess; // 已下架 、无券 不加入
|
| | | return addSuccess; // 已下架 、无券 不加入
|
| | | }
|
| | | |
| | |
|
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | listGoods.add(taoBaoGoodsBrief);
|
| | | |
| | |
|
| | | goodsExtra.setTkRate(taoBaoGoodsBrief.getTkRate());
|
| | | goodsExtra.setUpdatetime(new Date());
|
| | | goodsExtra.setCouponInfo(null);
|
| | | |
| | |
|
| | | GoodsPicture goodsPicture = getGoodsPicture(daTaoKe);
|
| | | goodsPicture.setGoods(goodsExtra);
|
| | | // 商品列表
|
| | |
| | | }
|
| | | }
|
| | | goodsExtra.setImgList(imgList);
|
| | | |
| | |
|
| | | // 分享奖金
|
| | | BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(taoBaoGoodsBrief);
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | |
| | |
|
| | | // 保存信息
|
| | | dynamicInfoDao.insert(dynamicInfo);
|
| | | |
| | |
|
| | | addSuccess = true;
|
| | | return addSuccess;
|
| | | }
|
| | |
| | |
|
| | | return list;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | @Cacheable(value = "dynamicCache", key = "'queryV2-'+#platform+'-'+#version+'-'+#start+'-'+#count+'-'+#cid+'-'+#subId")
|
| | | public List<DynamicInfo> queryV2(int platform, int version, int start, int count, Long cid, Long subId) {
|
| | | List<DynamicInfo> listNew = new ArrayList<DynamicInfo>();
|
| | | List<DynamicInfo> list = dynamicInfoDao.query(start, count, cid, subId);
|
| | | // 需要更新的商品
|
| | | List<TaoBaoGoodsBrief> taoBaoGoodsUpdateList = new ArrayList<>();
|
| | | if (list != null && list.size() > 0) {
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | for (DynamicInfo dynamicInfo: list) {
|
| | | for (DynamicInfo dynamicInfo : list) {
|
| | | DynamicInfo dynamicNew = new DynamicInfo();
|
| | | try {
|
| | | PropertyUtils.copyProperties(dynamicNew, dynamicInfo);
|
| | |
| | | e.printStackTrace();
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | // 店铺信息
|
| | | TaoBaoShop shop = dynamicNew.getShop();
|
| | | if (shop != null) {
|
| | |
| | | }
|
| | | dynamicNew.setShop(shopNew);
|
| | | }
|
| | | |
| | |
|
| | | List<GoodsPicture> imgsNew = new ArrayList<GoodsPicture>();
|
| | | List<GoodsPicture> imgs = dynamicNew.getImgs();
|
| | | if (imgs != null && imgs.size() > 0) {
|
| | | for (GoodsPicture goodsPicture: imgs) {
|
| | | for (GoodsPicture goodsPicture : imgs) {
|
| | | TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods();
|
| | | if (goods == null) {
|
| | | imgsNew.add(goodsPicture);
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | taoBaoGoodsUpdateList.add(goods);
|
| | |
|
| | | GoodsPicture goodsNew = new GoodsPicture();
|
| | | try {
|
| | | PropertyUtils.copyProperties(goodsNew, goodsPicture);
|
| | |
| | | e.printStackTrace();
|
| | | continue;
|
| | | }
|
| | | |
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBaoGoodsBriefExtra(goods, fanLiRate, shareRate);
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBaoGoodsBriefExtra(goods, fanLiRate,
|
| | | shareRate);
|
| | | goodsNew.setGoodsVO(detailVO);
|
| | | goodsNew.setGoods(null);
|
| | | |
| | |
|
| | | JumpDetailV2 jumpDetail = goodsNew.getJumpDetail();
|
| | | if (jumpDetail != null) {
|
| | | JumpDetailV2 jumpDetailV2 = jumpDetailV2Service.getByTypeCache(jumpDetail.getType(), platform, version);
|
| | | JumpDetailV2 jumpDetailV2 = jumpDetailV2Service.getByTypeCache(jumpDetail.getType(),
|
| | | platform, version);
|
| | | if (jumpDetailV2 != null) {
|
| | | goodsNew.setJumpDetail(jumpDetailV2);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | imgsNew.add(goodsNew);
|
| | | }
|
| | | dynamicNew.setImgs(imgsNew);
|
| | |
| | | listNew.add(dynamicNew);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 更新商品信息
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | |
| | | updateGoodInfo(list);
|
| | | }
|
| | | });
|
| | |
|
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(taoBaoGoodsUpdateList);
|
| | | return listNew;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 更新商品信息
|
| | |
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | for (DynamicInfo dynamicInfo : list) {
|
| | |
| | | dynamicInfo.setDesc(shareMoneyDesc);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 需要更新信息;
|
| | | needUpdate = true;
|
| | | }
|
| | | |
| | |
|
| | | // 无效更新信息
|
| | | if (!needUpdate) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | // 更新商品信息
|
| | | dynamicInfo.setImgs(listPicture);
|
| | |
|
| | |
| | |
|
| | | // 是否存在奖励券
|
| | | boolean hasRewardCoupon = userSystemCouponService.hasRewardCoupon(uid);
|
| | | |
| | |
|
| | | // 2019.8.1开始返回维权信息
|
| | | Date august = null;
|
| | | try {
|
| | |
| | | if (hongBao == null) {
|
| | | hongBao = new BigDecimal(0);
|
| | | }
|
| | | |
| | |
|
| | | if (CommonOrder.STATE_FK == orderState) {
|
| | | orderStateContent = "已付款";
|
| | | } else if (CommonOrder.STATE_JS == orderState) {
|
| | |
| | | isPart = true;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (!VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (isPart) {
|
| | | hongBaoState = HongBaoV2.STATE_BUFENSHIXIAO; // 部分失效
|
| | |
| | | if (isPart) {
|
| | | // 维权失效金额=维权的金额*获得的红包/结算金额
|
| | | BigDecimal settlement = order.getSettlement();
|
| | | BigDecimal wqHongbao = MoneyBigDecimalUtil.div(MoneyBigDecimalUtil.mul(hongBao, settlement), settlement);
|
| | | weiQuanInfo.setWqHongBao("维权:-¥" + wqHongbao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | BigDecimal wqHongbao = MoneyBigDecimalUtil
|
| | | .div(MoneyBigDecimalUtil.mul(hongBao, settlement), settlement);
|
| | | weiQuanInfo.setWqHongBao(
|
| | | "维权:-¥" + wqHongbao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBao = MoneyBigDecimalUtil.sub(hongBao, wqHongbao);
|
| | | } else {
|
| | | weiQuanInfo.setWqHongBao("维权:-¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | weiQuanInfo
|
| | | .setWqHongBao("维权:-¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBao = new BigDecimal(0);
|
| | | }
|
| | | order.setWeiQuanInfo(weiQuanInfo);
|
| | |
| | |
|
| | | hongbaoInfo = hongBaoState_Str + hongbaoInfo;
|
| | |
|
| | | |
| | | Map<String, String> hongBaoMap = new HashMap<String, String>();
|
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBaoMap.put("fontColor", hongbaoInfoFontColor);
|
| | |
| | | } else {// 修改
|
| | | // 已经结算,已经失效,状态未改变的订单不处理
|
| | | if (oldCommonOrder.getState() == CommonOrder.STATE_JS || oldCommonOrder.getState() == CommonOrder.STATE_SX
|
| | | || oldCommonOrder.getState() == CommonOrder.STATE_WQ
|
| | | || (oldCommonOrder.getState().intValue() == commonOrder.getState())) {
|
| | | return oldCommonOrder;
|
| | | }
|
| | |
| | | Integer type, Integer orderState, String startTime, String endTime, Integer source)
|
| | | throws CommonOrderException {
|
| | |
|
| | | List<CommonOrderVO> list = commonOrderMapper.listQuery(start, count, keyType, key, state, type, orderState,
|
| | | startTime, endTime, source);
|
| | | List<CommonOrderVO> list = null;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 搜索框无值或者按订单号搜索时都只搜索主订单
|
| | | list = commonOrderMapper.listQueryWithNoChild(start, count, keyType, key, state, type, orderState,
|
| | | startTime, endTime, source);
|
| | | } else
|
| | | list = commonOrderMapper.listQuery(start, count, keyType, key, state, type, orderState, startTime, endTime,
|
| | | source);
|
| | |
|
| | | if (list == null) {
|
| | | list = new ArrayList<CommonOrderVO>();
|
| | |
| | | @Override
|
| | | public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState,
|
| | | String startTime, String endTime, Integer source) throws CommonOrderException {
|
| | | return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source);
|
| | | if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 搜索框无值或者按订单号搜索时都只搜索主订单
|
| | | return commonOrderMapper.countQueryWithNoChild(keyType, key, state, type, orderState, startTime, endTime,
|
| | | source);
|
| | | } else
|
| | | return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | return commonOrderMapper.listBySourceTypeAndStateAndThirdCrateTime(sourceType, state, minTime, maxTime,
|
| | | (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | @Resource
|
| | | private AccountMessageMapper accountMessageMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void pushGoods(Long uid, String title, String content, String url, List<String> listIOS,
|
| | | public void pushGoods(Long uid, String title, String content, String url, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | | String gids = url.split("id=")[1];
|
| | | String gid = gids.split("&")[0];
|
| | |
| | | if (StringUtil.isNullOrEmpty(title))
|
| | | throw new PushException(1, "请填写推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "请填写推送内容"); |
| | | |
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | throw new PushException(1, "请填写推送内容");
|
| | |
|
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
|
| | | if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
|
| | | if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, versions);
|
| | | }
|
| | | // 华为推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setUid(uid);
|
| | | pushRecord.setState(1);
|
| | |
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void pushUrl(Long uid, String title, String content, String url, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | |
| | | throw new PushException(1, "无推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "无推送内容");
|
| | | |
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
|
| | | if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushUrl(uid, url, title, content, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
|
| | | if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushUrl(uid, url, title, content, versions);
|
| | | }
|
| | |
|
| | | // 华为推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushUrl(uid, url, title, content, versionCodeList);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setUid(uid);
|
| | | pushRecord.setState(1);
|
| | |
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void pushZNX(Long uId, String title, String content, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | | public void pushZNX(Long uId, String title, String content, List<String> listIOS, List<String> listAndroid)
|
| | | throws PushException {
|
| | | if (StringUtil.isNullOrEmpty(title))
|
| | | throw new PushException(1, "无推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | |
| | |
|
| | | SystemZnx systemZnx = null;
|
| | | AccountMessage accountMessage = null;
|
| | | |
| | |
|
| | | /* 无uid , 广播 数据插入系统表 */
|
| | | if (uId == null || uId == 0) {
|
| | | // 插入数据库(系统站内信数据)
|
| | |
| | | accountMessage.setContent(content);
|
| | | accountMessageMapper.insertSelective(accountMessage);
|
| | | }
|
| | | |
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
|
| | | if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushZNX(uId, accountMessage, systemZnx, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
|
| | | if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushZNX(uId, accountMessage, systemZnx, versions);
|
| | | }
|
| | |
|
| | | // 华为推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushZNX(uId, title, content, versionCodeList);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setUid(uId);
|
| | |
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | |
| | | throw new PushException(1, "无推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "无推送内容");
|
| | | |
| | |
|
| | | // 适用版本 1.4.8及以后 推送weex页面
|
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
|
| | | if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushWEEX(uid, title, content, weexUrl, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:31
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
|
| | | if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushWEEX(uid, title, content, weexUrl, versions);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 华为推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setTitle(title);
|
| | |
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(title))
|
| | | throw new PushException(1, "无推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "无推送内容");
|
| | | |
| | |
|
| | | // 适用版本 1.4.8及以后 推送百川网页
|
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
|
| | | if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushBaiChuanUrl(uid, title, content, url, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:31
|
| | | String versions = getEffectiveVersions(31, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | String versions = getEffectiveVersions(31, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
|
| | | if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushBaiChuanUrl(uid, title, content, url, versions);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 华为推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setUrl(url);
|
| | |
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void pushWelfareCenter(Long uid, String title, String content, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(title))
|
| | | throw new PushException(1, "无推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "无推送内容");
|
| | | |
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS);
|
| | | if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushWelfareCenter(uid, title, content, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | |
|
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:36
|
| | | String versions = getEffectiveVersions(36, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | String versions = getEffectiveVersions(36, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
|
| | | if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushWelfareCenter(uid, title, content, versions);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 华为推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushWelfareCenter(uid, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setTitle(title);
|
| | |
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 查询能推送版本号
|
| | | * |
| | | * @param versionCode
|
| | | * @param listVersion
|
| | | * @return
|
| | | */
|
| | | private String getEffectiveVersions(int minCode, String type, List<String> listVersion) throws PushException{
|
| | | |
| | | private String getEffectiveVersions(int minCode, String type, List<String> listVersion) throws PushException {
|
| | |
|
| | | if (minCode == 0 && listVersion == null) {
|
| | | return null;
|
| | | }
|
| | | |
| | |
|
| | | String versions = "";
|
| | | if (listVersion == null) {
|
| | | List<AppVersionInfo> list = appVersionService.listByPlatformAndMinVersionCode(type, minCode);
|
| | |
| | | List<AppVersionInfo> list = appVersionService.listByVersions(type, listVersion);
|
| | | if (list != null) {
|
| | | for (AppVersionInfo appVersion : list) {
|
| | | Integer code = appVersion.getVersionCode();
|
| | | Integer code = appVersion.getVersionCode();
|
| | | if (code != null && code >= minCode) {
|
| | | versions += appVersion.getVersion() + ",";
|
| | | }
|
| | | }
|
| | | } |
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (versions.endsWith(",")) {
|
| | | versions = versions.substring(0, versions.length() - 1);
|
| | | }
|
| | | |
| | |
|
| | | return versions;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 查询能推送版本号code
|
| | | * |
| | | * @param versionCode
|
| | | * @param listVersion
|
| | | * @return
|
| | | */
|
| | | private String getEffectiveVersionCodes(int minCode, String type, List<String> listVersion) throws PushException{
|
| | | |
| | | private String getEffectiveVersionCodes(int minCode, String type, List<String> listVersion) throws PushException {
|
| | |
|
| | | if (minCode == 0 && listVersion == null) {
|
| | | return null;
|
| | | }
|
| | | |
| | |
|
| | | String versionCodes = "";
|
| | | if (listVersion == null) {
|
| | | List<AppVersionInfo> list = appVersionService.listByPlatformAndMinVersionCode(type, minCode);
|
| | |
| | | List<AppVersionInfo> list = appVersionService.listByVersions(type, listVersion);
|
| | | if (list != null) {
|
| | | for (AppVersionInfo appVersion : list) {
|
| | | Integer code = appVersion.getVersionCode();
|
| | | Integer code = appVersion.getVersionCode();
|
| | | if (code != null && code >= minCode) {
|
| | | versionCodes += appVersion.getVersionCode() + ",";
|
| | | }
|
| | | }
|
| | | } |
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (versionCodes.endsWith(",")) {
|
| | | versionCodes = versionCodes.substring(0, versionCodes.length() - 1);
|
| | | }
|
| | | |
| | |
|
| | | return versionCodes;
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> filterTaoBaoGoods(List<TaoBaoGoodsBrief> goodsList) {
|
| | | public List<TaoBaoGoodsBrief> filterImportantTaoBaoGoods(List<TaoBaoGoodsBrief> goodsList) {
|
| | | Map<Long, TaoBaoGoodsBrief> finalMap = new HashMap<>();
|
| | | // 原始数据全覆盖
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | |
| | | List<TaoBaoGoodsBrief> mList = taoBaoGoodsUpdateDao.listByAuctionIds(auctionIds);
|
| | | if (mList != null)
|
| | | for (TaoBaoGoodsBrief goods : mList) {
|
| | | finalMap.put(goods.getAuctionId(), goods);
|
| | | if (goods.getUpdatetime().getTime() > System.currentTimeMillis() - 1000 * 60 * 60 * 24L)// 在1天内更新的数据才参与过滤
|
| | | finalMap.put(goods.getAuctionId(), goods);
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> finalList = new ArrayList<>();
|
| | | for (TaoBaoGoodsBrief goods : goodsList)
|
| | | finalList.add(finalMap.get(goods.getAuctionId()));
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | TaoBaoGoodsBrief newGoods = finalMap.get(goods.getAuctionId());
|
| | | // 过滤价格,返利比例,券信息
|
| | | goods.setZkPrice(newGoods.getZkPrice());
|
| | | goods.setTkRate(newGoods.getTkRate());
|
| | | goods.setCouponAmount(goods.getCouponAmount());
|
| | | goods.setCouponActivityId(newGoods.getCouponActivityId());
|
| | | goods.setCouponEffectiveEndTime(newGoods.getCouponEffectiveEndTime());
|
| | | goods.setCouponEffectiveStartTime(newGoods.getCouponEffectiveStartTime());
|
| | | goods.setCouponStartFee(newGoods.getCouponStartFee());
|
| | | goods.setCouponTotalCount(newGoods.getCouponTotalCount());
|
| | | goods.setCouponLeftCount(newGoods.getCouponLeftCount());
|
| | |
|
| | | finalList.add(goods);
|
| | | }
|
| | | return finalList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int listAndRemoveByMaxUpdateTime(Date maxTime, int page, int pageSize) {
|
| | | return taoBaoGoodsUpdateDao.listAndRemoveByMaxUpdateTime(maxTime, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByMaxUpdateTime(Date maxTime) {
|
| | | return taoBaoGoodsUpdateDao.countByMaxUpdateTime(maxTime);
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.taobao;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | | import java.util.HashSet;
|
| | | import java.util.Iterator;
|
| | |
| | | @Resource
|
| | | private TaoBaoOrderTradeMapMapper taoBaoOrderTradeMapMapper;
|
| | |
|
| | | /**
|
| | | * 获取订单的哈希值
|
| | | * |
| | | * @param list
|
| | | * @return
|
| | | */
|
| | |
|
| | | @Override
|
| | | public void addTaoBaoOrderList(List<TaoBaoOrder> list) {
|
| | | if (list == null || list.size() == 0)
|
| | |
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String orderId = its.next();
|
| | | String key = "addorder-" + orderId;
|
| | | String key = "addorder-" + TaoBaoOrderUtil.getOrderDataHashCode(map.get(orderId));
|
| | | // redis做频率限制
|
| | | try {
|
| | | if (Constant.IS_OUTNET) {
|
| | |
| | | @Override
|
| | | public void startSyncGoods() {
|
| | | LogHelper.test("大淘客同步开始");
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.listAll("1");
|
| | | int page = 0;
|
| | | while (result.getGoodsList() != null && result.getGoodsList().size() > 0) {
|
| | | System.out.println(page++);
|
| | | for (DaTaoKeDetailV2 v2 : result.getGoodsList())
|
| | | {
|
| | | try {
|
| | | daTaoKeGoodsDetailV2Dao.saveWithCommision(v2);
|
| | | } catch (Exception e) {
|
| | |
|
| | | int totalCount = 0;
|
| | | try {
|
| | |
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.listAll("1");
|
| | | int page = 0;
|
| | |
|
| | | while (result.getGoodsList() != null && result.getGoodsList().size() > 0) {
|
| | | System.out.println(page++);
|
| | | totalCount += result.getGoodsList().size();
|
| | | for (DaTaoKeDetailV2 v2 : result.getGoodsList()) {
|
| | | try {
|
| | | daTaoKeGoodsDetailV2Dao.saveWithCommision(v2);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | result = DaTaoKeApiUtil.listAll(result.getPageId());
|
| | | } catch (Exception e) {
|
| | | result = DaTaoKeApiUtil.listAll(result.getPageId());
|
| | | }
|
| | |
|
| | | try {
|
| | | Thread.sleep(10);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | result = DaTaoKeApiUtil.listAll(result.getPageId());
|
| | | try {
|
| | | Thread.sleep(10);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | } finally {
|
| | | LogHelper.test("大淘客新版商品同步数量:" + totalCount);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | String startTime = null;
|
| | | DaTaoKeDetailV2 latest = daTaoKeGoodsDetailV2Dao.selectLatest();
|
| | | if (latest != null) {
|
| | | startTime =TimeUtil.getGernalTime(latest.getCreateTime().getTime(),"yyyy-MM-dd HH:mm:ss");
|
| | | startTime = TimeUtil.getGernalTime(latest.getCreateTime().getTime(), "yyyy-MM-dd HH:mm:ss");
|
| | | }
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getNewGoodsList(null, startTime, null);
|
| | | while (!StringUtil.isNullOrEmpty(result.getPageId())) {
|
| | |
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page) {
|
| | | Map<Long, DaTaoKeDetailV2> map = new HashMap<>();
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods((page - 1) *100,
|
| | | 100, "monthSales");
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods((page - 1) * 100, 100, "monthSales");
|
| | | System.out.println(list);
|
| | | for (DaTaoKeDetailV2 v2 : list) {
|
| | | map.put(v2.getId(), v2);
|
| | |
| | | for (DaTaoKeDetailV2 v2 : result.getGoodsList()) {
|
| | | BigDecimal commision = MoneyBigDecimalUtil
|
| | | .div(MoneyBigDecimalUtil.mul(v2.getActualPrice(), v2.getCommissionRate()), new BigDecimal(100));
|
| | | |
| | |
|
| | | if (commision.multiply(new BigDecimal("0.7")).compareTo(new BigDecimal("1.01")) >= 0
|
| | | && v2.getActualPrice().compareTo(new BigDecimal(30)) < 0 && v2.getMonthSales() >= 5000) {
|
| | | Date time = new Date(TimeUtil.convertToTimeTemp(v2.getCouponEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | |
| | | }
|
| | | if (time.getTime() >= targetTime.getTime())
|
| | | goodsList.add(v2);
|
| | | } |
| | | }
|
| | | }
|
| | | return goodsList;
|
| | | } else
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.brand;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | /**
|
| | | * 品牌店铺商品服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface BrandClassShopGoodsService {
|
| | |
|
| | | /**
|
| | | * 总的品牌店铺商品列表
|
| | | * |
| | | * @param page
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> listBrandShopGoods(Long sellerId, int page, int count);
|
| | |
|
| | | /**
|
| | | * 总的品牌店铺商品数量
|
| | | * |
| | | * @return
|
| | | */
|
| | | public long countBrandShopGoods(Long sellerId);
|
| | |
|
| | | /**
|
| | | * 更新品牌商品的数据
|
| | | */
|
| | | public void startUpdateGoods();
|
| | |
|
| | | }
|
| | |
| | |
|
| | | public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState,
|
| | | String startTime, String endTime, Integer source) throws CommonOrderException;
|
| | |
|
| | |
|
| | | /**
|
| | | * 查询订单
|
| | | *
|
| | |
| | | package com.yeshi.fanli.service.inter.taobao;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | * @param goodsList
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> filterTaoBaoGoods(List<TaoBaoGoodsBrief> goodsList);
|
| | | public List<TaoBaoGoodsBrief> filterImportantTaoBaoGoods(List<TaoBaoGoodsBrief> goodsList);
|
| | |
|
| | | /**
|
| | | * 根据最大的更新时间移除
|
| | | * |
| | | * @param maxTime
|
| | | * @return
|
| | | */
|
| | | public int listAndRemoveByMaxUpdateTime(Date maxTime,int page,int pageSize);
|
| | |
|
| | | /**
|
| | | * 根据最大更新时间计算
|
| | | * @param maxTime
|
| | | * @return
|
| | | */
|
| | | public long countByMaxUpdateTime(Date maxTime);
|
| | |
|
| | | }
|
| | |
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | try {
|
| | | long startTime = System.currentTimeMillis();
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.searchGoodsDetail(map.get(key));
|
| | | // 更新一条数据需要的时间
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(goods);
|
| | | long time = System.currentTimeMillis() - startTime;
|
| | | LogHelper.test("淘宝重要商品库更新时间:" + time);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | // 自购立减PID
|
| | | public static TaoKeAppInfo ownBuyApp = new TaoKeAppInfo("24937414", "0457746e24622a6c8c7924288550af5f",
|
| | | "mm_133239778_45820106_699710614");
|
| | | |
| | | public static TaoKeAppInfo[] ownBuyApps=new TaoKeAppInfo[]{
|
| | | new TaoKeAppInfo("27759529", "2c0ecd37cf53eff0439a386c4eba2772","mm_472550068_628200329_109272850337"),
|
| | | new TaoKeAppInfo("27743325", "527a23554f71557d7b786bc479fcd5fe","mm_472720008_629400173_109272950312"),
|
| | | new TaoKeAppInfo("27770097", "fd896b718e2b0a833f0b7524cb83d092","mm_474720121_631000170_109273750171"),
|
| | | new TaoKeAppInfo("27762518", "2b2077798b7f8c5c94d337ac69d86a83","mm_474970057_635750171_109272950316"),
|
| | | new TaoKeAppInfo("27757101", "47921196e59a7999637269f486865096","mm_476760152_635550267_109272750381"),
|
| | | };
|
| | |
|
| | | public static BigDecimal OWN_BUY_WITHOUT_FANLI_RATE = new BigDecimal(70);// 自购立减的比例
|
| | |
|
| | |
| | | * @param auctionId
|
| | | * @return
|
| | | */
|
| | | public static String createGoodsParams(Long auctionId) {
|
| | | public static String createGoodsParams(Long auctionId, Integer goodsType) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("id", auctionId);
|
| | | if (goodsType != null)
|
| | | data.put("goodsType", goodsType);
|
| | | return data.toString();
|
| | | }
|
| | |
|
| | |
| | | ca.setTime(time);
|
| | | ca.add(Calendar.MONTH, -1);
|
| | |
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy.M");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | |
| | | ca.setTime(time);
|
| | | ca.add(Calendar.MONTH, -1);
|
| | |
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy年MM月");
|
| | | String timeF = TimeUtil.getGernalTime(ca.getTimeInMillis(), "yyyy.M");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | |
| | | package com.yeshi.fanli.util.jd;
|
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.InputStreamReader;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLEncoder;
|
| | |
| | |
|
| | | return null;
|
| | | }
|
| | | |
| | |
|
| | | public static String getJDGoodsJS() {
|
| | | InputStream input = JDUtil.class.getClassLoader().getResourceAsStream("jdGoods.js");
|
| | | StringBuilder sb = new StringBuilder();
|
| | | String line;
|
| | | BufferedReader br = new BufferedReader(new InputStreamReader(input));
|
| | | try {
|
| | | while ((line = br.readLine()) != null) {
|
| | | sb.append(line);
|
| | | }
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return sb.toString();
|
| | | }
|
| | |
|
| | | static String jdGoodsJs = null;
|
| | | static ScriptEngine engine = null;
|
| | | static {
|
| | | if (jdGoodsJs == null)
|
| | | jdGoodsJs = getJDGoodsJS();
|
| | | ScriptEngineManager manager = new ScriptEngineManager();
|
| | | engine = manager.getEngineByName("javascript");
|
| | | try {
|
| | | engine.eval(jdGoodsJs);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | public static String getJDGoodsId(String url) {
|
| | | try {
|
| | | if (url.startsWith("https://item.m.jd.com/product/") || url.startsWith("http://item.m.jd.com/product/")
|
| | | || url.startsWith("https://item.jd.com/") || url.startsWith("http://item.jd.com/")) {
|
| | | String preUrl = url.split("\\?")[0];
|
| | | String index = preUrl.split("/")[preUrl.split("/").length - 1];
|
| | | index = index.split("\\.")[0];
|
| | | return index.trim();
|
| | | } else if (url.startsWith("https://item.m.jd.com/ware/view.action?")) {
|
| | | String preUrl = url.substring(url.indexOf("?") + 1, url.length());
|
| | | String[] sts = preUrl.split("&");
|
| | | for (String st : sts) {
|
| | | if (st.startsWith("wareId=")) {
|
| | | return st.split("=")[1].trim();
|
| | | }
|
| | | }
|
| | | if (engine instanceof Invocable) {
|
| | | Invocable in = (Invocable) engine;
|
| | | String goodsId = in.invokeFunction("getGoodsId", url).toString();
|
| | | if (!StringUtil.isNullOrEmpty(goodsId))
|
| | | return goodsId.trim();
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.pinduoduo;
|
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.InputStreamReader;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLEncoder;
|
| | |
| | | import javax.script.Invocable;
|
| | | import javax.script.ScriptEngine;
|
| | | import javax.script.ScriptEngineManager;
|
| | | import javax.script.ScriptException;
|
| | |
|
| | | import org.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.methods.PostMethod;
|
| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | try {
|
| | | client.executeMethod(pm);
|
| | | String result = pm.getResponseBodyAsString();
|
| | | LogHelper.test("拼多多猜你喜欢:"+result);
|
| | | LogHelper.test("拼多多猜你喜欢:" + result);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | JSONArray array = json.optJSONArray("data");
|
| | | if (array != null) {
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 多多进宝爬取数据-品牌好货
|
| | | *
|
| | |
| | | public static PDDGoodsResult getTodaySaleGoods() {
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("type", 1);
|
| | | params.put("sortType",3);
|
| | | |
| | | params.put("sortType", 3);
|
| | |
|
| | | HttpClient client = new HttpClient();
|
| | | PostMethod pm = new PostMethod("https://jinbao.pinduoduo.com/network/api/common/queryTopGoodsList");
|
| | |
| | | return goodsResult;
|
| | | }
|
| | |
|
| | |
|
| | | private static PDDGoodsDetail parseTodaySaleGoods(JSONObject json) {
|
| | | PDDGoodsDetail goods = new PDDGoodsDetail();
|
| | | goods.setMallName(json.optString("mallName"));
|
| | |
| | | if (json.optString("mallId") != null) {
|
| | | goods.setMallId(json.getLong("mallId"));
|
| | | }
|
| | | |
| | |
|
| | | if (json.optString("goodsImageUrl") != null) {
|
| | | goods.setGoodsImageUrl(json.optString("goodsImageUrl"));
|
| | | }
|
| | |
| | | if (json.optString("minGroupPrice") != null) {
|
| | | goods.setMinGroupPrice(json.getLong("minGroupPrice"));
|
| | | }
|
| | | |
| | |
|
| | | if (json.optString("minNormalPrice") != null) {
|
| | | goods.setMinNormalPrice(json.getLong("minNormalPrice"));
|
| | | }
|
| | |
| | |
|
| | | return goods;
|
| | | }
|
| | | |
| | | public static String getPDDGoodsId(String url) {
|
| | |
|
| | | public static String getJDGoodsJS() {
|
| | | InputStream input = JDUtil.class.getClassLoader().getResourceAsStream("pddGoods.js");
|
| | | StringBuilder sb = new StringBuilder();
|
| | | String line;
|
| | | BufferedReader br = new BufferedReader(new InputStreamReader(input));
|
| | | try {
|
| | | if (url.startsWith("https://mobile.yangkeduo.com/goods.html?")
|
| | | || url.startsWith("http://mobile.yangkeduo.com/goods.html?")||url.contains("yangkeduo.com/duo_coupon_landing.html?")) {
|
| | | String preUrl = url.substring(url.indexOf("?") + 1, url.length());
|
| | | String[] sts = preUrl.split("&");
|
| | | for (String st : sts) {
|
| | | if (st.startsWith("goods_id=")) {
|
| | | return st.split("=")[1].trim();
|
| | | }
|
| | | }
|
| | | while ((line = br.readLine()) != null) {
|
| | | sb.append(line);
|
| | | }
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return sb.toString();
|
| | | }
|
| | |
|
| | | static String jdGoodsJs = null;
|
| | | static ScriptEngine engine = null;
|
| | | static {
|
| | | if (jdGoodsJs == null)
|
| | | jdGoodsJs = getJDGoodsJS();
|
| | | ScriptEngineManager manager = new ScriptEngineManager();
|
| | | engine = manager.getEngineByName("javascript");
|
| | | try {
|
| | | engine.eval(jdGoodsJs);
|
| | | } catch (ScriptException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public static String getPDDGoodsId(String url) {
|
| | |
|
| | | try {
|
| | | if (engine instanceof Invocable) {
|
| | | Invocable in = (Invocable) engine;
|
| | | String goodsId = in.invokeFunction("getGoodsId", url).toString();
|
| | | if (!StringUtil.isNullOrEmpty(goodsId))
|
| | | return goodsId.trim();
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | }
|
| | |
| | | import java.math.BigDecimal;
|
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | |
| | | return commonOrder;
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取一组订单的hash值
|
| | | * |
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | public static String getOrderDataHashCode(List<TaoBaoOrder> list) {
|
| | | List<TaoBaoOrder> orderList = new ArrayList<>();
|
| | | orderList.addAll(list);
|
| | | Comparator<TaoBaoOrder> orderCM = new Comparator<TaoBaoOrder>() {
|
| | |
|
| | | @Override
|
| | | public int compare(TaoBaoOrder o1, TaoBaoOrder o2) {
|
| | | return Long.parseLong(o1.getTradeId()) - Long.parseLong(o2.getTradeId()) > 0 ? 1 : -1;
|
| | | }
|
| | | };
|
| | | Collections.sort(orderList, orderCM);
|
| | | String sts = "";
|
| | | for (TaoBaoOrder order : orderList) {
|
| | | sts += order.getTradeId();
|
| | | }
|
| | | return StringUtil.Md5(sts);
|
| | | }
|
| | | }
|
New file |
| | |
| | | function getGoodsId(url) {
|
| | | if (url.indexOf('://item.m.jd.com/product/') > 0 || url.indexOf('://item.jd.com/') > 0) {
|
| | | var preUrl = url.split("?")[0];
|
| | | var index = preUrl.split("/")[preUrl.split("/").length - 1];
|
| | | index = index.split(".")[0];
|
| | | return index.replace(" ", "");
|
| | | } else if (url.indexOf('://item.m.jd.com/ware/view.action?') > 0) {
|
| | | var preUrl = url.substr(url.indexOf("?") + 1, url.length);
|
| | | var sts = preUrl.split("&");
|
| | | for (var i = 0; i < sts.length; i++) {
|
| | | if (st.indexOf("wareId=") == 0) {
|
| | | return st.split("=")[1].replace(" ", "");
|
| | | }
|
| | | }
|
| | | }
|
| | | return null;
|
| | | } |
New file |
| | |
| | | function getGoodsId(url) {
|
| | | if (url.indexOf('://mobile.yangkeduo.com/goods.html?') > 0 || url.indexOf('yangkeduo.com/duo_coupon_landing.html?') >
|
| | | 0 || url.indexOf('://mobile.yangkeduo.com/goods2.html?') > 0) {
|
| | | var preUrl = url.substr(url.indexOf("?") + 1, url.length());
|
| | | var sts = preUrl.split("&");
|
| | | for (var i = 0; i < sts.length; i++) {
|
| | | if (sts[i].indexOf("goods_id=") == 0) {
|
| | | return sts[i].split("=")[1];
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
| | |
| | | appId=100059977
|
| | | appSecret=07618b0e8e8f6d4739ee80a3ed14dd39 |
| | | appId=100513147
|
| | | appSecret=16f1b74908036c917f40c314968f6ee1 |