Browse Source

feat(message): 消息增加

huey 1 năm trước cách đây
mục cha
commit
62f8bd631b

+ 9 - 0
src/main/java/com/dragon/tj/portal/common/dto/notice/NoticeInfoReq.java

@@ -25,6 +25,13 @@ public class NoticeInfoReq {
     @NotBlank(message = "应用编码不能为空")
     private String scopeId;
 
+    @NotBlank(message = "应用url不能为空")
+    private String scopeUrl;
+    /**
+    *填充
+    */
+    private String scopeName;
+
     @Range(min = 4, max = 6, message = "请填入4~6,4 任务类 5 通知类 6 超期提醒类")
     private Integer messageType;
 
@@ -67,6 +74,8 @@ public class NoticeInfoReq {
     @NotBlank(message = "推送人组织名称 不能为空")
     private String clientOrgName;
 
+    @NotBlank(message = "推送人名称 不能为空")
+    private String clientName;
     /**
      * md5 (登录人标识+t)
      */

+ 3 - 2
src/main/java/com/dragon/tj/portal/common/enums/message/MessageInfoErrorEnums.java

@@ -27,9 +27,10 @@ public interface MessageInfoErrorEnums extends FrameResultError {
 
         MESSAGE_CONTRACTS_EMPTY(201001, "信息交流的联系人不能为空!"),
         MESSAGE_DEPT_EMPTY(201002, "当前信息类型部门名称不能为空!"),
-        MESSAGE_READ_ALREADY(201002, "当前信息已读"),
+        MESSAGE_READ_ALREADY(201003, "当前信息已读"),
 
-        NOTICE_LIMIT_EMPTY(201002, "当前消息范围不能为空!"),
+        NOTICE_LIMIT_EMPTY(201004, "当前消息范围不能为空!"),
+        NOTICE_INFO_ERROR(201005, "当前消息编码信息不存在!"),
 
 
         ;

+ 3 - 0
src/main/java/com/dragon/tj/portal/entity/NoticeInfo.java

@@ -72,6 +72,9 @@ public class NoticeInfo implements Serializable {
     private String createUser;
     private String createOrgName;
     private String createOrgCode;
+    private String scopeId;
+    private String scopeUrl;
+    private String scopeName;
 
     /**
      * 修改人

+ 2 - 0
src/main/java/com/dragon/tj/portal/service/AppInfoService.java

@@ -10,4 +10,6 @@ public interface AppInfoService extends IService<AppInfo> {
 
     List<String> getAllAppSysCodes();
 
+    AppInfo getOneByCode(String code);
+
 }

+ 10 - 0
src/main/java/com/dragon/tj/portal/service/impl/AppInfoServiceImpl.java

@@ -33,6 +33,16 @@ public class AppInfoServiceImpl extends ServiceImpl<AppInfoMapper, AppInfo> impl
             return Lists.newArrayList(sysCodes);
         }
     }
+
+    @Override
+    public AppInfo getOneByCode(String code) {
+        LambdaQueryWrapper<AppInfo> wrapper = Wrappers.lambdaQuery();
+        wrapper.eq(AppInfo::getSystemNumber, code);
+        AppInfo one = this.getOne(wrapper);
+        return one;
+    }
+
+
 }
 
 

+ 15 - 8
src/main/java/com/dragon/tj/portal/service/impl/NoticeInfoServiceImpl.java

@@ -21,15 +21,9 @@ import com.dragon.tj.portal.common.vo.notice.NoticeInfoParam;
 import com.dragon.tj.portal.common.vo.notice.NoticeInfoVO;
 import com.dragon.tj.portal.component.exception.message.MessageInfoException;
 import com.dragon.tj.portal.component.message.MessageProducer;
-import com.dragon.tj.portal.entity.MessageInfo;
-import com.dragon.tj.portal.entity.MsgRecord;
-import com.dragon.tj.portal.entity.NoticeInfo;
-import com.dragon.tj.portal.entity.NoticeInfoScope;
+import com.dragon.tj.portal.entity.*;
 import com.dragon.tj.portal.mapper.NoticeInfoMapper;
-import com.dragon.tj.portal.service.MsgRecordService;
-import com.dragon.tj.portal.service.NoticeInfoScopeService;
-import com.dragon.tj.portal.service.NoticeInfoService;
-import com.dragon.tj.portal.service.SysUserMenuService;
+import com.dragon.tj.portal.service.*;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import lombok.extern.slf4j.Slf4j;
@@ -42,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
 /**
@@ -74,6 +69,9 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
     @Autowired
     private NoticeInfoVOConvert noticeInfoVOConvert;
 
+    @Autowired
+    private AppInfoService appInfoService;
+
     @Value("${notice-secret:true}")
     private boolean noticeSecret;
 
@@ -136,6 +134,11 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
         boolean isSend = false;
         Integer messageType = noticeInfoReq.getMessageType();
         String scopeId = noticeInfoReq.getScopeId();
+        AppInfo appInfo = appInfoService.getOneByCode(noticeInfoReq.getScopeId());
+        if (Objects.isNull(appInfo)) {
+            throw new MessageInfoException(MessageInfoErrorEnums.Code.NOTICE_INFO_ERROR);
+        }
+        noticeInfoReq.setScopeName(appInfo.getSystemName());
         Set<String> messageClientIds = this.getMessageClientIds(messageType, scopeId);
         log.info("transferIds-scopeId-{}-{}", scopeId, messageClientIds);
         if (CollUtil.isNotEmpty(messageClientIds)) {
@@ -203,8 +206,12 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
 
         NoticeInfo noticeInfo = noticeReqConvert.reqToInfo(noticeInfoReq);
         noticeInfo.setCreateBy(noticeInfoReq.getClientId());
+        noticeInfo.setCreateUser(noticeInfoReq.getClientName());
         noticeInfo.setCreateOrgCode(noticeInfoReq.getClientOrgCode());
         noticeInfo.setCreateOrgName(noticeInfoReq.getClientOrgName());
+        noticeInfo.setScopeId(noticeInfoReq.getScopeId());
+        noticeInfo.setScopeUrl(noticeInfoReq.getScopeUrl());
+        noticeInfo.setScopeName(noticeInfoReq.getScopeName());
         // 存储
         boolean isSaveBatchSuccess = false;
         try {