Browse Source

Merge remote-tracking branch 'origin/dev' into dev

master
wxz 5 years ago
parent
commit
58653b7290
  1. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  2. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  3. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java
  4. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/ValidatorUtils.java
  5. 2
      epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml
  6. 2
      epmet-module/epmet-oss/epmet-oss-server/pom.xml
  7. 7
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java
  8. 5
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java
  9. 6
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftAttrFromDTO.java
  10. 14
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java
  11. 2
      epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml
  12. 6
      epmet-module/gov-voice/gov-voice-server/pom.xml
  13. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleContentController.java
  14. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleCoverController.java
  15. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleOperateRecordController.java
  16. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticlePublishRangeController.java
  17. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleTagsController.java
  18. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleVisitRecordController.java
  19. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftContentController.java
  20. 57
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java
  21. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftCoverController.java
  22. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftPublishRangeController.java
  23. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagCustomerController.java
  24. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagDefaultController.java
  25. 94
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagGridController.java
  26. 6
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleOperateRecordEntity.java
  27. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleContentRedis.java
  28. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleCoverRedis.java
  29. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleOperateRecordRedis.java
  30. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticlePublishRangeRedis.java
  31. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleRedis.java
  32. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleTagsRedis.java
  33. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleVisitRecordRedis.java
  34. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/DraftContentRedis.java
  35. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/DraftCoverRedis.java
  36. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/DraftPublishRangeRedis.java
  37. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/DraftRedis.java
  38. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagCustomerRedis.java
  39. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagDefaultRedis.java
  40. 47
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagGridRedis.java
  41. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleContentServiceImpl.java
  42. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleCoverServiceImpl.java
  43. 5
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleOperateRecordServiceImpl.java
  44. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticlePublishRangeServiceImpl.java
  45. 485
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  46. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleTagsServiceImpl.java
  47. 8
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleVisitRecordServiceImpl.java
  48. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftContentServiceImpl.java
  49. 8
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftCoverServiceImpl.java
  50. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftPublishRangeServiceImpl.java
  51. 4
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java
  52. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java
  53. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagDefaultServiceImpl.java
  54. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagGridServiceImpl.java
  55. 35
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java
  56. 3
      epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.2__add_gridIds.sql
  57. 1
      epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/epmet_gov_voice.sql
  58. 1
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml
  59. 1
      epmet-module/gov-voice/gov-voice-server/src/test/java/com/epmet/ArticleServiceTest.java
  60. 3
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java
  61. 1
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java
  62. 1
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java
  63. 4
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java
  64. 3
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java
  65. 4
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java
  66. 6
      epmet-openapi/epmet-openapi-scan/src/main/resources/readme

5
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 = "、";
}

2
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, "内部数据校验异常");

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java

@ -45,7 +45,7 @@ public class ScanContentUtils {
return resultResult;
} catch (Exception e) {
log.debug("imgSyncScan param:{}", JSON.toJSONString(param));
return new Result<SyncScanResult>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
}
}
@ -72,7 +72,7 @@ public class ScanContentUtils {
return resultResult;
} catch (Exception e) {
log.error("textSyncScan exception:", e);
return new Result<SyncScanResult>().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
}
}

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/ValidatorUtils.java

