| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -19,28 +19,33 @@ package com.epmet.service.impl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.AppClientConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.FieldConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.param.ImgScanParamDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.param.ImgTaskDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.param.TextScanParamDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.param.TextTaskDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.scan.result.SyncScanResult; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					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.DateUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ScanContentUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.validator.ValidatorUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.validator.group.AddGroup; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.validator.group.DefaultGroup; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.ArticleConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.DraftConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.RoleKeyConstants; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.TagConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetMessageOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.GovOrgOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.redis.ArticleRedis; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -54,6 +59,7 @@ import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jsoup.helper.StringUtil; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.BeanUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Value; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.util.CollectionUtils; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -111,6 +117,15 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private ArticleDao articleDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private ArticleTagsDao articleTagsDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Value("${openapi.scan.server.host}") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private String scanApiHost; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Value("${openapi.scan.method.imgSyncScan}") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private String imgSyncScanMethod; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Value("${openapi.scan.method.textSyncScan}") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private String textSyncScanMethod; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private static final String AGENCY = "agency"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private static final String GRID = "grid"; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -379,7 +394,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							coverEntity.setCustomerId(tokenDto.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							coverEntity.setDraftId(fromDTO.getDraftId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							coverEntity.setImgUrl(coverImg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							coverEntity.setAuditStatus(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							coverEntity.setAuditStatus(ModuleConstant.AUDIT_STATUS_PASS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							coverEntity.setAuditReason(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							coverEntity.setRevision(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							coverEntity.setDelFlag(NumConstant.ZERO_STR); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -443,6 +458,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setCustomerId(tokenDto.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setDraftId(fromDTO.getDraftId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setOrderNum(i + 1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//默认通过
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								entity.setAuditStatus(ModuleConstant.AUDIT_STATUS_PASS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								newContentList.add(entity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -514,11 +531,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//4:文章操作记录表新增数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//4.1:调用epmet-user服务,查询工作人员信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Result<CustomerStaffDTO> resultStaff = epmetUserOpenFeignClient.getCustomerStaff(formDTO.getStaffId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!resultStaff.success() || null == resultStaff.getData()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								throw new RenException(ArticleConstant.SELECT_STAFF_EXCEPTION); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							CustomerStaffDTO staffDTO = resultStaff.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							CustomerStaffDTO staffDTO = getCustomerStaff(formDTO.getStaffId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//4.2:查询文章表数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							ArticleEntity articleEntity = baseDao.selectById(formDTO.getArticleId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//4.3:新增操作表数据
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -532,6 +545,14 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							articleOperateRecordService.insert(recordEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private CustomerStaffDTO getCustomerStaff(String userId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Result<CustomerStaffDTO> resultStaff = epmetUserOpenFeignClient.getCustomerStaff(userId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!resultStaff.success() || null == resultStaff.getData()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								throw new RenException(ArticleConstant.SELECT_STAFF_EXCEPTION); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return resultStaff.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public PageData publishedArticleList(TokenDto tokenDto, PublishedListFormDTO formDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -805,20 +826,22 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @Description 草稿发布文章 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param draftId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param draft | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @return String 返回新发布文章的Id | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @author wangc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @date 2020.06.05 09:10 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 **/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public String publishDraftToArticle(String draftId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public ArticleEntity publishDraftToArticle(DraftEntity draft) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//1.查找草稿内容
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							DraftEntity draft = draftDao.selectById(draftId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if(null != draft){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								draft.setStatusFlag(DraftConstant.PUBLISHED); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								draftDao.updateById(draft); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//2.查找草稿内容、封面、发布范围
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								List<DraftContentDTO> draftContents = draftContentDao.selectByDraftId(draftId,ModuleConstant.AUDIT_STATUS_PASS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								DraftCoverDTO draftCover = draftCoverDao.selectByDraftId(draftId,ModuleConstant.AUDIT_STATUS_PASS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								String draftId = draft.getId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								List<DraftContentEntity> draftContents = draftContentDao.selectByDraftId(draftId,ModuleConstant.AUDIT_STATUS_PASS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								DraftCoverEntity draftCover = draftCoverDao.selectByDraftId(draftId,ModuleConstant.AUDIT_STATUS_PASS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								List<DraftPublishRangeDTO> draftPublishRange = draftPublishRangeDao.selectByDraftId(draftId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//3.生成文章以及相关记录
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -834,6 +857,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										contentToInsert.setArticleId(article.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										contentToInsert.setId(null); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										articleContentDao.insert(contentToInsert); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										content.setAuditStatus(ModuleConstant.AUDIT_STATUS_PASS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										draftContentDao.updateById(content); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								if(null != draftPublishRange && draftPublishRange.size() > NumConstant.ZERO){ | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -848,51 +874,144 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										coverToInsert.setArticleId(article.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										coverToInsert.setId(null); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										articleCoverDao.insert(coverToInsert); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										draftCover.setAuditStatus(ModuleConstant.AUDIT_STATUS_PASS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										draftCoverDao.updateById(draftCover); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return article.getId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//4.3:新增操作表数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								CustomerStaffDTO staffDTO = getCustomerStaff(loginUserUtil.getLoginUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								ArticleOperateRecordEntity recordEntity = new ArticleOperateRecordEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								recordEntity.setCustomerId(article.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								recordEntity.setArticleId(article.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								recordEntity.setOpUser(article.getPublisherName() + "-" + staffDTO.getRealName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								recordEntity.setContent(String.format(ArticleConstant.PUBLISH_ARTICLE_MSG, article.getPublisherName(), staffDTO.getRealName(), article.getTitle())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								recordEntity.setOpType(ArticleConstant.OFFLINE); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								recordEntity.setOpTime(new Date()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								articleOperateRecordService.insert(recordEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return article; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							throw new RenException(String.format(ModuleConstant.SPECIFIED_DRAFT_NOT_FOUNT_EXCEPTION_TEMPLATE,draftId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							throw new RenException(String.format(ModuleConstant.SPECIFIED_DRAFT_NOT_FOUNT_EXCEPTION_TEMPLATE,draft.getId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public void scanContent(String draftId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public SyncScanResult scanContent(TokenDto tokenDto, String draftId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							DraftEntity draftEntity = draftDao.selectById(draftId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (draftEntity == null){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								log.error("scanContent draftId:{} is not exist",draftId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!DraftConstant.AUDITING.equals(draftEntity.getStatusFlag())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								log.error("scanContent draftId:{} statusFlag:{} is not support 2 modify",draftId,draftEntity.getStatusFlag()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!NumConstant.ONE_STR.equals(draftEntity.getDelFlag())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								log.error("scanContent draftId:{} delFlag:{} is not support 2 modify",draftId,draftEntity.getDelFlag()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String,String> imgMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Map<String,String> textMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							DraftCoverDTO draftCoverDTO = draftCoverDao.selectCoverIdAndUrlByDraftId(draftId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (draftCoverDTO != null){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								imgMap.put(ModuleConstant.SCAN_COVER_PREFIX.concat(draftCoverDTO.getId()), draftCoverDTO.getImgUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								ImgTaskDTO taskDTO = new ImgTaskDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								taskDTO.setDataId(ModuleConstant.SCAN_COVER_PREFIX.concat(draftCoverDTO.getId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								taskDTO.setUrl(draftCoverDTO.getImgUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								imgScanParamDTO.getTasks().add(taskDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<DraftContentDTO> contentDTOList = draftContentDao.selectScanContentByDraftId(draftId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<DraftContentEntity> contentDTOList = draftContentDao.selectScanContentByDraftId(draftId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if(!CollectionUtils.isEmpty(contentDTOList)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								contentDTOList.forEach(content->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									String contentType = content.getContentType(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if (DraftConstant.TEXT.equals(contentType)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										//todo 内容叠加审核吧 id拼起来
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										textMap.put(content.getId(),content.getContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										TextTaskDTO textTaskDTO = new TextTaskDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										textTaskDTO.setDataId(content.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										textTaskDTO.setContent(content.getContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}else if (DraftConstant.IMG.equals(contentType)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										imgMap.put(draftCoverDTO.getId(), draftCoverDTO.getImgUrl()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										ImgTaskDTO taskDTO = new ImgTaskDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										taskDTO.setDataId(content.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										taskDTO.setUrl(content.getContent()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										imgScanParamDTO.getTasks().add(taskDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//todo 执行审核
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							SyncScanResult imgSyncScanResult = ScanContentUtils.imgSyncScan(scanApiHost.concat(imgSyncScanMethod),imgScanParamDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							SyncScanResult textSyncScanResult = ScanContentUtils.textSyncScan(scanApiHost.concat(textSyncScanMethod),textScanParamDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							SyncScanResult result = new SyncScanResult(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (imgSyncScanResult.isAllPass()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.setAllPass(imgSyncScanResult.isAllPass()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.getSuccessDataIds().addAll(imgSyncScanResult.getSuccessDataIds()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.getFailDataIds().addAll(imgSyncScanResult.getFailDataIds()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (textSyncScanResult.isAllPass()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.setAllPass(result.isAllPass()?textSyncScanResult.isAllPass():false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.getSuccessDataIds().addAll(textSyncScanResult.getSuccessDataIds()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								result.getFailDataIds().addAll(textSyncScanResult.getFailDataIds()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public void scanAllPassPublishArticle(TokenDto tokenDto, String draftId){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							DraftEntity draft = draftDao.selectById(draftId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (draft == null){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//审核通过
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								ArticleEntity articleEntity = this.publishDraftToArticle(draft); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								List<UpdateGridTagCacheDTO> updateGridTagCacheDTOS = this.updateGridTag(tokenDto, draftId, updateCustomerTagCacheDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//更新redis
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									this.updateCacheCustomerTag(updateCustomerTagCacheDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									this.updateCacheGridTag(updateGridTagCacheDTOS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} catch (Exception e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									log.error("scanAllPassPublishArticle update redis exception", e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} catch (Exception e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								log.error("scanAllPassPublishArticle update db exception", e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								this.sendMsg(draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public void updateAuditStatusFailById(String draftId,SyncScanResult syncScanResult) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<String> failDataIds = syncScanResult.getFailDataIds(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							failDataIds.forEach(id->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX)>=0){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									draftCoverDao.updateAuditStatusById(id,ModuleConstant.AUDIT_STATUS_FAIL); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								}else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									draftContentDao.updateAuditStatusById(id,ModuleConstant.AUDIT_STATUS_FAIL); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public Result sendMsg(String title,String content) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							UserMessageFormDTO formDTO = new UserMessageFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							formDTO.setCustomerId(loginUserUtil.getLoginUserApp()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							formDTO.setGridId(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							formDTO.setUserId(loginUserUtil.getLoginUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							formDTO.setApp(AppClientConstant.APP_GOV); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							formDTO.setTitle(String.format(ModuleConstant.MSG_TITLE,title)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							formDTO.setMessageContent(content); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							formDTO.setReadFlag(ReadFlagConstant.UN_READ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return epmetMessageOpenFeignClient.saveUserMessage(formDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -900,7 +1019,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param draftId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public UpdateCustomerTagCacheDTO updateCustomerTag(TokenDto tokenDto, String draftId){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//获取草稿基本信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							DraftDTO draft = draftService.get(draftId); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -952,7 +1070,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param formDto | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public List<UpdateGridTagCacheDTO> updateGridTag(TokenDto tokenDto,String draftId,UpdateCustomerTagCacheDTO formDto){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//获取草稿基本信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							DraftDTO draft = draftService.get(draftId); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |