luowei před 2 roky
rodič
revize
70f89c245e

+ 46 - 0
project_data/sql/0.0.2/soc/soc.sql

@@ -397,3 +397,49 @@ INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, quer
 INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (2315, '优秀案例学习', 2311, 4, '/rehearsallearning', null, null, 1, 0, 'M', '0', '0', '', '0', null, null, '超级管理员', now(), '超级管理员', now(), '');
 
 
+-- ----------------------------
+-- Table structure for core_message_send
+-- ----------------------------
+DROP TABLE IF EXISTS `core_message_send`;
+CREATE TABLE `core_message_send`  (
+                                      `id` bigint NOT NULL COMMENT '主键',
+                                      `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标题',
+                                      `type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
+                                      `content` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '内容',
+                                      `send_user` bigint NULL DEFAULT NULL COMMENT '按用户选择',
+                                      `send_role` bigint NULL DEFAULT NULL COMMENT '按角色选择',
+                                      `send_time_type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '发送时间类型1立即2指定时间',
+                                      `send_time` datetime NULL DEFAULT NULL COMMENT '发送时间',
+                                      `del_flag` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '0未2删',
+                                      `send_status` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '1已发送2待发送',
+                                      `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+                                      `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
+                                      `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
+                                      `update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
+                                      PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '消息发送配置' ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;
+--消息发送配置end
+
+-- ----------------------------
+-- Table structure for core_message_center
+-- ----------------------------
+DROP TABLE IF EXISTS `core_message_center`;
+CREATE TABLE `core_message_center`  (
+                                        `id` bigint NOT NULL,
+                                        `type` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '1公告2业务提醒3消息',
+                                        `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标题',
+                                        `read` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '0未读1已读',
+                                        `content` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '内容',
+                                        `del_flag` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '0未2删',
+                                        `user_id` bigint NULL DEFAULT NULL COMMENT '用户',
+                                        `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
+                                        `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
+                                        `update_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人',
+                                        `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
+                                        PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '消息中心' ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;
+--消息中心end

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/domain/CoreMessageCenter.java

@@ -59,7 +59,7 @@ public class CoreMessageCenter extends BaseEntity {
     /**
      * 0未2删
      */
-    private String delFlag;
+    private String delFlag="0";
     /**
      * 用户ID
      */

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/domain/CoreMessageSend.java

@@ -65,7 +65,7 @@ private static final long serialVersionUID=1L;
     private Date sendTime;
 
     /** 0未2已删 */
-    private String delFlag;
+    private String delFlag="0";
 
     /** 0已发送1待发送 */
             @ApiModelProperty(value = "1已发送2待发送")

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/domain/CoreResumptionConfiguration.java

@@ -37,7 +37,7 @@ private static final long serialVersionUID=1L;
     private String resumptionCycle;
 
     /** $column.columnComment */
-    private String delFlag;
+    private String delFlag="0";
 
     /** 全天 */
             @ApiModelProperty(value = "全天")

+ 34 - 12
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/service/impl/CoreMessageSendServiceImpl.java

@@ -24,6 +24,7 @@ import com.xunmei.system.api.domain.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -94,8 +95,8 @@ public class CoreMessageSendServiceImpl extends ServiceImpl<CoreMessageSendMappe
                 collect = userListByRole.stream().map(SysUser::getId).collect(Collectors.toList());
             }
             collect.add(coreMessageSend.getSendUser());
-            List<CoreMessageCenter>coreMessageCenterList=new ArrayList<>();
-            for (Long userId:collect){
+            List<CoreMessageCenter> coreMessageCenterList = new ArrayList<>();
+            for (Long userId : collect) {
                 CoreMessageCenter coreMessageCenter = new CoreMessageCenter();
                 coreMessageCenter.setTitle(coreMessageSend.getTitle());
                 coreMessageCenter.setContent(coreMessageSend.getContent());
@@ -160,20 +161,41 @@ public class CoreMessageSendServiceImpl extends ServiceImpl<CoreMessageSendMappe
             taskTime = LocalDate.now();
         }
         CoreMessageSend coreMessageSend = new CoreMessageSend();
-
-        coreMessageSend.setSendTime(new Date());
+Date nowTime=null;
+        SimpleDateFormat sd=new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String format = sd.format(new Date())+" 00:00:00";
+        try {
+            nowTime=simpleDateFormat.parse(format);
+        }catch (Exception e){
+            e.getMessage();
+        }
+        coreMessageSend.setSendTime(nowTime);
         List<CoreMessageSend> coreMessageSends = baseMapper.selectBySendTime(coreMessageSend);
         if (CollectionUtil.isNotEmpty(coreMessageSends)) {
+            List<Long> collect = new ArrayList<>();
             List<CoreMessageCenter> coreMessageCenters = new ArrayList<>();
             for (CoreMessageSend c : coreMessageSends) {
-                CoreMessageCenter coreMessageCenter = new CoreMessageCenter();
-                coreMessageCenter.setTitle(c.getTitle());
-                coreMessageCenter.setContent(c.getContent());
-                coreMessageCenter.setRead("0");
-                coreMessageCenter.setType("1");
-                coreMessageCenter.setCreateTime(DateUtils.getNowDate());
-                coreMessageCenter.setCreateBy(c.getCreateBy());
-                coreMessageCenters.add(coreMessageCenter);
+                if (null != c.getSendRole()) {
+                    List<CoreAnnouncementNotificationToRole> notificationToRoles = new ArrayList<>();
+                    CoreAnnouncementNotificationToRole coreAnnouncementNotificationToRole = new CoreAnnouncementNotificationToRole();
+                    coreAnnouncementNotificationToRole.setRoleId(coreMessageSend.getSendRole());
+                    notificationToRoles.add(coreAnnouncementNotificationToRole);
+                    List<SysUser> userListByRole = remoteUserService.getUserListByRole(notificationToRoles, SecurityConstants.INNER);
+                    collect = userListByRole.stream().map(SysUser::getId).collect(Collectors.toList());
+                }
+                collect.add(c.getSendUser());
+                for (Long userId : collect) {
+                    CoreMessageCenter coreMessageCenter = new CoreMessageCenter();
+                    coreMessageCenter.setTitle(coreMessageSend.getTitle());
+                    coreMessageCenter.setContent(coreMessageSend.getContent());
+                    coreMessageCenter.setRead("0");
+                    coreMessageCenter.setType("3");
+                    coreMessageCenter.setCreateTime(DateUtils.getNowDate());
+                    coreMessageCenter.setCreateBy(coreMessageSend.getCreateBy());
+                    coreMessageCenter.setUserId(userId);
+                    coreMessageCenters.add(coreMessageCenter);
+                }
             }
             coreMessageCenterService.saveBatch(coreMessageCenters);
         }

+ 4 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysUserController.java

@@ -427,4 +427,8 @@ public class SysUserController extends BaseController {
     public List<SysUser>userLoginInfo(@RequestBody List<CoreAnnouncementNotificationToRole> notificationToRoles) {
          return userService.selectUserListByRole(notificationToRoles);
     }
+    @PostMapping("/selectAllUser")
+    public List<SysUser> selectAllUser() {
+        return userService.selectAllUser();
+    }
 }