| | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringPool; |
| | | import com.baomidou.mybatisplus.generator.AutoGenerator; |
| | | import com.baomidou.mybatisplus.generator.InjectionConfig; |
| | | import com.baomidou.mybatisplus.generator.config.*; |
| | | import com.baomidou.mybatisplus.generator.config.DataSourceConfig; |
| | | import com.baomidou.mybatisplus.generator.config.FileOutConfig; |
| | | import com.baomidou.mybatisplus.generator.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.generator.config.PackageConfig; |
| | | import com.baomidou.mybatisplus.generator.config.StrategyConfig; |
| | | import com.baomidou.mybatisplus.generator.config.TemplateConfig; |
| | | import com.baomidou.mybatisplus.generator.config.po.LikeTable; |
| | | import com.baomidou.mybatisplus.generator.config.po.TableFill; |
| | | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| | | import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
| | | import org.junit.Test; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.junit.Test; |
| | | |
| | | /** |
| | | * 通过指定 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) 可达到加速的效果。 |
| | |
| | | pc.setMapper("mapper"); |
| | | pc.setService("service"); |
| | | |
| | | |
| | | // 自定义mapping文件生成路径配置 |
| | | InjectionConfig cfg = new InjectionConfig() { |
| | | @Override |
| | |
| | | //templateConfig.setController(null); |
| | | //mpg.setTemplate(templateConfig); |
| | | |
| | | |
| | | // 策略配置 |
| | | StrategyConfig strategy = new StrategyConfig(); |
| | | //设置字段和表名的是否把下划线完成驼峰命名规则 |
| | | strategy.setNaming(NamingStrategy.underline_to_camel); |
| | | strategy.setEntitySerialVersionUID(true); |
| | | strategy.setEntityColumnConstant(false); |
| | | |
| | | |
| | | //设置生成的实体类继承的父类 |
| | | // strategy.setSuperEntityClass(BaseModel.class); |
| | |
| | | // strategy.setTablePrefix(pc.getModuleName() + ""); |
| | | // strategy.setLikeTable(new LikeTable("room")); |
| | | //strategy.setLikeTable(new LikeTable("member")); |
| | | strategy.setLikeTable(new LikeTable("tb_basic_data_config"));// 生成表名 |
| | | strategy.setLikeTable(new LikeTable("tb_data_screen_score"));// 生成表名 |
| | | // strategy.setLikeTable(new LikeTable("t_hotel"));// 生成表名 |
| | | // strategy.setLikeTable(new LikeTable("t_scan_message"));// 生成表名 |
| | | // strategy.setNotLikeTable(new LikeTable("tb_dept"));// 不生成表名 |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import com.ruoyi.common.annotation.FinancialLog; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.system.dto.BasicDataDTO; |
| | | import com.ruoyi.system.query.ScoreQuery; |
| | |
| | | /** |
| | | * 导入模板下载 |
| | | */ |
| | | @FinancialLog(title = "下载导入模板", businessType = BusinessType.OTHER) |
| | | @GetMapping("/download") |
| | | @ApiOperation("模板下载") |
| | | public void downloadImportTemplate() { |
| | |
| | | */ |
| | | @PostMapping("/import") |
| | | @ApiOperation("基础数据导入") |
| | | @FinancialLog(title = "导入数据", businessType = BusinessType.IMPORT) |
| | | public R<Void> importBasicData(@RequestPart("file") MultipartFile file) { |
| | | try { |
| | | tbBasicDataService.importBasicData(file); |
| | |
| | | package com.ruoyi.web.controller.interceptor; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class MybatisConfiguration { |
| | | |
| | | |
| | | /** |
| | | * 注册拦截器 |
| | | */ |
| | | /* @Bean |
| | | @Bean |
| | | public MybatisInterceptor getMybatisInterceptor() { |
| | | return new MybatisInterceptor(); |
| | | }*/ |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.web.controller.interceptor; |
| | | |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Properties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.executor.Executor; |
| | | import org.apache.ibatis.mapping.MappedStatement; |
| | | import org.apache.ibatis.mapping.SqlCommandType; |
| | | import org.apache.ibatis.plugin.Interceptor; |
| | | import org.apache.ibatis.plugin.Intercepts; |
| | | import org.apache.ibatis.plugin.Invocation; |
| | | import org.apache.ibatis.plugin.Plugin; |
| | | import org.apache.ibatis.plugin.Signature; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | /*@Component |
| | | @Intercepts({ @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) })*/ |
| | | @Component |
| | | @Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, |
| | | Object.class})}) |
| | | public class MybatisInterceptor implements Interceptor { |
| | | |
| | | @Autowired |
| | |
| | | @Override |
| | | public Object intercept(Invocation invocation) throws Throwable { |
| | | MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; |
| | | log.debug("{}:"+mappedStatement); |
| | | log.debug("{}:" + mappedStatement); |
| | | log.debug("------sqlId------" + mappedStatement.getId()); |
| | | if("com.ruoyi.system.mapper.SysLogininforMapper.insertLogininfor".equals(mappedStatement.getId())){ |
| | | if ("com.ruoyi.system.mapper.SysLogininforMapper.insertLogininfor".equals( |
| | | mappedStatement.getId())) { |
| | | return invocation.proceed(); |
| | | } |
| | | // sql类型:insert、update、select、delete |
| | | SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType(); |
| | | Object parameter = invocation.getArgs()[1]; |
| | | log.debug("------sqlCommandType------" + sqlCommandType); |
| | | |
| | | |
| | | if (parameter == null) { |
| | | return invocation.proceed(); |
| | | } |
| | | |
| | | |
| | | // 当sql为新增或更新类型时,自动填充操作人相关信息 |
| | | if (SqlCommandType.INSERT == sqlCommandType) { |
| | | |
| | |
| | | for (Field field : fields) { |
| | | try { |
| | | // 注入创建人 |
| | | if ("createBy".equals(field.getName())) { |
| | | /* if ("createBy".equals(field.getName())) { |
| | | // 获取当前登录用户信息 |
| | | if(Objects.nonNull(tokenService.getLoginUser())){ |
| | | if (Objects.nonNull(tokenService.getLoginUser())) { |
| | | String userName = tokenService.getLoginUser().getUser().getUserName(); |
| | | field.setAccessible(true); |
| | | field.set(parameter, userName); |
| | | field.setAccessible(false); |
| | | } |
| | | } |
| | | }*/ |
| | | //注入创建时间 |
| | | if ("createTime".equals(field.getName())) { |
| | | field.setAccessible(true); |
| | | field.set(parameter, new Date()); |
| | | field.setAccessible(false); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("failed to insert data, exception = ", e); |
| | | } |
| | |
| | | try { |
| | | if ("updateBy".equals(field.getName())) { |
| | | // 获取当前登录用户信息 |
| | | if(Objects.nonNull(tokenService.getLoginUser())){ |
| | | if (Objects.nonNull(tokenService.getLoginUser())) { |
| | | String userName = tokenService.getLoginUser().getUser().getUserName(); |
| | | field.setAccessible(true); |
| | | field.set(parameter, userName); |
| | |
| | | } |
| | | return invocation.proceed(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Object plugin(Object target) { |
| | | return Plugin.wrap(target, this); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void setProperties(Properties properties) { |
| | | // TODO Auto-generated method stub |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取类的所有属性,包括父类 |
| | | * |
| | |
| | | fieldList.toArray(fields); |
| | | return fields; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | # 项目相关配置 |
| | | ruoyi: |
| | | # 名称 |
| | | name: RuoYi |
| | | # 版本 |
| | | version: 3.8.6 |
| | | # 版权年份 |
| | | copyrightYear: 2023 |
| | | # 实例演示开关 |
| | | demoEnabled: true |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | | # 验证码类型 math 数字计算 char 字符验证 |
| | | captchaType: math |
| | | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8084 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | | tomcat: |
| | | # tomcat的URI编码 |
| | | uri-encoding: UTF-8 |
| | | # 连接数满后的排队数,默认为100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcat最大线程数,默认为200 |
| | | max: 800 |
| | | # Tomcat启动初始化的线程数,默认值10 |
| | | min-spare: 100 |
| | | |
| | | # 日志配置 |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # 用户配置 |
| | | user: |
| | | password: |
| | | # 密码最大错误次数 |
| | | maxRetryCount: 5 |
| | | # 密码锁定时间(默认10分钟) |
| | | lockTime: 10 |
| | | |
| | | # Spring配置 |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | # 资源信息 |
| | | messages: |
| | | # 国际化资源文件路径 |
| | | basename: i18n/messages |
| | | config: |
| | | activate: |
| | | on-profile: dev |
| | | # 文件上传 |
| | | servlet: |
| | | multipart: |
| | | # 单个文件大小 |
| | | max-file-size: 500MB |
| | | # 设置总上传的文件大小 |
| | | max-request-size: 2000MB |
| | | # 服务模块 |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | | host: 127.0.0.1 |
| | | # 端口,默认为6379 |
| | | port: 6379 |
| | | # 数据库索引 |
| | | database: 0 |
| | | # 密码 |
| | | password: 123456 |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # 连接池中的最小空闲连接 |
| | | min-idle: 0 |
| | | # 连接池中的最大空闲连接 |
| | | max-idle: 8 |
| | | # 连接池的最大数据库连接数 |
| | | max-active: 8 |
| | | # #连接池最大阻塞等待时间(使用负值表示没有限制) |
| | | max-wait: -1ms |
| | | jackson: |
| | | default-property-inclusion: non_null |
| | | deserialization: |
| | | read-unknown-enum-values-as-null: true |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://localhost:3306/financialdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # url: jdbc:mysql://8.137.10.192:3306/sys_config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 |
| | | # username: root |
| | | # password: shms#123~ |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 20 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置连接超时时间 |
| | | connectTimeout: 30000 |
| | | # 配置网络超时时间 |
| | | socketTimeout: 60000 |
| | | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置白名单,不填则允许所有访问 |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # 控制台管理用户名和密码 |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 慢SQL记录 |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # token配置 |
| | | token: |
| | | # 令牌自定义标识 |
| | | header: Authorization |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 120 |
| | | |
| | | # MyBatis配置 |
| | | #mybatis: |
| | | # # 搜索指定包别名 |
| | | # typeAliasesPackage: com.ruoyi.**.domain |
| | | # # 配置mapper的扫描,找到所有的mapper.xml映射文件 |
| | | # mapperLocations: classpath*:mapper/**/*Mapper.xml |
| | | # # 加载全局的配置文件 |
| | | # configLocation: classpath:mybatis/mybatis-config.xml |
| | | |
| | | # PageHelper分页插件 |
| | | #pagehelper: |
| | | # helperDialect: mysql |
| | | # supportMethodsArguments: true |
| | | # params: count=countSql |
| | | |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | | # config-location: classpath:/mybatis-config.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | configuration: |
| | | map-underscore-to-camel-case: true |
| | | default-enum-type-handler: org.apache.ibatis.type.EnumOrdinalTypeHandler |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | cache-enabled: true |
| | | local-cache-scope: statement |
| | | type-aliases-package: com.ruoyi.**.domain,com.ruoyi.**.vo |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | # Swagger配置 |
| | | swagger: |
| | | # 是否开启swagger |
| | | enabled: true |
| | | # 请求前缀 |
| | | pathMapping: / |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | | # 过滤开关 |
| | | enabled: true |
| | | # 排除链接(多个用逗号分隔) |
| | | excludes: /system/notice |
| | | # 匹配链接 |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | file: |
| | | upload: |
| | | location: /file/ |
| | | qrLocation: /file/qrCode/ |
| | | accessPath: /file/ |
| | | allowExt: .jpg|.png|.gif|.jpeg|.doc|.docx|.apk|.MP4|.mp4|.pdf|.PDF |
| | | wx: |
| | | config: |
| | | appId: wxc3985a05da7d86dc |
| | | secret: 5cca42633c25439613b328c08ef20cc9 |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | accessKeyId: LTAI5tAdba8HtT1C6UqtSxBt |
| | | accessKeySecret: 0SRb6XGkciQDPWn2rYqbJtq2qRMDY8 |
| | | signName: "四川金达通信工程" |
| | | templateCode: "SMS_293985284" |
New file |
| | |
| | | # 项目相关配置 |
| | | ruoyi: |
| | | # 名称 |
| | | name: RuoYi |
| | | # 版本 |
| | | version: 3.8.6 |
| | | # 版权年份 |
| | | copyrightYear: 2023 |
| | | # 实例演示开关 |
| | | demoEnabled: true |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | | # 验证码类型 math 数字计算 char 字符验证 |
| | | captchaType: math |
| | | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8082 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | | tomcat: |
| | | # tomcat的URI编码 |
| | | uri-encoding: UTF-8 |
| | | # 连接数满后的排队数,默认为100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcat最大线程数,默认为200 |
| | | max: 800 |
| | | # Tomcat启动初始化的线程数,默认值10 |
| | | min-spare: 100 |
| | | |
| | | # 日志配置 |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # 用户配置 |
| | | user: |
| | | password: |
| | | # 密码最大错误次数 |
| | | maxRetryCount: 5 |
| | | # 密码锁定时间(默认10分钟) |
| | | lockTime: 10 |
| | | |
| | | # Spring配置 |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | # 资源信息 |
| | | messages: |
| | | # 国际化资源文件路径 |
| | | basename: i18n/messages |
| | | config: |
| | | activate: |
| | | on-profile: prod |
| | | # 文件上传 |
| | | servlet: |
| | | multipart: |
| | | # 单个文件大小 |
| | | max-file-size: 500MB |
| | | # 设置总上传的文件大小 |
| | | max-request-size: 2000MB |
| | | # 服务模块 |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | | host: 127.0.0.1 |
| | | # 端口,默认为6379 |
| | | port: 6379 |
| | | # 数据库索引 |
| | | database: 0 |
| | | # 密码 |
| | | password: 123456 |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # 连接池中的最小空闲连接 |
| | | min-idle: 0 |
| | | # 连接池中的最大空闲连接 |
| | | max-idle: 8 |
| | | # 连接池的最大数据库连接数 |
| | | max-active: 8 |
| | | # #连接池最大阻塞等待时间(使用负值表示没有限制) |
| | | max-wait: -1ms |
| | | jackson: |
| | | default-property-inclusion: non_null |
| | | deserialization: |
| | | read-unknown-enum-values-as-null: true |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://localhost:3306/financialdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | # url: jdbc:mysql://8.137.10.192:3306/sys_config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 |
| | | # username: root |
| | | # password: shms#123~ |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | | enabled: false |
| | | url: |
| | | username: |
| | | password: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 20 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置连接超时时间 |
| | | connectTimeout: 30000 |
| | | # 配置网络超时时间 |
| | | socketTimeout: 60000 |
| | | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置白名单,不填则允许所有访问 |
| | | allow: |
| | | url-pattern: /druid/* |
| | | # 控制台管理用户名和密码 |
| | | login-username: ruoyi |
| | | login-password: 123456 |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 慢SQL记录 |
| | | log-slow-sql: true |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # token配置 |
| | | token: |
| | | # 令牌自定义标识 |
| | | header: Authorization |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 120 |
| | | |
| | | # MyBatis配置 |
| | | #mybatis: |
| | | # # 搜索指定包别名 |
| | | # typeAliasesPackage: com.ruoyi.**.domain |
| | | # # 配置mapper的扫描,找到所有的mapper.xml映射文件 |
| | | # mapperLocations: classpath*:mapper/**/*Mapper.xml |
| | | # # 加载全局的配置文件 |
| | | # configLocation: classpath:mybatis/mybatis-config.xml |
| | | |
| | | # PageHelper分页插件 |
| | | #pagehelper: |
| | | # helperDialect: mysql |
| | | # supportMethodsArguments: true |
| | | # params: count=countSql |
| | | |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | | # config-location: classpath:/mybatis-config.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | configuration: |
| | | map-underscore-to-camel-case: true |
| | | default-enum-type-handler: org.apache.ibatis.type.EnumOrdinalTypeHandler |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | cache-enabled: true |
| | | local-cache-scope: statement |
| | | type-aliases-package: com.ruoyi.**.domain,com.ruoyi.**.vo |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | # Swagger配置 |
| | | swagger: |
| | | # 是否开启swagger |
| | | enabled: true |
| | | # 请求前缀 |
| | | pathMapping: / |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | | # 过滤开关 |
| | | enabled: true |
| | | # 排除链接(多个用逗号分隔) |
| | | excludes: /system/notice |
| | | # 匹配链接 |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | file: |
| | | upload: |
| | | location: /file/ |
| | | qrLocation: /file/qrCode/ |
| | | accessPath: /file/ |
| | | allowExt: .jpg|.png|.gif|.jpeg|.doc|.docx|.apk|.MP4|.mp4|.pdf|.PDF |
| | | wx: |
| | | config: |
| | | appId: wxc3985a05da7d86dc |
| | | secret: 5cca42633c25439613b328c08ef20cc9 |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | accessKeyId: LTAI5tAdba8HtT1C6UqtSxBt |
| | | accessKeySecret: 0SRb6XGkciQDPWn2rYqbJtq2qRMDY8 |
| | | signName: "四川金达通信工程" |
| | | templateCode: "SMS_293985284" |
| | |
| | | # 项目相关配置 |
| | | ruoyi: |
| | | # 名称 |
| | | name: RuoYi |
| | | # 版本 |
| | | version: 3.8.6 |
| | | # 版权年份 |
| | | copyrightYear: 2023 |
| | | # 实例演示开关 |
| | | demoEnabled: true |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | | # 验证码类型 math 数字计算 char 字符验证 |
| | | captchaType: math |
| | | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8082 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | | tomcat: |
| | | # tomcat的URI编码 |
| | | uri-encoding: UTF-8 |
| | | # 连接数满后的排队数,默认为100 |
| | | accept-count: 1000 |
| | | threads: |
| | | # tomcat最大线程数,默认为200 |
| | | max: 800 |
| | | # Tomcat启动初始化的线程数,默认值10 |
| | | min-spare: 100 |
| | | |
| | | # 日志配置 |
| | | logging: |
| | | level: |
| | | com.ruoyi: debug |
| | | org.springframework: warn |
| | | |
| | | # 用户配置 |
| | | user: |
| | | password: |
| | | # 密码最大错误次数 |
| | | maxRetryCount: 5 |
| | | # 密码锁定时间(默认10分钟) |
| | | lockTime: 10 |
| | | |
| | | # Spring配置 |
| | | spring: |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | # 资源信息 |
| | | messages: |
| | | # 国际化资源文件路径 |
| | | basename: i18n/messages |
| | | profiles: |
| | | active: druid |
| | | # 文件上传 |
| | | servlet: |
| | | multipart: |
| | | # 单个文件大小 |
| | | max-file-size: 500MB |
| | | # 设置总上传的文件大小 |
| | | max-request-size: 2000MB |
| | | # 服务模块 |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | | host: 127.0.0.1 |
| | | # 端口,默认为6379 |
| | | port: 6379 |
| | | # 数据库索引 |
| | | database: 0 |
| | | # 密码 |
| | | password: 123456 |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # 连接池中的最小空闲连接 |
| | | min-idle: 0 |
| | | # 连接池中的最大空闲连接 |
| | | max-idle: 8 |
| | | # 连接池的最大数据库连接数 |
| | | max-active: 8 |
| | | # #连接池最大阻塞等待时间(使用负值表示没有限制) |
| | | max-wait: -1ms |
| | | jackson: |
| | | default-property-inclusion: non_null |
| | | deserialization: |
| | | read-unknown-enum-values-as-null: true |
| | | |
| | | # token配置 |
| | | token: |
| | | # 令牌自定义标识 |
| | | header: Authorization |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 120 |
| | | |
| | | # MyBatis配置 |
| | | #mybatis: |
| | | # # 搜索指定包别名 |
| | | # typeAliasesPackage: com.ruoyi.**.domain |
| | | # # 配置mapper的扫描,找到所有的mapper.xml映射文件 |
| | | # mapperLocations: classpath*:mapper/**/*Mapper.xml |
| | | # # 加载全局的配置文件 |
| | | # configLocation: classpath:mybatis/mybatis-config.xml |
| | | |
| | | # PageHelper分页插件 |
| | | #pagehelper: |
| | | # helperDialect: mysql |
| | | # supportMethodsArguments: true |
| | | # params: count=countSql |
| | | |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | | # config-location: classpath:/mybatis-config.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | configuration: |
| | | map-underscore-to-camel-case: true |
| | | default-enum-type-handler: org.apache.ibatis.type.EnumOrdinalTypeHandler |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | cache-enabled: true |
| | | local-cache-scope: statement |
| | | type-aliases-package: com.ruoyi.**.domain,com.ruoyi.**.vo |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | | # Swagger配置 |
| | | swagger: |
| | | # 是否开启swagger |
| | | enabled: true |
| | | # 请求前缀 |
| | | pathMapping: / |
| | | |
| | | # 防止XSS攻击 |
| | | xss: |
| | | # 过滤开关 |
| | | enabled: true |
| | | # 排除链接(多个用逗号分隔) |
| | | excludes: /system/notice |
| | | # 匹配链接 |
| | | urlPatterns: /system/*,/monitor/*,/tool/* |
| | | file: |
| | | upload: |
| | | location: /file/ |
| | | qrLocation: /file/qrCode/ |
| | | accessPath: /file/ |
| | | allowExt: .jpg|.png|.gif|.jpeg|.doc|.docx|.apk|.MP4|.mp4|.pdf|.PDF |
| | | wx: |
| | | config: |
| | | appId: wxc3985a05da7d86dc |
| | | secret: 5cca42633c25439613b328c08ef20cc9 |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | accessKeyId: LTAI5tAdba8HtT1C6UqtSxBt |
| | | accessKeySecret: 0SRb6XGkciQDPWn2rYqbJtq2qRMDY8 |
| | | signName: "四川金达通信工程" |
| | | templateCode: "SMS_293985284" |
| | | active: prod |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.annotation.FinancialLog; |
| | | import com.ruoyi.common.annotation.HistoryGroup; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.ReportingStatusEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.system.domain.TbBasicData; |
| | |
| | | |
| | | @PostMapping("/import") |
| | | @ApiOperation("导入历史数据") |
| | | @FinancialLog(title = "导入数据", businessType = BusinessType.IMPORT) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "文件", required = true, dataType = "file", paramType = "form"), |
| | | @ApiImplicitParam(name = "quarter", value = "季度 e.g. 2024年一季度", required = true, dataType = "string", paramType = "query", dataTypeClass = String.class) |
| | |
| | | |
| | | @PostMapping("/export") |
| | | @ApiOperation("导出") |
| | | @FinancialLog(title = "导出数据", businessType = BusinessType.EXPORT) |
| | | @ApiImplicitParam(name = "quarterList", value = "quarterList", allowMultiple = true, dataTypeClass = List.class, paramType = "query") |
| | | public void exportData(@RequestParam("quarterList") List<String> quarterList) { |
| | | try { |
| | |
| | | public R<List<DataScreenConfigVO>> getIndicatorsConfig( |
| | | @Validated @RequestBody DataScreenConfigQuery query) { |
| | | try { |
| | | return R.ok(tbDataScreenConfigService.getIndicatorsConfig(query)); |
| | | return R.ok(tbDataScreenConfigService.getIndicatorsConfig(query.getType())); |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
New file |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.query.OperLogQuery; |
| | | import com.ruoyi.system.service.TbOperLogService; |
| | | import com.ruoyi.system.vo.OperLogVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Api(tags = {"操作日志"}) |
| | | @RestController |
| | | @RequestMapping("/oper-log") |
| | | @RequiredArgsConstructor |
| | | public class TbOperLogController { |
| | | |
| | | private final TbOperLogService tbOperLogService; |
| | | |
| | | @ApiOperation("查询日志列表") |
| | | @PostMapping("/page") |
| | | public R<PageDTO<OperLogVO>> queryPage(@Validated @RequestBody OperLogQuery query) { |
| | | return R.ok(tbOperLogService.queryPage(query)); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.web.controller.api.screen; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/15 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/screen") |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "大屏接口") |
| | | public class ScreenController { |
| | | |
| | | private final ISysUserService sysUserService; |
| | | |
| | | @ApiOperation("全省统计数") |
| | | @GetMapping("/province-statics") |
| | | public R<Integer> provinceStatics() { |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @Configuration |
| | | public class MybatisConfiguration { |
| | | |
| | | |
| | | /** |
| | | * 注册拦截器 |
| | | */ |
| | |
| | | public MybatisInterceptor getMybatisInterceptor() { |
| | | return new MybatisInterceptor(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | @GetMapping("/roleInfo") |
| | | public R<RoleInfoVO> roleInfo(@RequestParam Long roleId) { |
| | | SysRole role = roleService.selectRoleById(roleId); |
| | | if (Objects.isNull(role)) { |
| | | return R.ok(new RoleInfoVO()); |
| | | } |
| | | RoleInfoVO roleInfoVo = new RoleInfoVO(); |
| | | roleInfoVo.setRoleId(role.getRoleId()); |
| | | roleInfoVo.setRoleName(role.getRoleName()); |
| | |
| | | return AjaxResult.success(roleService.roleInfoFromUserId(userId)); |
| | | } |
| | | |
| | | @ApiOperation("角色获取权限菜单") |
| | | @GetMapping("/getMenuByRoleId") |
| | | public AjaxResult getMenuByRoleId(@RequestParam Long roleId) { |
| | | return AjaxResult.success(roleService.getMenuByRoleId(roleId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增角色 |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.dto.SysUserDTO; |
| | | import com.ruoyi.system.dto.SysUserUpdateStatusDTO; |
| | | import com.ruoyi.system.dto.update.SysUserPwdUpdDTO; |
| | | import com.ruoyi.system.dto.update.SysUserUpdDTO; |
| | | import com.ruoyi.system.mapper.SysUserRoleMapper; |
| | | import com.ruoyi.system.query.SysUserQuery; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | |
| | | @ApiOperation(value = "获取用户列表") |
| | | @PostMapping("/list") |
| | | public AjaxResult list(@RequestBody SysUserQuery query) { |
| | | PageInfo<SysUserVO> list = userService.pageList(query); |
| | | return AjaxResult.success(list); |
| | | PageDTO<SysUserVO> page = userService.pageList(query); |
| | | return AjaxResult.success(page); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取用户列表-不分页") |
| | |
| | | /** |
| | | * 获取用户数量统计 |
| | | */ |
| | | @ApiOperation(value = "获取用户数量统计") |
| | | // @ApiOperation(value = "获取用户数量统计") |
| | | @PostMapping("/getUserCount") |
| | | public AjaxResult getUserCount() { |
| | | Map<String, Integer> map = new HashMap<>(); |
| | |
| | | } |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setNickName(user.getUserName()); |
| | | userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | /* SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | | sysUserRole.setRoleId(dto.getRoleId()); |
| | | userRoleMapper.insertUserRole(sysUserRole); |
| | | userRoleMapper.insertUserRole(sysUserRole);*/ |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "修改用户管理") |
| | | @Log(title = "用户信息-修改用户", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | | user.setUserName(user.getPhoneNumber()); |
| | | public AjaxResult edit(@Validated @RequestBody SysUserUpdDTO dto) { |
| | | SysUser user = this.userService.selectUserById(dto.getUserId()); |
| | | user.setUserName(dto.getUserName()); |
| | | user.setNickName(dto.getUserName()); |
| | | user.setPhoneNumber(dto.getPhoneNumber()); |
| | | user.setRoleId(dto.getRoleId()); |
| | | // userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getUserId()); |
| | | if (!userService.checkUserNameUnique(user)) { |
| | | /*if (!userService.checkUserNameUnique(user)) { |
| | | return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | | } else if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique( |
| | | } else*/ |
| | | if (StringUtils.isNotEmpty(user.getPhoneNumber()) && !userService.checkPhoneUnique( |
| | | user)) { |
| | | return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | |
| | | user.setUpdateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | return AjaxResult.success(userService.updateUser(user)); |
| | | } |
| | | |
| | | @ApiOperation(value = "修改密码") |
| | | @Log(title = "用户信息-修改密码", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit-password") |
| | | public AjaxResult editPassword(@Validated @RequestBody SysUserPwdUpdDTO dto) { |
| | | SysUser user = this.userService.getById(dto.getUserId()); |
| | | user.setUpdateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | return AjaxResult.success(userService.updateById(user)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 重置密码 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") |
| | | @ApiOperation(value = "重置密码") |
| | | // @ApiOperation(value = "重置密码") |
| | | @Log(title = "用户信息-重置密码", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/resetPwd") |
| | | public AjaxResult resetPwd(@RequestBody SysUser user) { |
New file |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * 自定义操作日志记录注解 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target({ElementType.PARAMETER, ElementType.METHOD}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface FinancialLog { |
| | | |
| | | /** |
| | | * 模块 |
| | | */ |
| | | public String title() default ""; |
| | | |
| | | /** |
| | | * 功能 |
| | | */ |
| | | public BusinessType businessType() default BusinessType.OTHER; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.common.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | |
| | | * 造成spring循环依赖,项目支棱不起来 |
| | | */ |
| | | @Slf4j |
| | | @Configuration |
| | | //@Configuration |
| | | public class DataUpdateHandlerConfig implements MetaObjectHandler { |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | this.strictInsertFill(metaObject, "createTime", Date.class, new Date()); // 起始版本 3.3.0(推荐使用) |
| | | this.strictInsertFill(metaObject, "createBy", String.class, SecurityUtils.getUsername()); // 起始版本 3.3.0(推荐使用) |
| | | // 获取登录信息 |
| | | /* String userName = JwtTokenUtils.getUsername(); |
| | | if (StringUtils.isNotBlank(userName)) { |
| | |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date()); // 起始版本 3.3.0(推荐) |
| | | this.strictUpdateFill(metaObject, "updateBy", String.class, SecurityUtils.getUsername()); // 起始版本 3.3.0(推荐) |
| | | // 获取登录信息 |
| | | /*String userName = JwtTokenUtils.getUsername(); |
| | | if (StringUtils.isNotBlank(userName)) { |
| | |
| | | package com.ruoyi.common.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.core.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | |
| | | * @author liheng |
| | | * @ClassName MybatisPlusConfig |
| | | * @Description MybatisPlus相关配置 |
| | | * @date 2020-09-22 11:22、 |
| | | * 直接以实现类作为bean的注入(有事务管理的类) |
| | | * @date 2020-09-22 11:22、 直接以实现类作为bean的注入(有事务管理的类) |
| | | * @EnableTransactionManagement(proxyTargetClass = true) |
| | | */ |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | private final DataUpdateHandlerConfig dataUpdateHandler; |
| | | /* private final DataUpdateHandlerConfig dataUpdateHandler; |
| | | |
| | | @Autowired |
| | | public MybatisPlusConfig(DataUpdateHandlerConfig dataUpdateHandler) { |
| | | this.dataUpdateHandler = dataUpdateHandler; |
| | | } |
| | | }*/ |
| | | |
| | | /** |
| | | * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题 |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | /* @Bean |
| | | public GlobalConfig globalConfig() { |
| | | GlobalConfig globalConfig = new GlobalConfig(); |
| | | globalConfig.setMetaObjectHandler(dataUpdateHandler); |
| | | return globalConfig; |
| | | } |
| | | }*/ |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.common.core.domain.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.util.Set; |
| | |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 删除标志(0代表存在 2代表删除) |
| | | * 删除标志(0代表存在 1代表删除) |
| | | */ |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 业务操作类型 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum BusinessType |
| | | { |
| | | public enum BusinessType { |
| | | /** |
| | | * 其它 |
| | | */ |
| | |
| | | * 生成代码 |
| | | */ |
| | | GENCODE, |
| | | |
| | | |
| | | /** |
| | | * 清空数据 |
| | | */ |
| | |
| | | * 现场作业修改人员 |
| | | */ |
| | | UPDATEUSERREMOVE, |
| | | /** |
| | | * 部门端修改基础数据 |
| | | */ |
| | | UPDBASICDATA, |
| | | |
| | | } |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | |
| | | /** |
| | | * 安全服务工具类 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SecurityUtils |
| | | { |
| | | public class SecurityUtils { |
| | | |
| | | /** |
| | | * 用户ID |
| | | **/ |
| | | public static Long getUserId() |
| | | { |
| | | try |
| | | { |
| | | public static Long getUserId() { |
| | | try { |
| | | return getLoginUser().getUserId(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | } catch (Exception e) { |
| | | throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 获取部门ID |
| | | **/ |
| | | public static Long getDeptId() |
| | | { |
| | | try |
| | | { |
| | | public static Long getDeptId() { |
| | | try { |
| | | return getLoginUser().getDeptId(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | } catch (Exception e) { |
| | | throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户账户 |
| | | **/ |
| | | public static String getUsername() |
| | | { |
| | | try |
| | | { |
| | | public static String getUsername() { |
| | | try { |
| | | return getLoginUser().getUsername(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | } catch (Exception e) { |
| | | throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 获取用户 |
| | | **/ |
| | | public static LoginUser getLoginUser() |
| | | { |
| | | try |
| | | { |
| | | public static LoginUser getLoginUser() { |
| | | try { |
| | | return (LoginUser) getAuthentication().getPrincipal(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | } catch (Exception e) { |
| | | throw new ServiceException("获取用户信息异常", HttpStatus.UNAUTHORIZED); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 获取Authentication |
| | | */ |
| | | public static Authentication getAuthentication() |
| | | { |
| | | public static Authentication getAuthentication() { |
| | | return SecurityContextHolder.getContext().getAuthentication(); |
| | | } |
| | | |
| | |
| | | * @param password 密码 |
| | | * @return 加密字符串 |
| | | */ |
| | | public static String encryptPassword(String password) |
| | | { |
| | | public static String encryptPassword(String password) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | return passwordEncoder.encode(password); |
| | | } |
| | |
| | | /** |
| | | * 判断密码是否相同 |
| | | * |
| | | * @param rawPassword 真实密码 |
| | | * @param rawPassword 真实密码 |
| | | * @param encodedPassword 加密后字符 |
| | | * @return 结果 |
| | | */ |
| | | public static boolean matchesPassword(String rawPassword, String encodedPassword) |
| | | { |
| | | public static boolean matchesPassword(String rawPassword, String encodedPassword) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | return passwordEncoder.matches(rawPassword, encodedPassword); |
| | | } |
| | | |
| | | /** |
| | | * 是否为管理员 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 结果 |
| | | */ |
| | | public static boolean isAdmin(Long userId) |
| | | { |
| | | public static boolean isAdmin(Long userId) { |
| | | return userId != null && 1L == userId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.framework.aspectj; |
| | | |
| | | import com.ruoyi.common.annotation.FinancialLog; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.enums.BusinessStatus; |
| | | import com.ruoyi.common.enums.UserTypeEnum; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.manager.AsyncManager; |
| | | import com.ruoyi.framework.manager.factory.AsyncFactory; |
| | | import com.ruoyi.system.domain.TbOperLog; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import java.util.Objects; |
| | | import org.aspectj.lang.JoinPoint; |
| | | import org.aspectj.lang.annotation.AfterReturning; |
| | | import org.aspectj.lang.annotation.AfterThrowing; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 操作日志记录处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | public class FinancialLogAspect { |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(FinancialLogAspect.class); |
| | | |
| | | /** |
| | | * 处理完请求后执行 |
| | | * |
| | | * @param joinPoint 切点 |
| | | */ |
| | | @AfterReturning(pointcut = "@annotation(log)", returning = "jsonResult") |
| | | public void doAfterReturning(JoinPoint joinPoint, FinancialLog log, |
| | | Object jsonResult) { |
| | | handleLog(joinPoint, log, jsonResult); |
| | | } |
| | | |
| | | /** |
| | | * 拦截异常操作 |
| | | * |
| | | * @param joinPoint 切点 |
| | | * @param e 异常 |
| | | */ |
| | | @AfterThrowing(value = "@annotation(log)", throwing = "e") |
| | | public void doAfterThrowing(JoinPoint joinPoint, Log log, Exception e) { |
| | | |
| | | } |
| | | |
| | | protected void handleLog(final JoinPoint joinPoint, FinancialLog log, |
| | | Object jsonResult) { |
| | | // 获取当前的用户 |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | // *========数据库日志=========*// |
| | | TbOperLog operLog = new TbOperLog(); |
| | | operLog.setBusinessType(BusinessStatus.SUCCESS.ordinal()); |
| | | if (loginUser != null) { |
| | | SysUser user = loginUser.getUser(); |
| | | operLog.setAreaName( |
| | | UserTypeEnum.PLATFORM.equals(user.getUserType()) ? "平台" |
| | | : user.getAreaName()); |
| | | if (Objects.nonNull(user)) { |
| | | operLog.setStaffName(user.getNickName()); |
| | | operLog.setPhoneNumber(user.getPhoneNumber()); |
| | | operLog.setPhoneNumber(user.getPhoneNumber()); |
| | | } |
| | | } |
| | | // 处理设置注解上的参数 |
| | | getControllerMethodDescription(joinPoint, log, operLog, jsonResult); |
| | | // 保存数据库 |
| | | AsyncManager.me().execute(AsyncFactory.recordOper(operLog)); |
| | | } |
| | | |
| | | /** |
| | | * 获取注解中对方法的描述信息 用于Controller层注解 |
| | | * |
| | | * @param log 日志 |
| | | * @param operLog 操作日志 |
| | | * @throws Exception |
| | | */ |
| | | public void getControllerMethodDescription(JoinPoint joinPoint, FinancialLog log, |
| | | TbOperLog operLog, |
| | | Object jsonResult) { |
| | | // 设置action动作 |
| | | operLog.setBusinessType(log.businessType().ordinal()); |
| | | // 设置标题 |
| | | operLog.setOperation(log.title()); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.framework.manager.factory; |
| | | |
| | | import java.util.TimerTask; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.LogUtils; |
| | | import com.ruoyi.common.utils.ServletUtils; |
| | |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.system.domain.SysLogininfor; |
| | | import com.ruoyi.system.domain.SysOperLog; |
| | | import com.ruoyi.system.domain.TbOperLog; |
| | | import com.ruoyi.system.service.ISysLogininforService; |
| | | import com.ruoyi.system.service.ISysOperLogService; |
| | | import com.ruoyi.system.service.TbOperLogService; |
| | | import eu.bitwalker.useragentutils.UserAgent; |
| | | import java.util.TimerTask; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * 异步工厂(产生任务用) |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class AsyncFactory |
| | | { |
| | | public class AsyncFactory { |
| | | |
| | | private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user"); |
| | | |
| | | /** |
| | | * 记录登录信息 |
| | | * |
| | | * |
| | | * @param username 用户名 |
| | | * @param status 状态 |
| | | * @param message 消息 |
| | | * @param args 列表 |
| | | * @param status 状态 |
| | | * @param message 消息 |
| | | * @param args 列表 |
| | | * @return 任务task |
| | | */ |
| | | public static TimerTask recordLogininfor(final String username, final String status, final String message, |
| | | final Object... args) |
| | | { |
| | | final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); |
| | | public static TimerTask recordLogininfor(final String username, final String status, |
| | | final String message, |
| | | final Object... args) { |
| | | final UserAgent userAgent = UserAgent.parseUserAgentString( |
| | | ServletUtils.getRequest().getHeader("User-Agent")); |
| | | final String ip = IpUtils.getIpAddr(); |
| | | return new TimerTask() |
| | | { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() |
| | | { |
| | | public void run() { |
| | | String address = AddressUtils.getRealAddressByIP(ip); |
| | | StringBuilder s = new StringBuilder(); |
| | | s.append(LogUtils.getBlock(ip)); |
| | |
| | | logininfor.setOs(os); |
| | | logininfor.setMsg(message); |
| | | // 日志状态 |
| | | if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) |
| | | { |
| | | if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, |
| | | Constants.REGISTER)) { |
| | | logininfor.setStatus(Constants.SUCCESS); |
| | | } |
| | | else if (Constants.LOGIN_FAIL.equals(status)) |
| | | { |
| | | } else if (Constants.LOGIN_FAIL.equals(status)) { |
| | | logininfor.setStatus(Constants.FAIL); |
| | | } |
| | | // 插入数据 |
| | |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * |
| | | * @param operLog 操作日志信息 |
| | | * @return 任务task |
| | | */ |
| | | public static TimerTask recordOper(final SysOperLog operLog) |
| | | { |
| | | return new TimerTask() |
| | | { |
| | | public static TimerTask recordOper(final SysOperLog operLog) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() |
| | | { |
| | | public void run() { |
| | | // 远程查询操作地点 |
| | | operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp())); |
| | | SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * @param operLog 操作日志信息 |
| | | * @return 任务task |
| | | */ |
| | | public static TimerTask recordOper(final TbOperLog operLog) { |
| | | return new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | SpringUtils.getBean(TbOperLogService.class).save(operLog); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * 大屏得分表 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("tb_data_screen_score") |
| | | @ApiModel(value = "TbDataScreenScore对象", description = "大屏得分表") |
| | | public class TbDataScreenScore implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "部门区划代码") |
| | | @TableField("dept_area_code") |
| | | private String deptAreaCode; |
| | | |
| | | @ApiModelProperty(value = "基础数据id") |
| | | @TableField("basic_data_id") |
| | | private Long basicDataId; |
| | | |
| | | @ApiModelProperty(value = "配置id ") |
| | | @TableField("data_screen_config_id") |
| | | private Long dataScreenConfigId; |
| | | |
| | | @ApiModelProperty(value = "得分") |
| | | @TableField("score") |
| | | private Double score; |
| | | |
| | | @ApiModelProperty(value = "得分率") |
| | | @TableField("score_rate") |
| | | private Double scoreRate; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField(value = "create_time", fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("tb_oper_log") |
| | | @ApiModel(value = "TbOperLog对象", description = "") |
| | | public class TbOperLog implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "操作类别") |
| | | @TableField("business_type") |
| | | private Integer businessType; |
| | | |
| | | @ApiModelProperty(value = "员工姓名") |
| | | @TableField("staff_name") |
| | | private String staffName; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | @TableField("phone_number") |
| | | private String phoneNumber; |
| | | |
| | | @ApiModelProperty(value = "操作") |
| | | @TableField("operation") |
| | | private String operation; |
| | | |
| | | @ApiModelProperty(value = "修改字段") |
| | | @TableField("field_name") |
| | | private String fieldName; |
| | | |
| | | @ApiModelProperty(value = "所属部门") |
| | | @TableField("area_name") |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty(value = "修改前数据") |
| | | @TableField("before_edit") |
| | | private String beforeEdit; |
| | | |
| | | @ApiModelProperty(value = "修改后数据") |
| | | @TableField("after_edit") |
| | | private String afterEdit; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField(value = "create_time", fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | } |
| | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "当前季度基础数据数据传输对象") |
| | | public class BasicDataDTO { |
| | | public class BasicDataDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -519305267336964392L; |
| | | |
| | | @ApiModelProperty(value = "转移支付规模") |
| | | private String transferPaymentScale; |
| | |
| | | package com.ruoyi.system.dto.update; |
| | | |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import com.ruoyi.system.dto.CalculateItemDTO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | |
| | | public class DataIndicatorsUpdDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -5866223907037261823L; |
| | | |
| | | |
| | | @ApiModelProperty(value = "配置类型子类型(1=指标一 2=指标二 3=指标三 4=指标四)") |
| | | @NotNull(message = "配置类型子类型不能为空") |
| | | private SubTypeEnum subType; |
| | | |
| | | @ApiModelProperty(value = "得分计算规则") |
| | | @NotNull(message = "得分计算规则不能为空") |
| | | private String calculateFormula; |
| | | @NotEmpty(message = "得分计算规则不能为空") |
| | | private List<CalculateItemDTO> scoreCalculateList; |
| | | |
| | | @ApiModelProperty(value = "得分率计算规则") |
| | | @NotNull(message = "得分率计算规则不能为空") |
| | | private String calculateRateFormula; |
| | | @NotEmpty(message = "得分率计算规则不能为空") |
| | | private List<CalculateItemDTO> rateCalculateList; |
| | | |
| | | } |
| | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.validation.constraints.NotBlank; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "字段分类更新数据传输对象") |
| | |
| | | private static final long serialVersionUID = -1625725857401976832L; |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | @NotNull(message = "id不能为空") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "一级分类名称") |
| | |
| | | package com.ruoyi.system.dto.update; |
| | | |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import com.ruoyi.system.dto.CalculateItemDTO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | public class FormalIndicatorsUpdDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -4878457973955230627L; |
| | | |
| | | |
| | | @ApiModelProperty(value = "配置类型子类型(1=指标一 2=指标二 3=指标三 4=指标四)") |
| | | private SubTypeEnum subType; |
| | | |
| | | @ApiModelProperty(value = "得分计算规则") |
| | | private String calculateFormula; |
| | | private List<CalculateItemDTO> calculateItemList; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.dto.update; |
| | | |
| | | import com.ruoyi.system.dto.CalculateItemDTO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | |
| | | private static final long serialVersionUID = -4878457973955230627L; |
| | | |
| | | @ApiModelProperty(value = "计算规则", notes = "公式中字段的格式为:field_字段id,e.g:field_1,field_2等。") |
| | | @NotBlank(message = "计算规则不能为空") |
| | | private String calculateFormula; |
| | | @ApiModelProperty(value = "计算规则") |
| | | @NotEmpty(message = "计算规则不能为空") |
| | | private List<CalculateItemDTO> calculateItemList; |
| | | |
| | | @ApiModelProperty(value = "风险等级范围-高风险得分") |
| | | @NotBlank(message = "风险等级范围-高风险得分不能为空") |
| | |
| | | @ApiModelProperty(value = "风险等级范围-无风险得分") |
| | | @NotBlank(message = "风险等级范围-无风险得分不能为空") |
| | | private String noRisk; |
| | | |
| | | public boolean areRiskLevelsDistinct() { |
| | | return !highRisk.equals(mediumRisk) && !highRisk.equals(lowRisk) && !highRisk.equals(noRisk) |
| | | && !mediumRisk.equals(lowRisk) && !mediumRisk.equals(noRisk) && !lowRisk.equals( |
| | | noRisk); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.dto.update; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/15 |
| | | */ |
| | | @Data |
| | | @ApiModel("用户更新密码传输实体") |
| | | public class SysUserPwdUpdDTO implements Serializable { |
| | | |
| | | |
| | | private static final long serialVersionUID = -2917521746989431046L; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "密码") |
| | | private String password; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.dto.update; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/15 |
| | | */ |
| | | @Data |
| | | @ApiModel("用户更新传输实体") |
| | | public class SysUserUpdDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 9221182121298547867L; |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("员工姓名") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty("联系电话") |
| | | private String phoneNumber; |
| | | |
| | | @ApiModelProperty("所属角色id") |
| | | private Long roleId; |
| | | } |
| | |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.alibaba.excel.util.ListUtils; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import com.ruoyi.common.enums.FieldTypeEnum; |
| | | import com.ruoyi.common.enums.ReportingStatusEnum; |
| | | import com.ruoyi.common.enums.ShowStatusEnum; |
| | | import com.ruoyi.common.enums.ValueTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.CalculateUtil; |
| | | import com.ruoyi.common.utils.CollUtils; |
| | |
| | | import com.ruoyi.system.domain.TbBasicDataField; |
| | | import com.ruoyi.system.domain.TbField; |
| | | import com.ruoyi.system.domain.TbScore; |
| | | import com.ruoyi.system.dto.CalculateItemDTO; |
| | | import com.ruoyi.system.service.TbBasicDataConfigDetailService; |
| | | import com.ruoyi.system.service.TbBasicDataConfigService; |
| | | import com.ruoyi.system.service.TbBasicDataFieldService; |
| | |
| | | import com.ruoyi.system.service.TbScoreService; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext context) { |
| | | try { |
| | | TbBasicData tbBasicData = saveData(); |
| | | calculateScore(tbBasicData); |
| | | saveData(); |
| | | |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | | throw new ServiceException(e.getMessage()); |
| | |
| | | /** |
| | | * 加上存储数据库 |
| | | */ |
| | | private TbBasicData saveData() throws Exception { |
| | | private void saveData() throws Exception { |
| | | // 查询需要填写的动态字段 |
| | | List<TbField> fieldList = |
| | | tbFieldService.lambdaQuery().eq(TbField::getStatus, ShowStatusEnum.SHOW).list(); |
| | |
| | | } |
| | | LocalDate now = LocalDate.now(); |
| | | TbBasicData tbBasicData; |
| | | String quarter = String.format("%s年%s", now.getYear(), dataMap.get(1)); |
| | | String quarter = dataMap.get(1); |
| | | Optional<TbBasicData> tbBasicDataOpt = tbBasicDataService.lambdaQuery(). |
| | | eq(TbBasicData::getQuarter, quarter) |
| | | .eq(TbBasicData::getDeptAreaCode, areaCode).oneOpt(); |
| | |
| | | tbBasicData.setStatus(ReportingStatusEnum.FILLED); |
| | | tbBasicDataService.updateById(tbBasicData); |
| | | log.info(String.format("%s导入基础数据成功!", dataMap.get(0))); |
| | | return tbBasicData; |
| | | calculateScore(tbBasicData, fields); |
| | | } |
| | | |
| | | private void calculateScore(TbBasicData tbBasicData) { |
| | | private void calculateScore(TbBasicData tbBasicData, List<TbBasicDataField> fields) { |
| | | List<TbScore> scoreList = new ArrayList<>(); |
| | | //计算得分 |
| | | List<TbBasicDataConfig> list = tbBasicDataConfigService.lambdaQuery() |
| | |
| | | .collect(Collectors.toList()); |
| | | tbScoreService.remove( |
| | | new LambdaQueryWrapper<TbScore>().eq(TbScore::getBasicDataId, tbBasicData.getId())); |
| | | Map<Long, TbBasicDataField> basicDataFieldMap = fields.stream() |
| | | .collect(Collectors.toMap(TbBasicDataField::getFieldId, e -> e)); |
| | | if (CollUtils.isNotEmpty(numCalculates)) { |
| | | for (TbBasicDataConfig item : numCalculates) { |
| | | Map<String, Object> valueMap = new HashMap<>(); |
| | | String numberCalculateFormula = item.getNumberCalculateFormula(); |
| | | Map<String, Integer> fieldsAndValue = CalculateUtil.getFieldsAndValue( |
| | | numberCalculateFormula); |
| | | for (Map.Entry<String, Integer> stringIntegerEntry : fieldsAndValue.entrySet()) { |
| | | Optional<TbBasicDataField> tbBasicDataField = tbBasicDataFieldService.lambdaQuery() |
| | | .eq(TbBasicDataField::getBasicDataId, tbBasicData.getId()) |
| | | .eq(TbBasicDataField::getFieldId, stringIntegerEntry.getValue()) |
| | | .oneOpt(); |
| | | tbBasicDataField.ifPresent( |
| | | basicDataField -> valueMap.put(stringIntegerEntry.getKey(), |
| | | basicDataField.getFieldValue())); |
| | | List<CalculateItemDTO> calculateItemDTOS = JSONArray.parseArray( |
| | | numberCalculateFormula, |
| | | CalculateItemDTO.class); |
| | | for (CalculateItemDTO dto : calculateItemDTOS) { |
| | | if (ValueTypeEnum.FIELD.equals(dto.getValueType())) { |
| | | TbBasicDataField tbBasicDataField = basicDataFieldMap.get( |
| | | Long.valueOf(dto.getContent())); |
| | | if (Objects.nonNull(tbBasicDataField)) { |
| | | dto.setContent(tbBasicDataField.getFieldValue()); |
| | | } |
| | | } |
| | | } |
| | | double score = CalculateUtil.calculate(numberCalculateFormula, valueMap); |
| | | String numberCalculateFormulaStr = calculateItemDTOS.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double score = CalculateUtil.calculate(numberCalculateFormulaStr); |
| | | TbScore tbScore = new TbScore(); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(score); |
| | |
| | | Collectors.toMap(TbBasicDataConfigDetail::getKey, |
| | | TbBasicDataConfigDetail::getValue)); |
| | | if (CollectionUtils.isNotEmpty(details)) { |
| | | Optional<TbBasicDataField> tbBasicDataFieldOptional = tbBasicDataFieldService.lambdaQuery() |
| | | .eq(TbBasicDataField::getBasicDataId, tbBasicData.getId()) |
| | | .eq(TbBasicDataField::getFieldId, textAndPercentage.getFieldIdStr()) |
| | | .oneOpt(); |
| | | if (tbBasicDataFieldOptional.isPresent()) { |
| | | TbBasicDataField tbBasicDataField = tbBasicDataFieldOptional.get(); |
| | | TbBasicDataField textAndPercentageData = basicDataFieldMap.get( |
| | | Long.valueOf(textAndPercentage.getFieldIdStr())); |
| | | if (Objects.nonNull(textAndPercentageData)) { |
| | | if (CalculateTypeEnum.TEXT.equals(textAndPercentage.getCalculateType())) { |
| | | String score = scoreMap.get(tbBasicDataField.getFieldValue()); |
| | | String score = scoreMap.get(textAndPercentageData.getFieldValue()); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(Double.parseDouble(score)); |
| | | tbScore.setBasicDataConfigId(textAndPercentage.getId()); |
| | |
| | | textAndPercentage.getCalculateType())) { |
| | | for (Map.Entry<String, String> stringStringEntry : scoreMap.entrySet()) { |
| | | String[] split = stringStringEntry.getKey().split("-"); |
| | | double v = Double.parseDouble(tbBasicDataField.getFieldValue()); |
| | | double v = Double.parseDouble( |
| | | textAndPercentageData.getFieldValue()); |
| | | double min = Double.parseDouble(split[0]); |
| | | double max = Double.parseDouble(split[1]); |
| | | if (v >= min && v <= max) { |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.system.query.SysRoleQuery; |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @Mapper |
| | | public interface SysRoleMapper { |
| | | public interface SysRoleMapper extends BaseMapper<SysRole> { |
| | | |
| | | /** |
| | | * 根据条件分页查询角色数据 |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.query.SysUserQuery; |
| | | import com.ruoyi.system.vo.SysUserVO; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户表 数据层 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Mapper |
| | | public interface SysUserMapper extends BaseMapper<SysUser> |
| | | { |
| | | public interface SysUserMapper extends BaseMapper<SysUser> { |
| | | |
| | | /** |
| | | * 根据条件分页查询用户列表 |
| | | * |
| | | * |
| | | * @param sysUser 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据条件分页查询已配用户角色列表 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据条件分页查询未分配用户角色列表 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 通过用户名查询用户 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @return 用户对象信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 通过用户ID查询用户 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 用户对象信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 新增用户信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改用户头像 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @param avatar 头像地址 |
| | | * @param avatar 头像地址 |
| | | * @return 结果 |
| | | */ |
| | | public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar); |
| | | |
| | | /** |
| | | * 重置用户密码 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @param password 密码 |
| | | * @return 结果 |
| | |
| | | |
| | | /** |
| | | * 通过用户ID删除用户 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 批量删除用户信息 |
| | | * |
| | | * |
| | | * @param userIds 需要删除的用户ID |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 校验用户名称是否唯一 |
| | | * |
| | | * |
| | | * @param userName 用户名称 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询用户集合通过用户id |
| | | * |
| | | * @param userIds |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取用户黑名单列表 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | // List<SysUserVO> selectBlackPageList(@Param("query")SysUserQuery query); |
| | | |
| | | List<SysUser> selectListByNamePhone(@Param("name")String name); |
| | | List<SysUser> selectListByNamePhone(@Param("name") String name); |
| | | |
| | | List<SysUser> selectUserByUserNameList(@Param("names")List<String> names); |
| | | List<SysUser> selectUserByUserNameList(@Param("names") List<String> names); |
| | | // UserInfoVo userInfo(@Param("id") Long userId); |
| | | |
| | | SysUser selectByPhone(@Param("phoneNumber") String phoneNumber); |
| | |
| | | |
| | | Long getUserRole(@Param("userId") Long userId); |
| | | |
| | | int updateUserIfBlack(@Param("ids")List<Long> ids); |
| | | int updateUserIfBlack(@Param("ids") List<Long> ids); |
| | | |
| | | List<SysUser> selectAllList(); |
| | | |
| | | List<SysUserVO> pageList(@Param("query")SysUserQuery query, @Param("pageInfo")PageInfo<SysUserVO> pageInfo); |
| | | Page<SysUserVO> pageList(@Param("query") SysUserQuery query, |
| | | @Param("page") Page<SysUserVO> page); |
| | | |
| | | void updatePassword(@Param("id") Long id,@Param("s") String s); |
| | | void updatePassword(@Param("id") Long id, @Param("s") String s); |
| | | |
| | | long selectIdByPhone(@Param("phoneNumber") String phoneNumber); |
| | | |
New file |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | |
| | | /** |
| | | * <p> |
| | | * 大屏得分表 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-04-15 |
| | | */ |
| | | public interface TbDataScreenScoreMapper extends BaseMapper<TbDataScreenScore> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.TbOperLog; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-04-15 |
| | | */ |
| | | public interface TbOperLogMapper extends BaseMapper<TbOperLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/15 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "操作日志分页条件查询对象") |
| | | public class OperLogQuery extends BasePage { |
| | | |
| | | private static final long serialVersionUID = -3262552094044952596L; |
| | | |
| | | @ApiModelProperty(value = "员工姓名") |
| | | private String staffName; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String phoneNumber; |
| | | |
| | | @ApiModelProperty(value = "所属部门") |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty(value = "修改时间-开始") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "修改时间-结束") |
| | | private String endTime; |
| | | |
| | | } |
| | |
| | | private static final long serialVersionUID = 3174324251882921880L; |
| | | |
| | | @ApiModelProperty(value = "姓名") |
| | | private String nickName; |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "角色id") |
| | | private Integer roleId; |
| | |
| | | * @return 结果 |
| | | */ |
| | | public int editRole(SysRoleDTO dto); |
| | | |
| | | List<SysMenu> getMenuByRoleId(Long roleId); |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.query.SysUserQuery; |
| | | import com.ruoyi.system.vo.SysUserVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 用户 业务层 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface ISysUserService extends IService<SysUser> |
| | | { |
| | | public interface ISysUserService extends IService<SysUser> { |
| | | |
| | | /** |
| | | * 根据条件分页查询用户列表 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据条件分页查询已分配用户角色列表 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据条件分页查询未分配用户角色列表 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 通过用户名查询用户 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @return 用户对象信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 通过用户ID查询用户 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 用户对象信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据用户ID查询用户所属角色组 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据用户ID查询用户所属岗位组 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 校验用户名称是否唯一 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 校验用户是否允许操作 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | */ |
| | | public void checkUserAllowed(SysUser user); |
| | | |
| | | /** |
| | | * 校验用户是否有数据权限 |
| | | * |
| | | * |
| | | * @param userId 用户id |
| | | */ |
| | | public void checkUserDataScope(Long userId); |
| | | |
| | | /** |
| | | * 新增用户信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 注册用户信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 用户授权角色 |
| | | * |
| | | * @param userId 用户ID |
| | | * |
| | | * @param userId 用户ID |
| | | * @param roleIds 角色组 |
| | | */ |
| | | public void insertUserAuth(Long userId, Long[] roleIds); |
| | | |
| | | /** |
| | | * 修改用户状态 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改用户基本信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改用户头像 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @param avatar 头像地址 |
| | | * @param avatar 头像地址 |
| | | * @return 结果 |
| | | */ |
| | | public boolean updateUserAvatar(String userName, String avatar); |
| | | |
| | | /** |
| | | * 重置用户密码 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 重置用户密码 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @param password 密码 |
| | | * @return 结果 |
| | |
| | | |
| | | /** |
| | | * 通过用户ID删除用户 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 批量删除用户信息 |
| | | * |
| | | * |
| | | * @param userIds 需要删除的用户ID |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 导入用户数据 |
| | | * |
| | | * @param userList 用户数据列表 |
| | | * |
| | | * @param userList 用户数据列表 |
| | | * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 |
| | | * @param operName 操作用户 |
| | | * @param operName 操作用户 |
| | | * @return 结果 |
| | | */ |
| | | public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); |
| | |
| | | |
| | | /** |
| | | * 获取用户黑名单列表 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | |
| | | |
| | | List<SysUser> selectListByNamePhone(String name); |
| | | |
| | | |
| | | // UserInfoVo userInfo(Long userId); |
| | | |
| | | SysUser selectByPhone(String phoneNumber); |
| | | |
| | | /** |
| | | * 通过名字集合查询用户 |
| | | * |
| | | * @param names |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询所有用户(包含删除的) |
| | | * |
| | | * @return |
| | | */ |
| | | List<SysUser> selectAllList(); |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<SysUserVO> pageList(SysUserQuery query); |
| | | PageDTO<SysUserVO> pageList(SysUserQuery query); |
| | | |
| | | void updatePassword(Long id, String s); |
| | | |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.system.domain.TbDataScreenConfig; |
| | | import com.ruoyi.system.dto.update.DataIndicatorsUpdDTO; |
| | | import com.ruoyi.system.dto.update.FormalIndicatorsUpdDTO; |
| | | import com.ruoyi.system.dto.update.RiskLevelUpdDTO; |
| | | import com.ruoyi.system.query.DataScreenConfigQuery; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import java.util.List; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | DataScreenConfigVO editRiskLevel(RiskLevelUpdDTO dto); |
| | | |
| | | List<DataScreenConfigVO> getIndicatorsConfig(DataScreenConfigQuery query); |
| | | List<DataScreenConfigVO> getIndicatorsConfig(@NotNull DataScreenConfigEnum type); |
| | | |
| | | DataScreenConfigVO editDataIndicatorsConfig(DataIndicatorsUpdDTO dto); |
| | | |
New file |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | |
| | | /** |
| | | * <p> |
| | | * 大屏得分表 服务类 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-04-15 |
| | | */ |
| | | public interface TbDataScreenScoreService extends IService<TbDataScreenScore> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.system.domain.TbOperLog; |
| | | import com.ruoyi.system.query.OperLogQuery; |
| | | import com.ruoyi.system.vo.OperLogVO; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-04-15 |
| | | */ |
| | | public interface TbOperLogService extends IService<TbOperLog> { |
| | | |
| | | PageDTO<OperLogVO> queryPage(OperLogQuery query); |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.ruoyi.common.annotation.DataScope; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.TreeSelect; |
| | |
| | | import com.ruoyi.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMapper; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 部门管理 服务实现 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysDeptServiceImpl implements ISysDeptService |
| | | { |
| | | public class SysDeptServiceImpl implements ISysDeptService { |
| | | |
| | | @Autowired |
| | | private SysDeptMapper deptMapper; |
| | | |
| | |
| | | |
| | | /** |
| | | * 查询部门管理数据 |
| | | * |
| | | * |
| | | * @param dept 部门信息 |
| | | * @return 部门信息集合 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d") |
| | | public List<SysDept> selectDeptList(SysDept dept) |
| | | { |
| | | public List<SysDept> selectDeptList(SysDept dept) { |
| | | return deptMapper.selectDeptList(dept); |
| | | } |
| | | |
| | | /** |
| | | * 查询部门树结构信息 |
| | | * |
| | | * |
| | | * @param dept 部门信息 |
| | | * @return 部门树信息集合 |
| | | */ |
| | | @Override |
| | | public List<TreeSelect> selectDeptTreeList(SysDept dept) |
| | | { |
| | | public List<TreeSelect> selectDeptTreeList(SysDept dept) { |
| | | List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept); |
| | | return buildDeptTreeSelect(depts); |
| | | } |
| | | |
| | | /** |
| | | * 构建前端所需要树结构 |
| | | * |
| | | * |
| | | * @param depts 部门列表 |
| | | * @return 树结构列表 |
| | | */ |
| | | @Override |
| | | public List<SysDept> buildDeptTree(List<SysDept> depts) |
| | | { |
| | | public List<SysDept> buildDeptTree(List<SysDept> depts) { |
| | | List<SysDept> returnList = new ArrayList<SysDept>(); |
| | | List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList()); |
| | | for (SysDept dept : depts) |
| | | { |
| | | for (SysDept dept : depts) { |
| | | // 如果是顶级节点, 遍历该父节点的所有子节点 |
| | | if (!tempList.contains(dept.getParentId())) |
| | | { |
| | | if (!tempList.contains(dept.getParentId())) { |
| | | recursionFn(depts, dept); |
| | | returnList.add(dept); |
| | | } |
| | | } |
| | | if (returnList.isEmpty()) |
| | | { |
| | | if (returnList.isEmpty()) { |
| | | returnList = depts; |
| | | } |
| | | return returnList; |
| | |
| | | |
| | | /** |
| | | * 构建前端所需要下拉树结构 |
| | | * |
| | | * |
| | | * @param depts 部门列表 |
| | | * @return 下拉树结构列表 |
| | | */ |
| | | @Override |
| | | public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) |
| | | { |
| | | public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) { |
| | | List<SysDept> deptTrees = buildDeptTree(depts); |
| | | return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * 根据角色ID查询部门树信息 |
| | | * |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 选中部门列表 |
| | | */ |
| | | @Override |
| | | public List<Long> selectDeptListByRoleId(Long roleId) |
| | | { |
| | | public List<Long> selectDeptListByRoleId(Long roleId) { |
| | | SysRole role = roleMapper.selectRoleById(roleId); |
| | | return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly()); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门ID查询信息 |
| | | * |
| | | * |
| | | * @param deptId 部门ID |
| | | * @return 部门信息 |
| | | */ |
| | | @Override |
| | | public SysDept selectDeptById(Long deptId) |
| | | { |
| | | public SysDept selectDeptById(Long deptId) { |
| | | return deptMapper.selectDeptById(deptId); |
| | | } |
| | | |
| | | /** |
| | | * 根据ID查询所有子部门(正常状态) |
| | | * |
| | | * |
| | | * @param deptId 部门ID |
| | | * @return 子部门数 |
| | | */ |
| | | @Override |
| | | public int selectNormalChildrenDeptById(Long deptId) |
| | | { |
| | | public int selectNormalChildrenDeptById(Long deptId) { |
| | | return deptMapper.selectNormalChildrenDeptById(deptId); |
| | | } |
| | | |
| | | /** |
| | | * 是否存在子节点 |
| | | * |
| | | * |
| | | * @param deptId 部门ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean hasChildByDeptId(Long deptId) |
| | | { |
| | | public boolean hasChildByDeptId(Long deptId) { |
| | | int result = deptMapper.hasChildByDeptId(deptId); |
| | | return result > 0; |
| | | } |
| | | |
| | | /** |
| | | * 查询部门是否存在用户 |
| | | * |
| | | * |
| | | * @param deptId 部门ID |
| | | * @return 结果 true 存在 false 不存在 |
| | | */ |
| | | @Override |
| | | public boolean checkDeptExistUser(Long deptId) |
| | | { |
| | | public boolean checkDeptExistUser(Long deptId) { |
| | | int result = deptMapper.checkDeptExistUser(deptId); |
| | | return result > 0; |
| | | } |
| | | |
| | | /** |
| | | * 校验部门名称是否唯一 |
| | | * |
| | | * |
| | | * @param dept 部门信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkDeptNameUnique(SysDept dept) |
| | | { |
| | | public boolean checkDeptNameUnique(SysDept dept) { |
| | | Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); |
| | | SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); |
| | | if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) |
| | | { |
| | | if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | |
| | | |
| | | /** |
| | | * 校验部门是否有数据权限 |
| | | * |
| | | * |
| | | * @param deptId 部门id |
| | | */ |
| | | @Override |
| | | public void checkDeptDataScope(Long deptId) |
| | | { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) |
| | | { |
| | | public void checkDeptDataScope(Long deptId) { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) { |
| | | SysDept dept = new SysDept(); |
| | | dept.setDeptId(deptId); |
| | | List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept); |
| | | if (StringUtils.isEmpty(depts)) |
| | | { |
| | | if (StringUtils.isEmpty(depts)) { |
| | | throw new ServiceException("没有权限访问部门数据!"); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 新增保存部门信息 |
| | | * |
| | | * |
| | | * @param dept 部门信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertDept(SysDept dept) |
| | | { |
| | | public int insertDept(SysDept dept) { |
| | | SysDept info = deptMapper.selectDeptById(dept.getParentId()); |
| | | // 如果父节点不为正常状态,则不允许新增子节点 |
| | | if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) |
| | | { |
| | | if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) { |
| | | throw new ServiceException("部门停用,不允许新增"); |
| | | } |
| | | dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); |
| | |
| | | |
| | | /** |
| | | * 修改保存部门信息 |
| | | * |
| | | * |
| | | * @param dept 部门信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateDept(SysDept dept) |
| | | { |
| | | public int updateDept(SysDept dept) { |
| | | SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId()); |
| | | SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId()); |
| | | if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) |
| | | { |
| | | if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) { |
| | | String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); |
| | | String oldAncestors = oldDept.getAncestors(); |
| | | dept.setAncestors(newAncestors); |
| | | updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); |
| | | } |
| | | int result = deptMapper.updateDept(dept); |
| | | if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) |
| | | && !StringUtils.equals("0", dept.getAncestors())) |
| | | { |
| | | if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty( |
| | | dept.getAncestors()) |
| | | && !StringUtils.equals("0", dept.getAncestors())) { |
| | | // 如果该部门是启用状态,则启用该部门的所有上级部门 |
| | | updateParentDeptStatusNormal(dept); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 修改该部门的父级部门状态 |
| | | * |
| | | * |
| | | * @param dept 当前部门 |
| | | */ |
| | | private void updateParentDeptStatusNormal(SysDept dept) |
| | | { |
| | | private void updateParentDeptStatusNormal(SysDept dept) { |
| | | String ancestors = dept.getAncestors(); |
| | | Long[] deptIds = Convert.toLongArray(ancestors); |
| | | deptMapper.updateDeptStatusNormal(deptIds); |
| | |
| | | |
| | | /** |
| | | * 修改子元素关系 |
| | | * |
| | | * @param deptId 被修改的部门ID |
| | | * |
| | | * @param deptId 被修改的部门ID |
| | | * @param newAncestors 新的父ID集合 |
| | | * @param oldAncestors 旧的父ID集合 |
| | | */ |
| | | public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) |
| | | { |
| | | public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) { |
| | | List<SysDept> children = deptMapper.selectChildrenDeptById(deptId); |
| | | for (SysDept child : children) |
| | | { |
| | | for (SysDept child : children) { |
| | | child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); |
| | | } |
| | | if (children.size() > 0) |
| | | { |
| | | if (children.size() > 0) { |
| | | deptMapper.updateDeptChildren(children); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除部门管理信息 |
| | | * |
| | | * |
| | | * @param deptId 部门ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteDeptById(Long deptId) |
| | | { |
| | | public int deleteDeptById(Long deptId) { |
| | | return deptMapper.deleteDeptById(deptId); |
| | | } |
| | | |
| | | /** |
| | | * 递归列表 |
| | | */ |
| | | private void recursionFn(List<SysDept> list, SysDept t) |
| | | { |
| | | private void recursionFn(List<SysDept> list, SysDept t) { |
| | | // 得到子节点列表 |
| | | List<SysDept> childList = getChildList(list, t); |
| | | t.setChildren(childList); |
| | | for (SysDept tChild : childList) |
| | | { |
| | | if (hasChild(list, tChild)) |
| | | { |
| | | for (SysDept tChild : childList) { |
| | | if (hasChild(list, tChild)) { |
| | | recursionFn(list, tChild); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 得到子节点列表 |
| | | */ |
| | | private List<SysDept> getChildList(List<SysDept> list, SysDept t) |
| | | { |
| | | private List<SysDept> getChildList(List<SysDept> list, SysDept t) { |
| | | List<SysDept> tlist = new ArrayList<SysDept>(); |
| | | Iterator<SysDept> it = list.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | while (it.hasNext()) { |
| | | SysDept n = (SysDept) it.next(); |
| | | if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) |
| | | { |
| | | if (StringUtils.isNotNull(n.getParentId()) |
| | | && n.getParentId().longValue() == t.getDeptId().longValue()) { |
| | | tlist.add(n); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 判断是否有子节点 |
| | | */ |
| | | private boolean hasChild(List<SysDept> list, SysDept t) |
| | | { |
| | | private boolean hasChild(List<SysDept> list, SysDept t) { |
| | | return getChildList(list, t).size() > 0; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.entity.SysMenu; |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysRoleServiceImpl implements ISysRoleService { |
| | | public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements |
| | | ISysRoleService { |
| | | |
| | | @Autowired |
| | | private SysRoleMapper roleMapper; |
| | |
| | | // 添加角色 |
| | | SysRole sysRole = new SysRole(); |
| | | sysRole.setRoleName(dto.getRoleName()); |
| | | sysRole.setRoleKey("admin"); |
| | | roleMapper.insertRole(sysRole); |
| | | |
| | | // 添加角色权限中间表 |
| | |
| | | |
| | | return roleMenuMapper.batchRoleMenu(sysRoleMenus); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysMenu> getMenuByRoleId(Long roleId) { |
| | | SysRole sysRole = roleMapper.selectRoleById(roleId); |
| | | // 获取当前角色的菜单列表 |
| | | List<SysMenu> menus = menuMapper.selectListByRoleId(sysRole.getRoleId()); |
| | | if (menus.size() == 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<Long> menusId = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList()); |
| | | // 获取当前的权限菜单(有层级) |
| | | return this.getMenuLevelList(menusId); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.annotation.DataScope; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | |
| | | import com.ruoyi.system.domain.SysPost; |
| | | import com.ruoyi.system.domain.SysUserPost; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | | import com.ruoyi.system.mapper.*; |
| | | import com.ruoyi.system.mapper.SysPostMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMapper; |
| | | import com.ruoyi.system.mapper.SysUserMapper; |
| | | import com.ruoyi.system.mapper.SysUserPostMapper; |
| | | import com.ruoyi.system.mapper.SysUserRoleMapper; |
| | | import com.ruoyi.system.query.SysUserQuery; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.vo.SysUserVO; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | import javax.validation.Validator; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.validation.Validator; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 用户 业务层处理 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService |
| | | { |
| | | public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements |
| | | ISysUserService { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); |
| | | |
| | | @Autowired |
| | |
| | | |
| | | /** |
| | | * 根据条件分页查询用户列表 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d", userAlias = "u") |
| | | public List<SysUser> selectUserList(SysUser user) |
| | | { |
| | | public List<SysUser> selectUserList(SysUser user) { |
| | | return userMapper.selectUserList(user); |
| | | } |
| | | |
| | | /** |
| | | * 根据条件分页查询已分配用户角色列表 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d", userAlias = "u") |
| | | public List<SysUser> selectAllocatedList(SysUser user) |
| | | { |
| | | public List<SysUser> selectAllocatedList(SysUser user) { |
| | | return userMapper.selectAllocatedList(user); |
| | | } |
| | | |
| | | /** |
| | | * 根据条件分页查询未分配用户角色列表 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 用户信息集合信息 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d", userAlias = "u") |
| | | public List<SysUser> selectUnallocatedList(SysUser user) |
| | | { |
| | | public List<SysUser> selectUnallocatedList(SysUser user) { |
| | | return userMapper.selectUnallocatedList(user); |
| | | } |
| | | |
| | | /** |
| | | * 通过用户名查询用户 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @return 用户对象信息 |
| | | */ |
| | | @Override |
| | | public SysUser selectUserByUserName(String userName) |
| | | { |
| | | public SysUser selectUserByUserName(String userName) { |
| | | return userMapper.selectUserByUserName(userName); |
| | | } |
| | | |
| | | /** |
| | | * 通过用户ID查询用户 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 用户对象信息 |
| | | */ |
| | | @Override |
| | | public SysUser selectUserById(Long userId) |
| | | { |
| | | public SysUser selectUserById(Long userId) { |
| | | return userMapper.selectUserById(userId); |
| | | } |
| | | |
| | | /** |
| | | * 查询用户所属角色组 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public String selectUserRoleGroup(String userName) |
| | | { |
| | | public String selectUserRoleGroup(String userName) { |
| | | List<SysRole> list = roleMapper.selectRolesByUserName(userName); |
| | | if (CollectionUtils.isEmpty(list)) |
| | | { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(",")); |
| | |
| | | |
| | | /** |
| | | * 查询用户所属岗位组 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public String selectUserPostGroup(String userName) |
| | | { |
| | | public String selectUserPostGroup(String userName) { |
| | | List<SysPost> list = postMapper.selectPostsByUserName(userName); |
| | | if (CollectionUtils.isEmpty(list)) |
| | | { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | return list.stream().map(SysPost::getPostName).collect(Collectors.joining(",")); |
| | |
| | | |
| | | /** |
| | | * 校验用户名称是否唯一 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkUserNameUnique(SysUser user) |
| | | { |
| | | public boolean checkUserNameUnique(SysUser user) { |
| | | Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); |
| | | SysUser info = userMapper.checkUserNameUnique(user.getUserName()); |
| | | if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) |
| | | { |
| | | if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean checkPhoneUnique(SysUser user) |
| | | { |
| | | public boolean checkPhoneUnique(SysUser user) { |
| | | Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); |
| | | SysUser info = userMapper.checkPhoneUnique(user.getPhoneNumber()); |
| | | if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) |
| | | { |
| | | if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean checkEmailUnique(SysUser user) |
| | | { |
| | | public boolean checkEmailUnique(SysUser user) { |
| | | Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); |
| | | SysUser info = userMapper.checkEmailUnique(user.getEmail()); |
| | | if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) |
| | | { |
| | | if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | |
| | | |
| | | /** |
| | | * 校验用户是否允许操作 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | */ |
| | | @Override |
| | | public void checkUserAllowed(SysUser user) |
| | | { |
| | | if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) |
| | | { |
| | | public void checkUserAllowed(SysUser user) { |
| | | if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) { |
| | | throw new ServiceException("不允许操作超级管理员用户"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验用户是否有数据权限 |
| | | * |
| | | * |
| | | * @param userId 用户id |
| | | */ |
| | | @Override |
| | | public void checkUserDataScope(Long userId) |
| | | { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) |
| | | { |
| | | public void checkUserDataScope(Long userId) { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) { |
| | | SysUser user = new SysUser(); |
| | | user.setUserId(userId); |
| | | List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user); |
| | | if (StringUtils.isEmpty(users)) |
| | | { |
| | | if (StringUtils.isEmpty(users)) { |
| | | throw new ServiceException("没有权限访问用户数据!"); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 新增保存用户信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int insertUser(SysUser user) |
| | | { |
| | | public int insertUser(SysUser user) { |
| | | // 新增用户信息 |
| | | int rows = userMapper.insertUser(user); |
| | | // 新增用户岗位关联 |
| | |
| | | |
| | | /** |
| | | * 注册用户信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean registerUser(SysUser user) |
| | | { |
| | | public boolean registerUser(SysUser user) { |
| | | return userMapper.insertUser(user) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 修改保存用户信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int updateUser(SysUser user) |
| | | { |
| | | public int updateUser(SysUser user) { |
| | | Long userId = user.getUserId(); |
| | | // 删除用户与角色关联 |
| | | // userRoleMapper.deleteUserRoleByUserId(userId); |
| | | userRoleMapper.deleteUserRoleByUserId(userId); |
| | | // 新增用户与角色管理 |
| | | insertUserRoleId(user); |
| | | // 删除用户与岗位关联 |
| | |
| | | |
| | | /** |
| | | * 用户授权角色 |
| | | * |
| | | * @param userId 用户ID |
| | | * |
| | | * @param userId 用户ID |
| | | * @param roleIds 角色组 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void insertUserAuth(Long userId, Long[] roleIds) |
| | | { |
| | | public void insertUserAuth(Long userId, Long[] roleIds) { |
| | | userRoleMapper.deleteUserRoleByUserId(userId); |
| | | insertUserRole(userId, roleIds); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户状态 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateUserStatus(SysUser user) |
| | | { |
| | | public int updateUserStatus(SysUser user) { |
| | | return userMapper.updateUser(user); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户基本信息 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateUserProfile(SysUser user) |
| | | { |
| | | public int updateUserProfile(SysUser user) { |
| | | return userMapper.updateUser(user); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户头像 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @param avatar 头像地址 |
| | | * @param avatar 头像地址 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean updateUserAvatar(String userName, String avatar) |
| | | { |
| | | public boolean updateUserAvatar(String userName, String avatar) { |
| | | return userMapper.updateUserAvatar(userName, avatar) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 重置用户密码 |
| | | * |
| | | * |
| | | * @param user 用户信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int resetPwd(SysUser user) |
| | | { |
| | | public int resetPwd(SysUser user) { |
| | | return userMapper.updateUser(user); |
| | | } |
| | | |
| | | /** |
| | | * 重置用户密码 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @param password 密码 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int resetUserPwd(String userName, String password) |
| | | { |
| | | public int resetUserPwd(String userName, String password) { |
| | | return userMapper.resetUserPwd(userName, password); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户角色信息 |
| | | * |
| | | * |
| | | * @param user 用户对象 |
| | | */ |
| | | public void insertUserRole(SysUser user) |
| | | { |
| | | public void insertUserRole(SysUser user) { |
| | | this.insertUserRole(user.getUserId(), user.getRoleIds()); |
| | | } |
| | | |
| | |
| | | * |
| | | * @param user 用户对象 |
| | | */ |
| | | public void insertUserRoleId(SysUser user) |
| | | { |
| | | public void insertUserRoleId(SysUser user) { |
| | | this.insertUserRoleId(user.getUserId(), user.getRoleId()); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户岗位信息 |
| | | * |
| | | * |
| | | * @param user 用户对象 |
| | | */ |
| | | public void insertUserPost(SysUser user) |
| | | { |
| | | public void insertUserPost(SysUser user) { |
| | | Long[] posts = user.getPostIds(); |
| | | if (StringUtils.isNotEmpty(posts)) |
| | | { |
| | | if (StringUtils.isNotEmpty(posts)) { |
| | | // 新增用户与岗位管理 |
| | | List<SysUserPost> list = new ArrayList<SysUserPost>(posts.length); |
| | | for (Long postId : posts) |
| | | { |
| | | for (Long postId : posts) { |
| | | SysUserPost up = new SysUserPost(); |
| | | up.setUserId(user.getUserId()); |
| | | up.setPostId(postId); |
| | |
| | | |
| | | /** |
| | | * 新增用户角色信息 |
| | | * |
| | | * @param userId 用户ID |
| | | * |
| | | * @param userId 用户ID |
| | | * @param roleIds 角色组 |
| | | */ |
| | | public void insertUserRole(Long userId, Long[] roleIds) |
| | | { |
| | | if (StringUtils.isNotEmpty(roleIds)) |
| | | { |
| | | public void insertUserRole(Long userId, Long[] roleIds) { |
| | | if (StringUtils.isNotEmpty(roleIds)) { |
| | | // 新增用户与角色管理 |
| | | List<SysUserRole> list = new ArrayList<SysUserRole>(roleIds.length); |
| | | for (Long roleId : roleIds) |
| | | { |
| | | for (Long roleId : roleIds) { |
| | | SysUserRole ur = new SysUserRole(); |
| | | ur.setUserId(userId); |
| | | ur.setRoleId(roleId); |
| | |
| | | * @param userId 用户ID |
| | | * @param roleId 角色组 |
| | | */ |
| | | public void insertUserRoleId(Long userId, Long roleId) |
| | | { |
| | | if (Objects.nonNull(userId) && Objects.nonNull(roleId)){ |
| | | public void insertUserRoleId(Long userId, Long roleId) { |
| | | if (Objects.nonNull(userId) && Objects.nonNull(roleId)) { |
| | | // 新增用户与角色管理 |
| | | SysUserRole ur = new SysUserRole(); |
| | | ur.setUserId(userId); |
| | |
| | | |
| | | /** |
| | | * 通过用户ID删除用户 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int deleteUserById(Long userId) |
| | | { |
| | | public int deleteUserById(Long userId) { |
| | | // 删除用户与角色关联 |
| | | userRoleMapper.deleteUserRoleByUserId(userId); |
| | | // 删除用户与岗位表 |
| | |
| | | |
| | | /** |
| | | * 批量删除用户信息 |
| | | * |
| | | * |
| | | * @param userIds 需要删除的用户ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int deleteUserByIds(List<Long> userIds) |
| | | { |
| | | for (Long userId : userIds) |
| | | { |
| | | public int deleteUserByIds(List<Long> userIds) { |
| | | for (Long userId : userIds) { |
| | | checkUserAllowed(new SysUser(userId)); |
| | | // checkUserDataScope(userId); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 导入用户数据 |
| | | * |
| | | * @param userList 用户数据列表 |
| | | * |
| | | * @param userList 用户数据列表 |
| | | * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 |
| | | * @param operName 操作用户 |
| | | * @param operName 操作用户 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) |
| | | { |
| | | if (StringUtils.isNull(userList) || userList.size() == 0) |
| | | { |
| | | public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) { |
| | | if (StringUtils.isNull(userList) || userList.size() == 0) { |
| | | throw new ServiceException("导入用户数据不能为空!"); |
| | | } |
| | | int successNum = 0; |
| | |
| | | StringBuilder successMsg = new StringBuilder(); |
| | | StringBuilder failureMsg = new StringBuilder(); |
| | | String password = configService.selectConfigByKey("sys.user.initPassword"); |
| | | for (SysUser user : userList) |
| | | { |
| | | try |
| | | { |
| | | for (SysUser user : userList) { |
| | | try { |
| | | // 验证是否存在这个用户 |
| | | SysUser u = userMapper.selectUserByUserName(user.getUserName()); |
| | | if (StringUtils.isNull(u)) |
| | | { |
| | | if (StringUtils.isNull(u)) { |
| | | BeanValidators.validateWithException(validator, user); |
| | | user.setPassword(SecurityUtils.encryptPassword(password)); |
| | | user.setCreateBy(operName); |
| | | userMapper.insertUser(user); |
| | | successNum++; |
| | | successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功"); |
| | | } |
| | | else if (isUpdateSupport) |
| | | { |
| | | successMsg.append( |
| | | "<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功"); |
| | | } else if (isUpdateSupport) { |
| | | BeanValidators.validateWithException(validator, user); |
| | | checkUserAllowed(u); |
| | | checkUserDataScope(u.getUserId()); |
| | |
| | | user.setUpdateBy(operName); |
| | | userMapper.updateUser(user); |
| | | successNum++; |
| | | successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功"); |
| | | } |
| | | else |
| | | { |
| | | successMsg.append( |
| | | "<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功"); |
| | | } else { |
| | | failureNum++; |
| | | failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在"); |
| | | failureMsg.append( |
| | | "<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在"); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | } catch (Exception e) { |
| | | failureNum++; |
| | | String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; |
| | | failureMsg.append(msg + e.getMessage()); |
| | | log.error(msg, e); |
| | | } |
| | | } |
| | | if (failureNum > 0) |
| | | { |
| | | failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); |
| | | if (failureNum > 0) { |
| | | failureMsg.insert(0, |
| | | "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); |
| | | throw new ServiceException(failureMsg.toString()); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); |
| | | } |
| | | return successMsg.toString(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<SysUserVO> pageList(SysUserQuery query) { |
| | | PageInfo<SysUserVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<SysUserVO> list = userMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | public PageDTO<SysUserVO> pageList(SysUserQuery query) { |
| | | Page<SysUserVO> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | Page<SysUserVO> pageVO = userMapper.pageList(query, page); |
| | | return PageDTO.of(pageVO); |
| | | } |
| | | |
| | | @Override |
| | | public void updatePassword(Long id, String s) { |
| | | userMapper.updatePassword(id,s); |
| | | userMapper.updatePassword(id, s); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.write.metadata.WriteSheet; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.CalculateTypeEnum; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.enums.ReportingStatusEnum; |
| | | import com.ruoyi.common.enums.ShowStatusEnum; |
| | | import com.ruoyi.common.enums.UserTypeEnum; |
| | | import com.ruoyi.common.enums.ValueTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.common.utils.CalculateUtil; |
| | |
| | | import com.ruoyi.system.domain.TbBasicDataConfig; |
| | | import com.ruoyi.system.domain.TbBasicDataConfigDetail; |
| | | import com.ruoyi.system.domain.TbBasicDataField; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | import com.ruoyi.system.domain.TbDept; |
| | | import com.ruoyi.system.domain.TbField; |
| | | import com.ruoyi.system.domain.TbOperLog; |
| | | import com.ruoyi.system.domain.TbScore; |
| | | import com.ruoyi.system.dto.BasicDataDTO; |
| | | import com.ruoyi.system.dto.BasicDataFieldDTO; |
| | | import com.ruoyi.system.dto.CalculateItemDTO; |
| | | import com.ruoyi.system.handler.CustomCellWriteHandler; |
| | | import com.ruoyi.system.listener.BasicDataListener; |
| | | import com.ruoyi.system.listener.HistoryDataListener; |
| | |
| | | import com.ruoyi.system.service.TbBasicDataConfigService; |
| | | import com.ruoyi.system.service.TbBasicDataFieldService; |
| | | import com.ruoyi.system.service.TbBasicDataService; |
| | | import com.ruoyi.system.service.TbDataScreenConfigService; |
| | | import com.ruoyi.system.service.TbDataScreenScoreService; |
| | | import com.ruoyi.system.service.TbFieldService; |
| | | import com.ruoyi.system.service.TbOperLogService; |
| | | import com.ruoyi.system.service.TbScoreService; |
| | | import com.ruoyi.system.utils.FieldBuildUtil; |
| | | import com.ruoyi.system.vo.BasicDataReportingVO; |
| | | import com.ruoyi.system.vo.CurrentFieldsAllVO; |
| | | import com.ruoyi.system.vo.CurrentFieldsDetailVO; |
| | | import com.ruoyi.system.vo.CurrentFieldsVO; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import com.ruoyi.system.vo.FieldsTreeVO; |
| | | import com.ruoyi.system.vo.ScoreCalculateVO; |
| | | import com.ruoyi.system.vo.ScoreVO; |
| | |
| | | import java.time.ZoneId; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | private final TbBasicDataConfigDetailService tbBasicDataConfigDetailService; |
| | | private final TbScoreService tbScoreService; |
| | | private final ISysUserService sysUserService; |
| | | private final TbOperLogService tbOperLogService; |
| | | private final TbDataScreenScoreService tbDataScreenScoreService; |
| | | private final TbDataScreenConfigService tbDataScreenConfigService; |
| | | |
| | | public static void setFieldValues( |
| | | List<FieldsTreeVO> fields, Map<Long, TbBasicDataField> fieldMap) { |
| | |
| | | return; |
| | | } |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | TbBasicData tbBasicData = BeanUtils.copyBean(dto, TbBasicData.class); |
| | | tbBasicData.setDeptAreaCode(areaCode); |
| | | tbBasicData.setStatus(ReportingStatusEnum.MISSING_DATA); |
| | | tbBasicData.setQuarter(nowQuarter); |
| | | tbBasicData.setReportingTime(DateUtils.getQuarterDate(nowQuarter)); |
| | | this.saveOrUpdate(tbBasicData); |
| | | // 保存基础数据动态字段数据 |
| | | List<TbBasicDataField> tbBasicDataFields = |
| | | BeanUtils.copyList(dto.getFields(), TbBasicDataField.class); |
| | | // 查询需要填写的动态字段 |
| | | List<TbField> fieldList = |
| | | tbFieldService.lambdaQuery().eq(TbField::getStatus, ShowStatusEnum.SHOW).list(); |
| | | Map<Long, TbField> fieldMap = |
| | | fieldList.stream().collect(Collectors.toMap(TbField::getId, e -> e)); |
| | | Optional<TbBasicData> basicDataOpt = this.lambdaQuery() |
| | | .eq(TbBasicData::getDeptAreaCode, areaCode) |
| | | .eq(TbBasicData::getQuarter, nowQuarter).oneOpt(); |
| | | TbBasicData tbBasicData = BeanUtils.copyBean(dto, TbBasicData.class); |
| | | if (basicDataOpt.isPresent()) { |
| | | tbBasicData.setId(basicDataOpt.get().getId()); |
| | | this.updateById(tbBasicData); |
| | | //查询该基础数据的动态字端 |
| | | List<TbBasicDataField> originFields = tbBasicDataFieldService.lambdaQuery() |
| | | .eq(TbBasicDataField::getBasicDataId, tbBasicData.getId()).list(); |
| | | CompletableFuture.runAsync( |
| | | () -> saveExchangeLog(loginUser, basicDataOpt.get(), originFields, dto, |
| | | fieldMap)); |
| | | } else { |
| | | tbBasicData.setDeptAreaCode(areaCode); |
| | | tbBasicData.setStatus(ReportingStatusEnum.MISSING_DATA); |
| | | tbBasicData.setQuarter(nowQuarter); |
| | | tbBasicData.setReportingTime(DateUtils.getQuarterDate(nowQuarter)); |
| | | this.save(tbBasicData); |
| | | } |
| | | // 保存基础数据动态字段数据 |
| | | List<TbBasicDataField> tbBasicDataFields = |
| | | BeanUtils.copyList(dto.getFields(), TbBasicDataField.class); |
| | | |
| | | tbBasicDataFields.forEach( |
| | | item -> { |
| | | item.setBasicDataId(tbBasicData.getId()); |
| | |
| | | this.updateById(tbBasicData); |
| | | } |
| | | if (ReportingStatusEnum.FILLED.equals(tbBasicData.getStatus())) { |
| | | calculateScore(tbBasicData); |
| | | calculateScore(tbBasicData, tbBasicDataFields); |
| | | CompletableFuture.runAsync(() -> calculateScreenScore(tbBasicData, tbBasicDataFields)); |
| | | } |
| | | } |
| | | |
| | | private void calculateScreenScore(TbBasicData tbBasicData, |
| | | List<TbBasicDataField> tbBasicDataFields) { |
| | | Map<Long, TbBasicDataField> basicDataFieldMap = tbBasicDataFields.stream() |
| | | .collect(Collectors.toMap(TbBasicDataField::getFieldId, e -> e)); |
| | | DataScreenConfigVO riskLevel = tbDataScreenConfigService.getRiskLevel(); |
| | | List<DataScreenConfigVO> dataIndicatorsConfig = tbDataScreenConfigService.getIndicatorsConfig( |
| | | DataScreenConfigEnum.DATA_INDICATORS); |
| | | List<DataScreenConfigVO> formalIndicatorsConfig = tbDataScreenConfigService.getIndicatorsConfig( |
| | | DataScreenConfigEnum.FORMAL_INDICATORS); |
| | | handleScoreCalculate(tbBasicData, riskLevel, basicDataFieldMap); |
| | | for (DataScreenConfigVO config : dataIndicatorsConfig) { |
| | | handleScoreCalculate(tbBasicData, config, basicDataFieldMap); |
| | | } |
| | | for (DataScreenConfigVO config : formalIndicatorsConfig) { |
| | | handleScoreCalculate(tbBasicData, config, basicDataFieldMap); |
| | | } |
| | | } |
| | | |
| | | private void handleScoreCalculate(TbBasicData tbBasicData, DataScreenConfigVO riskLevel, |
| | | Map<Long, TbBasicDataField> basicDataFieldMap) { |
| | | List<CalculateItemDTO> scoreCalculateList = riskLevel.getScoreCalculateList(); |
| | | for (CalculateItemDTO item : scoreCalculateList) { |
| | | if (item.getValueType().equals(ValueTypeEnum.FIELD)) { |
| | | TbBasicDataField basicDataField = basicDataFieldMap.get( |
| | | Long.valueOf(item.getContent())); |
| | | if (Objects.nonNull(basicDataField)) { |
| | | item.setContent(basicDataField.getFieldValue()); |
| | | } |
| | | } |
| | | } |
| | | String calculateFormulaStr = scoreCalculateList.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double score = CalculateUtil.calculate(calculateFormulaStr); |
| | | TbDataScreenScore tbDataScreenScore = new TbDataScreenScore(); |
| | | tbDataScreenScore.setDataScreenConfigId(riskLevel.getId()); |
| | | tbDataScreenScore.setDataScreenConfigId(riskLevel.getId()); |
| | | tbDataScreenScore.setDeptAreaCode(tbBasicData.getDeptAreaCode()); |
| | | tbDataScreenScore.setScore(score); |
| | | tbDataScreenScoreService.save(tbDataScreenScore); |
| | | } |
| | | |
| | | private void saveExchangeLog(LoginUser loginUser, TbBasicData tbBasicData, |
| | | List<TbBasicDataField> originFields, |
| | | BasicDataDTO dto, Map<Long, TbField> fieldMap) { |
| | | List<TbOperLog> tbOperlogList = new ArrayList<>(); |
| | | String transferPaymentScale = tbBasicData.getTransferPaymentScale(); |
| | | String currentGdp = tbBasicData.getCurrentGdp(); |
| | | String remark = tbBasicData.getRemark(); |
| | | String transferPaymentScaleEdit = dto.getTransferPaymentScale(); |
| | | String currentGdpEdit = dto.getCurrentGdp(); |
| | | String remarkEdit = dto.getRemark(); |
| | | if (!transferPaymentScale.equals(transferPaymentScaleEdit)) { |
| | | wrapOperLog(loginUser, tbBasicData, transferPaymentScale, transferPaymentScaleEdit, |
| | | tbOperlogList, "转移支付规模"); |
| | | } |
| | | if (!currentGdp.equals(currentGdpEdit)) { |
| | | wrapOperLog(loginUser, tbBasicData, currentGdp, currentGdpEdit, tbOperlogList, |
| | | "当期GDP"); |
| | | } |
| | | if (!remark.equals(remarkEdit)) { |
| | | wrapOperLog(loginUser, tbBasicData, remark, remarkEdit, tbOperlogList, "备注"); |
| | | } |
| | | Map<Long, TbBasicDataField> basicDataFieldMap = originFields.stream() |
| | | .collect(Collectors.toMap(TbBasicDataField::getFieldId, e -> e)); |
| | | for (BasicDataFieldDTO field : dto.getFields()) { |
| | | TbBasicDataField tbBasicDataField = basicDataFieldMap.get(field.getFieldId()); |
| | | TbField tbField = fieldMap.get(field.getFieldId()); |
| | | if (Objects.nonNull(tbBasicDataField) && Objects.nonNull(tbField) |
| | | && !tbBasicDataField.getFieldValue().equals(field.getFieldValue())) { |
| | | String levelOneCategory = tbField.getLevelOneCategory(); |
| | | String levelTwoCategory = tbField.getLevelTwoCategory(); |
| | | String levelThreeCategory = tbField.getLevelThreeCategory(); |
| | | String fieldName = tbField.getFieldName(); |
| | | StringBuilder result = new StringBuilder(); |
| | | result.append(levelOneCategory).append("-"); |
| | | if (StringUtils.isNotBlank(levelTwoCategory)) { |
| | | result.append(levelTwoCategory).append("-"); |
| | | if (StringUtils.isNotBlank(levelThreeCategory)) { |
| | | result.append(levelThreeCategory).append("-").append(fieldName); |
| | | } else { |
| | | result.append(fieldName); |
| | | } |
| | | } else { |
| | | result.append(field); |
| | | } |
| | | wrapOperLog(loginUser, tbBasicData, tbBasicDataField.getFieldValue(), |
| | | field.getFieldValue(), tbOperlogList, result.toString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private static void wrapOperLog(LoginUser loginUser, TbBasicData tbBasicData, String before, |
| | | String after, List<TbOperLog> tbOperlogList, String fieldName) { |
| | | TbOperLog tbOperLog = new TbOperLog(); |
| | | tbOperLog.setOperation(tbBasicData.getQuarter()); |
| | | tbOperLog.setStaffName(loginUser.getUser().getNickName()); |
| | | tbOperLog.setAreaName(loginUser.getUser().getAreaName()); |
| | | tbOperLog.setFieldName(fieldName); |
| | | tbOperLog.setBusinessType(BusinessType.UPDBASICDATA.ordinal()); |
| | | tbOperLog.setBeforeEdit(before); |
| | | tbOperLog.setAfterEdit(after); |
| | | tbOperlogList.add(tbOperLog); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importBasicData(MultipartFile file) throws Exception { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String areaCode = loginUser.getUser().getAreaCode(); |
| | |
| | | .doRead(); |
| | | } |
| | | |
| | | private void calculateScore(TbBasicData tbBasicData) { |
| | | private void calculateScore(TbBasicData tbBasicData, List<TbBasicDataField> fields) { |
| | | // 计算得分 |
| | | List<TbBasicDataConfig> list = |
| | | tbBasicDataConfigService |
| | | .lambdaQuery() |
| | | .eq(TbBasicDataConfig::getStatus, ShowStatusEnum.SHOW) |
| | | .list(); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | if (CollUtils.isEmpty(list)) { |
| | | throw new ServiceException("计算得分失败,平台未配置得分计算规则"); |
| | | } |
| | | List<TbBasicDataConfig> numCalculates = |
| | |
| | | list.stream() |
| | | .filter(item -> !CalculateTypeEnum.NUMBER.equals(item.getCalculateType())) |
| | | .collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(numCalculates)) { |
| | | numCalculates.forEach( |
| | | item -> { |
| | | Map<String, Object> valueMap = new HashMap<>(); |
| | | String numberCalculateFormula = item.getNumberCalculateFormula(); |
| | | Map<String, Integer> fieldsAndValue = |
| | | CalculateUtil.getFieldsAndValue(numberCalculateFormula); |
| | | for (Map.Entry<String, Integer> stringIntegerEntry : fieldsAndValue.entrySet()) { |
| | | Optional<TbBasicDataField> tbBasicDataField = |
| | | tbBasicDataFieldService |
| | | .lambdaQuery() |
| | | .eq(TbBasicDataField::getBasicDataId, |
| | | tbBasicData.getId()) |
| | | .eq(TbBasicDataField::getFieldId, |
| | | stringIntegerEntry.getValue()) |
| | | .oneOpt(); |
| | | tbBasicDataField.ifPresent( |
| | | basicDataField -> |
| | | valueMap.put(stringIntegerEntry.getKey(), |
| | | basicDataField.getFieldValue())); |
| | | Map<Long, TbBasicDataField> basicDataFieldMap = fields.stream() |
| | | .collect(Collectors.toMap(TbBasicDataField::getFieldId, e -> e)); |
| | | if (CollUtils.isNotEmpty(numCalculates)) { |
| | | for (TbBasicDataConfig item : numCalculates) { |
| | | String numberCalculateFormula = item.getNumberCalculateFormula(); |
| | | List<CalculateItemDTO> calculateItemDTOS = JSONArray.parseArray( |
| | | numberCalculateFormula, CalculateItemDTO.class); |
| | | for (CalculateItemDTO dto : calculateItemDTOS) { |
| | | if (ValueTypeEnum.FIELD.equals(dto.getValueType())) { |
| | | TbBasicDataField tbBasicDataField = basicDataFieldMap.get( |
| | | Long.valueOf(dto.getContent())); |
| | | if (Objects.nonNull(tbBasicDataField)) { |
| | | dto.setContent(tbBasicDataField.getFieldValue()); |
| | | } |
| | | double score = CalculateUtil.calculate(numberCalculateFormula, valueMap); |
| | | TbScore tbScore = new TbScore(); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(score); |
| | | tbScore.setBasicDataConfigId(item.getId()); |
| | | tbScoreService.save(tbScore); |
| | | }); |
| | | } |
| | | } |
| | | String numberCalculateFormulaStr = calculateItemDTOS.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double score = CalculateUtil.calculate(numberCalculateFormulaStr); |
| | | TbScore tbScore = new TbScore(); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(score); |
| | | tbScore.setBasicDataConfigId(item.getId()); |
| | | tbScoreService.save(tbScore); |
| | | } |
| | | } |
| | | if (CollectionUtils.isNotEmpty(textAndPercentages)) { |
| | | if (CollUtils.isNotEmpty(textAndPercentages)) { |
| | | for (TbBasicDataConfig textAndPercentage : textAndPercentages) { |
| | | TbScore tbScore = new TbScore(); |
| | | List<TbBasicDataConfigDetail> details = |
| | |
| | | Collectors.toMap( |
| | | TbBasicDataConfigDetail::getKey, |
| | | TbBasicDataConfigDetail::getValue)); |
| | | if (CollectionUtils.isNotEmpty(details)) { |
| | | Optional<TbBasicDataField> tbBasicDataFieldOptional = |
| | | tbBasicDataFieldService |
| | | .lambdaQuery() |
| | | .eq(TbBasicDataField::getBasicDataId, tbBasicData.getId()) |
| | | .eq(TbBasicDataField::getFieldId, |
| | | textAndPercentage.getFieldIdStr()) |
| | | .oneOpt(); |
| | | if (tbBasicDataFieldOptional.isPresent()) { |
| | | TbBasicDataField tbBasicDataField = tbBasicDataFieldOptional.get(); |
| | | if (CollUtils.isNotEmpty(details)) { |
| | | TbBasicDataField textAndPercentageData = basicDataFieldMap.get( |
| | | Long.valueOf(textAndPercentage.getFieldIdStr())); |
| | | if (Objects.nonNull(textAndPercentageData)) { |
| | | if (CalculateTypeEnum.TEXT.equals(textAndPercentage.getCalculateType())) { |
| | | String score = scoreMap.get(tbBasicDataField.getFieldValue()); |
| | | String score = scoreMap.get(textAndPercentageData.getFieldValue()); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(Double.parseDouble(score)); |
| | | tbScore.setBasicDataConfigId(textAndPercentage.getId()); |
| | |
| | | textAndPercentage.getCalculateType())) { |
| | | for (Map.Entry<String, String> stringStringEntry : scoreMap.entrySet()) { |
| | | String[] split = stringStringEntry.getKey().split("-"); |
| | | double v = Double.parseDouble(tbBasicDataField.getFieldValue()); |
| | | double v = Double.parseDouble( |
| | | textAndPercentageData.getFieldValue()); |
| | | double min = Double.parseDouble(split[0]); |
| | | double max = Double.parseDouble(split[1]); |
| | | if (v >= min && v <= max) { |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.common.utils.CalculateUtil; |
| | | import com.ruoyi.common.utils.Checker; |
| | | import com.ruoyi.common.utils.CollUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.TbDataScreenConfig; |
| | | import com.ruoyi.system.dto.CalculateItemDTO; |
| | | import com.ruoyi.system.dto.update.DataIndicatorsUpdDTO; |
| | | import com.ruoyi.system.dto.update.FormalIndicatorsUpdDTO; |
| | | import com.ruoyi.system.dto.update.RiskLevelUpdDTO; |
| | | import com.ruoyi.system.mapper.TbDataScreenConfigMapper; |
| | | import com.ruoyi.system.query.DataScreenConfigQuery; |
| | | import com.ruoyi.system.service.TbDataScreenConfigService; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.IntStream; |
| | | import javax.validation.constraints.NotNull; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.RISK_LEVEL) |
| | | .one(); |
| | | return Objects.nonNull(tbDataScreenConfig) ? BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class) : new DataScreenConfigVO(); |
| | | if (Objects.isNull(tbDataScreenConfig)) { |
| | | return new DataScreenConfigVO(); |
| | | } |
| | | DataScreenConfigVO vo = BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class); |
| | | List<CalculateItemDTO> scoreCalculateList = JSONArray.parseArray( |
| | | tbDataScreenConfig.getCalculateFormula(), |
| | | CalculateItemDTO.class); |
| | | vo.setScoreCalculateList(scoreCalculateList); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public DataScreenConfigVO editRiskLevel(RiskLevelUpdDTO dto) { |
| | | if (dto.areRiskLevelsDistinct()) { |
| | | throw new ServiceException("得分范围不能重叠"); |
| | | } |
| | | //查询是否有该指标配置 |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.RISK_LEVEL) |
| | | .oneOpt().orElseGet(() -> BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class)); |
| | | List<CalculateItemDTO> calculateItemList = dto.getCalculateItemList(); |
| | | validateCalculateItemList(calculateItemList); |
| | | String numberCalculateFormulaJsonStr = JSON.toJSONString(calculateItemList); |
| | | tbDataScreenConfig.setCalculateFormula(numberCalculateFormulaJsonStr); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.RISK_LEVEL); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |
| | | DataScreenConfigVO dataScreenConfigVO = BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class); |
| | | dataScreenConfigVO.setRateCalculateList(calculateItemList); |
| | | return dataScreenConfigVO; |
| | | } |
| | | |
| | | private void validateCalculateItemList(List<CalculateItemDTO> calculateItemList) { |
| | | if (CollUtils.isEmpty(calculateItemList)) { |
| | | throw new ServiceException("计算公式不能为空"); |
| | | } |
| | | CollUtils.check(calculateItemList, new Checker<CalculateItemDTO>() { |
| | | @Override |
| | | public void check(CalculateItemDTO data) { |
| | | if (Objects.isNull(data.getValueType())) { |
| | | throw new ServiceException("基础数据配置计算规则值类型不能为空"); |
| | | } |
| | | if (StringUtils.isBlank(data.getContent())) { |
| | | throw new ServiceException("基础数据配置计算规则值内容不能为空"); |
| | | } |
| | | } |
| | | }); |
| | | boolean result = hasConsecutiveDuplicates(calculateItemList); |
| | | if (result) { |
| | | throw new ServiceException("计算表达式有误,请修改"); |
| | | } |
| | | //参数校验 |
| | | String numberCalculateFormulaStr = calculateItemList.stream() |
| | | .map(CalculateItemDTO::getContent) |
| | | .collect(Collectors.joining()); |
| | | //校验表达式是否正确 |
| | | try { |
| | | CalculateUtil.calculate(numberCalculateFormulaStr); |
| | | } catch (Exception e) { |
| | | throw new ServiceException("计算表达式有误,请修改"); |
| | | } |
| | | } |
| | | |
| | | public boolean hasConsecutiveDuplicates(List<CalculateItemDTO> calculateItemList) { |
| | | return IntStream.range(1, calculateItemList.size()) |
| | | .anyMatch(i -> calculateItemList.get(i - 1).getValueType() |
| | | .equals(calculateItemList.get(i).getValueType())); |
| | | } |
| | | |
| | | @Override |
| | | public List<DataScreenConfigVO> getIndicatorsConfig(DataScreenConfigQuery query) { |
| | | public List<DataScreenConfigVO> getIndicatorsConfig(@NotNull DataScreenConfigEnum type) { |
| | | List<TbDataScreenConfig> list = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, query.getType()).list(); |
| | | return BeanUtils.copyList(list, DataScreenConfigVO.class); |
| | | .eq(TbDataScreenConfig::getType, type).list(); |
| | | return list.stream().map(item -> { |
| | | DataScreenConfigVO vo = BeanUtils.copyBean(item, |
| | | DataScreenConfigVO.class); |
| | | List<CalculateItemDTO> scoreCalculateList = JSONArray.parseArray( |
| | | item.getCalculateFormula(), |
| | | CalculateItemDTO.class); |
| | | vo.setScoreCalculateList(scoreCalculateList); |
| | | List<CalculateItemDTO> rateCalculateList = JSONArray.parseArray( |
| | | item.getCalculateRateFormula(), |
| | | CalculateItemDTO.class); |
| | | vo.setRateCalculateList(rateCalculateList); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | .eq(TbDataScreenConfig::getSubType, |
| | | dto.getSubType()).oneOpt().orElseGet(() -> BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class)); |
| | | List<CalculateItemDTO> scoreCalculateList = dto.getScoreCalculateList(); |
| | | List<CalculateItemDTO> rateCalculateList = dto.getRateCalculateList(); |
| | | validateCalculateItemList(scoreCalculateList); |
| | | validateCalculateItemList(rateCalculateList); |
| | | String scoreCalculateFormulaJsonStr = JSON.toJSONString(scoreCalculateList); |
| | | tbDataScreenConfig.setCalculateFormula(scoreCalculateFormulaJsonStr); |
| | | String rateCalculateFormulaJsonStr = JSON.toJSONString(rateCalculateList); |
| | | tbDataScreenConfig.setCalculateRateFormula(rateCalculateFormulaJsonStr); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.DATA_INDICATORS); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |
| | | DataScreenConfigVO dataScreenConfigVO = BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class); |
| | | dataScreenConfigVO.setScoreCalculateList(scoreCalculateList); |
| | | dataScreenConfigVO.setRateCalculateList(rateCalculateList); |
| | | return dataScreenConfigVO; |
| | | } |
| | | |
| | | @Override |
| | |
| | | dto.getSubType()).oneOpt().orElseGet(() -> BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class)); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.FORMAL_INDICATORS); |
| | | List<CalculateItemDTO> calculateItemList = dto.getCalculateItemList(); |
| | | validateCalculateItemList(calculateItemList); |
| | | String calculateFormulaJsonStr = JSON.toJSONString(calculateItemList); |
| | | tbDataScreenConfig.setCalculateFormula(calculateFormulaJsonStr); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | return BeanUtils.copyBean(tbDataScreenConfig, DataScreenConfigVO.class); |
| | | DataScreenConfigVO dataScreenConfigVO = BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class); |
| | | dataScreenConfigVO.setScoreCalculateList(calculateItemList); |
| | | return dataScreenConfigVO; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | import com.ruoyi.system.mapper.TbDataScreenScoreMapper; |
| | | import com.ruoyi.system.service.TbDataScreenScoreService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 大屏得分表 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Service |
| | | public class TbDataScreenScoreServiceImpl extends |
| | | ServiceImpl<TbDataScreenScoreMapper, TbDataScreenScore> implements |
| | | TbDataScreenScoreService { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.common.utils.CollUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.TbField; |
| | | import com.ruoyi.system.domain.TbFieldCategory; |
| | | import com.ruoyi.system.dto.FieldCategoryDTO; |
| | | import com.ruoyi.system.dto.ShowHideDTO; |
| | |
| | | import com.ruoyi.system.mapper.TbFieldCategoryMapper; |
| | | import com.ruoyi.system.query.FieldCategoryQuery; |
| | | import com.ruoyi.system.service.TbFieldCategoryService; |
| | | import com.ruoyi.system.service.TbFieldService; |
| | | import com.ruoyi.system.vo.FieldCategoryDetailVO; |
| | | import com.ruoyi.system.vo.FieldCategoryVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.stream.Collectors; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author mitao |
| | | * @since 2024-03-13 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class TbFieldCategoryServiceImpl extends ServiceImpl<TbFieldCategoryMapper, TbFieldCategory> implements TbFieldCategoryService { |
| | | @RequiredArgsConstructor |
| | | public class TbFieldCategoryServiceImpl extends |
| | | ServiceImpl<TbFieldCategoryMapper, TbFieldCategory> implements TbFieldCategoryService { |
| | | |
| | | private final TbFieldService tbFieldService; |
| | | |
| | | @Override |
| | | public void add(FieldCategoryDTO dto) { |
| | |
| | | //二级分类 |
| | | List<FieldCategoryDTO> children = dto.getChildren(); |
| | | if (!CollectionUtils.isEmpty(children)) { |
| | | children.forEach(item->{ |
| | | children.forEach(item -> { |
| | | TbFieldCategory twoCategory = new TbFieldCategory(); |
| | | twoCategory.setParentId(oneCategory.getId()); |
| | | twoCategory.setFieldCategoryName(item.getFieldCategoryName()); |
| | |
| | | //三级分类 |
| | | List<FieldCategoryDTO> next = item.getChildren(); |
| | | if (!CollectionUtils.isEmpty(next)) { |
| | | next.forEach(nextItem->{ |
| | | next.forEach(nextItem -> { |
| | | TbFieldCategory threeCategory = new TbFieldCategory(); |
| | | threeCategory.setParentId(twoCategory.getId()); |
| | | threeCategory.setFieldCategoryName(nextItem.getFieldCategoryName()); |
| | |
| | | @Override |
| | | public PageDTO<FieldCategoryVO> queryPage(FieldCategoryQuery query) { |
| | | Page<TbFieldCategory> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotBlank(query.getFieldCategoryName()), TbFieldCategory::getFieldCategoryName, query.getFieldCategoryName()) |
| | | .eq(ObjectUtils.isNotEmpty(query.getStatus()), TbFieldCategory::getStatus, query.getStatus()) |
| | | .like(StringUtils.isNotBlank(query.getFieldCategoryName()), |
| | | TbFieldCategory::getFieldCategoryName, query.getFieldCategoryName()) |
| | | .eq(ObjectUtils.isNotEmpty(query.getStatus()), TbFieldCategory::getStatus, |
| | | query.getStatus()) |
| | | .eq(TbFieldCategory::getParentId, 0) |
| | | .orderByDesc(TbFieldCategory::getCreateTime) |
| | | .page(new Page<>(query.getPageNum(), query.getPageSize())); |
| | |
| | | .eq(TbFieldCategory::getId, id) |
| | | .set(TbFieldCategory::getStatus, status) |
| | | .update(); |
| | | List<TbFieldCategory> children = this.lambdaQuery().eq(TbFieldCategory::getParentId, category.getId()).list(); |
| | | List<TbFieldCategory> children = this.lambdaQuery() |
| | | .eq(TbFieldCategory::getParentId, category.getId()).list(); |
| | | if (CollUtils.isNotEmpty(children)) { |
| | | List<Long> childIds = children.stream().map(TbFieldCategory::getId).collect(Collectors.toList()); |
| | | List<Long> childIds = children.stream().map(TbFieldCategory::getId) |
| | | .collect(Collectors.toList()); |
| | | childIds.forEach(childId -> updateCategoryAndChildren(childId, status)); |
| | | } |
| | | } |
| | |
| | | TbFieldCategory category = this.getById(id); |
| | | if (Objects.nonNull(category)) { |
| | | //查询是否有三级分类 |
| | | List<TbFieldCategory> threeCategoryList = this.lambdaQuery().eq(TbFieldCategory::getParentId, id).list(); |
| | | List<TbFieldCategory> threeCategoryList = this.lambdaQuery() |
| | | .eq(TbFieldCategory::getParentId, id).list(); |
| | | if (CollectionUtils.isNotEmpty(threeCategoryList)) { |
| | | List<Long> ids = threeCategoryList.stream().map(TbFieldCategory::getId).collect(Collectors.toList()); |
| | | List<Long> ids = threeCategoryList.stream().map(TbFieldCategory::getId) |
| | | .collect(Collectors.toList()); |
| | | //删除该二级分类下面的三级分类 |
| | | this.removeByIds(ids); |
| | | } |
| | |
| | | //一级分类 |
| | | validateParam(id); |
| | | //查询是否有二级分类 |
| | | List<TbFieldCategory> threeCategoryList = this.lambdaQuery().eq(TbFieldCategory::getParentId, id).list(); |
| | | List<TbFieldCategory> threeCategoryList = this.lambdaQuery() |
| | | .eq(TbFieldCategory::getParentId, id).list(); |
| | | if (CollectionUtils.isNotEmpty(threeCategoryList)) { |
| | | List<Long> ids = threeCategoryList.stream().map(TbFieldCategory::getId).collect(Collectors.toList()); |
| | | List<Long> ids = threeCategoryList.stream().map(TbFieldCategory::getId) |
| | | .collect(Collectors.toList()); |
| | | //查询三级分类 |
| | | List<TbFieldCategory> list = this.lambdaQuery().in(TbFieldCategory::getParentId, ids).list(); |
| | | List<TbFieldCategory> list = this.lambdaQuery().in(TbFieldCategory::getParentId, ids) |
| | | .list(); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | List<Long> ids1 = list.stream().map(TbFieldCategory::getId).collect(Collectors.toList()); |
| | | List<Long> ids1 = list.stream().map(TbFieldCategory::getId) |
| | | .collect(Collectors.toList()); |
| | | //删除三级分类 |
| | | this.removeByIds(ids1); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void edit(FieldCategoryUpdateDTO dto) { |
| | | log.info("主线程名{}", Thread.currentThread().getName()); |
| | | validateParam(dto.getId()); |
| | | //更新一级分类 |
| | | updateCategory(dto); |
| | | TbFieldCategory category1 = updateCategory(dto, null); |
| | | CompletableFuture.runAsync(() -> handleFieldCategory(category1)); |
| | | List<FieldCategoryUpdateDTO> children = dto.getChildren(); |
| | | //更新二级分类 |
| | | if (!CollectionUtils.isEmpty(children)) { |
| | | children.forEach(item->{ |
| | | updateCategory(item); |
| | | if (CollUtils.isNotEmpty(children)) { |
| | | children.forEach(item -> { |
| | | //二级分类 |
| | | TbFieldCategory category2 = updateCategory(item, category1); |
| | | CompletableFuture.runAsync(() -> handleFieldCategory(category2)); |
| | | //三级分类 |
| | | List<FieldCategoryUpdateDTO> next = item.getChildren(); |
| | | if (!CollectionUtils.isEmpty(next)) { |
| | | next.forEach(this::updateCategory); |
| | | for (FieldCategoryUpdateDTO fieldCategoryUpdateDTO : next) { |
| | | TbFieldCategory category3 = updateCategory(fieldCategoryUpdateDTO, |
| | | category2); |
| | | CompletableFuture.runAsync(() -> handleFieldCategory(category3)); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | private void updateCategory(FieldCategoryUpdateDTO dto) { |
| | | if (dto == null) return; |
| | | this.lambdaUpdate() |
| | | .set(TbFieldCategory::getFieldCategoryName, dto.getFieldCategoryName()) |
| | | .set(Objects.nonNull(dto.getSortOrder()),TbFieldCategory::getSortOrder, dto.getSortOrder()) |
| | | .eq(TbFieldCategory::getId, dto.getId()) |
| | | .update(); |
| | | protected void handleFieldCategory(TbFieldCategory category) { |
| | | log.info("开始处理字段分类名称同步,线程名{}", Thread.currentThread().getName()); |
| | | //查询使用到该分类的字段 |
| | | List<TbField> list1 = tbFieldService.list(Wrappers.<TbField>lambdaQuery() |
| | | .eq(TbField::getLevelOneCategoryId, category.getId())); |
| | | if (CollUtils.isNotEmpty(list1)) { |
| | | List<TbField> fieldList = list1.stream().peek(item -> { |
| | | item.setLevelOneCategoryId(category.getId()); |
| | | item.setLevelOneCategory(category.getFieldCategoryName()); |
| | | }).collect(Collectors.toList()); |
| | | tbFieldService.updateBatchById(fieldList); |
| | | } |
| | | List<TbField> list2 = tbFieldService.list(Wrappers.<TbField>lambdaQuery() |
| | | .eq(TbField::getLevelTwoCategoryId, category.getId())); |
| | | if (CollUtils.isNotEmpty(list2)) { |
| | | List<TbField> fieldList = list2.stream().peek(item -> { |
| | | item.setLevelTwoCategoryId(category.getId()); |
| | | item.setLevelTwoCategory(category.getFieldCategoryName()); |
| | | }).collect(Collectors.toList()); |
| | | tbFieldService.updateBatchById(fieldList); |
| | | } |
| | | List<TbField> list3 = tbFieldService.list(Wrappers.<TbField>lambdaQuery() |
| | | .eq(TbField::getLevelThreeCategoryId, category.getId())); |
| | | if (CollUtils.isNotEmpty(list2)) { |
| | | List<TbField> fieldList = list3.stream().peek(item -> { |
| | | item.setLevelThreeCategoryId(category.getParentId()); |
| | | item.setLevelThreeCategory(category.getFieldCategoryName()); |
| | | }).collect(Collectors.toList()); |
| | | tbFieldService.updateBatchById(fieldList); |
| | | } |
| | | } |
| | | |
| | | private TbFieldCategory updateCategory(FieldCategoryUpdateDTO dto, |
| | | TbFieldCategory parent) { |
| | | TbFieldCategory category = BeanUtils.copyBean(dto, TbFieldCategory.class); |
| | | if (Objects.isNull(dto.getId()) && Objects.nonNull(parent)) { |
| | | assert category != null; |
| | | category.setParentId(parent.getId()); |
| | | this.save(category); |
| | | } else { |
| | | this.updateById(category); |
| | | } |
| | | return category; |
| | | } |
| | | |
| | | @Override |
| | | public List<FieldCategoryVO> queryFieldCategories(Long id) { |
| | | List<TbFieldCategory> list = this.lambdaQuery() |
| | | .select(TbFieldCategory::getId,TbFieldCategory::getFieldCategoryName) |
| | | .select(TbFieldCategory::getId, TbFieldCategory::getFieldCategoryName) |
| | | .eq(TbFieldCategory::getParentId, id) |
| | | .eq(TbFieldCategory::getStatus, ShowStatusEnum.SHOW) |
| | | .list(); |
| | |
| | | } |
| | | FieldCategoryDetailVO vo = BeanUtils.copyBean(oneCategory, FieldCategoryDetailVO.class); |
| | | //根据一级分类id,查询二级分类 |
| | | List<TbFieldCategory> twoCategoryList = this.lambdaQuery().eq(TbFieldCategory::getParentId, oneCategory.getId()).list(); |
| | | twoCategoryList.forEach(item->{ |
| | | FieldCategoryDetailVO twoCategoryVO = BeanUtils.copyBean(item, FieldCategoryDetailVO.class); |
| | | List<TbFieldCategory> twoCategoryList = this.lambdaQuery() |
| | | .eq(TbFieldCategory::getParentId, oneCategory.getId()).list(); |
| | | twoCategoryList.forEach(item -> { |
| | | FieldCategoryDetailVO twoCategoryVO = BeanUtils.copyBean(item, |
| | | FieldCategoryDetailVO.class); |
| | | vo.getChildren().add(twoCategoryVO); |
| | | //根据二级分类id,查询三级分类 |
| | | List<TbFieldCategory> threeCategoryList = this.lambdaQuery().eq(TbFieldCategory::getParentId, item.getId()).list(); |
| | | threeCategoryList.forEach(threeCategory->{ |
| | | FieldCategoryDetailVO threeCategoryVO = BeanUtils.copyBean(threeCategory, FieldCategoryDetailVO.class); |
| | | List<TbFieldCategory> threeCategoryList = this.lambdaQuery() |
| | | .eq(TbFieldCategory::getParentId, item.getId()).list(); |
| | | threeCategoryList.forEach(threeCategory -> { |
| | | FieldCategoryDetailVO threeCategoryVO = BeanUtils.copyBean(threeCategory, |
| | | FieldCategoryDetailVO.class); |
| | | twoCategoryVO.getChildren().add(threeCategoryVO); |
| | | }); |
| | | }); |
| | |
| | | import com.ruoyi.system.handler.CustomerHandler; |
| | | import com.ruoyi.system.handler.SelectedSheetWriteHandler; |
| | | import com.ruoyi.system.mapper.TbBasicDataMapper; |
| | | import com.ruoyi.system.mapper.TbFieldCategoryMapper; |
| | | import com.ruoyi.system.mapper.TbFieldMapper; |
| | | import com.ruoyi.system.query.FieldQuery; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TbBasicDataConfigService; |
| | | import com.ruoyi.system.service.TbBasicDataFieldService; |
| | | import com.ruoyi.system.service.TbFieldCategoryService; |
| | | import com.ruoyi.system.service.TbFieldService; |
| | | import com.ruoyi.system.utils.FieldBuildUtil; |
| | | import com.ruoyi.system.vo.BasicDataFieldVO; |
| | |
| | | public class TbFieldServiceImpl extends ServiceImpl<TbFieldMapper, TbField> implements |
| | | TbFieldService { |
| | | |
| | | private final TbFieldCategoryService tbFieldCategoryService; |
| | | private final TbFieldCategoryMapper tbFieldCategoryMapper; |
| | | private final TbBasicDataConfigService tbBasicDataConfigService; |
| | | private final TbBasicDataMapper tbBasicDataMapper; |
| | | private final TbBasicDataFieldService tbBasicDataFieldService; |
| | |
| | | } |
| | | } |
| | | TbField tbField = BeanUtils.copyBean(dto, TbField.class); |
| | | TbFieldCategory category1 = tbFieldCategoryService.getById(dto.getLevelOneCategoryId()); |
| | | TbFieldCategory category1 = tbFieldCategoryMapper.selectById(dto.getLevelOneCategoryId()); |
| | | tbField.setLevelOneCategory(category1.getFieldCategoryName()); |
| | | if (StringUtils.isNotNull(dto.getLevelTwoCategoryId())) { |
| | | TbFieldCategory category2 = tbFieldCategoryService.getById(dto.getLevelTwoCategoryId()); |
| | | TbFieldCategory category2 = tbFieldCategoryMapper.selectById( |
| | | dto.getLevelTwoCategoryId()); |
| | | tbField.setLevelTwoCategory(category2.getFieldCategoryName()); |
| | | } |
| | | if (StringUtils.isNotNull(dto.getLevelThreeCategoryId())) { |
| | | TbFieldCategory category3 = tbFieldCategoryService.getById( |
| | | TbFieldCategory category3 = tbFieldCategoryMapper.selectById( |
| | | dto.getLevelThreeCategoryId()); |
| | | tbField.setLevelThreeCategory(category3.getFieldCategoryName()); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.TbOperLog; |
| | | import com.ruoyi.system.mapper.TbOperLogMapper; |
| | | import com.ruoyi.system.query.OperLogQuery; |
| | | import com.ruoyi.system.service.TbOperLogService; |
| | | import com.ruoyi.system.vo.OperLogVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author mitao |
| | | * @since 2024-04-15 |
| | | */ |
| | | @Service |
| | | public class TbOperLogServiceImpl extends ServiceImpl<TbOperLogMapper, TbOperLog> implements |
| | | TbOperLogService { |
| | | |
| | | @Override |
| | | public PageDTO<OperLogVO> queryPage(OperLogQuery query) { |
| | | Page<TbOperLog> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotBlank(query.getStaffName()), TbOperLog::getStaffName, |
| | | query.getStaffName()) |
| | | .like(StringUtils.isNotBlank(query.getPhoneNumber()), TbOperLog::getPhoneNumber, |
| | | query.getPhoneNumber()) |
| | | .like(StringUtils.isNotBlank(query.getAreaName()), TbOperLog::getAreaName, |
| | | query.getAreaName()) |
| | | .between(StringUtils.isNotBlank(query.getStartTime()) && StringUtils.isNotBlank( |
| | | query.getEndTime()), TbOperLog::getCreateTime, |
| | | query.getStartTime(), query.getEndTime()) |
| | | .page(new Page<>(query.getPageNum(), query.getPageSize())); |
| | | return PageDTO.of(page, OperLogVO.class); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.enums.ShowStatusEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/3/18 |
| | | */ |
| | | @Data |
| | | @ApiModel(value="基础数据分类视图对象") |
| | | @ApiModel(value = "基础数据分类视图对象") |
| | | public class BasicDataCategoryVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -1547151291021868164L; |
| | |
| | | |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import com.ruoyi.system.dto.CalculateItemDTO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | private DataScreenConfigEnum type; |
| | | |
| | | @ApiModelProperty(value = "得分计算规则") |
| | | private String calculateFormula; |
| | | private List<CalculateItemDTO> scoreCalculateList; |
| | | |
| | | @ApiModelProperty(value = "得分率计算规则") |
| | | private String calculateRateFormula; |
| | | private List<CalculateItemDTO> rateCalculateList; |
| | | |
| | | @ApiModelProperty(value = "配置类型子类型(1=指标一 2=指标二 3=指标三 4=指标四)") |
| | | private SubTypeEnum subType; |
| | |
| | | import com.ruoyi.common.enums.ShowStatusEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/3/14 |
| | | */ |
| | | @Data |
| | | @ApiModel(value="字段分类视图对象") |
| | | @ApiModel(value = "字段分类视图对象") |
| | | public class FieldCategoryVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 6367532315341833784L; |
| | |
| | | |
| | | @ApiModelProperty(value = "分类名称") |
| | | private String fieldCategoryName; |
| | | |
| | | @ApiModelProperty(value = "排序") |
| | | private Integer sortOrder; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.util.Date; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/15 |
| | | */ |
| | | @Data |
| | | @ApiModel("操作日志视图对象") |
| | | public class OperLogVO { |
| | | |
| | | @ApiModelProperty(value = "主键id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "员工姓名") |
| | | private String staffName; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String phoneNumber; |
| | | |
| | | @ApiModelProperty(value = "操作") |
| | | private String operation; |
| | | |
| | | @ApiModelProperty(value = "修改字段") |
| | | private String fieldName; |
| | | |
| | | @ApiModelProperty(value = "所属部门") |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty(value = "修改前数据") |
| | | private String beforeEdit; |
| | | |
| | | @ApiModelProperty(value = "修改后数据") |
| | | private String afterEdit; |
| | | |
| | | @ApiModelProperty(value = "修改时间") |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | @TableField("create_by") |
| | | private String createBy; |
| | | } |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "账户列表VO") |
| | | public class SysUserVO extends SysUser { |
| | | public class SysUserVO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "身份") |
| | | private Integer companyType; |
| | | @ApiModelProperty(value = "单位名称") |
| | | private String companyName; |
| | | @ApiModelProperty(value = "部门") |
| | | private String deptName; |
| | | @ApiModelProperty(value = "角色") |
| | | private static final long serialVersionUID = -852636474150556733L; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | @ApiModelProperty(value = "员工姓名") |
| | | private String userName; |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String phoneNumber; |
| | | @ApiModelProperty(value = "所属角色") |
| | | private String roleName; |
| | | @ApiModelProperty(value = "所属角色ID") |
| | | private Integer roleId; |
| | | |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.SysOperLogMapper"> |
| | | |
| | | <resultMap type="SysOperLog" id="SysOperLogResult"> |
| | | <id property="operId" column="oper_id" /> |
| | | <result property="title" column="title" /> |
| | | <result property="businessType" column="business_type" /> |
| | | <result property="method" column="method" /> |
| | | <result property="requestMethod" column="request_method" /> |
| | | <result property="operatorType" column="operator_type" /> |
| | | <result property="operName" column="oper_name" /> |
| | | <result property="deptName" column="dept_name" /> |
| | | <result property="operUrl" column="oper_url" /> |
| | | <result property="operIp" column="oper_ip" /> |
| | | <result property="operLocation" column="oper_location" /> |
| | | <result property="operParam" column="oper_param" /> |
| | | <result property="jsonResult" column="json_result" /> |
| | | <result property="status" column="status" /> |
| | | <result property="errorMsg" column="error_msg" /> |
| | | <result property="operTime" column="oper_time" /> |
| | | <result property="costTime" column="cost_time" /> |
| | | <result property="companyName" column="companyName" /> |
| | | <result property="roleName" column="roleName" /> |
| | | <result property="phoneNumber" column="phone_number" /> |
| | | <result property="userId" column="userId" /> |
| | | <result property="nickName" column="nickName" /> |
| | | </resultMap> |
| | | <resultMap type="SysOperLog" id="SysOperLogResult"> |
| | | <id property="operId" column="oper_id"/> |
| | | <result property="title" column="title"/> |
| | | <result property="businessType" column="business_type"/> |
| | | <result property="method" column="method"/> |
| | | <result property="requestMethod" column="request_method"/> |
| | | <result property="operatorType" column="operator_type"/> |
| | | <result property="operName" column="oper_name"/> |
| | | <result property="deptName" column="dept_name"/> |
| | | <result property="operUrl" column="oper_url"/> |
| | | <result property="operIp" column="oper_ip"/> |
| | | <result property="operLocation" column="oper_location"/> |
| | | <result property="operParam" column="oper_param"/> |
| | | <result property="jsonResult" column="json_result"/> |
| | | <result property="status" column="status"/> |
| | | <result property="errorMsg" column="error_msg"/> |
| | | <result property="operTime" column="oper_time"/> |
| | | <result property="costTime" column="cost_time"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectOperLogVo"> |
| | | select oper_id, title, business_type, `method`, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, |
| | | json_result, status, error_msg, oper_time, cost_time,companyName,roleName,phoneNumber,userId,nickName |
| | | from sys_oper_log |
| | | </sql> |
| | | |
| | | <insert id="insertOperlog" parameterType="SysOperLog"> |
| | | insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time,companyName,roleName,phoneNumber,userId,nickName, oper_time) |
| | | values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime},#{companyName},#{roleName},#{phoneNumber},#{userId},#{nickName}, sysdate()) |
| | | </insert> |
| | | |
| | | <select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult"> |
| | | <include refid="selectOperLogVo"/> |
| | | <where> |
| | | <if test="operIp != null and operIp != ''"> |
| | | AND oper_ip like concat('%', #{operIp}, '%') |
| | | </if> |
| | | <if test="title != null and title != ''"> |
| | | AND title like concat('%', #{title}, '%') |
| | | </if> |
| | | <if test="businessType != null"> |
| | | AND business_type = #{businessType} |
| | | </if> |
| | | <if test="businessTypes != null and businessTypes.length > 0"> |
| | | AND business_type in |
| | | <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")"> |
| | | #{businessType} |
| | | </foreach> |
| | | </if> |
| | | <if test="status != null"> |
| | | AND status = #{status} |
| | | </if> |
| | | <if test="operName != null and operName != ''"> |
| | | AND oper_name like concat('%', #{operName}, '%') |
| | | </if> |
| | | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> |
| | | AND oper_time >= #{params.beginTime} |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
| | | AND oper_time <= #{params.endTime} |
| | | </if> |
| | | </where> |
| | | order by oper_id desc |
| | | </select> |
| | | |
| | | <delete id="deleteOperLogByIds" parameterType="Long"> |
| | | delete from sys_oper_log where oper_id in |
| | | <foreach collection="operIds" item="operId" open="(" separator="," close=")"> |
| | | #{operId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult"> |
| | | <include refid="selectOperLogVo"/> |
| | | where oper_id = #{operId} |
| | | </select> |
| | | <select id="selectOperLogPageList" resultType="com.ruoyi.system.vo.SysOperLogVO"> |
| | | select sol.oper_id AS operId, sol.title AS title, sol.business_type AS businessType, sol.`method` AS method, sol.request_method AS requestMethod, |
| | | sol.operator_type AS operatorType,sol.oper_name AS operName,sol.dept_name AS deptName, sol.oper_url AS operUrl, sol.oper_ip AS operIp, |
| | | sol.oper_location AS operLocation, sol.oper_param AS operLocation,sol.json_result AS jsonResult, sol.status AS status,sol.error_msg AS errorMsg, |
| | | sol.oper_time AS operTime, sol.cost_time AS costTime,sol.companyName AS companyName,sol.roleName AS roleName,sol.phoneNumber AS phoneNumber, |
| | | sol.userId AS userId,sol.nickName AS nickName |
| | | from sys_oper_log sol |
| | | <where> |
| | | <if test="query.companyName != null and query.companyName != ''"> |
| | | AND sol.companyName LIKE concat('%',#{query.companyName},'%') |
| | | </if> |
| | | <if test="query.roleName != null and query.roleName != ''"> |
| | | AND sol.roleName LIKE concat('%',#{query.roleName},'%') |
| | | </if> |
| | | <if test="query.nickName != null and query.nickName != ''"> |
| | | AND sol.nickName LIKE concat('%',#{query.nickName},'%') |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND DATE_FORMAT(sol.oper_time, '%Y-%m-%d %H:%i:%s') >= #{query.startTime} |
| | | AND DATE_FORMAT(sol.oper_time, '%Y-%m-%d %H:%i:%s') <= #{query.endTime} |
| | | </if> |
| | | </where> |
| | | ORDER BY sol.oper_time DESC |
| | | </select> |
| | | <sql id="selectOperLogVo"> |
| | | select oper_id, |
| | | title, |
| | | business_type, |
| | | `method`, |
| | | request_method, |
| | | operator_type, |
| | | oper_name, |
| | | dept_name, |
| | | oper_url, |
| | | oper_ip, |
| | | oper_location, |
| | | oper_param, |
| | | json_result, |
| | | status, |
| | | error_msg, |
| | | oper_time, |
| | | cost_time |
| | | from sys_oper_log |
| | | </sql> |
| | | |
| | | <update id="cleanOperLog"> |
| | | truncate table sys_oper_log |
| | | </update> |
| | | <insert id="insertOperlog" parameterType="com.ruoyi.system.domain.SysOperLog"> |
| | | insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, |
| | | dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, |
| | | status, error_msg, cost_time, oper_time) |
| | | values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, |
| | | #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, |
| | | #{status}, #{errorMsg}, #{costTime}, sysdate()) |
| | | </insert> |
| | | |
| | | <select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult"> |
| | | <include refid="selectOperLogVo"/> |
| | | <where> |
| | | <if test="operIp != null and operIp != ''"> |
| | | AND oper_ip like concat('%', #{operIp}, '%') |
| | | </if> |
| | | <if test="title != null and title != ''"> |
| | | AND title like concat('%', #{title}, '%') |
| | | </if> |
| | | <if test="businessType != null"> |
| | | AND business_type = #{businessType} |
| | | </if> |
| | | <if test="businessTypes != null and businessTypes.length > 0"> |
| | | AND business_type in |
| | | <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")"> |
| | | #{businessType} |
| | | </foreach> |
| | | </if> |
| | | <if test="status != null"> |
| | | AND status = #{status} |
| | | </if> |
| | | <if test="operName != null and operName != ''"> |
| | | AND oper_name like concat('%', #{operName}, '%') |
| | | </if> |
| | | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> |
| | | AND oper_time >= #{params.beginTime} |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
| | | AND oper_time <= #{params.endTime} |
| | | </if> |
| | | </where> |
| | | order by oper_id desc |
| | | </select> |
| | | |
| | | <delete id="deleteOperLogByIds" parameterType="Long"> |
| | | delete from sys_oper_log where oper_id in |
| | | <foreach collection="operIds" item="operId" open="(" separator="," close=")"> |
| | | #{operId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult"> |
| | | <include refid="selectOperLogVo"/> |
| | | where oper_id = #{operId} |
| | | </select> |
| | | <select id="selectOperLogPageList" resultType="com.ruoyi.system.vo.SysOperLogVO"> |
| | | select sol.oper_id AS operId, sol.title AS title, sol.business_type AS businessType, |
| | | sol.`method` AS method, sol.request_method AS requestMethod, |
| | | sol.operator_type AS operatorType,sol.oper_name AS operName,sol.dept_name AS deptName, |
| | | sol.oper_url AS operUrl, sol.oper_ip AS operIp, |
| | | sol.oper_location AS operLocation, sol.oper_param AS operLocation,sol.json_result AS jsonResult, |
| | | sol.status AS status,sol.error_msg AS errorMsg, |
| | | sol.oper_time AS operTime, sol.cost_time AS costTime,sol.companyName AS companyName,sol.roleName |
| | | AS roleName,sol.phoneNumber AS phoneNumber, |
| | | sol.userId AS userId,sol.nickName AS nickName |
| | | from sys_oper_log sol |
| | | <where> |
| | | <if test="query.companyName != null and query.companyName != ''"> |
| | | AND sol.companyName LIKE concat('%',#{query.companyName},'%') |
| | | </if> |
| | | <if test="query.roleName != null and query.roleName != ''"> |
| | | AND sol.roleName LIKE concat('%',#{query.roleName},'%') |
| | | </if> |
| | | <if test="query.nickName != null and query.nickName != ''"> |
| | | AND sol.nickName LIKE concat('%',#{query.nickName},'%') |
| | | </if> |
| | | <if |
| | | test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND DATE_FORMAT(sol.oper_time, '%Y-%m-%d %H:%i:%s') >= #{query.startTime} |
| | | AND DATE_FORMAT(sol.oper_time, '%Y-%m-%d %H:%i:%s') <= #{query.endTime} |
| | | </if> |
| | | </where> |
| | | ORDER BY sol.oper_time DESC |
| | | </select> |
| | | |
| | | <update id="cleanOperLog"> |
| | | truncate table sys_oper_log |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where r.role_id = #{roleId} |
| | | where r.role_id = #{roleId} AND r.del_flag = 0 |
| | | </select> |
| | | |
| | | <select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult"> |
| | |
| | | status AS status, |
| | | del_flag AS delFlag, |
| | | create_time AS createTime, |
| | | create_by AS createBy, |
| | | postType AS postType, |
| | | removeDays AS removeDays |
| | | create_by AS createBy |
| | | from sys_role |
| | | where del_flag = 0 |
| | | </select> |
| | |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="removeDays != null">removeDays,</if> |
| | | <if test="postType != null">postType,</if> |
| | | create_time |
| | | )values( |
| | | <if test="roleId != null and roleId != 0">#{roleId},</if> |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="removeDays != null">#{removeDays},</if> |
| | | <if test="postType != null">#{postType},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="removeDays != null">removeDays = #{removeDays},</if> |
| | | <if test="postType != null">postType = #{postType},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where role_id = #{roleId} |
| | |
| | | |
| | | <delete id="deleteRoleById" parameterType="Long"> |
| | | update sys_role |
| | | set del_flag = '2' |
| | | set del_flag = '1' |
| | | where role_id = #{roleId} |
| | | </delete> |
| | | |
| | | <delete id="deleteRoleByIds" parameterType="Long"> |
| | | update sys_role set del_flag = '2' where role_id in |
| | | update sys_role set del_flag = '1' where role_id in |
| | | <foreach collection="roleIds" item="roleId" open="(" separator="," close=")"> |
| | | #{roleId} |
| | | </foreach> |
| | |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <!-- <if test="ifBlack != null">ifBlack,</if>--> |
| | | <!-- <if test="districtId != null">districtId,</if>--> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | | <if test="deptId != null and deptId != ''">#{deptId},</if> |
| | | <if test="userName != null and userName != ''">#{userName},</if> |
| | | <if test="deptName != null and deptName != ''">#{deptName},</if> |
| | | |
| | | <if test="nickName != null and nickName != ''">#{nickName},</if> |
| | | <if test="email != null and email != ''">#{email},</if> |
| | | <if test="avatar != null and avatar != ''">#{avatar},</if> |
| | | <if test="phoneNumber != null and phoneNumber != ''">#{phone_number},</if> |
| | | <if test="phoneNumber != null and phoneNumber != ''">#{phoneNumber},</if> |
| | | <if test="sex != null and sex != ''">#{sex},</if> |
| | | <if test="password != null and password != ''">#{password},</if> |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <!-- <if test="ifBlack != null">#{ifBlack},</if>--> |
| | | <!-- <if test="districtId != null">#{districtId},</if>--> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | |
| | | u.create_time AS createTime, |
| | | u.remark AS remark,/*u.ifBlack AS ifBlack,u.districtId AS districtId,*/ |
| | | ur.role_id AS roleId, |
| | | sr.role_name AS roleName, |
| | | u.deptName as deptName |
| | | sr.role_name AS roleName |
| | | from sys_user u |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | | left join sys_role sr on ur.role_id = sr.role_id |
| | |
| | | u.remark AS remark |
| | | from sys_user u |
| | | WHERE u.del_flag = 0 |
| | | AND u.user_type = 1 |
| | | </select> |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from sys_user |
| | |
| | | <if test="status != null"> |
| | | AND status = #{status} |
| | | </if> |
| | | AND del_flag = 0 |
| | | AND del_flag = 0 AND user_type = 1 |
| | | </where> |
| | | </select> |
| | | <select id="selectListByNamePhone" resultType="com.ruoyi.common.core.domain.entity.SysUser"> |
| | |
| | | u.phone_number AS phoneNumber, u.sex AS sex, u.status AS status, u.del_flag AS delFlag, |
| | | u.login_ip AS loginIp, |
| | | u.login_date AS loginDate, u.create_by AS createBy, u.create_time AS createTime, u.remark AS |
| | | remark,/*u.ifBlack AS ifBlack,u.districtId AS districtId*/ |
| | | remark |
| | | from sys_user u |
| | | WHERE u.del_flag = 0 |
| | | WHERE u.del_flag = 0 AND u.user_type = 1 |
| | | <if test="name != null and name != ''"> |
| | | AND (u.nick_name LIKE concat('%',#{name},'%') |
| | | OR u.phone_number LIKE concat('%',#{name},'%')) |
| | |
| | | nickName, u.email AS email, u.avatar AS avatar, |
| | | u.phone_number AS phoneNumber |
| | | from sys_user u |
| | | WHERE u.del_flag = 0 |
| | | WHERE u.del_flag = 0 AND u.user_type = 1 |
| | | <if test="names != null and names.size()>0"> |
| | | AND u.nick_name IN |
| | | <foreach close=")" collection="names" item="name" open="(" separator=","> |
| | |
| | | left join t_company t2 on t2.id = t1.companyId |
| | | left join t_qrcode tq on t1.user_id = tq.otherId and tq.type = 1 |
| | | where t1.user_id = #{id} |
| | | AND u.user_type = 1 |
| | | </select> |
| | | <select id="selectByPhone" resultType="com.ruoyi.common.core.domain.entity.SysUser"> |
| | | select u.user_id AS userId, |
| | |
| | | where u.phone_number = #{phoneNumber} |
| | | and u.status = 0 |
| | | and u.del_flag = 0 |
| | | AND u.user_type = 1 |
| | | </select> |
| | | <select id="getUserInfoBy" resultType="com.ruoyi.system.vo.UserInfoVo"> |
| | | select t1.*, t2.companyName, t2.companyType |
| | | from sys_user t1 |
| | | left join t_company t2 on t2.id = t1.companyId |
| | | where t1.singleNum = #{singleNum} |
| | | AND u.user_type = 1 |
| | | </select> |
| | | <select id="getUserRole" resultType="java.lang.Long"> |
| | | select role_id |
| | |
| | | <select id="selectAllList" resultType="com.ruoyi.common.core.domain.entity.SysUser"> |
| | | select * |
| | | from sys_user |
| | | where user_type = 1 |
| | | </select> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.SysUserVO"> |
| | | select u.user_id AS userId, u.dept_id AS deptId, u.user_name AS userName, u.nick_name AS |
| | |
| | | u.phone_number AS phoneNumber, u.sex AS sex, u.status AS status, u.del_flag AS delFlag, |
| | | u.login_ip AS loginIp, |
| | | u.login_date AS loginDate, u.create_by AS createBy, u.create_time AS createTime, u.remark AS |
| | | remark,/*u.ifBlack AS ifBlack, u.districtId AS districtId,*/ |
| | | r.role_id AS roleId, r.role_name AS roleName, r.role_key AS roleKey, r.role_sort AS roleSort, |
| | | r.data_scope AS dataScope, r.status as role_status,u.deptName as deptName |
| | | remark, r.role_id AS roleId, r.role_name AS roleName, r.role_key AS roleKey, r.role_sort AS |
| | | roleSort, r.data_scope AS dataScope, r.status as role_status |
| | | from sys_user u |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | | left join sys_role r on r.role_id = ur.role_id |
| | | WHERE u.del_flag = 0 |
| | | <if test="query.nickName != null and query.nickName != ''"> |
| | | AND u.nick_name LIKE concat('%',#{query.nickName},'%') |
| | | WHERE u.del_flag = 0 AND u.user_type = 1 |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | AND u.user_name LIKE concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="query.roleId != null"> |
| | | AND r.role_id = #{query.roleId} |
| | |
| | | where phone_number = #{phoneNumber} |
| | | and status = 0 |
| | | and del_flag = 0 |
| | | AND user_type = 1 |
| | | </select> |
| | | <select id="selectDeptUserByUserName" parameterType="java.lang.String" |
| | | resultType="com.ruoyi.common.core.domain.entity.SysUser"> |
| | |
| | | LEFT JOIN tb_basic_data_category tbdc2 ON tbdc.basic_data_category_id = tbdc2.id |
| | | <where> |
| | | <if test="query.basicDataConfigName != null and query.basicDataConfigName !=''"> |
| | | AND bdc.type_name LIKE CONCAT('%',#{query.basicDataConfigName},'%') |
| | | AND tbdc.type_name LIKE CONCAT('%',#{query.basicDataConfigName},'%') |
| | | </if> |
| | | <if test="query.status !=null"> |
| | | AND bdc.status = #{query.status} |
| | | AND tbdc.status = #{query.status} |
| | | </if> |
| | | <if test="query.calculateType !=null"> |
| | | AND bdc.calculate_type = #{query.calculateType} |
| | | AND tbdc.calculate_type = #{query.calculateType} |
| | | </if> |
| | | </where> |
| | | </select> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.TbDataScreenScoreMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.TbDataScreenScore"> |
| | | <id column="id" property="id"/> |
| | | <result column="dept_area_code" property="deptAreaCode"/> |
| | | <result column="basic_data_id" property="basicDataId"/> |
| | | <result column="data_screen_config_id" property="dataScreenConfigId"/> |
| | | <result column="score" property="score"/> |
| | | <result column="score_rate" property="scoreRate"/> |
| | | <result column="create_time" property="createTime"/> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, dept_area_code, basic_data_id, data_screen_config_id, score, score_rate, create_time |
| | | </sql> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.TbOperLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.TbOperLog"> |
| | | <id column="id" property="id"/> |
| | | <result column="business_type" property="businessType"/> |
| | | <result column="staff_name" property="staffName"/> |
| | | <result column="phone_number" property="phoneNumber"/> |
| | | <result column="operation" property="operation"/> |
| | | <result column="field_name" property="fieldName"/> |
| | | <result column="area_name" property="areaName"/> |
| | | <result column="before_edit" property="beforeEdit"/> |
| | | <result column="after_edit" property="afterEdit"/> |
| | | <result column="create_time" property="createTime"/> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, staff_name, phone_number, operation, field_name, area_name, before_edit, after_edit, create_time, create_by |
| | | </sql> |
| | | |
| | | </mapper> |