| | |
| | |
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.dynamic.DynamicInfoDao;
|
| | |
| | | dynamicInfo.setClassId(classId);
|
| | | dynamicInfo.setSubclassId(subclassId);
|
| | | dynamicInfo.setDaTaoKeId(daTaoKe.getId());
|
| | | dynamicInfo.setCreateTime(new Date());
|
| | |
|
| | | dynamicInfo.setCreateTime(DateUtil.reduceRandomMinute(new Date()));
|
| | | dynamicInfo.setUpdateTime(new Date());
|
| | | // 随机分享次数
|
| | | dynamicInfo.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | // 随机分布用户
|
| | |
| | | dynamicVO.setClassId(4L);
|
| | | dynamicVO.setSubclassId(0L);
|
| | | dynamicVO.setShareType(DynamicInfo.SHARE_TYPE_INVITE);
|
| | | dynamicVO.setUpdateTime(new Date());
|
| | | |
| | | if (existInfo != null) {
|
| | | dynamicVO.setCreateTime(existInfo.getCreateTime());
|
| | | dynamicVO.setShareCount(existInfo.getShareCount());
|
| | | } else {
|
| | | dynamicVO.setCreateTime(new Date());
|
| | | dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date()));
|
| | | dynamicVO.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | }
|
| | | |
| | |
|
| | | if (activityUser == null) {
|
| | | dynamicVO.setUser(activityUserService.listRand(1).get(0));
|
| | |
| | | dynamicVO.setShowType(DynamicInfo.SHOW_TYPE_TWO);
|
| | | dynamicVO.setShop(taoBaoShop);
|
| | | dynamicVO.setUser(activityUserService.listRand(1).get(0));
|
| | | dynamicVO.setCreateTime(new Date());
|
| | | dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date())); |
| | | dynamicVO.setUpdateTime(new Date());
|
| | |
|
| | | // 介绍内容
|
| | | ClientTextStyleVO row1 = new ClientTextStyleVO();
|
| | |
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | for (DynamicInfo dynamicInfo: list) {
|
| | | // 邀请数据不做更新
|
| | | long classId = dynamicInfo.getClassId();
|
| | | if (classId == 4) {
|
| | | break;
|
| | | }
|
| | | |
| | | // 更新商品信息
|
| | | List<GoodsPicture> imgs = dynamicInfo.getImgs();
|
| | | if (imgs == null || imgs.size() == 0) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | boolean isupdate = false;
|
| | | BigDecimal shareMoney = null;
|
| | | // 是否一个小时之内已更新
|
| | | Date updateTime = dynamicInfo.getUpdateTime();
|
| | | if (updateTime != null) {
|
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数 |
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数 |
| | | long diff = System.currentTimeMillis() - updateTime.getTime(); |
| | | long day = diff / nd;// 计算差多少天 |
| | | long hour = diff % nd / nh + day * 24;// 计算差多少小时 |
| | | if (hour < 1) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | | |
| | | // 更新
|
| | | BigDecimal shareMoney = new BigDecimal(0);
|
| | | for (GoodsPicture goodsPicture: imgs) {
|
| | | TaoBaoGoodsBriefExtra oldExtra = goodsPicture.getGoods();
|
| | | if (oldExtra == null) {
|
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数 |
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数 |
| | | long diff = System.currentTimeMillis() - oldExtra.getUpdatetime().getTime(); |
| | | long day = diff / nd;// 计算差多少天 |
| | | long hour = diff % nd / nh + day * 24;// 计算差多少小时 |
| | | if (hour < 1) {
|
| | | continue;
|
| | | }
|
| | | |
| | | isupdate = true;
|
| | | try {
|
| | | TaoBaoGoodsBrief goodsBrief = redisManager.getTaoBaoGoodsBrief(oldExtra.getAuctionId());
|
| | | TaoBaoGoodsBriefExtra newExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null);
|
| | |
| | | newExtra.setUpdatetime(new Date());
|
| | | goodsPicture.setGoods(newExtra);
|
| | |
|
| | | BigDecimal money = taoBaoGoodsBriefService.getShareGoodsUserHongBao(goodsBrief);
|
| | | shareMoney = MoneyBigDecimalUtil.add(shareMoney, money);
|
| | | |
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | | if (classId == 1) {
|
| | | BigDecimal money = taoBaoGoodsBriefService.getShareGoodsUserHongBao(goodsBrief);
|
| | | shareMoney = MoneyBigDecimalUtil.add(shareMoney, money);
|
| | | }
|
| | |
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | oldExtra.setState(1);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if (shareMoney != null) {
|
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | | if (classId == 1) {
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | | shareMoneyDesc.setColor("#FFFFFF");
|
| | | shareMoneyDesc.setBottomColor("#E8AE48");
|
| | |
| | | dynamicInfo.setDesc(shareMoneyDesc);
|
| | | }
|
| | |
|
| | | if (isupdate) {
|
| | | dynamicInfoDao.updateGoodInfo(dynamicInfo);
|
| | | }
|
| | | dynamicInfo.setImgs(imgs);
|
| | | dynamicInfo.setUpdateTime(new Date());
|
| | | dynamicInfoDao.updateGoodInfo(dynamicInfo);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | dynamicInfo.setShareCount(existInfo.getShareCount());
|
| | | } else {
|
| | | dynamicInfo.setCreateTime(new Date());
|
| | | dynamicInfo.setUpdateTime(new Date());
|
| | | dynamicInfo.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | }
|
| | |
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|