wxz 5 years ago
parent
commit
b9fb22b903
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 2
      epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml
  3. 2
      epmet-module/epmet-oss/epmet-oss-server/pom.xml
  4. 42
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleAgencyGridListResultDTO.java
  5. 2
      epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml
  6. 2
      epmet-module/gov-org/gov-org-server/pom.xml
  7. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  8. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java
  9. 19
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishArticleFormDTO.java
  10. 2
      epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml
  11. 2
      epmet-module/gov-voice/gov-voice-server/pom.xml
  12. 41
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  13. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/DraftController.java
  14. 6
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java
  15. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java
  16. 11
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  17. 58
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  18. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java
  19. 16
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml
  20. 3
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml
  21. 3
      epmet-module/gov-voice/gov-voice-server/src/test/java/com/epmet/ArticleServiceTest.java

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -65,8 +65,11 @@ public enum EpmetErrorCode {
OPER_UPLOAD_FILE_OVER_SIZE(8707, "文件体积过大"),
OPER_UPLOAD_FILE_TYPE_ERROR(8708, "文件类型错误"),
ARTICLE_PUBLISH_ERROR(8801, "发布文章失败,请刷新重试"),
CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常");
private int code;
private String msg;

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.16
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.17
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.16</version>
<version>0.3.17</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-oss</artifactId>

42
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ArticleAgencyGridListResultDTO.java

@ -0,0 +1,42 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <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.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 党建声音-可选发布范围可下线网格列表-接口返参
*
* @author sun
*/
@Data
public class ArticleAgencyGridListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 树结构对象
*/
private ArticleGridResultDTO agencyGridList;
}

2
epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
gov-org-server:
container_name: gov-org-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.62
image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.63
ports:
- "8092:8092"
network_mode: host # 使用现有网络

