Browse Source

党建声音-添加文章标签时 创建时间与文章创建时间保持一致,便于数据统计时跨天问题

dev_shibei_match
jianjun 5 years ago
parent
commit
2d434403b8
  1. 6
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddArticleTagsFormDTO.java
  2. 10
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  3. 5
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml

6
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddArticleTagsFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.form;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* @Author zxc * @Author zxc
@ -53,6 +54,11 @@ public class AddArticleTagsFormDTO implements Serializable {
*/ */
private String createdBy; private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/** /**
* 更新人 * 更新人
*/ */

10
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -1058,13 +1058,13 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
try { try {
//审核通过 //审核通过
this.updateAuditStatusFailById(draftId, syncScanResult); this.updateAuditStatusFailById(draftId, syncScanResult);
this.publishDraftToArticle(draft); ArticleEntity articleEntity = this.publishDraftToArticle(draft);
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId); UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId);
if (updateCustomerTagCacheDTO == null) { if (updateCustomerTagCacheDTO == null) {
return; return;
} }
List<UpdateGridTagCacheDTO> updateGridTagCacheDTOS = this.updateGridTag(tokenDto, draftId, updateCustomerTagCacheDTO); List<UpdateGridTagCacheDTO> updateGridTagCacheDTOS = this.updateGridTag(tokenDto, draftId, updateCustomerTagCacheDTO);
this.addArticleTags(updateCustomerTagCacheDTO, draftId, tokenDto); this.addArticleTags(updateCustomerTagCacheDTO, draftId, tokenDto, articleEntity.getCreatedTime());
//更新redis //更新redis
try { try {
@ -1279,10 +1279,11 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
/** /**
* @param formDto * @param formDto
* @Description 给文章挂标签 article_tags * @param createdTime
* @Description 给文章挂标签 article_tags,创建时间与文章保持一致
* @author zxc * @author zxc
*/ */
public void addArticleTags(UpdateCustomerTagCacheDTO formDto, String draftId, TokenDto tokenDto) { public void addArticleTags(UpdateCustomerTagCacheDTO formDto, String draftId, TokenDto tokenDto, Date createdTime) {
List<AddArticleTagsFormDTO> addArticleTags = new ArrayList<>(); List<AddArticleTagsFormDTO> addArticleTags = new ArrayList<>();
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo(); List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo();
DraftDTO draft = draftService.get(draftId); DraftDTO draft = draftService.get(draftId);
@ -1296,6 +1297,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
addArticleTag.setCustomerId(customerId); addArticleTag.setCustomerId(customerId);
addArticleTag.setArticleId(articleId); addArticleTag.setArticleId(articleId);
BeanUtils.copyProperties(resultDTO, addArticleTag); BeanUtils.copyProperties(resultDTO, addArticleTag);
addArticleTag.setCreatedTime(createdTime);
addArticleTags.add(addArticleTag); addArticleTags.add(addArticleTag);
}); });
articleTagsDao.addArticleTags(addArticleTags); articleTagsDao.addArticleTags(addArticleTags);

5
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml

@ -8,8 +8,9 @@
INSERT INTO article_tags ( ID, CUSTOMER_ID, ARTICLE_ID, TAG_ID, TAG_NAME, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) INSERT INTO article_tags ( ID, CUSTOMER_ID, ARTICLE_ID, TAG_ID, TAG_NAME, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES VALUES
<foreach collection="addArticleTags" item="tag" separator=","> <foreach collection="addArticleTags" item="tag" separator=",">
( REPLACE ( UUID(), '-', '' ),#{tag.customerId}, #{tag.articleId}, #{tag.tagId}, #{tag.tagName}, #{tag.delFlag}, ( REPLACE ( UUID(), '-', '' ),#{tag.customerId}, #{tag.articleId}, #{tag.tagId}, #{tag.tagName},
#{tag.revision}, #{tag.createdBy}, NOW(),#{tag.updatedBy}, NOW()) #{tag.delFlag},
#{tag.revision}, #{tag.createdBy}, #{tag.createdTime,jdbcType=TIMESTAMP},#{tag.updatedBy}, NOW())
</foreach> </foreach>
</select> </select>
<select id="selectInitData" resultType="com.epmet.entity.ArticleTagsEntity"> <select id="selectInitData" resultType="com.epmet.entity.ArticleTagsEntity">

Loading…
Cancel
Save