diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index 83801407f0..b4a81ce53a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -43,4 +43,9 @@ public interface StrConstant { * 冒号 */ String COLON = ":"; + + /** + * 中文顿号 + */ + String COMMA_ZH = "、"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 0df23a82f1..04aabbf38f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -67,6 +67,8 @@ public enum EpmetErrorCode { OPER_UPLOAD_FILE_OVER_SIZE(8707, "文件体积过大"), OPER_UPLOAD_FILE_TYPE_ERROR(8708, "文件类型错误"), + // 党建声音 前端提示 88段 + DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), ARTICLE_PUBLISH_ERROR(8801, "发布文章失败,请刷新重试"), CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"); diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java index 1a81faee29..6d4b81cc2a 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java @@ -20,6 +20,7 @@ package com.epmet.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.List; @@ -34,7 +35,6 @@ import java.util.List; @Data public class DraftAttrFromDTO implements Serializable { - private static final long serialVersionUID = 6463906402283515172L; /** * 草稿ID @@ -61,11 +61,13 @@ public class DraftAttrFromDTO implements Serializable { /** * 网格Id数组 */ + @NotEmpty(message = "发布范围不能为空") private List gridIdList; /** * 发布单位Id 类型不同 id含义不同 */ + @NotBlank(message = "发布单位不能为空") private String publisher; /** @@ -76,7 +78,7 @@ public class DraftAttrFromDTO implements Serializable { /** * 发布日期 */ - @NotBlank(message = "发布日期不能为空") + @NotBlank(message = "发布时间不能为空") private String publishDate; /** diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java index c1f615a4b0..2c82e28b06 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java @@ -44,13 +44,13 @@ public class DraftContentFromDTO implements Serializable { /** * 文章标题 */ - @NotBlank(message = "文章标题不能为空") + @NotBlank(message = "请输入标题") private String title; /** * 内容列表 */ - @NotEmpty(message = "文章内容不能为空") + @NotEmpty(message = "至少添加一个段落") private List contentList; @Data 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 590ff82d6f..e6132615c1 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 @@ -56,6 +56,7 @@ import com.epmet.service.*; import com.epmet.utils.ModuleConstant; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.sun.javafx.binding.StringConstant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.jsoup.helper.StringUtil; @@ -67,6 +68,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import javax.swing.text.StringContent; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @@ -173,12 +175,6 @@ public class ArticleServiceImpl extends BaseServiceImpl loginUserDetails = epmetUserOpenFeignClient.getLoginUserDetails(detailsFormDTO); if (loginUserDetails == null || loginUserDetails.getData() == null) { log.warn("saveOrUpdateContent getloginUserDetails return null"); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), ModuleConstant.GET_USER_DETAIL_ERROR); } draftEntity = new DraftEntity(); draftEntity.setTitle(fromDTO.getTitle()); @@ -287,23 +283,18 @@ public class ArticleServiceImpl extends BaseServiceImpl 1 || fromDTO.getIsTop() < 0) { + throw new RenException(ModuleConstant.DRAFT_IS_TOP_ERROR); } - if (StringUtils.isBlank(fromDTO.getPublishDate())) { - log.warn("saveOrUpdateAttr publishDate is blank"); - throw new RenException("发布时间不能为空"); + if ( fromDTO.getPublisherType() != DraftConstant.AGENCY && fromDTO.getPublisherType() != DraftConstant.DEPARTMENT + &&fromDTO.getPublisherType() != DraftConstant.GRID) { + throw new RenException(ModuleConstant.DRAFT_PUBLISHER_TYPE_ERROR); } return saveDraftAttr(tokenDto, fromDTO); } @@ -361,7 +350,7 @@ public class ArticleServiceImpl extends BaseServiceImpl { if (gridIdList.contains(grid.getGridId())) { - String agencyGridName = articleGridResultDTO.getAgencyName().concat("-").concat(grid.getGridName()); + String agencyGridName = articleGridResultDTO.getAgencyName().concat(StrConstant.HYPHEN).concat(grid.getGridName()); agencyGridNameList.add(agencyGridName); DraftPublishRangeEntity draftPublishRangeEntity = new DraftPublishRangeEntity(); draftPublishRangeEntity.setCustomerId(tokenDto.getCustomerId()); @@ -471,19 +460,17 @@ public class ArticleServiceImpl extends BaseServiceImpl newContentList = new ArrayList<>(); - for (int i = 0; i < contentList.size(); i++) { + for (int i = NumConstant.ZERO; i < contentList.size(); i++) { DraftContentFromDTO.DraftContentDTO content = contentList.get(i); DraftContentEntity entity = ConvertUtils.sourceToTarget(content, DraftContentEntity.class); entity.setId(content.getDraftContentId()); entity.setCustomerId(tokenDto.getCustomerId()); entity.setDraftId(fromDTO.getDraftId()); - entity.setOrderNum(i + 1); - //默认通过 + entity.setOrderNum(i + NumConstant.ONE); + //默认为空 entity.setAuditStatus(""); newContentList.add(entity); } - - return newContentList; } @@ -543,16 +530,16 @@ public class ArticleServiceImpl extends BaseServiceImpl { - publishRangeDesc.append(publishRangeDesc.length() > NumConstant.ZERO ? "、" : ""); + publishRangeDesc.append(publishRangeDesc.length() > NumConstant.ZERO ? StrConstant.COMMA_ZH : ""); publishRangeDesc.append(range.getAgencyGridName()); }); } else { publishedList.forEach(pub -> { - publishRangeDesc.append(publishRangeDesc.length() > NumConstant.ZERO ? "、" : ""); + publishRangeDesc.append(publishRangeDesc.length() > NumConstant.ZERO ? StrConstant.COMMA_ZH : ""); publishRangeDesc.append(pub.getAgencyGridName()); }); } @@ -566,7 +553,7 @@ public class ArticleServiceImpl extends BaseServiceImpl { - offLineRangeDesc.append(offLineRangeDesc.length() > NumConstant.ZERO ? "、" : ""); + offLineRangeDesc.append(offLineRangeDesc.length() > NumConstant.ZERO ? StrConstant.COMMA_ZH : ""); offLineRangeDesc.append(off.getAgencyGridName()); }); content = String.format(ArticleConstant.OFF_LINE_ARTICLE_MSG, articleEntity.getPublisherName(), staffDTO.getRealName(), articleEntity.getTitle(), offLineRangeDesc); @@ -721,9 +708,9 @@ public class ArticleServiceImpl extends BaseServiceImpl= NumConstant.ZERO; i--) { //遍历到当前人员所属组织的上一级组织时停止遍历 @@ -742,7 +729,7 @@ public class ArticleServiceImpl extends BaseServiceImpl gridList = new ArrayList<>(); AgencyGridListResultDTO gridDto = new AgencyGridListResultDTO(); gridDto.setGridId(range.getGridId()); - gridDto.setGridName(range.getAgencyGridName().substring(range.getAgencyGridName().lastIndexOf("-") + NumConstant.ONE)); + gridDto.setGridName(range.getAgencyGridName().substring(range.getAgencyGridName().lastIndexOf(StrConstant.HYPHEN) + NumConstant.ONE)); gridList.add(gridDto); dto.setGridList(gridList); } @@ -753,7 +740,7 @@ public class ArticleServiceImpl extends BaseServiceImpl gridList = dto1.getGridList(); AgencyGridListResultDTO gridDto = new AgencyGridListResultDTO(); gridDto.setGridId(range.getGridId()); - gridDto.setGridName(range.getAgencyGridName().substring(range.getAgencyGridName().lastIndexOf("-") + NumConstant.ONE)); + gridDto.setGridName(range.getAgencyGridName().substring(range.getAgencyGridName().lastIndexOf(StrConstant.HYPHEN) + NumConstant.ONE)); gridList.add(gridDto); dto1.setGridList(gridList); map.put(pids[i], dto1); @@ -1099,11 +1086,11 @@ public class ArticleServiceImpl extends BaseServiceImpl