| | |
| | | import com.yeshi.fanli.dto.taobao.TaoBaoShopDTO;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivityInviteInfo;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivityTaoBaoGoods;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo;
|
| | |
| | | import com.yeshi.fanli.service.inter.dynamic.InviteMaterialService;
|
| | | 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.service.inter.user.QrCodeService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private QrCodeService qrCodeService;
|
| | | |
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | buffer.append("我的邀请码:【邀请码】\n");
|
| | | buffer.append("购物省钱返利券App:【邀请链接】");
|
| | |
|
| | | |
| | | content = content.replaceAll("\\,", "\\,").replaceAll("\\.", "\\。") .replaceAll("\\;", "\\;")
|
| | | .replaceAll("\\!", "\\!").replaceAll("\\?", "\\?").replaceAll("\\:", "\\:");
|
| | | |
| | | ClientTextStyleVO row1 = new ClientTextStyleVO();
|
| | | row1.setColor("#333333");
|
| | | row1.setContent(content + "\n" + buffer.toString());
|
| | |
| | | return goodsPicture;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateShareCount(DynamicInfo record) {
|
| | | dynamicInfoDao.updateShareCount(record);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void insertInviteMaterial(String title, String picUrl, Long activityId, ActivityUser activityUser) {
|
| | | public void insertInviteActivity(RecommendActivity activity) throws Exception{
|
| | |
|
| | | DynamicInfo existInfo = null;
|
| | | if (activityId != null) {
|
| | | existInfo = dynamicInfoDao.getByActivityId(activityId);
|
| | | if (existInfo != null) {
|
| | | dynamicInfoDao.deleteById(existInfo.getId());
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(title)) {
|
| | | title = title.replace("<p>", "");
|
| | | title = title.replace("</p>", "");
|
| | | }
|
| | | String title = activity.getTitle();
|
| | | |
| | | String picUrl = null;
|
| | | List<String> imageList = activity.getImageList();
|
| | | if (imageList != null && imageList.size() > 0) {
|
| | | picUrl = imageList.get(0);
|
| | | }
|
| | |
|
| | | DynamicInfo dynamicVO = new DynamicInfo();
|
| | | if (StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(picUrl)) {
|
| | | return;
|
| | | }
|
| | | |
| | | // 判断是否已存在
|
| | | String dynamicInfoId = null;
|
| | | |
| | | Long activityId = activity.getId();
|
| | | DynamicInfo dynamicVO = dynamicInfoDao.getByActivityId(activityId);
|
| | | if (dynamicVO == null) {
|
| | | dynamicVO = new DynamicInfo();
|
| | | dynamicVO.setId(UUID.randomUUID().toString().replace("-", ""));
|
| | | dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date(), 8));
|
| | | } else {
|
| | | dynamicInfoId = dynamicVO.getId();
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(title)) {
|
| | | title = title.replaceAll("<p>", "").replaceAll("</p>", "").replaceAll("<br>", "\n");
|
| | | |
| | | int index = title.lastIndexOf("\n");
|
| | | String newDesc = title.substring(index + 1);
|
| | | if(StringUtil.isNullOrEmpty(newDesc)) {
|
| | | title = title.substring(0, index);
|
| | | }
|
| | | |
| | | title = title.replaceAll("\\,", "\\,").replaceAll("\\.", "\\。") .replaceAll("\\;", "\\;")
|
| | | .replaceAll("\\!", "\\!").replaceAll("\\?", "\\?").replaceAll("\\:", "\\:");
|
| | | }
|
| | | |
| | | dynamicVO.setId(UUID.randomUUID().toString().replace("-", ""));
|
| | | dynamicVO.setActivityId(activityId);
|
| | | dynamicVO.setClassId(4L);
|
| | |
| | | dynamicVO.setShareType(DynamicInfo.SHARE_TYPE_INVITE);
|
| | | dynamicVO.setUpdateTime(new Date());
|
| | |
|
| | | if (existInfo != null) {
|
| | | dynamicVO.setCreateTime(existInfo.getCreateTime());
|
| | | dynamicVO.setShareCount(existInfo.getShareCount());
|
| | | } else {
|
| | | dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date(), 8));
|
| | | |
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null || shareCount <= 0) {
|
| | | dynamicVO.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | } else {
|
| | | dynamicVO.setShareCount(shareCount);
|
| | | }
|
| | |
|
| | | // 发布用户
|
| | | ActivityUser activityUser = activity.getActivityUser();
|
| | | if (activityUser == null) {
|
| | | dynamicVO.setUser(activityUserService.listRand(1).get(0));
|
| | | dynamicVO.setUser(activityUserService.selectByPrimaryKey(2L));
|
| | | } else {
|
| | | dynamicVO.setUser(activityUser);
|
| | | }
|
| | |
|
| | |
|
| | | // 介绍内容
|
| | | List<ClientTextStyleVO> listtitle = new ArrayList<ClientTextStyleVO>();
|
| | | |
| | | |
| | | List<GoodsPicture> listImg = new ArrayList<GoodsPicture>();
|
| | | if(StringUtil.isNullOrEmpty(picUrl)) {
|
| | | dynamicVO.setImgs(listImg);
|
| | | dynamicVO.setShowType(DynamicInfo.SHOW_TYPE_ZERO);
|
| | | |
| | | // 介绍内容
|
| | | SimpleDateFormat format = new SimpleDateFormat("MM月dd日");
|
| | | StringBuffer buffer = new StringBuffer();
|
| | | buffer.append("-------------------\n");
|
| | | buffer.append("今天 : " + format.format(new Date()));
|
| | | buffer.append(" ");
|
| | | buffer.append(DateLunarUtil.getWeekd(new Date()) + "\n");
|
| | | buffer.append("各位亲爱的你");
|
| | | buffer.append(" ");
|
| | | buffer.append("早安~\n");
|
| | | buffer.append("我的邀请码:【邀请码】\n");
|
| | | buffer.append("购物省钱返利券App:【邀请链接】");
|
| | | |
| | | if(!StringUtil.isNullOrEmpty(title)) {
|
| | | ClientTextStyleVO row1 = new ClientTextStyleVO();
|
| | | row1.setColor("#333333");
|
| | | row1.setContent(title + "\n" + buffer.toString());
|
| | | |
| | | row1.setContent(title );
|
| | | listtitle.add(row1);
|
| | | dynamicVO.setTitle(listtitle);
|
| | | dynamicInfoDao.insert(dynamicVO);
|
| | | }
|
| | | |
| | | |
| | | // 图片
|
| | | List<GoodsPicture> listImg = new ArrayList<GoodsPicture>();
|
| | | if(StringUtil.isNullOrEmpty(picUrl)) {
|
| | | dynamicVO.setShowType(DynamicInfo.SHOW_TYPE_ZERO);
|
| | | } else {
|
| | | try {
|
| | | dynamicVO.setTitle(listtitle);
|
| | | dynamicVO.setShowType(DynamicInfo.SHOW_TYPE_ONE);
|
| | | |
| | | // 图片
|
| | | String imgLink = qrCodeService.drawInviteQrCodeNew(picUrl , null, null, null);
|
| | | GoodsPicture p2 = new GoodsPicture();
|
| | | p2.setW(100);
|
| | | p2.setH(100);
|
| | | p2.setUrl(imgLink);
|
| | | p2.setUrlOriginal(picUrl);
|
| | | listImg.add(p2);
|
| | | dynamicVO.setImgs(listImg);
|
| | | |
| | | |
| | | dynamicInfoDao.insert(dynamicVO);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | dynamicVO.setShowType(DynamicInfo.SHOW_TYPE_ONE);
|
| | | RecommendActivityInviteInfo inviteInfo = activity.getInviteInfo();
|
| | | |
| | | Integer pX = null; |
| | | Integer pY = null;
|
| | | Integer size = null;
|
| | | if (inviteInfo != null) {
|
| | | pX = inviteInfo.getPx();
|
| | | pY = inviteInfo.getPy();
|
| | | size = inviteInfo.getSize();
|
| | | }
|
| | | |
| | | // 图片
|
| | | String imgLink = qrCodeService.drawInviteQrCodeNew(picUrl , null, null, pX, pY, size, null);
|
| | | GoodsPicture p2 = new GoodsPicture();
|
| | | p2.setW(100);
|
| | | p2.setH(100);
|
| | | p2.setUrl(imgLink);
|
| | | p2.setUrlOriginal(picUrl);
|
| | | p2.setPx(pX);
|
| | | p2.setPy(pY);
|
| | | p2.setSize(size);
|
| | | |
| | | listImg.add(p2);
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public void removeByDate(Date createTime) {
|
| | | dynamicInfoDao.removeByDate(createTime);
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 更新商品信息
|
| | | */
|
| | | public void updateGoodInfo(List<DynamicInfo> list) {
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | dynamicVO.setImgs(listImg);
|
| | | dynamicVO.setTitle(listtitle);
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(dynamicInfoId)) {
|
| | | dynamicInfoDao.deleteById(dynamicInfoId);
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | | |
| | | // 是否一个小时之内已更新
|
| | | 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;
|
| | | }
|
| | | |
| | | Integer state = oldExtra.getState();
|
| | | if (state != null && state == 1) {
|
| | | continue;
|
| | | }
|
| | | |
| | | try {
|
| | | TaoBaoGoodsBrief goodsBrief = redisManager.getTaoBaoGoodsBrief(oldExtra.getAuctionId());
|
| | | TaoBaoGoodsBriefExtra newExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null);
|
| | | |
| | | if (!newExtra.isCoupon()) {
|
| | | newExtra.setState(1);
|
| | | }
|
| | | newExtra.setUpdatetime(new Date());
|
| | | newExtra.setTkRate(goodsBrief.getTkRate());
|
| | | goodsPicture.setGoods(newExtra);
|
| | | |
| | | |
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | | if (classId == 1) {
|
| | | BigDecimal money = taoBaoGoodsBriefService.getShareGoodsUserHongBao(goodsBrief);
|
| | | shareMoney = MoneyBigDecimalUtil.add(shareMoney, money);
|
| | | }
|
| | | |
| | | } catch (TaobaoGoodsDownException e) {
|
| | | oldExtra.setState(1);
|
| | | oldExtra.setCoupon(false);
|
| | | oldExtra.setUpdatetime(new Date());
|
| | | goodsPicture.setGoods(oldExtra);
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | | if (classId == 1) {
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | | shareMoneyDesc.setColor("#FFFFFF");
|
| | | shareMoneyDesc.setBottomColor("#E8AE48");
|
| | | shareMoneyDesc.setContent("预估分享奖金:¥" + shareMoney);
|
| | | dynamicInfo.setDesc(shareMoneyDesc);
|
| | | }
|
| | | |
| | | dynamicInfo.setImgs(imgs);
|
| | | dynamicInfo.setUpdateTime(new Date());
|
| | | dynamicInfoDao.updateGoodInfo(dynamicInfo);
|
| | | }
|
| | | dynamicInfoDao.insert(dynamicVO);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void deleteActivity(Long activityId) {
|
| | | DynamicInfo dynamicInfo = dynamicInfoDao.getByActivityId(activityId);
|
| | | if (dynamicInfo != null) {
|
| | | // 删除之前的
|
| | | dynamicInfoDao.deleteById(dynamicInfo.getId());
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void saveActivityRecommend(RecommendActivity activity) {
|
| | | public void insertActivityRecommend(RecommendActivity activity) {
|
| | | if (activity == null || activity.getGoodsList() == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | DynamicInfo existInfo = dynamicInfoDao.getByActivityId(activity.getId());
|
| | | if (existInfo != null) {
|
| | | dynamicInfoDao.deleteById(existInfo.getId());
|
| | | String dynamicInfoId = null;
|
| | | DynamicInfo dynamicInfo = dynamicInfoDao.getByActivityId(activity.getId());
|
| | | if (dynamicInfo == null) {
|
| | | dynamicInfo = new DynamicInfo();
|
| | | dynamicInfo.setId(UUID.randomUUID().toString().replace("-", ""));
|
| | | dynamicInfo.setCreateTime(new Date());
|
| | | } else {
|
| | | dynamicInfoId = dynamicInfo.getId();
|
| | | }
|
| | |
|
| | | DynamicInfo dynamicInfo = new DynamicInfo();
|
| | | dynamicInfo.setId(UUID.randomUUID().toString().replace("-", ""));
|
| | | dynamicInfo.setClassId(2L);
|
| | | dynamicInfo.setSubclassId(0L);
|
| | | dynamicInfo.setUser(activity.getActivityUser());
|
| | | dynamicInfo.setActivityId(activity.getId());
|
| | | dynamicInfo.setUpdateTime(new Date());
|
| | |
|
| | | |
| | | List<ClientTextStyleVO> listtitle = new ArrayList<ClientTextStyleVO>();
|
| | | String title = activity.getTitle();
|
| | | if (!StringUtil.isNullOrEmpty(title)) {
|
| | | title = title.replace("<p>", "");
|
| | | title = title.replace("</p>", "");
|
| | | dynamicInfo.setTitle(convertIntroduce(title));
|
| | | title = title.replaceAll("<p>", "");
|
| | | title = title.replaceAll("</p>", "");
|
| | | title = title.replaceAll("<br>", "\n");
|
| | | |
| | | int index = title.lastIndexOf("\n");
|
| | | String newDesc = title.substring(index + 1);
|
| | | if(StringUtil.isNullOrEmpty(newDesc)) {
|
| | | title = title.substring(0, index);
|
| | | }
|
| | | |
| | | ClientTextStyleVO row1 = new ClientTextStyleVO();
|
| | | row1.setColor("#333333");
|
| | | row1.setContent(title );
|
| | | listtitle.add(row1);
|
| | | }
|
| | | dynamicInfo.setTitle(listtitle);
|
| | | |
| | | |
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null || shareCount <= 0) {
|
| | | dynamicInfo.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | } else {
|
| | | dynamicInfo.setShareCount(shareCount);
|
| | | }
|
| | |
|
| | | if (existInfo != null) {
|
| | | dynamicInfo.setCreateTime(existInfo.getCreateTime());
|
| | | dynamicInfo.setShareCount(existInfo.getShareCount());
|
| | | // 发布用户
|
| | | ActivityUser activityUser = activity.getActivityUser();
|
| | | if (activityUser == null) {
|
| | | dynamicInfo.setUser(activityUserService.selectByPrimaryKey(2L));
|
| | | } else {
|
| | | dynamicInfo.setCreateTime(new Date());
|
| | | dynamicInfo.setUpdateTime(new Date());
|
| | | dynamicInfo.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | dynamicInfo.setUser(activityUser);
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
| | | dynamicInfo.setShowType(DynamicInfo.SHOW_TYPE_THREE);
|
| | | dynamicInfo.setShareType(DynamicInfo.SHARE_TYPE_NINE); // 分享类型9图
|
| | | }
|
| | | |
| | | |
| | | if (!StringUtil.isNullOrEmpty(dynamicInfoId)) {
|
| | | dynamicInfoDao.deleteById(dynamicInfoId);
|
| | | }
|
| | | // 保存信息
|
| | | dynamicInfoDao.insert(dynamicInfo);
|
| | |
|
| | |
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void deleteActivity(Long activityId) {
|
| | | DynamicInfo dynamicInfo = dynamicInfoDao.getByActivityId(activityId);
|
| | | if (dynamicInfo != null) {
|
| | | // 删除之前的
|
| | | dynamicInfoDao.deleteById(dynamicInfo.getId());
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void removeByDate(Date createTime) {
|
| | | dynamicInfoDao.removeByDate(createTime);
|
| | | }
|
| | | |
| | | @Override
|
| | | public void updateShareCount(DynamicInfo record) {
|
| | | dynamicInfoDao.updateShareCount(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Cacheable(value = "dynamicCache", key = "'count-'+#cid+'-'+#subId")
|
| | |
| | |
|
| | | return list;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 更新商品信息
|
| | | */
|
| | | public void updateGoodInfo(List<DynamicInfo> list) {
|
| | | |
| | | // 外网进行更新
|
| | | if (!Constant.IS_OUTNET) {
|
| | | return;
|
| | | }
|
| | | |
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | | 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;
|
| | | }
|
| | | |
| | | // 是否一个小时之内已更新
|
| | | 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;
|
| | | }
|
| | | }
|
| | | |
| | | // 已下架ID
|
| | | List<Long> listDown = new ArrayList<Long>();
|
| | | // 商品列表
|
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | |
| | | for (GoodsPicture goodsPicture: imgs) {
|
| | | TaoBaoGoodsBriefExtra oldExtra = goodsPicture.getGoods();
|
| | | if (oldExtra == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | Integer state = oldExtra.getState();
|
| | | if (state != null && state == 1) {
|
| | | continue;
|
| | | }
|
| | | |
| | | try {
|
| | | TaoBaoGoodsBrief goodsBrief = redisManager.getTaoBaoGoodsBrief(oldExtra.getAuctionId());
|
| | | |
| | | // 更新商品信息
|
| | | try {
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(goodsBrief);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | listGoods.add(goodsBrief);
|
| | | |
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | | if (classId == 1) {
|
| | | BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(goodsBrief);
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | | shareMoneyDesc.setColor("#FFFFFF");
|
| | | shareMoneyDesc.setBottomColor("#E8AE48");
|
| | | shareMoneyDesc.setContent("预估分享奖金:¥" + shareMoney);
|
| | | dynamicInfo.setDesc(shareMoneyDesc);
|
| | | }
|
| | | |
| | | TaoBaoGoodsBriefExtra newExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null);
|
| | | |
| | | if (!newExtra.isCoupon()) {
|
| | | newExtra.setState(1);
|
| | | }
|
| | | newExtra.setUpdatetime(new Date());
|
| | | goodsPicture.setGoods(oldExtra);
|
| | | |
| | | } catch (TaobaoGoodsDownException e) {
|
| | | listDown.add(oldExtra.getAuctionId());
|
| | | |
| | | oldExtra.setState(1);
|
| | | oldExtra.setCoupon(false);
|
| | | oldExtra.setUpdatetime(new Date());
|
| | | goodsPicture.setGoods(oldExtra);
|
| | | |
| | | // 商品真实下架
|
| | | goodsPicture.setGoodState(1);
|
| | | |
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | | if (classId == 1) {
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | | shareMoneyDesc.setColor("#FFFFFF");
|
| | | shareMoneyDesc.setBottomColor("#E8AE48");
|
| | | shareMoneyDesc.setContent("预估分享奖金:¥" + new BigDecimal(0));
|
| | | dynamicInfo.setDesc(shareMoneyDesc);
|
| | | }
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | dynamicInfo.setImgs(imgs);
|
| | | |
| | | // 商品已下架
|
| | | List<TaoBaoGoodsBrief> listGoodsBrief = dynamicInfo.getListGoodsBrief();
|
| | | if (listGoodsBrief != null && listGoodsBrief.size() > 0) {
|
| | | |
| | | if (listGoods.size() > 0 ) {
|
| | | if (classId == 1) {
|
| | | dynamicInfo.setListGoodsBrief(listGoods);
|
| | | } else {
|
| | | for (int i =0; i < listGoodsBrief.size(); i ++) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = listGoodsBrief.get(i);
|
| | | Long auctionId = taoBaoGoodsBrief.getAuctionId();
|
| | | |
| | | boolean isadd = true;
|
| | | for (TaoBaoGoodsBrief goods: listGoods) {
|
| | | if(goods.getAuctionId().equals(auctionId) || goods.getAuctionId() == auctionId) {
|
| | | isadd = false;
|
| | | break;
|
| | | } |
| | | }
|
| | | |
| | | if (isadd) {
|
| | | // 商品已下架 则添加原来商品信息
|
| | | if (listDown.size() > 0 && listDown.contains(taoBaoGoodsBrief.getAuctionId())) {
|
| | | taoBaoGoodsBrief.setState(1);
|
| | | }
|
| | | listGoods.add(taoBaoGoodsBrief);
|
| | | }
|
| | | }
|
| | | dynamicInfo.setListGoodsBrief(listGoods);
|
| | | }
|
| | | } else {
|
| | | if (listDown.size() > 0) {
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief: listGoodsBrief) {
|
| | | if (listDown.contains(taoBaoGoodsBrief.getAuctionId())) {
|
| | | taoBaoGoodsBrief.setState(1);
|
| | | }
|
| | | }
|
| | | dynamicInfo.setListGoodsBrief(listGoodsBrief);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | dynamicInfo.setUpdateTime(new Date());
|
| | | dynamicInfoDao.updateGoodInfo(dynamicInfo);
|
| | | }
|
| | | }
|
| | | |
| | | }
|