From aa4d4bef768a63ac7337b0bd8ddf3dfe4df621b3 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 5 Jun 2020 14:47:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=8D=89=E7=A8=BF=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=96=87=E7=AB=A0=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/DraftConstant.java | 20 +++++++ .../main/java/com/epmet/dao/ArticleDao.java | 2 +- .../service/impl/ArticleServiceImpl.java | 58 ++++++++++--------- .../src/main/resources/mapper/ArticleDao.xml | 24 ++++++-- 4 files changed, 70 insertions(+), 34 deletions(-) diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java index 26bbba7918..6788069282 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java @@ -41,4 +41,24 @@ public interface DraftConstant { * 不置顶:0 */ Integer UN_TOP = 0; + /** + * 组织 + */ + String AGENCY = "agency"; + /** + * 部门 + */ + String DEPARTMENT = "department"; + /** + * 网格 + */ + String GRID = "grid"; + /** + * 内容类型-图片 + */ + String IMG = "img"; + /** + * 内容类型-文字 + */ + String TEXT = "text"; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java index 9946d010b2..31c744610a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java @@ -91,7 +91,7 @@ public interface ArticleDao extends BaseDao { * @param gridList * @return java.util.List */ - @DataFilter(tableAliases = "a", gridIdArgName = "gridList") + @DataFilter(tableAliases = "apr", gridIdArgName = "gridList") List selectOfflineList(Set gridList); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index d4f9ec603d..37c457dc52 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -45,10 +45,7 @@ import com.epmet.entity.*; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.redis.ArticleRedis; -import com.epmet.service.ArticleOperateRecordService; -import com.epmet.service.ArticlePublishRangeService; -import com.epmet.service.ArticleService; -import com.epmet.service.ArticleVisitRecordService; +import com.epmet.service.*; import com.epmet.utils.ModuleConstant; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -80,6 +77,8 @@ public class ArticleServiceImpl extends BaseServiceImpl 50) { + content = content.substring(0, 50); + } + draftEntity.setPreviewContent(content); + break; + } + } draftDao.updateById(draftEntity); } else { @@ -227,6 +235,16 @@ public class ArticleServiceImpl extends BaseServiceImpl 50) { + content = content.substring(0, 50); + } + draftEntity.setPreviewContent(content); + break; + } + } draftDao.insert(draftEntity); } @@ -241,9 +259,7 @@ public class ArticleServiceImpl extends BaseServiceImpl draftIdMap = new HashMap<>(); draftIdMap.put("DRAFT_ID", fromDTO.getDraftId()); draftContentDao.deleteByMap(draftIdMap); - //TODO 改为批量插入 - draftContentList.forEach(content -> draftContentDao.insert(content)); - + draftContentService.insertBatch(draftContentList); return draftId; } @@ -283,7 +299,10 @@ public class ArticleServiceImpl extends BaseServiceImpl gridIdList = Arrays.asList("1","2","d5e746de405cb38479fccea3228b0fa4"); - List agencyGridNameList = new ArrayList<>(); - List publishRangeEntityList = new ArrayList<>(); - TokenDto tokenDto = new TokenDto(); - tokenDto.setCustomerId("1"); - - DraftAttrFromDTO fromDTO = new DraftAttrFromDTO(); - fromDTO.setGridIdList(gridIdList); - //buildName(tokenDto,agencyGridNameList, publishRangeEntityList,fromDTO, articleGridResultDTOS); - //buildAgencyGridNames(tokenDto,agencyGridNameList,publishRangeEntityList,fromDTO,articleGridResultDTOS); - System.out.println("组织-网格名称:"+JSON.toJSONString(agencyGridNameList)); - System.out.println("publishRangeEntityList:"+JSON.toJSONString(publishRangeEntityList)); - - } private void buildName(TokenDto tokenDto, List agencyGridNameList, List publishRangeEntityList, DraftAttrFromDTO fromDTO, ArticleGridResultDTO articleGridResultDTO) { List gridIdList = fromDTO.getGridIdList(); @@ -799,8 +800,9 @@ public class ArticleServiceImpl extends BaseServiceImpl params = new HashMap<>(); params.put(ModuleConstant.FIELD_GRID_ID_CAMEL,articleDetailFormDTO.getGridId()); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml index 14f8875696..cb1817ed58 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml @@ -58,15 +58,25 @@ WHERE a.DEL_FLAG = '0' AND a.STATUS_FLAG = 'published' AND a.CUSTOMER_ID = #{customerId} + ORDER BY PUBLISH_DATE DESC, UPDATED_TIME DESC