Преглед на файлове

Merge remote-tracking branch 'origin/V0.0.2' into V0.0.2

jingyuanchao преди 2 години
родител
ревизия
d975da50b4

+ 3 - 1
project_data/sql/0.0.2/quartz/quartz.sql

@@ -1,3 +1,5 @@
 INSERT INTO `sys_job`(`job_id`, `job_name`, `job_group`, `invoke_target`, `cron_expression`, `misfire_policy`, `concurrent`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (129, '恶劣天气预警', 'DEFAULT', 'WeatherTask.getDataFromApi', '0 0 7,10,14,17 * * ? *', '1', '1', '0', '超级管理员', '2023-09-25 11:46:50', '', NULL);
 INSERT INTO `sys_job` VALUES (128, '履职临期提醒(除了每日的)', 'DEFAULT', 'CoreMessageSendTask.resumptionRemind', '0 0 0 * * ?', '1', '1', '0', '超级管理员', '2023-09-22 17:03:31', '', '2023-09-22 20:29:13');
-INSERT INTO `sys_job` VALUES (125, '消息发送管理(每日凌晨零点)', 'DEFAULT', 'CoreMessageSendTask.messageSendTask', '0 0 0 * * ? *', '1', '1', '0', '超级管理员', '2023-09-21 12:30:22', '超级管理员', '2023-09-22 19:04:39');
+INSERT INTO `sys_job` VALUES (125, '消息发送管理(每日凌晨零点)', 'DEFAULT', 'CoreMessageSendTask.messageSendTask', '0 0 0 * * ? *', '1', '1', '0', '超级管理员', '2023-09-21 12:30:22', '超级管理员', '2023-09-22 19:04:39');
+delete from `sys_job` where job_name='生成每周安全检查任务';
+INSERT INTO `sys_job`(`job_id`, `job_name`, `job_group`, `invoke_target`, `cron_expression`, `misfire_policy`, `concurrent`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (130, '生成每周安全检查任务', 'DEFAULT', 'CoreSafetyCheckTask.buildWeekTask', '1 1 1 ? * 2', '2', '1', '0', '超级管理员', '2023-09-22 16:34:24', '', '2023-09-22 16:34:55');

+ 36 - 3
project_data/sql/0.0.2/soc/soc.sql

@@ -1311,14 +1311,44 @@ SET FOREIGN_KEY_CHECKS = 1;
 DELETE from `sys_dict_type` WHERE dict_type='question_confirm_status' or dict_type='question_reform_status';
 INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '问题确认状态', 'question_confirm_status', '0', '超级管理员', '2023-09-13 18:14:59', '', NULL, NULL);
 INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '问题整改状态', 'question_reform_status', '0', '超级管理员', '2023-09-13 18:15:18', '', NULL, NULL);
