From 3fe3d5e01037ed0c2e4e804d9d35d6829da3c342 Mon Sep 17 00:00:00 2001 From: dearlin <1261008090@qq.com> Date: Mon, 8 Jan 2024 09:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zcloud/controller/map/MapController.java | 38 +++++++-- .../datasource/system/DepartmentMapper.java | 2 + .../service/system/DepartmentService.java | 2 + .../system/impl/DepartmentServiceImpl.java | 5 ++ src/main/java/com/zcloud/util/Smb.java | 80 ++++++++++++++++++- .../datasource/system/DepartmentMapper.xml | 3 + .../mybatis/datasource/system/UsersMapper.xml | 2 +- 7 files changed, 124 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/zcloud/controller/map/MapController.java b/src/main/java/com/zcloud/controller/map/MapController.java index 01f6d9cc..884b1569 100644 --- a/src/main/java/com/zcloud/controller/map/MapController.java +++ b/src/main/java/com/zcloud/controller/map/MapController.java @@ -333,8 +333,9 @@ public class MapController extends BaseController { @RequestMapping(value = "/getAlarmData") @ResponseBody public Object getAlarmData() { - return HttpRequestUtil.getPeopleApi("/statistics/alarmStatistics/todayAlarm",""); + return HttpRequestUtil.getPeopleApi("/statistics/alarmStatistics/todayAlarm", ""); } + /** * @Description: 定位基础信息 * @Author: dearLin @@ -345,9 +346,34 @@ public class MapController extends BaseController { @RequestMapping(value = "/getCzksBasicLocationInfoData") @ResponseBody public Object getCzksBasicLocationInfoData() { - return HttpRequestUtil.getPeopleApi("/statistics/personStatistics/todayPerson",""); + return HttpRequestUtil.getPeopleApi("/statistics/personStatistics/todayPerson", ""); + } + /** + * @Description: 人员定位信息 + * @Author: dearLin + * @Date: 2024/1/6/006 17:33 + * @Param: [] [] + * @Return: java.lang.Object + */ + @RequestMapping(value = "/czks/person/allPerson/listPage") + @ResponseBody + public Object getCzksOnlinePersion() throws Exception { + PageData pageData = this.getPageData(); + JSONObject request = new JSONObject(); + request.put("pageNum", 1); + request.put("pageSize", 10); + request.put("online", "true"); + // 人员定位在线 + ReturnMap online = HttpRequestUtil.getPeopleApi("/person/allPerson/listPage", request.toString()); + pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + // 系统人员数 + int userCount = usersService.getUserCount(pageData); + // 系统部门数 + int departCount = departmentService.getDepartmentCount(pageData); + online.put("userCount",userCount); + online.put("departCount",departCount); + return online; } - /** * @Description: 标签卡状态 * @Author: dearLin @@ -363,11 +389,11 @@ public class MapController extends BaseController { request.put("pageNum", pageData.getString("pageNum")); request.put("pageSize", pageData.getString("pageSize")); // 普通员工 - if ("0".equals(pageData.getString("type"))) { - return HttpRequestUtil.getPeopleApi("/person/staff/listPage",request.toString()); + if ("1".equals(pageData.getString("type"))) { + return HttpRequestUtil.getPeopleApi("/person/staff/listPage", request.toString()); } else { // 相关方 员工 - return HttpRequestUtil.getPeopleApi("/person/allPerson/listPage",request.toString()); + return HttpRequestUtil.getPeopleApi("/person/allPerson/listPage", request.toString()); } } /** diff --git a/src/main/java/com/zcloud/mapper/datasource/system/DepartmentMapper.java b/src/main/java/com/zcloud/mapper/datasource/system/DepartmentMapper.java index 5fdb5712..9cc4dc1e 100644 --- a/src/main/java/com/zcloud/mapper/datasource/system/DepartmentMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/system/DepartmentMapper.java @@ -181,5 +181,7 @@ public interface DepartmentMapper{ List listSubCorpDepartmentByParentId(String parentId); PageData findByCorpDepartmentId(PageData condition); + + int getDepartmentCount(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/system/DepartmentService.java b/src/main/java/com/zcloud/service/system/DepartmentService.java index 7c30e2a1..faad9247 100644 --- a/src/main/java/com/zcloud/service/system/DepartmentService.java +++ b/src/main/java/com/zcloud/service/system/DepartmentService.java @@ -231,5 +231,7 @@ public interface DepartmentService{ List listAllCorpDepartment(String number) throws Exception; PageData getCorpDepartment(PageData condition) throws Exception; + + int getDepartmentCount(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/system/impl/DepartmentServiceImpl.java b/src/main/java/com/zcloud/service/system/impl/DepartmentServiceImpl.java index 5be056e3..78ab0053 100644 --- a/src/main/java/com/zcloud/service/system/impl/DepartmentServiceImpl.java +++ b/src/main/java/com/zcloud/service/system/impl/DepartmentServiceImpl.java @@ -441,6 +441,11 @@ public class DepartmentServiceImpl implements DepartmentService{ return departmentMapper.findByCorpDepartmentId(condition); } + @Override + public int getDepartmentCount(PageData pageData) { + return departmentMapper.getDepartmentCount(pageData); + } + /** * 通过ID获取其子级列表 * @param parentId diff --git a/src/main/java/com/zcloud/util/Smb.java b/src/main/java/com/zcloud/util/Smb.java index 5d928701..0dd52a49 100644 --- a/src/main/java/com/zcloud/util/Smb.java +++ b/src/main/java/com/zcloud/util/Smb.java @@ -155,7 +155,85 @@ public class Smb { * IMGFILES_ID,FOREIGN_KEY,TYPE * 这三个值必须要传,所以用到Smb.sshSftp * */ - public static void sshSftp(MultipartFile file, String fileName, String path, String IMGFILES_ID, String FOREIGN_KEY, String TYPE) throws Exception { + public static void sshSftp(MultipartFile file, String fileName, String path, + String IMGFILES_ID, String FOREIGN_KEY, String TYPE) throws Exception { + Session session = null; + Channel channel = null; + JSch jsch = new JSch(); + if (port <= 0) { + // 连接服务器,采用默认端口 + session = jsch.getSession(user, host); + } else { + // 采用指定的端口连接服务器 + session = jsch.getSession(user, host, port); + } + + // 如果服务器连接不上,则抛出异常 + if (session == null) { + throw new Exception("session is null"); + } + // 设置登陆主机的密码 + session.setPassword(password); + // 设置第一次登陆的时候提示,可选值:(ask | yes | no) + session.setConfig("StrictHostKeyChecking", "no"); + // 设置登陆超时时间 + session.connect(30000); + OutputStream outstream = null; + + try { + // 创建sftp通信通道 + channel = (Channel) session.openChannel("sftp"); + channel.connect(1000); + ChannelSftp sftp = (ChannelSftp) channel; + // 进入服务器指定的文件夹 +// File dir = new File(basePath+"/"+path); +// dir.setWritable(true, false); +// if(!dir.exists()){ +// dir.mkdirs(); +// } + createDir(basePath + path, sftp); + sftp.cd(basePath + path); + // 列出服务器指定的文件列表 +// Vector v = sftp.ls("*"); +// for(int i=0;i + diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index 3d5f116b..8eb08704 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -1050,7 +1050,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM sys_user WHERE - CORPINFO_ID = #{CORPINFO_ID} + CORPINFO_ID = #{CORPINFO_ID} and ISDELETE = '0'