|
@ -28,13 +28,9 @@ import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.constant.DraftConstant; |
|
|
import com.epmet.constant.DraftConstant; |
|
|
import com.epmet.dao.DraftContentDao; |
|
|
import com.epmet.dao.*; |
|
|
import com.epmet.dao.DraftCoverDao; |
|
|
|
|
|
import com.epmet.dao.DraftDao; |
|
|
|
|
|
import com.epmet.dao.DraftPublishRangeDao; |
|
|
|
|
|
import com.epmet.dto.DraftDTO; |
|
|
import com.epmet.dto.DraftDTO; |
|
|
import com.epmet.dto.form.DeleteDraftFormDTO; |
|
|
import com.epmet.dto.form.DeleteDraftFormDTO; |
|
|
import com.epmet.dto.form.DraftDetailFormDTO; |
|
|
import com.epmet.dto.form.DraftDetailFormDTO; |
|
@ -52,7 +48,10 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -68,11 +67,11 @@ public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> imp |
|
|
@Autowired |
|
|
@Autowired |
|
|
private DraftCoverDao draftCoverDao; |
|
|
private DraftCoverDao draftCoverDao; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private DraftPublishRangeDao draftPublishRangeDao; |
|
|
private DraftPublishRangeDao draftPublishRangeDao; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private DraftContentDao draftContentDao; |
|
|
private DraftContentDao draftContentDao; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private TagCustomerDao tagCustomerDao; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<DraftDTO> page(Map<String, Object> params) { |
|
|
public PageData<DraftDTO> page(Map<String, Object> params) { |
|
@ -231,7 +230,7 @@ public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> imp |
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
list.forEach(l->{ |
|
|
list.forEach(l->{ |
|
|
l.setTagNameList(StringUtils.isNotBlank(l.getTags())?Arrays.asList(l.getTags().split("[|]")):new ArrayList<>()); |
|
|
l.setTagNameList(StringUtils.isNotBlank(l.getTags())?Arrays.asList(l.getTags().split("[|]")):new ArrayList<>()); |
|
|
l.setIsMePublished(l.getCreatedBy().equals(loginUserUtil.getLoginUserId())?true:false); |
|
|
l.setIsMePublished(l.getCreatedBy().equals(formDTO.getStaffId())?true:false); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -246,6 +245,8 @@ public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> imp |
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
resultDTO = list.get(NumConstant.ZERO); |
|
|
resultDTO = list.get(NumConstant.ZERO); |
|
|
|
|
|
resultDTO.setTagNameList(StringUtils.isNotBlank(resultDTO.getTags())?Arrays.asList(resultDTO.getTags().split("[|]")):new ArrayList<>()); |
|
|
|
|
|
resultDTO.setIsMePublished(resultDTO.getCreatedBy().equals(formDTO.getStaffId())?true:false); |
|
|
//查询文章涉及的发布范围网络Id列表
|
|
|
//查询文章涉及的发布范围网络Id列表
|
|
|
LambdaQueryWrapper<DraftPublishRangeEntity> tWrapper = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<DraftPublishRangeEntity> tWrapper = new LambdaQueryWrapper<>(); |
|
|
tWrapper.eq(DraftPublishRangeEntity::getDraftId, formDTO.getDraftId()); |
|
|
tWrapper.eq(DraftPublishRangeEntity::getDraftId, formDTO.getDraftId()); |
|
@ -268,10 +269,24 @@ public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> imp |
|
|
tWrapper1.eq(DraftContentEntity::getDelFlag, NumConstant.ZERO_STR); |
|
|
tWrapper1.eq(DraftContentEntity::getDelFlag, NumConstant.ZERO_STR); |
|
|
tWrapper1.orderByDesc(DraftContentEntity::getOrderNum); |
|
|
tWrapper1.orderByDesc(DraftContentEntity::getOrderNum); |
|
|
List<DraftContentEntity> contentEntityList = draftContentDao.selectList(tWrapper1); |
|
|
List<DraftContentEntity> contentEntityList = draftContentDao.selectList(tWrapper1); |
|
|
if (!CollectionUtils.isEmpty(entityList)) { |
|
|
if (!CollectionUtils.isEmpty(contentEntityList)) { |
|
|
LinkedList<String> contentList = (LinkedList)contentEntityList.stream().map(DraftContentEntity::getContent).collect(Collectors.toList()); |
|
|
List<String> contentList = contentEntityList.stream().map(DraftContentEntity::getContent).collect(Collectors.toList()); |
|
|
resultDTO.setContentList(contentList); |
|
|
resultDTO.setContentList(contentList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//标签列表
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(resultDTO.getTagNameList())){ |
|
|
|
|
|
LambdaQueryWrapper<TagCustomerEntity> tWrapper2 = new LambdaQueryWrapper<>(); |
|
|
|
|
|
tWrapper2.eq(TagCustomerEntity::getCustomerId, formDTO.getCustomerId()); |
|
|
|
|
|
tWrapper2.in(TagCustomerEntity::getTagName, resultDTO.getTagNameList()); |
|
|
|
|
|
tWrapper2.eq(TagCustomerEntity::getDelFlag, NumConstant.ZERO_STR); |
|
|
|
|
|
List<TagCustomerEntity> tagEntityList = tagCustomerDao.selectList(tWrapper2); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(tagEntityList)) { |
|
|
|
|
|
List<String> contentList = tagEntityList.stream().map(TagCustomerEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
resultDTO.setTagIdList(contentList); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return resultDTO; |
|
|
return resultDTO; |
|
|