From 1c3d76917db352cd4a826f292de7b233d475bded Mon Sep 17 00:00:00 2001 From: wangxy <1356089412@qq.com> Date: Thu, 8 Aug 2024 09:07:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=B6=89=E5=AF=86=E7=A8=8B=E5=BA=A6?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/count/SysUsernumController.java | 29 +++++++++++++++++ .../system/domain/count/UserSmCountDTO.java | 32 +++++++++++++++++++ .../ruoyi/system/mapper/SysUserMapper.java | 3 ++ .../ruoyi/system/service/ISysUserService.java | 4 +++ .../service/impl/SysUserServiceImpl.java | 6 ++++ .../resources/mapper/system/SysUserMapper.xml | 9 ++++++ 6 files changed, 83 insertions(+) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/count/UserSmCountDTO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysUsernumController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysUsernumController.java index d574d37..0e94336 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysUsernumController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysUsernumController.java @@ -19,6 +19,7 @@ import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.domain.SysUserPost; import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.domain.count.UserCountDTO; +import com.ruoyi.system.domain.count.UserSmCountDTO; import com.ruoyi.system.service.*; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -129,6 +130,31 @@ public class SysUsernumController extends BaseController { private List sharType = Arrays.asList("已登记", "已申报", "已审核", "已离职"); + private List smType = Arrays.asList("一般涉密人员", "重要涉密人员", "核心涉密人员"); + + + @PostMapping("/countSm") + @ResponseBody + public AjaxResult countSm() { + UserSmCountDTO userSmCountDTO = userService.selectCountSmUser(); + List yAxisData = new ArrayList<>(); + smType.forEach(xAxis -> { + AtomicReference yAxis = new AtomicReference<>(0L); + if("一般涉密人员".equals(xAxis)){ + yAxis.set(Long.valueOf(userSmCountDTO.getYb())); + }else if("重要涉密人员".equals(xAxis)){ + yAxis.set(Long.valueOf(userSmCountDTO.getZy())); + }else{ + yAxis.set(Long.valueOf(userSmCountDTO.getHx())); + } + yAxisData.add(yAxis.get()); + }); + JSONObject obj = new JSONObject(); + obj.put("xAxisData", smType.toArray()); + obj.put("yAxisData", yAxisData); + return AjaxResult.success(obj); + } + /** * * 统计人员已登记、已申报、已审核、已离职 @@ -160,4 +186,7 @@ public class SysUsernumController extends BaseController { } + + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/UserSmCountDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/UserSmCountDTO.java new file mode 100644 index 0000000..872d0b3 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/UserSmCountDTO.java @@ -0,0 +1,32 @@ +package com.ruoyi.system.domain.count; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * packageName com.ruoyi.system.domain.count + * + * @author wangxy + * @version JDK 8 + * @className UserSmCountDTO + * @date 2024/8/8 + * @description 涉密程度统计 + */ +@Data +@ApiModel(value="涉密程度统计", description="涉密程度统计") +public class UserSmCountDTO implements Serializable { + + @ApiModelProperty(value = "一般") + private Integer yb; + + @ApiModelProperty(value = "重要") + private Integer zy; + + @ApiModelProperty(value = "核心") + private Integer hx; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java index fa6b4cd..c077739 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.system.domain.count.UserCountDTO; +import com.ruoyi.system.domain.count.UserSmCountDTO; /** * 用户表 数据层 @@ -130,4 +131,6 @@ public interface SysUserMapper extends BaseMapper public UserCountDTO selectCountUser(); + + public UserSmCountDTO selectCountSmUser(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java index 1518b43..e41560b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java @@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.domain.count.UserCountDTO; +import com.ruoyi.system.domain.count.UserSmCountDTO; /** * 用户 业务层 @@ -230,4 +231,7 @@ public interface ISysUserService extends IService public UserCountDTO selectCountUser(); + + + public UserSmCountDTO selectCountSmUser(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 9c1e71b..f5170a2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -8,6 +8,7 @@ import javax.validation.Validator; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.system.domain.count.UserCountDTO; +import com.ruoyi.system.domain.count.UserSmCountDTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -587,4 +588,9 @@ public class SysUserServiceImpl extends ServiceImpl imple public UserCountDTO selectCountUser() { return userMapper.selectCountUser(); } + + @Override + public UserSmCountDTO selectCountSmUser() { + return userMapper.selectCountSmUser(); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index bac3282..40070fc 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -326,6 +326,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + \ No newline at end of file