@ -50,7 +50,10 @@ public class ValidatorUtils {
List<Class<?>> customerShowGroups = new ArrayList<>();
List<Class<?>> internalGroups = new ArrayList<>();
if (groups == null || groups.length ==0){
validate(EpmetErrorCode.CUSTOMER_VALIDATE_ERROR ,object,groups);
return;
}
Arrays.asList(groups).forEach(g -> {
if (CustomerClientShowGroup.class.isAssignableFrom(g)) {
//如果派生自客户端显示分组,那么会优先校验,并且将错误提示给客户端,返回客户端可见的错误码

2
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.18
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.21
ports:
- "8083:8083"
network_mode: host # 使用现有网络

2
epmet-module/epmet-oss/epmet-oss-server/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" 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">
<modelVersion>4.0.0</modelVersion>
<version>0.3.18</version>
<version>0.3.21</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-oss</artifactId>

7
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java

@ -29,6 +29,7 @@ import com.epmet.utils.ModuleConstant;
import com.google.gson.Gson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@ -37,7 +38,6 @@ import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
/**
@ -48,6 +48,7 @@ import java.util.Map;
@RestController
@RequestMapping("file")
@Api(tags="文件上传")
@Slf4j
public class OssController {
@Autowired
private OssService ossService;
@ -190,7 +191,9 @@ public class OssController {
public Result<UploadImgResultDTO> uploadArticleImg(@RequestParam("file") MultipartFile file) {
// 校验文件类型
if (!MediaType.IMAGE_PNG_VALUE.equals(file.getContentType()) && !MediaType.IMAGE_JPEG_VALUE.equals(file.getContentType())) {
if (!MediaType.IMAGE_PNG_VALUE.equals(file.getContentType()) && !MediaType.IMAGE_JPEG_VALUE.equals(file.getContentType())
&& !ModuleConstant.FILE_CONTENT_TYPE_JPG.equals(file.getContentType()) ) {
log.error("uploadArticleImg file type:{} is not support 2 upload",file.getContentType() == null? null:file.getContentType());
throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getCode()
, EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getMsg());
}

5
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -21,4 +21,9 @@ public interface ModuleConstant extends Constant {
* 云存储配置KEY
*/
String CLOUD_STORAGE_CONFIG_KEY = "CLOUD_STORAGE_CONFIG_KEY";
/**
* jpg文件类型
*/
String FILE_CONTENT_TYPE_JPG = "image/jpg";
}

6
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<String> gridIdList;
/**
* 发布单位Id 类型不同 id含义不同
*/
@NotBlank(message = "发布单位不能为空")
private String publisher;
/**
@ -76,7 +78,7 @@ public class DraftAttrFromDTO implements Serializable {
/**
* 发布日期
*/
@NotBlank(message = "发布日期不能为空")
@NotBlank(message = "发布时间不能为空")
private String publishDate;
/**

14
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java

@ -18,7 +18,9 @@
package com.epmet.dto.form;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
@ -44,13 +46,15 @@ public class DraftContentFromDTO implements Serializable {
/**
* 文章标题
*/
@NotBlank(message = "文章标题不能为空")
@NotBlank(message = "请输入标题")
@Length(max = 50, message = "标题最长为50个字")
private String title;
/**
* 内容列表
*/
@NotEmpty(message = "文章内容不能为空")
@NotEmpty(message = "至少添加一个段落")
@Valid
private List<DraftContentDTO> contentList;
@Data
@ -65,16 +69,12 @@ public class DraftContentFromDTO implements Serializable {
/**
* 内容
*/
@Length(max = 1000, message = "每段文字最长为1000个字")
private String content;
/**
* 内容类型 图片img文字text
*/
private String contentType;
/**
* 内容顺序 从1开始
*/
private Integer orderNum;
}
}

2
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.41
image: 192.168.1.130:10080/epmet-cloud-dev/gov-voice-server:0.3.49
ports:
- "8105:8105"
network_mode: host # 使用现有网络

6
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">
<modelVersion>4.0.0</modelVersion>
<version>0.3.41</version>
<version>0.3.49</version>
<parent>
<artifactId>gov-voice</artifactId>
<groupId>com.epmet</groupId>
@ -134,7 +134,7 @@
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<openapi.scan.server.url>http://localhost:8107/epmetscan/api</openapi.scan.server.url>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/epmetscan/api</openapi.scan.server.url>
</properties>
</profile>
<profile>
@ -167,7 +167,7 @@
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<openapi.scan.server.url>http://localhost:8107/epmetscan/api</openapi.scan.server.url>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/epmetscan/api</openapi.scan.server.url>
</properties>
</profile>
</profiles>

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleContentController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.ArticleContentDTO;
import com.epmet.excel.ArticleContentExcel;
import com.epmet.service.ArticleContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 文章内容表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("articlecontent")
public class ArticleContentController {
@Autowired
private ArticleContentService articleContentService;
@GetMapping("page")
public Result<PageData<ArticleContentDTO>> page(@RequestParam Map<String, Object> params){
PageData<ArticleContentDTO> page = articleContentService.page(params);
return new Result<PageData<ArticleContentDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ArticleContentDTO> get(@PathVariable("id") String id){
ArticleContentDTO data = articleContentService.get(id);
return new Result<ArticleContentDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ArticleContentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
articleContentService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ArticleContentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
articleContentService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
articleContentService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ArticleContentDTO> list = articleContentService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ArticleContentExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleCoverController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.ArticleCoverDTO;
import com.epmet.excel.ArticleCoverExcel;
import com.epmet.service.ArticleCoverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 文章封面表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("articlecover")
public class ArticleCoverController {
@Autowired
private ArticleCoverService articleCoverService;
@GetMapping("page")
public Result<PageData<ArticleCoverDTO>> page(@RequestParam Map<String, Object> params){
PageData<ArticleCoverDTO> page = articleCoverService.page(params);
return new Result<PageData<ArticleCoverDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ArticleCoverDTO> get(@PathVariable("id") String id){
ArticleCoverDTO data = articleCoverService.get(id);
return new Result<ArticleCoverDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ArticleCoverDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
articleCoverService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ArticleCoverDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
articleCoverService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
articleCoverService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ArticleCoverDTO> list = articleCoverService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ArticleCoverExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleOperateRecordController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.ArticleOperateRecordDTO;
import com.epmet.excel.ArticleOperateRecordExcel;
import com.epmet.service.ArticleOperateRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 文章操作记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("articleoperaterecord")
public class ArticleOperateRecordController {
@Autowired
private ArticleOperateRecordService articleOperateRecordService;
@GetMapping("page")
public Result<PageData<ArticleOperateRecordDTO>> page(@RequestParam Map<String, Object> params){
PageData<ArticleOperateRecordDTO> page = articleOperateRecordService.page(params);
return new Result<PageData<ArticleOperateRecordDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ArticleOperateRecordDTO> get(@PathVariable("id") String id){
ArticleOperateRecordDTO data = articleOperateRecordService.get(id);
return new Result<ArticleOperateRecordDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ArticleOperateRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
articleOperateRecordService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ArticleOperateRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
articleOperateRecordService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
articleOperateRecordService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ArticleOperateRecordDTO> list = articleOperateRecordService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ArticleOperateRecordExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticlePublishRangeController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.ArticlePublishRangeDTO;
import com.epmet.excel.ArticlePublishRangeExcel;
import com.epmet.service.ArticlePublishRangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 文章发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("articlepublishrange")
public class ArticlePublishRangeController {
@Autowired
private ArticlePublishRangeService articlePublishRangeService;
@GetMapping("page")
public Result<PageData<ArticlePublishRangeDTO>> page(@RequestParam Map<String, Object> params){
PageData<ArticlePublishRangeDTO> page = articlePublishRangeService.page(params);
return new Result<PageData<ArticlePublishRangeDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ArticlePublishRangeDTO> get(@PathVariable("id") String id){
ArticlePublishRangeDTO data = articlePublishRangeService.get(id);
return new Result<ArticlePublishRangeDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ArticlePublishRangeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
articlePublishRangeService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ArticlePublishRangeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
articlePublishRangeService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
articlePublishRangeService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ArticlePublishRangeDTO> list = articlePublishRangeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ArticlePublishRangeExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleTagsController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.ArticleTagsDTO;
import com.epmet.excel.ArticleTagsExcel;
import com.epmet.service.ArticleTagsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 文章标签表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("articletags")
public class ArticleTagsController {
@Autowired
private ArticleTagsService articleTagsService;
@GetMapping("page")
public Result<PageData<ArticleTagsDTO>> page(@RequestParam Map<String, Object> params){
PageData<ArticleTagsDTO> page = articleTagsService.page(params);
return new Result<PageData<ArticleTagsDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ArticleTagsDTO> get(@PathVariable("id") String id){
ArticleTagsDTO data = articleTagsService.get(id);
return new Result<ArticleTagsDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ArticleTagsDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
articleTagsService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ArticleTagsDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
articleTagsService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
articleTagsService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ArticleTagsDTO> list = articleTagsService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ArticleTagsExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleVisitRecordController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.ArticleVisitRecordDTO;
import com.epmet.excel.ArticleVisitRecordExcel;
import com.epmet.service.ArticleVisitRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 文章访问记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("articlevisitrecord")
public class ArticleVisitRecordController {
@Autowired
private ArticleVisitRecordService articleVisitRecordService;
@GetMapping("page")
public Result<PageData<ArticleVisitRecordDTO>> page(@RequestParam Map<String, Object> params){
PageData<ArticleVisitRecordDTO> page = articleVisitRecordService.page(params);
return new Result<PageData<ArticleVisitRecordDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<ArticleVisitRecordDTO> get(@PathVariable("id") String id){
ArticleVisitRecordDTO data = articleVisitRecordService.get(id);
return new Result<ArticleVisitRecordDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody ArticleVisitRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
articleVisitRecordService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody ArticleVisitRecordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
articleVisitRecordService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
articleVisitRecordService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ArticleVisitRecordDTO> list = articleVisitRecordService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, ArticleVisitRecordExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftContentController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
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.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.DraftContentDTO;
import com.epmet.excel.DraftContentExcel;
import com.epmet.service.DraftContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 草稿内容表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("draftcontent")
public class DraftContentController {
@Autowired
private DraftContentService draftContentService;
@GetMapping("page")
public Result<PageData<DraftContentDTO>> page(@RequestParam Map<String, Object> params){
PageData<DraftContentDTO> page = draftContentService.page(params);
return new Result<PageData<DraftContentDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<DraftContentDTO> get(@PathVariable("id") String id){
DraftContentDTO data = draftContentService.get(id);
return new Result<DraftContentDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody DraftContentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
draftContentService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody DraftContentDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
draftContentService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
draftContentService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<DraftContentDTO> list = draftContentService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, DraftContentExcel.class);
}
}

57
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java

@ -20,27 +20,20 @@ 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.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.DraftDTO;
import com.epmet.dto.form.DeleteDraftFormDTO;
import com.epmet.dto.form.DraftListFormDTO;
import com.epmet.dto.result.DraftListResultDTO;
import com.epmet.excel.DraftExcel;
import com.epmet.service.DraftService;
import org.springframework.beans.factory.annotation.Autowired;
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 javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
@ -56,48 +49,6 @@ public class DraftController {
@Autowired
private DraftService draftService;
@GetMapping("page")
public Result<PageData<DraftDTO>> page(@RequestParam Map<String, Object> params){
PageData<DraftDTO> page = draftService.page(params);
return new Result<PageData<DraftDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<DraftDTO> get(@PathVariable("id") String id){
DraftDTO data = draftService.get(id);
return new Result<DraftDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody DraftDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
draftService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody DraftDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
draftService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
draftService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<DraftDTO> list = draftService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, DraftExcel.class);
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftCoverController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.DraftCoverDTO;
import com.epmet.excel.DraftCoverExcel;
import com.epmet.service.DraftCoverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 草稿封面表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("draftcover")
public class DraftCoverController {
@Autowired
private DraftCoverService draftCoverService;
@GetMapping("page")
public Result<PageData<DraftCoverDTO>> page(@RequestParam Map<String, Object> params){
PageData<DraftCoverDTO> page = draftCoverService.page(params);
return new Result<PageData<DraftCoverDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<DraftCoverDTO> get(@PathVariable("id") String id){
DraftCoverDTO data = draftCoverService.get(id);
return new Result<DraftCoverDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody DraftCoverDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
draftCoverService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody DraftCoverDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
draftCoverService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
draftCoverService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<DraftCoverDTO> list = draftCoverService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, DraftCoverExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftPublishRangeController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.DraftPublishRangeDTO;
import com.epmet.excel.DraftPublishRangeExcel;
import com.epmet.service.DraftPublishRangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 草稿发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("draftpublishrange")
public class DraftPublishRangeController {
@Autowired
private DraftPublishRangeService draftPublishRangeService;
@GetMapping("page")
public Result<PageData<DraftPublishRangeDTO>> page(@RequestParam Map<String, Object> params){
PageData<DraftPublishRangeDTO> page = draftPublishRangeService.page(params);
return new Result<PageData<DraftPublishRangeDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<DraftPublishRangeDTO> get(@PathVariable("id") String id){
DraftPublishRangeDTO data = draftPublishRangeService.get(id);
return new Result<DraftPublishRangeDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody DraftPublishRangeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
draftPublishRangeService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody DraftPublishRangeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
draftPublishRangeService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
draftPublishRangeService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<DraftPublishRangeDTO> list = draftPublishRangeService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, DraftPublishRangeExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagCustomerController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.TagCustomerDTO;
import com.epmet.excel.TagCustomerExcel;
import com.epmet.service.TagCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 客户标签表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("tagcustomer")
public class TagCustomerController {
@Autowired
private TagCustomerService tagCustomerService;
@GetMapping("page")
public Result<PageData<TagCustomerDTO>> page(@RequestParam Map<String, Object> params){
PageData<TagCustomerDTO> page = tagCustomerService.page(params);
return new Result<PageData<TagCustomerDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<TagCustomerDTO> get(@PathVariable("id") String id){
TagCustomerDTO data = tagCustomerService.get(id);
return new Result<TagCustomerDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody TagCustomerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tagCustomerService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody TagCustomerDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tagCustomerService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tagCustomerService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TagCustomerDTO> list = tagCustomerService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, TagCustomerExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagDefaultController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.TagDefaultDTO;
import com.epmet.excel.TagDefaultExcel;
import com.epmet.service.TagDefaultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 默认标签表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("tagdefault")
public class TagDefaultController {
@Autowired
private TagDefaultService tagDefaultService;
@GetMapping("page")
public Result<PageData<TagDefaultDTO>> page(@RequestParam Map<String, Object> params){
PageData<TagDefaultDTO> page = tagDefaultService.page(params);
return new Result<PageData<TagDefaultDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<TagDefaultDTO> get(@PathVariable("id") String id){
TagDefaultDTO data = tagDefaultService.get(id);
return new Result<TagDefaultDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody TagDefaultDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tagDefaultService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody TagDefaultDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tagDefaultService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tagDefaultService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TagDefaultDTO> list = tagDefaultService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, TagDefaultExcel.class);
}
}

94
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/TagGridController.java

@ -1,94 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.TagGridDTO;
import com.epmet.excel.TagGridExcel;
import com.epmet.service.TagGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 网格标签表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@RestController
@RequestMapping("taggrid")
public class TagGridController {
@Autowired
private TagGridService tagGridService;
@GetMapping("page")
public Result<PageData<TagGridDTO>> page(@RequestParam Map<String, Object> params){
PageData<TagGridDTO> page = tagGridService.page(params);
return new Result<PageData<TagGridDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<TagGridDTO> get(@PathVariable("id") String id){
TagGridDTO data = tagGridService.get(id);
return new Result<TagGridDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody TagGridDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tagGridService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody TagGridDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tagGridService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tagGridService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TagGridDTO> list = tagGridService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, TagGridExcel.class);
}
}

6
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleOperateRecordEntity.java

@ -18,7 +18,6 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -48,6 +47,11 @@ public class ArticleOperateRecordEntity extends BaseEpmetEntity {
*/
private String articleId;
/**
* 网格ID下线文章时多个以英文:隔开
*/
private String gridIds;
/**
* 执行人 xx街道-xx中心-姓名
*/

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleContentRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 文章内容表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class ArticleContentRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleCoverRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 文章封面表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class ArticleCoverRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleOperateRecordRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 文章操作记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class ArticleOperateRecordRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticlePublishRangeRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 文章发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class ArticlePublishRangeRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 文章表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class ArticleRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleTagsRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 文章标签表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class ArticleTagsRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/ArticleVisitRecordRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 文章访问记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class ArticleVisitRecordRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/DraftContentRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 草稿内容表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class DraftContentRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/DraftCoverRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 草稿封面表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class DraftCoverRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/DraftPublishRangeRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 草稿发布范围表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class DraftPublishRangeRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/DraftRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 草稿表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class DraftRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagCustomerRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 客户标签表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class TagCustomerRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagDefaultRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 默认标签表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class TagDefaultRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagGridRedis.java

@ -1,47 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 网格标签表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-06-02
*/
@Component
public class TagGridRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleContentServiceImpl.java

@ -20,16 +20,14 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.ArticleContentDao;
import com.epmet.dto.ArticleContentDTO;
import com.epmet.entity.ArticleContentEntity;
import com.epmet.redis.ArticleContentRedis;
import com.epmet.service.ArticleContentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,9 +44,6 @@ import java.util.Map;
@Service
public class ArticleContentServiceImpl extends BaseServiceImpl<ArticleContentDao, ArticleContentEntity> implements ArticleContentService {
@Autowired
private ArticleContentRedis articleContentRedis;
@Override
public PageData<ArticleContentDTO> page(Map<String, Object> params) {
IPage<ArticleContentEntity> page = baseDao.selectPage(

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleCoverServiceImpl.java

@ -20,16 +20,14 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.ArticleCoverDao;
import com.epmet.dto.ArticleCoverDTO;
import com.epmet.entity.ArticleCoverEntity;
import com.epmet.redis.ArticleCoverRedis;
import com.epmet.service.ArticleCoverService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,9 +44,6 @@ import java.util.Map;
@Service
public class ArticleCoverServiceImpl extends BaseServiceImpl<ArticleCoverDao, ArticleCoverEntity> implements ArticleCoverService {
@Autowired
private ArticleCoverRedis articleCoverRedis;
@Override
public PageData<ArticleCoverDTO> page(Map<String, Object> params) {
IPage<ArticleCoverEntity> page = baseDao.selectPage(

5
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleOperateRecordServiceImpl.java

@ -27,10 +27,8 @@ import com.epmet.dao.ArticleOperateRecordDao;
import com.epmet.dto.ArticleOperateRecordDTO;
import com.epmet.dto.result.ArticleOperationResultDTO;
import com.epmet.entity.ArticleOperateRecordEntity;
import com.epmet.redis.ArticleOperateRecordRedis;
import com.epmet.service.ArticleOperateRecordService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -48,9 +46,6 @@ import java.util.Map;
@Service
public class ArticleOperateRecordServiceImpl extends BaseServiceImpl<ArticleOperateRecordDao, ArticleOperateRecordEntity> implements ArticleOperateRecordService {
@Autowired
private ArticleOperateRecordRedis articleOperateRecordRedis;
@Override
public PageData<ArticleOperateRecordDTO> page(Map<String, Object> params) {
IPage<ArticleOperateRecordEntity> page = baseDao.selectPage(

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticlePublishRangeServiceImpl.java

@ -20,16 +20,14 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.ArticlePublishRangeDao;
import com.epmet.dto.ArticlePublishRangeDTO;
import com.epmet.entity.ArticlePublishRangeEntity;
import com.epmet.redis.ArticlePublishRangeRedis;
import com.epmet.service.ArticlePublishRangeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,9 +44,6 @@ import java.util.Map;
@Service
public class ArticlePublishRangeServiceImpl extends BaseServiceImpl<ArticlePublishRangeDao, ArticlePublishRangeEntity> implements ArticlePublishRangeService {
@Autowired
private ArticlePublishRangeRedis articlePublishRangeRedis;
@Override
public PageData<ArticlePublishRangeDTO> page(Map<String, Object> params) {
IPage<ArticlePublishRangeEntity> page = baseDao.selectPage(

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

@ -50,7 +50,6 @@ import com.epmet.entity.*;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.redis.ArticleRedis;
import com.epmet.redis.TagRedis;
import com.epmet.service.*;
import com.epmet.utils.ModuleConstant;
@ -80,8 +79,6 @@ import java.util.stream.Collectors;
@Slf4j
@Service
public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntity> implements ArticleService {
@Autowired
private ArticleRedis articleRedis;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
@ -134,8 +131,8 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
private static final String GRID = "grid";
@Autowired
private ArticleVisitRecordService articleVisitRecordService;
@Autowired
private ArticleVisitRecordService articleVisitRecordService;
/**
* @param tokenDTO
@ -146,26 +143,26 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Override
public ArticleGridResultDTO agencyGridList(TokenDto tokenDTO) {
Result<ArticleGridResultDTO> result = govOrgOpenFeignClient.getAgencyGridList(tokenDTO.getUserId());
if(!result.success()){
if (!result.success()) {
throw new RenException(result.getInternalMsg());
}
return result.getData();
}
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位
**/
@Override
public PublishAgencyListResultDTO publishAgencyList(TokenDto tokenDTO) {
Result<PublishAgencyListResultDTO> result = govOrgOpenFeignClient.getPublishAgencyList(tokenDTO.getUserId());
if(!result.success()){
/**
* @param tokenDTO
* @return
* @Author sun
* @Description 党建声音-政府端-可选发布单位
**/
@Override
public PublishAgencyListResultDTO publishAgencyList(TokenDto tokenDTO) {
Result<PublishAgencyListResultDTO> result = govOrgOpenFeignClient.getPublishAgencyList(tokenDTO.getUserId());
if (!result.success()) {
throw new RenException(result.getInternalMsg());
}
return result.getData();
}
return result.getData();
}
@Override
@Transactional(rollbackFor = Exception.class)
@ -173,12 +170,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
log.debug("saveOrUpdateContent param:{}", JSON.toJSONString(fromDTO));
if (required) {
ValidatorUtils.validateEntity(fromDTO);
if (StringUtils.isBlank(fromDTO.getTitle())){
throw new RenException(ModuleConstant.ARTICLE_TITLE_IS_NULL);
}
if (CollectionUtils.isEmpty(fromDTO.getContentList())){
throw new RenException(ModuleConstant.ARTICLE_CONTENT_IS_NULL);
}
}
DraftEntity draftEntity = null;
@ -196,7 +187,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
Result<LoginUserDetailsResultDTO> 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());
@ -226,10 +217,10 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
private void buildPreviewContent(DraftContentFromDTO fromDTO, DraftEntity draftEntity) {
if (CollectionUtils.isEmpty(fromDTO.getContentList())){
draftEntity.setPreviewContent("");
return;
}
if (CollectionUtils.isEmpty(fromDTO.getContentList())) {
draftEntity.setPreviewContent("");
return;
}
String content = "";
for (int i = 0; i < fromDTO.getContentList().size(); i++) {
if (DraftConstant.TEXT.equals(fromDTO.getContentList().get(i).getContentType())) {
@ -248,22 +239,22 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
GovArticleDetailResultDTO articleDetail = baseDao.queryGovArticleDetail(articleId);
if (null != articleDetail) {
List<GovArticleContentDTO> articleContentList = baseDao.queryGovArticleContent(articleId);
if(null!=articleContentList&&articleContentList.size()>0){
if (null != articleContentList && articleContentList.size() > 0) {
articleDetail.setArticleContentList(articleContentList);
}else{
} else {
articleDetail.setArticleContentList(new ArrayList<>());
}
if (StringUtils.isNoneBlank(articleDetail.getTags())) {
String[] tagNames = articleDetail.getTags().split("\\|");
articleDetail.setTagNameList(tagNames);
}else{
if (StringUtils.isNoneBlank(articleDetail.getTags())) {
String[] tagNames = articleDetail.getTags().split("\\|");
articleDetail.setTagNameList(tagNames);
} else {
articleDetail.setTagNameList(new String[0]);
}
ArticleEntity articleEntity=this.baseDao.selectById(articleId);
ArticleEntity articleEntity = this.baseDao.selectById(articleId);
log.info(String.format("当前文章id%s,发布人id%s,当前用户id%s", articleId, articleEntity.getCreatedBy(), loginUserUtil.getLoginUserId()));
if(articleEntity.getCreatedBy().equals(loginUserUtil.getLoginUserId())){
if (articleEntity.getCreatedBy().equals(loginUserUtil.getLoginUserId())) {
articleDetail.setIsMePublished(true);
}else{
} else {
articleDetail.setIsMePublished(false);
}
}
@ -272,7 +263,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Override
public Boolean saveDraftAttr(TokenDto tokenDto, DraftAttrFromDTO fromDTO) {
log.debug("saveDraftAttr param:{}",JSON.toJSONString(fromDTO));
log.debug("saveDraftAttr param:{}", JSON.toJSONString(fromDTO));
DraftEntity draftEntity = checkDraftStatus(fromDTO.getDraftId());
@ -287,28 +278,23 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftEntity.setIsTop(fromDTO.getIsTop());
//发布单位
if (StringUtils.isNotBlank(fromDTO.getPublisher())){
String publisherType = fromDTO.getPublisherType();
String publisherName = fromDTO.getPublisherName();
if (StringUtils.isBlank(publisherType) || StringUtils.isBlank(publisherName)) {
log.warn("saveDraftAttr publisher info is illegal,publisher:{},publisherType:{},publisherName:{}",fromDTO.getPublisher(),publisherType,publisherName);
throw new RenException("发布单位不能为空");
}
}
draftEntity.setPublisherName(fromDTO.getPublisherName());
draftEntity.setPublisherId(fromDTO.getPublisher());
draftEntity.setPublisherType(fromDTO.getPublisherType());
if(DraftConstant.GRID.equals(fromDTO.getPublisherType())) {
//TODO ? 如果为机关 不设置?
if (DraftConstant.GRID.equals(fromDTO.getPublisherType())) {
draftEntity.setGridId(fromDTO.getPublisher());
}
draftEntity.setPublishDate(DateUtils.stringToDate(fromDTO.getPublishDate(),DateUtils.DATE_PATTERN));
if (StringUtils.isNotBlank(fromDTO.getPublishDate())) {
draftEntity.setPublishDate(DateUtils.stringToDate(fromDTO.getPublishDate(), DateUtils.DATE_PATTERN));
}
//封面
DraftCoverEntity coverEntity = buildCoverEntity(tokenDto, fromDTO);
//发布范围
List<DraftPublishRangeEntity> publishRangeEntityList = buildDraftPublishRange(draftEntity,tokenDto, fromDTO);
List<DraftPublishRangeEntity> publishRangeEntityList = buildDraftPublishRange(draftEntity, tokenDto, fromDTO);
executeSaveDraftAttr(draftEntity, coverEntity, publishRangeEntityList);
@ -318,50 +304,49 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
private DraftEntity checkDraftStatus(String draftId) {
DraftEntity draftEntity = draftDao.selectById(draftId);
if (draftEntity == null) {
log.warn("saveDraftAttr draftId:{} is not exist in db",draftId);
throw new RenException("参数错误");
log.warn("saveDraftAttr draftId:{} is not exist in db", draftId);
throw new RenException(ModuleConstant.DRAFT_ID_IS_NOT_EXIST);
}
if (NumConstant.ONE_STR.equals(draftEntity.getDelFlag())) {
log.warn("saveDraftAttr draftId:{} have deleted",draftId);
throw new RenException("草稿已删除");
log.warn("saveDraftAttr draftId:{} have deleted", draftId);
throw new RenException(ModuleConstant.DRAFT_STATUS_IS_DEL);
}
//只有为发布的才能保存修改
//只有未发布的和审核失败的才能修改
if (DraftConstant.AUDITING.equals(draftEntity.getStatusFlag()) || DraftConstant.PUBLISHED.equals(draftEntity.getStatusFlag())) {
log.warn("saveDraftAttr draftId:{} publishStatus have published",draftId);
throw new RenException("草稿发布状态错误");
log.warn("saveDraftAttr draftId:{} publishStatus have published", draftId);
throw new RenException(ModuleConstant.DRAFT_STATUS_IS_NOT_ALLOW_MODIFY);
}
return draftEntity;
}
@Override
public Boolean previewSaveDraftAttr(TokenDto tokenDto, DraftAttrFromDTO fromDTO) {
log.debug("previewSaveDraftAttr param:{}",JSON.toJSONString(fromDTO));
//校验参数
ValidatorUtils.validateEntity(fromDTO);
if (DraftConstant.TOP.equals(fromDTO.getIsTop()) && StringUtils.isBlank(fromDTO.getCoverImg())) {
log.warn("saveOrUpdateAttr isTop=1 but coverImg is blank");
throw new RenException("文章封面不能为空");
throw new RenException(ModuleConstant.DRAFT_CONTENT_IS_NULL);
}
if (CollectionUtils.isEmpty(fromDTO.getGridIdList())) {
log.warn("saveOrUpdateAttr gridIdList is empty");
throw new RenException("发布范围不能为空");
if (StringUtils.isBlank(fromDTO.getPublisherName()) || StringUtils.isBlank(fromDTO.getPublisherType())) {
throw new RenException(ModuleConstant.DRAFT_PUBLISHER_IS_NULL);
}
if (StringUtils.isBlank(fromDTO.getPublisher())) {
log.warn("saveOrUpdateAttr publisher is blank");
throw new RenException("发布单位不能为空");
if (fromDTO.getIsTop() == null || fromDTO.getIsTop() > 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 (!DraftConstant.AGENCY.equals(fromDTO.getPublisherType()) && !DraftConstant.DEPARTMENT.equals(fromDTO.getPublisherType())
&& !DraftConstant.GRID.equals(fromDTO.getPublisherType())) {
throw new RenException(ModuleConstant.DRAFT_PUBLISHER_TYPE_ERROR);
}
return saveDraftAttr(tokenDto, fromDTO);
}
@Override
public Boolean publish(TokenDto tokenDto, String draftId) {
if (StringUtils.isBlank(draftId)){
if (StringUtils.isBlank(draftId)) {
log.warn("publish param error draftId is blank");
throw new RenException("草稿Id不能为空");
throw new RenException(ModuleConstant.DRAFT_ID_IS_NULL);
}
DraftEntity draftEntity = checkDraftStatus(draftId);
draftEntity.setStatusFlag(DraftConstant.AUDITING);
@ -371,41 +356,40 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Transactional(rollbackFor = Exception.class)
public void executeSaveDraftAttr(DraftEntity draftEntity, DraftCoverEntity coverEntity, List<DraftPublishRangeEntity> publishRangeEntityList) {
Map<String,Object> draftIdMap = new HashMap<>();
//物理删除
draftCoverDao.deleteByDraftId(draftEntity.getId());
if (coverEntity != null){
if (coverEntity != null) {
draftCoverDao.insert(coverEntity);
}
//物理删除
draftPublishRangeDao.deleteByDraftId(draftEntity.getId());
if (!CollectionUtils.isEmpty(publishRangeEntityList)){
publishRangeEntityList.forEach(publishRange->draftPublishRangeDao.insert(publishRange));
if (!CollectionUtils.isEmpty(publishRangeEntityList)) {
publishRangeEntityList.forEach(publishRange -> draftPublishRangeDao.insert(publishRange));
}
draftDao.updateById(draftEntity);
}
private List<DraftPublishRangeEntity> buildDraftPublishRange(DraftEntity draftEntity, TokenDto tokenDto, DraftAttrFromDTO fromDTO) {
if (CollectionUtils.isEmpty(fromDTO.getGridIdList())){
return null;
}
if (CollectionUtils.isEmpty(fromDTO.getGridIdList())) {
return null;
}
List<DraftPublishRangeEntity> publishRangeEntityList = new ArrayList<>();
List<String> agencyGridNameList = new ArrayList<>();
ArticleGridResultDTO articleGridResultDTO = this.agencyGridList(tokenDto);
if (articleGridResultDTO == null) {
log.warn("saveDraftAttr userId:{} have not right access publishRange", tokenDto.getUserId());
throw new RenException("参数错误");
throw new RenException(ModuleConstant.GET_USER_CAN_SELECT_GRID_ERROR);
}
buildName(tokenDto,agencyGridNameList,publishRangeEntityList, fromDTO, articleGridResultDTO);
buildAgencyGridNames(tokenDto,agencyGridNameList,publishRangeEntityList, fromDTO, articleGridResultDTO);
draftEntity.setPublishRangeDesc(StringUtils.join(agencyGridNameList,"、"));
buildName(tokenDto, agencyGridNameList, publishRangeEntityList, fromDTO, articleGridResultDTO);
buildAgencyGridNames(tokenDto, agencyGridNameList, publishRangeEntityList, fromDTO, articleGridResultDTO);
draftEntity.setPublishRangeDesc(StringUtils.join(agencyGridNameList, StrConstant.COMMA_ZH));
return publishRangeEntityList;
}
private DraftCoverEntity buildCoverEntity(TokenDto tokenDto, DraftAttrFromDTO fromDTO) {
String coverImg = fromDTO.getCoverImg();
if (StringUtils.isBlank(coverImg)){
if (StringUtils.isBlank(coverImg)) {
return null;
}
DraftCoverEntity coverEntity = new DraftCoverEntity();
@ -420,7 +404,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
private void buildAgencyGridNames(TokenDto tokenDto, List<String> agencyGridNameList, List<DraftPublishRangeEntity> publishRangeEntityList, DraftAttrFromDTO fromDTO, ArticleGridResultDTO articleGridResultDTO) {
articleGridResultDTO.getSubAgencyGridList().forEach(subAgencyGrid -> {
buildName(tokenDto,agencyGridNameList, publishRangeEntityList,fromDTO, subAgencyGrid);
buildName(tokenDto, agencyGridNameList, publishRangeEntityList, fromDTO, subAgencyGrid);
});
if (!CollectionUtils.isEmpty(articleGridResultDTO.getSubAgencyGridList())) {
articleGridResultDTO.getSubAgencyGridList().forEach(subAgencyGrid -> {
@ -433,10 +417,10 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
private void buildName(TokenDto tokenDto, List<String> agencyGridNameList, List<DraftPublishRangeEntity> publishRangeEntityList, DraftAttrFromDTO fromDTO, ArticleGridResultDTO articleGridResultDTO) {
List<String> gridIdList = fromDTO.getGridIdList();
List<AgencyGridListResultDTO> gridList = articleGridResultDTO.getGridList();
if (!CollectionUtils.isEmpty(gridList)&&!CollectionUtils.isEmpty(gridIdList)) {
if (!CollectionUtils.isEmpty(gridList) && !CollectionUtils.isEmpty(gridIdList)) {
gridList.forEach(grid -> {
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 +455,17 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
List<DraftContentEntity> 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;
}
@ -496,14 +478,14 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Override
@Transactional(rollbackFor = Exception.class)
public void offLineArticle(OffLineArticleFormDTO formDTO) {
//0:查询文章表数据,判断当前操作人是否是当初发表文章的人(谁发布的文章水才能下线)
ArticleEntity articleEntity = baseDao.selectById(formDTO.getArticleId());
if (null == articleEntity) {
throw new RenException(ArticleConstant.SELECT_ARTICLE_EXCEPTION);
}
if(!formDTO.getStaffId().equals(articleEntity.getCreatedBy())){
throw new RenException(ArticleConstant.SHIRO_EXCEPTION);
}
//0:查询文章表数据,判断当前操作人是否是当初发表文章的人(谁发布的文章水才能下线)
ArticleEntity articleEntity = baseDao.selectById(formDTO.getArticleId());
if (null == articleEntity) {
throw new RenException(ArticleConstant.SELECT_ARTICLE_EXCEPTION);
}
if (!formDTO.getStaffId().equals(articleEntity.getCreatedBy())) {
throw new RenException(ArticleConstant.SHIRO_EXCEPTION);
}
//1:根据文章Id查询全部(已发布、已下线)发布范围数据
ArticlePublishRangeEntity rangeEntity = new ArticlePublishRangeEntity();
@ -543,16 +525,16 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
ArticleEntity entity = new ArticleEntity();
entity.setId(formDTO.getArticleId());
StringBuffer publishRangeDesc = new StringBuffer();
if (null == publishedList || publishedList.size() < NumConstant.ONE) {
if (CollectionUtils.isEmpty(publishedList)) {
entity.setStatusFlag(ArticleConstant.OFFLINE);
entity.setOffLineTime(date);
rangeEntityList.forEach(range -> {
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,20 +548,25 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
ArticleOperateRecordEntity recordEntity = new ArticleOperateRecordEntity();
recordEntity.setCustomerId(articleEntity.getCustomerId());
recordEntity.setArticleId(formDTO.getArticleId());
recordEntity.setOpUser(articleEntity.getPublisherName() + "-" + staffDTO.getRealName());
//下线文案,分为全部下线和部分下线
String content = "";
if (null == publishedList || publishedList.size() < NumConstant.ONE) {
content = String.format(ArticleConstant.OFF_LINE_ALL_ARTICLE_MSG, articleEntity.getPublisherName(), staffDTO.getRealName(), articleEntity.getTitle());
} else {
StringBuffer offLineRangeDesc = new StringBuffer();
offLineList.forEach(off -> {
offLineRangeDesc.append(offLineRangeDesc.length() > NumConstant.ZERO ? "、" : "");
offLineRangeDesc.append(off.getAgencyGridName());
});
content = String.format(ArticleConstant.OFF_LINE_ARTICLE_MSG, articleEntity.getPublisherName(), staffDTO.getRealName(), articleEntity.getTitle(), offLineRangeDesc);
}
recordEntity.setContent(content);
recordEntity.setOpUser(articleEntity.getPublisherName() + StrConstant.HYPHEN + staffDTO.getRealName());
//下线文案,分为全部下线和部分下线
String content = "";
StringBuffer offLineGridId = new StringBuffer();
if (null == publishedList || publishedList.size() < NumConstant.ONE) {
content = String.format(ArticleConstant.OFF_LINE_ALL_ARTICLE_MSG, articleEntity.getPublisherName(), staffDTO.getRealName(), articleEntity.getTitle());
} else {
StringBuffer offLineRangeDesc = new StringBuffer();
offLineList.forEach(off -> {
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);
}
offLineList.forEach(off -> {
offLineGridId.append(StrConstant.COLON).append(off.getGridId());
});
recordEntity.setGridIds(offLineGridId.toString().replaceFirst(StrConstant.COLON,""));
recordEntity.setContent(content);
recordEntity.setOpType(ArticleConstant.OFFLINE);
recordEntity.setOpTime(date);
articleOperateRecordService.insert(recordEntity);
@ -595,7 +582,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Override
public PageData publishedArticleList(TokenDto tokenDto, PublishedListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize());
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<PublishedListResultDTO> resultList;
List<CustomerStaffRoleResultDTO> roles = epmetUserOpenFeignClient.getStaffRoles(tokenDto.getUserId()).getData();
LoginUserDetailsFormDTO loginUserDetailsFormDTO = new LoginUserDetailsFormDTO();
@ -620,12 +607,16 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
if (AGENCY.equals(staffLevel)) {
resultList = baseDao.selectArticleListForAgency(tokenDto.getCustomerId(), formDTO.getTagIdList());
} else {
resultList = baseDao.selectArticleListForGrid(tokenDto.getCustomerId(), formDTO.getTagIdList(), userInfo.getGridIdList());
Set<String> gridList = new HashSet<>();
if (null != userInfo.getGridIdList()) {
gridList = userInfo.getGridIdList();
}
resultList = baseDao.selectArticleListForGrid(tokenDto.getCustomerId(), formDTO.getTagIdList(), gridList);
}
resultList.forEach(result -> {
String tags = result.getTags();
List<String> tagList = new ArrayList<>();
tagList= Arrays.asList(tags.split("[|]"));
tagList = Arrays.asList(tags.split("[|]"));
result.setTagNameList(tagList);
});
PageInfo<PublishedListResultDTO> pageInfo = new PageInfo<>(resultList);
@ -634,7 +625,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Override
public PageData offlineList(TokenDto tokenDto, OfflineListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize());
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
LoginUserDetailsFormDTO loginUserDetailsFormDTO = new LoginUserDetailsFormDTO();
loginUserDetailsFormDTO.setApp(tokenDto.getApp());
@ -646,46 +637,46 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return new PageData<>(resultList, pageInfo.getTotal());
}
/**
* @Description 根据网格Id查找置顶文章的相关信息列表 用处:居民端首页轮播
* @param commonArticleListFormDTO :: getGridId :: getNum
* @return List<ArticleBannerResultDTO>
* @author wangc
* @date 2020.06.02 16:13
**/
@Override
public List<ArticleBannerResultDTO> getTopArticleList(CommonArticleListFormDTO commonArticleListFormDTO) {
return baseDao.selectTopArticleMsg(commonArticleListFormDTO.getGridId(),
null == commonArticleListFormDTO.getNum() || commonArticleListFormDTO.getNum() <= NumConstant.ZERO ?
NumConstant.THREE : commonArticleListFormDTO.getNum());
}
/**
* @Description 根据网格Id查找最新文章的相关信息列表 用处:居民端首页最新文章列表
* @param commonArticleListFormDTO :: getGridId :: getNum
* @return List<ArticleLatestResultDTO>
* @author wangc
* @date 2020.06.03 09:53
**/
@Override
public List<ArticleLatestResultDTO> getLatestArticleList(CommonArticleListFormDTO commonArticleListFormDTO) {
return baseDao.selectLatestArticleMsg(commonArticleListFormDTO.getGridId(),
null == commonArticleListFormDTO.getNum() || commonArticleListFormDTO.getNum() <= NumConstant.ZERO ?
NumConstant.FIVE : commonArticleListFormDTO.getNum());
}
/**
* @Description 根据网格Id和标签列表查找文章的相关信息列表 用处:居民端党建声音列表
* @param articlePageFormDTO
* @return List<ArticleListResultDTO>
* @author wangc
* @date 2020.06.03 14:19
**/
@Override
public List<ArticleListResultDTO> getArticleList(ArticlePageFormDTO articlePageFormDTO) {
PageHelper.startPage(articlePageFormDTO.getPageNo(),articlePageFormDTO.getPageSize());
return baseDao.selectArticleList(articlePageFormDTO.getGridId(),articlePageFormDTO.getTagIdList());
}
/**
* @param commonArticleListFormDTO :: getGridId :: getNum
* @return List<ArticleBannerResultDTO>
* @Description 根据网格Id查找置顶文章的相关信息列表 用处:居民端首页轮播
* @author wangc
* @date 2020.06.02 16:13
**/
@Override
public List<ArticleBannerResultDTO> getTopArticleList(CommonArticleListFormDTO commonArticleListFormDTO) {
return baseDao.selectTopArticleMsg(commonArticleListFormDTO.getGridId(),
null == commonArticleListFormDTO.getNum() || commonArticleListFormDTO.getNum() <= NumConstant.ZERO ?
NumConstant.THREE : commonArticleListFormDTO.getNum());
}
/**
* @param commonArticleListFormDTO :: getGridId :: getNum
* @return List<ArticleLatestResultDTO>
* @Description 根据网格Id查找最新文章的相关信息列表 用处:居民端首页最新文章列表
* @author wangc
* @date 2020.06.03 09:53
**/
@Override
public List<ArticleLatestResultDTO> getLatestArticleList(CommonArticleListFormDTO commonArticleListFormDTO) {
return baseDao.selectLatestArticleMsg(commonArticleListFormDTO.getGridId(),
null == commonArticleListFormDTO.getNum() || commonArticleListFormDTO.getNum() <= NumConstant.ZERO ?
NumConstant.FIVE : commonArticleListFormDTO.getNum());
}
/**
* @param articlePageFormDTO
* @return List<ArticleListResultDTO>
* @Description 根据网格Id和标签列表查找文章的相关信息列表 用处:居民端党建声音列表
* @author wangc
* @date 2020.06.03 14:19
**/
@Override
public List<ArticleListResultDTO> getArticleList(ArticlePageFormDTO articlePageFormDTO) {
PageHelper.startPage(articlePageFormDTO.getPageNo(), articlePageFormDTO.getPageSize());
return baseDao.selectArticleList(articlePageFormDTO.getGridId(), articlePageFormDTO.getTagIdList());
}
/**
* @param formDTO
@ -709,7 +700,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
loginUserDetailsFormDTO.setClient("wxmp");
loginUserDetailsFormDTO.setUserId(formDTO.getStaffId());
Result<LoginUserDetailsResultDTO> resultDTOResult = epmetUserOpenFeignClient.getLoginUserDetails(loginUserDetailsFormDTO);
String agencyId = resultDTOResult.getData().getOrgIdPath().substring(resultDTOResult.getData().getOrgIdPath().lastIndexOf(":")+NumConstant.ONE);
String agencyId = resultDTOResult.getData().getOrgIdPath().substring(resultDTOResult.getData().getOrgIdPath().lastIndexOf(":") + NumConstant.ONE);
//存放树的每一个节点对象,用于将同一节点下的网格列表合并(主键:agencyId 值:节点对象)
Map<String, ArticleGridResultDTO> map = new HashMap<>();
//3:循环可下线网格列表,根据pids组织每一个树节点对象信息
@ -717,9 +708,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
//当前网格的所有机关id
String gridPids = range.getPids() + ":" + range.getAgencyId();
//当前网格的所有机关名称
String gridAgencyNames = range.getAllParentName() + "-" + range.getAgencyGridName().substring(NumConstant.ZERO, range.getAgencyGridName().lastIndexOf("-"));
String gridAgencyNames = range.getAllParentName() + StrConstant.HYPHEN + range.getAgencyGridName().substring(NumConstant.ZERO, range.getAgencyGridName().lastIndexOf(StrConstant.HYPHEN));
String[] pids = gridPids.split(":");
String[] names = gridAgencyNames.split("-");
String[] names = gridAgencyNames.split(StrConstant.HYPHEN);
//倒序遍历
for (int i = (pids.length - NumConstant.ONE); i >= NumConstant.ZERO; i--) {
//遍历到当前人员所属组织的上一级组织时停止遍历
@ -738,7 +729,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
List<AgencyGridListResultDTO> 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);
}
@ -749,7 +740,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
List<AgencyGridListResultDTO> 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);
@ -762,6 +753,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
List<ArticleGridResultDTO> list = agencyGridListToTree(resultDTOList);
return list.get(NumConstant.ZERO);
}
/**
* @Author sun
* @Description 可下线网格列表-将list转为Tree结构
@ -799,6 +791,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
return listParentRecord;
}
/**
* @Author sun
* @Description 可下线网格列表-将list转为Tree结构-递归查询每一个根节点的下级节点集合
@ -827,9 +820,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
/**
* @Description 根绝文章Id查询出文章的内容封面等相关信息如果居民端传入的网格Id不在该文章的发布范围内则返回NULL
* @param articleDetailFormDTO
* @return ArticleDetailResultDTO
* @Description 根绝文章Id查询出文章的内容封面等相关信息如果居民端传入的网格Id不在该文章的发布范围内则返回NULL
* @author wangc
* @date 2020.06.03 18:28
**/
@ -837,20 +830,20 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Transactional(rollbackFor = Exception.class)
public ArticleDetailResultDTO getArticleDetail(ResiArticleDetailFormDTO articleDetailFormDTO) {
//1.查询文章详情信息
ArticleDetailResultDTO articleInfo = baseDao.selectArticleDetail(articleDetailFormDTO.getGridId(),articleDetailFormDTO.getArticleId());
if(null == articleInfo) {
throw new RenException(String.format(ModuleConstant.SPECIFIED_ARTICLE_NOT_FOUND_EXCEPTION_TEMPLATE,articleDetailFormDTO.getArticleId(),articleDetailFormDTO.getGridId()));
ArticleDetailResultDTO articleInfo = baseDao.selectArticleDetail(articleDetailFormDTO.getGridId(), articleDetailFormDTO.getArticleId());
if (null == articleInfo) {
throw new RenException(String.format(ModuleConstant.SPECIFIED_ARTICLE_NOT_FOUND_EXCEPTION_TEMPLATE, articleDetailFormDTO.getArticleId(), articleDetailFormDTO.getGridId()));
}
//2.判断当前用户当前文章当前网格是否存在访问记录
Map<String,Object> params = new HashMap<>();
params.put(ModuleConstant.FIELD_GRID_ID_CAMEL,articleDetailFormDTO.getGridId());
params.put(ModuleConstant.FIELD_USER_ID_CAMEL,articleDetailFormDTO.getUserId());
params.put(ModuleConstant.FIELD_ARTICLE_ID_CAMEL,articleDetailFormDTO.getArticleId());
params.put(ModuleConstant.FIELD_CUSTOMER_ID_CAMEL,articleInfo.getCustomerId());
params.put(FieldConstant.DEL_FLAG_HUMP,NumConstant.ZERO_STR);
Map<String, Object> params = new HashMap<>();
params.put(ModuleConstant.FIELD_GRID_ID_CAMEL, articleDetailFormDTO.getGridId());
params.put(ModuleConstant.FIELD_USER_ID_CAMEL, articleDetailFormDTO.getUserId());
params.put(ModuleConstant.FIELD_ARTICLE_ID_CAMEL, articleDetailFormDTO.getArticleId());
params.put(ModuleConstant.FIELD_CUSTOMER_ID_CAMEL, articleInfo.getCustomerId());
params.put(FieldConstant.DEL_FLAG_HUMP, NumConstant.ZERO_STR);
List<ArticleVisitRecordDTO> existedVisitRecord = articleVisitRecordService.list(params);
//3.没有则插入
if(null == existedVisitRecord || existedVisitRecord.size() < NumConstant.ONE){
if (null == existedVisitRecord || existedVisitRecord.size() < NumConstant.ONE) {
ArticleVisitRecordEntity recordToInsert = new ArticleVisitRecordEntity();
recordToInsert.setArticleId(articleDetailFormDTO.getArticleId());
recordToInsert.setGridId(articleDetailFormDTO.getGridId());
@ -865,9 +858,9 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
/**
* @Description 草稿发布文章
* @param draft
* @return String 返回新发布文章的Id
* @Description 草稿发布文章
* @author wangc
* @date 2020.06.05 09:10
**/
@ -875,40 +868,40 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
public ArticleEntity publishDraftToArticle(DraftEntity draft) {
//1.查找草稿内容
if(null != draft){
if (null != draft) {
//2.查找草稿内容、封面、发布范围
String draftId = draft.getId();
//直接查询改草稿的 封面及内容
List<DraftContentEntity> draftContents = draftContentDao.selectByDraftId(draftId,null);
DraftCoverEntity draftCover = draftCoverDao.selectByDraftId(draftId,null);
List<DraftContentEntity> draftContents = draftContentDao.selectByDraftId(draftId, null);
DraftCoverEntity draftCover = draftCoverDao.selectByDraftId(draftId, null);
List<DraftPublishRangeEntity> draftPublishRange = draftPublishRangeDao.selectByDraftId(draftId);
//3.生成文章以及相关记录
ArticleEntity article = ConvertUtils.sourceToTarget(draft,ArticleEntity.class);
ArticleEntity article = ConvertUtils.sourceToTarget(draft, ArticleEntity.class);
article.setId(null);
article.setDraftId(draftId);
article.setStatusFlag(DraftConstant.PUBLISHED);
baseDao.insert(article);
if(null != draftContents && draftContents.size() > NumConstant.ZERO){
if (null != draftContents && draftContents.size() > NumConstant.ZERO) {
draftContents.forEach(content -> {
content.setOrderNum(content.getOrderNum());
ArticleContentEntity contentToInsert = ConvertUtils.sourceToTarget(content,ArticleContentEntity.class);
ArticleContentEntity contentToInsert = ConvertUtils.sourceToTarget(content, ArticleContentEntity.class);
contentToInsert.setArticleId(article.getId());
contentToInsert.setId(null);
articleContentDao.insert(contentToInsert);
});
}
if(null != draftPublishRange && draftPublishRange.size() > NumConstant.ZERO){
if (null != draftPublishRange && draftPublishRange.size() > NumConstant.ZERO) {
draftPublishRange.forEach(range -> {
range.setPublishStatus(DraftConstant.PUBLISHED);
ArticlePublishRangeEntity rangeToInsert = ConvertUtils.sourceToTarget(range,ArticlePublishRangeEntity.class);
ArticlePublishRangeEntity rangeToInsert = ConvertUtils.sourceToTarget(range, ArticlePublishRangeEntity.class);
rangeToInsert.setArticleId(article.getId());
rangeToInsert.setId(null);
articlePublishRangeDao.insert(rangeToInsert);
draftPublishRangeDao.updateById(range);
});
if(null != draftCover){
ArticleCoverEntity coverToInsert = ConvertUtils.sourceToTarget(draftCover,ArticleCoverEntity.class);
if (null != draftCover) {
ArticleCoverEntity coverToInsert = ConvertUtils.sourceToTarget(draftCover, ArticleCoverEntity.class);
coverToInsert.setArticleId(article.getId());
coverToInsert.setId(null);
articleCoverDao.insert(coverToInsert);
@ -929,7 +922,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return article;
}
throw new RenException(String.format(ModuleConstant.SPECIFIED_DRAFT_NOT_FOUNT_EXCEPTION_TEMPLATE,draft.getId()));
throw new RenException(String.format(ModuleConstant.SPECIFIED_DRAFT_NOT_FOUNT_EXCEPTION_TEMPLATE, draft.getId()));
}
@Override
@ -951,7 +944,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
if (!isOk) {
this.sendMsg(draftEntity.getCustomerId(),draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL);
return null;
}
@ -986,20 +979,26 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
Result<SyncScanResult> imgSyncScanResult = null;
Result<SyncScanResult> textSyncScanResult = null;
if(!CollectionUtils.isEmpty(imgScanParamDTO.getTasks())){
log.info("scanContent imgScanParamDTO:{}", JSON.toJSONString(imgScanParamDTO));
if (!CollectionUtils.isEmpty(imgScanParamDTO.getTasks())) {
log.info("scanContent imgScanParamDTO:{}", JSON.toJSONString(imgScanParamDTO));
imgSyncScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
log.info("scanContent imgSyncScanResult:{}", JSON.toJSONString(imgSyncScanResult));
if (!imgSyncScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),imgSyncScanResult.getMsg());
}
}
if(!CollectionUtils.isEmpty(textScanParamDTO.getTasks())){
log.info("scanContent textScanParamDTO:{}", JSON.toJSONString(textScanParamDTO));
if (!CollectionUtils.isEmpty(textScanParamDTO.getTasks())) {
log.info("scanContent textScanParamDTO:{}", JSON.toJSONString(textScanParamDTO));
textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
log.info("scanContent textSyncScanResult:{}", JSON.toJSONString(textSyncScanResult));
if (!textSyncScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),textSyncScanResult.getMsg());
}
}
result = new SyncScanResult();
if (imgSyncScanResult != null){
if (imgSyncScanResult != null) {
SyncScanResult imgSyncScanResultData = imgSyncScanResult.getData();
if (imgSyncScanResult.success()) {
result.setAllPass(imgSyncScanResultData.isAllPass());
@ -1017,15 +1016,16 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
} catch (Exception e) {
log.error("scanContent exception", e);
this.sendMsg(draftEntity.getCustomerId(),draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL);
}
log.debug("scanContent result:{}", JSON.toJSONString(result));
return result;
}
@Override
@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
public void scanAllPassPublishArticle(TokenDto tokenDto, String draftId, SyncScanResult syncScanResult){
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void scanAllPassPublishArticle(TokenDto tokenDto, String draftId, SyncScanResult syncScanResult) {
DraftEntity draft = draftDao.selectById(draftId);
if (draft == null) {
@ -1037,7 +1037,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
this.updateAuditStatusFailById(draftId, syncScanResult);
this.publishDraftToArticle(draft);
UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId);
if (updateCustomerTagCacheDTO == null){
if (updateCustomerTagCacheDTO == null) {
return;
}
List<UpdateGridTagCacheDTO> updateGridTagCacheDTOS = this.updateGridTag(tokenDto, draftId, updateCustomerTagCacheDTO);
@ -1053,31 +1053,31 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
} catch (Exception e) {
log.error("scanAllPassPublishArticle update db exception", e);
this.sendMsg(draft.getCustomerId(),draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateAuditStatusFailById(String draftId,SyncScanResult syncScanResult) {
public void updateAuditStatusFailById(String draftId, SyncScanResult syncScanResult) {
DraftEntity draft = draftDao.selectById(draftId);
if (draft == null) {
log.error("updateAuditStatusFailById draftId:{} is not exist in db", draftId);
throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(), EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
}
if (syncScanResult.isAllPass()){
if (syncScanResult.isAllPass()) {
this.updateDraftPublishStatus(draftId, DraftConstant.PUBLISHED);
}else{
} else {
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL);
}
boolean coverFail = false,contentFail = false;
boolean coverFail = false, contentFail = false;
try {
List<String> failDataIds = syncScanResult.getFailDataIds();
for(String id:failDataIds) {
for (String id : failDataIds) {
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) {
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE),""), ModuleConstant.AUDIT_STATUS_FAIL);
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE), ""), ModuleConstant.AUDIT_STATUS_FAIL);
coverFail = true;
} else {
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_FAIL);
@ -1087,21 +1087,22 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
List<String> successDataIds = syncScanResult.getSuccessDataIds();
successDataIds.forEach(id -> {
if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX) >= NumConstant.ZERO) {
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE),""), ModuleConstant.AUDIT_STATUS_PASS);
draftCoverDao.updateAuditStatusById(id.replace(ModuleConstant.SCAN_COVER_PREFIX.concat(StrConstant.UNDER_LINE), ""), ModuleConstant.AUDIT_STATUS_PASS);
} else {
draftContentDao.updateAuditStatusById(id, ModuleConstant.AUDIT_STATUS_PASS);
}
});
if (coverFail || contentFail){
if (coverFail || contentFail) {
String auditMsg = "";
if (coverFail&&contentFail){
auditMsg = "内容和封面";
}else if (contentFail){
auditMsg = "内容";
}else if (coverFail){
auditMsg = "封面";
if (coverFail && contentFail) {
auditMsg = ModuleConstant.DRAFT_CONTENT_AND_COVER;
} else if (contentFail) {
auditMsg = ModuleConstant.DRAFT_CONTENT;
} else if (coverFail) {
auditMsg = ModuleConstant.DRAFT_COVER;
;
}
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(),auditMsg));
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(), auditMsg));
}
} catch (Exception e) {
log.error("scanAllPassPublishArticle update db exception", e);
@ -1116,37 +1117,37 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return this.saveOrUpdateContent(tokenDto, fromDTO, false);
}
public Result sendMsg(String customerId, String title,String content) {
public Result sendMsg(String customerId, String title, String content) {
UserMessageFormDTO formDTO = new UserMessageFormDTO();
formDTO.setCustomerId(customerId);
formDTO.setGridId("");
formDTO.setUserId(loginUserUtil.getLoginUserId());
formDTO.setApp(AppClientConstant.APP_GOV);
formDTO.setTitle(String.format(ModuleConstant.MSG_TITLE,title));
formDTO.setTitle(String.format(ModuleConstant.MSG_TITLE, title));
formDTO.setMessageContent(content);
formDTO.setReadFlag(ReadFlagConstant.UN_READ);
return epmetMessageOpenFeignClient.saveUserMessage(formDTO);
}
@Override
public void updateDraftPublishStatus(String draftId,String statusFlag){
draftDao.updateAuditStatusById(draftId,statusFlag);
public void updateDraftPublishStatus(String draftId, String statusFlag) {
draftDao.updateAuditStatusById(draftId, statusFlag);
}
/**
* @Description 更新DB的标签使用次数 政府端
* @param draftId
* @Description 更新DB的标签使用次数 政府端
* @author zxc
*/
public UpdateCustomerTagCacheDTO updateCustomerTag(TokenDto tokenDto, String draftId){
public UpdateCustomerTagCacheDTO updateCustomerTag(TokenDto tokenDto, String draftId) {
//获取草稿基本信息
DraftDTO draft = draftService.get(draftId);
String tags = draft.getTags();
String customerId = draft.getCustomerId();
String userId = tokenDto.getUserId();
UpdateCustomerTagCacheDTO result = null;
if (StringUtils.isNotBlank(tags)){
UpdateCustomerTagCacheDTO result = null;
if (StringUtils.isNotBlank(tags)) {
result = new UpdateCustomerTagCacheDTO();
List<String> tagsList = Arrays.asList(tags.split("\\|"));
List<UpdateTagUseCountsResultDTO> tagsInfo = new ArrayList<>();
@ -1164,37 +1165,37 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
/**
* @Description 更新redis 标签使用数量 标签级联 政府端
* @param formDto
* @Description 更新redis 标签使用数量 标签级联 政府端
* @author zxc
*/
public void updateCacheCustomerTag(UpdateCustomerTagCacheDTO formDto){
public void updateCacheCustomerTag(UpdateCustomerTagCacheDTO formDto) {
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo();
String customerId = formDto.getCustomerId();
//更新缓存标签使用数量
tagsInfo.forEach(resultDTO -> {
String customerKey = TagConstant.GOV_TAG_KEY+customerId;
tagRedis.updateTagUseCounts(customerKey,resultDTO);
String customerKey = TagConstant.GOV_TAG_KEY + customerId;
tagRedis.updateTagUseCounts(customerKey, resultDTO);
});
//政府端更新redis的级联标签(set)
List<UpdateTagUseCountsResultDTO> tagsInfoCopy = new ArrayList<>();
for (int i = 0; i < tagsInfo.size(); i++) {
tagsInfoCopy.addAll(tagsInfo);
String key = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagsInfo.get(i).getTagId();
String key = TagConstant.GOV_RETAG_KEY + customerId + TagConstant.COLON + tagsInfo.get(i).getTagId();
tagsInfoCopy.remove(tagsInfo.get(i));
Set<UpdateTagUseCountsResultDTO> setTag = new HashSet<>(tagsInfoCopy);
tagRedis.updateMoreTag(key,setTag);
tagRedis.updateMoreTag(key, setTag);
tagsInfoCopy.clear();
}
}
/**
* @Description 更新数据库 网格下的标签使用数量 居民端
* @param draftId
* @param formDto
* @Description 更新数据库 网格下的标签使用数量 居民端
* @author zxc
*/
public List<UpdateGridTagCacheDTO> updateGridTag(TokenDto tokenDto,String draftId,UpdateCustomerTagCacheDTO formDto){
public List<UpdateGridTagCacheDTO> updateGridTag(TokenDto tokenDto, String draftId, UpdateCustomerTagCacheDTO formDto) {
//获取草稿基本信息
DraftDTO draft = draftService.get(draftId);
String customerId = draft.getCustomerId();
@ -1202,7 +1203,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
String userId = tokenDto.getUserId();
//根据草稿id查询发布范围id集合
List<String> gridIds = draftPublishRangeDao.selectGridIdByDraftId(draftId);
if (gridIds.size() == NumConstant.ZERO){
if (gridIds.size() == NumConstant.ZERO) {
throw new RenException(TagConstant.SELECT_GRIDIDLIST_FAILURE);
}
List<UpdateGridTagsFormDTO> gridTags = new ArrayList<>();
@ -1214,7 +1215,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
gridTagCache.add(cache);
tagsInfo.forEach(resultDTO -> {
UpdateGridTagsFormDTO tag = new UpdateGridTagsFormDTO();
BeanUtils.copyProperties(resultDTO,tag);
BeanUtils.copyProperties(resultDTO, tag);
tag.setCreatedBy(userId);
tag.setUpdatedBy(userId);
tag.setCustomerId(customerId);
@ -1222,43 +1223,43 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
gridTags.add(tag);
});
});
tagGridDao.updateGridTag(gridTags,userId);
tagGridDao.updateGridTag(gridTags, userId);
return gridTagCache;
}
/**
* @Description 更新redis 网格下的 标签使用数量 级联标签 居民端
* @param gridTagCache
* @Description 更新redis 网格下的 标签使用数量 级联标签 居民端
* @author zxc
*/
public void updateCacheGridTag(List<UpdateGridTagCacheDTO> gridTagCache){
public void updateCacheGridTag(List<UpdateGridTagCacheDTO> gridTagCache) {
//更新 网格下 标签使用数量
List<UpdateTagUseCountsResultDTO> gridTagCacheCopy = new ArrayList<>();
gridTagCache.forEach(cacheDTO -> {
String gridId = cacheDTO.getGridId();
String key = TagConstant.GRID_TAG_KEY+gridId;
String key = TagConstant.GRID_TAG_KEY + gridId;
List<UpdateTagUseCountsResultDTO> tagsInfo = cacheDTO.getTagsInfo();
tagsInfo.forEach(resultDTO -> {
tagRedis.updateTagUseCounts(key,resultDTO);
tagRedis.updateTagUseCounts(key, resultDTO);
});
//级联
for (int i = 0; i < tagsInfo.size(); i++) {
gridTagCacheCopy.addAll(tagsInfo);
String moreKey = TagConstant.GRID_RETAG_KEY+gridId+TagConstant.COLON+tagsInfo.get(i).getTagId();
String moreKey = TagConstant.GRID_RETAG_KEY + gridId + TagConstant.COLON + tagsInfo.get(i).getTagId();
gridTagCacheCopy.remove(tagsInfo.get(i));
Set<UpdateTagUseCountsResultDTO> setTag = new HashSet<>(gridTagCacheCopy);
tagRedis.updateMoreTag(moreKey,setTag);
tagRedis.updateMoreTag(moreKey, setTag);
gridTagCacheCopy.clear();
}
});
}
/**
* @Description 给文章挂标签 article_tags
* @param formDto
* @Description 给文章挂标签 article_tags
* @author zxc
*/
public void addArticleTags(UpdateCustomerTagCacheDTO formDto,String draftId,TokenDto tokenDto){
public void addArticleTags(UpdateCustomerTagCacheDTO formDto, String draftId, TokenDto tokenDto) {
List<AddArticleTagsFormDTO> addArticleTags = new ArrayList<>();
List<UpdateTagUseCountsResultDTO> tagsInfo = formDto.getTagsInfo();
DraftDTO draft = draftService.get(draftId);
@ -1271,7 +1272,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
addArticleTag.setUpdatedBy(userId);
addArticleTag.setCustomerId(customerId);
addArticleTag.setArticleId(articleId);
BeanUtils.copyProperties(resultDTO,addArticleTag);
BeanUtils.copyProperties(resultDTO, addArticleTag);
addArticleTags.add(addArticleTag);
});
articleTagsDao.addArticleTags(addArticleTags);

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleTagsServiceImpl.java

@ -20,16 +20,14 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.ArticleTagsDao;
import com.epmet.dto.ArticleTagsDTO;
import com.epmet.entity.ArticleTagsEntity;
import com.epmet.redis.ArticleTagsRedis;
import com.epmet.service.ArticleTagsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,9 +44,6 @@ import java.util.Map;
@Service
public class ArticleTagsServiceImpl extends BaseServiceImpl<ArticleTagsDao, ArticleTagsEntity> implements ArticleTagsService {
@Autowired
private ArticleTagsRedis articleTagsRedis;
@Override
public PageData<ArticleTagsDTO> page(Map<String, Object> params) {
IPage<ArticleTagsEntity> page = baseDao.selectPage(

8
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleVisitRecordServiceImpl.java

@ -20,21 +20,18 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.ArticleVisitRecordDao;
import com.epmet.dto.ArticleVisitRecordDTO;
import com.epmet.entity.ArticleVisitRecordEntity;
import com.epmet.redis.ArticleVisitRecordRedis;
import com.epmet.service.ArticleVisitRecordService;
import com.epmet.utils.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -48,9 +45,6 @@ import java.util.Map;
@Service
public class ArticleVisitRecordServiceImpl extends BaseServiceImpl<ArticleVisitRecordDao, ArticleVisitRecordEntity> implements ArticleVisitRecordService {
@Autowired
private ArticleVisitRecordRedis articleVisitRecordRedis;
@Override
public PageData<ArticleVisitRecordDTO> page(Map<String, Object> params) {
IPage<ArticleVisitRecordEntity> page = baseDao.selectPage(

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftContentServiceImpl.java

@ -20,16 +20,14 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.DraftContentDao;
import com.epmet.dto.DraftContentDTO;
import com.epmet.entity.DraftContentEntity;
import com.epmet.redis.DraftContentRedis;
import com.epmet.service.DraftContentService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,9 +44,6 @@ import java.util.Map;
@Service
public class DraftContentServiceImpl extends BaseServiceImpl<DraftContentDao, DraftContentEntity> implements DraftContentService {
@Autowired
private DraftContentRedis draftContentRedis;
@Override
public PageData<DraftContentDTO> page(Map<String, Object> params) {
IPage<DraftContentEntity> page = baseDao.selectPage(

8
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftCoverServiceImpl.java

@ -20,16 +20,14 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.DraftCoverDao;
import com.epmet.dto.DraftCoverDTO;
import com.epmet.entity.DraftCoverEntity;
import com.epmet.redis.DraftCoverRedis;
import com.epmet.service.DraftCoverService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -45,10 +43,6 @@ import java.util.Map;
*/
@Service
public class DraftCoverServiceImpl extends BaseServiceImpl<DraftCoverDao, DraftCoverEntity> implements DraftCoverService {
@Autowired
private DraftCoverRedis draftCoverRedis;
@Override
public PageData<DraftCoverDTO> page(Map<String, Object> params) {
IPage<DraftCoverEntity> page = baseDao.selectPage(

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftPublishRangeServiceImpl.java

@ -20,16 +20,14 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.DraftPublishRangeDao;
import com.epmet.dto.DraftPublishRangeDTO;
import com.epmet.entity.DraftPublishRangeEntity;
import com.epmet.redis.DraftPublishRangeRedis;
import com.epmet.service.DraftPublishRangeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,9 +44,6 @@ import java.util.Map;
@Service
public class DraftPublishRangeServiceImpl extends BaseServiceImpl<DraftPublishRangeDao, DraftPublishRangeEntity> implements DraftPublishRangeService {
@Autowired
private DraftPublishRangeRedis draftPublishRangeRedis;
@Override
public PageData<DraftPublishRangeDTO> page(Map<String, Object> params) {
IPage<DraftPublishRangeEntity> page = baseDao.selectPage(

4
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java

@ -33,14 +33,12 @@ import com.epmet.dto.form.DraftDetailFormDTO;
import com.epmet.dto.form.DraftListFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.DraftEntity;
import com.epmet.redis.DraftRedis;
import com.epmet.service.DraftService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -58,8 +56,6 @@ import java.util.Map;
@Service
public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> implements DraftService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private DraftRedis draftRedis;
@Override
public PageData<DraftDTO> page(Map<String, Object> params) {

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java

@ -20,18 +20,16 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.TagCustomerDao;
import com.epmet.dto.TagCustomerDTO;
import com.epmet.dto.form.UpdateTagFormDTO;
import com.epmet.dto.result.UpdateTagUseCountsResultDTO;
import com.epmet.entity.TagCustomerEntity;
import com.epmet.redis.TagCustomerRedis;
import com.epmet.service.TagCustomerService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -48,9 +46,6 @@ import java.util.Map;
@Service
public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagCustomerEntity> implements TagCustomerService {
@Autowired
private TagCustomerRedis tagCustomerRedis;
@Override
public PageData<TagCustomerDTO> page(Map<String, Object> params) {
IPage<TagCustomerEntity> page = baseDao.selectPage(

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagDefaultServiceImpl.java

@ -20,16 +20,14 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.TagDefaultDao;
import com.epmet.dto.TagDefaultDTO;
import com.epmet.entity.TagDefaultEntity;
import com.epmet.redis.TagDefaultRedis;
import com.epmet.service.TagDefaultService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,9 +44,6 @@ import java.util.Map;
@Service
public class TagDefaultServiceImpl extends BaseServiceImpl<TagDefaultDao, TagDefaultEntity> implements TagDefaultService {
@Autowired
private TagDefaultRedis tagDefaultRedis;
@Override
public PageData<TagDefaultDTO> page(Map<String, Object> params) {
IPage<TagDefaultEntity> page = baseDao.selectPage(

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagGridServiceImpl.java

@ -20,16 +20,14 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.TagGridDao;
import com.epmet.dto.TagGridDTO;
import com.epmet.entity.TagGridEntity;
import com.epmet.redis.TagGridRedis;
import com.epmet.service.TagGridService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,9 +44,6 @@ import java.util.Map;
@Service
public class TagGridServiceImpl extends BaseServiceImpl<TagGridDao, TagGridEntity> implements TagGridService {
@Autowired
private TagGridRedis tagGridRedis;
@Override
public PageData<TagGridDTO> page(Map<String, Object> params) {
IPage<TagGridEntity> page = baseDao.selectPage(

35
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -90,13 +90,40 @@ public interface ModuleConstant {
String MSG_ARTICLE_PUBLISH_ERROR = "您好,你发布的【%s】文章由于网络错误未发布成功,请重新发布,谢谢。";
/**
* 文章内容不能为空
* 草稿Id不存在
* */
String ARTICLE_CONTENT_IS_NULL = "文章内容不能为空";
String DRAFT_ID_IS_NOT_EXIST = "草稿ID不存在";
/**
* 文章标题不能为空
* 草稿已删除
* */
String ARTICLE_TITLE_IS_NULL = "文章标题不能为空";
String DRAFT_STATUS_IS_DEL = "草稿已删除";
String GET_USER_DETAIL_ERROR = "获取用户详情失败";
String GET_USER_CAN_SELECT_GRID_ERROR = "获取用户可选网格失败";
String DRAFT_STATUS_IS_NOT_ALLOW_MODIFY = "草稿状态不允许修改";
String DRAFT_PUBLISHER_IS_NULL = "发布单位不能为空";
String DRAFT_PUBLISHER_TYPE_ERROR = "发布单位类型不合法";
String DRAFT_PUBLISH_RANGE_IS_NULL = "发布范围不能为空";
String DRAFT_PUBLISH_DATE_IS_NULL = "发布时间不能为空";
String DRAFT_ID_IS_NULL = "草稿ID不能为空";
String DRAFT_CONTENT_AND_COVER = "内容和封面";
String DRAFT_CONTENT = "内容";
String DRAFT_COVER = "封面";
String DRAFT_CONTENT_IS_NULL = "文章封面不能为空";
String DRAFT_IS_TOP_ERROR = "是否置顶参数不合法";
}

3
epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.2__add_gridIds.sql

@ -0,0 +1,3 @@
ALTER TABLE `epmet_gov_voice`.`article_operate_record`
ADD COLUMN `GRID_IDS` varchar(1024) NULL DEFAULT NULL COMMENT '网格ID,下线文章时,多个以英文:隔开' AFTER `ARTICLE_ID`,
MODIFY COLUMN `OP_TYPE` varchar(32) NOT NULL COMMENT '操作类型 发布文章:publish;取消文章置顶:canceltop;设置置顶:settop;下线文章:offline;修改文章发布范围:updatepublishrange' AFTER `CONTENT`;

1
epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/epmet_gov_voice.sql

@ -250,6 +250,7 @@ CREATE TABLE article_operate_record(
ID VARCHAR(64) NOT NULL COMMENT '主键ID 主键ID' ,
CUSTOMER_ID VARCHAR(64) NOT NULL COMMENT '客户ID' ,
ARTICLE_ID VARCHAR(64) NOT NULL COMMENT '文章ID' ,
GRID_IDS VARCHAR(1024) NOT NULL COMMENT '网格ID,下线文章时,多个以英文:隔开' ,
OP_USER VARCHAR(128) NOT NULL COMMENT '执行人 xx街道-xx中心-姓名' ,
CONTENT VARCHAR(512) NOT NULL COMMENT '操作内容 操作内容,eg:重新编辑文章;' ,
OP_TYPE VARCHAR(32) NOT NULL COMMENT '操作类型 发布文章:publish;取消文章置顶:canceltop;设置置顶:settom;下线文章:offline;修改文章发布范围:updatepublishrange' ,

1
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml

@ -147,6 +147,7 @@
WHERE DEL_FLAG = '0'
AND (STATUS_FLAG = 'unpublish' OR STATUS_FLAG = 'auditfail')
AND CREATED_BY = #{userId}
ORDER BY CREATED_TIME DESC
</select>
<!-- 文章预览-获取文章基本属性 -->
<select id="selectDraftDetail" parameterType="java.lang.String" resultType="com.epmet.dto.result.DraftDetailResultDTO">

1
epmet-module/gov-voice/gov-voice-server/src/test/java/com/epmet/ArticleServiceTest.java

@ -38,7 +38,6 @@ public class ArticleServiceTest {
contentDTO.setDraftContentId("");
contentDTO.setContent("内容"+i);
contentDTO.setContentType("text");
contentDTO.setOrderNum(1+i);
list.add(contentDTO);
}
draftContentFromDTO.setContentList(list);

3
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java

@ -1,6 +1,7 @@
package com.epmet.openapi.scan.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.openapi.scan.service.impl.ScanService;
import com.epmet.openapi.scan.support.param.ImgScanParam;
import com.epmet.openapi.scan.support.param.TextScanParam;
@ -32,6 +33,7 @@ public class ScanController {
*/
@RequestMapping("imgSyncScan")
public Result<SyncScanResult> ImgSyncScan(@RequestBody ImgScanParam param) {
ValidatorUtils.validateEntity(param);
Result<SyncScanResult> scanResultResult = scanService.sendSyncImgScan(param);
return scanResultResult;
}
@ -44,6 +46,7 @@ public class ScanController {
*/
@RequestMapping("textSyncScan")
public Result<SyncScanResult> textSyncScan(@RequestBody TextScanParam param) {
ValidatorUtils.validateEntity(param);
Result<SyncScanResult> scanResultResult = scanService.sendTextScan(param);
return scanResultResult;
}

1
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiAuthInterceptor.java

@ -31,7 +31,6 @@ public class ScanApiAuthInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String ip = IpUtils.getIpAddr(request);
log.info("preHandle requestUrl",request.getRequestURL());
SetOperations setOperations = redisTemplate.opsForSet();
if (!setOperations.isMember(RedisKeys.getWhiteList(), ip)) {
log.warn("preHandle ip:{} is not in whitelist", ip);

1
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java

@ -12,6 +12,7 @@ import com.aliyuncs.green.model.v20180509.TextScanRequest;
import com.aliyuncs.http.FormatType;
import com.aliyuncs.http.HttpResponse;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.openapi.scan.common.constant.SysConstant;
import com.epmet.openapi.scan.common.enu.ImgSceneEnum;
import com.epmet.openapi.scan.common.enu.SuggestionEnum;

4
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java

@ -2,6 +2,8 @@ package com.epmet.openapi.scan.support.param;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
@ -30,6 +32,8 @@ public class ImgScanParam implements Serializable {
* 要检测的内容列表必填
* remark一组任务列表中的taskId不能相同
*/
@Valid
@NotEmpty(message = "任务列表不能为空")
private List<ImgTask> tasks;
/**

3
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java

@ -2,6 +2,7 @@ package com.epmet.openapi.scan.support.param;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -19,10 +20,12 @@ public class ImgTask implements Serializable {
* 要检测的数据id 非必填
*
* */
@NotNull(message = "dataId不能为空")
private String dataId;
/**
* 图片url 必填
*/
@NotNull(message = "图片URL不能为空")
private String url;
}

4
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java

@ -2,6 +2,8 @@ package com.epmet.openapi.scan.support.param;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
@ -24,6 +26,8 @@ public class TextScanParam implements Serializable {
*
* @see com.epmet.openapi.scan.common.enu.ImgSceneEnum;
*/
@Valid
@NotEmpty(message = "任务列表不能为空")
private List<String> scenes;
/**

6
epmet-openapi/epmet-openapi-scan/src/main/resources/readme

@ -1,2 +1,4 @@
#添加白名单
sadd epmet:openapi:scan:whitelist "客户端ip地址"
#访问openApi 需要向redis中 添加白名单
sadd epmet:openapi:scan:whitelist "客户端ip地址"
#eg:
sadd epmet:openapi:scan:whitelist "\"192.168.1.1\""
Loading…
Cancel
Save