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 32c074f291..89fdb4cf19 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 @@ -65,8 +65,11 @@ public enum EpmetErrorCode { OPER_UPLOAD_FILE_OVER_SIZE(8707, "文件体积过大"), OPER_UPLOAD_FILE_TYPE_ERROR(8708, "文件类型错误"), + ARTICLE_PUBLISH_ERROR(8801, "发布文章失败,请刷新重试"), + CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"); + private int code; private String msg; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 5422ce563f..82f50cf042 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -1,8 +1,9 @@ package com.epmet.commons.tools.utils; - import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; @@ -167,6 +168,19 @@ public class HttpClientManager { } throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } + + public static void main(String[] args) { + String url = "http://192.168.1.130:8107/epmetscan/api/textSyncScan"; + TextTaskDTO p = new TextTaskDTO(); + p.setDataId("1"); + p.setContent("neirong1"); + List list = new ArrayList<>(); + list.add(p); + TextScanParamDTO param = new TextScanParamDTO(); + param.setTasks(list); + Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param)); + System.out.println(JSON.toJSONString(result)); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java index cfab55c859..057b4b7e23 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.param.ImgScanParamDTO; import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; /** @@ -15,6 +16,7 @@ import org.apache.commons.lang3.StringUtils; * @email liujianjun@yunzongnet.com * @date 2020-06-08 8:28 **/ +@Slf4j public class ScanContentUtils { /** * desc:图片同步扫描 @@ -22,6 +24,7 @@ public class ScanContentUtils { * @return */ public static SyncScanResult imgSyncScan(String url, ImgScanParamDTO param) { + log.debug("imgSyncScan param:",JSON.toJSONString(param)); if (StringUtils.isBlank(url) || param == null) { throw new RenException("参数错误"); } @@ -42,6 +45,7 @@ public class ScanContentUtils { * @return */ public static SyncScanResult textSyncScan(String url, TextScanParamDTO param) { + log.debug("textSyncScan param:",JSON.toJSONString(param)); if (StringUtils.isBlank(url) || param == null) { throw new RenException("参数错误"); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml index cb56e6aba6..baeb630555 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml @@ -3,7 +3,7 @@ services: epmet-oss-server: container_name: epmet-oss-server-dev # image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/epmet-oss-server:0.3.2 - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.14 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.17 ports: - "8083:8083" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index 97f8559e13..d865257602 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.14 + 0.3.17 com.epmet epmet-oss diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 2826dc9932..ba393cba85 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -55,7 +55,6 @@ public class OssController { private ParamsRemoteService paramsRemoteService; private final static String KEY = ModuleConstant.CLOUD_STORAGE_CONFIG_KEY; - public static final String IMAGE_JPG_VALUE = "image/jpg"; @GetMapping("page") @ApiOperation(value = "分页") @@ -188,10 +187,10 @@ public class OssController { } @PostMapping("article/upload") - public Result uploadArticleImg(@RequestParam("file") MultipartFile file) { + public Result uploadArticleImg(@RequestParam("file") MultipartFile file) { // 校验文件类型 - if (!MediaType.IMAGE_PNG_VALUE.equals(file.getContentType()) && !IMAGE_JPG_VALUE.equals(file.getContentType())) { + if (!MediaType.IMAGE_PNG_VALUE.equals(file.getContentType()) && !MediaType.IMAGE_JPEG_VALUE.equals(file.getContentType())) { throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getCode() , EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getMsg()); } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java index af13b14a3c..a7b1b2a7df 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/ListOpePermsFormDTO.java @@ -11,4 +11,8 @@ public class ListOpePermsFormDTO { private String staffId; @NotBlank(message = "当前单位不能为空") private String currAgencyId; + + private String currGridId; + + private String currDeptId; } diff --git a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml index 9a9aa6ec3e..8289777a7a 100644 --- a/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-access/gov-access-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-access-server: container_name: gov-access-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-access-server:0.3.26 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-access-server:0.3.27 ports: - "8099:8099" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-access/gov-access-server/pom.xml b/epmet-module/gov-access/gov-access-server/pom.xml index 777ca5e39d..cad1ea3769 100644 --- a/epmet-module/gov-access/gov-access-server/pom.xml +++ b/epmet-module/gov-access/gov-access-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.26 + 0.3.27 gov-access com.epmet diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index cc723cca1f..f47ac58ef4 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -546,8 +546,7 @@ public class AccessServiceImpl implements AccessService { } if (!opeScope.getSeries().equals(OperationScopeConstant.SERIES_ORG_LEVEL)) { - // 如果不是org_level系列权限,跳过。(如果一个操作没有分配org_level系列权限,那么无法根据所在机构判断是否具有该功能权限) - // 此时不会给前台返回此功能权限。即要求所有操作必须分配至少一个org_level系列权限(如果实在不需要,可以分配成org_all)。 + opeKeys.add(opeScope.getOperationKey()); continue; } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index 5f7926415b..d53204f039 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -27,6 +27,7 @@ public class AccessServiceImpl implements AccessService { ListOpePermsFormDTO listOpePermsFormDTO = new ListOpePermsFormDTO(); listOpePermsFormDTO.setStaffId(staffId); listOpePermsFormDTO.setCurrAgencyId(currAgencyId); + listOpePermsFormDTO.setCurrGridId(currGridId); Result> result = govAccessFeignClient.listOperationPermissions(listOpePermsFormDTO); if (!result.success()) { logger.error("调用GovAccess服务查询功能权限列表失败,StaffId:{},错误信息:{}", staffId, result.getMsg()); diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleAgencyGridListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleAgencyGridListResultDTO.java new file mode 100644 index 0000000000..dd84877e56 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleAgencyGridListResultDTO.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + + +/** + * 党建声音-可选发布范围、可下线网格列表-接口返参 + * + * @author sun + */ +@Data +public class ArticleAgencyGridListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 树结构对象 + */ + private ArticleGridResultDTO agencyGridList; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index b83e3086a4..6c539852e5 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.62 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.63 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 1a7359c79d..f4b102fa0e 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.62 + 0.3.63 com.epmet gov-org diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 52e15fcbd9..fb9ea27ab0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -686,7 +686,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl gridList = customerGridDao.selectAgencyGridList(agencyEntity.getId()); returnDTO.setGridList(gridList); //递归查询当前组织的下级组织以及每个下级组织对应的网格列表 - List subAgencyGridList = getGridList(agencyEntity.getPids() + ":" + agencyEntity.getId()); + //根组织pids为空 + List subAgencyGridList = getGridList(("".equals(agencyEntity.getPids())?"":agencyEntity.getPids() + ":")+agencyEntity.getId()); returnDTO.setSubAgencyGridList(subAgencyGridList); } else if (gridParty) { //4.2:查询人员在当前机关下参与的网格列表 @@ -771,11 +772,11 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl agencyDeptList = customerDepartmentDao.selectAgencyDeptMsgList(agencyEntity.getId()); returnDTO.setAgencyDeptList(agencyDeptList); 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 5d933697d7..44df615c1a 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 @@ -34,9 +34,7 @@ import java.util.List; public class DraftContentFromDTO implements Serializable { - private static final long serialVersionUID = -4206020151361420221L; - - + private static final long serialVersionUID = -5699594328218833256L; /** * 草稿ID */ @@ -51,6 +49,7 @@ public class DraftContentFromDTO implements Serializable { /** * 内容列表 */ + @NotBlank(message = "文章内容不能为空") private List contentList; @Data diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishArticleFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishArticleFormDTO.java new file mode 100644 index 0000000000..4aff23c34e --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishArticleFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 政府端-发布文章参数 + */ +@Data +public class PublishArticleFormDTO implements Serializable { + + private static final long serialVersionUID = -1659776209159063672L; + /** + * 要发布的草稿Id + */ + private String draftId; + +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftContentSaveResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftContentSaveResultDTO.java new file mode 100644 index 0000000000..dadde8373d --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftContentSaveResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 政府端:保存文章内容 返回结果 + */ +@Data +public class DraftContentSaveResultDTO implements Serializable { + public DraftContentSaveResultDTO() { + super(); + } + public DraftContentSaveResultDTO(String draftId) { + this.draftId = draftId; + } + + /** + *草稿Id + */ + private String draftId; +} diff --git a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml index c51187335f..0b5a6a3a04 100644 --- a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-voice-server: container_name: gov-voice-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-voice-server:0.3.9 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-voice-server:0.3.14 ports: - "8105:8105" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-voice/gov-voice-server/pom.xml b/epmet-module/gov-voice/gov-voice-server/pom.xml index d79a0d5745..8aba2de112 100644 --- a/epmet-module/gov-voice/gov-voice-server/pom.xml +++ b/epmet-module/gov-voice/gov-voice-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.9 + 0.3.14 gov-voice com.epmet 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 6788069282..b4d0f0f12f 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 @@ -31,6 +31,11 @@ public interface DraftConstant { */ String AUDITING = "auditing"; + /** + * 审核失败:auditfail + */ + String AUDITFAIL = "auditfail"; + //是否置顶 /** * 置顶:1 @@ -61,4 +66,9 @@ public interface DraftConstant { * 内容类型-文字 */ String TEXT = "text"; + + /** + * 草稿预览内容大小长度 + */ + Integer PREVIEW_CONTENT_MAX_LENGTH = 50; } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java index 3ec18dd5ed..9c6edf5307 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java @@ -20,14 +20,13 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.enums.RequirePermissionEnum; -import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.DefaultGroup; -import com.epmet.dto.ArticleContentDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.service.ArticleOperateRecordService; @@ -35,7 +34,10 @@ import com.epmet.service.ArticleService; import com.epmet.service.DraftService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -64,8 +66,22 @@ public class ArticleController { * @Description 党建声音-政府端-可选发布范围 **/ @PostMapping("agencygridlist") - public Result agencyGridList(@LoginUser TokenDto tokenDTO) { - return new Result().ok(articleService.agencyGridList(tokenDTO)); + public Result agencyGridList(@LoginUser TokenDto tokenDTO) { + ArticleAgencyGridListResultDTO agencyGridList = new ArticleAgencyGridListResultDTO(); + agencyGridList.setAgencyGridList(articleService.agencyGridList(tokenDTO)); + return new Result().ok(agencyGridList); + } + + /** + * desc:政府端-点击返回按钮时,点击保存草稿 无需校验参数 + * @param fromDTO + * @throws Exception + */ + @PostMapping("savedraft") + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) + public Result savedraft(@LoginUser TokenDto tokenDto,@RequestBody DraftContentFromDTO fromDTO) throws Exception { + DraftContentSaveResultDTO draftDTO = articleService.saveDraft(tokenDto, fromDTO); + return new Result().ok(draftDTO); } /** @@ -73,11 +89,11 @@ public class ArticleController { * @param fromDTO * @throws Exception */ - @GetMapping("savecontent") + @PostMapping("savecontent") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) - public Result saveOrUpdateContent(@LoginUser TokenDto tokenDto,@RequestBody DraftContentFromDTO fromDTO) throws Exception { - String draftId = articleService.saveOrUpdateContent(tokenDto, fromDTO); - return new Result().ok(draftId); + public Result saveOrUpdateContent(@LoginUser TokenDto tokenDto,@RequestBody DraftContentFromDTO fromDTO) throws Exception { + DraftContentSaveResultDTO resultDTO = articleService.saveOrUpdateContent(tokenDto, fromDTO, true); + return new Result().ok(resultDTO); } /** @@ -171,7 +187,7 @@ public class ArticleController { * @param fromDTO * @throws Exception */ - @GetMapping("saveattr") + @PostMapping("saveattr") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) public Result saveDraftAttr(@LoginUser TokenDto tokenDto,@RequestBody DraftAttrFromDTO fromDTO) throws Exception { ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class); @@ -184,7 +200,7 @@ public class ArticleController { * @param fromDTO * @throws Exception */ - @GetMapping("previewsaveattr") + @PostMapping("previewsaveattr") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) public Result previewSaveDraftAttr(@LoginUser TokenDto tokenDto,@RequestBody DraftAttrFromDTO fromDTO) throws Exception { ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class); @@ -194,16 +210,15 @@ public class ArticleController { /** * desc:发布文章 - * @param draftId + * @param formDTO * @throws Exception */ - @GetMapping("publish") + @PostMapping("publish") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH) - public Result publishArticle(@LoginUser TokenDto tokenDto, String draftId) throws Exception { - Boolean isSuccess = articleService.publish(tokenDto, draftId); + public Result publishArticle(@LoginUser TokenDto tokenDto, @RequestBody PublishArticleFormDTO formDTO) throws Exception { + Boolean isSuccess = articleService.publish(tokenDto, formDTO.getDraftId()); if (isSuccess){ - //TODO 异步校验内容 - scanContent(tokenDto,draftId); + scanContent(tokenDto,formDTO.getDraftId()); } return new Result().ok(isSuccess); } @@ -211,6 +226,9 @@ public class ArticleController { @Async public void scanContent(TokenDto tokenDto,String draftId){ SyncScanResult syncScanResult = articleService.scanContent(tokenDto,draftId); + if (syncScanResult == null){ + throw new RenException(EpmetErrorCode.ARTICLE_PUBLISH_ERROR.getCode(),EpmetErrorCode.ARTICLE_PUBLISH_ERROR.getMsg()); + } if (syncScanResult.isAllPass()){ articleService.scanAllPassPublishArticle(tokenDto,draftId); }else{ @@ -298,10 +316,12 @@ public class ArticleController { * @Description 党建声音-政府端-可下线网格列表 **/ @PostMapping("publishgridlist") - public Result publishGridList(@LoginUser TokenDto tokenDTO, @RequestBody PublishGridListFormDTO formDTO) { + public Result publishGridList(@LoginUser TokenDto tokenDTO, @RequestBody PublishGridListFormDTO formDTO) { formDTO.setStaffId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(formDTO, PublishGridListFormDTO.AddUserInternalGroup.class); - return new Result().ok(articleService.publishGridList(formDTO)); + ArticleAgencyGridListResultDTO agencyGridList = new ArticleAgencyGridListResultDTO(); + agencyGridList.setAgencyGridList(articleService.publishGridList(formDTO)); + return new Result().ok(agencyGridList); } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java index 3656c16f6e..89acd7d3d2 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java @@ -115,7 +115,7 @@ public class DraftController { @PostMapping("draftlist") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_LIST) - public Result> draftList(@LoginUser TokenDto tokenDto, DraftListFormDTO formDTO) { + public Result> draftList(@LoginUser TokenDto tokenDto, @RequestBody DraftListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(draftService.draftList(tokenDto, formDTO).getList()); } 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 a09cc3927d..f444f878f7 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 @@ -83,9 +83,9 @@ public interface ArticleDao extends BaseDao { * @param gridList * @return java.util.List */ - @DataFilter(tableAliases = {"a", "apr"}, gridIdsArgName = "gridList") List selectArticleListForGrid(@Param("customerId") String customerId, - @Param("tagIdList") List tagIdList, Set gridList); + @Param("tagIdList") List tagIdList, + @Param("gridList")Set gridList); /** * 已下线文章列表 @@ -94,7 +94,7 @@ public interface ArticleDao extends BaseDao { * @param gridList * @return java.util.List */ - @DataFilter(tableAliases = "apr", gridIdsArgName = "gridList") + @DataFilter(tableAliases = "a", gridIdsArgName = "gridList") List selectOfflineList(Set gridList); diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java index 39b47a54f9..4e6c151df4 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java @@ -99,4 +99,8 @@ public interface DraftDao extends BaseDao { * @date 2020/6/5 12:23 **/ List selectDraftContentList(String draftId); + + int deleteDraft(String draftId); + + int updateAuditStatusById(@Param("draftId") String draftId, @Param("statusFlag") String statusFlag); } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java index 3fa1c7c49b..d9dfea5dff 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java @@ -48,9 +48,10 @@ public interface ArticleService extends BaseService { * * @param tokenDto * @param fromDTO + * @param required * @return */ - String saveOrUpdateContent(TokenDto tokenDto, DraftContentFromDTO fromDTO); + DraftContentSaveResultDTO saveOrUpdateContent(TokenDto tokenDto, DraftContentFromDTO fromDTO, boolean required); /** * 政府端:(已发布、已下线)文章详情 @@ -183,4 +184,12 @@ public interface ArticleService extends BaseService { * @param syncScanResult */ void updateAuditStatusFailById(String draftId, SyncScanResult syncScanResult); + + /** + * desc:政府端点击返回时,点击保存草稿 + * @param tokenDto + * @param fromDTO + * @return + */ + DraftContentSaveResultDTO saveDraft(TokenDto tokenDto, DraftContentFromDTO fromDTO); } \ No newline at end of file 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 f4013ebd58..f3f7ed18a3 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 @@ -166,40 +166,28 @@ public class ArticleServiceImpl extends BaseServiceImpl draftContentList = null; if (StringUtils.isNotBlank(fromDTO.getDraftId())) { - draftEntity = draftDao.selectById(fromDTO.getDraftId()); - if (draftEntity == null) { - log.warn("saveOrUpdateContent draftId is not exist in db"); - throw new RenException("参数错误"); - } - draftEntity.setTitle(draftEntity.getTitle()); - for (int i = 0; i < fromDTO.getContentList().size(); i++) { - if(DraftConstant.TEXT.equals(fromDTO.getContentList().get(i).getContentType())) { - String content = fromDTO.getContentList().get(i).getContent(); - if(content.length() > 50) { - content = content.substring(0, 50); - } - draftEntity.setPreviewContent(content); - break; - } - } + draftEntity = this.checkDraftStatus(fromDTO.getDraftId()); + draftEntity.setTitle(StringUtils.isBlank(draftEntity.getTitle()) ? "" : draftEntity.getTitle()); + buildPreviewContent(fromDTO, draftEntity); draftDao.updateById(draftEntity); - } else { LoginUserDetailsFormDTO detailsFormDTO = new LoginUserDetailsFormDTO(); detailsFormDTO.setUserId(loginUserUtil.getLoginUserId()); detailsFormDTO.setApp(loginUserUtil.getLoginUserApp()); detailsFormDTO.setClient(loginUserUtil.getLoginUserClient()); Result loginUserDetails = epmetUserOpenFeignClient.getLoginUserDetails(detailsFormDTO); - if (loginUserDetails == null || loginUserDetails.getData() == null){ + 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(), EpmetErrorCode.SERVER_ERROR.getMsg()); } draftEntity = new DraftEntity(); draftEntity.setTitle(fromDTO.getTitle()); @@ -211,32 +199,38 @@ public class ArticleServiceImpl extends BaseServiceImpl 50) { - content = content.substring(0, 50); - } - draftEntity.setPreviewContent(content); - break; - } - } + buildPreviewContent(fromDTO, draftEntity); draftDao.insert(draftEntity); } String draftId = draftEntity.getId(); fromDTO.setDraftId(draftId); draftContentList = buildDraftContent(tokenDto, fromDTO); - if (CollectionUtils.isEmpty(draftContentList)) { - log.warn("saveOrUpdateContent contentList is empty"); - throw new RenException("参数错误"); - } Map draftIdMap = new HashMap<>(); - draftIdMap.put("DRAFT_ID", fromDTO.getDraftId()); + draftIdMap.put(ModuleConstant.FIELD_DRAFT_ID, fromDTO.getDraftId()); draftContentDao.deleteByMap(draftIdMap); - draftContentService.insertBatch(draftContentList); - return draftId; + if (!CollectionUtils.isEmpty(draftContentList)) { + draftContentService.insertBatch(draftContentList); + } + return new DraftContentSaveResultDTO(draftId); + } + + private void buildPreviewContent(DraftContentFromDTO fromDTO, DraftEntity draftEntity) { + if (CollectionUtils.isEmpty(fromDTO.getContentList())){ + draftEntity.setPreviewContent(""); + return; + } + for (int i = 0; i < fromDTO.getContentList().size(); i++) { + if (DraftConstant.TEXT.equals(fromDTO.getContentList().get(i).getContentType())) { + String content = fromDTO.getContentList().get(i).getContent(); + if (content.length() > DraftConstant.PREVIEW_CONTENT_MAX_LENGTH) { + content = content.substring(NumConstant.ZERO, DraftConstant.PREVIEW_CONTENT_MAX_LENGTH); + } + draftEntity.setPreviewContent(content); + break; + } + } } @Override @@ -311,11 +305,12 @@ public class ArticleServiceImpl extends BaseServiceImpl publishRangeEntityList) { Map draftIdMap = new HashMap<>(); - draftIdMap.put("DRAFT_ID", draftEntity.getId()); + draftIdMap.put(ModuleConstant.FIELD_DRAFT_ID, draftEntity.getId()); draftCoverDao.deleteByMap(draftIdMap); if (coverEntity != null){ draftCoverDao.insert(coverEntity); @@ -394,9 +389,8 @@ public class ArticleServiceImpl extends BaseServiceImpl buildDraftContent(TokenDto tokenDto, DraftContentFromDTO fromDTO) { + List contentList = fromDTO.getContentList(); + if (CollectionUtils.isEmpty(contentList)) { + return null; + } List newContentList = new ArrayList<>(); - List contentList = fromDTO.getContentList(); for (int i = 0; i < contentList.size(); i++) { DraftContentFromDTO.DraftContentDTO content = contentList.get(i); @@ -459,10 +456,11 @@ public class ArticleServiceImpl extends BaseServiceImpl successDataIds = syncScanResult.getSuccessDataIds(); + successDataIds.forEach(id->{ + if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX)>=0){ + draftCoverDao.updateAuditStatusById(id,ModuleConstant.AUDIT_STATUS_PASS); + }else{ + draftContentDao.updateAuditStatusById(id,ModuleConstant.AUDIT_STATUS_PASS); + } + }); + } + + @Override + public DraftContentSaveResultDTO saveDraft(TokenDto tokenDto, DraftContentFromDTO fromDTO) { + return this.saveOrUpdateContent(tokenDto, fromDTO, false); } public Result sendMsg(String title,String content) { @@ -1011,10 +1029,13 @@ public class ArticleServiceImpl extends BaseServiceImpl imp return; } draftDTO.setDelFlag(NumConstant.ONE); - this.update(draftDTO); + baseDao.deleteDraft(draftDTO.getId()); } @Override diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java index 186b427914..19dcbf3d5d 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagServiceImpl.java @@ -99,6 +99,9 @@ public class TagServiceImpl implements TagService { */ @Override public List correlationTagList(TokenDto tokenDto, CorrelationTagListFormDTO formDto) { + if (formDto.getTagIdList().size() == NumConstant.ZERO){ + return new ArrayList<>(); + } String customerId = tokenDto.getCustomerId(); return tagRedis.get(customerId,formDto); } @@ -110,6 +113,9 @@ public class TagServiceImpl implements TagService { */ @Override public List tagCascadeList(TagCascadeListFormDTO formDto) { + if (formDto.getTagIdList().size() == NumConstant.ZERO){ + return new ArrayList<>(); + } return tagRedis.getResiTag(formDto); } } \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java index d9cc1d429c..9da980ea8f 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java @@ -39,6 +39,11 @@ public interface ModuleConstant { * */ String FIELD_ARTICLE_ID = "ARTICLE_ID"; + /** + * 数据库列名 - 草稿ID + * */ + String FIELD_DRAFT_ID = "DRAFT_ID"; + /** * 实体属性名 - 文章ID * */ 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 d3be4c7e2f..42ba89d7fc 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 @@ -96,6 +96,9 @@ WHERE a.DEL_FLAG = '0' AND a.STATUS_FLAG = 'published' AND a.CUSTOMER_ID = #{customerId} + + a.GRID_ID = #{gridId} + UNION SELECT DISTINCT aa.ID AS "articleId", @@ -109,7 +112,11 @@ INNER JOIN article_publish_range apr ON aa.ID = apr.ARTICLE_ID AND apr.DEL_FLAG = 0 AND apr.PUBLISH_STATUS = 'published' WHERE aa.DEL_FLAG = '0' AND aa.STATUS_FLAG = 'published' - AND aa.CUSTOMER_ID = #{customerId}) t + AND aa.CUSTOMER_ID = #{customerId} + + apr.GRID_ID = #{gridId} + + ) t AND EXISTS ( SELECT DISTINCT @@ -131,12 +138,11 @@ a.TITLE AS "title", IFNULL(a.PREVIEW_CONTENT, "") AS "previewContent", a.PUBLISHER_NAME AS "publisherName", - a.PUBLISH_DATE AS "publishDate" + a.OFF_LINE_TIME AS "publishDate" FROM article a - INNER JOIN article_publish_range apr ON a.ID = apr.ARTICLE_ID AND apr.DEL_FLAG = '0' WHERE a.DEL_FLAG = '0' - AND apr.PUBLISH_STATUS = 'offline' - ORDER BY apr.OFF_LINE_TIME DESC + AND a.STATUS_FLAG = 'offline' + ORDER BY a.OFF_LINE_TIME DESC diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml index 0c1f84593f..ed813e8c6c 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml @@ -125,4 +125,10 @@ ORDER BY dc.ORDER_NUM ASC + + update draft set DEL_FLAG='1' where id=#{draftId} + + + update draft set STATUS_FLAG =#{statusFlag,jdbcType=VARCHAR} where id=#{draftId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/test/java/com/epmet/ArticleServiceTest.java b/epmet-module/gov-voice/gov-voice-server/src/test/java/com/epmet/ArticleServiceTest.java index bf88b68040..9b184a2f7a 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/test/java/com/epmet/ArticleServiceTest.java +++ b/epmet-module/gov-voice/gov-voice-server/src/test/java/com/epmet/ArticleServiceTest.java @@ -3,6 +3,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.constant.DraftConstant; import com.epmet.dto.form.DraftAttrFromDTO; import com.epmet.dto.form.DraftContentFromDTO; +import com.epmet.dto.result.DraftContentSaveResultDTO; import com.epmet.service.ArticleService; import org.junit.Test; import org.junit.runner.RunWith; @@ -41,7 +42,7 @@ public class ArticleServiceTest { list.add(contentDTO); } draftContentFromDTO.setContentList(list); - String s = articleService.saveOrUpdateContent(tokenDto, draftContentFromDTO); + DraftContentSaveResultDTO s = articleService.saveOrUpdateContent(tokenDto, draftContentFromDTO, false); System.out.println(s); } diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index 2c9510bc45..9dcf0b0bcc 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.3 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.5 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index 16e3820d4e..08f4e24a50 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.3 + 0.3.5 epmet-openapi-scan jar