...
|
...
|
@@ -7,21 +7,20 @@ import com.google.common.collect.Maps; |
|
|
import com.google.common.collect.Sets;
|
|
|
import com.yoho.core.dal.datasource.annotation.Database;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.service.model.social.request.BaseReqBO;
|
|
|
import com.yoho.service.model.social.request.UicUserReqBO;
|
|
|
import com.yoho.service.model.social.response.UserInfoRspBO;
|
|
|
import com.yohobuy.platform.common.exception.PlatformException;
|
|
|
import com.yohobuy.platform.common.helper.ImagesHelper;
|
|
|
import com.yohobuy.platform.common.util.DateUtil;
|
|
|
import com.yohobuy.platform.dal.grass.*;
|
|
|
import com.yohobuy.platform.dal.grass.model.*;
|
|
|
import com.yohobuy.platform.dal.guang.IAuthorDAO;
|
|
|
import com.yohobuy.platform.dal.guang.model.Author;
|
|
|
import com.yohobuy.platform.grass.service.IGrassArticleCommentService;
|
|
|
import com.yohobuy.platform.grass.service.IGrassArticleService;
|
|
|
import com.yohobuy.platform.grass.service.IGrassRefreshCacheService;
|
|
|
import com.yohobuy.platform.model.common.PageResponseVO;
|
|
|
import com.yohobuy.platform.model.grass.request.GrassArticleReq;
|
|
|
import com.yohobuy.platform.model.grass.request.GrassCacheReq;
|
|
|
import com.yohobuy.platform.model.grass.response.ArticleDetailRspBo;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringEscapeUtils;
|
...
|
...
|
@@ -54,7 +53,8 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ |
|
|
|
|
|
@Resource
|
|
|
private IGrassArticleCommentDao grassArticleCommentDao;
|
|
|
|
|
|
@Resource
|
|
|
private IGrassArticlePraiseDao grassArticlePraiseDao;
|
|
|
@Resource
|
|
|
private IGrassArticleLabelDao grassArticleLabelDao;
|
|
|
@Resource
|
...
|
...
|
@@ -65,6 +65,12 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ |
|
|
|
|
|
@Autowired
|
|
|
private ServiceCaller serviceCaller;
|
|
|
@Autowired
|
|
|
private IGrassArticleDeleteLogDao grassArticleDeleteLogDao;
|
|
|
@Autowired
|
|
|
private IUserFavoriteArticleDao userFavoriteArticleDao;
|
|
|
@Autowired
|
|
|
private IGrassRefreshCacheService grassRefreshCacheService;
|
|
|
|
|
|
private final static String BLOCK_TEXT = "text";
|
|
|
private final static String BLOCK_IMAGE = "image";
|
...
|
...
|
@@ -648,6 +654,30 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ |
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void deleteArticle(GrassArticleReq req) throws PlatformException {
|
|
|
int articleId = req.getArticleId();
|
|
|
int flag = grassArticleDao.deleteById(articleId);
|
|
|
logger.info("after deleteArticle,flag is {},articleId is {}",flag,articleId);
|
|
|
if(flag == 0){
|
|
|
return;
|
|
|
}
|
|
|
grassArticleBlockDao.deleteByArticleId(articleId);
|
|
|
grassArticleCommentDao.deleteByDestIdAndColumnType(articleId,GrassArticleComment.ColumnType.ARTICLE.getValue());
|
|
|
grassArticlePraiseDao.deleteByArticleId(articleId);
|
|
|
userFavoriteArticleDao.deleteByArticleId(articleId);
|
|
|
grassArticleLabelDao.deleteByArticleId(articleId);
|
|
|
grassArticleProductDao.deleteByArticleId(articleId);
|
|
|
|
|
|
GrassArticleDeleteLog grassArticleDeleteLog = new GrassArticleDeleteLog(articleId,req.getAuthorizeAccount(), DateUtil.getCurrentTimeSeconds());
|
|
|
grassArticleDeleteLogDao.insertByGrassArticleDeleteLog(grassArticleDeleteLog);
|
|
|
//TODO 清空缓存,cdn啥的
|
|
|
GrassCacheReq cacheReq = new GrassCacheReq();
|
|
|
cacheReq.setClearCode(GrassCacheReq.CLEARCODE_ARTICLE);
|
|
|
cacheReq.setElementId(String.valueOf(articleId));
|
|
|
grassRefreshCacheService.refreshGrassCache(cacheReq);
|
|
|
}
|
|
|
|
|
|
private List<ArticleDetailRspBo> buildArticleDetail( List<GrassArticle> articleList){
|
|
|
if(CollectionUtils.isEmpty(articleList)){
|
|
|
return new ArrayList<>();
|
...
|
...
|
|