Authored by peuei

fix 公共库将文章表改为逻辑删除

package com.yoho.datasync.consumer.handler.listener;
import com.yoho.datasync.consumer.common.ContentConvertUtil;
import com.yoho.datasync.consumer.common.EventEnum;
import com.yoho.datasync.consumer.handler.helper.AnnotationClassFactory;
import com.yoho.datasync.consumer.handler.mqcomponent.AbstractMqListener;
... ... @@ -16,7 +15,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map;
/***
* @author peuei
... ...
package com.yoho.datasync.consumer.service;
import com.yoho.datasync.consumer.common.BeanCopyUtils;
import com.yoho.datasync.consumer.common.ContentConvertUtil;
import com.yoho.datasync.consumer.common.ServiceConstant;
import com.yoho.datasync.consumer.dal.repository.PublicArticleBlockRepository;
import com.yoho.datasync.consumer.dal.repository.PublicArticleRepository;
... ... @@ -11,7 +10,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
@Service
public class PublicArticleBlockService {
... ... @@ -64,7 +62,7 @@ public class PublicArticleBlockService {
findByArticleIdAndCreateTimeAndOrderBy(targetObject.getArticleId(), targetObject.getCreateTime(), targetObject.getOrderBy());
if (flag) {
if (existObject == null) {
log.error("something goes wrong ... data is null...");
log.error("something goes wrong ... data is null... with param {}", targetObject.toString());
return;
}
publicArticleBlockRepository.deleteById(existObject.getId());
... ...
... ... @@ -48,7 +48,7 @@ public class PublicArticleLabelService {
public void updateData(PublicArticleLabel targetObject) {
final PublicArticleLabel existObject = publicArticleLabelRepository.findByLabelIdAndArticleId(targetObject.getLabelId(), targetObject.getArticleId());
if (existObject != null) {
log.error("something goes wrong, in this operation, there's no update , just only insert , with param {}", targetObject);
log.error("something goes wrong, in this operation, there's no update , just only insert , with param {}", targetObject.toString());
return;
}
publicArticleLabelRepository.save(targetObject);
... ...
... ... @@ -55,7 +55,7 @@ public class PublicArticleProductService {
final PublicArticleProduct existObject = publicArticleProductRepository.
findByArticleIdAndProductSknAndCreateTimeAndOrderBy(targetObject.getArticleId(), targetObject.getProductSkn(), targetObject.getCreateTime(), targetObject.getOrderBy());
if (existObject == null) {
log.error("something goes wrong ... data is null");
log.error("something goes wrong ... data is null , with param {}", targetObject.toString());
return;
}
publicArticleProductRepository.deleteById(existObject.getId());
... ...
... ... @@ -25,6 +25,8 @@ public class PublicArticleService {
@Resource
private PublicArticleAuditRepository publicArticleAuditRepository;
private static final Integer DELETE = 2;
/**
* 删除数据
*
... ... @@ -36,7 +38,12 @@ public class PublicArticleService {
log.info("get nothing from database by condition relateId and articleType with targetObject {}", targetObject.toString());
return;
}
publicArticleRepository.deleteById(existObject.getId());
existObject.setStatus(DELETE);
/**
* 2019.4.4 将文章表改为逻辑删除
*/
publicArticleRepository.save(existObject);
// publicArticleRepository.deleteById(existObject.getId());
}
... ... @@ -54,6 +61,7 @@ public class PublicArticleService {
boolean mark = true;
PublicArticle saveObject;
if (existObject != null) {
// update
mark = false;
targetObject.setCoverImg((String) checkResult);
if (targetObject.getId() != null) {
... ... @@ -71,6 +79,7 @@ public class PublicArticleService {
publicArticleAuditHandler(publicArticleAudit, existObject);
saveObject = publicArticleRepository.save(existObject);
} else {
// insert
saveObject = publicArticleRepository.save(targetObject);
}
if (mark) {
... ...