2
epmet-module/gov-org/gov-org-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.62</version>
<version>0.3.63</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>gov-org</artifactId>

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -771,11 +771,11 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
//4:根据不同角色查询不同数据
CustomerAgencyEntity agencyEntity = baseDao.selectById(staffAgencyDTO.getAgencyId());
//当前机关信息
returnDTO.setAgencyId(agencyEntity.getId());
returnDTO.setAgencyName(agencyEntity.getOrganizationName());
if (party) {
//4.1:查询当前机关的网格列表以及所有下级机关的网格列表
//当前机关信息
returnDTO.setAgencyId(agencyEntity.getId());
returnDTO.setAgencyName(agencyEntity.getOrganizationName());
//当前机关下部门列表信息
List<AgencyDeptList> agencyDeptList = customerDepartmentDao.selectAgencyDeptMsgList(agencyEntity.getId());
returnDTO.setAgencyDeptList(agencyDeptList);

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

@ -34,9 +34,7 @@ import java.util.List;
public class DraftContentFromDTO implements Serializable {
private static final long serialVersionUID = -4206020151361420221L;
private static final long serialVersionUID = -5699594328218833256L;
/**
* 草稿ID
*/
@ -51,6 +49,7 @@ public class DraftContentFromDTO implements Serializable {
/**
* 内容列表
*/
@NotBlank(message = "文章内容不能为空")
private List<DraftContentDTO> contentList;
@Data

19
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/PublishArticleFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* 政府端-发布文章参数
*/
@Data
public class PublishArticleFormDTO implements Serializable {
private static final long serialVersionUID = -1659776209159063672L;
/**
* 要发布的草稿Id
*/
private String draftId;
}

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

2
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.10</version>
<version>0.3.15</version>
<parent>
<artifactId>gov-voice</artifactId>
<groupId>com.epmet</groupId>

41
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -20,6 +20,8 @@ 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.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
@ -64,8 +66,22 @@ public class ArticleController {
* @Description 党建声音-政府端-可选发布范围
**/
@PostMapping("agencygridlist")
public Result<ArticleGridResultDTO> agencyGridList(@LoginUser TokenDto tokenDTO) {
return new Result<ArticleGridResultDTO>().ok(articleService.agencyGridList(tokenDTO));
public Result<ArticleAgencyGridListResultDTO> agencyGridList(@LoginUser TokenDto tokenDTO) {
ArticleAgencyGridListResultDTO agencyGridList = new ArticleAgencyGridListResultDTO();
agencyGridList.setAgencyGridList(articleService.agencyGridList(tokenDTO));
return new Result<ArticleAgencyGridListResultDTO>().ok(agencyGridList);
}
/**
* desc:政府端-点击返回按钮时点击保存草稿 无需校验参数
* @param fromDTO
* @throws Exception
*/
@PostMapping("savedraft")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH)
public Result<DraftContentSaveResultDTO> savedraft(@LoginUser TokenDto tokenDto,@RequestBody DraftContentFromDTO fromDTO) throws Exception {
DraftContentSaveResultDTO draftDTO = articleService.saveDraft(tokenDto, fromDTO);
return new Result<DraftContentSaveResultDTO>().ok(draftDTO);
}
/**
@ -76,8 +92,7 @@ public class ArticleController {
@PostMapping("savecontent")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH)
public Result<DraftContentSaveResultDTO> saveOrUpdateContent(@LoginUser TokenDto tokenDto,@RequestBody DraftContentFromDTO fromDTO) throws Exception {
String draftId = articleService.saveOrUpdateContent(tokenDto, fromDTO);
DraftContentSaveResultDTO resultDTO = new DraftContentSaveResultDTO(draftId);
DraftContentSaveResultDTO resultDTO = articleService.saveOrUpdateContent(tokenDto, fromDTO, true);
return new Result<DraftContentSaveResultDTO>().ok(resultDTO);
}
@ -195,16 +210,15 @@ public class ArticleController {
/**
* desc:发布文章
* @param draftId
* @param formDTO
* @throws Exception
*/
@PostMapping("publish")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH)
public Result<Boolean> publishArticle(@LoginUser TokenDto tokenDto, String draftId) throws Exception {
Boolean isSuccess = articleService.publish(tokenDto, draftId);
public Result<Boolean> publishArticle(@LoginUser TokenDto tokenDto, @RequestBody PublishArticleFormDTO formDTO) throws Exception {
Boolean isSuccess = articleService.publish(tokenDto, formDTO.getDraftId());
if (isSuccess){
//TODO 异步校验内容
scanContent(tokenDto,draftId);
scanContent(tokenDto,formDTO.getDraftId());
}
return new Result<Boolean>().ok(isSuccess);
}
@ -212,6 +226,9 @@ public class ArticleController {
@Async
public void scanContent(TokenDto tokenDto,String draftId){
SyncScanResult syncScanResult = articleService.scanContent(tokenDto,draftId);
if (syncScanResult == null){
throw new RenException(EpmetErrorCode.ARTICLE_PUBLISH_ERROR.getCode(),EpmetErrorCode.ARTICLE_PUBLISH_ERROR.getMsg());
}
if (syncScanResult.isAllPass()){
articleService.scanAllPassPublishArticle(tokenDto,draftId);
}else{
@ -299,10 +316,12 @@ public class ArticleController {
* @Description 党建声音-政府端-可下线网格列表
**/
@PostMapping("publishgridlist")
public Result<ArticleGridResultDTO> publishGridList(@LoginUser TokenDto tokenDTO, @RequestBody PublishGridListFormDTO formDTO) {
public Result<ArticleAgencyGridListResultDTO> publishGridList(@LoginUser TokenDto tokenDTO, @RequestBody PublishGridListFormDTO formDTO) {
formDTO.setStaffId(tokenDTO.getUserId());
ValidatorUtils.validateEntity(formDTO, PublishGridListFormDTO.AddUserInternalGroup.class);
return new Result<ArticleGridResultDTO>().ok(articleService.publishGridList(formDTO));
ArticleAgencyGridListResultDTO agencyGridList = new ArticleAgencyGridListResultDTO();
agencyGridList.setAgencyGridList(articleService.publishGridList(formDTO));
return new Result<ArticleAgencyGridListResultDTO>().ok(agencyGridList);
}

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

@ -115,7 +115,7 @@ public class DraftController {
@PostMapping("draftlist")
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_DRAFT_LIST)
public Result<List<DraftListResultDTO>> draftList(@LoginUser TokenDto tokenDto, DraftListFormDTO formDTO) {
public Result<List<DraftListResultDTO>> draftList(@LoginUser TokenDto tokenDto, @RequestBody DraftListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<DraftListResultDTO>>().ok(draftService.draftList(tokenDto, formDTO).getList());
}

6
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java

@ -83,9 +83,9 @@ public interface ArticleDao extends BaseDao<ArticleEntity> {
* @param gridList
* @return java.util.List<com.epmet.dto.result.PublishedListResultDTO>
*/
@DataFilter(tableAliases = {"a", "apr"}, gridIdsArgName = "gridList")
List<PublishedListResultDTO> selectArticleListForGrid(@Param("customerId") String customerId,
@Param("tagIdList") List<String> tagIdList, Set<String> gridList);
@Param("tagIdList") List<String> tagIdList,
@Param("gridList")Set<String> gridList);
/**
* 已下线文章列表
@ -94,7 +94,7 @@ public interface ArticleDao extends BaseDao<ArticleEntity> {
* @param gridList
* @return java.util.List<com.epmet.dto.result.OfflineListResultDTO>
*/
@DataFilter(tableAliases = "apr", gridIdsArgName = "gridList")
@DataFilter(tableAliases = "a", gridIdsArgName = "gridList")
List<OfflineListResultDTO> selectOfflineList(Set<String> gridList);

2
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftDao.java

@ -99,4 +99,6 @@ public interface DraftDao extends BaseDao<DraftEntity> {
* @date 2020/6/5 12:23
**/
List<GovDraftContentDTO> selectDraftContentList(String draftId);
int deleteDraft(String draftId);
}

11
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -48,9 +48,10 @@ public interface ArticleService extends BaseService<ArticleEntity> {
*
* @param tokenDto
* @param fromDTO
* @param required
* @return
*/
String saveOrUpdateContent(TokenDto tokenDto, DraftContentFromDTO fromDTO);
DraftContentSaveResultDTO saveOrUpdateContent(TokenDto tokenDto, DraftContentFromDTO fromDTO, boolean required);
/**
* 政府端已发布已下线文章详情
@ -183,4 +184,12 @@ public interface ArticleService extends BaseService<ArticleEntity> {
* @param syncScanResult
*/
void updateAuditStatusFailById(String draftId, SyncScanResult syncScanResult);
/**
* desc:政府端点击返回时点击保存草稿
* @param tokenDto
* @param fromDTO
* @return
*/
DraftContentSaveResultDTO saveDraft(TokenDto tokenDto, DraftContentFromDTO fromDTO);
}

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

@ -166,32 +166,28 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
@Override
@Transactional(rollbackFor = Exception.class)
public String saveOrUpdateContent(TokenDto tokenDto, DraftContentFromDTO fromDTO) {
public DraftContentSaveResultDTO saveOrUpdateContent(TokenDto tokenDto, DraftContentFromDTO fromDTO, boolean required) {
log.debug("saveOrUpdateContent param:{}", JSON.toJSONString(fromDTO));
ValidatorUtils.validateEntity(fromDTO, AddGroup.class, DefaultGroup.class);
if (required) {
ValidatorUtils.validateEntity(fromDTO, AddGroup.class, DefaultGroup.class);
}
DraftEntity draftEntity = null;
List<DraftContentEntity> draftContentList = null;
if (StringUtils.isNotBlank(fromDTO.getDraftId())) {
draftEntity = draftDao.selectById(fromDTO.getDraftId());
if (draftEntity == null) {
log.warn("saveOrUpdateContent draftId is not exist in db");
throw new RenException("参数错误");
}
draftEntity.setTitle(draftEntity.getTitle());
draftEntity.setPreviewContent("");
draftEntity = this.checkDraftStatus(fromDTO.getDraftId());
draftEntity.setTitle(StringUtils.isBlank(draftEntity.getTitle()) ? "" : draftEntity.getTitle());
buildPreviewContent(fromDTO, draftEntity);
draftDao.updateById(draftEntity);
} else {
LoginUserDetailsFormDTO detailsFormDTO = new LoginUserDetailsFormDTO();
detailsFormDTO.setUserId(loginUserUtil.getLoginUserId());
detailsFormDTO.setApp(loginUserUtil.getLoginUserApp());
detailsFormDTO.setClient(loginUserUtil.getLoginUserClient());
Result<LoginUserDetailsResultDTO> loginUserDetails = epmetUserOpenFeignClient.getLoginUserDetails(detailsFormDTO);
if (loginUserDetails == null || loginUserDetails.getData() == null){
if (loginUserDetails == null || loginUserDetails.getData() == null) {
log.warn("saveOrUpdateContent getloginUserDetails return null");
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(),EpmetErrorCode.SERVER_ERROR.getMsg());
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
draftEntity = new DraftEntity();
draftEntity.setTitle(fromDTO.getTitle());
@ -203,7 +199,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftEntity.setGridId("");
draftEntity.setDepartmentId(loginUserDetails.getData().getCustomerId());
draftEntity.setDelFlag(NumConstant.ZERO_STR);
draftEntity.setPreviewContent("");
buildPreviewContent(fromDTO, draftEntity);
draftDao.insert(draftEntity);
}
@ -211,19 +206,21 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
String draftId = draftEntity.getId();
fromDTO.setDraftId(draftId);
draftContentList = buildDraftContent(tokenDto, fromDTO);
if (CollectionUtils.isEmpty(draftContentList)) {
log.warn("saveOrUpdateContent contentList is empty");
throw new RenException("参数错误");
}
Map<String, Object> draftIdMap = new HashMap<>();
draftIdMap.put(ModuleConstant.FIELD_DRAFT_ID, fromDTO.getDraftId());
draftContentDao.deleteByMap(draftIdMap);
draftContentService.insertBatch(draftContentList);
return draftId;
if (!CollectionUtils.isEmpty(draftContentList)) {
draftContentService.insertBatch(draftContentList);
}
return new DraftContentSaveResultDTO(draftId);
}
private void buildPreviewContent(DraftContentFromDTO fromDTO, DraftEntity draftEntity) {
if (CollectionUtils.isEmpty(fromDTO.getContentList())){
draftEntity.setPreviewContent("");
return;
}
for (int i = 0; i < fromDTO.getContentList().size(); i++) {
if (DraftConstant.TEXT.equals(fromDTO.getContentList().get(i).getContentType())) {
String content = fromDTO.getContentList().get(i).getContent();
@ -308,11 +305,12 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
if (NumConstant.ONE_STR.equals(draftEntity.getDelFlag())) {
log.warn("saveDraftAttr draftId:{} have deleted",draftId);
throw new RenException("参数错误");
throw new RenException("草稿已删除");
}
if (DraftConstant.PUBLISHED.equals(draftEntity.getStatusFlag())) {
//只有为发布的才能保存修改
if (!DraftConstant.UNPUBLISH.equals(draftEntity.getStatusFlag())) {
log.warn("saveDraftAttr draftId:{} publishStatus have published");
throw new RenException("参数错误");
throw new RenException("草稿发布状态错误");
}
return draftEntity;
}
@ -393,7 +391,6 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
coverEntity.setImgUrl(coverImg);
coverEntity.setAuditStatus(ModuleConstant.AUDIT_STATUS_PASS);
coverEntity.setAuditReason("");
coverEntity.setRevision(0);
coverEntity.setDelFlag(NumConstant.ZERO_STR);
return coverEntity;
}
@ -425,10 +422,10 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
draftPublishRangeEntity.setAgencyGridName(agencyGridName);
draftPublishRangeEntity.setOffLineTime(null);
draftPublishRangeEntity.setPublishStatus(DraftConstant.UNPUBLISH);
draftPublishRangeEntity.setRevision(0);
draftPublishRangeEntity.setDelFlag(NumConstant.ZERO_STR);
draftPublishRangeEntity.setPids(articleGridResultDTO.getPids());
draftPublishRangeEntity.setAllParentName(articleGridResultDTO.getAllParentName());
draftPublishRangeEntity.setAgencyId(articleGridResultDTO.getAgencyId());
publishRangeEntityList.add(draftPublishRangeEntity);
}
@ -444,9 +441,12 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
* @return
*/
private List<DraftContentEntity> buildDraftContent(TokenDto tokenDto, DraftContentFromDTO fromDTO) {
List<DraftContentFromDTO.DraftContentDTO> contentList = fromDTO.getContentList();
if (CollectionUtils.isEmpty(contentList)) {
return null;
}
List<DraftContentEntity> newContentList = new ArrayList<>();
List<DraftContentFromDTO.DraftContentDTO> contentList = fromDTO.getContentList();
for (int i = 0; i < contentList.size(); i++) {
DraftContentFromDTO.DraftContentDTO content = contentList.get(i);
@ -460,6 +460,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
newContentList.add(entity);
}
return newContentList;
}
@ -906,7 +907,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return null;
}
if (!NumConstant.ONE_STR.equals(draftEntity.getDelFlag())){
if (!NumConstant.ZERO_STR.equals(draftEntity.getDelFlag())){
log.error("scanContent draftId:{} delFlag:{} is not support 2 modify",draftId,draftEntity.getDelFlag());
return null;
}
@ -999,6 +1000,11 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
});
}
@Override
public DraftContentSaveResultDTO saveDraft(TokenDto tokenDto, DraftContentFromDTO fromDTO) {
return this.saveOrUpdateContent(tokenDto, fromDTO, false);
}
public Result sendMsg(String title,String content) {
UserMessageFormDTO formDTO = new UserMessageFormDTO();
formDTO.setCustomerId(loginUserUtil.getLoginUserApp());

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

@ -122,7 +122,7 @@ public class DraftServiceImpl extends BaseServiceImpl<DraftDao, DraftEntity> imp
return;
}
draftDTO.setDelFlag(NumConstant.ONE);
this.update(draftDTO);
baseDao.deleteDraft(draftDTO.getId());
}
@Override

16
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml

@ -96,6 +96,9 @@
WHERE a.DEL_FLAG = '0'
AND a.STATUS_FLAG = 'published'
AND a.CUSTOMER_ID = #{customerId}
<foreach item="gridId" collection="gridList" open="AND (" separator="or" close=")" index="">
a.GRID_ID = #{gridId}
</foreach>
UNION
SELECT DISTINCT
aa.ID AS "articleId",
@ -109,7 +112,11 @@
INNER JOIN article_publish_range apr ON aa.ID = apr.ARTICLE_ID AND apr.DEL_FLAG = 0 AND apr.PUBLISH_STATUS = 'published'
WHERE aa.DEL_FLAG = '0'
AND aa.STATUS_FLAG = 'published'
AND aa.CUSTOMER_ID = #{customerId}) t
AND aa.CUSTOMER_ID = #{customerId}
<foreach item="gridId" collection="gridList" open="AND (" separator="or" close=")" index="">
apr.GRID_ID = #{gridId}
</foreach>
) t
<if test="tagIdList !=null and tagIdList.size() > 0">
AND EXISTS (
SELECT DISTINCT
@ -131,12 +138,11 @@
a.TITLE AS "title",
IFNULL(a.PREVIEW_CONTENT, "") AS "previewContent",
a.PUBLISHER_NAME AS "publisherName",
a.PUBLISH_DATE AS "publishDate"
a.OFF_LINE_TIME AS "publishDate"
FROM article a
INNER JOIN article_publish_range apr ON a.ID = apr.ARTICLE_ID AND apr.DEL_FLAG = '0'
WHERE a.DEL_FLAG = '0'
AND apr.PUBLISH_STATUS = 'offline'
ORDER BY apr.OFF_LINE_TIME DESC
AND a.STATUS_FLAG = 'offline'
ORDER BY a.OFF_LINE_TIME DESC
</select>

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

@ -125,4 +125,7 @@
ORDER BY
dc.ORDER_NUM ASC
</select>
<update id="deleteDraft" parameterType="java.lang.String">
update draft set DEL_FLAG='1' where id=#{draftId}
</update>
</mapper>

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

@ -3,6 +3,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.constant.DraftConstant;
import com.epmet.dto.form.DraftAttrFromDTO;
import com.epmet.dto.form.DraftContentFromDTO;
import com.epmet.dto.result.DraftContentSaveResultDTO;
import com.epmet.service.ArticleService;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -41,7 +42,7 @@ public class ArticleServiceTest {
list.add(contentDTO);
}
draftContentFromDTO.setContentList(list);
String s = articleService.saveOrUpdateContent(tokenDto, draftContentFromDTO);
DraftContentSaveResultDTO s = articleService.saveOrUpdateContent(tokenDto, draftContentFromDTO, false);
System.out.println(s);
}

Loading…
Cancel
Save