-
-DELETE from `sys_dict_data` WHERE dict_type in ('question_confirm_status','question_reform_status');
+delete  from 'sys_dict_type' WHERE dict_type='send_time_type' or dict_type='message_type' or dict_type ='send_status';
+INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( '发送时间类型', 'send_time_type', '0', '超级管理员', '2023-09-13 18:14:59', '', NULL, NULL);
+INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( '消息类型', 'message_type', '0', '超级管理员', '2023-09-13 18:14:59', '', NULL, NULL);
+INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( '发送状态', 'send_status', '0', '超级管理员', '2023-09-13 18:14:59', '', NULL, NULL);
+
+DELETE from `sys_dict_data` WHERE dict_type in ('post_no_pass','question_confirm_status','question_reform_status','send_status','message_type','send_time_type');
 INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '待确认', '0', 'question_confirm_status', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:15:44', '', NULL, NULL);
 INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (1, '提出异议', '1', 'question_confirm_status', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:16:01', '', NULL, NULL);
 INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 2, '已确认', '2', 'question_confirm_status', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:16:18', '', NULL, NULL);
 INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 3, '已关闭', '3', 'question_confirm_status', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:16:30', '', NULL, NULL);
 INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '未整改', '10', 'question_reform_status', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:38', '', NULL, NULL);
 INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '已整改', '11', 'question_reform_status', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+ VALUES ( 1, '已发送', '1', 'send_status', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 2, '待发送', '2', 'send_status', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 0, '公告', '0', 'message_type', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 1, '通知', '1', 'message_type', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 1, '立即发送', '1', 'send_time_type', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 2, '指定时间发送', '2', 'send_time_type', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 1, '无', '1', 'post_no_pass', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 2, '考试不合格', '2', 'post_no_pass', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 3, '不符合参考条件为参考', '3', 'post_no_pass', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 4, '新任职保卫人员未参考', '4', 'post_no_pass', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
+VALUES ( 5, '非必考对象', '5', 'post_no_pass', NULL, 'default', 'N', '0', '超级管理员', '2023-09-13 18:17:47', '', NULL, NULL);
 
 delete from `sys_menu` WHERE id in (01706851077007085569,01706851219965743105,01706854057534033922,01706854338376241153,2325,2326,2327,2328,2329,2330,2331,2332,2333,2334,2335,2336,2338,2339,2340,2341,2342,2344,2345,2346,2347,2348,2349,2350,2351,2352,2353,2354,2355,2356,2357,2317,2318,00000000000000002324,01706850786660585473,01706850961911189505);
 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 (00000000000000002325, '安全检查登记', 2136, 4, '/securityCheckRegister', NULL, NULL, 1, 0, 'C', '0', '0', 'core:safetycheck:appregister', '0', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFYAAABWCAMAAABiiJHFAAAAM1BMVEVHcEzYvXHYvXHYvXHYvXHYvXHYvXHYvXHYvXHYvXHYvXHYvXHYvXHYvXHYvXHYvXHYvXF4gE2CAAAAEHRSTlMAV5zcH/72wO9wPIf7z+evrVcrhwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAuBJREFUWIXtmddu7CAQhode3Ob9nzYyNjaYYpZFOidS/qtkhb/FUxkW/tSmSVE73FRkRkRcRmMdFXEaSzWIzBqB61jshAgAC+qx2BVRgZ0RySgiWTGWWPj3VCswEetDKe1FYUmpiBz8Akabqex+XoHOYQ3cf8tGkxgMsSyH5Tz4pzE6QhfJ6Eu85j3gbrVFR+Qjm9muILFptiZshJAciIq1WaDRGvU5FmWmbG34NRZRrtFmF/2M5D7sq/6w/wW2bekna381li+VNt6PlbXK14O1xrqaTgG4eYp0YxXOfHOdi8s0rGgvdkOcj6aicuHai3XtUexvS0rtt89l9HxXmFQi3o8dufZXY4mqHFy6sXx4ljlpd7S3SZaZbizVjLPjqDAybpXLsnl0llnts2zLUEUvFoCKY7bhq07UXWr2Db9MeH9Z9g3WVkfHLiyZ9twV5NF0VG5tO1Yh0tUV8kc63Gvloqhpuw+4sNOVpNEEciTCx7pfzAg/dkVNp2/uDexF5FxnWPd9m/kMC/UJkV6eFOzVwK3enebI4uxlSE2weTskY6Co2+uBpSLXdHLHJ1Gd1mMsyWdZdsKu7vfCGjUBFyhsFGDOhLm6jkcnecXuWSbdJVWYDrJwJeLUcsI2IviCWwUTaHdhUI6z27b7VZ3zV+ig/RCdoTJ3EKxsN3AZP035UMay8nyyXC8CbEHPK6zTV+4lisHwjk0cdkSWe4niVcg7NtmsKzW0/uArlngveWPQ4NPi1dsr1lwwepP8Ma14vDx8kB5jTvn4cr7fQ3ANqeUIywRlKL/CYYFr1z74VSSLr1lKzFN2n1eDffE4XYr30dnihOFz5wrtUyVMwmL2FuvIZTxfeYRJNiJLVICpypX3BfxpyfD1apWcb+nQeOuK/MMQPKTOFWqDbmOKqFF++QMCway+/v2A5qitF8+fcQdQfUsKI28EdW8dIVi3nMMawdt5mT2zcdBD+zQ8GPkvBAA/0zOEJ7oqo7UAAAAASUVORK5CYII=', NULL, '超级管理员', '2023-09-21 11:27:50', '超级管理员', '2023-09-22 16:44:12', '');
@@ -1372,4 +1402,7 @@ INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `co
 VALUES (01706854338376241153, '提交', 1706854057534033922, 1, NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'core:configuration:add', '1', NULL, NULL, '超级管理员', '2023-09-21 10:37:52', '超级管理员', '2023-09-22 09:42:43', '');
 
 -- 处理自增id步长问题
-alter table core_drill_dictionary auto_increment = 10000;
+alter table core_drill_dictionary auto_increment = 10000;
+-- 用户导出管理人员
+delete from `sys_menu` where `menu_name` ='用户导出管理人员';
+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 (00000000000000002358, '用户导出管理人员', 100, 9, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:user:exportManager', '1', NULL, NULL, '演示安全检查', '2023-09-27 16:10:58', '', NULL, '');

+ 35 - 17
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/information/service/impl/CoreResumptionConfigurationServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xunmei.common.core.constant.SecurityConstants;
+import com.xunmei.common.core.utils.StringUtils;
 import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.core.information.service.ICoreMessageCenterService;
 import com.xunmei.system.api.RemoteJobService;
@@ -79,6 +80,18 @@ public class CoreResumptionConfigurationServiceImpl extends ServiceImpl<CoreResu
         return coreResumptionConfigurationMapper.selectList(new QueryWrapper<>(coreResumptionConfiguration));
     }
 
+    String split(String time) {
+        if (StringUtils.isEmpty(time)) {
+            return time;
+        }
+        if (time.indexOf(":") != -1) {
+            String[] split = time.split(":");
+            return split[0];
+        } else {
+            return time;
+        }
+    }
+
     /**
      * 新增履职任务定时提醒
      *
@@ -87,10 +100,15 @@ public class CoreResumptionConfigurationServiceImpl extends ServiceImpl<CoreResu
      */
     @Override
     public int insertCoreResumptionConfiguration(CoreResumptionConfigurationDTO coreResumptionConfiguration) {
+
         Long[] jobIds = {100l, 101L, 102L, 103L};
         remoteJobService.remoteRemove(jobIds, SecurityConstants.INNER);
         int insert = 0;
         for (CoreResumptionConfiguration c : coreResumptionConfiguration.getCoreResumptionConfiguration()) {
+            c.setFront(split(c.getFront()));
+            c.setCentre(split(c.getCentre()));
+            c.setAfter(split(c.getAfter()));
+            c.setAllDay(split(c.getAllDay()));
             if (null == c.getId()) {
                 c.setCreateTime(DateUtils.getNowDate());
                 c.setCreateBy(SecurityUtils.getUsername());
@@ -206,7 +224,7 @@ public class CoreResumptionConfigurationServiceImpl extends ServiceImpl<CoreResu
                 String timeUnit = "天";
                 if (cycle.equals("1")) {
                     coreMessageCenter.setContent("您有履职任务" + taskName + "快到期");
-                }else {
+                } else {
                     coreMessageCenter.setContent("您有履职任务" + taskName + "还有" + time + timeUnit + "到期");
                 }
                 coreMessageCenter.setUserId(sysUser.getId());
@@ -241,49 +259,49 @@ public class CoreResumptionConfigurationServiceImpl extends ServiceImpl<CoreResu
 
     @Override
     public void font() {
-        CoreResumptionConfiguration coreResumptionConfiguration=new CoreResumptionConfiguration();
+        CoreResumptionConfiguration coreResumptionConfiguration = new CoreResumptionConfiguration();
         coreResumptionConfiguration.setTimeUnit("1");
         coreResumptionConfiguration.setDelFlag("0");
         List<CoreResumptionConfiguration> coreResumptionConfigurations = baseMapper.selectCoreResumptionConfigurationList(coreResumptionConfiguration);
-        List<Resumption> resumptions = resumptionMapper.selectDay(getTime(0),"2");
-        resumptions.forEach(r->{
-            addMassageCenter(r.getName(),null, coreResumptionConfigurations.get(0).getTimeUnit(),r.getOrgId(),r.getRoleId());
+        List<Resumption> resumptions = resumptionMapper.selectDay(getTime(0), "2");
+        resumptions.forEach(r -> {
+            addMassageCenter(r.getName(), null, coreResumptionConfigurations.get(0).getTimeUnit(), r.getOrgId(), r.getRoleId());
         });
     }
 
     @Override
     public void centre() {
-        CoreResumptionConfiguration coreResumptionConfiguration=new CoreResumptionConfiguration();
+        CoreResumptionConfiguration coreResumptionConfiguration = new CoreResumptionConfiguration();
         coreResumptionConfiguration.setTimeUnit("1");
         coreResumptionConfiguration.setDelFlag("0");
         List<CoreResumptionConfiguration> coreResumptionConfigurations = baseMapper.selectCoreResumptionConfigurationList(coreResumptionConfiguration);
-        List<Resumption> resumptions = resumptionMapper.selectDay(getTime(0),"3");
-        resumptions.forEach(r->{
-            addMassageCenter(r.getName(),null, coreResumptionConfigurations.get(0).getTimeUnit(),r.getOrgId(),r.getRoleId());
+        List<Resumption> resumptions = resumptionMapper.selectDay(getTime(0), "3");
+        resumptions.forEach(r -> {
+            addMassageCenter(r.getName(), null, coreResumptionConfigurations.get(0).getTimeUnit(), r.getOrgId(), r.getRoleId());
         });
     }
 
     @Override
     public void after() {
-        CoreResumptionConfiguration coreResumptionConfiguration=new CoreResumptionConfiguration();
+        CoreResumptionConfiguration coreResumptionConfiguration = new CoreResumptionConfiguration();
         coreResumptionConfiguration.setTimeUnit("1");
         coreResumptionConfiguration.setDelFlag("0");
         List<CoreResumptionConfiguration> coreResumptionConfigurations = baseMapper.selectCoreResumptionConfigurationList(coreResumptionConfiguration);
-        List<Resumption> resumptions = resumptionMapper.selectDay(getTime(0),"4");
-        resumptions.forEach(r->{
-            addMassageCenter(r.getName(),null, coreResumptionConfigurations.get(0).getTimeUnit(),r.getOrgId(),r.getRoleId());
+        List<Resumption> resumptions = resumptionMapper.selectDay(getTime(0), "4");
+        resumptions.forEach(r -> {
+            addMassageCenter(r.getName(), null, coreResumptionConfigurations.get(0).getTimeUnit(), r.getOrgId(), r.getRoleId());
         });
     }
 
     @Override
     public void allDay() {
-        CoreResumptionConfiguration coreResumptionConfiguration=new CoreResumptionConfiguration();
+        CoreResumptionConfiguration coreResumptionConfiguration = new CoreResumptionConfiguration();
         coreResumptionConfiguration.setTimeUnit("1");
         coreResumptionConfiguration.setDelFlag("0");
         List<CoreResumptionConfiguration> coreResumptionConfigurations = baseMapper.selectCoreResumptionConfigurationList(coreResumptionConfiguration);
-        List<Resumption> resumptions = resumptionMapper.selectDay(getTime(0),"1");
-        resumptions.forEach(r->{
-            addMassageCenter(r.getName(),null, coreResumptionConfigurations.get(0).getTimeUnit(),r.getOrgId(),r.getRoleId());
+        List<Resumption> resumptions = resumptionMapper.selectDay(getTime(0), "1");
+        resumptions.forEach(r -> {
+            addMassageCenter(r.getName(), null, coreResumptionConfigurations.get(0).getTimeUnit(), r.getOrgId(), r.getRoleId());
         });
     }
 }

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/information/CoreMessageSendMapper.xml

@@ -79,7 +79,7 @@
         SELECT * FROM core_message_send
         WHERE del_flag=0
         <if test="request.title != null ">
-            and title = #{request.title}
+            and title like concat('%', #{request.title}, '%')
         </if>
         <if test="request.type != null ">
             and type = #{request.type}

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

@@ -1,11 +1,15 @@
 package com.xunmei.system.controller;
 
 import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.R;
 import com.xunmei.common.core.domain.message.domain.CoreAnnouncementNotificationToRole;
+import com.xunmei.common.core.domain.retrieval.vo.CoreMonitoringRetrievalTaskExcelVo;
+import com.xunmei.common.core.utils.DateHelper;
 import com.xunmei.common.core.utils.DateUtils;
 import com.xunmei.common.core.utils.StringUtils;
 import com.xunmei.common.core.vo.IdNameVo;
@@ -17,10 +21,7 @@ import com.xunmei.common.security.annotation.InnerAuth;
 import com.xunmei.common.security.annotation.RequiresPermissions;
 import com.xunmei.common.security.utils.SaltHelper;
 import com.xunmei.common.security.utils.SecurityUtils;
-import com.xunmei.system.api.domain.SysOrg;
-import com.xunmei.system.api.domain.SysRole;
-import com.xunmei.system.api.domain.SysUser;
-import com.xunmei.system.api.domain.SysUserInformation;
+import com.xunmei.system.api.domain.*;
 import com.xunmei.system.api.model.LoginUser;
 import com.xunmei.system.domain.SysUserRole;
 import com.xunmei.system.domain.vo.SysUserListVo;
@@ -28,6 +29,7 @@ import com.xunmei.system.domain.vo.UserRoleVo;
 import com.xunmei.system.api.dto.SysRoleOrgDTO;
 import com.xunmei.system.mapper.SysOrgMapper;
 import com.xunmei.system.service.*;
+import com.xunmei.system.util.UserExport;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,6 +37,9 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
 import java.util.Date;
 import java.util.List;
 import java.util.Set;
@@ -459,4 +464,62 @@ public class SysUserController extends BaseController {
             return vo;
         }).collect(Collectors.toList());
     }
+
+    /**
+     * 导出用户数据
+     */
+    @RequiresPermissions("system:user:export")
+    @PostMapping("/export")
+    public void export(SysUser user, HttpServletResponse response)  {
+        List<UserExport> list=userService.down(user);
+        if (ObjectUtil.isEmpty(list)) {
+            throw new RuntimeException("导出数据为空!");
+        }
+        if(list.size()>10000){
+            throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
+        }
+        try {
+            // 设置响应头
+            response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("用户数据", "utf-8"));
+            response.setContentType("application/octet-stream;charset=UTF-8");
+            response.setCharacterEncoding("utf-8");
+            // 数据导出
+            EasyExcel.write(response.getOutputStream(), UserExport.class)
+                    .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("用户数据").doWrite(list);
+        } catch (Exception e) {
+            // 重置response
+            response.reset();
+            response.setContentType("application/json");
+            response.setCharacterEncoding("utf-8");
+        }
+    }
+    /**
+     * 导出管理人员数据
+     */
+    @RequiresPermissions("system:user:exportManager")
+    @PostMapping("/exportManager")
+    public void exportManager(SysUser user, HttpServletResponse response)  {
+        List<UserExport> list=userService.down(user);
+        if (ObjectUtil.isEmpty(list)) {
+            throw new RuntimeException("导出数据为空!");
+        }
+        list=list.stream().filter(e -> e.getIsManager() != null).collect(Collectors.toList());
+        if(list.size()>10000){
+            throw new RuntimeException("导出数据量过大(单次导出限量10000条数据),请填写条件分批导出");
+        }
+        try {
+            // 设置响应头
+            response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("用户数据", "utf-8"));
+            response.setContentType("application/octet-stream;charset=UTF-8");
+            response.setCharacterEncoding("utf-8");
+            // 数据导出
+            EasyExcel.write(response.getOutputStream(), UserExport.class)
+                    .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("用户数据").doWrite(list);
+        } catch (Exception e) {
+            // 重置response
+            response.reset();
+            response.setContentType("application/json");
+            response.setCharacterEncoding("utf-8");
+        }
+    }
 }

+ 2 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysUserMapper.java

@@ -8,6 +8,7 @@ import com.xunmei.system.api.domain.SysRole;
 import com.xunmei.system.api.domain.SysUser;
 import com.xunmei.system.domain.vo.SysUserVO;
 import com.xunmei.system.api.dto.SysRoleOrgDTO;
+import com.xunmei.system.util.UserExport;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -156,4 +157,5 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
 
     List<SysUser> selectUserListByRoleAndOrg(@Param("sysRoleOrgDTO") SysRoleOrgDTO sysRoleOrgDTO);
 
+    List<UserExport> select(@Param("info") SysUser user);
 }

+ 3 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysUserService.java

@@ -8,6 +8,7 @@ import com.xunmei.system.api.domain.SysUser;
 import com.xunmei.system.domain.vo.SysUserListVo;
 import com.xunmei.system.domain.vo.SysUserVO;
 import com.xunmei.system.api.dto.SysRoleOrgDTO;
+import com.xunmei.system.util.UserExport;
 
 import java.util.List;
 
@@ -224,4 +225,6 @@ public interface ISysUserService extends IService<SysUser> {
     List<SysUser> selectUserListByRoleAndOrg(SysRoleOrgDTO sysRoleOrgDTO);
 
     List<SysUser> selectAllUser();
+
+    List<UserExport> down(SysUser user);
 }

+ 2 - 52
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDeviceServiceImpl.java

@@ -102,6 +102,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
                 QueryWrapper queryWrapper = new QueryWrapper();
                 queryWrapper.eq("del_flag", "0");
                 queryWrapper.eq("host_id", hostByOrgId.get(i).getId());
+                queryWrapper.eq("device_type","0");
                 List<SysDevice> list = baseMapper.selectList(queryWrapper);
                 if (CollectionUtils.isEmpty(list) || list.size() == longs.size()) {
                     hostByOrgId.remove(hostByOrgId.get(i));
@@ -111,48 +112,6 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
         return hostByOrgId;
     }
 
-/*    @Override
-    public List<HostVO> getHostVideoByOrgId(Long orgId) {
-        List<HostVO> hostVOS = new ArrayList<>();
-        //查询所有视频主机
-        List<SysDevice> hostByOrgId = sysDeviceMapper.getHostByOrgId(orgId);
-        hostByOrgId.forEach(h -> {
-            HostVO hostVO = new HostVO();
-            hostVO.setHostId(h.getId());
-            hostVO.setHostName(h.getDeviceName());
-            QueryWrapper queryWrapper = new QueryWrapper();
-            queryWrapper.eq("del_flag", "0");
-            queryWrapper.eq("host_id", h.getId());
-            //查询视频
-            List<SysDevice> sysDevices = baseMapper.selectList(queryWrapper);
-            if (CollectionUtils.isNotEmpty(sysDevices)) {
-                List<VideoVO> videoVOS = new ArrayList<>();
-                sysDevices.forEach(s -> {
-                    VideoVO videoVO = new VideoVO();
-                    videoVO.setVideoId(s.getId());
-                    videoVO.setVideoName(s.getDeviceName());
-                    List<Map> accessByVideo = sysDeviceMapper.getAccessByVideo(orgId, s.getId());
-                    if (CollectionUtils.isNotEmpty(accessByVideo)) {
-                        accessByVideo.forEach(a -> {
-                            String situation = a.get("situation").toString();
-                            int num = Integer.parseInt(a.get("num").toString());
-                            videoVO.setType(1);
-                            if (situation.equals("1") && num > 0) {
-                                videoVO.setType(2);
-                            }
-                        });
-                    } else {
-                        videoVO.setType(0);
-                    }
-                    videoVOS.add(videoVO);
-                });
-                hostVO.setDeviceVOS(videoVOS);
-            }
-            hostVOS.add(hostVO);
-        });
-        return hostVOS;
-    }*/
-
     @Override
     public List<HostVO> getHostVideoByTaskId(Long taskId) {
         List<HostVO> hostVOS = new ArrayList<>();
@@ -184,15 +143,6 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
                                 break;
                             }
                         }
-                  /*      accessByVideo.forEach(a -> {
-                            String situation = a.getSituation();
-                            int num = a.getNum();
-                            videoVO.setType(1);
-                            if (situation.equals("1") && num > 0) {
-                                videoVO.setType(2);
-                            }
-                        });*/
-
                     } else {
                         videoVO.setType(0);
                     }
@@ -255,7 +205,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
         sysDevice.setUpdateTime(DateUtils.getNowDate());
         sysDevice.setUpdateBy(SecurityUtils.getUsername());
         SysOrg sysOrg = orgService.selectSysOrgById(sysDevice.getOrgId());
-        sysDevice.setOrgName(sysOrg.getName());
+        sysDevice.setOrgName(sysOrg.getShortName());
         return sysDeviceMapper.updateById(sysDevice);
     }
 

+ 16 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysUserServiceImpl.java

@@ -26,6 +26,7 @@ import com.xunmei.system.mapper.*;
 import com.xunmei.system.service.ISysConfigService;
 import com.xunmei.system.service.ISysOrgService;
 import com.xunmei.system.service.ISysUserService;
+import com.xunmei.system.util.UserExport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -615,4 +616,19 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     public List<SysUser> selectAllUser() {
         return userMapper.selectAllUser();
     }
+
+    @Override
+    public List<UserExport> down(SysUser user) {
+        SysOrg org = null;
+        //查询条件
+        QueryWrapper<SysOrg> queryWrapper = new QueryWrapper<>();
+        if (null == user.getOrgId()) {
+            queryWrapper.eq("parent_id", -1);
+            org = sysOrgMapper.selectOne(queryWrapper);
+        } else {
+            org = sysOrgMapper.selectById(user.getOrgId());
+        }
+        user.setOrgPath(org.getPath());
+        return userMapper.select(user);
+    }
 }

+ 37 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/UserExport.java

@@ -0,0 +1,37 @@
+package com.xunmei.system.util;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.alibaba.excel.metadata.BaseRowModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+@Data
+@ColumnWidth(15) //列宽,最大值为255
+@HeadRowHeight(16) //表头行高
+@ContentRowHeight(16) //数据行高
+public class UserExport {
+
+    @ExcelProperty(value = "用户账号", index = 1)
+    private String username;
+    @ExcelProperty(value = "用户姓名", index = 2)
+    private String name;
+    @ExcelProperty(value = "所属机构", index = 3)
+    private String orgName;
+    @ExcelProperty(value = "用户角色", index = 4)
+    private String roleNames;
+    @ExcelProperty(value = "状态", index = 5,converter = UserStatusConverter.class)
+    private String isLock;
+    @ExcelProperty(value = "是否管理人员", index = 6,converter = UserManagerConverter.class)
+    private String isManager;
+    @ExcelProperty(value = "登录IP", index = 7)
+    private String lastIp;
+    @ExcelProperty(value = "登录时间", index = 8)
+    private Date lastTime;
+}

+ 34 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/UserManagerConverter.java

@@ -0,0 +1,34 @@
+package com.xunmei.system.util;
+
+import com.alibaba.excel.converters.Converter;
+import com.alibaba.excel.enums.CellDataTypeEnum;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.GlobalConfiguration;
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
+
+public class UserManagerConverter implements Converter<String> {
+    @Override
+    public Class supportJavaTypeKey() {
+        return null;
+    }
+
+    @Override
+    public CellDataTypeEnum supportExcelTypeKey() {
+        return null;
+    }
+
+    @Override
+    public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        return null;
+    }
+
+    @Override
+    public CellData convertToExcelData(String s, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        // 根据条件修改是否管理人员的值
+        if (s!=null) {
+            return new CellData("是");
+        } else {
+            return new CellData("否");
+        }
+    }
+}

+ 39 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/UserStatusConverter.java

@@ -0,0 +1,39 @@
+package com.xunmei.system.util;
+
+import com.alibaba.excel.converters.Converter;
+import com.alibaba.excel.enums.CellDataTypeEnum;
+import com.alibaba.excel.metadata.CellData;
+import com.alibaba.excel.metadata.GlobalConfiguration;
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
+
+public class UserStatusConverter implements Converter<String> {
+
+
+
+    @Override
+    public Class supportJavaTypeKey() {
+        return null;
+    }
+
+    @Override
+    public CellDataTypeEnum supportExcelTypeKey() {
+        return null;
+    }
+
+    @Override
+    public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        return null;
+    }
+
+    @Override
+    public CellData convertToExcelData(String isLock, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
+        if ("0".equals(isLock)) {
+            return new CellData("启用");
+        } else if ("1".equals(isLock)) {
+            return new CellData("禁用");
+        } else {
+            return new CellData("禁用");
+        }
+
+    }
+}

+ 79 - 0
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -604,4 +604,83 @@
           AND b.id = #{sysRoleOrgDTO.orgId}
           AND d.id = #{sysRoleOrgDTO.roleId}
     </select>
+    <select id="select" resultType="com.xunmei.system.util.UserExport">
+        SELECT
+        h.user_id AS is_manager,
+        GROUP_CONCAT(sr.role_name) role_names,
+        CONCAT(",",GROUP_CONCAT( sr.id ),",") as roleIds,
+        u.id,
+        u.dept_id,
+        u.is_lock,
+        u.job_id,
+        u.NAME,
+        u.username,
+        u.org_id,
+        u.phone,
+        u.create_time,
+        u.modified_name,
+        u.update_time,
+        u.modified_id,
+        u.PASSWORD,
+        u.salt,
+        u.deleted,
+        u.last_ip,
+        u.last_time,
+        o.NAME AS org_name,
+        o.path AS org_path,
+        u.image,
+        u.card,
+        u.gender,
+        u.job_number,
+        u.note,
+        u.is_sign,
+        u.sign_time,
+        u.agreement_id,
+        u.sign_version,
+        u.approve_status,
+        u.locked,
+        u.create_by,
+        u.update_by,
+        u.CODE,
+        u.source,
+        u.original_org_id
+        FROM
+        sys_user u
+        LEFT JOIN sys_org o ON u.original_org_id = o.id
+        LEFT JOIN ( SELECT user_id FROM sys_user_role uo LEFT JOIN sys_role ro ON uo.role_id = ro.id WHERE ro.role_name LIKE '%安全保卫管理人员' ) h ON h.user_id = u.id
+        LEFT JOIN sys_user_role sro on u.id=sro.user_id
+        LEFT JOIN sys_role sr on sro.role_id=sr.id
+        where 1=1
+        and u.deleted =0
+        <choose>
+            <when test="info.checkSub">
+                AND o.path like concat('%', #{info.orgPath}, '%')
+            </when>
+            <otherwise>
+                AND o.id = #{info.orgId}
+            </otherwise>
+        </choose>
+        <if test="info.isLock != null and info.isLock != ''">
+            AND u.is_lock = #{info.isLock}
+        </if>
+        <if test="info.phone != null and info.phone != ''">
+            AND u.phone like concat('%',concat(#{info.phone},'%'))
+        </if>
+        <if test="info.username != null and info.username != ''">
+            AND u.username like concat('%', #{info.username}, '%')
+        </if>
+        <if test="info.name != null and info.name != ''">
+            AND u.name like concat('%', #{info.name}, '%')
+        </if>
+        <if test="info.params.beginTime != null and info.params.beginTime != ''">
+            <!-- 开始时间检索 -->
+            AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{info.params.beginTime},'%y%m%d')
+        </if>
+        <if test="info.params.endTime != null and info.params.endTime != ''">
+            <!-- 结束时间检索 -->
+            AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{info.params.endTime},'%y%m%d')
+        </if>
+        group by u.id
+
+    </select>
 </mapper>