From 78f90a702642ff11253f4f14077091bb856ec441 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 26 Aug 2021 10:24:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E5=86=85=E5=AE=B9=E6=9C=80?= =?UTF-8?q?=E5=A4=9A=E8=BE=93=E5=85=A5500=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 1 + .../epmet/service/impl/InfoServiceImpl.java | 40 ++++++++++--------- .../migration/V0.3.14__create_info_table.sql | 2 +- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 3ec318507f..aa74cd8e2a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -107,6 +107,7 @@ public enum EpmetErrorCode { REPLY_INFO_CONTENT_NOT_NULL(8610,"回复内容不能为空"), PLEASE_CHOOSE_MEMBER(8611,"请选择成员"), INFO_GROUP_NAME_EXISTS(8612,"名称已存在"), + INFO_REPLY_CONTENT_LENGTH_LIMIT(8613,"回复内容最多输入500字"), // 爱心互助 居民端 NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java index 684b4ebd50..ba3712ccca 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java @@ -17,12 +17,12 @@ package com.epmet.service.impl; -import com.alibaba.fastjson.JSON; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; @@ -99,7 +99,7 @@ public class InfoServiceImpl extends BaseServiceImpl implem Set orgStaffIds=queryOrgStaffIds(formDTO.getCustomerId(),formDTO.getOrgList()); Set roleStaffIds=queryRoleStaffIds(formDTO.getRoleIdList(),formDTO.getCustomerId()); Set groupStaffIds = CollectionUtils.isNotEmpty(formDTO.getGroupIdList()) ? infoGroupReceiversDao.selectStaffIds(formDTO.getGroupIdList()) : Collections.EMPTY_SET; - log.info("群组选择的人:"+JSON.toJSONString(groupStaffIds,true)); + //log.info("群组选择的人:"+JSON.toJSONString(groupStaffIds,true)); //3、计算接收人: Set totalReceiver=new LinkedHashSet(); @@ -157,7 +157,7 @@ public class InfoServiceImpl extends BaseServiceImpl implem userMessageEntity.setTitle(UserMessageConstans.INFO_TITLE); userMessageEntity.setMessageContent(String.format(UserMessageConstans.INFO_CONTENT_TEMP, infoEntity.getContent().length() > NumConstant.FIFTY ? - StringUtils.substring(infoEntity.getContent(), NumConstant.ZERO,NumConstant.FORTY_NINE) : infoEntity.getContent())); + StringUtils.substring(infoEntity.getContent(), NumConstant.ZERO,NumConstant.FORTY_NINE) : infoEntity.getContent())); userMessageEntity.setReadFlag(UserMessageConstans.UNREAD); userMessageEntity.setMessageType(UserMessageConstans.MESSAGE_TYPE_INFO); userMessageEntity.setTargetId(infoEntity.getId()); @@ -222,10 +222,14 @@ public class InfoServiceImpl extends BaseServiceImpl implem @Override public ReplyInfoResultDTO replyInfo(ReplyInfoFormDTO formDTO) { //1、插入回复记录、回复附件 - //内容和附件 2选一 + // 2、内容和附件 2选一 if(StringUtils.isBlank(formDTO.getContent())&&CollectionUtils.isEmpty(formDTO.getAttachmentList())){ throw new RenException(EpmetErrorCode.REPLY_INFO_CONTENT_NOT_NULL.getCode(), EpmetErrorCode.REPLY_INFO_CONTENT_NOT_NULL.getMsg()); } + // 3、回复内容不能超过500字 + if(StringUtils.isNotBlank(formDTO.getContent())&&formDTO.getContent().length()>500){ + throw new RenException(EpmetErrorCode.INFO_REPLY_CONTENT_LENGTH_LIMIT.getCode(), EpmetErrorCode.INFO_REPLY_CONTENT_LENGTH_LIMIT.getMsg()); + } InfoReplyEntity infoReplyEntity=new InfoReplyEntity(); infoReplyEntity.setInfoId(formDTO.getInfoId()); infoReplyEntity.setCustomerId(formDTO.getCustomerId()); @@ -233,14 +237,14 @@ public class InfoServiceImpl extends BaseServiceImpl implem infoReplyDao.insert(infoReplyEntity); int sort=1; if(StringUtils.isNotBlank(formDTO.getContent())){ - InfoReplyContentEntity contentEntity=new InfoReplyContentEntity(); - contentEntity.setCustomerId(formDTO.getCustomerId()); - contentEntity.setInfoReplyId(infoReplyEntity.getId()); - contentEntity.setReplyType("text"); - contentEntity.setContent(formDTO.getContent()); - contentEntity.setSort(sort); - infoReplyContentDao.insert(contentEntity); - sort++; + InfoReplyContentEntity contentEntity=new InfoReplyContentEntity(); + contentEntity.setCustomerId(formDTO.getCustomerId()); + contentEntity.setInfoReplyId(infoReplyEntity.getId()); + contentEntity.setReplyType("text"); + contentEntity.setContent(formDTO.getContent()); + contentEntity.setSort(sort); + infoReplyContentDao.insert(contentEntity); + sort++; } if(CollectionUtils.isNotEmpty(formDTO.getAttachmentList())){ for(FileCommonDTO att:formDTO.getAttachmentList()) { @@ -353,11 +357,11 @@ public class InfoServiceImpl extends BaseServiceImpl implem OrgStaffFormDTO orgStaffFormDTO=new OrgStaffFormDTO(); orgStaffFormDTO.setCustomerId(customerId); for(OrgCommonDTO org:orgList){ - if("grid".equals(org.getOrgType())){ - orgStaffFormDTO.getGridIds().add(org.getOrgId()); - }else if("agency".equals(org.getOrgType())){ + if(OrgTypeEnum.GRID.getCode().equals(org.getOrgType())){ + orgStaffFormDTO.getGridIds().add(org.getOrgId()); + }else if(OrgTypeEnum.AGENCY.getCode().equals(org.getOrgType())){ orgStaffFormDTO.getAgencyIds().add(org.getOrgId()); - }else if("dept".equals(org.getOrgType())){ + }else if(OrgTypeEnum.DEPT.getCode().equals(org.getOrgType())){ orgStaffFormDTO.getDeptIds().add(org.getOrgId()); } } @@ -366,7 +370,7 @@ public class InfoServiceImpl extends BaseServiceImpl implem throw new RenException("根据组织查询工作人员异常"); } if(CollectionUtils.isEmpty(result.getData())){ - log.info("已选择的架构里没有工作人员"); + log.warn("已选择的架构里没有工作人员"); return Collections.EMPTY_SET; } return result.getData(); @@ -393,7 +397,7 @@ public class InfoServiceImpl extends BaseServiceImpl implem throw new RenException("根据角色查询工作人员异常"); } if(CollectionUtils.isEmpty(result.getData())){ - log.info("角色下没有工作人员"); + log.warn("角色下没有工作人员"); return Collections.EMPTY_SET; } return result.getData(); diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.14__create_info_table.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.14__create_info_table.sql index 820e8ca67c..d13a3e6de3 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.14__create_info_table.sql +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.14__create_info_table.sql @@ -127,7 +127,7 @@ CREATE TABLE `info_reply_content` ( `ATTACHMENT_NAME` varchar(64) DEFAULT NULL COMMENT '附件名', `ATTACHMENT_FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', `REPLY_TYPE` varchar(64) NOT NULL COMMENT '回复的类型(文本-text、图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', - `CONTENT` varchar(255) NOT NULL COMMENT '如果是文本对应的是文字,如果是其他类型,对应的是url', + `CONTENT` varchar(512) NOT NULL COMMENT '如果是文本对应的是文字,如果是其他类型,对应的是url', `SORT` int(1) NOT NULL COMMENT '排序字段', `ATTACHMENT_SIZE` int(11) DEFAULT NULL COMMENT '文件大小,单位b', `DURATION` int(11) unsigned DEFAULT '0' COMMENT '语音或视频时长,秒',