diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ed8368aaa7067771686573623aa38f4e14952961 --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +###################################################################### +# Build Tools + +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +target/ +!.mvn/wrapper/maven-wrapper.jar + +###################################################################### +# IDE + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### JRebel ### +rebel.xml + +### NetBeans ### +nbproject/private/ +build/* +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +###################################################################### +# Others +*.log +*.xml.versionsBackup +*.swp + +!*/build/*.java +!*/build/*.html +!*/build/*.xml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..8564f294c7781cbbbdb22ae5927a96f859db0054 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2018 RuoYi + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d438bf596206fa3b0f0b8d3ca739ae83e4726f22 --- /dev/null +++ b/README.md @@ -0,0 +1,97 @@ +

+ logo +

+

RuoYi v3.8.4

+

基于SpringBoot+Vue前后端分离的Java快速开发框架

+

+ + + +

+ +## 平台简介 + +若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。 + +* 前端采用Vue、Element UI。 +* 后端采用Spring Boot、Spring Security、Redis & Jwt。 +* 权限认证使用Jwt,支持多终端认证系统。 +* 支持加载动态权限菜单,多方式轻松权限控制。 +* 高效率开发,使用代码生成器可以一键生成前后端代码。 +* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。 +* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。 +* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) +* 特别鸣谢:[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web)。 +* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)   +* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)   + +## 内置功能 + +1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 +2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 +3. 岗位管理:配置系统用户所属担任职务。 +4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。 +5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。 +6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。 +7. 参数管理:对系统动态配置常用参数。 +8. 通知公告:系统通知公告信息发布维护。 +9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 +10. 登录日志:系统登录日志记录查询包含登录异常。 +11. 在线用户:当前系统中活跃用户状态监控。 +12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。 +13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。 +14. 系统接口:根据业务代码自动生成相关的api接口文档。 +15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。 +16. 缓存监控:对系统的缓存信息查询,命令统计等。 +17. 在线构建器:拖动表单元素生成相应的HTML代码。 +18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 + +## 在线体验 + +- admin/admin123 +- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 + +演示地址:http://vue.ruoyi.vip +文档地址:http://doc.ruoyi.vip + +## 演示图 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +## 若依前后端分离交流群 + +QQ群: [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/已满-167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](https://img.shields.io/badge/已满-104748341-blue.svg)](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](https://img.shields.io/badge/已满-160110482-blue.svg)](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](https://img.shields.io/badge/170801498-blue.svg)](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) 点击按钮入群。 \ No newline at end of file diff --git a/bin/clean.bat b/bin/clean.bat new file mode 100644 index 0000000000000000000000000000000000000000..24c09741e10963dd8c7068f9ff21c952b22b7fc5 --- /dev/null +++ b/bin/clean.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] target· +echo. + +%~d0 +cd %~dp0 + +cd .. +call mvn clean + +pause \ No newline at end of file diff --git a/bin/package.bat b/bin/package.bat new file mode 100644 index 0000000000000000000000000000000000000000..c693ec067499702689d496f74c089888d7840be4 --- /dev/null +++ b/bin/package.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] Weḅwar/jarļ +echo. + +%~d0 +cd %~dp0 + +cd .. +call mvn clean package -Dmaven.test.skip=true + +pause \ No newline at end of file diff --git a/bin/run.bat b/bin/run.bat new file mode 100644 index 0000000000000000000000000000000000000000..41efbd0f3eb46221fb2c9f2f4f156ca311ae5f66 --- /dev/null +++ b/bin/run.bat @@ -0,0 +1,14 @@ +@echo off +echo. +echo [Ϣ] ʹJarWeb̡ +echo. + +cd %~dp0 +cd ../ruoyi-admin/target + +set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m + +java -jar %JAVA_OPTS% ruoyi-admin.jar + +cd bin +pause \ No newline at end of file diff --git a/cmcc_gm/pom.xml b/cmcc_gm/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..4bae25df75ba7fedf62ce16f5993709cd9af41f3 --- /dev/null +++ b/cmcc_gm/pom.xml @@ -0,0 +1,37 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + 4.0.0 + + cmcc_gm + + + 移动的物资管理模块 + + + + + com.ruoyi + ruoyi-common + + + + com.baomidou + mybatis-plus-boot-starter + + + + + + 8 + 8 + UTF-8 + + + \ No newline at end of file diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/common/enums/OrderStatus.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/common/enums/OrderStatus.java new file mode 100644 index 0000000000000000000000000000000000000000..207c73877dae790c98dd32883a25b85a79a40e9a --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/common/enums/OrderStatus.java @@ -0,0 +1,59 @@ +package com.ruoyi.cmcc_gm.common.enums; + +public enum OrderStatus { + + DSQ("0", "待申请") ,DSH("1", "待审核") ,YSH("2","已审核") ,YCK("3","已出库") ,YRK("4","已入库"), + CX("5","撤销"); + + /** code */ + private String code; + + /** 显示标签 */ + private String label; + + OrderStatus(String code, String label){ + + this.code = code; + + this.label = label; + } + + public static String getLabelByCode (String code) { + + for (OrderStatus enuma : OrderStatus.values()) { + + if (enuma.getCode().equals(code)) { + + return enuma.getLabel(); + + } + + } + + return ""; + + } + + + @Override + public String toString(){ + + return label; + + } + + public String getLabel() { + + return label; + + } + + + public String getCode(){ + + return this.code; + + } + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/common/enums/OrderType.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/common/enums/OrderType.java new file mode 100644 index 0000000000000000000000000000000000000000..1624e8b6a66d0734e234bb2b4c090e0579b532e7 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/common/enums/OrderType.java @@ -0,0 +1,83 @@ +package com.ruoyi.cmcc_gm.common.enums; + +public enum OrderType { + + ZXK((Integer)1, "ZXK","中心库更新") ,SL((Integer)2,"SL" ,"物资申领") ,TK((Integer) 3,"TK" ,"物资退库") ,CK((Integer) 4,"CK" ,"工程出库") ,RK((Integer) 5,"RK" ,"折旧入库"),DB((Integer) 6,"DB" ,"调拨"); + + /** code */ + private Integer code; + + /** 英文标签 */ + private String abbLabel; + + /** 显示标签 */ + private String label; + + OrderType(Integer code,String abbLabel, String label){ + + this.code = code; + this.abbLabel = abbLabel; + this.label = label; + } + + public static String getLabelByCode (Integer code) { + + for (OrderType enuma : OrderType.values()) { + + if (enuma.getCode().compareTo(code) == 0) { + + return enuma.getLabel(); + + } + + } + + return ""; + + } + + public static String getAbbLabelByCode (Integer code) { + + for (OrderType enuma : OrderType.values()) { + + if (enuma.getCode().compareTo(code) == 0) { + + return enuma.getAbbLabel(); + + } + + } + + return ""; + + } + + + @Override + public String toString(){ + + return label; + + } + + public String getLabel() { + + return label; + + } + + + public String getAbbLabel() { + + return abbLabel; + + } + + public Integer getCode(){ + + return this.code; + + } + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsBatch.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsBatch.java new file mode 100644 index 0000000000000000000000000000000000000000..f827163cf966df4bfab8bcf16e0d5d2d5c49ef00 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsBatch.java @@ -0,0 +1,54 @@ +package com.ruoyi.cmcc_gm.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * 物资批次表 + *

+ * + * @author jkj + * @since 2023-04-10 + */ +@Getter +@Setter +@TableName("yw_materials_batch") +public class YwMaterialsBatch implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + private Long id; + + /** + * 工单号 + */ + private String orderid; + + /** + * 物资编码 + */ + private String materialCode; + + /** + * 数量 + */ + private Integer sum; + + /** + * 实际入库数量 + */ + private Integer inSum; + + /** + * 实际出库数量 + */ + private Integer outSum; + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsClasses.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsClasses.java new file mode 100644 index 0000000000000000000000000000000000000000..12425d96f78467b9f954238701244593c0700c08 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsClasses.java @@ -0,0 +1,52 @@ +package com.ruoyi.cmcc_gm.domain; + +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 com.ruoyi.common.annotation.Excel; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@Getter +@Setter +@TableName("yw_materials_classes") +public class YwMaterialsClasses implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + @TableId(type = IdType.AUTO) + @Excel(name = "ID",type= Excel.Type.EXPORT, sort = 1) + private Long id; + + /** + * 物资大类 + */ + @Excel(name = "物资大类",type= Excel.Type.ALL, sort = 1) + private String bigClass; + + /** + * 物资小类 + */ + @Excel(name = "物资大类",type= Excel.Type.ALL, sort = 2) + private String smallClass; + + + @Excel(name = "失败原因", type = Excel.Type.EXPORT,sort = 3) + @TableField(exist = false) + private String reason; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsInform.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsInform.java new file mode 100644 index 0000000000000000000000000000000000000000..6fdf7dc56c8d5dd4bfc8eb7f5dfb202260a3de1c --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsInform.java @@ -0,0 +1,99 @@ +package com.ruoyi.cmcc_gm.domain; + +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 java.io.Serializable; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * 物资信息表 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +@Getter +@Setter +@TableName("yw_materials_inform") +public class YwMaterialsInform extends ResultBean implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + @TableId(type = IdType.AUTO) + private Long id; + + @TableField(exist = false) + private String rowId; + + @TableField(exist = false) + private String special; + + /** + * 物资名称 + */ + @Excel(name = "物资名称", sort = 3) + private String materialName; + + /** + * 物资编码 + */ + @Excel(name = "物资编号", sort = 2) + private String materialCode; + + private String factory; + + /** + * 规格 + */ + @Excel(name = "规格型号", sort = 4) + private String materialStand; + + @TableField(exist = false) + private String detail; + + /** + * 单位 + */ + @Excel(name = "单位", sort = 7) + private String materialUnit; + + @TableField(exist = false) + private String ifStringCode; + + /** + * 物资大类id + */ + @Excel(name = "大类", sort = 5) + private String materialBigClass; + + /** + * 物资小类id + */ + @Excel(name = "小类", sort = 6) + private String materialSmallClass; + + /** + * SN绑定 + */ + @Excel(name = "SN绑定", sort = 8) + private String snCode; + + /** + * 物资数量 + */ + @Excel(name = "申请数量", sort = 9) + @TableField(exist = false) + private String sum; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsOrderLog.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsOrderLog.java new file mode 100644 index 0000000000000000000000000000000000000000..e244d9b0707c58fc11286339b93a8563d8a693fc --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsOrderLog.java @@ -0,0 +1,114 @@ +package com.ruoyi.cmcc_gm.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * 物资工单日志表 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@Data +@TableName("yw_materials_order_log") +public class YwMaterialsOrderLog implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 工单号 + */ + private String orderId; + + /** + * 工单类型(更新中心库=1,申领=2,退库=3,工程出库=4,折旧入库=5,物资调拨=6) + */ + private Integer orderType; + + /** + * 工作流id + */ + private String flwProcessid; + + /** + * 申请人 + */ + private String applyName; + + /** + * 审核人 + */ + private String checkName; + + /** + * 入库人 + */ + private String inStoreName; + + /** + * 任务状态 + */ + private String taskStatus; + + /** + * 任务发起时间 + */ + private LocalDateTime taskStartTime; + + /** + * 入库场馆 + */ + private Long inStoreVenue; + + /** + * 出库场馆 + */ + private Long outStoreVenue; + + /** + * 拆布线工单号 + */ + private String wireTaskId; + + /** + * 上传文件路径 + */ + private String fileUrl; + + /** + * 上传文件名称 + */ + private String fileName; + + /** + * 申请人ID + */ + private Long applyId; + + /** + * 审核人ID + */ + private Long checkId; + + /** + * 入库人ID + */ + private Long inStoreId; + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsSnList.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsSnList.java new file mode 100644 index 0000000000000000000000000000000000000000..82697c59f61db8e15595f262dc685606365dcdbf --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsSnList.java @@ -0,0 +1,50 @@ +package com.ruoyi.cmcc_gm.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + *

+ * 物资编码串码对应表 + *

+ * + * @author jkj + * @since 2023-04-10 + */ +@Getter +@Setter +@TableName("yw_materials_list") +public class YwMaterialsSnList implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + private Long id; + + /** + * 工单号 + */ + private String orderid; + + /** + * 物资编码 + */ + private String materialCode; + + /** + * 串码 + */ + private String materialStrCode; + + + /** + * 操作类型 + */ + private Integer opType; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsStock.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsStock.java new file mode 100644 index 0000000000000000000000000000000000000000..e66fc42621f0d46aa70d2d51dbc5e400cefbfb4f --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/YwMaterialsStock.java @@ -0,0 +1,65 @@ +package com.ruoyi.cmcc_gm.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * 物资库存表 + *

+ * + * @author jkj + * @since 2023-04-06 + */ + +@Data +@TableName("yw_materials_stock") +public class YwMaterialsStock implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 物资库ID(场馆库对应venue_id,中心库对应一个特殊id比如-1 + */ + + private Long materialStoreId; + + /** + * 物资编码 + */ + private String materialCode; + + /** + * 可用数 + */ + private Integer availSum; + + /** + * 出库在途数 + */ + private Integer outWaySum; + + /** + * 入库在途数 + */ + private Integer inWaySum; + + /** + * 大场景id + */ + private Long sceneBigId; + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/BaseDTO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/BaseDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..d829cf6045bace6b5769ce4087251e758c8bc797 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/BaseDTO.java @@ -0,0 +1,12 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import lombok.Data; + +@Data +public class BaseDTO { + + private Integer pageNum; + + private Integer pageSize; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/TransformJsonArrayToMaterialsXlsDTO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/TransformJsonArrayToMaterialsXlsDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..6fe3a6ef25b5d7d2bd77773ace17ae8a92cc2aa4 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/TransformJsonArrayToMaterialsXlsDTO.java @@ -0,0 +1,12 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import com.ruoyi.cmcc_gm.domain.vo.MaterialsXlsToJsonArrayVo; +import lombok.Data; + +import java.util.List; + +@Data +public class TransformJsonArrayToMaterialsXlsDTO { + private List data; + private Long taskType; +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YmMaterialsClassesParam.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YmMaterialsClassesParam.java new file mode 100644 index 0000000000000000000000000000000000000000..abc124f4675387b9d712acdd3e261cae9247839e --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YmMaterialsClassesParam.java @@ -0,0 +1,22 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import lombok.Data; + +@Data +public class YmMaterialsClassesParam extends BaseDTO { + /** + * 序号 + */ + private Long id; + + /** + * 物资大类 + */ + private String bigClass; + + /** + * 物资小类 + */ + private String smallClass; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsBatchDTO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsBatchDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..3cc806736c20734f67d70fc3d86e3c98747fef24 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsBatchDTO.java @@ -0,0 +1,30 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import lombok.Data; + +import java.util.List; + +@Data +public class YwMaterialsBatchDTO { + + /** + * 工单号 + */ + private String orderId; + + /** + * 仓库号 + */ + private Long storeId; + + + /** + * 是否需要冻结 + */ + private Integer needfrozen; + + private List data; + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsDTO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..811e00277572fcc94241bec5bb2f0d89103fcb81 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsDTO.java @@ -0,0 +1,23 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import lombok.Data; + +@Data +public class YwMaterialsDTO { + + + //工单号 + private String orderId; + + //工单类型 + private Integer orderType; + + //操作步骤 1.提交申请 2.审核任务 3.出库确认 4.入库确认 + private String opType; + + //当前审核人 + private String auditor; + + + private String isBack; +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsInformDTO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsInformDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..40e6e8221438c32e565e2b9df8c84aa200cc56df --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsInformDTO.java @@ -0,0 +1,62 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + *

+ * 物资信息表 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +@Data +public class YwMaterialsInformDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 物资名称 + */ + private String materialName; + + /** + * 物资编码 + */ + private String materialCode; + + + /** + * 规格 + */ + private String materialStand; + + /** + * 单位 + */ + private String materialUnit; + + /** + * 物资大类id + */ + private String materialBigClass; + + /** + * 物资小类id + */ + private String materialSmallClass; + + /** + * SN绑定 + */ + private String snBand; + + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsOrderLogDTO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsOrderLogDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..2faa51f39d9e93b4c276b8ab507965636f4e59fa --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsOrderLogDTO.java @@ -0,0 +1,103 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 物资工单日志表 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@Data +public class YwMaterialsOrderLogDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 工单号 + */ + private String orderId; + + /** + * 工单类型(更新中心库=1,申领=2,退库=3,工程出库=4,折旧入库=5,物资调拨=6) + */ + private Integer orderType; + + /** + * 工作流id + */ + private String flwProcessid; + + /** + * 申请人 + */ + private String applyName; + + /** + * 审核人 + */ + private String checkName; + + /** + * 入库人 + */ + private String inStoreName; + + /** + * 任务状态 + */ + private String taskStatus; + + + /** + * 入库场馆 + */ + private Long inStoreVenue; + + /** + * 出库场馆 + */ + private Long outStoreVenue; + + /** + * 拆布线工单号 + */ + private String wireTaskId; + + + /** + * 上传文件路径 + */ + private String fileUrl; + + + /** + * 上传文件名称 + */ + private String fileName; + + /** + * 申请人ID + */ + private Long applyId; + + /** + * 审核人ID + */ + private Long checkId; + + /** + * 入库人ID + */ + private Long inStoreId; + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsSearchDTO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsSearchDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..d27d5cc0b88d24ce6dee1e5e2345de749fa84706 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsSearchDTO.java @@ -0,0 +1,74 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import lombok.Data; + +@Data +public class YwMaterialsSearchDTO extends BaseDTO { + + + //工单号 + private String orderId; + + //工单类型 + private Integer orderType; + + //任务状态 + private String taskStatus; + + //查询日期 + private String searchDate; + + //查询某个仓库 + private Long storeId; + + //查询入库仓库 + private Long inStoreId; + + //查询出库仓库 + private Long outStoreId; + + //查询入库仓库 + private Long [] inStoreIds; + + //查询出库仓库 + private Long [] outStoreIds; + + //查询多个仓库 + private Long [] storeIds; + + private String flwId; + + /** + * 物资编码 + */ + private String materialCode; + + /** + * 物资名称 + */ + private String materialName; + + + /** + * 规格 + */ + private String materialStand; + + + /** + * 物资大类id + */ + private String materialBigClass; + + + /** + * SN绑定 + */ + private String snCode; + + /** + * 物资小类id + */ + private String materialSmallClass; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsSnListDTO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsSnListDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..db0443b697e73e97686b2effc51e081f5f4f5a8b --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsSnListDTO.java @@ -0,0 +1,32 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsSnList; +import lombok.Data; + +import java.util.List; + +@Data +public class YwMaterialsSnListDTO { + + /** + * 工单号 + */ + private String orderId; + + /** + * 物资编码 + */ + private String materialCode; + + /** + * 操作类型 + */ + private Integer opType; + + + private List data; + + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsStockImportDTO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsStockImportDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..43664acca1734565cd40634bb5de33a7132e7bdf --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/dto/YwMaterialsStockImportDTO.java @@ -0,0 +1,84 @@ +package com.ruoyi.cmcc_gm.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.Data; + +/** + * @author los + */ +@Data +public class YwMaterialsStockImportDTO extends ResultBean { + + /** + * rowId + */ + @TableField(exist = false) + private String rowId; + + /** + * 物资编码 + */ + @Excel(name = "物资编号", sort = 2) + private String materialCode; + + /** + * 专业 + */ + @TableField(exist = false) + private String special; + + /** + * 物资大类id + */ + @Excel(name = "大类", sort = 5) + private String materialBigClass; + + /** + * 物资小类id + */ + @Excel(name = "小类", sort = 6) + private String materialSmallClass; + + /** + * 厂家 + */ + private String factory; + + /** + * 物资名称 + */ + @Excel(name = "物资名称", sort = 3) + private String materialName; + + /** + * 规格 + */ + @Excel(name = "规格型号", sort = 4) + private String materialStand; + + /** + * 详情 + */ + @TableField(exist = false) + private String detail; + + /** + * 单位 + */ + @Excel(name = "单位", sort = 7) + private String materialUnit; + + /** + * SN绑定 + */ + private String snCode; + + /** + * 物资数量 + */ + @Excel(name = "申请数量", sort = 8) + @TableField(exist = false) + private String availSum; +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/qo/YwMaterialsSnListQO.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/qo/YwMaterialsSnListQO.java new file mode 100644 index 0000000000000000000000000000000000000000..896a59fc188507ec5701e6297bdb8b965e3792a1 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/qo/YwMaterialsSnListQO.java @@ -0,0 +1,26 @@ +package com.ruoyi.cmcc_gm.domain.qo; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsSnList; +import lombok.Data; + +import java.util.List; + +@Data +public class YwMaterialsSnListQO { + + /** + * 工单号 + */ + private String orderId; + + /** + * 物资编码 + */ + private String materialCode; + + /** + * 操作类型 + */ + private Integer opType; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/MaterialsXlsToJsonArrayVo.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/MaterialsXlsToJsonArrayVo.java new file mode 100644 index 0000000000000000000000000000000000000000..c445c213bfc43b02952bb750577d833fa93f2858 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/MaterialsXlsToJsonArrayVo.java @@ -0,0 +1,36 @@ +package com.ruoyi.cmcc_gm.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.Data; + +/** + * @author los + */ +@Data +public class MaterialsXlsToJsonArrayVo extends ResultBean { + @Excel(name = "序号", sort = 1) + private String id; + @Excel(name = "物资名称", sort = 3) + private String materialName; + @Excel(name = "规格型号", sort = 4) + private String materialStand; + @Excel(name = "物资编号", sort = 2) + private String materialCode; + @Excel(name = "SN绑定", sort = 8) + private String snCode; + @Excel(name = "大类", sort = 6) + private String materialBigClass; + @Excel(name = "小类", sort = 7) + private String materialSmallClass; + @Excel(name = "可领数量", sort = 9) + private String availSum; + @Excel(name = "申请数量", sort = 10) + private String sum; + @Excel(name = "出库数量", sort = 10) + private String outSum; + @Excel(name = "入库数量", sort = 11) + private String inSum; + @Excel(name = "操作", sort = 12) + private String operation; +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsBatchVo.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsBatchVo.java new file mode 100644 index 0000000000000000000000000000000000000000..7930f4f1d6a9b3d19da47acf5f6a1ca373ba971c --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsBatchVo.java @@ -0,0 +1,49 @@ +package com.ruoyi.cmcc_gm.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + *

+ * 物资批次表 + *

+ * + * @author jkj + * @since 2023-04-10 + */ +@Data +public class YwMaterialsBatchVo extends YwMaterialsInformVo implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 工单号 + */ + private String orderid; + + /** + * 可用数量 + */ + private Integer availSum; + + /** + * 申领数量 + */ + private Integer sum; + + /** + * 出库数量 + */ + private Integer outSum; + + /** + * 出库数量 + */ + private Integer inSum; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsClassesVo.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsClassesVo.java new file mode 100644 index 0000000000000000000000000000000000000000..60db76c08c29778ddc3cc2eda104cb31852dae0d --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsClassesVo.java @@ -0,0 +1,35 @@ +package com.ruoyi.cmcc_gm.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@Data +public class YwMaterialsClassesVo implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 物资大类 + */ + private String bigClass; + + /** + * 物资小类 + */ + private String smallClass; + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsExportVo.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsExportVo.java new file mode 100644 index 0000000000000000000000000000000000000000..4bbb1b699dc60c01bc8167f5c20cee83c13b7e31 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsExportVo.java @@ -0,0 +1,105 @@ +package com.ruoyi.cmcc_gm.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + * @author los + */ +@Data +public class YwMaterialsExportVo { + /** + * 物资库ID(场馆库对应venue_id,中心库对应一个特殊id比如0 + */ + private Long materialStoreId; + /** + * 仓库名称 + */ + @Excel(name = "仓库名称", type = Excel.Type.EXPORT, sort = 1) + private String materialStoreName; + /** + * 物资编码 + */ + @Excel(name = "物资编号", type = Excel.Type.EXPORT, sort = 2) + private String materialCode; + /** + * 可用数 + */ + @Excel(name = "可领取数", type = Excel.Type.EXPORT, sort = 10) + private Integer availSum; + + /** + * 出库在途数 + */ + @Excel(name = "冻结数", type = Excel.Type.EXPORT, sort = 11) + private Integer outWaySum; + + /** + * 入库在途数 + */ + @Excel(name = "在途数", type = Excel.Type.EXPORT, sort = 12) + private Integer inWaySum; + /** + * 物资名称 + */ + @Excel(name = "物资名称", type = Excel.Type.EXPORT, sort = 3) + private String materialName; + /** + * 规格 + */ + @Excel(name = "规格型号", type = Excel.Type.EXPORT, sort = 4) + private String materialStand; + + /** + * 单位 + */ + @Excel(name = "单位", type = Excel.Type.EXPORT, sort = 8) + private String materialUnit; + + /** + * SN绑定 + */ + @Excel(name = "SN绑定", type = Excel.Type.EXPORT, sort = 9) + private String snCode; + + /** + * 库存数 + */ + @Excel(name = "库存数", type = Excel.Type.EXPORT, sort = 13) + @TableField(exist = false) + private Integer storeSum; + + + /** + * 中心库入库数量 + */ + @Excel(name = "中心库导入数", type = Excel.Type.EXPORT, sort = 14) + private Integer zxkInSum; + + /** + * 申领数量 + */ + @Excel(name = "申领数", type = Excel.Type.EXPORT, sort = 15) + private Integer slSum; + + /** + * 退库数量 + */ + @Excel(name = "退库数", type = Excel.Type.EXPORT, sort = 16) + private Integer tkSum; + + + /** + * 物资大类id + */ + @Excel(name = "大类", type = Excel.Type.EXPORT, sort = 5) + private String materialBigClass; + + /** + * 物资小类id + */ + @Excel(name = "小类", type = Excel.Type.EXPORT, sort = 6) + private String materialSmallClass; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsInformRedisVo.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsInformRedisVo.java new file mode 100644 index 0000000000000000000000000000000000000000..cb673010b7ce9eca0922a51f8e8e5ebf6d116c53 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsInformRedisVo.java @@ -0,0 +1,53 @@ +package com.ruoyi.cmcc_gm.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + *

+ * 物资信息表 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +@Data +public class YwMaterialsInformRedisVo implements Serializable { + + /** + * 物资编号 + */ + private String wzbh; + + /** + * 物资名称 + */ + private String wzmc; + + /** + * 规格 + */ + private String ggxh; + + /** + * 物资单位 + */ + private String wzdw; + + /** + * 物资大类id + */ + private String dl; + + /** + * 物资小类id + */ + private String xl; + + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsInformVo.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsInformVo.java new file mode 100644 index 0000000000000000000000000000000000000000..c938def7d4bae0435820d4f77a49d130805e98c6 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsInformVo.java @@ -0,0 +1,74 @@ +package com.ruoyi.cmcc_gm.domain.vo; + +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 com.ruoyi.common.annotation.Excel; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; + +/** + *

+ * 物资信息表 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +@Data +public class YwMaterialsInformVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + private Long id; + + /** + * 物资名称 + */ + @Excel(name = "物资名称") + private String materialName; + + /** + * 物资编码 + */ + private String materialCode; + + /** + * 规格 + */ + @Excel(name = "规格") + private String materialStand; + + /** + * 单位 + */ + @Excel(name = "单位") + private String materialUnit; + + /** + * 物资大类id + */ + @Excel(name = "物资大类") + private String materialBigClass; + + /** + * 物资小类id + */ + @Excel(name = "物资小类") + private String materialSmallClass; + + /** + * SN绑定 + */ + @Excel(name = "SN绑定") + private String snCode; + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsOrderLogVo.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsOrderLogVo.java new file mode 100644 index 0000000000000000000000000000000000000000..eb522e151b96f539851464259ee3039fc74fa80e --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsOrderLogVo.java @@ -0,0 +1,160 @@ +package com.ruoyi.cmcc_gm.domain.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 物资工单日志表 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@Data +public class YwMaterialsOrderLogVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 工单号 + */ + @Excel(name = "工单号", type = Excel.Type.EXPORT) + private String orderId; + + /** + * 入库场馆名称 + */ + @Excel(name = "场馆", type = Excel.Type.EXPORT) + private String inVenueName; + + /** + * 出库场馆名称 + */ + @Excel(name = "场馆", type = Excel.Type.EXPORT) + private String outVenueName; + + /** + * 出库场馆名称 + */ + @Excel(name = "调出库", type = Excel.Type.EXPORT) + private String outVenue2Name; + + /** + * 入库场馆名称 + */ + @Excel(name = "调入库", type = Excel.Type.EXPORT) + private String inVenue2Name; + + /** + * 拆布线工单号 + */ + @Excel(name = "布线项目号", type = Excel.Type.EXPORT) + private String wireTaskId; + + /** + * 任务发起时间 + */ + @Excel(name = "申请时间", type = Excel.Type.EXPORT, dateFormat = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime taskStartTime; + + /** + * 申请人 + */ + @Excel(name = "申请人", type = Excel.Type.EXPORT) + private String applyName; + + /** + * 审核人 + */ + @Excel(name = "审核人", type = Excel.Type.EXPORT) + private String checkName; + + /** + * 入库人 + */ + @Excel(name = "入库人", type = Excel.Type.EXPORT) + private String inStoreName; + + /** + * 出库人 + */ + @Excel(name = "出库人", type = Excel.Type.EXPORT) + @TableField(exist = false) + private String outStoreName; + + /** + * 任务状态 + */ + @Excel(name = "工单状态", type = Excel.Type.EXPORT) + private String taskStatus; + + private String dealStatus; + + /** + * 工单类型(更新中心库=1,申领=2,退库=3,工程出库=4,折旧入库=5,物资调拨=6) + */ + private Integer orderType; + private String orderTypeName; + + /** + * 工作流id + */ + private String flwProcessid; + + /** + * 工作流任务id + */ + private String taskId; + + /** + * 入库场馆 + */ + private Long inStoreVenue; + + /** + * 出库场馆 + */ + private Long outStoreVenue; + + /** + * 申请人ID + */ + private Long applyId; + + /** + * 审核人ID + */ + private Long checkId; + + /** + * 入库人ID + */ + private Long inStoreId; + + /** + * 上传文件路径 + */ + private String fileUrl; + + /** + * 上传文件名称 + */ + private String fileName; + + + private Integer materialNum; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsSnListVo.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsSnListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..bcde038922e9f2e60b7074af4216aaf37b9c4ea5 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsSnListVo.java @@ -0,0 +1,31 @@ +package com.ruoyi.cmcc_gm.domain.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 物资编码串码对应表 + *

+ * + * @author jkj + * @since 2023-04-10 + */ +@Data +public class YwMaterialsSnListVo extends YwMaterialsInformVo implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 工单号 + */ + private String orderid; + + /** + * 串码 + */ + private String materialStrCode; + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsVo.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsVo.java new file mode 100644 index 0000000000000000000000000000000000000000..776b5e7f42d4363c89495c78b01c0199bc8028f0 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/domain/vo/YwMaterialsVo.java @@ -0,0 +1,68 @@ +package com.ruoyi.cmcc_gm.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 物资库存表 + *

+ * + * @author jkj + * @since 2023-04-06 + */ + +@Data +public class YwMaterialsVo extends YwMaterialsInformVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 物资库ID(场馆库对应venue_id,中心库对应一个特殊id比如0 + */ + private Long materialStoreId; + + /** + * 仓库名称 + */ + private String materialStoreName; + + /** + * 可用数 + */ + private Integer availSum; + + /** + * 出库在途数 + */ + private Integer outWaySum; + + /** + * 入库在途数 + */ + private Integer inWaySum; + + /** + * 出入库统计数 + */ + private Integer statisSum; + + /** + * 中心库入库数量 + */ + private Integer zxkInSum; + + /** + * 申领数量 + */ + private Integer slSum; + + /** + * 退库数量 + */ + private Integer tkSum; + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsBatch.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsBatch.java new file mode 100644 index 0000000000000000000000000000000000000000..62d43d322148e8c36ae4a0b4711fde9f99e3b124 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsBatch.java @@ -0,0 +1,133 @@ +package com.ruoyi.cmcc_gm.importer; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsBatchMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsInformMapper; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@RequiredArgsConstructor +public class ImporterMaterialsBatch extends ImporterBase implements YwBatchAddService { + + private final YwMaterialsBatchMapper ywMaterialsBatchMapper; + + private final YwMaterialsInformMapper ywMaterialsInformMapper; + + private String materialCode; + private String materialName; + private String materialStand; + + { + cellFormatBeans.add(new CellFormatBean("物资编号", "materialCode", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("物资名称", "materialName", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("规格型号", "materialStand", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("大类", "materialBigClass", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("小类", "materialSmallClass", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("单位", "materialUnit", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("SN绑定", "snCode", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("数量", "sum", "false", "", "true", "nonNegative", "", "", "", "")); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + List ywMaterialsInforms = ywMaterialsInformMapper.selectByMaterialNameAndMaterialStandAndMaterialCode(materialName, materialStand, materialCode); + if (CollectionUtils.isEmpty(ywMaterialsInforms)) { + reasonL.append("物资编号&物资名称&规格型号不存在于物资配置表。"); + } + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @param j + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + if ("materialCode".equals(format.getColumnEn())) { + materialCode = s; + } else if ("materialName".equals(format.getColumnEn())) { + materialName = s; + } else if ("materialStand".equals(format.getColumnEn())) { + materialStand = s; + } + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + //导入 + List ywMaterialsBatchList = new ArrayList<>(); + for (YwMaterialsInform ywMaterialsInform : datas) { + YwMaterialsBatch ywMaterialsBatch = new YwMaterialsBatch(); + ywMaterialsBatch.setMaterialCode(ywMaterialsInform.getMaterialCode()); + ywMaterialsBatch.setOrderid((String) args[0]); + ywMaterialsBatch.setSum(Integer.parseInt(ywMaterialsInform.getSum())); + ywMaterialsBatchList.add(ywMaterialsBatch); + } + ywMaterialsBatchMapper.deleteByOrderid((String) args[0]); + add(ywMaterialsBatchList); + } + + /** + * 实现类提供具体插入方法 + * + * @param collect + */ + @Override + public void insertB(List collect) { + ywMaterialsBatchMapper.insertBatch(collect); + } +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsInform.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsInform.java new file mode 100644 index 0000000000000000000000000000000000000000..364f3fbaafd1497978e31f609e616bab62b2c306 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsInform.java @@ -0,0 +1,174 @@ +package com.ruoyi.cmcc_gm.importer; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsClasses; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformVo; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsClassesMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsInformMapper; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RequiredArgsConstructor +@Slf4j +public class ImporterMaterialsInform extends ImporterBase { + + private final YwMaterialsClassesMapper ywMaterialsClassesMapper; + + private final YwMaterialsInformMapper ywMaterialsInformMapper; + + private String bigClass; + private String smallClass; + + private String materialCode; + + private List> materialCodeList = new ArrayList<>(); + + private String materialName; + + private String materialStand; + + { + cellFormatBeans.add(new CellFormatBean("物资编号", "materialCode", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("物资名称", "materialName", "false", "", "", "", "", "", "true")); + cellFormatBeans.add(new CellFormatBean("规格型号", "materialStand", "false", "", "", "", "", "", "true")); + cellFormatBeans.add(new CellFormatBean("大类", "materialBigClass", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("小类", "materialSmallClass", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("单位", "materialUnit", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("SN绑定", "snCode", "", "", "", "", "", "是,否", "")); + + this.setHiddenResultColumns(new String[]{"sum"}); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + if (isNotEmpty(bigClass) && isNotEmpty(smallClass)) { + List list = ywMaterialsClassesMapper.selectByBigClassAndSmallClass(bigClass, smallClass); + if (CollectionUtils.isEmpty(list)) { + reasonL.append("大类+小类的组合不在类型配置表中。"); + } + } + for (Map stringObjectMap : materialCodeList) { + if (materialCode.equals(stringObjectMap.get("materialCode")) && i != (Integer) stringObjectMap.get("row")) { + reasonL.append("物资编号重复。"); + } + } + if (isNotEmpty(materialName) && isNotEmpty(materialStand)) { + List ywMaterialsInforms = ywMaterialsInformMapper.selectByMaterialNameAndMaterialStand(materialName, materialStand); + if (!CollectionUtils.isEmpty(ywMaterialsInforms)) { + if (ywMaterialsInforms.size() > 1) { + reasonL.append("物资名称和规格型号已存在物资配置表中。"); + } else { + YwMaterialsInform ywMaterialsInform = ywMaterialsInforms.get(0); + if (!materialCode.equals(ywMaterialsInform.getMaterialCode())) { + reasonL.append("物资名称和规格型号已存在物资配置表中。"); + } + } + } + } + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @param j + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + if ("materialBigClass".equals(format.getColumnEn())) { + bigClass = s; + } else if ("materialSmallClass".equals(format.getColumnEn())) { + smallClass = s; + } else if ("materialName".equals(format.getColumnEn())) { + materialName = s; + } else if ("materialStand".equals(format.getColumnEn())) { + materialStand = s; + } else if ("materialCode".equals(format.getColumnEn())) { + materialCode = s; + Map map = new HashMap<>(); + map.put("row", i); + map.put("materialCode", materialCode); + materialCodeList.add(map); + } + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + @Transactional + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + + + if(args.length>0) + { + if((boolean)args[0]==true) + { + ywMaterialsInformMapper.deleteNotExistsStock(); + } + } + + for (YwMaterialsInform data : datas) { + YwMaterialsSearchDTO ywMaterialsSearchDTO = new YwMaterialsSearchDTO(); + ywMaterialsSearchDTO.setMaterialCode(data.getMaterialCode()); + List ywMaterialsInformVos = ywMaterialsInformMapper.selectMaterialsInfo(ywMaterialsSearchDTO); + if (CollectionUtils.isEmpty(ywMaterialsInformVos)) { + ywMaterialsInformMapper.insert(data); + } else { + data.setId(ywMaterialsInformVos.get(0).getId()); + ywMaterialsInformMapper.updateById(data); + } + } + } +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsReturnList.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsReturnList.java new file mode 100644 index 0000000000000000000000000000000000000000..963e3f4745b33ab5cabd3f4b4eb317adf91542f4 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsReturnList.java @@ -0,0 +1,158 @@ +package com.ruoyi.cmcc_gm.importer; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.cmcc_gm.domain.YwMaterialsClasses; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.ruoyi.cmcc_gm.domain.vo.MaterialsXlsToJsonArrayVo; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsClassesMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsInformMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsStockMapper; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +@Slf4j +@RequiredArgsConstructor +public class ImporterMaterialsReturnList extends ImporterBase { + + private final YwMaterialsClassesMapper ywMaterialsClassesMapper; + private final YwMaterialsStockMapper ywMaterialsStockMapper; + private final YwMaterialsInformMapper ywMaterialsInformMapper; + + private String bigClass; + private String smallClass; + + private String materialCode; + private String materialName; + private String materialStand; + + private String sum; + + { + setHiddenResultColumns(new String[]{"id", "availSum", "outSum", "inSum", "operation"}); + cellFormatBeans.add(new CellFormatBean("物资编号", "materialCode", "false", "", "", "", "", "", "true")); + cellFormatBeans.add(new CellFormatBean("物资名称", "materialName", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("规格型号", "materialStand", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("大类", "materialBigClass", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("小类", "materialSmallClass", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("SN绑定", "snCode", "false", "", "", "", "", "是,否", "")); + cellFormatBeans.add(new CellFormatBean("申请数量", "sum", "false", "", "true", "nonNegative", "", "", "", "")); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + if (isNotEmpty(bigClass) && isNotEmpty(smallClass)) { + List list = ywMaterialsClassesMapper.selectByBigClassAndSmallClass(bigClass, smallClass); + if (CollectionUtils.isEmpty(list)) { + reasonL.append("大类+小类的组合不在类型配置表中。"); + } + } + if (isNotEmpty(sum) && isNotEmpty(materialCode)) { + String name; + Long materialId = (Long) args[0]; + // 物资折旧入库不需要判断物资是否存在和库存数 + if (materialId != -1L) { + if (materialId == 0L) { + name = "中心库"; + } else { + name = "场馆库"; + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YwMaterialsStock::getMaterialStoreId, materialId).eq(YwMaterialsStock::getMaterialCode, materialCode); + List list = ywMaterialsStockMapper.selectList(wrapper); + if (CollectionUtils.isEmpty(list)) { + reasonL.append(name).append("中不存在该物资。"); + } else { + wrapper.ge(YwMaterialsStock::getAvailSum, Integer.parseInt(sum)); + List list1 = ywMaterialsStockMapper.selectList(wrapper); + if (CollectionUtils.isEmpty(list1)) { + reasonL.append(name).append("中该物资库存数量不足。"); + } + } + } + } + if (isNotEmpty(materialName) && isNotEmpty(materialStand) && isNotEmpty(materialCode)) { + List ywMaterialsInforms = ywMaterialsInformMapper.selectByMaterialNameAndMaterialStandAndMaterialCode(materialName, materialStand, materialCode); + if (CollectionUtils.isEmpty(ywMaterialsInforms)) { + reasonL.append("物资编号+物资名称+规格型号不存在于物资配置表。"); + } + } + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @param j + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + if ("materialBigClass".equals(format.getColumnEn())) { + bigClass = s; + } else if ("materialSmallClass".equals(format.getColumnEn())) { + smallClass = s; + } else if ("materialCode".equals(format.getColumnEn())) { + materialCode = s; + } else if ("sum".equals(format.getColumnEn())) { + sum = s; + } else if ("materialName".equals(format.getColumnEn())) { + materialName = s; + } else if ("materialStand".equals(format.getColumnEn())) { + materialStand = s; + } + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + + } +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsStock.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsStock.java new file mode 100644 index 0000000000000000000000000000000000000000..530eaf4954dcbacbcb8c684062be3390432f1967 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/importer/ImporterMaterialsStock.java @@ -0,0 +1,187 @@ +package com.ruoyi.cmcc_gm.importer; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.domain.YwMaterialsClasses; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsStockImportDTO; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsClassesMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsInformMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsStockMapper; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@RequiredArgsConstructor +public class ImporterMaterialsStock extends ImporterBase implements YwBatchAddService { + + private final YwMaterialsStockMapper ywMaterialsStockMapper; + + private final YwMaterialsClassesMapper ywMaterialsClassesMapper; + + private final YwMaterialsInformMapper ywMaterialsInformMapper; + + private String bigClass; + private String smallClass; + private String materialCode; + private String materialName; + private String materialStand; + + { + cellFormatBeans.add(new CellFormatBean("物资编号", "materialCode", "false", "", "", "", "", "", "true")); + cellFormatBeans.add(new CellFormatBean("物资名称", "materialName", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("规格型号", "materialStand", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("大类", "materialBigClass", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("小类", "materialSmallClass", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("单位", "materialUnit", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("数量", "availSum", "false", "", "true", "nonNegative", "", "", "", "")); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + if (isNotEmpty(bigClass) && isNotEmpty(smallClass)) { + List list = ywMaterialsClassesMapper.selectByBigClassAndSmallClass(bigClass, smallClass); + if (CollectionUtils.isEmpty(list)) { + reasonL.append("大类+小类的组合不在类型配置表中。"); + } + } + if (isNotEmpty(materialCode) && isNotEmpty(materialName) && isNotEmpty(materialStand)) { + List ywMaterialsInforms = ywMaterialsInformMapper.selectByMaterialNameAndMaterialStandAndMaterialCode(materialName, materialStand, materialCode); + if (CollectionUtils.isEmpty(ywMaterialsInforms)) { + reasonL.append("物资编号+物资名称+规格型号的组合不在物资配置表中。"); + } + } + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @param j + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + if ("materialBigClass".equals(format.getColumnEn())) { + bigClass = s; + } else if ("materialSmallClass".equals(format.getColumnEn())) { + smallClass = s; + } else if ("materialCode".equals(format.getColumnEn())) { + materialCode = s; + } else if ("materialName".equals(format.getColumnEn())) { + materialName = s; + } else if ("materialStand".equals(format.getColumnEn())) { + materialStand = s; + } + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + if ("0".equals(importType)) { + ywMaterialsStockMapper.deleteByMaterialStoreId((Long) args[0]); + List list = new ArrayList<>(); + for (YwMaterialsStockImportDTO data : datas) { + YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); + ywMaterialsStock.setMaterialCode(data.getMaterialCode()); + ywMaterialsStock.setMaterialStoreId((Long) args[0]); + ywMaterialsStock.setAvailSum(Integer.parseInt(data.getAvailSum())); + ywMaterialsStock.setInWaySum(0); + ywMaterialsStock.setOutWaySum(0); + ywMaterialsStock.setSceneBigId(sceneBigId); + list.add(ywMaterialsStock); + } + add(list); + } else if ("1".equals(importType)) { + for (YwMaterialsStockImportDTO data : datas) { + // 1 新增 2 修改 + Integer opType; + Integer availSumOld = null; + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwMaterialsStock::getMaterialCode, data.getMaterialCode()).eq(YwMaterialsStock::getMaterialStoreId, args[0]); + YwMaterialsStock ywMaterialsStock = ywMaterialsStockMapper.selectOne(queryWrapper); + if (ObjectUtils.isNotEmpty(ywMaterialsStock)) { + availSumOld = ywMaterialsStock.getAvailSum(); + opType = 2; + } else { + opType = 1; + } + YwMaterialsStock y = new YwMaterialsStock(); + if (opType == 1) { + y.setMaterialCode(data.getMaterialCode()); + y.setMaterialStoreId((Long) args[0]); + y.setAvailSum(Integer.parseInt(data.getAvailSum())); + y.setInWaySum(0); + y.setOutWaySum(0); + y.setSceneBigId(sceneBigId); + ywMaterialsStockMapper.insert(y); + } else if (opType == 2) { + y.setAvailSum(Integer.parseInt(data.getAvailSum()) + availSumOld); + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(YwMaterialsStock::getMaterialStoreId, args[0]).eq(YwMaterialsStock::getMaterialCode, data.getMaterialCode()); + ywMaterialsStockMapper.update(y, queryWrapper1); + } + } + } + } + + /** + * 实现类提供具体插入方法 + * + * @param collect + */ + @Override + public void insertB(List collect) { + ywMaterialsStockMapper.insertBatch(collect); + } +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsBatchMapper.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsBatchMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..39f5b3da1295cacd9d2b398179b4118fa6ccd3f1 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsBatchMapper.java @@ -0,0 +1,34 @@ +package com.ruoyi.cmcc_gm.mapper; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsBatchVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 物资批次表 Mapper 接口 + *

+ * + * @author jkj + * @since 2023-04-10 + */ +public interface YwMaterialsBatchMapper extends BaseMapper { + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + int updateBatch(@Param("orderId") String orderId,@Param("entities") List entities); + + List selectBatch(@Param("orderid") String orderid); + + int deleteByOrderid(@Param("orderid") String orderid); + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsClassesMapper.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsClassesMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..3d0ed2b55ce5df185f73215b8cd5ab62e2e82ed7 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsClassesMapper.java @@ -0,0 +1,31 @@ +package com.ruoyi.cmcc_gm.mapper; +import org.apache.ibatis.annotations.Param; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsClasses; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsClassesVo; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsVo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@Mapper +public interface YwMaterialsClassesMapper extends BaseMapper { + + List selectMaterialClass(); + + List selectByBigClassAndSmallClass(@Param("bigClass") String bigClass, @Param("smallClass") String smallClass); + + List listAllByBigClassAndSmallClass(@Param("bigClass") String bigClass, @Param("smallClass") String smallClass); + + public void cleanMaterialClass(); + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsInformMapper.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsInformMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..4fac2680d0485b2be312f147907844aa77ee4f12 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsInformMapper.java @@ -0,0 +1,37 @@ +package com.ruoyi.cmcc_gm.mapper; +import java.util.Collection; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 物资信息表 Mapper 接口 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +public interface YwMaterialsInformMapper extends BaseMapper { + + List selectByMaterialNameAndMaterialStand(@Param("materialName") String materialName, @Param("materialStand") String materialStand); + + List selectByMaterialNameAndMaterialStandAndMaterialCode(@Param("materialName") String materialName, @Param("materialStand") String materialStand, @Param("materialCode") String materialCode); + + List selectMaterialsInfo(YwMaterialsSearchDTO ywMaterialsSearchDTO); + + @InterceptorIgnore(blockAttack = "true") + int delete(); + + int insertBatch(@Param("ywMaterialsInformCollection") Collection ywMaterialsInformCollection); + + List listAll(YwMaterialsSearchDTO ywMaterialsSearchDTO); + + int deleteNotExistsStock(); +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsOrderLogMapper.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsOrderLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..85543b583d677c8aa4a18308a975fccd0ed33ed8 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsOrderLogMapper.java @@ -0,0 +1,30 @@ +package com.ruoyi.cmcc_gm.mapper; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsOrderLogVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 物资工单日志表 Mapper 接口 + *

+ * + * @author jkj + * @since 2023-04-07 + */ + +public interface YwMaterialsOrderLogMapper extends BaseMapper { + + List selectMaterialsOrderLog(YwMaterialsSearchDTO ywMaterialsSearchDTO); + + List selectOrderMaterialsNumLog(@Param("materialStoreId") Long storeId,@Param("materialCode") String materialCode); + + + Long selectCheckUserIdByFlwId(@Param("flwId") String flwId); + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsSnListMapper.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsSnListMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..b2b96d54528a3b22a958753bc507f6882b1a0d46 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsSnListMapper.java @@ -0,0 +1,32 @@ +package com.ruoyi.cmcc_gm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsSnList; +import com.ruoyi.cmcc_gm.domain.qo.YwMaterialsSnListQO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsBatchVo; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 物资批次表 Mapper 接口 + *

+ * + * @author jkj + * @since 2023-04-10 + */ +public interface YwMaterialsSnListMapper extends BaseMapper { + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertSnList(@Param("entities") List entities); + + List selectSnList(YwMaterialsSnListQO ywMaterialsSnListQO); + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsStockMapper.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsStockMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..904a128b040d77cf068415db100be8c722a866d4 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/mapper/YwMaterialsStockMapper.java @@ -0,0 +1,44 @@ +package com.ruoyi.cmcc_gm.mapper; +import org.apache.ibatis.annotations.Param; +import java.util.Collection; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsVo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + *

+ * 物资库存表 Mapper 接口 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +@Mapper +public interface YwMaterialsStockMapper extends BaseMapper { + + + public List getYwMaterial(YwMaterialsSearchDTO ywMaterialsSearchDTO); + + /** + * 批量插入 + * + * @param ywMaterialsStockCollection + * @return + */ + int insertBatch(@Param("ywMaterialsStockCollection") Collection ywMaterialsStockCollection); + + /** + * 根据大场景id和materialStoreId删除 + * + * @param materialStoreId + * @return + */ + int deleteByMaterialStoreId(@Param("materialStoreId") Long materialStoreId); + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/GMCommonService.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/GMCommonService.java new file mode 100644 index 0000000000000000000000000000000000000000..e5a4097d2bfc6efd5c7710ce5034d974d8597fe6 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/GMCommonService.java @@ -0,0 +1,7 @@ +package com.ruoyi.cmcc_gm.service; + +public interface GMCommonService { + + String getJobNo(String type); + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsBatchService.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsBatchService.java new file mode 100644 index 0000000000000000000000000000000000000000..fa77cf443fd2a0074c6b4c04f8c91a5d24a1f801 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsBatchService.java @@ -0,0 +1,33 @@ +package com.ruoyi.cmcc_gm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsBatchDTO; +import com.ruoyi.common.core.domain.AjaxResult; + +import java.io.File; +import java.util.List; + +/** + * 物资批次表(YwMaterialsBatch)表服务接口 + * + * @author makejava + * @since 2023-04-10 15:39:19 + */ +public interface YwMaterialsBatchService extends IService { + + AjaxResult importExcel(String orderId, List y, File file) throws Exception; + + Boolean deleteBatch(YwMaterialsBatchDTO ywMaterialsBatchDTO); + + Boolean deleteBatchALL(YwMaterialsBatchDTO ywMaterialsBatchDTO); + + Boolean insertBatch(YwMaterialsBatchDTO ywMaterialsBatchDTO); + + Boolean updateBatch(YwMaterialsBatch ywMaterialsBatch); + + Boolean updateBatchInner(YwMaterialsBatch ywMaterialsBatch); + +} + diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsClassesService.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsClassesService.java new file mode 100644 index 0000000000000000000000000000000000000000..fd08610debf956b75682266be3a71c0e9a12f93a --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsClassesService.java @@ -0,0 +1,38 @@ +package com.ruoyi.cmcc_gm.service; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsClasses; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.cmcc_gm.domain.dto.YmMaterialsClassesParam; +import com.ruoyi.common.core.domain.AjaxResult; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +public interface YwMaterialsClassesService extends IService { + + public void loadingMaterialsClassesCache(); + + Map GetMaterialsClasses(); + + List getMaterialsBySearch(YmMaterialsClassesParam ywMaterialsClasses); + + /** + * 核查大小类是否在物资信息中已经使用 + * + * @param ywMaterialsClasses 大小类 + * @return 是否 + */ + boolean checkClassesInUse(YwMaterialsClasses ywMaterialsClasses); + + + AjaxResult importMaterialsClasses(List ywMaterialsClasses, Boolean updateSupport); + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsInformService.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsInformService.java new file mode 100644 index 0000000000000000000000000000000000000000..c64aa7519826d85bdeccc8a95de2669584515706 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsInformService.java @@ -0,0 +1,52 @@ +package com.ruoyi.cmcc_gm.service; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsInformDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformRedisVo; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformVo; +import com.ruoyi.common.core.domain.AjaxResult; + +import java.util.List; + + +/** + *

+ * 物资信息表 服务类 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +public interface YwMaterialsInformService extends IService { + + + void loadingMaterialsInfoCache(); + + List getMaterials(YwMaterialsSearchDTO ywMaterialsSearchDTO); + + List selectMaterials(YwMaterialsSearchDTO ywMaterialsSearchDTO); + + List getMaterials(); + + Boolean insertMaterials(YwMaterialsInformDTO ywMaterialsInformDTO); + + Boolean updateMaterials(YwMaterialsInformDTO ywMaterialsInformDTO); + + Boolean deleteMaterials(YwMaterialsInformDTO ywMaterialsInformDTO); + + int deleteNotExistsMaterials(); + + /** + * 导入 + * + * @param informs 数据 + * @return + */ + AjaxResult doImport(List informs) throws Exception; + + AjaxResult doImport(List informs,boolean delNotUse) throws Exception; + + List getMaterialsBySearch(YwMaterialsSearchDTO ywMaterialsInform); +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsOrderLogService.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsOrderLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..a90d9bfa3ad7c6e81582a0ad231e792deac0ad68 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsOrderLogService.java @@ -0,0 +1,33 @@ +package com.ruoyi.cmcc_gm.service; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsOrderLogDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsOrderLogVo; +import com.ruoyi.common.core.page.TableDataInfo; + +import java.util.List; + +/** + *

+ * 物资工单日志表 服务类 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +public interface YwMaterialsOrderLogService extends IService { + + String insertMaterialsOrderLog(YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO); + + Boolean updateMaterialsOrderLog(YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO); + + Boolean updateMaterialsOrderLogInner(YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO); + + Boolean deleteMaterialsOrderLog(YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO); + + TableDataInfo getMaterialsOrderLog(YwMaterialsSearchDTO ywMaterialsSearchDTO); + + List selectMaterialsOrderLog(YwMaterialsSearchDTO ywMaterialsSearchDTO); +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsSnListService.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsSnListService.java new file mode 100644 index 0000000000000000000000000000000000000000..1aa900f7c2e45a733de7439063c36a0d0f7b3f2c --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsSnListService.java @@ -0,0 +1,32 @@ +package com.ruoyi.cmcc_gm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.YwMaterialsSnList; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsBatchDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSnListDTO; +import com.ruoyi.cmcc_gm.domain.qo.YwMaterialsSnListQO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsBatchVo; +import com.ruoyi.common.core.domain.AjaxResult; + +import java.io.File; +import java.util.List; + +/** + * 出入库串码(YwMaterialsSnList)表服务接口 + * + * @author makejava + * @since 2023-04-10 15:39:19 + */ +public interface YwMaterialsSnListService extends IService { + + + Boolean deleteSnListALL(String orderId); + + Boolean insertSnList(YwMaterialsSnListDTO ywMaterialsSnListDTO); + + List selectSnList(YwMaterialsSnListQO ywMaterialsSnListQO); + +} + diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsStockService.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsStockService.java new file mode 100644 index 0000000000000000000000000000000000000000..b856aecdf8ae04ef146a670eec026a96d3085cc6 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/YwMaterialsStockService.java @@ -0,0 +1,71 @@ +package com.ruoyi.cmcc_gm.service; + +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.cmcc_gm.domain.dto.*; +import com.ruoyi.cmcc_gm.domain.vo.MaterialsXlsToJsonArrayVo; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsVo; +import com.ruoyi.common.core.domain.AjaxResult; + +import java.util.List; + +/** + *

+ * 物资库存表 服务类 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +public interface YwMaterialsStockService extends IService { + + List getMaterialsStock(YwMaterialsSearchDTO ywMaterialsSearchDTO); + + Boolean freezeOutWayMaterialsStock(YwMaterialsDTO ywMaterialsDTO, YwMaterialsOrderLog ywMaterialsOrderLog); + + Boolean freezeOutWayMaterialsStock(YwMaterialsBatchDTO ywMaterialsBatchDTO); + + Boolean freezeOutWayMaterialsStockBack(YwMaterialsBatchDTO ywMaterialsBatchDTO); + + Boolean freezeOutWayMaterialsStockBack(YwMaterialsDTO ywMaterialsDTO, YwMaterialsOrderLog ywMaterialsOrderLog); + + Boolean updateInWayMaterialsStock(YwMaterialsDTO ywMaterialsDTO); + + Boolean updateInWayMaterialsStockBack(YwMaterialsDTO ywMaterialsDTO); + + Boolean updateMaterialsStock(YwMaterialsDTO ywMaterialsDTO); + + Boolean updateMaterialsStockBack(YwMaterialsDTO ywMaterialsDTO); + + Boolean updateFreezeOutWayMaterialsStock(YwMaterialsDTO ywMaterialsDTO); + + Boolean updateFreezeOutWayMaterialsStockBack(YwMaterialsDTO ywMaterialsDTO); + + YwMaterialsOrderLog Validate(YwMaterialsDTO ywMaterialsDTO); + + int insertMaterialsStock(YwMaterialsStock ywMaterialsStock); + + int updateMaterialsStock(YwMaterialsStock ywMaterialsStock); + + /** + * 导入 + * + * @param beans 数据 + * @param sceneBigId 大场景id + * @param importType 导入方式 + * @param materialStoreId materialStoreId + * @return 导入结果 + */ + AjaxResult importXls(List beans, Long sceneBigId, String importType, Long materialStoreId) throws Exception; + + /** + * 导入,返回List + * + * @param xls 数据 + * @param sceneId + * @return 导入的数据 + * @throws Exception 异常 + */ + AjaxResult importXlsReturnList(List xls, Long sceneId) throws Exception; +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/GMCommonServiceImpl.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/GMCommonServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9f64f390157325d74c7b7e9f8e0d6ad36a985629 --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/GMCommonServiceImpl.java @@ -0,0 +1,50 @@ +package com.ruoyi.cmcc_gm.service.impl; + +import com.ruoyi.cmcc_gm.service.GMCommonService; +import com.ruoyi.common.core.redis.RedisCache; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.concurrent.TimeUnit; + +@Component +public class GMCommonServiceImpl implements GMCommonService { + + @Autowired + private RedisCache redisCache; + + @Override + public String getJobNo(String type) { + String date = new SimpleDateFormat("yyyyMMdd").format(new Date()); + String key = type + date; + + if (redisCache.hasKey(key)) { + String value = redisCache.getCacheObject(key).toString(); + String[] split = value.split("-"); + if (split.length == 3) { + int i = Integer.parseInt(split[2]) + 1; + String num = String.format("%04d", i); + if(type.equals("ZXK")) + { + num = String.format("%02d", i); + } + String v = split[0] + "-" + split[1] + "-" + num; + redisCache.setCacheObject(key,v,1, TimeUnit.DAYS); + return v; + } + } + String value = ""; + if(type.equals("ZXK")) + { + value = type + "-" + date + "-" + "01"; + } + if(!type.equals("ZXK")) + { + value = type + "-" + date + "-" + "0001"; + } + redisCache.setCacheObject(key,value,1, TimeUnit.DAYS); + return value; + } +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsBatchServiceImpl.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsBatchServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..597802d1777f1c50fb64e9fb213511cfe636f0ca --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsBatchServiceImpl.java @@ -0,0 +1,314 @@ +package com.ruoyi.cmcc_gm.service.impl; + +import cn.hutool.core.io.FileUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.cmcc_gm.common.enums.OrderStatus; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsBatchDTO; +import com.ruoyi.cmcc_gm.importer.ImporterMaterialsBatch; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsBatchMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsInformMapper; +import com.ruoyi.cmcc_gm.service.YwMaterialsBatchService; +import com.ruoyi.cmcc_gm.service.YwMaterialsOrderLogService; +import com.ruoyi.cmcc_gm.service.YwMaterialsStockService; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.utils.StringUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * 物资批次表(YwMaterialsBatch)表服务实现类 + * + * @author makejava + * @since 2023-04-10 15:39:20 + */ +@Service("ywMaterialsBatchService") +@RequiredArgsConstructor +public class YwMaterialsBatchServiceImpl extends ServiceImpl implements YwMaterialsBatchService { + + private final YwMaterialsInformMapper ywMaterialsInformMapper; + private final YwMaterialsBatchMapper ywMaterialsBatchMapper; + + @Autowired + private YwMaterialsOrderLogService ywMaterialsOrderLogService; + + @Autowired + private YwMaterialsStockService ywMaterialsStockService; + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importExcel(String orderId, List y, File file) throws Exception { + + ImporterBase importer = new ImporterMaterialsBatch(ywMaterialsBatchMapper, ywMaterialsInformMapper); + AjaxResult ajaxResult = importer.doAdd(y, null, "", orderId); + if (HttpStatus.ACCEPTED == (int) ajaxResult.get(AjaxResult.CODE_TAG)) { + String s = (String) ajaxResult.get(AjaxResult.DATA_TAG); + File src = new File(RuoYiConfig.getDownloadPath() + s); + if (src.exists()) { + FileUtil.copy(src, file, true); + } + return new AjaxResult(HttpStatus.ACCEPTED, "导入失败"); + } else { + return ajaxResult; + } + } + + @Override + @Transactional + public Boolean deleteBatch(YwMaterialsBatchDTO ywMaterialsBatchDTO) { + + if (StringUtils.isEmpty(ywMaterialsBatchDTO.getOrderId())) { + throw new ServiceException("物资订单号不能为空"); + } + + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(YwMaterialsOrderLog::getOrderId, ywMaterialsBatchDTO.getOrderId()); + + List listOrder = ywMaterialsOrderLogService.list(query); + + if (listOrder.isEmpty()) { + throw new ServiceException("物资订单不存在"); + } + + YwMaterialsOrderLog orderLog = listOrder.get(0); + + if (!orderLog.getTaskStatus().equals("0")) { + throw new ServiceException("当前物资订单状态不允许删除申领数据"); + } + + LambdaQueryWrapper queryBatch = new LambdaQueryWrapper<>(); + queryBatch.eq(YwMaterialsBatch::getOrderid, ywMaterialsBatchDTO.getOrderId()); + + if (ywMaterialsBatchDTO.getData().size() > 0) { + + List listBatch = ywMaterialsBatchMapper.selectList(queryBatch); + + if (listBatch.isEmpty()) { + return true; + } + + List backBatchs = new ArrayList<>(); + + for (YwMaterialsBatch delBatch : ywMaterialsBatchDTO.getData()) { + for (YwMaterialsBatch existsBatch : listBatch) { + if (delBatch.getMaterialCode().equals(existsBatch.getMaterialCode())) { + + backBatchs.add(existsBatch); + + } + } + } + + ywMaterialsBatchDTO.setData(backBatchs); + + //释放库存数 + ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsBatchDTO); + } + + int res = 0; + + if (!ywMaterialsBatchDTO.getData().isEmpty()) { + + for (YwMaterialsBatch batch : ywMaterialsBatchDTO.getData()) { + LambdaQueryWrapper deleteBatch = new LambdaQueryWrapper<>(); + + deleteBatch.eq(YwMaterialsBatch::getOrderid, ywMaterialsBatchDTO.getOrderId()); + deleteBatch.eq(YwMaterialsBatch::getMaterialCode, batch.getMaterialCode()); + + res = ywMaterialsBatchMapper.delete(deleteBatch); + + if (res == 0) { + throw new ServiceException("删除申领数据失败"); + } + } + } + + if (res > 0) { + return true; + } + + return false; + + } + + @Override + @Transactional + public Boolean deleteBatchALL(YwMaterialsBatchDTO ywMaterialsBatchDTO) { + + LambdaQueryWrapper queryBatch = new LambdaQueryWrapper<>(); + queryBatch.eq(YwMaterialsBatch::getOrderid, ywMaterialsBatchDTO.getOrderId()); + + YwMaterialsBatchDTO dto = new YwMaterialsBatchDTO(); + + dto.setStoreId(ywMaterialsBatchDTO.getStoreId()); + dto.setOrderId(ywMaterialsBatchDTO.getOrderId()); + + List listBatch = ywMaterialsBatchMapper.selectList(queryBatch); + dto.setData(listBatch); + + if (dto.getData().isEmpty()) { + return true; + } + +//驳回的同时,释放了库存,这里就不需要再次释放库存 +// if (ywMaterialsBatchDTO.getStoreId() >= 0) +// { +// if (dto.getData().size() > 0) { +// //释放库存数 +// Boolean r = ywMaterialsStockService.freezeOutWayMaterialsStockBack(dto); +// } +// } + + int res = ywMaterialsBatchMapper.delete(queryBatch); + + if (res > 0) { + return true; + } + + return false; + } + + @Override + @Transactional + public Boolean insertBatch(YwMaterialsBatchDTO ywMaterialsBatchDTO) { + + if (StringUtils.isEmpty(ywMaterialsBatchDTO.getOrderId())) { + throw new ServiceException("物资订单号不能为空"); + } + + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(YwMaterialsOrderLog::getOrderId, ywMaterialsBatchDTO.getOrderId()); + + List listOrder = ywMaterialsOrderLogService.list(query); + + if (listOrder.isEmpty()) { + throw new ServiceException("物资订单不存在"); + } + + YwMaterialsOrderLog order = listOrder.get(0); + + if (!order.getTaskStatus().equals(OrderStatus.DSQ.getCode())) { + throw new ServiceException("物资订单状态不是待申请"); + } + + Long outStore = order.getOutStoreVenue(); + + //设置出库仓库的仓库号 + ywMaterialsBatchDTO.setStoreId(outStore); + + List ywMaterialsBatchList = new ArrayList<>(); + + for (YwMaterialsBatch stockDTO : ywMaterialsBatchDTO.getData()) { + + if (StringUtils.isEmpty(stockDTO.getMaterialCode())) { + throw new ServiceException("物资编号不能为空"); + } + + if (outStore >= 0) { + + if (ObjectUtils.isEmpty(stockDTO.getSum())) { + + throw new ServiceException("申领数量不能为空"); + } + + if (stockDTO.getSum() <= 0) { + throw new ServiceException("申领数量必须大于0"); + } + } + + YwMaterialsBatch ywMaterialsBatch = new YwMaterialsBatch(); + ywMaterialsBatch.setMaterialCode(stockDTO.getMaterialCode()); + ywMaterialsBatch.setOrderid(ywMaterialsBatchDTO.getOrderId()); + ywMaterialsBatch.setSum(stockDTO.getSum()); + ywMaterialsBatchList.add(ywMaterialsBatch); + + } + + //回滚冻结数和删除旧的批量数据 + this.deleteBatchALL(ywMaterialsBatchDTO); + + //默认是1 暂存传0 + if(ObjectUtils.isEmpty(ywMaterialsBatchDTO.getNeedfrozen())) + { + if (outStore >= 0) { + //冻结库存数,最后讨论还是放在这,把更新库存表的冻结去掉 + ywMaterialsStockService.freezeOutWayMaterialsStock(ywMaterialsBatchDTO); + } + } + + if(ObjectUtils.isNotEmpty(ywMaterialsBatchDTO.getNeedfrozen())) + { + if(ywMaterialsBatchDTO.getNeedfrozen() == 1) + { + if (outStore >= 0) { + //冻结库存数,最后讨论还是放在这,把更新库存表的冻结去掉 + ywMaterialsStockService.freezeOutWayMaterialsStock(ywMaterialsBatchDTO); + } + } + } + + int res = ywMaterialsBatchMapper.insertBatch(ywMaterialsBatchList); + + if (res > 0) { + return true; + } + + return false; + + } + + // 存一下出入库的数据量,用于显示 + @Override + public Boolean updateBatch(YwMaterialsBatch ywMaterialsBatch) { + + if (StringUtils.isEmpty(ywMaterialsBatch.getOrderid())) { + throw new ServiceException("物资订单号不能为空"); + } + + if (StringUtils.isEmpty(ywMaterialsBatch.getMaterialCode())) { + throw new ServiceException("物资编号不能为空"); + } + + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(YwMaterialsOrderLog::getOrderId, ywMaterialsBatch.getOrderid()); + List listOrder = ywMaterialsOrderLogService.list(query); + + if (listOrder.isEmpty()) { + throw new ServiceException("物资订单不存在"); + } + + return this.updateBatchInner(ywMaterialsBatch); + + } + + @Override + public Boolean updateBatchInner(YwMaterialsBatch ywMaterialsBatch) { + + LambdaQueryWrapper condition = new LambdaQueryWrapper<>(); + condition.eq(YwMaterialsBatch::getOrderid, ywMaterialsBatch.getOrderid()); + condition.eq(YwMaterialsBatch::getMaterialCode, ywMaterialsBatch.getMaterialCode()); + int res = ywMaterialsBatchMapper.update(ywMaterialsBatch, condition); + + if (res > 0) { + return true; + } + + return false; + } + +} + diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsClassesServiceImpl.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsClassesServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..31a7c4c5228410c4119f7a876383378cc6ee1dec --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsClassesServiceImpl.java @@ -0,0 +1,182 @@ +package com.ruoyi.cmcc_gm.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.domain.YwMaterialsClasses; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.dto.YmMaterialsClassesParam; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsClassesVo; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsClassesMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsInformMapper; +import com.ruoyi.cmcc_gm.service.YwMaterialsClassesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.spring.SpringUtils; +import org.apache.commons.collections4.ListUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.PostConstruct; +import java.util.*; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@Service +public class YwMaterialsClassesServiceImpl extends ServiceImpl implements YwMaterialsClassesService { + + @Autowired + private YwMaterialsClassesMapper ywMaterialsClassesMapper; + + @Autowired + private YwMaterialsInformMapper ywMaterialsInformMapper; + + @Autowired + private RedisCache redisCache; + + + private String key = CacheConstants.YW_MATERIALS_CLASS; + + /** + * 项目启动时,初始化参数到缓存 + */ + @PostConstruct + public void init() { + loadingMaterialsClassesCache(); + } + + @Override + public void loadingMaterialsClassesCache() { + + List list = ywMaterialsClassesMapper.selectMaterialClass(); + + Map dictDataMap = new HashMap<>(); + + for (YwMaterialsClassesVo ywMaterialsClassesVo : list) { + String[] smallClasses = ywMaterialsClassesVo.getSmallClass().split(","); + dictDataMap.put(ywMaterialsClassesVo.getBigClass(), smallClasses); + } + + redisCache.setCacheObject(key, dictDataMap); + + } + + @Override + public Map GetMaterialsClasses() { + + if (redisCache.hasKey(key)) { + try { + Map res = redisCache.getCacheObject(key); + if (ObjectUtils.isEmpty(res)) { + throw new Exception(); + } + return res; + } catch (Exception ex) { + + List list = ywMaterialsClassesMapper.selectMaterialClass(); + + Map dictDataMap = new HashMap<>(); + + for (YwMaterialsClassesVo ywMaterialsClassesVo : list) { + String[] smallClasses = ywMaterialsClassesVo.getSmallClass().split(","); + dictDataMap.put(ywMaterialsClassesVo.getBigClass(), smallClasses); + } + + redisCache.setCacheObject(key, dictDataMap); + + return dictDataMap; + + } + } + + List list = ywMaterialsClassesMapper.selectMaterialClass(); + + Map dictDataMap = new HashMap<>(); + + for (YwMaterialsClassesVo ywMaterialsClassesVo : list) { + String[] smallClasses = ywMaterialsClassesVo.getSmallClass().split(","); + dictDataMap.put(ywMaterialsClassesVo.getBigClass(), smallClasses); + } + + redisCache.setCacheObject(key, dictDataMap); + + return dictDataMap; + + } + + @Override + public List getMaterialsBySearch(YmMaterialsClassesParam ywMaterialsClasses) { + return ywMaterialsClassesMapper.listAllByBigClassAndSmallClass(ywMaterialsClasses.getBigClass(), ywMaterialsClasses.getSmallClass()); + } + + /** + * 核查大小类是否在物资信息中已经使用 + * + * @param ywMaterialsClasses 大小类 + * @return 是否 + */ + @Override + public boolean checkClassesInUse(YwMaterialsClasses ywMaterialsClasses) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YwMaterialsInform::getMaterialBigClass, ywMaterialsClasses.getBigClass()) + .eq(YwMaterialsInform::getMaterialSmallClass, ywMaterialsClasses.getSmallClass()); + Long aLong = ywMaterialsInformMapper.selectCount(wrapper); + return aLong > 0; + } + + @Override + @Transactional + public AjaxResult importMaterialsClasses(List lstMaterialsClasses, Boolean updateSupport) { + if (StringUtils.isNull(lstMaterialsClasses) || lstMaterialsClasses.size() == 0) { + throw new ServiceException("导入数据不能为空!"); + } + + // 核查数据 + boolean checkFlag = true; + + for (int i = 0; i < lstMaterialsClasses.size() - 1; i++) { + for (int j = i + 1; j < lstMaterialsClasses.size(); j++) { + if (lstMaterialsClasses.get(i).getBigClass().equals(lstMaterialsClasses.get(j).getBigClass()) && + lstMaterialsClasses.get(i).getSmallClass().equals(lstMaterialsClasses.get(j).getSmallClass()) + ) { + lstMaterialsClasses.get(i).setReason("存在重复"); + lstMaterialsClasses.get(j).setReason("存在重复"); + checkFlag = false; + break; + } + } + } + + if (!checkFlag) { + ExcelUtil util = new ExcelUtil<>(YwMaterialsClasses.class); + String fileName = (String) util.exportExcel(lstMaterialsClasses, "签到导入结果").get(AjaxResult.MSG_TAG); + return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + } + + try { + ywMaterialsClassesMapper.cleanMaterialClass(); + for (YwMaterialsClasses materialsClasses : lstMaterialsClasses) { + ywMaterialsClassesMapper.insert(materialsClasses); + } + } catch (Exception ex) { + throw new ServiceException(ex.getMessage()); + } + + return AjaxResult.success(); + + } + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsInformServiceImpl.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsInformServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ae5eb0dd0db5d954ab68ebec25442b93a2f95b9e --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsInformServiceImpl.java @@ -0,0 +1,333 @@ +package com.ruoyi.cmcc_gm.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsInformDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformRedisVo; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformVo; +import com.ruoyi.cmcc_gm.importer.ImporterMaterialsInform; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsClassesMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsInformMapper; +import com.ruoyi.cmcc_gm.service.YwMaterialsInformService; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.PostConstruct; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 物资信息表 服务实现类 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +@Service +public class YwMaterialsInformServiceImpl extends ServiceImpl implements YwMaterialsInformService { + + + @Autowired + private YwMaterialsInformMapper ywMaterialsInformMapper; + + @Autowired + private YwMaterialsClassesMapper ywMaterialsClassesMapper; + + @Autowired + private RedisCache redisCache; + + private String key = CacheConstants.YW_MATERIALS_INFO; + + @PostConstruct + public void init() { + loadingMaterialsInfoCache(); + } + + @Override + public void loadingMaterialsInfoCache() { + + List list = ywMaterialsInformMapper.selectList(null); + + List listVo = new ArrayList<>(); + + for (YwMaterialsInform inform : list) { + YwMaterialsInformRedisVo ywMaterialsRedis = new YwMaterialsInformRedisVo(); + ywMaterialsRedis.setWzmc(inform.getMaterialName()); + ywMaterialsRedis.setGgxh(inform.getMaterialStand()); + ywMaterialsRedis.setDl(inform.getMaterialBigClass()); + ywMaterialsRedis.setXl(inform.getMaterialSmallClass()); + ywMaterialsRedis.setWzbh(inform.getMaterialCode()); + ywMaterialsRedis.setWzdw(inform.getMaterialUnit()); + listVo.add(ywMaterialsRedis); + } + + + redisCache.setCacheObject(key, listVo); + + } + + @Override + public List getMaterials(YwMaterialsSearchDTO ywMaterialsSearchDTO) { + + YwMaterialsInform ywMaterialsInform = new YwMaterialsInform(); + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + //物资编号 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywMaterialsSearchDTO.getMaterialCode()), YwMaterialsInform::getMaterialCode, ywMaterialsSearchDTO.getMaterialCode()); + + //物资名称 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywMaterialsSearchDTO.getMaterialName()), YwMaterialsInform::getMaterialName, ywMaterialsSearchDTO.getMaterialName()); + + //规格型号 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywMaterialsSearchDTO.getMaterialStand()), YwMaterialsInform::getMaterialStand, ywMaterialsSearchDTO.getMaterialStand()); + + //是否绑定SN + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywMaterialsSearchDTO.getSnCode()), YwMaterialsInform::getSnCode, ywMaterialsSearchDTO.getSnCode()); + + List list = ywMaterialsInformMapper.selectList(lambdaQueryWrapper); + + List listVo = new ArrayList<>(); + + for (YwMaterialsInform inform : list) { + YwMaterialsInformVo ywMaterialsInformVo = new YwMaterialsInformVo(); + BeanUtils.copyBeanProp(ywMaterialsInformVo, inform); + listVo.add(ywMaterialsInformVo); + } + + return listVo; + + } + + @Override + public List selectMaterials(YwMaterialsSearchDTO ywMaterialsSearchDTO) { + return ywMaterialsInformMapper.selectMaterialsInfo(ywMaterialsSearchDTO); + } + + @Override + public List getMaterials() { + + if (redisCache.hasKey(key)) { + try { + List res = redisCache.getCacheObject(key); + if (ObjectUtils.isEmpty(res)) { + throw new Exception(); + } + return res; + } catch (Exception ex) { + + List list = ywMaterialsInformMapper.selectList(null); + + List listVo = new ArrayList<>(); + + for (YwMaterialsInform inform : list) { + YwMaterialsInformRedisVo ywMaterialsRedis = new YwMaterialsInformRedisVo(); + + ywMaterialsRedis.setWzmc(inform.getMaterialName()); + ywMaterialsRedis.setGgxh(inform.getMaterialStand()); + ywMaterialsRedis.setDl(inform.getMaterialBigClass()); + ywMaterialsRedis.setXl(inform.getMaterialSmallClass()); + listVo.add(ywMaterialsRedis); + } + + redisCache.setCacheObject(key, listVo); + + return listVo; + + } + } + + List list = ywMaterialsInformMapper.selectList(null); + + List listVo = new ArrayList<>(); + + for (YwMaterialsInform inform : list) { + YwMaterialsInformRedisVo ywMaterialsRedis = new YwMaterialsInformRedisVo(); + ywMaterialsRedis.setWzmc(inform.getMaterialName()); + ywMaterialsRedis.setGgxh(inform.getMaterialStand()); + ywMaterialsRedis.setDl(inform.getMaterialBigClass()); + ywMaterialsRedis.setXl(inform.getMaterialSmallClass()); + listVo.add(ywMaterialsRedis); + } + + redisCache.setCacheObject(key, listVo); + + return listVo; + } + + @Override + public Boolean insertMaterials(YwMaterialsInformDTO ywMaterialsInformDTO) { + + Validate(ywMaterialsInformDTO, "add"); + + YwMaterialsInform ywMaterialsInform = new YwMaterialsInform(); + + BeanUtils.copyBeanProp(ywMaterialsInform, ywMaterialsInformDTO); + + if (ywMaterialsInformMapper.insert(ywMaterialsInform) > 0) { + //新增成功后,更新下物资的缓存 + loadingMaterialsInfoCache(); + return true; + } + + return false; + } + + @Override + public Boolean updateMaterials(YwMaterialsInformDTO ywMaterialsInformDTO) { + + Validate(ywMaterialsInformDTO, "edit"); + + YwMaterialsInform ywMaterialsInform = new YwMaterialsInform(); + + BeanUtils.copyBeanProp(ywMaterialsInform, ywMaterialsInformDTO); + + //物资编码不用改 + ywMaterialsInform.setMaterialCode(null); + + //修改条件 + LambdaQueryWrapper condition = new LambdaQueryWrapper<>(); + condition.eq(YwMaterialsInform::getMaterialCode, ywMaterialsInformDTO.getMaterialCode()); + + + if (ywMaterialsInformMapper.update(ywMaterialsInform, condition) > 0) { + //修改成功后,更新下物资的缓存 + loadingMaterialsInfoCache(); + return true; + } + + return false; + } + + @Override + public Boolean deleteMaterials(YwMaterialsInformDTO ywMaterialsInformDTO) { + + if (StringUtils.isEmpty(ywMaterialsInformDTO.getMaterialCode())) { + throw new ServiceException("物资编码不允许为空"); + } + + LambdaQueryWrapper condition = new LambdaQueryWrapper<>(); + condition.eq(YwMaterialsInform::getMaterialCode, ywMaterialsInformDTO.getMaterialCode()); + + if (ywMaterialsInformMapper.delete(condition) > 0) { + //删除成功后,更新下物资的缓存 + loadingMaterialsInfoCache(); + return true; + } + + return false; + } + + @Override + public int deleteNotExistsMaterials() { + return ywMaterialsInformMapper.deleteNotExistsStock(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult doImport(List informs) throws Exception { + ImporterBase importer = new ImporterMaterialsInform(ywMaterialsClassesMapper, ywMaterialsInformMapper); + AjaxResult ajaxResult = importer.doAdd(informs, null, null); + if (HttpStatus.SUCCESS == (int) ajaxResult.get(AjaxResult.CODE_TAG)) { + //导入成功后,更新下物资的缓存 + loadingMaterialsInfoCache(); + } else { + return ajaxResult; + } + return AjaxResult.success(); + } + + @Override + public AjaxResult doImport(List informs, boolean delNotUse) throws Exception { + ImporterBase importer = new ImporterMaterialsInform(ywMaterialsClassesMapper, ywMaterialsInformMapper); + AjaxResult ajaxResult = null; + if(delNotUse) + { + ajaxResult = importer.doAdd(informs, null, null, delNotUse); + } + else + { + ajaxResult = importer.doAdd(informs, null, null); + } + if (HttpStatus.SUCCESS == (int) ajaxResult.get(AjaxResult.CODE_TAG)) { + //导入成功后,更新下物资的缓存 + loadingMaterialsInfoCache(); + } else { + return ajaxResult; + } + return AjaxResult.success(); + } + + @Override + public List getMaterialsBySearch(YwMaterialsSearchDTO ywMaterialsInform) { + return ywMaterialsInformMapper.listAll(ywMaterialsInform); + } + + void Validate(YwMaterialsInformDTO ywMaterialsInformDTO, String operType) { + if (StringUtils.isEmpty(ywMaterialsInformDTO.getMaterialName())) { + throw new ServiceException("物资名称不允许为空"); + } + + if (StringUtils.isEmpty(ywMaterialsInformDTO.getMaterialCode())) { + throw new ServiceException("物资编码不允许为空"); + } + + if (ObjectUtils.isEmpty(ywMaterialsInformDTO.getMaterialBigClass())) { + throw new ServiceException("大类不允许为空"); + } + + if (ObjectUtils.isEmpty(ywMaterialsInformDTO.getMaterialSmallClass())) { + throw new ServiceException("小类不允许为空"); + } + + if (StringUtils.isEmpty(ywMaterialsInformDTO.getMaterialStand())) { + throw new ServiceException("规格型号不允许为空"); + } + + if (StringUtils.isEmpty(ywMaterialsInformDTO.getMaterialUnit())) { + throw new ServiceException("单位型号不允许为空"); + } + + if (StringUtils.isEmpty(ywMaterialsInformDTO.getMaterialStand())) { + throw new ServiceException("规格型号不允许为空"); + } + + if (StringUtils.isEmpty(ywMaterialsInformDTO.getSnBand())) { + throw new ServiceException("SN绑定不允许为空"); + } + + //检查物资编号是否已经存在 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(YwMaterialsInform::getMaterialCode, ywMaterialsInformDTO.getMaterialCode()); + + YwMaterialsInform inform = ywMaterialsInformMapper.selectOne(query); + + if (operType.equals("add")) { + if (ObjectUtils.isNotEmpty(inform)) { + throw new ServiceException("物资编号已存在"); + } + } + + if (operType.equals("edit")) { + if (ObjectUtils.isEmpty(inform)) { + throw new ServiceException("物资编号不存在"); + } + } + + } + + +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsOrderLogServiceImpl.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsOrderLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..017687721a1b087f037ed984186ab5a9aa76341b --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsOrderLogServiceImpl.java @@ -0,0 +1,300 @@ +package com.ruoyi.cmcc_gm.service.impl; + +import cn.hutool.core.date.LocalDateTimeUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.cmcc_gm.common.enums.OrderStatus; +import com.ruoyi.cmcc_gm.common.enums.OrderType; +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsOrderLogDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsOrderLogVo; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsOrderLogMapper; +import com.ruoyi.cmcc_gm.service.GMCommonService; +import com.ruoyi.cmcc_gm.service.YwMaterialsOrderLogService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 物资工单日志表 服务实现类 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@Service +public class YwMaterialsOrderLogServiceImpl extends ServiceImpl implements YwMaterialsOrderLogService { + + + @Autowired + private YwMaterialsOrderLogMapper ywMaterialsOrderLogMapper; + + @Autowired + private GMCommonService commonService; + + @Override + public String insertMaterialsOrderLog(YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) { + + if(StringUtils.isNotEmpty(ywMaterialsOrderLogDTO.getWireTaskId())) + { + ywMaterialsOrderLogDTO.setWireTaskId(ywMaterialsOrderLogDTO.getWireTaskId().trim()); + } + + if(ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getOrderType())) + { + throw new ServiceException("工单类型不能为空"); + } + + if(ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getCheckName()) || ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getCheckId())) + { + throw new ServiceException("审核人不能为空"); + } + + if(ywMaterialsOrderLogDTO.getOrderType() == OrderType.ZXK.getCode() || ywMaterialsOrderLogDTO.getOrderType() == OrderType.TK.getCode()) + { + if(!ywMaterialsOrderLogDTO.getInStoreVenue().equals(0L)) + { + throw new ServiceException("中心库的库号不正确"); + } + } + + if(ywMaterialsOrderLogDTO.getOrderType() == OrderType.SL.getCode()) + { + if(!ywMaterialsOrderLogDTO.getOutStoreVenue().equals(0L)) + { + throw new ServiceException("中心库的库号不正确"); + } + } + + //根据工单类型生成工单号 + String type = OrderType.getAbbLabelByCode(ywMaterialsOrderLogDTO.getOrderType()); + + if(StringUtils.isEmpty(type)) + { + throw new ServiceException("工单类型不存在"); + } + + if(!ywMaterialsOrderLogDTO.getOrderType().equals(4)) { + if (ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getInStoreVenue())) { + throw new ServiceException("入库场馆不能为空"); + } + } + + if(!(ywMaterialsOrderLogDTO.getOrderType().equals(1) || ywMaterialsOrderLogDTO.getOrderType().equals(5))) + { + if(ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getOutStoreVenue())) + { + throw new ServiceException("出库场馆不能为空"); + } + } + + ywMaterialsOrderLogDTO.setOrderId(commonService.getJobNo(type)); + + if(ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getApplyName())) + { + ywMaterialsOrderLogDTO.setApplyId(SecurityUtils.getUserId()); + ywMaterialsOrderLogDTO.setApplyName(SecurityUtils.getLoginUser().getUser().getNickName()); + } + + YwMaterialsOrderLog ywMaterialsOrderLog=new YwMaterialsOrderLog(); + + BeanUtils.copyBeanProp(ywMaterialsOrderLog,ywMaterialsOrderLogDTO); + + ywMaterialsOrderLog.setTaskStatus(OrderStatus.DSQ.getCode()); + + ywMaterialsOrderLog.setTaskStartTime(LocalDateTimeUtil.now()); + + if(ywMaterialsOrderLogMapper.insert(ywMaterialsOrderLog)>0) + { + return ywMaterialsOrderLogDTO.getOrderId(); + } + + return ""; + + } + + @Override + public Boolean updateMaterialsOrderLog(YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) { + + if(StringUtils.isEmpty(ywMaterialsOrderLogDTO.getOrderId())) + { + throw new ServiceException("工单ID不能为空"); + } + + if(ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getOrderType())) + { + throw new ServiceException("工单类型不能为空"); + } + + QueryWrapper condition =new QueryWrapper<>(); + condition.eq("order_id",ywMaterialsOrderLogDTO.getOrderId()); + condition.eq("order_type",ywMaterialsOrderLogDTO.getOrderType()); + + YwMaterialsOrderLog ywMaterialsOrderLog=new YwMaterialsOrderLog(); + + if(ywMaterialsOrderLogDTO.getCheckId() != null) + { + ywMaterialsOrderLog.setCheckId(ywMaterialsOrderLogDTO.getCheckId()); + } + + if(StringUtils.isNotEmpty(ywMaterialsOrderLogDTO.getCheckName())) { + ywMaterialsOrderLog.setCheckName(ywMaterialsOrderLogDTO.getCheckName()); + } + + if(StringUtils.isNotEmpty(ywMaterialsOrderLogDTO.getFileUrl())) { + ywMaterialsOrderLog.setFileUrl(ywMaterialsOrderLogDTO.getFileUrl()); + } + + if(StringUtils.isNotEmpty(ywMaterialsOrderLogDTO.getFileName())) { + ywMaterialsOrderLog.setFileName(ywMaterialsOrderLogDTO.getFileName()); + } + + if(StringUtils.isNotEmpty(ywMaterialsOrderLogDTO.getFlwProcessid())) { + ywMaterialsOrderLog.setFlwProcessid(ywMaterialsOrderLogDTO.getFlwProcessid()); + } + + if(ywMaterialsOrderLogMapper.update(ywMaterialsOrderLog,condition)>0) + { + return true; + } + + return false; + } + + @Override + public Boolean updateMaterialsOrderLogInner(YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) { + + if(StringUtils.isEmpty(ywMaterialsOrderLogDTO.getOrderId())) + { + throw new ServiceException("工单ID不能为空"); + } + + if(ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getOrderType())) + { + throw new ServiceException("工单类型不能为空"); + } + + if(ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getTaskStatus())) + { + throw new ServiceException("任务状态不能为空"); + } + + QueryWrapper condition =new QueryWrapper<>(); + condition.eq("order_id",ywMaterialsOrderLogDTO.getOrderId()); + condition.eq("order_type",ywMaterialsOrderLogDTO.getOrderType()); + + YwMaterialsOrderLog ywMaterialsOrderLog=new YwMaterialsOrderLog(); + ywMaterialsOrderLog.setTaskStatus(ywMaterialsOrderLogDTO.getTaskStatus()); + + if(ywMaterialsOrderLogDTO.getInStoreId()!=null) + { + if(ywMaterialsOrderLogDTO.getInStoreId()>0) { + ywMaterialsOrderLog.setInStoreId(ywMaterialsOrderLogDTO.getInStoreId()); + } + else + { + ywMaterialsOrderLog.setInStoreId(null); + } + } + + if(ywMaterialsOrderLogDTO.getInStoreName()!=null) + { + ywMaterialsOrderLog.setInStoreName(ywMaterialsOrderLogDTO.getInStoreName()); + } + + if(ywMaterialsOrderLogMapper.update(ywMaterialsOrderLog,condition)>0) + { + return true; + } + + return false; + } + + @Override + public Boolean deleteMaterialsOrderLog(YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) { + + if(StringUtils.isEmpty(ywMaterialsOrderLogDTO.getOrderId())) + { + throw new ServiceException("工单ID不能为空"); + } + + if(ObjectUtils.isEmpty(ywMaterialsOrderLogDTO.getOrderType())) + { + throw new ServiceException("工单类型不能为空"); + } + + + QueryWrapper condition =new QueryWrapper<>(); + condition.eq("order_id",ywMaterialsOrderLogDTO.getOrderId()); + condition.eq("order_type",ywMaterialsOrderLogDTO.getOrderType()); + + if(ywMaterialsOrderLogMapper.delete(condition)>0) + { + return true; + } + + return false; + } + + @Override + public TableDataInfo getMaterialsOrderLog(YwMaterialsSearchDTO ywMaterialsSearchDTO) { + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.like(StringUtils.isNotEmpty(ywMaterialsSearchDTO.getOrderId()),YwMaterialsOrderLog::getOrderId, ywMaterialsSearchDTO.getOrderId()); + + lambdaQueryWrapper.eq(ObjectUtils.isNotEmpty(ywMaterialsSearchDTO.getOrderType()),YwMaterialsOrderLog::getOrderType, ywMaterialsSearchDTO.getOrderType()); + + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywMaterialsSearchDTO.getTaskStatus()),YwMaterialsOrderLog::getTaskStatus, ywMaterialsSearchDTO.getTaskStatus()); + + if(StringUtils.isNotEmpty(ywMaterialsSearchDTO.getSearchDate())) + { + lambdaQueryWrapper.between(YwMaterialsOrderLog::getTaskStartTime, LocalDateTime.parse(ywMaterialsSearchDTO.getSearchDate()+"T00:00:00"), LocalDateTime.parse(ywMaterialsSearchDTO.getSearchDate()+"T23:59:59")); + } + + TableDataInfo rspData = new TableDataInfo(); + Page page = ywMaterialsOrderLogMapper.selectPage(new Page<>(ywMaterialsSearchDTO.getPageNum(), ywMaterialsSearchDTO.getPageSize()), lambdaQueryWrapper); + + rspData.setRows(page.getRecords()); + rspData.setTotal(page.getTotal()); + + return rspData; + } + + @Override + public List selectMaterialsOrderLog(YwMaterialsSearchDTO ywMaterialsSearchDTO) { + +// 调拨传入-2,就显示全部场馆库 + if(ywMaterialsSearchDTO.getOrderType() == OrderType.DB.getCode()) + { + if (ywMaterialsSearchDTO.getInStoreId() == -2) { + ywMaterialsSearchDTO.setInStoreId(null); + } + if (ywMaterialsSearchDTO.getOutStoreId() == -2) { + ywMaterialsSearchDTO.setOutStoreId(null); + } + } + + // 前端绑定下拉框不好处理空字符串,传入all或者全部就置空 + if(StringUtils.isNotEmpty(ywMaterialsSearchDTO.getTaskStatus())) + { + if(ywMaterialsSearchDTO.getTaskStatus().equals("all")||ywMaterialsSearchDTO.getTaskStatus().equals("全部")) + { + ywMaterialsSearchDTO.setTaskStatus(""); + } + } + return ywMaterialsOrderLogMapper.selectMaterialsOrderLog(ywMaterialsSearchDTO); + } +} diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsSnListServiceImpl.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsSnListServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..94d4dc07f381a94df71c6b23f9aa634e9e46ce8b --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsSnListServiceImpl.java @@ -0,0 +1,208 @@ +package com.ruoyi.cmcc_gm.service.impl; +; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.ruoyi.cmcc_gm.domain.YwMaterialsSnList; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsBatchDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSnListDTO; +import com.ruoyi.cmcc_gm.domain.qo.YwMaterialsSnListQO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsBatchVo; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsBatchMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsSnListMapper; +import com.ruoyi.cmcc_gm.service.YwMaterialsBatchService; +import com.ruoyi.cmcc_gm.service.YwMaterialsOrderLogService; +import com.ruoyi.cmcc_gm.service.YwMaterialsSnListService; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.List; + +/** + * 物资批次表(YwMaterialsBatch)表服务实现类 + * + * @author makejava + * @since 2023-04-10 15:39:20 + */ +@Service("ywMaterialsSnListService") +@RequiredArgsConstructor +public class YwMaterialsSnListServiceImpl extends ServiceImpl implements YwMaterialsSnListService { + + private final YwMaterialsSnListMapper ywMaterialsSnListMapper; + private final YwMaterialsOrderLogService ywMaterialsOrderLogService; + + private final YwMaterialsBatchService ywMaterialsBatchService; + + + @Override + public Boolean deleteSnListALL(String orderId) { + + LambdaQueryWrapper querySn = new LambdaQueryWrapper<>(); + + querySn.eq(YwMaterialsSnList::getOrderid, orderId); + + List listSn = ywMaterialsSnListMapper.selectList(querySn); + + if(listSn.isEmpty()) + { + return true; + } + + int res = ywMaterialsSnListMapper.delete(querySn); + + if(res > 0) + { + return true; + } + + return false; + + } + + public Boolean deleteSnListALL(String orderId,String materialCode,Integer opType) { + + LambdaQueryWrapper querySn = new LambdaQueryWrapper<>(); + + querySn.eq(YwMaterialsSnList::getOrderid, orderId); + + querySn.eq(YwMaterialsSnList::getOpType,opType); + + querySn.eq(YwMaterialsSnList::getMaterialCode,materialCode); + + List listSn = ywMaterialsSnListMapper.selectList(querySn); + + if(listSn.isEmpty()) + { + return true; + } + + int res = ywMaterialsSnListMapper.delete(querySn); + + if(res > 0) + { + return true; + } + + throw new ServiceException("删除SN发生异常,稍后再试"); + + } + + + + @Override + @Transactional + public Boolean insertSnList(YwMaterialsSnListDTO ywMaterialsSnListDTO) { + + if (StringUtils.isEmpty(ywMaterialsSnListDTO.getOrderId())) { + throw new ServiceException("物资订单号不能为空"); + } + + if (ObjectUtils.isEmpty(ywMaterialsSnListDTO.getOpType())) { + throw new ServiceException("操作类型不能为空"); + } + + if (StringUtils.isEmpty(ywMaterialsSnListDTO.getMaterialCode())) { + throw new ServiceException("物资编号不能为空"); + } + + if(ywMaterialsSnListDTO.getOpType()!=0 && ywMaterialsSnListDTO.getOpType()!=1) + { + throw new ServiceException("操作类型不正确"); + } + + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(YwMaterialsOrderLog::getOrderId,ywMaterialsSnListDTO.getOrderId()); + + List listOrder = ywMaterialsOrderLogService.list(query); + + if (listOrder.isEmpty()) { + throw new ServiceException("物资订单不存在"); + } + + List ywMaterialsSnList = new ArrayList<>(); + + for (YwMaterialsSnList snDto : ywMaterialsSnListDTO.getData()) + { + + if (ObjectUtils.isEmpty(snDto.getMaterialStrCode())) { + throw new ServiceException("串码不能为空"); + } + + YwMaterialsSnList snList = new YwMaterialsSnList(); + snList.setOrderid(ywMaterialsSnListDTO.getOrderId()); + snList.setMaterialCode(ywMaterialsSnListDTO.getMaterialCode()); + snList.setOpType(ywMaterialsSnListDTO.getOpType()); + snList.setMaterialStrCode(snDto.getMaterialStrCode()); + ywMaterialsSnList.add(snList); + + + } + + try { + //删除旧的SN数据 + this.deleteSnListALL(ywMaterialsSnListDTO.getOrderId(), ywMaterialsSnListDTO.getMaterialCode(), ywMaterialsSnListDTO.getOpType()); + } + catch (Exception ex) + { + throw new ServiceException(ex.getMessage()); + } + + int res = 0; + + if(!ywMaterialsSnList.isEmpty()) { + res = ywMaterialsSnListMapper.insertSnList(ywMaterialsSnList); + } + + YwMaterialsBatch batch =new YwMaterialsBatch(); + + if(ywMaterialsSnListDTO.getOpType()==0) + { + batch.setOutSum(res); + } + if(ywMaterialsSnListDTO.getOpType()==1) + { + batch.setInSum(res); + } + + batch.setMaterialCode(ywMaterialsSnListDTO.getMaterialCode()); + batch.setOrderid(ywMaterialsSnListDTO.getOrderId()); + + ywMaterialsBatchService.updateBatchInner(batch); + + if(res>0) + { + return true; + } + + throw new ServiceException("修改数据失败"); + + } + + @Override + public List selectSnList(YwMaterialsSnListQO ywMaterialsSnListQO) { + + if(StringUtils.isEmpty(ywMaterialsSnListQO.getOrderId())) + { + throw new ServiceException("物资订单号不能为空"); + } + + if (ObjectUtils.isEmpty(ywMaterialsSnListQO.getOpType())) { + throw new ServiceException("操作类型不能为空"); + } + + if(StringUtils.isEmpty(ywMaterialsSnListQO.getMaterialCode())) + { + throw new ServiceException("物资编码不能为空"); + } + + return ywMaterialsSnListMapper.selectSnList(ywMaterialsSnListQO); + } + + +} + diff --git a/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsStockServiceImpl.java b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsStockServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..94eca5a954833b4ffdff43c8cb56c9d69373cd0f --- /dev/null +++ b/cmcc_gm/src/main/java/com/ruoyi/cmcc_gm/service/impl/YwMaterialsStockServiceImpl.java @@ -0,0 +1,1087 @@ +package com.ruoyi.cmcc_gm.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.cmcc_gm.common.enums.OrderStatus; +import com.ruoyi.cmcc_gm.common.enums.OrderType; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.ruoyi.cmcc_gm.domain.dto.*; +import com.ruoyi.cmcc_gm.domain.vo.MaterialsXlsToJsonArrayVo; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsVo; +import com.ruoyi.cmcc_gm.importer.ImporterMaterialsReturnList; +import com.ruoyi.cmcc_gm.importer.ImporterMaterialsStock; +import com.ruoyi.cmcc_gm.mapper.*; +import com.ruoyi.cmcc_gm.service.YwMaterialsOrderLogService; +import com.ruoyi.cmcc_gm.service.YwMaterialsStockService; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.FlowDealStatus; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 物资库存表 服务实现类 + *

+ * + * @author jkj + * @since 2023-04-06 + */ +@Service +public class YwMaterialsStockServiceImpl extends ServiceImpl implements YwMaterialsStockService { + + @Autowired + private YwMaterialsStockMapper ywMaterialsStockMapper; + + @Autowired + private YwMaterialsOrderLogService ywMaterialsOrderLogService; + + @Autowired + private YwMaterialsBatchMapper ywMaterialsBatchMapper; + + @Autowired + private YwMaterialsOrderLogMapper ywMaterialsOrderLogMapper; + + @Autowired + private YwMaterialsClassesMapper ywMaterialsClassesMapper; + + @Autowired + private YwMaterialsInformMapper ywMaterialsInformMapper; + + @Override + public List getMaterialsStock(YwMaterialsSearchDTO ywMaterialsSearchDTO) { + + return ywMaterialsStockMapper.getYwMaterial(ywMaterialsSearchDTO); + + } + + @Transactional + @Override + public Boolean freezeOutWayMaterialsStock(YwMaterialsDTO ywMaterialsDTO, YwMaterialsOrderLog ywMaterialsOrderLog) { + + Long outStoreVenue = ywMaterialsOrderLog.getOutStoreVenue(); + + if (outStoreVenue == null || outStoreVenue < 0) { + return true; + } + + if (!OrderStatus.DSQ.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + + //根据orderId查找批次数据 + List listMaterBat = ywMaterialsBatchMapper.selectList( + new LambdaQueryWrapper().eq(YwMaterialsBatch::getOrderid, ywMaterialsDTO.getOrderId()) + ); + + if (!listMaterBat.isEmpty()) { + YwMaterialsBatchDTO dto = new YwMaterialsBatchDTO(); + dto.setStoreId(outStoreVenue); + dto.setData(listMaterBat); + this.freezeOutWayMaterialsStock(dto); + } + + return true; + } + + @Transactional + @Override + public Boolean freezeOutWayMaterialsStock(YwMaterialsBatchDTO ywMaterialsBatchDTO) { + + for (YwMaterialsBatch stockDTO : ywMaterialsBatchDTO.getData()) { + LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); + + queryStock.eq(YwMaterialsStock::getMaterialStoreId, ywMaterialsBatchDTO.getStoreId()); + + queryStock.eq(YwMaterialsStock::getMaterialCode, stockDTO.getMaterialCode()); + + List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); + + //预处理,冻结要出库仓库的库存 + if (materialsStocks.isEmpty()) { + throw new ServiceException("出库仓库的物资库存不能为空"); + } + + if (materialsStocks.size() == 1) { + + YwMaterialsStock materialsStock = materialsStocks.get(0); + + if (materialsStock.getAvailSum() < stockDTO.getSum()) { + throw new ServiceException("出库仓库的物资库存数量不足"); + } + + YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); + + ywMaterialsStock.setMaterialStoreId(ywMaterialsBatchDTO.getStoreId()); + + ywMaterialsStock.setMaterialCode(stockDTO.getMaterialCode()); + + ywMaterialsStock.setAvailSum(materialsStock.getAvailSum() - stockDTO.getSum()); + + if (ObjectUtils.isEmpty(materialsStock.getOutWaySum())) { + ywMaterialsStock.setOutWaySum(stockDTO.getSum()); + } + + if (ObjectUtils.isNotEmpty(materialsStock.getOutWaySum())) { + ywMaterialsStock.setOutWaySum(materialsStock.getOutWaySum() + stockDTO.getSum()); + } + + int res = this.updateMaterialsStock(ywMaterialsStock); + + if (res == 0) { + throw new ServiceException("冻结出库仓库的物资失败"); + } + } + + if (materialsStocks.size() > 1) { + throw new ServiceException("出库仓库的物资库存数据有错误"); + } + } + + return true; + + } + + @Transactional + @Override + public Boolean freezeOutWayMaterialsStockBack(YwMaterialsBatchDTO ywMaterialsBatchDTO) { + + try { + List materialCodes = ywMaterialsBatchDTO.getData().stream() + .map(YwMaterialsBatch::getMaterialCode) + .distinct() + .collect(Collectors.toList()); + + LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); + + queryStock.eq(YwMaterialsStock::getMaterialStoreId, ywMaterialsBatchDTO.getStoreId()) + .in(YwMaterialsStock::getMaterialCode, materialCodes); + + List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); + + if (materialsStocks.size() != materialCodes.size()) { + throw new ServiceException("物资库存数据有错误"); + } + +// List updatedStocks = new ArrayList<>(); + for (YwMaterialsBatch stockDTO : ywMaterialsBatchDTO.getData()) { + YwMaterialsStock materialsStock = materialsStocks.stream() + .filter(s -> s.getMaterialCode().equals(stockDTO.getMaterialCode())) + .findFirst() + .orElseThrow(() -> new ServiceException("物资库存数据有错误")); + YwMaterialsStock updatedStock = new YwMaterialsStock(); + updatedStock.setId(materialsStock.getId()); + updatedStock.setAvailSum(materialsStock.getAvailSum() + stockDTO.getSum()); + updatedStock.setOutWaySum(materialsStock.getOutWaySum() - stockDTO.getSum()); + int res = ywMaterialsStockMapper.updateById(updatedStock); + if (res == 0) { + throw new ServiceException("回滚出库仓库的冻结物资失败"); + } + } + + return true; + } + catch (Exception e) { + throw new ServiceException("回滚出库仓库的冻结物资失败", e); + } + } + + @Transactional + @Override + public Boolean freezeOutWayMaterialsStockBack(YwMaterialsDTO ywMaterialsDTO, YwMaterialsOrderLog ywMaterialsOrderLog) { + + Long outStoreVenue = ywMaterialsOrderLog.getOutStoreVenue(); + + if (outStoreVenue == null || outStoreVenue < 0) { + return true; + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.eq(YwMaterialsBatch::getOrderid, ywMaterialsDTO.getOrderId()); + + //根据orderId查找批次数据 + List listMaterBat = ywMaterialsBatchMapper.selectList(lambdaQueryWrapper); + + if (!listMaterBat.isEmpty()) { + YwMaterialsBatchDTO dto = new YwMaterialsBatchDTO(); + dto.setStoreId(outStoreVenue); + dto.setData(listMaterBat); + this.freezeOutWayMaterialsStockBack(dto); + } + + return true; + } + + @Override + public Boolean updateInWayMaterialsStock(YwMaterialsDTO ywMaterialsDTO) { + + YwMaterialsOrderLog ywMaterialsOrderLog = Validate(ywMaterialsDTO); + + if (!OrderStatus.YSH.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + +// LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); +// +// lambdaQueryWrapper.eq(YwMaterialsBatch::getOrderid, ywMaterialsDTO.getOrderId()); +// +// //根据orderId查找批次数据 +// List listMaterBat = ywMaterialsBatchMapper.selectList(lambdaQueryWrapper); +// +// if (listMaterBat.isEmpty()) { +// throw new ServiceException("没有找到物资批次数据"); +// } + +// Long inStoreVenue = ywMaterialsOrderLog.getInStoreVenue(); +// +// if (ObjectUtils.isEmpty(inStoreVenue)) { +// throw new ServiceException("入库场馆号异常"); +// } +// +// if (inStoreVenue < 0) { +// return true; +// } +// +// +// for (YwMaterialsBatch ywMaterialsBatch : listMaterBat) { +// +// LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); +// +// queryStock.eq(YwMaterialsStock::getMaterialStoreId, inStoreVenue); +// +// queryStock.eq(YwMaterialsStock::getMaterialCode, ywMaterialsBatch.getMaterialCode()); +// +// List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); +// +// YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); +// +// ywMaterialsStock.setMaterialStoreId(inStoreVenue); +// +// ywMaterialsStock.setMaterialCode(ywMaterialsBatch.getMaterialCode()); +// +// //新增 +// if (materialsStocks.size() == 0) { +// +// ywMaterialsStock.setAvailSum(0); +// +// ywMaterialsStock.setInWaySum(ywMaterialsBatch.getSum()); +// +// this.insertMaterialsStock(ywMaterialsStock); +// +// } +// +//// 修改 +// if (materialsStocks.size() == 1) { +// YwMaterialsStock materialsStock = materialsStocks.get(0); +// +// if (!ObjectUtils.isEmpty(materialsStock.getInWaySum())) { +// ywMaterialsStock.setInWaySum(materialsStock.getInWaySum() + ywMaterialsBatch.getSum()); +// } +// +// if (ObjectUtils.isEmpty(materialsStock.getInWaySum())) { +// ywMaterialsStock.setInWaySum(ywMaterialsBatch.getSum()); +// } +// +// this.updateMaterialsStock(ywMaterialsStock); +// } +// +// +// if (materialsStocks.size() > 1) { +// throw new ServiceException("物资库存数据有错误"); +// } +// +// } + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsDTO.getOrderId()); + orderDto.setOrderType(ywMaterialsDTO.getOrderType()); + orderDto.setTaskStatus(OrderStatus.YCK.getCode()); + + return ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); +// return true; + } + + @Override + public Boolean updateInWayMaterialsStockBack(YwMaterialsDTO ywMaterialsDTO) { + + YwMaterialsOrderLog ywMaterialsOrderLog = Validate(ywMaterialsDTO); + + if (!OrderStatus.YCK.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + +// LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); +// +// lambdaQueryWrapper.eq(YwMaterialsBatch::getOrderid, ywMaterialsDTO.getOrderId()); +// +// //根据orderId查找批次数据 +// List listMaterBat = ywMaterialsBatchMapper.selectList(lambdaQueryWrapper); +// +// if (listMaterBat.isEmpty()) { +// throw new ServiceException("没有找到物资批次数据"); +// } +// +// Long inStoreVenue = ywMaterialsOrderLog.getInStoreVenue(); +// +// if (ObjectUtils.isEmpty(inStoreVenue)) { +// throw new ServiceException("入库场馆号异常"); +// } +// +// if (inStoreVenue < 0) { +// return true; +// } +// +// for (YwMaterialsBatch ywMaterialsBatch : listMaterBat) { +// +// LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); +// +// queryStock.eq(YwMaterialsStock::getMaterialStoreId, inStoreVenue); +// +// queryStock.eq(YwMaterialsStock::getMaterialCode, ywMaterialsBatch.getMaterialCode()); +// +// List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); +// +// YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); +// +// ywMaterialsStock.setMaterialStoreId(inStoreVenue); +// +// ywMaterialsStock.setMaterialCode(ywMaterialsBatch.getMaterialCode()); +// +// //新增 +// if (materialsStocks.size() == 0) { +// +// ywMaterialsStock.setAvailSum(0); +// ywMaterialsStock.setInWaySum(ywMaterialsBatch.getSum()); +// this.insertMaterialsStock(ywMaterialsStock); +// +// } +// +//// 修改 +// if (materialsStocks.size() == 1) { +// +// YwMaterialsStock materialsStock = materialsStocks.get(0); +// +// ywMaterialsStock.setInWaySum(materialsStock.getInWaySum() - ywMaterialsBatch.getSum()); +// +// this.updateMaterialsStock(ywMaterialsStock); +// } +// +// +// if (materialsStocks.size() > 1) { +// throw new ServiceException("物资库存数据有错误"); +// } +// +// } + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsDTO.getOrderId()); + orderDto.setOrderType(ywMaterialsDTO.getOrderType()); + orderDto.setTaskStatus(OrderStatus.YSH.getCode()); + ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + return true; + } + + + @Transactional + @Override + public Boolean updateMaterialsStock(YwMaterialsDTO ywMaterialsDTO) { + + YwMaterialsOrderLog ywMaterialsOrderLog = Validate(ywMaterialsDTO); + + Long inStoreVenue = ywMaterialsOrderLog.getInStoreVenue(); + + if (ObjectUtils.isEmpty(inStoreVenue)) { + throw new ServiceException("入库场馆号异常"); + } + + //中心库做入库确认,任务状态是待审核 + if (OrderType.ZXK.getCode().equals(ywMaterialsOrderLog.getOrderType())) { + if (!OrderStatus.DSH.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + } + + if (!OrderType.ZXK.getCode().equals(ywMaterialsOrderLog.getOrderType())) { + + + if(OrderType.CK.getCode().equals(ywMaterialsDTO.getOrderType())) + { + throw new ServiceException("工程出库没有该操作"); + } + + //调拨和退库做入库确认,任务状态是已出库 + if (OrderType.DB.getCode().equals(ywMaterialsOrderLog.getOrderType()) || OrderType.TK.getCode().equals(ywMaterialsDTO.getOrderType())) { + if (!OrderStatus.YCK.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + } + + if (!(OrderType.DB.getCode().equals(ywMaterialsOrderLog.getOrderType()) || OrderType.TK.getCode().equals(ywMaterialsDTO.getOrderType()))) { + + //其它物资订单类型的入库确认,任务状态是已审核 + if (!OrderStatus.YSH.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + } + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.eq(YwMaterialsBatch::getOrderid, ywMaterialsDTO.getOrderId()); + + //根据orderId查找批次数据 + List listMaterBat = ywMaterialsBatchMapper.selectList(lambdaQueryWrapper); + + if (listMaterBat.isEmpty()) { + throw new ServiceException("没有找到物资批次数据"); + } + + if (inStoreVenue >= 0) { + + for (YwMaterialsBatch ywMaterialsBatch : listMaterBat) { + + LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); + + queryStock.eq(YwMaterialsStock::getMaterialStoreId, inStoreVenue); + + queryStock.eq(YwMaterialsStock::getMaterialCode, ywMaterialsBatch.getMaterialCode()); + + List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); + + YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); + + ywMaterialsStock.setMaterialStoreId(inStoreVenue); + + ywMaterialsStock.setMaterialCode(ywMaterialsBatch.getMaterialCode()); + + //新增 + if (materialsStocks.size() == 0) { + ywMaterialsStock.setAvailSum(ywMaterialsBatch.getSum()); + this.insertMaterialsStock(ywMaterialsStock); + } + +// 修改 + if (materialsStocks.size() == 1) { + + YwMaterialsStock materialsStock = materialsStocks.get(0); + + ywMaterialsStock.setAvailSum(materialsStock.getAvailSum() + ywMaterialsBatch.getSum()); + + //调拨要多做一步把在在途数去掉 +// if (ywMaterialsDTO.getOrderType() == OrderType.DB.getCode() || ywMaterialsDTO.getOrderType() == OrderType.TK.getCode()) { +// ywMaterialsStock.setInWaySum(materialsStock.getInWaySum() - ywMaterialsBatch.getSum()); +// } + + if (ywMaterialsDTO.getOrderType() != OrderType.ZXK.getCode()) { + ywMaterialsStock.setInWaySum(materialsStock.getInWaySum() - ywMaterialsBatch.getSum()); + } + + this.updateMaterialsStock(ywMaterialsStock); + + } + + + if (materialsStocks.size() > 1) { + throw new ServiceException("物资库存数据有错误"); + } + + } + } + + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsDTO.getOrderId()); + orderDto.setOrderType(ywMaterialsDTO.getOrderType()); +// 20230426工程出库,最后状态是已出库,用于解决前端的显示和查询 + if (OrderType.CK.getCode().equals(ywMaterialsDTO.getOrderType())) { + orderDto.setTaskStatus(OrderStatus.YCK.getCode()); + } + if (!OrderType.CK.getCode().equals(ywMaterialsDTO.getOrderType())) { + orderDto.setTaskStatus(OrderStatus.YRK.getCode()); + } + + orderDto.setInStoreName(SecurityUtils.getLoginUser().getUser().getNickName()); + orderDto.setInStoreId(SecurityUtils.getUserId()); + + ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + + return true; + } + + @Override + public Boolean updateMaterialsStockBack(YwMaterialsDTO ywMaterialsDTO) { + + + YwMaterialsOrderLog ywMaterialsOrderLog = Validate(ywMaterialsDTO); + + if (!OrderStatus.YRK.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前任务状态不是已入库,无法回滚"); + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.eq(YwMaterialsBatch::getOrderid, ywMaterialsDTO.getOrderId()); + + //根据orderId查找批次数据 + List listMaterBat = ywMaterialsBatchMapper.selectList(lambdaQueryWrapper); + + if (listMaterBat.isEmpty()) { + throw new ServiceException("没有找到物资批次数据"); + } + + Long inStoreVenue = ywMaterialsOrderLog.getInStoreVenue(); + + Long outStoreVenue = ywMaterialsOrderLog.getOutStoreVenue(); + + if (inStoreVenue >= 0) { + + for (YwMaterialsBatch ywMaterialsBatch : listMaterBat) { + + LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); + + queryStock.eq(YwMaterialsStock::getMaterialStoreId, inStoreVenue); + + queryStock.eq(YwMaterialsStock::getMaterialCode, ywMaterialsBatch.getMaterialCode()); + + List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); + + YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); + + ywMaterialsStock.setMaterialStoreId(inStoreVenue); + + ywMaterialsStock.setMaterialCode(ywMaterialsBatch.getMaterialCode()); + +// 修改 + if (materialsStocks.size() == 1) { + YwMaterialsStock materialsStock = materialsStocks.get(0); + + if (!OrderType.DB.getCode().equals(ywMaterialsDTO.getOrderType())) { + ywMaterialsStock.setAvailSum(materialsStock.getAvailSum() - ywMaterialsBatch.getSum()); + } + if (OrderType.DB.getCode().equals(ywMaterialsDTO.getOrderType())) { + + ywMaterialsStock.setAvailSum(materialsStock.getAvailSum() - ywMaterialsBatch.getSum()); + ywMaterialsStock.setInWaySum(materialsStock.getInWaySum() + ywMaterialsBatch.getSum()); + + } + this.updateMaterialsStock(ywMaterialsStock); + } + + + if (materialsStocks.size() > 1) { + throw new ServiceException("物资库存数据有错误"); + } + + } + } + + if (outStoreVenue >= 0) { + //入库场馆入库了才会消掉出库场馆的冻结数 + //20230506审核通过了,直接消掉出库场馆的冻结数 + for (YwMaterialsBatch ywMaterialsBatch : listMaterBat) { + + LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); + + queryStock.eq(YwMaterialsStock::getMaterialStoreId, outStoreVenue); + + queryStock.eq(YwMaterialsStock::getMaterialCode, ywMaterialsBatch.getMaterialCode()); + + List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); + + YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); + + ywMaterialsStock.setMaterialStoreId(outStoreVenue); + + ywMaterialsStock.setMaterialCode(ywMaterialsBatch.getMaterialCode()); + + if (materialsStocks.size() == 0) { + throw new ServiceException("出库场馆的物资库存数据不存在"); + } + + if (materialsStocks.size() == 1) { + + YwMaterialsStock materialsStock = materialsStocks.get(0); + + ywMaterialsStock.setOutWaySum(materialsStock.getOutWaySum() + ywMaterialsBatch.getSum()); + + this.updateMaterialsStock(ywMaterialsStock); + + } + + } + + } + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsDTO.getOrderId()); + orderDto.setOrderType(ywMaterialsDTO.getOrderType()); + + if (OrderType.ZXK.getCode().equals(ywMaterialsOrderLog.getOrderType())) { + orderDto.setTaskStatus(OrderStatus.DSH.getCode()); + } else { + if (!OrderType.DB.getCode().equals(ywMaterialsOrderLog.getOrderType())) { + orderDto.setTaskStatus(OrderStatus.YSH.getCode()); + } + + if (OrderType.DB.getCode().equals(ywMaterialsOrderLog.getOrderType())) { + orderDto.setTaskStatus(OrderStatus.YCK.getCode()); + } + } + orderDto.setInStoreName(""); + orderDto.setInStoreId(-1L); + ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + + return true; + + } + + //冻结数据释放掉 + @Transactional + @Override + public Boolean updateFreezeOutWayMaterialsStock(YwMaterialsDTO ywMaterialsDTO) { + + YwMaterialsOrderLog ywMaterialsOrderLog = Validate(ywMaterialsDTO); + + Long inStoreVenue = ywMaterialsOrderLog.getInStoreVenue(); + + if (ObjectUtils.isEmpty(inStoreVenue)) { + throw new ServiceException("入库场馆号异常"); + } + + Long outStoreVenue = ywMaterialsOrderLog.getOutStoreVenue(); + + if (ObjectUtils.isEmpty(outStoreVenue)) { + throw new ServiceException("出库场馆号异常"); + } + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsOrderLog.getOrderId()); + orderDto.setOrderType(ywMaterialsOrderLog.getOrderType()); + orderDto.setInStoreName(ywMaterialsDTO.getAuditor()); + + if(OrderType.SL.getCode().equals(ywMaterialsDTO.getOrderType())|| OrderType.RK.getCode().equals(ywMaterialsDTO.getOrderType())) { + if (!OrderStatus.DSH.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + orderDto.setTaskStatus(OrderStatus.YSH.getCode()); + } + + if(OrderType.TK.getCode().equals(ywMaterialsDTO.getOrderType()) || OrderType.CK.getCode().equals(ywMaterialsDTO.getOrderType()) || OrderType.DB.getCode().equals(ywMaterialsDTO.getOrderType())) { + if (!OrderStatus.YSH.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + orderDto.setTaskStatus(OrderStatus.YCK.getCode()); + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.eq(YwMaterialsBatch::getOrderid, ywMaterialsDTO.getOrderId()); + + //根据orderId查找批次数据 + List listMaterBat = ywMaterialsBatchMapper.selectList(lambdaQueryWrapper); + + if (listMaterBat.isEmpty()) { + throw new ServiceException("没有找到物资批次数据"); + } + + if (outStoreVenue >= 0) { + //20230506审核通过,消掉出库场馆的冻结数 + for (YwMaterialsBatch ywMaterialsBatch : listMaterBat) { + + LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); + + queryStock.eq(YwMaterialsStock::getMaterialStoreId, outStoreVenue); + + queryStock.eq(YwMaterialsStock::getMaterialCode, ywMaterialsBatch.getMaterialCode()); + + List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); + + YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); + + ywMaterialsStock.setMaterialStoreId(outStoreVenue); + + ywMaterialsStock.setMaterialCode(ywMaterialsBatch.getMaterialCode()); + + if (materialsStocks.size() == 0) { + throw new ServiceException("出库场馆的物资库存数据不存在"); + } + + if (materialsStocks.size() == 1) { + + YwMaterialsStock materialsStock = materialsStocks.get(0); + + if (ObjectUtils.isEmpty(materialsStock.getOutWaySum())) { + throw new ServiceException("出库场馆的冻结库存数据有问题"); + } + + if (!ObjectUtils.isEmpty(materialsStock.getOutWaySum())) { + + if (materialsStock.getOutWaySum() < ywMaterialsBatch.getSum()) { + + throw new ServiceException("出库场馆的冻结库存数据居然小于出库的库存数"); + } + + ywMaterialsStock.setOutWaySum(materialsStock.getOutWaySum() - ywMaterialsBatch.getSum()); + + } + + this.updateMaterialsStock(ywMaterialsStock); + + } + + } + + } + + + if (inStoreVenue >= 0) { + + for (YwMaterialsBatch ywMaterialsBatch : listMaterBat) { + + LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); + + queryStock.eq(YwMaterialsStock::getMaterialStoreId, inStoreVenue); + + queryStock.eq(YwMaterialsStock::getMaterialCode, ywMaterialsBatch.getMaterialCode()); + + List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); + + YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); + + ywMaterialsStock.setMaterialStoreId(inStoreVenue); + + ywMaterialsStock.setMaterialCode(ywMaterialsBatch.getMaterialCode()); + + //新增 + if (materialsStocks.size() == 0) { + + ywMaterialsStock.setAvailSum(0); + + ywMaterialsStock.setInWaySum(ywMaterialsBatch.getSum()); + + this.insertMaterialsStock(ywMaterialsStock); + + } + +// 修改 + if (materialsStocks.size() == 1) { + YwMaterialsStock materialsStock = materialsStocks.get(0); + + if (!ObjectUtils.isEmpty(materialsStock.getInWaySum())) { + ywMaterialsStock.setInWaySum(materialsStock.getInWaySum() + ywMaterialsBatch.getSum()); + } + + if (ObjectUtils.isEmpty(materialsStock.getInWaySum())) { + ywMaterialsStock.setInWaySum(ywMaterialsBatch.getSum()); + } + + this.updateMaterialsStock(ywMaterialsStock); + } + + + if (materialsStocks.size() > 1) { + throw new ServiceException("物资库存数据有错误"); + } + + } + } + + ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + + return true; + + } + + @Override + public Boolean updateFreezeOutWayMaterialsStockBack(YwMaterialsDTO ywMaterialsDTO) { + + YwMaterialsOrderLog ywMaterialsOrderLog = Validate(ywMaterialsDTO); + + Long inStoreVenue = ywMaterialsOrderLog.getInStoreVenue(); + + if (ObjectUtils.isEmpty(inStoreVenue)) { + throw new ServiceException("入库场馆号异常"); + } + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsOrderLog.getOrderId()); + orderDto.setOrderType(ywMaterialsOrderLog.getOrderType()); + + if(OrderType.SL.getCode().equals(ywMaterialsDTO.getOrderType())|| OrderType.RK.getCode().equals(ywMaterialsDTO.getOrderType())) { + if (!OrderStatus.YSH.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + orderDto.setTaskStatus(OrderStatus.DSH.getCode()); + } + + if(OrderType.TK.getCode().equals(ywMaterialsDTO.getOrderType()) || OrderType.CK.getCode().equals(ywMaterialsDTO.getOrderType()) || OrderType.DB.getCode().equals(ywMaterialsDTO.getOrderType())) { + if (!OrderStatus.YCK.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前步骤和任务状态不同步"); + } + orderDto.setTaskStatus(OrderStatus.YSH.getCode()); + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.eq(YwMaterialsBatch::getOrderid, ywMaterialsDTO.getOrderId()); + + //根据orderId查找批次数据 + List listMaterBat = ywMaterialsBatchMapper.selectList(lambdaQueryWrapper); + + if (listMaterBat.isEmpty()) { + throw new ServiceException("没有找到物资批次数据"); + } + + Long outStoreVenue = ywMaterialsOrderLog.getOutStoreVenue(); + + if (ObjectUtils.isEmpty(outStoreVenue)) { + throw new ServiceException("出库场馆号异常"); + } + + if (outStoreVenue >= 0) { + + for (YwMaterialsBatch ywMaterialsBatch : listMaterBat) { + + LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); + + queryStock.eq(YwMaterialsStock::getMaterialStoreId, outStoreVenue); + + queryStock.eq(YwMaterialsStock::getMaterialCode, ywMaterialsBatch.getMaterialCode()); + + List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); + + YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); + + ywMaterialsStock.setMaterialStoreId(outStoreVenue); + + ywMaterialsStock.setMaterialCode(ywMaterialsBatch.getMaterialCode()); + + if (materialsStocks.size() == 0) { + throw new ServiceException("出库场馆的物资库存数据不存在"); + } + + if (materialsStocks.size() == 1) { + + YwMaterialsStock materialsStock = materialsStocks.get(0); + + if (ObjectUtils.isEmpty(materialsStock.getOutWaySum())) { + throw new ServiceException("出库场馆的冻结库存数据有问题"); + } + + if (!ObjectUtils.isEmpty(materialsStock.getOutWaySum())) { + + ywMaterialsStock.setOutWaySum(materialsStock.getOutWaySum() + ywMaterialsBatch.getSum()); + + } + + this.updateMaterialsStock(ywMaterialsStock); + + } + + } + + } + + + if (inStoreVenue >= 0) { + + for (YwMaterialsBatch ywMaterialsBatch : listMaterBat) { + + LambdaQueryWrapper queryStock = new LambdaQueryWrapper<>(); + + queryStock.eq(YwMaterialsStock::getMaterialStoreId, inStoreVenue); + + queryStock.eq(YwMaterialsStock::getMaterialCode, ywMaterialsBatch.getMaterialCode()); + + List materialsStocks = ywMaterialsStockMapper.selectList(queryStock); + + YwMaterialsStock ywMaterialsStock = new YwMaterialsStock(); + + ywMaterialsStock.setMaterialStoreId(inStoreVenue); + + ywMaterialsStock.setMaterialCode(ywMaterialsBatch.getMaterialCode()); + + //新增 + if (materialsStocks.size() == 0) { + + throw new ServiceException("物资库存数据有错误"); + + } + + // 修改 + if (materialsStocks.size() == 1) { + + YwMaterialsStock materialsStock = materialsStocks.get(0); + + ywMaterialsStock.setInWaySum(materialsStock.getInWaySum() - ywMaterialsBatch.getSum()); + + this.updateMaterialsStock(ywMaterialsStock); + } + + + if (materialsStocks.size() > 1) { + throw new ServiceException("物资库存数据有错误"); + } + + } + } + + + + ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + + return true; + } + + @Override + public YwMaterialsOrderLog Validate(YwMaterialsDTO ywMaterialsDTO) { + + if (StringUtils.isEmpty(ywMaterialsDTO.getOrderId())) { + throw new ServiceException("物资工单ID不能为空"); + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.eq(YwMaterialsOrderLog::getOrderId, ywMaterialsDTO.getOrderId()); + + lambdaQueryWrapper.eq(YwMaterialsOrderLog::getOrderType, ywMaterialsDTO.getOrderType()); + + //根据物资order表查找order是否存在 + List list = ywMaterialsOrderLogMapper.selectList(lambdaQueryWrapper); + + if (list.isEmpty()) { + throw new ServiceException("物资工单数据不存在"); + } + + //核查当前操作的人员 + YwMaterialsOrderLog ywMaterialsOrderLog = list.get(0); + + if (FlowDealStatus.BUSINESS_STATUS_4.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + + if (!ywMaterialsDTO.getIsBack().equals("是")) { + throw new ServiceException("物资工单已完结"); + } + + } + } + + //工程出库不需要验证入库场馆 + if (OrderType.CK.getCode().equals(ywMaterialsOrderLog.getOrderType())) { + + if (ObjectUtils.isEmpty(ywMaterialsOrderLog.getInStoreVenue())) { + throw new ServiceException("物资工单入库场馆数据有错误"); + } + + } + + //不是更新中心库,需要有出库场馆的ID + if (!(OrderType.ZXK.getCode().equals(ywMaterialsDTO.getOrderType()) || OrderType.RK.getCode().equals(ywMaterialsDTO.getOrderType()))) { + if (ObjectUtils.isEmpty(ywMaterialsOrderLog.getOutStoreVenue())) { + throw new ServiceException("物资工单出库场馆数据有错误"); + } + } + + if (ywMaterialsDTO.getOpType().equals("审核任务")) { + + //从工作流获取当前用户的审核人 + Long shrId = ywMaterialsOrderLogMapper.selectCheckUserIdByFlwId(ywMaterialsOrderLog.getFlwProcessid()); + + if(ObjectUtils.isEmpty(shrId)) + { + throw new ServiceException("物资工单的审核人不存在"); + } + + if (!SecurityUtils.getUserId().equals(shrId)) { + throw new ServiceException("审核人不正确"); + } + + } + + return ywMaterialsOrderLog; + + } + + @Override + public int insertMaterialsStock(YwMaterialsStock ywMaterialsStock) { + + return ywMaterialsStockMapper.insert(ywMaterialsStock); + + } + + @Override + public int updateMaterialsStock(YwMaterialsStock ywMaterialsStock) { + + //根据库号和物资号,修改库存数据 + LambdaQueryWrapper condition = new LambdaQueryWrapper<>(); + condition.eq(YwMaterialsStock::getMaterialStoreId, ywMaterialsStock.getMaterialStoreId()); + condition.eq(YwMaterialsStock::getMaterialCode, ywMaterialsStock.getMaterialCode()); + + return ywMaterialsStockMapper.update(ywMaterialsStock, condition); + } + + /** + * 导入 + * + * @param beans 数据 + * @param sceneBigId 大场景id + * @param importType 导入方式 + * @param materialStoreId materialStoreId + * @return 导入结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importXls(List beans, Long sceneBigId, String importType, Long materialStoreId) throws Exception { + ImporterBase importer = new ImporterMaterialsStock(ywMaterialsStockMapper, ywMaterialsClassesMapper, ywMaterialsInformMapper); + return importer.doAdd(beans, sceneBigId, importType, materialStoreId); + } + + /** + * 导入,返回List + * + * @param xls 数据 + * @param sceneId + * @return 导入的数据 + * @throws Exception 异常 + */ + @Override + public AjaxResult importXlsReturnList(List xls, Long sceneId) throws Exception { + ImporterBase importer = new ImporterMaterialsReturnList(ywMaterialsClassesMapper, ywMaterialsStockMapper, ywMaterialsInformMapper); + AjaxResult ajaxResult = importer.doAdd(xls, null, null, sceneId); + if (String.valueOf(HttpStatus.SUCCESS).equals(String.valueOf(ajaxResult.get(AjaxResult.CODE_TAG)))) { + JSONArray jsonArray = new JSONArray(); + for (MaterialsXlsToJsonArrayVo xl : xls) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YwMaterialsStock::getMaterialStoreId, sceneId).eq(YwMaterialsStock::getMaterialCode, xl.getMaterialCode()).ge(YwMaterialsStock::getAvailSum, Integer.parseInt(xl.getSum())); + List list = ywMaterialsStockMapper.selectList(wrapper); + if (CollectionUtil.isNotEmpty(list)) { + xl.setAvailSum(String.valueOf(list.get(0).getAvailSum())); + } + JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(xl)); + jsonObject.remove("reason"); + jsonArray.add(jsonObject); + } + return AjaxResult.success(jsonArray); + } else { + return ajaxResult; + } + } + +} diff --git a/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsBatchMapper.xml b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsBatchMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..5f2ce5c73d04b9dfc8ab0995efacc2c0c3d16f1a --- /dev/null +++ b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsBatchMapper.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + insert into public.yw_materials_batch(orderid, material_code, sum) + values + + (#{entity.orderid}, #{entity.materialCode}, #{entity.sum}) + + + + + + update public.yw_materials_batch + + + WHEN #{entity.materialCode} THEN #{entity.inSum} + + + WHEN #{entity.materialCode} THEN #{entity.outSum} + + + + + #{entity.materialCode} + + and orderid = #{orderId} + + + + + + + delete + from yw_materials_batch + where orderid = #{orderid,jdbcType=VARCHAR} + + + + diff --git a/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsClassesMapper.xml b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsClassesMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..488141d40eff9486f6188b7cd74dd5bed57ae62f --- /dev/null +++ b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsClassesMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + truncate table yw_materials_classes; + + + + diff --git a/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsInformMapper.xml b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsInformMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..d2a47c182a613978782b3300724836bec86ce559 --- /dev/null +++ b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsInformMapper.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + insert into public.yw_materials_inform(material_name, material_code, material_stand, material_unit, material_big_class, material_small_class, sn_code, factory) + values + + (#{entity.materialName}, #{entity.materialCode}, #{entity.materialStand}, #{entity.materialUnit}, #{entity.materialBigClass}, #{entity.materialSmallClass}, #{entity.snCode}, #{entity.factory}) + + + + + insert into public.yw_materials_inform(material_name, material_code, material_stand, material_unit, material_big_class, material_small_class, sn_code) + values + + (#{entity.materialName}, #{entity.materialCode}, #{entity.materialStand}, #{entity.materialUnit}, #{entity.materialBigClass}, #{entity.materialSmallClass}, #{entity.snCode}) + + on duplicate key update + material_name = values(material_name) , material_code = values(material_code) , material_stand = values(material_stand) , material_unit = values(material_unit) , material_big_class = values(material_big_class) , material_small_class = values(material_small_class) , sn_code = values(sn_code) + + + + + + + + + + AND material_code = #{materialCode} + + + + + AND material_name = #{materialName} + + + + + AND material_stand = #{materialStand} + + + + AND sn_code = #{snCode} + + + + + + + delete + from yw_materials_inform + + + + + delete from yw_materials_inform t1 where not exists (SELECT 1 FROM yw_materials_stock t2 where t1.material_code = t2.material_code) + + + + diff --git a/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsOrderLogMapper.xml b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsOrderLogMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..735babac54478cae50c113adc96123c375159b39 --- /dev/null +++ b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsOrderLogMapper.xml @@ -0,0 +1,140 @@ + + + + + + + + + + and t1.order_id = like CONCAT('%',#{orderId} :: text,'%') + + + + + and t1.order_type = #{orderType} + + + + + and t1.task_status = #{taskStatus} + + + + and t1.flw_processid = #{flwId} + + + + and t1.in_store_venue = #{inStoreId} + + + + and t1.in_store_venue in + + #{arrInStoreId} + + + + + and t1.out_store_venue = #{outStoreId} + + + + and t1.out_store_venue in + + #{arrOutStoreId} + + + + + and t1.task_start_time between to_timestamp(#{searchDate}||' 00:00:00','yyyy-mm-dd hh24:mi:ss') and to_timestamp(#{searchDate}||' 23:59:59','yyyy-mm-dd hh24:mi:ss') + + + + + + + + + + + \ No newline at end of file diff --git a/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsSnListMapper.xml b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsSnListMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..f9e4d474852722ab26880478aa512abdf4ec47f5 --- /dev/null +++ b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsSnListMapper.xml @@ -0,0 +1,32 @@ + + + + + + + insert into public.yw_materials_list(orderid, material_code, material_str_code, op_type) + values + + (#{entity.orderid}, #{entity.materialCode}, #{entity.materialStrCode}, #{entity.opType}) + + + + + + + diff --git a/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsStockMapper.xml b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsStockMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..2a879fa2d4c04801ddc501daa964f222f21adb58 --- /dev/null +++ b/cmcc_gm/src/main/resources/mapper/cmcc_gm/YwMaterialsStockMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + and yms.material_store_id = #{storeId} + + + and yms.material_store_id > 0 + + + + + and yms.material_store_id in + + #{arrStoreId} + + + + + + and ymi.material_stand = #{materialStand} + + + + + and ymi.material_name = #{materialName} + + + + + + and ymi.material_big_class = #{materialBigClass} + + + + + and ymi.material_small_class = #{materialSmallClass} + + + + + + + insert into yw_materials_stock(material_store_id,material_code, + avail_sum,out_way_sum,in_way_sum, + scene_big_id) + values + + (#{item.materialStoreId,jdbcType=NUMERIC},#{item.materialCode,jdbcType=VARCHAR}, + #{item.availSum,jdbcType=NUMERIC},#{item.outWaySum,jdbcType=NUMERIC},#{item.inWaySum,jdbcType=NUMERIC}, + #{item.sceneBigId,jdbcType=NUMERIC}) + + + + delete from yw_materials_stock + + + AND material_store_id = #{materialStoreId,jdbcType=NUMERIC} + + + + + \ No newline at end of file diff --git "a/doc/\350\213\245\344\276\235\347\216\257\345\242\203\344\275\277\347\224\250\346\211\213\345\206\214.docx" "b/doc/\350\213\245\344\276\235\347\216\257\345\242\203\344\275\277\347\224\250\346\211\213\345\206\214.docx" new file mode 100644 index 0000000000000000000000000000000000000000..9e4daef4d9be2e445419109a02eaf321cd4d537e Binary files /dev/null and "b/doc/\350\213\245\344\276\235\347\216\257\345\242\203\344\275\277\347\224\250\346\211\213\345\206\214.docx" differ diff --git a/eastcom_yw/pom.xml b/eastcom_yw/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..5f6e8219e7cfc36d631a13d7ce2506049d24ac47 --- /dev/null +++ b/eastcom_yw/pom.xml @@ -0,0 +1,85 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + + 4.0.0 + + jar + + eastcom_yw + + + 东信业务 + + + + + + + + + + + + + + + com.ruoyi + ruoyi-common + + + + + com.baomidou + mybatis-plus-boot-starter + + + com.ruoyi + ruoyi-system + + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + provided + + + org.mapstruct + mapstruct + ${mapstruct.version} + + + com.ruoyi + ruoyi-framework + + + org.springframework + spring-test + + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-core + + + + + + + 8 + 8 + UTF-8 + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/AlarmConstants.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/AlarmConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..4ab0bdfa5f886322786a956573af6cb98ca8ea38 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/AlarmConstants.java @@ -0,0 +1,9 @@ +package com.ruoyi.eastcom_yw.common.constant; + +public class AlarmConstants +{ + + public static final String [] ALARMS = new String[]{"cs","wx","dh","agis","wifi","voip","yayun"}; + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/CacheConstants.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/CacheConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..e3aaf02bf561e34f28f8d499cd427dd8a29c4516 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/CacheConstants.java @@ -0,0 +1,8 @@ +package com.ruoyi.eastcom_yw.common.constant; + +public class CacheConstants +{ + public static final String YW_ALARM_LAST_VENUES = "yw_alarm_last_venues:"; + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/KpiConstants.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/KpiConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..f63e535d5393ceaa792945308ddf2eec1c754ae7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/KpiConstants.java @@ -0,0 +1,53 @@ +package com.ruoyi.eastcom_yw.common.constant; + +/** + * @author yqf + * @date 2023/4/12 + */ +public class KpiConstants { + + public static final String YW_KPI_COLOR_DEFAULT = "#000000"; + + public static final String YW_NETTYPE_4G = "4G"; + + public static final String YW_FIELD_RPB_UP = "上行Prb利用率"; + public static final String YW_FIELD_RPB_DOWN = "下行Prb利用率"; + public static final String YW_FIELD_MAX_USER = "最大用户数"; + public static final String YW_FIELD_AVG_DIS = "平均干扰值"; + public static final String YW_FIELD_ALL = "综合算法"; + + public static final String YW_QUERY_ALL = "综合得分"; + + + public static final String YW_SORT_DESC = "desc"; + + public static final String YW_DATATYPE_15 = "15分钟"; + public static final String YW_DATATYPE_1 = "1分钟"; + + public static final int YW_SCENE_RUNTYPE = 1; + + public static final int YW_MINTYPE_1 = 1; + + public static final String QUERYSEAT = "P"; + + public static final String FIELD_4G_GB = "上行流量mb"; + public static final String FIELD_4G_DISTURB = "上行平均干扰"; + public static final String FIELD_4G_MAXUSER = "最大用户数"; + public static final String FIELD_4G_PRBUP = "上行prb利用率"; + public static final String FIELD_4G_PRBDOWN = "下行prb利用率"; + + public static final String FIELD_5G_GB = "上行5g流量"; + public static final String FIELD_5G_DISTURB = "上行干扰值"; + public static final String FIELD_5G_MAXUSER = "最大用户数"; + public static final String FIELD_5G_PRBUP = "上行prb利用率"; + public static final String FIELD_5G_PRBDOWN = "下行prb利用率"; + + public static final String FIELD_AGIS_FLOWCOUNT = "ul_flow + dl_flow"; + public static final String FIELD_AGIS_UL_VELOCITY = "ul_velocity"; + public static final String FIELD_AGIS_DL_VELOCITY = "dl_velocity"; + public static final String FIELD_AGIS_UL_BAND_RATIO = "ul_band_ratio"; + public static final String FIELD_AGIS_DL_BAND_RATIO = "dl_band_ratio"; + + public static final String ORDER_DESC = "DESC"; + public static final String ORDER_ASC = "ASC"; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/NetElementConstants.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/NetElementConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..b8dd3953dee68530c081b4d2ffccb6a7a597c4b9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/constant/NetElementConstants.java @@ -0,0 +1,15 @@ +package com.ruoyi.eastcom_yw.common.constant; + +/** + * 网元常量 + * + * @author los + */ +public class NetElementConstants { + + /** + * 网元导入是否单场馆覆盖 1 是 0 全覆盖 + */ + public static final String SINGLE_SCENE_COVER = "1"; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/FlowDealStatus.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/FlowDealStatus.java new file mode 100644 index 0000000000000000000000000000000000000000..caa0a7c00cf2683796d8111def4aae744604686e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/FlowDealStatus.java @@ -0,0 +1,59 @@ +package com.ruoyi.eastcom_yw.common.enums; + +public enum FlowDealStatus { + + BUSINESS_STATUS_0("0", "待处理") ,BUSINESS_STATUS_1("1", "正在处理") ,BUSINESS_STATUS_2("2", "挂起") , + BUSINESS_STATUS_3("3","驳回"),BUSINESS_STATUS_4("4","已结束") ,BUSINESS_STATUS_5("5","撤销"); + + /** code */ + private String code; + + /** 显示标签 */ + private String label; + + FlowDealStatus(String code, String label){ + + this.code = code; + + this.label = label; + } + + public static String getLabelByCode (String code) { + + for (FlowDealStatus enuma : FlowDealStatus.values()) { + + if (enuma.getCode().equals(code)) { + + return enuma.getLabel(); + + } + + } + + return ""; + + } + + + @Override + public String toString(){ + + return label; + + } + + public String getLabel() { + + return label; + + } + + + public String getCode(){ + + return this.code; + + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/InRedLine.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/InRedLine.java new file mode 100644 index 0000000000000000000000000000000000000000..3e2b40622fb07ceeb22fa718a6722927bf6c8a2a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/InRedLine.java @@ -0,0 +1,45 @@ +package com.ruoyi.eastcom_yw.common.enums; + +import lombok.Getter; + +/** + * 是否红线内 + * + * @author los + */ +public enum InRedLine { + + /** + * 红线内 + */ + IN_RED_LINE("Y", "内"), + /** + * 红线外 + */ + NOT_IN_RED_LINE("N", "外"); + + /** + * code + */ + @Getter + private String code; + + /** + * 标签 + */ + @Getter + private String label; + + InRedLine(String code, String label) { + this.code = code; + this.label = label; + } + + @Override + public String toString() { + + return label; + + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/WireTaskSubType.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/WireTaskSubType.java new file mode 100644 index 0000000000000000000000000000000000000000..6efa05a22b77fd9fbfdfe84f3235cdd6b8182db2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/WireTaskSubType.java @@ -0,0 +1,58 @@ +package com.ruoyi.eastcom_yw.common.enums; + +public enum WireTaskSubType { + + AGIS((Integer)1, "AGIS专网") ,INTERNET((Integer)2, "互联网(WIFI)专网") ,VOIP((Integer)3, "固话(VOIP)专网") ; ; + + /** code */ + private Integer code; + + /** 显示标签 */ + private String label; + + WireTaskSubType(Integer code, String label){ + + this.code = code; + + this.label = label; + } + + public static String getLabelByCode (Integer code) { + + for (WireTaskSubType enuma : WireTaskSubType.values()) { + + if (enuma.getCode().compareTo(code) == 0) { + + return enuma.getLabel(); + + } + + } + + return ""; + + } + + + @Override + public String toString(){ + + return label; + + } + + public String getLabel() { + + return label; + + } + + + public Integer getCode(){ + + return this.code; + + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/WireTaskType.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/WireTaskType.java new file mode 100644 index 0000000000000000000000000000000000000000..334a7370478a2d51e1c0a9dc48f83b1d92db0b23 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/common/enums/WireTaskType.java @@ -0,0 +1,58 @@ +package com.ruoyi.eastcom_yw.common.enums; + +public enum WireTaskType { + + WIRETASK1((Integer)1, "布线") ,WIRETASK2((Integer)2, "拆线") ,WIRETASK3((Integer) 3,"布线结算") ,WIRETASK4((Integer) 4,"拆线结算") ; + + /** code */ + private Integer code; + + /** 显示标签 */ + private String label; + + WireTaskType(Integer code, String label){ + + this.code = code; + + this.label = label; + } + + public static String getLabelByCode (Integer code) { + + for (WireTaskType enuma : WireTaskType.values()) { + + if (enuma.getCode().compareTo(code) == 0) { + + return enuma.getLabel(); + + } + + } + + return ""; + + } + + + @Override + public String toString(){ + + return label; + + } + + public String getLabel() { + + return label; + + } + + + public Integer getCode(){ + + return this.code; + + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/AppVersionConfig.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/AppVersionConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..ddfc5263bf08d8d59b29600b38fabe4c86e71654 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/AppVersionConfig.java @@ -0,0 +1,39 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("app_version_config") +public class AppVersionConfig { + + @TableId(value = "id") + private Long id; + + private String device; + + private String versionCode; + + private String packageUrl; + + private String describe; + + private String force; + + private String packageType; + + private String versionName; + + private String wgtVersion; + + private String wgtUrl; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2AgisLink5mi.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2AgisLink5mi.java new file mode 100644 index 0000000000000000000000000000000000000000..9e8b87587d8d6d716395d23150bdc821266d6981 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2AgisLink5mi.java @@ -0,0 +1,133 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author yqf + * @since 2023-08-18 + */ +@Data +@TableName("dp_2_agis_link_5mi") +@ApiModel(value = "Dp2AgisLink5mi对象", description = "") +public class Dp2AgisLink5mi { + + private static final long serialVersionUID = 1L; + + @TableField("stat_date") + private LocalDateTime statDate; + + @TableField("city_code") + private String cityCode; + + @TableField("city_name") + private String cityName; + + @TableField("venue_code") + private String venueCode; + + @TableField("venue_name") + private String venueName; + + @TableField("link_value_code") + private String linkValueCode; + + @TableField("link_value") + private String linkValue; + + @TableField("link_code") + private String linkCode; + + @TableField("link_name") + private String linkName; + + @TableField("bandwith") + private Double bandwith; + + @TableField("delay") + private Double delay; + + @TableField("jitter") + private Double jitter; + + @TableField("lpack_ratio") + private Double lpackRatio; + + @TableField("ul_velocity") + private Double ulVelocity; + + @TableField("dl_velocity") + private Double dlVelocity; + + @TableField("ul_flow") + private Double ulFlow; + + @TableField("dl_flow") + private Double dlFlow; + + @TableField("ul_band_ratio") + private Double ulBandRatio; + + @TableField("dl_band_ratio") + private Double dlBandRatio; + + @TableField("total_band_ratio") + private Double totalBandRatio; + + @TableField("load_time") + private LocalDateTime loadTime; + + @TableField("a_device_alias") + private String aDeviceAlias; + + @TableField("z_device_alias") + private String zDeviceAlias; + + @TableField("dl_max_24h_ratio") + private Double dlMax24hRatio; + + @TableField("ul_max_24h_ratio") + private Double ulMax24hRatio; + + @TableField("dl_avg_24h_ratio") + private Double dlAvg24hRatio; + + @TableField("ul_avg_24h_ratio") + private Double ulAvg24hRatio; + + @TableField("a_device_name") + private String aDeviceName; + + @TableField("a_port_name") + private String aPortName; + + @TableField("z_device_name") + private String zDeviceName; + + @TableField("z_port_name") + private String zPortName; + + @TableField("a_port_full_name") + private String aPortFullName; + + @TableField("z_port_full_name") + private String zPortFullName; + + @TableField("a_port_short_name") + private String aPortShortName; + + @TableField("z_port_short_name") + private String zPortShortName; + + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2MmlList.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2MmlList.java new file mode 100644 index 0000000000000000000000000000000000000000..4a58d0588f45e055e82f5c50fc375e515232927b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2MmlList.java @@ -0,0 +1,107 @@ +package com.ruoyi.eastcom_yw.domain; + +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 com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author ck + * @since 2023-09-12 + */ +@Data +@TableName("dp_2_mml_list") +@ApiModel(value = "Dp2MmlList对象", description = "") +public class Dp2MmlList { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("小区名") + @TableField("cell_name") + @Excel(name = "小区名", sort = 2,width = 90) + private String cellName; + + @ApiModelProperty("统计时间") + @TableField("stat_time") + @Excel(name = "统计时间", dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 11,width = 25) + private LocalDateTime statTime; + + @ApiModelProperty("上行Prb利用率") + @TableField("prb_up") + @Excel(name = "上行Prb利用率", sort = 3) + private BigDecimal prbUp; + + @ApiModelProperty("下行Prb利用率") + @TableField("prb_down") + @Excel(name = "下行Prb利用率", sort = 4) + private BigDecimal prbDown; + + @ApiModelProperty("最大用户数") + @TableField("max_user") + @Excel(name = "最大用户数", sort = 5) + private BigDecimal maxUser; + + @ApiModelProperty("综合得分") + @TableField("zh_score") + @Excel(name = "综合得分", sort = 6) + private BigDecimal zhScore; + + @ApiModelProperty("是否降低功率") + @TableField("desc_power") + @Excel(name = "是否降低功率", sort = 10,readConverterExp = "0=否,1=是") + private Integer descPower; + + @ApiModelProperty("关闭状态") + @TableField("close_state") +// @Excel(name = "关闭状态", sort = 1) + private Integer closeState; + + @ApiModelProperty("场馆号") + @TableField("scene_id") + private Integer sceneId; + + @ApiModelProperty("场馆名称") + @TableField(exist = false) + @Excel(name = "场馆名称",sort = 1,width = 30) + private String venueName; + + @ApiModelProperty("批次,每次写入批次号相同") + @TableField("batchno") +// @Excel(name = "批次,每次写入批次号相同", sort = 1) + private Long batchno; + + @ApiModelProperty("平均干扰") + @TableField("avg_disturb") + @Excel(name = "平均干扰", sort = 7) + private BigDecimal avgDisturb; + + @ApiModelProperty("坐席编号") + @TableField("seatid") + @Excel(name = "坐席编号", sort = 8) + private String seatid; + + @ApiModelProperty("4G/5G") + @TableField("nettype") + @Excel(name = "4G/5G", sort = 9) + private String nettype; + + @TableField("inputtime") +// @Excel(name = "inputtime", dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 1) + private LocalDateTime inputtime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2PnNetVenue5mi.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2PnNetVenue5mi.java new file mode 100644 index 0000000000000000000000000000000000000000..7ca2e33df6c8993ce995df01586365c705cf0c40 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2PnNetVenue5mi.java @@ -0,0 +1,137 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author yqf + * @since 2023-08-21 + */ +@Data +@TableName("dp_2_pn_net_venue_5mi") +@ApiModel(value = "Dp2PnNetVenue5mi对象", description = "") +public class Dp2PnNetVenue5mi { + + private static final long serialVersionUID = 1L; + + @TableField("stat_date") + private LocalDateTime statDate; + + @TableField("city_code") + private String cityCode; + + @TableField("city_name") + private String cityName; + + @ApiModelProperty("互联网在线用户数") + @TableField("online_user_cnt") + private Double onlineUserCnt; + + @TableField("inter_exp_bandwith") + private Double interExpBandwith; + + @TableField("interc_bandwith") + private Double intercBandwith; + + @TableField("venue_bandwith") + private Double venueBandwith; + + @TableField("dl_inter_exp_flow") + private Double dlInterExpFlow; + + @TableField("ul_inter_exp_flow") + private Double ulInterExpFlow; + + @TableField("dl_interc_flow") + private Double dlIntercFlow; + + @TableField("ul_interc_flow") + private Double ulIntercFlow; + + @TableField("dl_venue_flow") + private Double dlVenueFlow; + + @TableField("ul_venue_flow") + private Double ulVenueFlow; + + @TableField("dl_inter_exp_band_ratio") + private Double dlInterExpBandRatio; + + @TableField("ul_inter_exp_band_ratio") + private Double ulInterExpBandRatio; + + @TableField("dl_interc_band_ratio") + private Double dlIntercBandRatio; + + @TableField("ul_interc_band_ratio") + private Double ulIntercBandRatio; + + @ApiModelProperty("互联网下行带宽利用率") + @TableField("dl_venue_band_ratio") + private Double dlVenueBandRatio; + + @ApiModelProperty("互联网上行带宽利用率") + @TableField("ul_venue_band_ratio") + private Double ulVenueBandRatio; + + @TableField("dl_inter_exp_velocity") + private Double dlInterExpVelocity; + + @TableField("ul_inter_exp_velocity") + private Double ulInterExpVelocity; + + @TableField("dl_interc_velocity") + private Double dlIntercVelocity; + + @TableField("ul_interc_velocity") + private Double ulIntercVelocity; + + @ApiModelProperty("互联网场馆出口_下行流速") + @TableField("dl_venue_velocity") + private Double dlVenueVelocity; + + @ApiModelProperty("互联网出口_上行流速") + @TableField("ul_venue_velocity") + private Double ulVenueVelocity; + + @TableField("interc_delay") + private Double intercDelay; + + @TableField("inter_exp_delay") + private Double interExpDelay; + + @TableField("interc_jitter") + private Double intercJitter; + + @TableField("inter_exp_jitter") + private Double interExpJitter; + + @TableField("interc_lpack_ratio") + private Double intercLpackRatio; + + @TableField("inter_exp_lpack_ratio") + private Double interExpLpackRatio; + + @TableField("load_time") + private LocalDateTime loadTime; + + @TableField("venue_code") + private String venueCode; + + @TableField("venue_name") + private String venueName; + + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2SpotCell.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2SpotCell.java new file mode 100644 index 0000000000000000000000000000000000000000..e005aac107764c3798a83b93705cb891aaa9022a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2SpotCell.java @@ -0,0 +1,231 @@ +package com.ruoyi.eastcom_yw.domain; + +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 com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * @author ck + * @since 2023-08-10 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("dp_2_spot_cell") +@ApiModel(value = "Dp2SpotCell对象", description = "") +public class Dp2SpotCell { + + private static final long serialVersionUID = 1L; + + @TableField("id") + @TableId(type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("地市编码") + @TableField("地市编码") + @Excel(name = "地市编码") + private String 地市编码; + + @ApiModelProperty("地市") + @TableField("地市") + @Excel(name = "地市") + private String 地市; + + @ApiModelProperty("区县编码") + @TableField("区县编码") + @Excel(name = "区县编码") + private String 区县编码; + + @TableField("omc") + @Excel(name = "OMC") + private String omc; + + @ApiModelProperty("需要") + @TableField("县市") + @Excel(name = "县市") + private String 县市; + + @TableField("enodebid") + @Excel(name = "enodebid") + private Long enodebid; + + @TableField("本地小区标识") + @Excel(name = "本地小区标识") + private Long 本地小区标识; + + @TableField("小区标识") + @Excel(name = "小区标识") + private Long 小区标识; + + @ApiModelProperty("需要") + @TableField("站号") + @Excel(name = "站号") + private Long 站号; + + @ApiModelProperty("需要") + @TableField("ci") + @Excel(name = "CI") + private Long ci; + + @ApiModelProperty("需要") + @TableField("基站全称") + @Excel(name = "基站全称") + private String 基站全称; + + @TableField("en名称") + @Excel(name = "en名称") + private String en名称; + + @ApiModelProperty("需要") + @TableField("小区名称") + @Excel(name = "小区名称") + private String 小区名称; + + @ApiModelProperty("需要") + @TableField("小区频段") + @Excel(name = "小区频段") + private String 小区频段; + + @ApiModelProperty("lac") + @TableField("lac") + @Excel(name = "lac") + private String lac; + + @ApiModelProperty("需要") + @TableField("纬度") + @Excel(name = "纬度") + private Double 纬度; + + @ApiModelProperty("需要") + @TableField("经度") + @Excel(name = "经度") + private Double 经度; + + @TableField("纬度gcj") + @Excel(name = "纬度gcj") + private Double 纬度gcj; + + @TableField("经度gcj") + @Excel(name = "经度gcj") + private Double 经度gcj; + + @ApiModelProperty("需要") + @TableField("室内室外") + @Excel(name = "室内室外",combo={"室内","室外"}) + private String 室内室外; + + @ApiModelProperty("需要") + @TableField("网络") + @Excel(name = "网络",combo={"4G","5G"}) + private String 网络; + + @TableField("现网状态") + @Excel(name = "现网状态",combo={"正常","未建立"}) + private String 现网状态; + + @TableField("cgi") + @Excel(name = "CGI") + private String cgi; + + @TableField("频点") + @Excel(name = "频点") + private Long 频点; + + @TableField("pci") + @Excel(name = "pci") + private Long pci; + + @TableField("tac") + @Excel(name = "tac") + private Long tac; + + @TableField("一级场景") + @Excel(name = "一级场景") + private String 一级场景; + + @TableField("二级场景") + @Excel(name = "二级场景") + private String 二级场景; + + @ApiModelProperty("需要 spot_cell_type") + @TableField("设备类型") + @Excel(name = "设备类型") + private String 设备类型; + + @TableField(exist = false) + @Excel(name = "带宽") + private String 带宽str; + + @ApiModelProperty("需要") + @TableField("带宽") + private Double 带宽; + + @ApiModelProperty("需要") + @TableField("方位角") + @Excel(name = "方位角") + private Long 方位角; + + @TableField("扇区id") + @Excel(name = "扇区ID") + private Long 扇区id; + + @TableField("更新时间") + private LocalDateTime 更新时间; + + @ApiModelProperty("景区ID,需要") + @TableField("景区id") + @Excel(name = "景区ID") + private Integer 景区id; + + @ApiModelProperty("坐席编号") + @TableField("坐席编号") + @Excel(name = "坐席编号") + private String 坐席编号; + + @ApiModelProperty("场景类型编码") + @TableField("场景类型编码") + @Excel(name = "场景类型编码") + private String 场景类型编码; + + @ApiModelProperty("场景类型") + @TableField("场景类型") + @Excel(name = "场景类型") + private String 场景类型; + + @ApiModelProperty("场景子类型编码") + @TableField("场景子类型编码") + @Excel(name = "场景子类型编码") + private String 场景子类型编码; + + @ApiModelProperty("场景子类型") + @TableField("场景子类型") + @Excel(name = "场景子类型") + private String 场景子类型; + + @ApiModelProperty("场景编码") + @TableField("场景编码") + @Excel(name = "场景编码") + private String 场景编码; + + @ApiModelProperty("覆盖子场景编码") + @TableField("覆盖子场景编码") + @Excel(name = "覆盖子场景编码") + private String 覆盖子场景编码; + + @ApiModelProperty("覆盖子场景") + @TableField("覆盖子场景") + @Excel(name = "覆盖子场景") + private String 覆盖子场景; + + @TableField(exist = false) + @Excel(name = "失败原因") + private String reason; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2SpotConfig.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2SpotConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..a6732104278802ef56ab9f0304e8b7693d1ee78f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2SpotConfig.java @@ -0,0 +1,54 @@ +package com.ruoyi.eastcom_yw.domain; + +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 lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author ck + * @since 2023-08-09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("dp_2_spot_config") +@ApiModel(value = "Dp2SpotConfig对象", description = "") +public class Dp2SpotConfig { + + private static final long serialVersionUID = 1L; + + @TableField("景区id") + @TableId(value = "景区id",type = IdType.AUTO) + private Integer 景区id; + + @TableField("景区名称") + private String 景区名称; + + // yw_county + @TableField("行政区域") + private String 行政区域; + + @TableField("中心经度") + private Object 中心经度; + + @TableField("中心纬度") + private Object 中心纬度; + + @TableField("景区介绍") + private String 景区介绍; + + //spot_type + @TableField("景区大类") + private String 景区大类; + + @TableField("景区大类id") + private Integer 景区大类id; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2ViewPowerAlarm.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2ViewPowerAlarm.java new file mode 100644 index 0000000000000000000000000000000000000000..90484261825dcba1a46038144742a51b969de056 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2ViewPowerAlarm.java @@ -0,0 +1,81 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author wqx + * @since 2023-08-31 + */ +@Data +@TableName("dp_2_view_power_alarm") +@ApiModel(value = "Dp2ViewPowerAlarm对象", description = "") +public class Dp2ViewPowerAlarm { + + private static final long serialVersionUID = 1L; + + @TableField("eventtime") + private LocalDateTime eventtime; + + @TableField("alarmname") + private String alarmname; + + @TableField("alarmid") + private Long alarmid; + + @TableField("severity") + private String severity; + + @TableField("site_id") + private String siteId; + + @TableField("site_name") + private String siteName; + + @TableField("device_name") + private String deviceName; + + @TableField("owner") + private String owner; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("area") + private String area; + + @TableField("logicalsites") + private String logicalsites; + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("区域id") + private Integer 区域id; + + @TableField("场馆名称") + private String 场馆名称; + + @TableField("故障处理人") + private String 故障处理人; + + @TableField("phonenumber") + private String phonenumber; + + @TableField("deal_status") + private Integer dealStatus; + + @TableField("deal_time") + private LocalDateTime dealTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2ViewWirelessAlarm.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2ViewWirelessAlarm.java new file mode 100644 index 0000000000000000000000000000000000000000..73f094b720df1d49b1d9d4c661067228cf3e13cf --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/Dp2ViewWirelessAlarm.java @@ -0,0 +1,89 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author wqx + * @since 2023-09-01 + */ +@Data +@TableName("dp_2_view_wireless_alarm") +@ApiModel(value = "Dp2ViewWirelessAlarm对象", description = "") +public class Dp2ViewWirelessAlarm { + + private static final long serialVersionUID = 1L; + + @TableField("id") + private Long id; + + @TableField("eventtime") + private LocalDateTime eventtime; + + @TableField("alarmname") + private String alarmname; + + @TableField("omcname") + private String omcname; + + @TableField("site_id") + private String siteId; + + @TableField("site_name") + private String siteName; + + @TableField("area") + private String area; + + @TableField("alarmid") + private String alarmid; + + @TableField("sitetype") + private String sitetype; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("cell_name") + private String cellName; + + @TableField("场馆id") + private Long 场馆id; + + @TableField("场馆名称") + private String 场馆名称; + + @TableField("longitude") + private Object longitude; + + @TableField("latitude") + private Object latitude; + + @TableField("坐席编号") + private String 坐席编号; + + @TableField("场内场外") + private String 场内场外; + + @TableField("区域id") + private Integer 区域id; + + @TableField("故障处理人") + private String 故障处理人; + + @TableField("phonenumber") + private String phonenumber; + + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/DpSceneConfig.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/DpSceneConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..1c9adb80ea7b540f6a7b7d0c10930fbb54a777c4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/DpSceneConfig.java @@ -0,0 +1,74 @@ +package com.ruoyi.eastcom_yw.domain; + +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 java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("dp_scene_config") +@ApiModel(value = "DpSceneConfig对象", description = "") +public class DpSceneConfig { + + private static final long serialVersionUID = 1L; + @ApiModelProperty("自增id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("颜色等级") + @TableField("level") + private Short level; + + @ApiModelProperty("指标名称") + @TableField("name") + private String name; + + @ApiModelProperty("最小值") + @TableField("range1") + private Object range1; + + @ApiModelProperty("最大值") + @TableField("range2") + private Object range2; + + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @ApiModelProperty("备注") + @TableField("content") + private String content; + + @ApiModelProperty("指标等级:cell、scene") + @TableField("type") + private String type; + + @ApiModelProperty("网络类型") + @TableField("nettype") + private String nettype; + + @ApiModelProperty("小区设备") + @TableField("celltype") + private String celltype; + + @ApiModelProperty("颜色分值") + @TableField("colorscore") + private Double colorscore; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/HmAlarmDerive.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/HmAlarmDerive.java new file mode 100644 index 0000000000000000000000000000000000000000..f4de081df977ea459ccbe998300c24f5c9f426fb --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/HmAlarmDerive.java @@ -0,0 +1,84 @@ +package com.ruoyi.eastcom_yw.domain; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-08-02 + */ +@Data +@TableName("hm_alarm_derive") +public class HmAlarmDerive implements Serializable { + +private static final long serialVersionUID=1L; + + + private Long id; + + private Long groupid; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "告警时间" ,sort = 4) + private LocalDateTime 告警时间; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "恢复时间" ,sort = 5) + private LocalDateTime 恢复时间; + + @Excel(name = "区县" ,sort = 1) + private String 分公司; + + @Excel(name = "网元名称" ,sort = 6) + private String 网元名称; + + @Excel(name = "端口" ,sort = 7) + private String 端口; + + @Excel(name = "场馆名称" ,sort = 2) + private String 场馆名称; + + private String 场馆等级; + + @Excel(name = "告警名称" ,sort = 3) + private String 告警名称; + + @Excel(name = "详细位置" ,sort = 9) + private String 详细位置; + + @Excel(name = "专业" ,sort = 8) + private String 专业; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime 告警插入时间; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime 恢复更新时间; + + private String mark; + + private String yClearid; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime 修改时间; + + @TableField(exist = false) + private String alarmType = "yayun"; + + @TableField(exist = false) + private Long alarmId; + + @TableField(exist = false) + private String alarmKey; + +} \ No newline at end of file diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi4gCell.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi4gCell.java new file mode 100644 index 0000000000000000000000000000000000000000..0611ed31e403c2a301b22a483862edcd76953eaa --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi4gCell.java @@ -0,0 +1,200 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 场馆4G小区级15分钟指标 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi4g_cell") +@ApiModel(value = "PmKpi4gCell对象", description = "场馆4G小区级15分钟指标") +public class PmKpi4gCell { + + private static final long serialVersionUID = 1L; +// @ApiModelProperty("id") +// @TableField("id") +// private Long id; + + @TableField("venue_id") + private Integer venueId; + + @TableField("venue_name") + private String venueName; + + @TableField("cellcodeci") + private String cellcodeci; + + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("小区名称") + private String 小区名称; + + @TableField("上行流量mb") + private BigDecimal 上行流量mb; + + @TableField("下行流量mb") + private BigDecimal 下行流量mb; + + @TableField("有效rrc连接平均数") + private BigDecimal 有效rrc连接平均数; + + @TableField("有效rrc连接最大数") + private BigDecimal 有效rrc连接最大数; + + @TableField("平均用户数") + private BigDecimal 平均用户数; + + @TableField("最大用户数") + private BigDecimal 最大用户数; + + @TableField("volte话务量") + private BigDecimal volte话务量; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("上行平均干扰") + private BigDecimal 上行平均干扰; + + @TableField("rrc建立成功率") + private BigDecimal rrc建立成功率; + + @TableField("e_rab建立成功率") + private BigDecimal eRab建立成功率; + + @TableField("qci为1的e_rab建立成功率") + private BigDecimal qci为1的eRab建立成功率; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("掉线次数") + private BigDecimal 掉线次数; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("esrvcc切换成功率") + private BigDecimal esrvcc切换成功率; + + @TableField("esrvcc切换请求次数") + private BigDecimal esrvcc切换请求次数; + + @TableField("rrc重建成功率") + private BigDecimal rrc重建成功率; + + @TableField("rrc重建次数") + private BigDecimal rrc重建次数; + + @TableField("volte掉话率") + private BigDecimal volte掉话率; + + @TableField("volte掉话次数") + private BigDecimal volte掉话次数; + + @TableField("rru_puschprbassn") + private BigDecimal rruPuschprbassn; + + @TableField("rru_puschprbtot") + private BigDecimal rruPuschprbtot; + + @TableField("rru_pdschprbassn") + private BigDecimal rruPdschprbassn; + + @TableField("rru_pdschprbtot") + private BigDecimal rruPdschprbtot; + + @TableField("rrc_succconnestab") + private BigDecimal rrcSuccconnestab; + + @TableField("rrc_attconnestab") + private BigDecimal rrcAttconnestab; + + @TableField("erab_nbrsuccestab_1") + private BigDecimal erabNbrsuccestab1; + + @TableField("erab_nbrattestab") + private BigDecimal erabNbrattestab; + + @TableField("erab_nbrattestab_1") + private BigDecimal erabNbrattestab1; + + @TableField("切换成功率_分母") + private BigDecimal 切换成功率分母; + + @TableField("切换成功率_分子") + private BigDecimal 切换成功率分子; + + @TableField("掉线率_分母") + private BigDecimal 掉线率分母; + + @TableField("iratho_succoutgeran") + private BigDecimal irathoSuccoutgeran; + + @TableField("rrc_attconnreestab") + private BigDecimal rrcAttconnreestab; + + @TableField("volte掉话率_分母") + private BigDecimal volte掉话率分母; + + @TableField("erab_nbrsuccestab") + private BigDecimal erabNbrsuccestab; + + @TableField("omcname") + private String omcname; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("rrc_failconnestab") + private BigDecimal rrcFailconnestab; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("groupid") + private Long groupid; + + @TableField("endtime") + private LocalDateTime endtime; + + ///////////////////////////////// + @TableField(exist = false) + private Integer orderId; + + @TableField(exist = false) + private String 坐席编号; + + @TableField(exist = false) + private String 小区频段; + + @TableField(exist = false) + private String 设备类型; + + @TableField(exist = false) + private Long 带宽; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi4gMin.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi4gMin.java new file mode 100644 index 0000000000000000000000000000000000000000..a0d19aac78bff95b715fb6ec6b3bb03a9ba48d07 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi4gMin.java @@ -0,0 +1,126 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 场馆4G小区级1分钟指标 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi4g_min") +@ApiModel(value = "PmKpi4gMin对象", description = "场馆4G小区级1分钟指标") +public class PmKpi4gMin { + + private static final long serialVersionUID = 1L; + + @TableField("groupid") + private Integer groupid; + + @TableField("时间") + private LocalDateTime 时间; + + @TableField("小区名称") + private String 小区名称; + + @TableField("地市区号") + private String 地市区号; + + @TableField("厂商id") + private String 厂商id; + + @TableField("avg_user") + private BigDecimal avgUser; + + @TableField("max_user") + private Integer maxUser; + + @TableField("prb_up") + private BigDecimal prbUp; + + @TableField("prb_down") + private BigDecimal prbDown; + + @TableField("avg_disturb") + private Integer avgDisturb; + + @TableField("speed_up") + private BigDecimal speedUp; + + @TableField("speed_down") + private BigDecimal speedDown; + + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @TableField("call_drop_rate") + private BigDecimal callDropRate; + + @TableField("act_avg_user") + private BigDecimal actAvgUser; + + @TableField("act_max_user") + private Integer actMaxUser; + + @TableField("volte") + private BigDecimal volte; + + @TableField("volte_succ_rate") + private BigDecimal volteSuccRate; + + @TableField("volte_drop_rate") + private BigDecimal volteDropRate; + + @TableField("data_up") + private BigDecimal dataUp; + + @TableField("data_down") + private BigDecimal dataDown; + + @TableField("v1_max") + private BigDecimal v1Max; + + @TableField("v1_avg") + private String v1Avg; + + @TableField("update_time") + private LocalDateTime updateTime; + + ///////////////////////////////// + @TableField(exist = false) + private Integer orderId; + + @TableField(exist = false) + private String venueName; + + @TableField(exist = false) + private String venueId; + + @TableField(exist = false) + private String cellcodeci; + + @TableField(exist = false) + private String 小区频段; + + @TableField(exist = false) + private String 设备类型; + + @TableField(exist = false) + private Long 带宽; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi4gVenue.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi4gVenue.java new file mode 100644 index 0000000000000000000000000000000000000000..47cdd032ace514d0bf9a1ac6f92c3ade0129bf87 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi4gVenue.java @@ -0,0 +1,86 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi4g_venue") +@ApiModel(value = "PmKpi4gVenue对象", description = "4G场馆级15分钟指标") +public class PmKpi4gVenue { + + + private static final long serialVersionUID = 1L; + + @TableId("id") + private Long id; + + @TableField("开始时间") + private LocalDateTime 开始时间; + + @TableField("入库时间") + private LocalDateTime 入库时间; + + @TableField("区县") + private String 区县; + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + +// @TableField("流量GB") +// private Short 流量GB; + + @TableField("最大用户数") + private Short 最大用户数; + + @TableField("话务量") + private Short 话务量; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("上行平均干扰") + private Short 上行平均干扰; + + @TableField("volte接通率") + private BigDecimal volte接通率; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("结束时间") + private LocalDateTime 结束时间; + + @TableField("平均用户数") + private BigDecimal 平均用户数; + + ///////////////////////////////// + @TableField(exist = false) + private String venueName; + + @TableField(exist = false) + private String prbupColor; + + @TableField(exist = false) + private String prbdownColor; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi5gCell.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi5gCell.java new file mode 100644 index 0000000000000000000000000000000000000000..07df6b515fd6d54fc42d5f3e2462f3ab1d48c525 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi5gCell.java @@ -0,0 +1,183 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 场馆5G小区级15分钟指标 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi5g_cell_2") +@ApiModel(value = "PmKpi5gCell对象", description = "场馆5G小区级15分钟指标") +public class PmKpi5gCell { + + private static final long serialVersionUID = 1L; +// @ApiModelProperty("id") +// @TableField("id") +// private Long id; + + @TableField("venue_id") + private Integer venueId; + + @TableField("venue_name") + private String venueName; + + @TableField("ci") + private String ci; + + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("小区名称") + private String 小区名称; + + @TableField("nr流量") + private BigDecimal nr流量; + + @TableField("上行5g流量") + private BigDecimal 上行5g流量; + + @TableField("下行5g流量") + private BigDecimal 下行5g流量; + + @TableField("小区rlc层下行丢包率") + private BigDecimal 小区rlc层下行丢包率; + + @TableField("小区级rlc层sdu下行空口丢包数") + private BigDecimal 小区级rlc层sdu下行空口丢包数; + + @TableField("小区rlc层收到的下行sdu包数") + private BigDecimal 小区rlc层收到的下行sdu包数; + + @TableField("平均用户数") + private BigDecimal 平均用户数; + + @TableField("最大用户数") + private BigDecimal 最大用户数; + + @TableField("sn异常释放率") + private BigDecimal sn异常释放率; + + @TableField("sgnb释放总次数") + private BigDecimal sgnb释放总次数; + + @TableField("sgnb触发sgnb异常释放总次数") + private BigDecimal sgnb触发sgnb异常释放总次数; + + @TableField("nsa_sgnb添加成功率") + private BigDecimal nsaSgnb添加成功率; + + @TableField("dc场景下发送sgnb增加成功的次数") + private BigDecimal dc场景下发送sgnb增加成功的次数; + + @TableField("dc场景下收到sgnb增加尝试的次数") + private BigDecimal dc场景下收到sgnb增加尝试的次数; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("rrc建立成功次数") + private BigDecimal rrc建立成功次数; + + @TableField("rrc建立请求消息次数") + private BigDecimal rrc建立请求消息次数; + + @TableField("小区中qos_flow建立成功次数") + private BigDecimal 小区中qosFlow建立成功次数; + + @TableField("小区中qos_flow建立尝试次数") + private BigDecimal 小区中qosFlow建立尝试次数; + + @TableField("小区中ng信令连接建立成功次数") + private BigDecimal 小区中ng信令连接建立成功次数; + + @TableField("小区中ng信令连接建立尝试次数") + private BigDecimal 小区中ng信令连接建立尝试次数; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("小区中ue上下文异常释放的次数") + private BigDecimal 小区中ue上下文异常释放的次数; + + @TableField("小区中ue上下文正常释放的次数") + private BigDecimal 小区中ue上下文正常释放的次数; + + @TableField("无线掉线率分母") + private BigDecimal 无线掉线率分母; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("切换成功率分子") + private BigDecimal 切换成功率分子; + + @TableField("切换成功率分母") + private BigDecimal 切换成功率分母; + + @TableField("下行平均使用的prb个数") + private BigDecimal 下行平均使用的prb个数; + + @TableField("下行平均可用prb个数") + private BigDecimal 下行平均可用prb个数; + + @TableField("上行平均使用的prb个数") + private BigDecimal 上行平均使用的prb个数; + + @TableField("上行平均可用prb个数") + private BigDecimal 上行平均可用prb个数; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("cell_name") + private String cellName; + + @TableField("groupid") + private Long groupid; + + @TableField("上行干扰值") + private Double 上行干扰值; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("endtime") + private LocalDateTime endtime; + + + ///////////////////////////////// + @TableField(exist = false) + private Integer orderId; + + @TableField(exist = false) + private String 小区频段; + + @TableField(exist = false) + private String 设备类型; + + @TableField(exist = false) + private Long 带宽; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi5gMin.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi5gMin.java new file mode 100644 index 0000000000000000000000000000000000000000..83d5a03b899346ec45a60f6237461203415f0f94 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi5gMin.java @@ -0,0 +1,109 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 场馆5G小区级1分钟指标 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi5g_min") +@ApiModel(value = "PmKpi5gMin对象", description = "场馆5G小区级1分钟指标") +public class PmKpi5gMin { + + private static final long serialVersionUID = 1L; + + @TableField("groupid") + private Integer groupid; + + @TableField("时间") + private LocalDateTime 时间; + + @TableField("小区名称") + private String 小区名称; + + @TableField("地市区号") + private String 地市区号; + + @TableField("厂商id") + private String 厂商id; + + @TableField("prb_up") + private Double prbUp; + + @TableField("prb_down") + private Double prbDown; + + @TableField("up_disturb") + private Integer upDisturb; + + @TableField("speed_up") + private Double speedUp; + + @TableField("speed_down") + private Double speedDown; + + @TableField("act_max_user") + private Integer actMaxUser; + + @TableField("act_avg_user") + private Double actAvgUser; + + @TableField("rrc_avg_user") + private BigDecimal rrcAvgUser; + + @TableField("rrc_max_user") + private Integer rrcMaxUser; + + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @TableField("drop_call_rate") + private BigDecimal dropCallRate; + + @TableField("data_down") + private BigDecimal dataDown; + + @TableField("data_up") + private BigDecimal dataUp; + + @TableField("update_time") + private LocalDateTime updateTime; + + ///////////////////////////////// + @TableField(exist = false) + private Integer orderId; + + @TableField(exist = false) + private String venueName; + + @TableField(exist = false) + private String venueId; + + @TableField(exist = false) + private String cellcodeci; + + @TableField(exist = false) + private String 小区频段; + + @TableField(exist = false) + private String 设备类型; + + @TableField(exist = false) + private Long 带宽; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi5gVenue.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi5gVenue.java new file mode 100644 index 0000000000000000000000000000000000000000..ef744b661292f875df0a9ee7485ff9f0349a375a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpi5gVenue.java @@ -0,0 +1,99 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 5G场馆级15分钟指标 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi5g_venue_2") +@ApiModel(value = "PmKpi5gVenue对象", description = "5G场馆级15分钟指标") +public class PmKpi5gVenue { + + private static final long serialVersionUID = 1L; + + @TableId("id") + private Long id; + + @TableField("开始时间") + private LocalDateTime 开始时间; + + @TableField("入库时间") + private LocalDateTime 入库时间; + + @TableField("区县") + private String 区县; + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("nsa_sgnb添加成功率") + private BigDecimal nsaSgnb添加成功率; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("sn异常释放率") + private BigDecimal sn异常释放率; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("流量GB") + private BigDecimal 流量GB; + + @TableField("最大用户数") + private Short 最大用户数; + + @TableField("话务量") + private BigDecimal 话务量; + + @TableField("上行干扰值") + private Double 上行干扰值; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("结束时间") + private LocalDateTime 结束时间; + + @TableField("平均用户数") + private BigDecimal 平均用户数; + + ///////////////////////////////// + @TableField(exist = false) + private String venueName; + + + @TableField(exist = false) + private String prbupColor; + + @TableField(exist = false) + private String prbdownColor; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpiMaxEntity.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpiMaxEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..fd09fb5c7cea32c1a7ac4b47016187d2654b851b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpiMaxEntity.java @@ -0,0 +1,21 @@ +package com.ruoyi.eastcom_yw.domain; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author yqf + * @date 2023/4/19 + */ +@Data +public class PmKpiMaxEntity { + + private BigDecimal avgNum; + private BigDecimal maxuserNum; + private BigDecimal prbupNum; + private BigDecimal prbdownNum; + private BigDecimal avgDisturb; + private BigDecimal succesNum; + private BigDecimal failNum; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpiMonitorEntity.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpiMonitorEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..83d33a4ee44d8a09e263c6be814e88ba1ccf32a4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/PmKpiMonitorEntity.java @@ -0,0 +1,75 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "PmKpiMonitorEntity对象", description = "场馆4G小区级1分钟指标") +public class PmKpiMonitorEntity { + + private static final long serialVersionUID = 1L; + private Long id; + + private Integer venueid; + + private String venuename; + + private String cellcodeci; + + private LocalDateTime starttime; + + private String 小区名称; + + private BigDecimal 平均用户数; + + private BigDecimal 最大用户数; + + private BigDecimal 上行prb利用率; + + private BigDecimal 下行prb利用率; + + private BigDecimal 上行平均干扰; + + private BigDecimal 无线掉线率; + + private BigDecimal 无线接通率; + + private LocalDateTime endtime; + + private Integer orderId; + + private String 坐席编号; + + private LocalDateTime 时间; + + private Long stationno; + private String pointname; + private String pointid; + private Double longitude; + private Double latitude; + + private String maxuserColor; + private String prbupColor; + private String prbdownColor; + private String avgdisColor; + private Integer maxuserScore; + private Integer prbupScore; + private Integer prbdownScore; + private Integer avgdisScore; + + private String 小区频段; + private String 设备类型; + private Long 带宽; + private Long 方位角; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/SysNotice.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/SysNotice.java new file mode 100644 index 0000000000000000000000000000000000000000..2929fcf9d384d7a291ee150adb1a944e82657239 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/SysNotice.java @@ -0,0 +1,144 @@ +package com.ruoyi.eastcom_yw.domain; + +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 com.ruoyi.common.mybatis.JsonListLongTypeHandler; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知公告表 + *

+ * + * @author ck + * @since 2023-04-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName(value = "sys_notice" ,autoResultMap = true) +@ApiModel(value = "SysNotice对象", description = "通知公告表") +public class SysNotice { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("自增id") + @TableId(value = "notice_id", type = IdType.AUTO) + private Integer noticeId; + + @ApiModelProperty("通知标题") + @TableField("notice_title") + private String noticeTitle; + + @ApiModelProperty("通知类型--字典表sys_notice_type 短信3 移动办公5 IVR7") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("状态 0未读 1已读") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("插入时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("接收人") + @TableField("recive_user") + private Long reciveUser; + + @ApiModelProperty("工作流id") + @TableField("flw_processid") + private String flwProcessid; + + @ApiModelProperty("工作流任务id") + @TableField("flw_taskid") + private String flwTaskid; + + @ApiModelProperty("实际发送时间") + @TableField("send_time") + private LocalDateTime sendTime; + + @ApiModelProperty("发送是否成功,1成功 0失败") + @TableField("send_status") + private String sendStatus; + + @ApiModelProperty("接收人手机号") + @TableField("recive_user_phone") + private String reciveUserPhone; + + @ApiModelProperty("计划发送时间(同天当前时间之前立即发送)") + @TableField("exp_send_time") + private LocalDateTime expSendTime; + + @ApiModelProperty("加入定时任务标记 默认0未加入 1已加入") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知对象ids数组") + @TableField(value = "notice_object_id",typeHandler = JsonListLongTypeHandler.class) + private List noticeObjectId; + + @ApiModelProperty("通知模板id") + @TableField("notice_model_id") + private Long noticeModelId; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + private String modelScene; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知对象(是指具体的通知接受者,呈现方式包括场馆+群组;分公司+群组名;地市+群组名;ITCC+群组名;场馆+个人名;分公司+个人名;地市+个人名;ITCC+个人名这几种组合。具体呈现内容和对象属性、通知方式相关联)") + @TableField("notice_object") + private String noticeObject; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("接收人群号") + @TableField("group_id") + private String groupId; + + @ApiModelProperty("关联表id(yw_notice_handwork)") + @TableField("handwork_id") + private Long handworkId; + + @ApiModelProperty("通知对象名称数组") + @TableField("notice_object_name_str") + private String noticeObjectNameStr; + + @ApiModelProperty("发送人(由谁发送)") + @TableField("send_user") + private Long sendUser; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/SysUserImp.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/SysUserImp.java new file mode 100644 index 0000000000000000000000000000000000000000..a0ae3366f9727aca883bfb2d7b04af83c2f8fc59 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/SysUserImp.java @@ -0,0 +1,45 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class SysUserImp extends ResultBean { + private Long user_id; + @Excel(name = "姓名", sort = 2) + private String user_name; + @Excel(name = "手机号码", sort = 3) + private String phonenumber; + private String avatar; + @Excel(name = "账号状态", sort = 5) + private String status; + private Long roleId; + @Excel(name = "角色", sort = 6) + private String roleName; + private String specialtyCode; + @Excel(name = "专业", sort = 7) + private String specialty; + private String cityId; + @Excel(name = "地市", sort = 8) + private String city; + private String countyId; + @Excel(name = "区县", sort = 9) + private String county; + private Long sceneId; + @Excel(name = "场馆", sort = 10) + private String sceneName; + @Excel(name = "场馆分区", sort = 11) + private String belongArea; + @Excel(name = "是否要签到", sort = 12) + private String needSign; + @Excel(name = "自有/三方", sort = 13) + private String ywUserBelong; + private String createTime; + private String loginDate; + private String loginIp; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarm.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarm.java new file mode 100644 index 0000000000000000000000000000000000000000..e264655a48356ceb9d8097eebdeef4416cc5b30c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarm.java @@ -0,0 +1,55 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + + +/** +* @author jkj +* @since 2023-01-12 +**/ + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_alarm_all") +public class YwAlarm implements Serializable { + private static final long serialVersionUID=1L; + + private String id; + + private String 告警时间; + + private String 恢复时间; + + private String 告警编号; + + private String 告警名称; + + private String 场馆名称; + + private String 告警等级; + + private String 基站号; + + private String 基站名; + + private String 网元名称; + + private String 关联组号; + + private String 告警类型; + + private String 红线内; + + private String alarmType; + + private String 类型; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmCS.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmCS.java new file mode 100644 index 0000000000000000000000000000000000000000..295786780020c454be43cc683593936f2a5d8b0b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmCS.java @@ -0,0 +1,55 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + + +/** +* @author jkj +* @since 2023-01-12 +**/ + +@Data +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_alarm_last_cs") +public class YwAlarmCS extends YwAlarmView implements Serializable { + + private Long 场馆id; + + private String dealUserId; + + private String dealUser; + + private String dealStatus; + + private String processId; + + private String taskId; + + private Date endTime; + + private String areaCountyId; + + private String city; + + private String county; + + private String alarmType; + + private String alarmStatus; + + private String belongArea; + + private String lastClearTime; + + private String isHangup; + + private Integer clearNum; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmConfig.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..6002a8923d73140110a787b974d0939d512a75e9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmConfig.java @@ -0,0 +1,31 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_alarm_config") +public class YwAlarmConfig { + + private Long id; + + private String alarmCode; + + private Long dealHour; + + private Long sceneBigId; + + private String alarmName; + + private String specialty; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmDH.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmDH.java new file mode 100644 index 0000000000000000000000000000000000000000..519720bc406c0415a3735e48489222d5e00ba9ba --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmDH.java @@ -0,0 +1,55 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + + +/** +* @author jkj +* @since 2023-01-12 +**/ + +@Data +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_alarm_last_dh") +public class YwAlarmDH extends YwAlarmView implements Serializable { + + private Long 场馆id; + + private String dealUserId; + + private String dealUser; + + private String dealStatus; + + private String processId; + + private String taskId; + + private Date endTime; + + private String areaCountyId; + + private String city; + + private String county; + + private String alarmType; + + private String alarmStatus; + + private String belongArea; + + private String lastClearTime; + + private String isHangup; + + private Integer clearNum; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmHangupLog.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmHangupLog.java new file mode 100644 index 0000000000000000000000000000000000000000..168d0b2ee98cf16f57b939db35a21d063cf59241 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmHangupLog.java @@ -0,0 +1,77 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-02-15 + */ +@Data +@TableName("yw_alarm_hangup_log") +public class YwAlarmHangupLog implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(type= IdType.AUTO) + private Long id; + + /** + * 大场景id + */ + private Long sceneBigId; + + /** + * 挂起时间 + */ + private Date hangupTime; + + /** + * 挂起人 + */ + private Long hangupUserId; + + /** + * 恢复处理时间 + */ + private Date recoveryTime; + + /** + * 恢复结果 + */ + private String recoveryResult; + + /** + * 挂起原因 + */ + private String hangupReason; + + /** + * 工作流进程id + */ + private String flwProcessid; + + /** + * 工作流任务id + */ + private String flwTaskid; + + /** + * 挂起状态 + */ + private String hangupStatus; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmHangupReover.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmHangupReover.java new file mode 100644 index 0000000000000000000000000000000000000000..39786460d03e39e11a712f069d42b424f0ceb813 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmHangupReover.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-02-15 + */ +@Data +public class YwAlarmHangupReover extends YwAlarmHangupLog implements Serializable { + /** + * 告警是否恢复 + */ + private String isRecover; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmOprateLog.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmOprateLog.java new file mode 100644 index 0000000000000000000000000000000000000000..c2f39316250e234a1450e6c8eb5f569e8049f807 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmOprateLog.java @@ -0,0 +1,49 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-03-06 + */ +@Data +@TableName("yw_alarm_oprate_log") +public class YwAlarmOprateLog implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 序号 + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + /** + * 告警组号 + */ + private String alarmGroup; + + /** + * 用户id + */ + private Long userId; + + /** + * 操作时间 + */ + private String oprateTime; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmRecover.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmRecover.java new file mode 100644 index 0000000000000000000000000000000000000000..4bc292a31b148227978f7032c338878b096d28ac --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmRecover.java @@ -0,0 +1,44 @@ +package com.ruoyi.eastcom_yw.domain; + +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 告警自动恢复 + *

+ * + * @author jkj + * @since 2023-02-15 + */ +@Data +public class YwAlarmRecover implements Serializable { + + /** + * 告警分组号 + */ + private Long alarmId; + + /** + * 告警类型 + */ + private String alarmType; + + /** + * 工作流进程id + */ + private String flwProcessid; + + /** + * 工作流任务id + */ + private String flwTaskid; + + + /** + * 最后清除时间 + */ + private String lastClearTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmView.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmView.java new file mode 100644 index 0000000000000000000000000000000000000000..6a20ba29a967d2aa742dbc3b3ce32f2be6727b36 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmView.java @@ -0,0 +1,56 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + + +/** +* @author jkj +* @since 2023-01-12 +**/ + +@Data +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_alarm_last") +public class YwAlarmView extends YwAlarm implements Serializable { + + private Long 场馆id; + + private String dealUserId; + + private String dealUser; + + private String dealStatus; + + private String processId; + + private String taskId; + + private Date endTime; + + private String areaCountyId; + + private String city; + + private String county; + + private String alarmType; + + private String alarmStatus; + + private String belongArea; + + private String lastClearTime; + + private String isHangup; + + private Integer clearNum; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmWX.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmWX.java new file mode 100644 index 0000000000000000000000000000000000000000..9b26a33105039df882ef0cf180735d8d5b5fe22c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwAlarmWX.java @@ -0,0 +1,55 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + + +/** +* @author jkj +* @since 2023-01-12 +**/ + +@Data +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_alarm_last_wx") +public class YwAlarmWX extends YwAlarmView implements Serializable { + + private Long 场馆id; + + private String dealUserId; + + private String dealUser; + + private String dealStatus; + + private String processId; + + private String taskId; + + private Date endTime; + + private String areaCountyId; + + private String city; + + private String county; + + private String alarmType; + + private String alarmStatus; + + private String belongArea; + + private String lastClearTime; + + private String isHangup; + + private Integer clearNum; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwDrsConfig.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwDrsConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..f016b5eb8819b2b2fb0d54181fb745f4e437aa51 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwDrsConfig.java @@ -0,0 +1,67 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + *

+ * DRS配置表 + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("yw_drs_config") +@ApiModel(value = "YwDrsConfig对象", description = "DRS配置表") +public class YwDrsConfig { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("任务名称") + @TableField("task_name") + private String taskName; + + @ApiModelProperty("任务类型 drs_task_type 0 / 1 签到 2巡检") + @TableField("drs_task_type") + private String drsTaskType; + + @ApiModelProperty("状态") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("删除标记") + @TableField("del_flag") + private String delFlag; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwDrsTempTask.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwDrsTempTask.java new file mode 100644 index 0000000000000000000000000000000000000000..7ddc7eff697cacebe2c61d4cd61b4a69dace81fe --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwDrsTempTask.java @@ -0,0 +1,93 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * DRS临时任务表 + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("yw_drs_temp_task") +@KeySequence(value ="yw_drs_temp_task_seq" ,dbType = DbType.POSTGRE_SQL) +@ApiModel(value = "YwDrsTempTask对象", description = "DRS临时任务表") +public class YwDrsTempTask { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("任务日期") + @TableField("task_date") + private LocalDate taskDate; + + @ApiModelProperty("任务时间") + @TableField("task_time") + private LocalDateTime taskTime; + + @ApiModelProperty("任务结束时间") + @TableField("task_end_time") + private LocalDateTime taskEndTime; + + @ApiModelProperty("任务名称") + @TableField("task_name") + private String taskName; + + @ApiModelProperty("DRS任务类型 drs_task_type 0 / 1 签到 2巡检") + @TableField("drs_task_type") + private String drsTaskType; + + @ApiModelProperty("DRS任务状态 drs_task_status 0未开始 1进行中 2已完成") + @TableField("drs_task_status") + private String drsTaskStatus; + + @ApiModelProperty("自动状态变更 drs_auto_update 0自动 1手动") + @TableField("drs_auto_update") + private String drsAutoUpdate; + + @ApiModelProperty("状态") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("删除标记") + @TableField("del_flag") + private String delFlag; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwKpiConfig.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwKpiConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..22bdbdec2336456f155e6fd622109354285d4fb3 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwKpiConfig.java @@ -0,0 +1,84 @@ +package com.ruoyi.eastcom_yw.domain; + +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 java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 指标字段阈值配置表 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("yw_kpi_config") +@ApiModel(value = "YwKpiConfig对象", description = "指标字段阈值配置表") +public class YwKpiConfig { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("序号") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("专业(字典表)") + @TableField("subject") + private String subject; + + @ApiModelProperty("网络模式(字典表)") + @TableField("net_type") + private String netType; + + @ApiModelProperty("指标字段") + @TableField("kpi_field") + private Long kpiField; + + @ApiModelProperty("阈值范围") + @TableField("threshold_value") + private String thresholdValue; + + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("最小是(包括本值)") + @TableField("min_value") + private Object minValue; + + @ApiModelProperty("最大值(不包括本值)") + @TableField("max_value") + private Object maxValue; + + @ApiModelProperty("指标名") + @TableField("kpi_field_name") + private String kpiFieldName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeBriefing.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeBriefing.java new file mode 100644 index 0000000000000000000000000000000000000000..d583b352fddc0117447f6cc41c2be5546c013585 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeBriefing.java @@ -0,0 +1,108 @@ +package com.ruoyi.eastcom_yw.domain; + +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 com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import com.ruoyi.common.mybatis.JsonListLongTypeHandler; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告简报计划表 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName(value = "yw_notice_briefing",autoResultMap = true) +@ApiModel(value = "YwNoticeBriefing对象", description = "通知通告简报计划表") +public class YwNoticeBriefing { + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + private String city; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("发送日期") + @TableField("send_date") + private LocalDate sendDate; + + @ApiModelProperty("开始时间") + @TableField("begin_time") + private LocalDateTime beginTime; + + @ApiModelProperty("结束时间") + @TableField("end_time") + private LocalDateTime endTime; + + @ApiModelProperty("区县") + @TableField("county") + private String county; + + @ApiModelProperty("对象ids数组") + @TableField(value = "object_ids",typeHandler = JsonListLongTypeHandler.class) + private List objectIds; + + @ApiModelProperty("模板id") + @TableField("model_id") + private Long modelId; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("时间间隔(单位分)") + @TableField("time_interval") + private Integer timeInterval; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + private String noticeName; + + @ApiModelProperty("启用状态 sys_normal_disable 0启用 1停用") + @TableField("sys_normal_disable") + private String sysNormalDisable; + + @ApiModelProperty("通知对象名称数组") + @TableField("notice_object_name_str") + private String noticeObjectNameStr; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3文字简报 4h5简报)") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("发送方式 send_type (1自动发送 2手工发送)") + @TableField("send_type") + private String sendType; + + @ApiModelProperty("发送人员") + @TableField("send_user") + private Long sendUser; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeHandwork.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeHandwork.java new file mode 100644 index 0000000000000000000000000000000000000000..357a979ffa5e81f81e8cea6000bf5edc9a2d87c4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeHandwork.java @@ -0,0 +1,96 @@ +package com.ruoyi.eastcom_yw.domain; + +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 com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import com.ruoyi.common.mybatis.JsonListLongTypeHandler; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告手工通知计划表 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName(value = "yw_notice_handwork",autoResultMap = true) +@ApiModel(value = "YwNoticeHandwork对象", description = "通知通告手工通知计划表") +public class YwNoticeHandwork { + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + private String noticeName; + + @ApiModelProperty("通知模板id") + @TableField("notice_model") + private Long noticeModel; + + @ApiModelProperty("通知方式--sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("通知对象ids") + @TableField(value = "notice_object",typeHandler = JsonListLongTypeHandler.class) + private List noticeObject; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("通知状态yw_veriy_status 0待提交 1待审核 2已审核") + @TableField("notice_status") + private String noticeStatus; + + @ApiModelProperty("日期") + @TableField("notice_date") + private LocalDateTime noticeDate; + + @ApiModelProperty("开始时间") + @TableField("begin_time") + private LocalDateTime beginTime; + + @ApiModelProperty("结束时间") + @TableField("end_time") + private LocalDateTime endTime; + + @ApiModelProperty("时间间隔(单位分)") + @TableField("time_interval") + private Integer timeInterval; + + @ApiModelProperty("工作流processid") + @TableField("flw_processid") + private String flwProcessid; + + @ApiModelProperty("申请人id") + @TableField("apply_id") + private Long applyId; + + @ApiModelProperty("审核人id") + @TableField("audit_id") + private Long auditId; + + @ApiModelProperty("已添加到sys_notice标记(0否 1是)") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知对象名称数组") + @TableField("notice_object_name_str") + private String noticeObjectNameStr; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeHandworkdetail.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeHandworkdetail.java new file mode 100644 index 0000000000000000000000000000000000000000..aefaf497dd87853bca6f6c59994fbcb889177dd5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeHandworkdetail.java @@ -0,0 +1,55 @@ +package com.ruoyi.eastcom_yw.domain; + +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 lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 通知通告手工通知审核表 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("yw_notice_handworkdetail") +@ApiModel(value = "YwNoticeHandworkdetail对象", description = "通知通告手工通知审核表") +public class YwNoticeHandworkdetail { + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("手工通知id") + @TableField("handwork_id") + private Long handworkId; + + @ApiModelProperty("操作人(提交审核的人 或者 审核的人)") + @TableField("oprate_user") + private Long oprateUser; + + @ApiModelProperty("审核结果(关联字典表yw_veriy_result 0通过 1驳回)") + @TableField("veriy_result") + private String veriyResult; + + @ApiModelProperty("审核状态(关联字典表yw_veriy_status 0 待审核 1 已审核)") + @TableField("veriy_status") + private String veriyStatus; + + @ApiModelProperty("驳回原因") + @TableField("fail_reason") + private String failReason; + + @ApiModelProperty("附件") + @TableField("appendix") + private String appendix; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeList.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeList.java new file mode 100644 index 0000000000000000000000000000000000000000..0a896a55454b1fb7d3dae75e741645ee323c9bfc --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeList.java @@ -0,0 +1,100 @@ +package com.ruoyi.eastcom_yw.domain; + +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 com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import com.ruoyi.common.mybatis.JsonListLongTypeHandler; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告记录表 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName(value = "yw_notice_List",autoResultMap = true) +@ApiModel(value = "YwNoticeList对象", description = "通知通告记录表") +public class YwNoticeList { + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + private String noticeName; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + private String modelScene; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知方式--sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("通知时间(计划发送时间(同天当前时间之前立即发送))") + @TableField("notice_time") + private LocalDateTime noticeTime; + + @ApiModelProperty("通知对象") + @TableField("notice_object") + private String noticeObject; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("状态 0未读 1已读") + @TableField("status") + private String status; + + @ApiModelProperty("通知对象ids数组") + @TableField(value = "notice_object_id",typeHandler = JsonListLongTypeHandler.class) + private List noticeObjectId; + + @ApiModelProperty("通知模板id") + @TableField("notice_model_id") + private Long noticeModelId; + + @ApiModelProperty("实际发送时间") + @TableField("send_time") + private LocalDateTime sendTime; + + @ApiModelProperty("发送是否成功,1成功 0失败") + @TableField("send_status") + private String sendStatus; + + @ApiModelProperty("计划发送时间(同天当前时间之前立即发送)") + @TableField("exp_send_time") + private LocalDateTime expSendTime; + + @ApiModelProperty("加入定时任务标记 默认0未加入 1已加入") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("计划id(手工与简报会先配置计划)") + @TableField("plan_id") + private Long planId; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeModel.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeModel.java new file mode 100644 index 0000000000000000000000000000000000000000..60191c780d4003e798b77e014d949eca792a1090 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeModel.java @@ -0,0 +1,84 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.*; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.Valid; +import javax.validation.constraints.Size; +import java.time.LocalDateTime; + +/** + *

+ * 通知通告模板表 + *

+ * + * @author ck + * @since 2023-04-07 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("yw_notice_model") +@ApiModel(value = "YwNoticeModel对象", description = "通知通告模板表") +public class YwNoticeModel { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("模板名称") + @TableField("model_name") + @Excel(name = "模板名称") + @Size(min = 1,max = 2,message = "模板名称最短为1,最长为10") + private String modelName; + + @ApiModelProperty("模板内容") + @TableField("model_content") + @Excel(name = "模板内容") + private String modelContent; + + @ApiModelProperty("场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + @Excel(name = "适用场景", dictType = "yw_notice_scene") + private String modelScene; + + @ApiModelProperty("创建用户id") + @TableField(value = "create_user_id", fill = FieldFill.INSERT) + private Long createUserId; + + @ApiModelProperty("创建用户昵称") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty("模板适用类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + @Excel(name = "适用类型", readConverterExp = "1=普通,2=手工,3=简报") + private String modelSuitType; + + @ApiModelProperty("备注(写一些触发要求)") + @TableField("model_des") + @Excel(name = "备注") + private String modelDes; + + @ApiModelProperty("模板类型--字典yw_model_type 0事件触发型") + @TableField("model_type") + @Excel(name = "模板类型", dictType = "yw_model_type") + private String modelType; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeObject.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeObject.java new file mode 100644 index 0000000000000000000000000000000000000000..7e36de9cc796f3c0b8864cc0df194cbe6b786591 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeObject.java @@ -0,0 +1,103 @@ +package com.ruoyi.eastcom_yw.domain; + +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 com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import com.ruoyi.common.mybatis.JsonListLongTypeHandler; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + *

+ * 通知通告对象表 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName(value = "yw_notice_object",autoResultMap = true) +@ApiModel(value = "YwNoticeObject对象", description = "通知通告对象表") +public class YwNoticeObject { + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + private String city; + + @ApiModelProperty("区县") + @TableField("county") + private String county; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("场馆名称") + @TableField(exist=false) + private String venueName; + + @ApiModelProperty("专业") + @TableField("specialty") + private Long specialty; + + @ApiModelProperty("角色id数组") + @TableField(value = "role_ids",typeHandler= JacksonTypeHandler.class) + private List roleIds; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("短信组名") + @TableField("message_name") + private String messageName; + + @ApiModelProperty("短信组内成员id数组") + @TableField(value="message_users",typeHandler= JsonListLongTypeHandler.class) + private List messageUsers; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("群号") + @TableField("group_id") + private String groupId; + + @ApiModelProperty("群名") + @TableField("group_name") + private String groupName; + + @ApiModelProperty("备注") + @TableField("group_des") + private String groupDes; + + @ApiModelProperty("对象名称") + @TableField("object_name") + private String objectName; + + @ApiModelProperty("ivr组名") + @TableField("ivr_name") + private String ivrName; + + @ApiModelProperty("ivr组内成员id数组") + @TableField(value = "ivr_users",typeHandler= JsonListLongTypeHandler.class) + private List ivrUsers; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeUser.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeUser.java new file mode 100644 index 0000000000000000000000000000000000000000..14110e577e50fa67f43f8b1d832c6851a23ae509 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwNoticeUser.java @@ -0,0 +1,33 @@ +package com.ruoyi.eastcom_yw.domain; + + + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class YwNoticeUser implements Serializable { + + private static final long serialVersionUID=1L; + + private String flwProcessid; + + private String flwTaskid; + + private String title; + + private String content; + + private String userId; + + private String noticType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectConfig.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..8c3330c7ba7f3d37321bd80afd63e926e9577f5e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectConfig.java @@ -0,0 +1,49 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_rout_inspect_config") +public class YwRoutInspectConfig implements Serializable { + + private static final long serialVersionUID=1L; + + private Long id; + + private Long sceneId; + + private String specialty; + + private Integer checkNum; + + private String checkType; + + private String checkDesc; + + private Integer circle; + + private Long stopTimeOption; + + private Long intervalTime; + + private Long sceneBigId; + + private Integer inspectUserId; + + private String repWarnInterval; + + private String noticeType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectLog.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectLog.java new file mode 100644 index 0000000000000000000000000000000000000000..fa28d8b0cf3118dc4150e2a6480dcc59d0fcf987 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectLog.java @@ -0,0 +1,41 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_rout_inspect_log") +public class YwRoutInspectLog { + + private static final long serialVersionUID=1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long routInspectId; + + private String flwProcessid; + + private Integer checkNum; + + private Integer questionNum; + + private String questionDesc; + + private String feedBackUser; + + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date feedBackTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectPlan.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectPlan.java new file mode 100644 index 0000000000000000000000000000000000000000..4ac1c46b05edd15c57fe1d941a72da1cce09932b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectPlan.java @@ -0,0 +1,66 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_rout_inspect_plan") +public class YwRoutInspectPlan implements Serializable { + + private static final long serialVersionUID=1L; + + private Long id; + + private Long sceneId; + + private Date inspectDate; + + private String inspectSpecialty; + + private Date beginTime; + + private Date planFinTime; + + private Long sceneBigId; + + private Long type; + + private String inspectName; + + private Integer checkNum; + + private String checkType; + + private String checkDesc; + + private Integer circle; + + private Long stopTimeOption; + + private Long intervalTime; + + private Integer inspectUserId; + + private String repWarnInterval; + + private String noticeType; + + private String jobNo; + + @TableField(exist = false) + private String isGen; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectQuestionConfig.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectQuestionConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..832efdbfed9217de18b165847ee5e87735d8530e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwRoutInspectQuestionConfig.java @@ -0,0 +1,44 @@ +package com.ruoyi.eastcom_yw.domain; + +//import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.Excel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_rout_inspect_question_config") +public class YwRoutInspectQuestionConfig { + + @Excel(name = "序号", width = 20, sort = 1) + private Long id; + + @Excel(name = "问题类型", width = 20, sort = 3) + @NotBlank(message = "问题类型不能为空") + private String questionType; + + @Excel(name = "问题子类型", width = 20, sort = 4) + @NotBlank(message = "问题子类型不能为空") + private String questionSonType; + + private Long sceneBigId; + + @NotBlank(message = "专业不能为空") + private String specialtyId; + + @Excel(name = "专业", width = 20, sort = 2) + @TableField(exist = false) + private String specialtyName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwScene.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwScene.java new file mode 100644 index 0000000000000000000000000000000000000000..75e2583327577ffa785f304f28e07a7b79829107 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwScene.java @@ -0,0 +1,169 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import java.util.List; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.Excel; +import lombok.*; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-01-12 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_scene") +public class YwScene implements Serializable { + + private static final long serialVersionUID=1L; + + /** + * 序号 + */ + @TableId(value = "id", type = IdType.AUTO) + @Excel(name = "场馆ID", type = Excel.Type.IMPORT, sort = 0) + private Long id; + + /** + * 场馆名称 + */ + @Excel(name = "场馆标准名称", type = Excel.Type.IMPORT, sort = 1) + private String venueName; + + /** + * 场馆介绍 + */ + @Excel(name = "备注", type = Excel.Type.IMPORT, sort = 15) + private String venueDesc; + + /** + * 场馆地址 + */ + @Excel(name = "地址", type = Excel.Type.IMPORT, sort = 14) + private String venueAddress; + + /** + * 所属区县id + */ + private String areaCountyId; + + @TableField(exist = false) + @Excel(name = "所属区县", type = Excel.Type.IMPORT, sort = 12) + private String county; + + /** + * 纬度 + */ + @Excel(name = "纬度GPS", type = Excel.Type.IMPORT, sort = 8) + private Double latitude; + + /** + * 经度 + */ + @Excel(name = "经度GPS", type = Excel.Type.IMPORT, sort = 7) + private Double longitude; + + /** + * 类型 + */ + @Excel(name = "场馆属性", type = Excel.Type.IMPORT, sort = 5) + private String venueType; + + /** + * 级别 + */ + @Excel(name = "场馆级别", type = Excel.Type.IMPORT, sort = 6) + private String venueLevel; + + /** + * 容纳人数 + */ + private Integer accPerson; + + /** + * 场景ID + */ + private Long sceneBigId; + + /** + * 签到范围 + */ + private Integer signScope; + + /** + * 1开 0关 + */ + private String status; + + private String createBy; + + private String createTime; + + private String updateBy; + + private String updateTime; + + /** + * 简称 + */ + @Excel(name = "场馆简称", type = Excel.Type.IMPORT, sort = 2) + private String venueShortname; + + /** + * 地市 + */ + private String cityId; + + @Excel(name = "所属地市", type = Excel.Type.IMPORT, sort = 11) + @TableField(exist = false) + private String cityName; + + /** + * 英文名称 + */ + private String englishName; + + /** + * 英文简称 + */ + @Excel(name = "场馆英文缩写", type = Excel.Type.IMPORT, sort = 3) + private String englishShortname; + + /** + * 维护类型 + */ + @Excel(name = "维护类别", type = Excel.Type.IMPORT, sort = 4) + private String maintainType; + + /** + * GCJ02纬度 + */ + @Excel(name = "纬度GCJ02", type = Excel.Type.IMPORT, sort = 10) + private Double latitudeGcj02; + + /** + * GCJ02经度 + */ + @Excel(name = "经度GCJ02", type = Excel.Type.IMPORT, sort = 9) + private Double longitudeGcj02; + + /** + * 赛事类型 + */ + @Excel(name = "赛事类型", type = Excel.Type.IMPORT, sort = 13) + private String matchType; + + @TableField(exist = false) + private List ywSceneFile; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneAlarm.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneAlarm.java new file mode 100644 index 0000000000000000000000000000000000000000..0a6008c59eb3c85d88a2f4d8c7f848dd1cdbe20e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneAlarm.java @@ -0,0 +1,33 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_scene_alarm") +public class YwSceneAlarm { + + private Long id; + + private Long sceneId; + + private String alarmCode; + + private String alarmName; + + private String blackorwhite; + + private String alarmSpecityId; + + private String status; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneBigConfig.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneBigConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..cbbd9d4ea75cf62b5984e60bc9c0828f53e0dfb9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneBigConfig.java @@ -0,0 +1,45 @@ +package com.ruoyi.eastcom_yw.domain; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_scene_big_config") +public class YwSceneBigConfig { + + private Long id; + + @Excel(name = "场景名称",width = 20,orderNum = "0") + private String name; + + private String createBy; + + private Date createTime; + + private String updateBy; + + private Date updateTime; + + @Excel(name = "备注",width = 20,isImportField = "true_st",orderNum = "1") + private String remark; + + private String status; + + @TableField(exist = false) + @Excel(name = "状态",width = 20,isImportField = "true_st",orderNum = "2") + private String statusName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneCalendar.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneCalendar.java new file mode 100644 index 0000000000000000000000000000000000000000..9c4d21ac3925d55dba43a1f449612f8b4f47bf89 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneCalendar.java @@ -0,0 +1,62 @@ +package com.ruoyi.eastcom_yw.domain; + +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 com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_scene_calendar") +public class YwSceneCalendar { + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private Long sceneId; + + private String matchType; + + private String matchName; + + private String matchRemark; + + @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date beginTime; + + @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date endTime; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8", locale = "zh") + private Date matchDate; + + private String status; + + private String createBy; + + private Date createTime; + + private String updateBy; + + private Date updateTime; + + private String goldPoint; + + @TableField(exist = false) + private String url; + + @TableField(exist = false) + private String scenePictureUrl; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneFile.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneFile.java new file mode 100644 index 0000000000000000000000000000000000000000..29a74b96f1f38186bdb571c3a0e55081b1ddfdbb --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneFile.java @@ -0,0 +1,47 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_scene_file") +public class YwSceneFile { + +// private Long id; + + private Long fileId; + + private Long sceneId; + + private String remark; + + private Long createBy; + + private Date createTime; + + private Long updateBy; + + private Date updateTime; + + private String fileName; + + private Long fileSize; + + private String fileUrl; + + private String fileType; + + private String fileResolution; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneNetelement.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneNetelement.java new file mode 100644 index 0000000000000000000000000000000000000000..2676b52056e3af430b374b52b2d84408d987fe55 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneNetelement.java @@ -0,0 +1,78 @@ +package com.ruoyi.eastcom_yw.domain; + +//import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.Excel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_scene_netelement") +public class YwSceneNetelement { + + private Long id; + + private Long sceneId; + + @Excel(name = "场馆名称",width = 20,sort = 1) + @TableField(exist = false) + private String venueName; + + @Excel(name = "网元名称",width = 20,sort = 2) + private String netElementName; + + private String alarmSpecityId; + + @Excel(name = "专业",width = 20,sort = 3) + @TableField(exist = false) + private String specialty; + + @Excel(name = "网元编号",width = 20,sort = 4) + private String netElementCode; + + @Excel(name = "网元经度",width = 20,sort = 5) + private Float netElementLat; + + @Excel(name = "网元纬度",width = 20,sort = 6) + private Float netElementLon; + + @Excel(name = "网元类型",width = 20,sort = 7) + private String type; + + private String status; + + @Excel(name = "状态",width = 20,sort = 8) + @TableField(exist = false) + private String statusName; + + @Excel(name = "物理站名",width = 20,sort = 9) + private String netElementPhyname; + + @Excel(name = "是否红线内",width = 20,sort = 10) + private String inRedline; + + @Excel(name = "黑白名单",width = 20,sort = 11) + private String blackorwhite; + + @Excel(name = "机房",width = 20,sort = 12) + private String room; + + @Excel(name = "端口",width = 20,sort = 13) + private String port; + + @Excel(name = "网元中文名称",width = 20,sort = 14) + private String netElementCname; + + @Excel(name = "小区ci",width = 20,sort = 15) + private String ci; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneTestData.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneTestData.java new file mode 100644 index 0000000000000000000000000000000000000000..e69ed3dd18a12b31c970b703ae00195ad81ef110 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneTestData.java @@ -0,0 +1,22 @@ +package com.ruoyi.eastcom_yw.domain; + +import lombok.Data; + +import java.util.Date; + +@Data +public class YwSceneTestData { + private Long id; + private String bzname; + private String scenename; + private String deviceoid; + private Float connectdelay; + private Float dlspeed; + private Float lat; + private Float lng; + private Float pagecomplete; + private Float ulspeed; + private Date updateTime; + private String nettype; + private Integer sceneId; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneUser.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneUser.java new file mode 100644 index 0000000000000000000000000000000000000000..3ae4dd13c3ed0ecee4f906ebccb8282738caf646 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneUser.java @@ -0,0 +1,61 @@ +package com.ruoyi.eastcom_yw.domain; + +import cn.afterturn.easypoi.excel.annotation.Excel; +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 com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.List; + +/** + * @author huamile + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_scene_user") +public class YwSceneUser { + + @TableId(value = "id",type = IdType.AUTO) + private Long id; + + private Long sceneId; + + @TableField(exist = false) + @Excel(name = "场馆名称",isImportField = "true_st",width = 20) + private String venueName; + + private Long userId; + + @TableField(exist = false) + @Excel(name = "用户名",isImportField = "true_st",width = 20) + private String userName; + + @Excel(name = "所属区域",isImportField = "true_st",width = 20) + private String belongArea; + + @Excel(name = "是否需要签到",isImportField = "true_st",width = 20) + private String needSign; + + @TableField(exist = false) + private List userIds; + + private String updateBy; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date updateTime; + + private String createBy; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date createTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneView.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneView.java new file mode 100644 index 0000000000000000000000000000000000000000..2c856983acd29fceef83159c448e42dfa35e4c8e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSceneView.java @@ -0,0 +1,42 @@ +package com.ruoyi.eastcom_yw.domain; + +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 com.ruoyi.common.annotation.Excel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-01-12 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_scene") +public class YwSceneView implements Serializable { + + private static final long serialVersionUID=1L; + + /** + * 序号 + */ + private Long id; + + /** + * 场馆名称 + */ + private String venueName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignLog.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignLog.java new file mode 100644 index 0000000000000000000000000000000000000000..a419bb4dfd9370171cc7a2aeb5e7932d14f93c1b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignLog.java @@ -0,0 +1,39 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +import java.sql.Timestamp; +import java.util.Date; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_sign_log") +public class YwSignLog { + + @TableId(value = "id") + private Long id; + + private Long signPlanId; + + private Long userId; + + private Date signTime; + + private Double signJ; + + private Double signW; + + private Long isDaiSign; + + private String signType; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignLogView.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignLogView.java new file mode 100644 index 0000000000000000000000000000000000000000..bc161ef6637c2bc1117b6a351e838a7e5d922fd2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignLogView.java @@ -0,0 +1,78 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +import java.sql.Timestamp; +import java.util.Date; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_sign_log") +public class YwSignLogView { + + private Long signPlanId; + + private String signDate; + + private Date beginTime; + + private Date endTime; + + private Long userId; + + private String nickName; + + private String userTypeName; + + private String userType; + + private Long sceneId; + + private String venueName; + + private String areaCountyId; + + private String city; + + private String county; + + private Date signInTime; + + private Double signInJ; + + private Double signInW; + + private Long isDaiSignIn; + + private Date signOutTime; + + private Double signOutJ; + + private Double signOutW; + + private Long isDaiSignOut; + + private String signType; + + private String signStatus; + + private String checkType; + + private String belongArea; + + private Double latitude; + + private Double longitude; + + private Integer signScope; + + private Date genTime; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignPlan.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignPlan.java new file mode 100644 index 0000000000000000000000000000000000000000..7d255b2c45a085ec1f9794224f990394a4b3ce41 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignPlan.java @@ -0,0 +1,47 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.List; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_sign_plan") +public class YwSignPlan { + + @TableId(value = "id") + private Long id; + + private Long sceneId; + + private Date signDate; + + private Date beginTime; + + private Date endTime; + + private String repWarnInterval; + + private Integer repSignInterval; + + private Long sceneBigId; + + private String isOpen; + + private String noticeType; + + private Integer signNum; + + private String signUsers; + + private Date updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignPlanRemind.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignPlanRemind.java new file mode 100644 index 0000000000000000000000000000000000000000..2221942486896fd679c8e08910a6b739c96d6633 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignPlanRemind.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.domain; + + + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class YwSignPlanRemind extends YwSignPlan implements Serializable { + + private static final long serialVersionUID=1L; + + private Long userId; + + private String phoneNumber; + + private Date remindTime; + + private String noticeTitle; + + private String noticeContent; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignPlanView.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignPlanView.java new file mode 100644 index 0000000000000000000000000000000000000000..aacb2c75416206af838976ba7d04bf6ffb9ef499 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSignPlanView.java @@ -0,0 +1,37 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_sign_plan") +public class YwSignPlanView extends YwSignPlan{ + + private String noticeTypeName; + + private String venueName; + + private Double latitude; + + private Double longitude; + + private Integer signScope; + + private String areaCountyId; + + private String city; + + private String county; + + private String venueType; + + private String maintainType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSpareParts.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSpareParts.java new file mode 100644 index 0000000000000000000000000000000000000000..c17fda92417010e146be3b7239b0a841ba02bfba --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwSpareParts.java @@ -0,0 +1,105 @@ +package com.ruoyi.eastcom_yw.domain; + +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 lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + *

+ * 亚运备件表 + *

+ * + * @author yqf + * @since 2023-08-31 + */ +@Data +@TableName("yw_spare_parts") +@ApiModel(value = "YwSpareParts对象", description = "亚运备件表") +public class YwSpareParts { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("序号") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("场馆名称") + @TableField("venue_name") + private String venueName; + + @ApiModelProperty("场馆类型") + @TableField("venue_type") + private String venueType; + + @ApiModelProperty("设备类型") + @TableField("device_type") + private String deviceType; + + @ApiModelProperty("单板型号") + @TableField("board_model") + private String boardModel; + + @ApiModelProperty("通用数量") + @TableField("current_num") + private String currentNum; + + @ApiModelProperty("单板数量") + @TableField("board_num") + private String boardNum; + + @ApiModelProperty("备件型号") + @TableField("part_model") + private String partModel; + + @ApiModelProperty("需求数量") + @TableField("need_num") + private String needNum; + + @ApiModelProperty("配置数量") + @TableField("configure_num") + private String configureNum; + + @ApiModelProperty("缺口") + @TableField("gap_num") + private String gapNum; + + @ApiModelProperty("专业") + @TableField("major") + private String major; + + @ApiModelProperty("备注") + @TableField("comment") + private String comment; + + @ApiModelProperty("联系人") + @TableField("contacts") + private String contacts; + + @ApiModelProperty("联系电话") + @TableField("telephone") + private String telephone; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwWireTaskLog.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwWireTaskLog.java new file mode 100644 index 0000000000000000000000000000000000000000..907b033e6414fa2df619b2afe4041cff5be740d4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/YwWireTaskLog.java @@ -0,0 +1,103 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +import java.util.Date; + +/** + * @author jkj + * @since 2023-02-07 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_wire_task_log") +public class YwWireTaskLog { + + /** + * 序号 + */ + @TableId(value = "id") + private Long id; + + /** + * 工作流processid + */ + private String flwProcessid; + + private String taskId; + + /** + * 创建人 + */ + private Long createBy; + + private String createName; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 结束时间 + */ + private Date endTime; + + /** + * 施工单位 + */ + private String construcUnit; + + /** + * 任务主id:场馆id-时间戳 + */ + private String wireTaskId; + + private String wireTaskName; + + /** + * 任务类型:1:布线,2:拆线,3:布线结算 4:拆线结算 + */ + private Integer taskType; + + private String dealUser; + + private String curStep; + + private String dealStatus; + + private Long venueId; + + private String venueName; + + private String city; + + private String county; + + private String roleKey; + + private Integer isRemove; + + private Integer isSettle; + + private String report; + + private Integer taskSubType; + + private String matchId; + + private String areaCountyId; + + private String venueType; + + private String maintainType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/CommonDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/CommonDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..3c0cf38e7327e82505b5df9c408207670e764cc8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/CommonDTO.java @@ -0,0 +1,16 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +@Data +public class CommonDTO { + + private Integer pageNum = 1; + + private Integer pageSize = 10; + + private PageSizesDTO pageSizes; + + private PageNumsDTO pageNums; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2SpotCellDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2SpotCellDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..8d70d0275be4c11173ec937325913c6db8af371d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2SpotCellDTO.java @@ -0,0 +1,135 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + *

+ * DTO + *

+ * + * @author ck + * @since 2023-08-10 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2SpotCellDTO { + + + private static final long serialVersionUID = 1L; + + @TableField("id") + private Integer id; + + @TableField("omc") + private String omc; + + @ApiModelProperty("需要") + @TableField("县市") + private String 县市; + + @TableField("enodebid") + private Long enodebid; + + @TableField("本地小区标识") + private Long 本地小区标识; + + @TableField("小区标识") + private Long 小区标识; + + @ApiModelProperty("需要") + @TableField("站号") + private Long 站号; + + @ApiModelProperty("需要") + @TableField("ci") + private Long ci; + + @ApiModelProperty("需要") + @TableField("基站全称") + private String 基站全称; + + @TableField("en名称") + private String en名称; + + @ApiModelProperty("需要") + @TableField("小区名称") + private String 小区名称; + + @ApiModelProperty("需要") + @TableField("小区频段") + private String 小区频段; + + @ApiModelProperty("需要") + @TableField("纬度") + private Double 纬度; + + @ApiModelProperty("需要") + @TableField("经度") + private Double 经度; + + @TableField("纬度gcj") + private Double 纬度gcj; + + @TableField("经度gcj") + private Double 经度gcj; + + @ApiModelProperty("需要") + @TableField("室内室外") + private String 室内室外; + + @ApiModelProperty("需要") + @TableField("网络") + private String 网络; + + @TableField("现网状态") + private String 现网状态; + + @TableField("cgi") + private String cgi; + + @TableField("频点") + private Long 频点; + + @TableField("pci") + private Long pci; + + @TableField("tac") + private Long tac; + + @TableField("一级场景") + private String 一级场景; + + @TableField("二级场景") + private String 二级场景; + + @ApiModelProperty("需要") + @TableField("设备类型") + private String 设备类型; + + @ApiModelProperty("需要") + @TableField("带宽") + private Long 带宽; + + @ApiModelProperty("需要") + @TableField("方位角") + private Long 方位角; + + @TableField("扇区id") + private Long 扇区id; + + @TableField("更新时间") + private LocalDateTime 更新时间; + + @ApiModelProperty("景区ID,需要") + @TableField("景区id") + private Integer 景区id; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2SpotConfigDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2SpotConfigDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..13dfdd804071bde203c99a58ac46488e19765f46 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2SpotConfigDTO.java @@ -0,0 +1,49 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * DTO + *

+ * + * @author ck + * @since 2023-08-09 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2SpotConfigDTO { + + + private static final long serialVersionUID = 1L; + + @TableField("景区id") + private Integer 景区id; + + @TableField("景区名称") + private String 景区名称; + + @TableField("行政区域") + private String 行政区域; + + @TableField("中心经度") + private Object 中心经度; + + @TableField("中心纬度") + private Object 中心纬度; + + @TableField("景区介绍") + private String 景区介绍; + + @TableField("景区大类") + private String 景区大类; + + @TableField("景区大类id") + private Integer 景区大类id; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2ViewPowerAlarmDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2ViewPowerAlarmDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..2d866ade001363b7d83b9368abd8f5d57f3d953f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2ViewPowerAlarmDTO.java @@ -0,0 +1,83 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * DTO + *

+ * + * @author wqx + * @since 2023-08-31 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2ViewPowerAlarmDTO { + + + private static final long serialVersionUID = 1L; + + @TableField("eventtime") + private LocalDateTime eventtime; + + @TableField("alarmname") + private String alarmname; + + @TableField("alarmid") + private Long alarmid; + + @TableField("severity") + private String severity; + + @TableField("site_id") + private String siteId; + + @TableField("site_name") + private String siteName; + + @TableField("device_name") + private String deviceName; + + @TableField("owner") + private String owner; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("area") + private String area; + + @TableField("logicalsites") + private String logicalsites; + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("区域id") + private Integer 区域id; + + @TableField("场馆名称") + private String 场馆名称; + + @TableField("故障处理人") + private String 故障处理人; + + @TableField("phonenumber") + private String phonenumber; + + @TableField("deal_status") + private Integer deal_status; + + @TableField("deal_time") + private LocalDateTime deal_time; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2ViewWirelessAlarmDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2ViewWirelessAlarmDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..8be497fd9dc689bf060c49d767fc8b1e53ef7778 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/Dp2ViewWirelessAlarmDTO.java @@ -0,0 +1,89 @@ +package com.ruoyi.eastcom_yw.domain.dto; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * DTO + *

+ * + * @author wqx + * @since 2023-09-01 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2ViewWirelessAlarmDTO { + + + private static final long serialVersionUID = 1L; + + @TableField("id") + private Long id; + + @TableField("eventtime") + private LocalDateTime eventtime; + + @TableField("alarmname") + private String alarmname; + + @TableField("omcname") + private String omcname; + + @TableField("site_id") + private String siteId; + + @TableField("site_name") + private String siteName; + + @TableField("area") + private String area; + + @TableField("alarmid") + private String alarmid; + + @TableField("sitetype") + private String sitetype; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("cell_name") + private String cellName; + + @TableField("场馆id") + private Long 场馆id; + + @TableField("场馆名称") + private String 场馆名称; + + @TableField("longitude") + private Object longitude; + + @TableField("latitude") + private Object latitude; + + @TableField("坐席编号") + private String 坐席编号; + + @TableField("场内场外") + private String 场内场外; + + @TableField("区域id") + private Integer 区域id; + + @TableField("故障处理人") + private String 故障处理人; + + @TableField("phonenumber") + private String phonenumber; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/DpSceneConfigDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/DpSceneConfigDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..c842eedd7c7bead2d7eeae63a605ee403425c158 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/DpSceneConfigDTO.java @@ -0,0 +1,75 @@ +package com.ruoyi.eastcom_yw.domain.dto; + + +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 java.io.Serializable; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * DTO + *

+ * + * @author yqf + * @since 2023-04-12 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DpSceneConfigDTO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("自增id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("颜色等级") + @TableField("level") + private Short level; + + @ApiModelProperty("指标名称") + @TableField("name") + private String name; + + @ApiModelProperty("最小值") + @TableField("range1") + private Object range1; + + @ApiModelProperty("最大值") + @TableField("range2") + private Object range2; + + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @ApiModelProperty("备注") + @TableField("content") + private String content; + + @ApiModelProperty("指标等级:cell、scene") + @TableField("type") + private String type; + + @ApiModelProperty("网络类型") + @TableField("nettype") + private String nettype; + + @ApiModelProperty("小区类型") + @TableField("celltype") + private String celltype; + + @ApiModelProperty("颜色分值") + @TableField("colorscore") + private Double colorscore; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/MmlObjectDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/MmlObjectDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..badf3363d8221d151cde8f8b70e8e6a0d12ddd67 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/MmlObjectDTO.java @@ -0,0 +1,19 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @author yqf + * @date 2023/6/6 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class MmlObjectDTO { + private String 基站名; + private List 指令集; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PageNumsDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PageNumsDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..ab5fa02c05e46a98f90a55a9ea44ce2f0f523151 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PageNumsDTO.java @@ -0,0 +1,16 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +@Data +public class PageNumsDTO { + + private Integer cs; + + private Integer dh; + + private Integer agis; + + private Integer wx; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PageSizesDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PageSizesDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..c47b9d68432dd6f132c3d0e5d7289f3f31441b90 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PageSizesDTO.java @@ -0,0 +1,16 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +@Data +public class PageSizesDTO { + + private Integer cs; + + private Integer dh; + + private Integer agis; + + private Integer wx; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi4gCellDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi4gCellDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..71d2ee2db4b55778ad5fe186ded75f8206c81ffb --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi4gCellDTO.java @@ -0,0 +1,185 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆4G小区级15分钟指标DTO + *

+ * + * @author yqf + * @since 2023-04-11 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi4gCellDTO { + + + private static final long serialVersionUID = 1L; + +// @ApiModelProperty("id") +// @TableField("id") +// private Long id; + + @TableField("venue_id") + private Integer venueId; + + @TableField("venue_name") + private String venueName; + + @TableField("cellcodeci") + private String cellcodeci; + + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("小区名称") + private String 小区名称; + + @TableField("上行流量mb") + private BigDecimal 上行流量mb; + + @TableField("下行流量mb") + private BigDecimal 下行流量mb; + + @TableField("有效rrc连接平均数") + private BigDecimal 有效rrc连接平均数; + + @TableField("有效rrc连接最大数") + private BigDecimal 有效rrc连接最大数; + + @TableField("平均用户数") + private BigDecimal 平均用户数; + + @TableField("最大用户数") + private BigDecimal 最大用户数; + + @TableField("volte话务量") + private BigDecimal volte话务量; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("上行平均干扰") + private BigDecimal 上行平均干扰; + + @TableField("rrc建立成功率") + private BigDecimal rrc建立成功率; + + @TableField("e_rab建立成功率") + private BigDecimal eRab建立成功率; + + @TableField("qci为1的e_rab建立成功率") + private BigDecimal qci为1的eRab建立成功率; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("掉线次数") + private BigDecimal 掉线次数; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("esrvcc切换成功率") + private BigDecimal esrvcc切换成功率; + + @TableField("esrvcc切换请求次数") + private BigDecimal esrvcc切换请求次数; + + @TableField("rrc重建成功率") + private BigDecimal rrc重建成功率; + + @TableField("rrc重建次数") + private BigDecimal rrc重建次数; + + @TableField("volte掉话率") + private BigDecimal volte掉话率; + + @TableField("volte掉话次数") + private BigDecimal volte掉话次数; + + @TableField("rru_puschprbassn") + private BigDecimal rruPuschprbassn; + + @TableField("rru_puschprbtot") + private BigDecimal rruPuschprbtot; + + @TableField("rru_pdschprbassn") + private BigDecimal rruPdschprbassn; + + @TableField("rru_pdschprbtot") + private BigDecimal rruPdschprbtot; + + @TableField("rrc_succconnestab") + private BigDecimal rrcSuccconnestab; + + @TableField("rrc_attconnestab") + private BigDecimal rrcAttconnestab; + + @TableField("erab_nbrsuccestab_1") + private BigDecimal erabNbrsuccestab1; + + @TableField("erab_nbrattestab") + private BigDecimal erabNbrattestab; + + @TableField("erab_nbrattestab_1") + private BigDecimal erabNbrattestab1; + + @TableField("切换成功率_分母") + private BigDecimal 切换成功率分母; + + @TableField("切换成功率_分子") + private BigDecimal 切换成功率分子; + + @TableField("掉线率_分母") + private BigDecimal 掉线率分母; + + @TableField("iratho_succoutgeran") + private BigDecimal irathoSuccoutgeran; + + @TableField("rrc_attconnreestab") + private BigDecimal rrcAttconnreestab; + + @TableField("volte掉话率_分母") + private BigDecimal volte掉话率分母; + + @TableField("erab_nbrsuccestab") + private BigDecimal erabNbrsuccestab; + + @TableField("omcname") + private String omcname; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("rrc_failconnestab") + private BigDecimal rrcFailconnestab; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("groupid") + private Long groupid; + + @TableField("endtime") + private LocalDateTime endtime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi4gMinDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi4gMinDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..1c80682a6f414bef7b36d10748fb328a15d7d96c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi4gMinDTO.java @@ -0,0 +1,102 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆4G小区级1分钟指标DTO + *

+ * + * @author yqf + * @since 2023-04-12 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi4gMinDTO { + + + private static final long serialVersionUID = 1L; + + + @TableField("groupid") + private Integer groupid; + + @TableField("时间") + private LocalDateTime 时间; + + @TableField("小区名称") + private String 小区名称; + + @TableField("地市区号") + private String 地市区号; + + @TableField("厂商id") + private String 厂商id; + + @TableField("avg_user") + private BigDecimal avgUser; + + @TableField("max_user") + private Integer maxUser; + + @TableField("prb_up") + private BigDecimal prbUp; + + @TableField("prb_down") + private BigDecimal prbDown; + + @TableField("avg_disturb") + private Integer avgDisturb; + + @TableField("speed_up") + private BigDecimal speedUp; + + @TableField("speed_down") + private BigDecimal speedDown; + + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @TableField("call_drop_rate") + private BigDecimal callDropRate; + + @TableField("act_avg_user") + private BigDecimal actAvgUser; + + @TableField("act_max_user") + private Integer actMaxUser; + + @TableField("volte") + private BigDecimal volte; + + @TableField("volte_succ_rate") + private BigDecimal volteSuccRate; + + @TableField("volte_drop_rate") + private BigDecimal volteDropRate; + + @TableField("data_up") + private BigDecimal dataUp; + + @TableField("data_down") + private BigDecimal dataDown; + + @TableField("v1_max") + private BigDecimal v1Max; + + @TableField("v1_avg") + private String v1Avg; + + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi4gVenueDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi4gVenueDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..b5395a47d7ce810a32f77aa75eb450946690bdb9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi4gVenueDTO.java @@ -0,0 +1,75 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi4gVenueDTO { + + private static final long serialVersionUID = 1L; + + + @TableId("id") + private Long id; + + @TableField("开始时间") + private LocalDateTime 开始时间; + + @TableField("入库时间") + private LocalDateTime 入库时间; + + @TableField("区县") + private String 区县; + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("流量GB") + private Short 流量GB; + + @TableField("最大用户数") + private Short 最大用户数; + + @TableField("话务量") + private Short 话务量; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("上行平均干扰") + private Short 上行平均干扰; + + @TableField("volte接通率") + private BigDecimal volte接通率; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("结束时间") + private LocalDateTime 结束时间; + + @TableField("平均用户数") + private BigDecimal 平均用户数; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi5gCellDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi5gCellDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..0ec97d0d3c75bede147875f4193ece9a025cac94 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi5gCellDTO.java @@ -0,0 +1,170 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆5G小区级15分钟指标DTO + *

+ * + * @author yqf + * @since 2023-04-11 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi5gCellDTO { + + + private static final long serialVersionUID = 1L; + +// @ApiModelProperty("id") +// @TableField("id") +// private Long id; + + @TableField("venue_id") + private Integer venueId; + + @TableField("venue_name") + private String venueName; + + @TableField("ci") + private String ci; + + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("小区名称") + private String 小区名称; + + @TableField("nr流量") + private Short nr流量; + + @TableField("上行5g流量") + private Short 上行5g流量; + + @TableField("下行5g流量") + private Short 下行5g流量; + + @TableField("小区rlc层下行丢包率") + private BigDecimal 小区rlc层下行丢包率; + + @TableField("小区级rlc层sdu下行空口丢包数") + private Short 小区级rlc层sdu下行空口丢包数; + + @TableField("小区rlc层收到的下行sdu包数") + private Short 小区rlc层收到的下行sdu包数; + + @TableField("平均用户数") + private Short 平均用户数; + + @TableField("最大用户数") + private Short 最大用户数; + + @TableField("sn异常释放率") + private BigDecimal sn异常释放率; + + @TableField("sgnb释放总次数") + private Short sgnb释放总次数; + + @TableField("sgnb触发sgnb异常释放总次数") + private Short sgnb触发sgnb异常释放总次数; + + @TableField("nsa_sgnb添加成功率") + private BigDecimal nsaSgnb添加成功率; + + @TableField("dc场景下发送sgnb增加成功的次数") + private Short dc场景下发送sgnb增加成功的次数; + + @TableField("dc场景下收到sgnb增加尝试的次数") + private Short dc场景下收到sgnb增加尝试的次数; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("rrc建立成功次数") + private Short rrc建立成功次数; + + @TableField("rrc建立请求消息次数") + private Short rrc建立请求消息次数; + + @TableField("小区中qos_flow建立成功次数") + private Short 小区中qosFlow建立成功次数; + + @TableField("小区中qos_flow建立尝试次数") + private Short 小区中qosFlow建立尝试次数; + + @TableField("小区中ng信令连接建立成功次数") + private Short 小区中ng信令连接建立成功次数; + + @TableField("小区中ng信令连接建立尝试次数") + private Short 小区中ng信令连接建立尝试次数; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("小区中ue上下文异常释放的次数") + private Short 小区中ue上下文异常释放的次数; + + @TableField("小区中ue上下文正常释放的次数") + private Short 小区中ue上下文正常释放的次数; + + @TableField("无线掉线率分母") + private Short 无线掉线率分母; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("切换成功率分子") + private Short 切换成功率分子; + + @TableField("切换成功率分母") + private Short 切换成功率分母; + + @TableField("下行平均使用的prb个数") + private Short 下行平均使用的prb个数; + + @TableField("下行平均可用prb个数") + private Short 下行平均可用prb个数; + + @TableField("上行平均使用的prb个数") + private Short 上行平均使用的prb个数; + + @TableField("上行平均可用prb个数") + private Short 上行平均可用prb个数; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("cell_name") + private String cellName; + + @TableField("pmsid") + private Long pmsid; + + @TableField("上行干扰值") + private Double 上行干扰值; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("endtime") + private LocalDateTime endtime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi5gMinDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi5gMinDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..5a0d76bfa9c99fe4475485d58b1f8bb5596b25e8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi5gMinDTO.java @@ -0,0 +1,88 @@ +package com.ruoyi.eastcom_yw.domain.dto; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆5G小区级1分钟指标DTO + *

+ * + * @author yqf + * @since 2023-04-12 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi5gMinDTO { + + + private static final long serialVersionUID = 1L; + + + @TableField("groupid") + private Integer groupid; + + @TableField("时间") + private LocalDateTime 时间; + + @TableField("小区名称") + private String 小区名称; + + @TableField("地市区号") + private String 地市区号; + + @TableField("厂商id") + private String 厂商id; + + @TableField("prb_up") + private Double prbUp; + + @TableField("prb_down") + private Double prbDown; + + @TableField("up_disturb") + private Integer upDisturb; + + @TableField("speed_up") + private Double speedUp; + + @TableField("speed_down") + private Double speedDown; + + @TableField("act_max_user") + private Integer actMaxUser; + + @TableField("act_avg_user") + private Double actAvgUser; + + @TableField("rrc_avg_user") + private BigDecimal rrcAvgUser; + + @TableField("rrc_max_user") + private Integer rrcMaxUser; + + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @TableField("drop_call_rate") + private BigDecimal dropCallRate; + + @TableField("data_down") + private BigDecimal dataDown; + + @TableField("data_up") + private BigDecimal dataUp; + + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi5gVenueDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi5gVenueDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..e9dfba95f0c19a07c60be3321e235af9fda2a8cb --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/PmKpi5gVenueDTO.java @@ -0,0 +1,88 @@ +package com.ruoyi.eastcom_yw.domain.dto; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 5G场馆级15分钟指标DTO + *

+ * + * @author yqf + * @since 2023-04-12 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi5gVenueDTO { + + + private static final long serialVersionUID = 1L; + + @TableId("id") + private Long id; + + @TableField("开始时间") + private LocalDateTime 开始时间; + + @TableField("入库时间") + private LocalDateTime 入库时间; + + @TableField("区县") + private String 区县; + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("nsa_sgnb添加成功率") + private BigDecimal nsaSgnb添加成功率; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("sn异常释放率") + private BigDecimal sn异常释放率; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("流量GB") + private BigDecimal 流量GB; + + @TableField("最大用户数") + private Short 最大用户数; + + @TableField("话务量") + private BigDecimal 话务量; + + @TableField("上行干扰值") + private Double 上行干扰值; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("结束时间") + private LocalDateTime 结束时间; + + @TableField("平均用户数") + private BigDecimal 平均用户数; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/SysNoticeDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/SysNoticeDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..8e6396153d61c52ab4f860ada84ec9c814b880a7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/SysNoticeDTO.java @@ -0,0 +1,131 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知公告表DTO + *

+ * + * @author ck + * @since 2023-04-14 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class SysNoticeDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("自增id") + @TableId(value = "notice_id", type = IdType.AUTO) + private Integer noticeId; + + @ApiModelProperty("通知标题") + @TableField("notice_title") + private String noticeTitle; + + @ApiModelProperty("通知类型--字典表sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("状态 0未读 1已读") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("插入时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("接收人") + @TableField("recive_user") + private Integer reciveUser; + + @ApiModelProperty("工作流id") + @TableField("flw_processid") + private String flwProcessid; + + @ApiModelProperty("工作流任务id") + @TableField("flw_taskid") + private String flwTaskid; + + @ApiModelProperty("实际发送时间") + @TableField("send_time") + private LocalDateTime sendTime; + + @ApiModelProperty("发送是否成功,1成功 0失败") + @TableField("send_status") + private String sendStatus; + + @ApiModelProperty("接收人手机号") + @TableField("recive_user_phone") + private String reciveUserPhone; + + @ApiModelProperty("计划发送时间(同天当前时间之前立即发送)") + @TableField("exp_send_time") + private LocalDateTime expSendTime; + + @ApiModelProperty("加入定时任务标记 默认0未加入 1已加入") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知对象ids数组") + @TableField("notice_object_id") + private List noticeObjectId; + + @ApiModelProperty("通知模板id") + @TableField("notice_model_id") + private Long noticeModelId; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + private String modelScene; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知对象(是指具体的通知接受者,呈现方式包括场馆+群组;分公司+群组名;地市+群组名;ITCC+群组名;场馆+个人名;分公司+个人名;地市+个人名;ITCC+个人名这几种组合。具体呈现内容和对象属性、通知方式相关联)") + @TableField("notice_object") + private String noticeObject; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("关联表id(yw_notice_handwork)") + @TableField("handwork_id") + private Long handworkId; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/WorkFlowDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/WorkFlowDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..142e0c238b1e6ba4f34cc7a19f0140a829be288b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/WorkFlowDTO.java @@ -0,0 +1,11 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +@Data +public class WorkFlowDTO { + + private String processInstanceId; + + private String taskName; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwAlarmDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwAlarmDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..1885169dfeda6ceb003e6f0d6903e9d39acef4a7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwAlarmDTO.java @@ -0,0 +1,103 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.ruoyi.eastcom_yw.domain.model.StepInfo; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; +/** + * @author jkj + */ +@Data +public class YwAlarmDTO extends CommonDTO { + + private Long alarmId; + + private Long groupId; + + //告警类型 专业 wx 11种类型 + private String alarmType; + + //告警状态 0,1 PC端分别表示实时和全量 2 挂起,特殊要求 + private String alarmStatus; + + //告警的处理状态 + private String dealStatus; + + //告警处理人 + private String dealUser; + + //场馆Ids + private List venues; + + private List venueNames; + + //专业 + private String alarmGroup; + + //开始时间 + private String startTime; + + //结束时间 + private String endTime; + + private String city; + + //区县 + private String county; + + private List countys; + + //开始时间 + private LocalDateTime start; + + //结束时间 + private LocalDateTime end; + + //告警名称 + private String alarmName; + + //搜索框(告警名称、反馈人、告警网元、基站号) + private String searchBox; + + //进程号 + private String processId; + + //查询时间 + private String searchTime; + + private Long userId; + + //红线筛选 + private String inRedLine; + + private Integer isRefresh; + + private Boolean isAll; + + private Boolean isAPP = false; + + //默认false,导出需要设置未true + private Boolean isExport = false; + + private String venueName; + + private String venueType; + + private String maintainType; + + private String orderByTime; + + private String record; + + private String siteType; + + private Long [] alarmIds; + + private StepInfo stepInfo; + + private List alarmLevels; + +// private String orderBy; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwAlarmDTONoPage.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwAlarmDTONoPage.java new file mode 100644 index 0000000000000000000000000000000000000000..0f240b72c94e5b0fdb3b88e9b576695142c6030e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwAlarmDTONoPage.java @@ -0,0 +1,104 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.ruoyi.eastcom_yw.domain.model.StepInfo; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author jkj + */ +@Data +public class YwAlarmDTONoPage { + + private Long alarmId; + + private Long groupId; + + //告警类型 专业 wx 11种类型 + private String alarmType; + + //告警状态 0,1 PC端分别表示实时和全量 2 挂起,特殊要求 + private String alarmStatus; + + //告警的处理状态 + private String dealStatus; + + //告警处理人 + private String dealUser; + + //场馆Ids + private List venues; + + private List venueNames; + + //专业 + private String alarmGroup; + + //开始时间 + private String startTime; + + //结束时间 + private String endTime; + + private String city; + + //区县 + private String county; + + private List countys; + + //开始时间 + private LocalDateTime start; + + //结束时间 + private LocalDateTime end; + + //告警名称 + private String alarmName; + + //搜索框(告警名称、反馈人、告警网元、基站号) + private String searchBox; + + //进程号 + private String processId; + + //查询时间 + private String searchTime; + + private Long userId; + + //红线筛选 + private String inRedLine; + + private Integer isRefresh; + + private Boolean isAll; + + private Boolean isAPP = false; + + //默认false,导出需要设置未true + private Boolean isExport = false; + + private String venueName; + + private String venueType; + + private String maintainType; + + private String orderByTime; + + private String record; + + private String siteType; + + private Long [] alarmIds; + + private StepInfo stepInfo; + + private List alarmLevels; + +// private String orderBy; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwAlarmHangupLogDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwAlarmHangupLogDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..c595c6bfcd2c52e4839361df41fc30401eb0c62c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwAlarmHangupLogDTO.java @@ -0,0 +1,66 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-02-15 + */ +@Data +public class YwAlarmHangupLogDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 大场景id + */ + private Long sceneBigId; + + /** + * 挂起时间 + */ + private String hangupTime; + + /** + * 挂起人 + */ + private Long hangupUserId; + + /** + * 恢复处理时间 + */ + private String recoveryTime; + + /** + * 挂起原因 + */ + private String hangupReason; + + /** + * 工作流进程id + */ + private String flwProcessid; + + /** + * 工作流任务id + */ + private String flwTaskid; + + + /** + * 挂起类型 + */ + private String hangupStatus; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDataDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDataDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..e918b8a00359dee4c558e95ebfe724c3b5910b51 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDataDTO.java @@ -0,0 +1,32 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author jkj + */ +@Data +public class YwDataDTO { + + private Long signPlanId; + + private Long [] venueIds; + + private String [] roles; + + private String role; + + private String [] userTypes; + + //0签到1签退 + private Integer signType; + + private String signDate; + + private Long [] ids; + + private Long sceneBigId; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDrsConfigDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDrsConfigDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..33ea6cf7e43291eafc0525f64b307e061d1658e8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDrsConfigDTO.java @@ -0,0 +1,71 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +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 io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + *

+ * DRS配置表DTO + *

+ * + * @author ck + * @since 2023-06-13 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwDrsConfigDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("任务名称") + @TableField("task_name") + private String taskName; + + @ApiModelProperty("任务类型 drs_task_type 0 / 1 签到 2巡检") + @TableField("drs_task_type") + private String drsTaskType; + + @ApiModelProperty("状态") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField(value = "update_by", fill = FieldFill.UPDATE) + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField(value = "update_time", fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("删除标记") + @TableField("del_flag") + private String delFlag; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDrsTempTaskDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDrsTempTaskDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..a5d56d9af58ab52b43fa5148d758ae89dac07899 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDrsTempTaskDTO.java @@ -0,0 +1,100 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +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 io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * DRS临时任务表DTO + *

+ * + * @author ck + * @since 2023-06-13 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwDrsTempTaskDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("任务日期") + @TableField("task_date") + private LocalDate taskDate; + + @ApiModelProperty("多组任务开始结束时间") + private List ywDrsTempTaskTimes; + + @ApiModelProperty("任务时间") + @TableField("task_time") + private LocalDateTime taskTime; + + @ApiModelProperty("任务结束时间") + @TableField("task_end_time") + private LocalDateTime taskEndTime; + + @ApiModelProperty("任务名称") + @TableField("task_name") + private String taskName; + + @ApiModelProperty("DRS任务类型 drs_task_type 0 / 1 签到 2巡检") + @TableField("drs_task_type") + private String drsTaskType; + + @ApiModelProperty("DRS任务状态 drs_task_status 0未开始 1进行中 2已完成") + @TableField("drs_task_status") + private String drsTaskStatus; + + @ApiModelProperty("自动状态变更 0自动 1手动") + @TableField("drs_auto_update") + private String drsAutoUpdate; + + @ApiModelProperty("状态") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("删除标记") + @TableField("del_flag") + private String delFlag; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDrsTempTaskTimeDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDrsTempTaskTimeDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..3bc97af0858ed225d45fd0a77c9ffad7b03e1f0c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwDrsTempTaskTimeDTO.java @@ -0,0 +1,35 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwDrsTempTaskTimeDTO { + + @ApiModelProperty("任务时间") + @TableField("task_time") + private LocalDateTime taskTime; + + @ApiModelProperty("任务结束时间") + @TableField("task_end_time") + private LocalDateTime taskEndTime; + + @ApiModelProperty("任务名称") + @TableField("task_name") + private String taskName; + + @ApiModelProperty("DRS任务状态 drs_task_status 0未开始 1进行中 2已完成") + @TableField("drs_task_status") + private String drsTaskStatus; + + @ApiModelProperty("自动状态变更 0自动 1手动") + @TableField("drs_auto_update") + private String drsAutoUpdate; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectPlanDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectPlanDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..6ce7be6e0ae953aaece8ca6b8165bebfacdcfdbe --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectPlanDTO.java @@ -0,0 +1,65 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @author huamile + */ +@Data +public class YwInspectPlanDTO { + + private Long id; + + private Long sceneId; + + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8", locale = "zh") + private Date inspectDate; + + private String inspectSpecialty; + + private List specialtyList; + + private String beginTime; + + private String planFinTime; + + private List> timePeriods; + + private Long sceneBigId; + + private Long type; + + private String inspectName; + + private Integer checkNum; + + private String checkType; + + private String checkDesc; + + private Integer circle; + + private Long stopTimeOption; + + private Long intervalTime; + + private Integer inspectUserId; + + private String repWarnInterval; + + private String noticeType; + + private String jobNo; + + private String city; + + private String county; + + private String description; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectPlanExportDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectPlanExportDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..daaf17a5b89f360e4bf03d5a677b808638b21cd9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectPlanExportDTO.java @@ -0,0 +1,41 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * @author huamile + */ +@Data +public class YwInspectPlanExportDTO { + + @Excel(name = "计划名称", width = 20) + private String inspectName; + + @Excel(name = "场馆",width = 20) + private String venueName; + + @Excel(name = "巡检日期",width = 20) + private String inspectDate; + + @Excel(name = "专业",width = 20) + private String specialtyName; + +// @Excel(name = "巡检周期",width = 20) + private Integer circle; + + @Excel(name = "计划开始时间",width = 20,exportFormat = "yyyy-MM-dd HH:mm:ss") + private Date beginTime; + + @Excel(name = "计划结束时间",width = 20,exportFormat = "yyyy-MM-dd HH:mm:ss") + private Date planFinTime; + +// @Excel(name = "提前通知时间量",width = 20) + private String repWarnInterval; + + @Excel(name = "通知方式",width = 20) + private String noticeType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectStatDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectStatDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..0e1ad468ccc4010ed58339e1e00f297a9b1fa29a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectStatDTO.java @@ -0,0 +1,41 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +//import cn.afterturn.easypoi.excel.annotation.Excel; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwInspectStatDTO { + + private Long sceneId; + + @Excel(name = "场馆", width = 20) + private String venueName; + + private String imageurl; + + @Excel(name = "应完成数", width = 20) + private Integer allNum; + + @Excel(name = "已完成数", width = 20) + private Integer completedNum; + + @Excel(name = "任务完成率", width = 20) + private Double rate; + + private String rateStr; + + @Excel(name = "总项数", width = 20) + private Integer resultAllNum; + + @Excel(name = "正常数", width = 20) + private Integer resulNormalNum; + + @Excel(name = "任务正常率", width = 20) + private Double resulRate; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectTaskDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectTaskDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..493bc036208de8bed20958bff0e5d3b53ff419b7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectTaskDTO.java @@ -0,0 +1,19 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.ruoyi.eastcom_yw.domain.YwRoutInspectConfig; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectPlan; +import lombok.Data; + +import java.util.List; + +/** + * @author huamile + */ +@Data +public class YwInspectTaskDTO { + + private YwInspectPlanDTO ywRoutInspectPlan; + + private List list; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectTaskExportDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectTaskExportDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..97f099930dca3dcb1a4d24bf0eb52af507e14d78 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwInspectTaskExportDTO.java @@ -0,0 +1,50 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * @author huamile + */ +@Data +public class YwInspectTaskExportDTO { + + @Excel(name = "任务号", width = 20,sort = 1) + private String jobNo; + + @Excel(name = "任务名称", width = 20,sort = 2) + private String inspectName; + + @Excel(name = "场馆", width = 20,sort = 3) + private String venueName; + + @Excel(name = "专业", width = 20,sort = 4) + private String specialtyName; + + @Excel(name = "责任人", width = 20,sort = 5) + private String feedBackUserName; + + @Excel(name = "计划开始时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 6) + private Date beginTime; + + @Excel(name = "计划完成时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 7) + private Date planFinTime; + + @Excel(name = "是否超时", width = 20,sort = 8) + private String timeoutOrNot; + + @Excel(name = "任务状态", width = 20,sort = 9) + private String taskStatus; + +// @Excel(name = "异常数/总项数",sort = 10) + private String rate; + + @Excel(name = "异常数",sort = 11) + private Integer errorNum; + + @Excel(name = "总项数",sort = 12) + private Integer num; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwKpiConfigDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwKpiConfigDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..05f512c1146331bce1801128cb24a8840648d850 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwKpiConfigDTO.java @@ -0,0 +1,84 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +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 java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 指标字段阈值配置表DTO + *

+ * + * @author yqf + * @since 2023-04-11 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwKpiConfigDTO { + + + private static final long serialVersionUID = 1L; + + + + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("专业(字典表)") + @TableField("subject") + private String subject; + + @ApiModelProperty("网络模式(字典表)") + @TableField("net_type") + private String netType; + + @ApiModelProperty("指标字段") + @TableField("kpi_field") + private Long kpiField; + + @ApiModelProperty("阈值范围") + @TableField("threshold_value") + private String thresholdValue; + + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("最小是(包括本值)") + @TableField("min_value") + private Object minValue; + + @ApiModelProperty("最大值(不包括本值)") + @TableField("max_value") + private Object maxValue; + + @ApiModelProperty("指标名") + @TableField("kpi_field_name") + private String kpiFieldName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeBriefingDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeBriefingDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..a2ab3a040c3b9e1e041d8bc345938a069e4ddacd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeBriefingDTO.java @@ -0,0 +1,101 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告简报计划表DTO + *

+ * + * @author ck + * @since 2023-04-11 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeBriefingDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + private String city; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + private List noticeType; + + @ApiModelProperty("发送日期") + @TableField("send_date") + private LocalDate sendDate; + + @ApiModelProperty("开始时间") + @TableField("begin_time") + private LocalDateTime beginTime; + + @ApiModelProperty("结束时间") + @TableField("end_time") + private LocalDateTime endTime; + + @ApiModelProperty("区县") + @TableField("county") + private String county; + + @ApiModelProperty("对象ids数组") + @TableField("object_ids") + private List objectIds; + + @ApiModelProperty("模板id") + @TableField("model_id") + private Long modelId; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("时间间隔(单位分)") + @TableField("time_interval") + private Integer timeInterval; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + private String noticeName; + + @ApiModelProperty("启用状态 sys_normal_disable 0启用 1停用") + @TableField("sys_normal_disable") + private String sysNormalDisable; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3文字简报 4h5简报)") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("发送方式 send_type (1自动发送 2手工发送)") + @TableField("send_type") + private String sendType; + + @ApiModelProperty("发送人员") + @TableField("send_user") + private Long sendUser; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeHandworkDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeHandworkDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..b28b60a19c98be021f6c911edbc58ccb4fb599d6 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeHandworkDTO.java @@ -0,0 +1,90 @@ +package com.ruoyi.eastcom_yw.domain.dto; + + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告手工通知计划表DTO + *

+ * + * @author ck + * @since 2023-04-11 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeHandworkDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + private String noticeName; + + @ApiModelProperty("通知模板id") + @TableField("notice_model") + private Long noticeModel; + + @ApiModelProperty("通知方式--sys_notice_type") + @TableField("notice_type") + private List noticeType; + + @ApiModelProperty("通知对象ids") + @TableField("notice_object") + private List noticeObject; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("通知状态yw_veriy_status 0待提交 1待审核 2已审核") + @TableField("notice_status") + private String noticeStatus; + + @ApiModelProperty("日期") + @TableField("notice_date") + private LocalDateTime noticeDate; + + @ApiModelProperty("开始时间") + @TableField("begin_time") + private LocalDateTime beginTime; + + @ApiModelProperty("结束时间") + @TableField("end_time") + private LocalDateTime endTime; + + @ApiModelProperty("时间间隔(单位分)") + @TableField("time_interval") + private Integer timeInterval; + + @ApiModelProperty("工作流processid") + @TableField("flw_processid") + private String flwProcessid; + + @ApiModelProperty("申请人id") + @TableField("apply_id") + private Long applyId; + + @ApiModelProperty("审核人id") + @TableField("audit_id") + private Long auditId; + + @ApiModelProperty("已添加到sys_notice标记(0否 1是)") + @TableField("add_flag") + private String addFlag; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeHandworkdetailDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeHandworkdetailDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..d9c4832d4dde3b13f8c6fc37e56285e2787707c7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeHandworkdetailDTO.java @@ -0,0 +1,55 @@ +package com.ruoyi.eastcom_yw.domain.dto; + + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * 通知通告手工通知审核表DTO + *

+ * + * @author ck + * @since 2023-04-11 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeHandworkdetailDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("手工通知id") + @TableField("handwork_id") + private Long handworkId; + + @ApiModelProperty("操作人(提交审核的人 或者 审核的人)") + @TableField("oprate_user") + private Long oprateUser; + + @ApiModelProperty("审核结果(关联字典表yw_veriy_result 0通过 1驳回)") + @TableField("veriy_result") + private String veriyResult; + + @ApiModelProperty("审核状态(关联字典表yw_veriy_status 0 待审核 1 已审核)") + @TableField("veriy_status") + private String veriyStatus; + + @ApiModelProperty("驳回原因") + @TableField("fail_reason") + private String failReason; + + @ApiModelProperty("附件") + @TableField("appendix") + private String appendix; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeListDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeListDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..178de73069d8bbf9143e8b139765b25527ba5b89 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeListDTO.java @@ -0,0 +1,98 @@ +package com.ruoyi.eastcom_yw.domain.dto; + + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告记录表DTO + *

+ * + * @author ck + * @since 2023-04-11 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeListDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + private String noticeName; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + private String modelScene; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知方式--sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("通知时间(计划发送时间(同天当前时间之前立即发送))") + @TableField("notice_time") + private LocalDateTime noticeTime; + + @ApiModelProperty("通知对象") + @TableField("notice_object") + private String noticeObject; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("状态 0未读 1已读") + @TableField("status") + private String status; + + @ApiModelProperty("通知对象ids数组") + @TableField("notice_object_id") + private List noticeObjectId; + + @ApiModelProperty("通知模板id") + @TableField("notice_model_id") + private Long noticeModelId; + + @ApiModelProperty("实际发送时间") + @TableField("send_time") + private LocalDateTime sendTime; + + @ApiModelProperty("发送是否成功,1成功 0失败") + @TableField("send_status") + private String sendStatus; + + @ApiModelProperty("计划发送时间(同天当前时间之前立即发送)") + @TableField("exp_send_time") + private LocalDateTime expSendTime; + + @ApiModelProperty("加入定时任务标记 默认0未加入 1已加入") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("计划id(手工与简报会先配置计划)") + @TableField("plan_id") + private Long planId; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeModelDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeModelDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..36506968612cb048fc2d05aa87e4e37157085b08 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeModelDTO.java @@ -0,0 +1,77 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + *

+ * 通知通告模板表DTO + *

+ * + * @author ck + * @since 2023-04-07 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeModelDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("模板名称") + @TableField("model_name") + private String modelName; + + @ApiModelProperty("模板内容") + @TableField("model_content") + private String modelContent; + + @ApiModelProperty("场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + private String modelScene; + + @ApiModelProperty("用户id") + @TableField(value = "create_user_id",fill= FieldFill.INSERT) + private Long createUserId; + + @ApiModelProperty("创建用户昵称") + @TableField(value = "create_by",fill= FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("模板适用类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("备注(写一些触发要求)") + @TableField("model_des") + private String modelDes; + + @ApiModelProperty("模板类型--字典yw_model_type 0事件触发型") + @TableField("model_type") + private String modelType; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeObjectDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeObjectDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..a754a8e8a7cfa70062a544348198704ea7c7b304 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwNoticeObjectDTO.java @@ -0,0 +1,97 @@ +package com.ruoyi.eastcom_yw.domain.dto; + + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + *

+ * 通知通告对象表DTO + *

+ * + * @author ck + * @since 2023-04-11 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeObjectDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + private String city; + + @ApiModelProperty("区县") + @TableField("county") + private String county; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("专业") + @TableField("specialty") + private Long specialty; + + @ApiModelProperty("角色id数组") + @TableField("roleIds") + private List roleIds; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("短信组名") + @TableField("message_name") + private String messageName; + + @ApiModelProperty("短信组内成员id数组") + @TableField("message_users") + private List messageUsers; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("群号") + @TableField("group_id") + private String groupId; + + @ApiModelProperty("群名") + @TableField("group_name") + private String groupName; + + @ApiModelProperty("备注") + @TableField("group_des") + private String groupDes; + + @ApiModelProperty("对象名称") + @TableField("object_name") + private String objectName; + + @ApiModelProperty("ivr组名") + @TableField("ivr_name") + private String ivrName; + + @ApiModelProperty("ivr组内成员id数组") + @TableField("ivr_users") + private List ivrUsers; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSceneCalendarDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSceneCalendarDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..762bb09ccca566c80e8ff53bf2cdf92c50992cde --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSceneCalendarDTO.java @@ -0,0 +1,29 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwSceneCalendarDTO { + + private Long id; + + private Long sceneId; + + private String matchType; + + private String matchName; + + private String matchRemark; + + private String beginTime; + + private String endTime; + + private String matchDate; + + private String status; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSceneDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSceneDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..1d3c9c6fafe56aabe7ab1e5e678294b79e994f84 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSceneDTO.java @@ -0,0 +1,106 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import com.ruoyi.eastcom_yw.domain.YwSceneFile; +import lombok.Data; + +import java.util.List; + +/** + * @author huamile + */ +@Data +public class YwSceneDTO extends ResultBean { + + private Long id; + + @Excel(name = "场馆标准名称", type = Excel.Type.ALL, sort = 1) + private String venueName; + + @Excel(name = "场馆简称", type = Excel.Type.ALL, sort = 2) + private String venueShortname; + + @Excel(name = "场馆英文缩写", type = Excel.Type.ALL, sort = 3) + private String englishShortname; + + @Excel(name = "维护类别", type = Excel.Type.ALL, sort = 4) + private String maintainType; + + @Excel(name = "场馆属性", type = Excel.Type.ALL, sort = 5) + private String venueType; + + @Excel(name = "场馆级别", type = Excel.Type.ALL, sort = 6) + private String venueLevel; + + private Double longitude; + + @Excel(name = "经度GPS", type = Excel.Type.ALL, sort = 7) + @TableField(exist = false) + private String longitudeStr; + + private Double latitude; + + @Excel(name = "纬度GPS", type = Excel.Type.ALL, sort = 8) + @TableField(exist = false) + private String latitudeStr; + + private Double longitudeGcj02; + + @Excel(name = "经度GCJ02", type = Excel.Type.ALL, sort = 9) + @TableField(exist = false) + private String longitudeGcj02Str; + + private Double latitudeGcj02; + + @Excel(name = "纬度GCJ02", type = Excel.Type.ALL, sort = 10) + @TableField(exist = false) + private String latitudeGcj02Str; + + private String cityId; + + @Excel(name = "所属地市", type = Excel.Type.ALL, sort = 11) + @TableField(exist = false) + private String city; + + private String areaCountyId; + + @Excel(name = "所属区县", type = Excel.Type.ALL, sort = 12) + @TableField(exist = false) + private String county; + + @Excel(name = "赛事类型", type = Excel.Type.ALL, sort = 13) + private String matchType; + + @Excel(name = "地址", type = Excel.Type.ALL, sort = 14) + private String venueAddress; + + @Excel(name = "备注", type = Excel.Type.ALL, sort = 15) + private String venueDesc; + + private Integer accPerson; + + private Long sceneBigId; + + private Integer signScope; + + private String status; + + private String createBy; + + private String createTime; + + private String updateBy; + + private String updateTime; + + private String englishName; + + @TableField(exist = false) + private List files; + + + private String venueCategory; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSceneNoticeinfoSearchDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSceneNoticeinfoSearchDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..11cb3cfae960ee23c307ca2770ab490ee8f1b97a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSceneNoticeinfoSearchDTO.java @@ -0,0 +1,14 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +@Data +public class YwSceneNoticeinfoSearchDTO extends CommonDTO { + + private String sceneName; + + private Long sceneId; + + private Long userId; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSearchDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSearchDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..e016164e562e76f7078ca484d3f5fa967b61d370 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSearchDTO.java @@ -0,0 +1,31 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +//工作流查询,字段名必须小写 +@Data +public class YwSearchDTO { + + //城市区县 + private String area_county_id; + //子场景,场馆 + private String venue_id; + //场馆名称 + private String venue_name; + //地市名称 + private String city; + //区县名称 + private String county; + //任务类别 + private String task_type; + //名称 + private String task_name; + //专业 + private String specialty; + //网元名称 + private String net_name; + //告警名称 + private String alarm_name; + //基站名称 + private String site_name; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..e16f9c67bb78b5b88cf329126037696ee33e0813 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignDTO.java @@ -0,0 +1,23 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +@Data +public class YwSignDTO { + + //签到计划id + private Long signPlanId; + + //场馆id + private Long venueId; + + //签到类型 0签到1签退 + private Integer signType; + + //纬度 + private String latitude; + + //经度 + private String longitude; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignInDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignInDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..85936e678ae64964e94c05165ad5dbb145107168 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignInDTO.java @@ -0,0 +1,22 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +@Data +public class YwSignInDTO { + + private Long signPlanId; + + private Long venueId; + + private String[] userTypes; + + private String signTime; + + private Long[] users; + + private Long userId; + + private Integer signType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignLogDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignLogDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..6599b375d493406112a2d29d97f0e638e30db506 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignLogDTO.java @@ -0,0 +1,41 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +import java.util.Date; + +/** + * @author jkj + */ +@Data +public class YwSignLogDTO extends CommonDTO{ + + private String city; + + private String nickName; + + private String county; + + private Long[] venueIds; + + private String userType; + + private String startDate; + + private String endDate; + + private String signStatus; + + private Boolean isExport; + + private String venueType; + + private String maintainType; + + private boolean taskFlag = false; + + private Boolean genTime; + + private boolean isToday; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignPlanDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignPlanDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..33ffdd960211ae440ae9bfd87ef2d9e705ca730c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignPlanDTO.java @@ -0,0 +1,67 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +@Data +public class YwSignPlanDTO extends CommonDTO { + + private Long id; + + private Long[] venueIds; + + private Long venueId; + + @Excel(name = "场馆", type = Excel.Type.ALL) + private String venueName; + + @Excel(name = "签到日期", type = Excel.Type.ALL, dateFormat = "yyyy-MM-dd") + private String signDate; + + private String[] signDates; + + private String startDate; + + private String endDate; + + private Double latitude; + + private Double longitude; + + private Integer signScope; + + @Excel(name = "早签到时间", type = Excel.Type.ALL, dateFormat = "HH:mm:ss") + private String beginTime; + + @Excel(name = "晚签到时间", type = Excel.Type.ALL, dateFormat = "HH:mm:ss") + private String endTime; + + @Excel(name = "通知时间量", type = Excel.Type.ALL) + private String repWarnInterval; + + @Excel(name = "签到时间量", type = Excel.Type.ALL) + private Integer repSignInterval; + + @Excel(name = "通知方式", type = Excel.Type.ALL) + private String noticeType; + + private String isOpen; + + private String createBy; + + private String updateBy; + + private Boolean isExport = false; + + @Excel(name = "失败原因", type = Excel.Type.EXPORT) + private String reason; + + private Integer signNum; + + private String signUsers; + + private String venueType; + + private String maintainType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignPlanImportDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignPlanImportDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..ee2adb6c9524529656474a0d2238a8503acc070f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignPlanImportDTO.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.Data; + +@Data +public class YwSignPlanImportDTO extends ResultBean { + @Excel(name = "场馆", type = Excel.Type.ALL, sort = 1) + private String venueName; + + @Excel(name = "签到日期", type = Excel.Type.ALL, dateFormat = "yyyy-MM-dd", sort = 2) + private String signDate; + + @Excel(name = "早签到时间", type = Excel.Type.ALL, dateFormat = "HH:mm:ss", sort = 3) + private String beginTime; + + @Excel(name = "晚签到时间", type = Excel.Type.ALL, dateFormat = "HH:mm:ss", sort = 4) + private String endTime; + + @Excel(name = "提醒时间量", type = Excel.Type.ALL, sort = 5) + private String repWarnInterval; + + @Excel(name = "通知方式", type = Excel.Type.ALL, sort = 6) + private String noticeType; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignPlanUserDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignPlanUserDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..5500e60568598f0a109fca3a35bf768489bd2eee --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSignPlanUserDTO.java @@ -0,0 +1,15 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +@Data +public class YwSignPlanUserDTO { + + private String beginTime; + + private String endTime; + + private String[] signUsers; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSparePartsDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSparePartsDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..dfeb89fbf89c86071179d8c1c3033ed3d595d753 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwSparePartsDTO.java @@ -0,0 +1,124 @@ +package com.ruoyi.eastcom_yw.domain.dto; + + +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 java.io.Serializable; +import java.time.LocalDateTime; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 亚运备件表DTO + *

+ * + * @author yqf + * @since 2023-08-31 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwSparePartsDTO extends ResultBean { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("序号") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @Excel(name = "场馆名称", type = Excel.Type.ALL, sort = 1) + @ApiModelProperty("场馆名称") + @TableField("venue_name") + private String venueName; + + @Excel(name = "场馆类型", type = Excel.Type.ALL, sort = 2) + @ApiModelProperty("场馆类型") + @TableField("venue_type") + private String venueType; + + @Excel(name = "设备类型", type = Excel.Type.ALL, sort = 3) + @ApiModelProperty("设备类型") + @TableField("device_type") + private String deviceType; + + @Excel(name = "单板型号", type = Excel.Type.ALL, sort = 4) + @ApiModelProperty("单板型号") + @TableField("board_model") + private String boardModel; + + @Excel(name = "单板数量", type = Excel.Type.ALL, sort = 5) + @ApiModelProperty("单板数量") + @TableField("board_num") + private String boardNum; + + @Excel(name = "备件型号", type = Excel.Type.ALL, sort = 6) + @ApiModelProperty("备件型号") + @TableField("part_model") + private String partModel; + + @Excel(name = "通用数量", type = Excel.Type.ALL, sort = 7) + @ApiModelProperty("通用数量") + @TableField("current_num") + private String currentNum; + + @Excel(name = "需求数量", type = Excel.Type.ALL, sort = 8) + @ApiModelProperty("需求数量") + @TableField("need_num") + private String needNum; + + @Excel(name = "配置数量", type = Excel.Type.ALL, sort = 9) + @ApiModelProperty("配置数量") + @TableField("configure_num") + private String configureNum; + + @Excel(name = "缺口", type = Excel.Type.ALL, sort = 10) + @ApiModelProperty("缺口") + @TableField("gap_num") + private String gapNum; + + @Excel(name = "专业", type = Excel.Type.ALL, sort = 11) + @ApiModelProperty("专业") + @TableField("major") + private String major; + + @Excel(name = "备注", type = Excel.Type.ALL, sort = 12) + @ApiModelProperty("备注") + @TableField("comment") + private String comment; + + @Excel(name = "联系人", type = Excel.Type.ALL, sort = 13) + @ApiModelProperty("联系人") + @TableField("contacts") + private String contacts; + + @Excel(name = "联系电话", type = Excel.Type.ALL, sort = 14) + @ApiModelProperty("联系电话") + @TableField("telephone") + private String telephone; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwWireTaskLogDTO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwWireTaskLogDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..4185a47bc1781ac6712ec62629559a91425e3925 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/dto/YwWireTaskLogDTO.java @@ -0,0 +1,71 @@ +package com.ruoyi.eastcom_yw.domain.dto; + +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @author jkj + */ +@Data +public class YwWireTaskLogDTO extends CommonDTO { + + private String flwProcessid; + + private Long createBy; + + private String createTime; + + private String wireTaskId; + + private String wireTaskName; + + private String currentUser; + + private Long userId; + + //创建人 + private String creater; + + private Integer [] taskTypes; + + private Integer taskType; + + //必须要有,新增要用到 + private Long venueId; + + private Long [] venueIds; + + private String county; + + private String city; + + private String [] countys; + + private String status; + + private String curStep; + + //开始时间 + private String startTime; + + //结束时间 + private String endTime; + + //施工单位 + private String sgdw; + + private Boolean isApp= false; + + private String construcUnit; + + private String report; + + private String venueType; + + private String maintainType; + + private Boolean isExport = false; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/enums/TaskNameWithRoleEnum.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/enums/TaskNameWithRoleEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..882784562c9e4566f712b8f32c73e36b4bea3fdc --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/enums/TaskNameWithRoleEnum.java @@ -0,0 +1,47 @@ +package com.ruoyi.eastcom_yw.domain.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum TaskNameWithRoleEnum { + +// 任务发起("任务发起",new Long[]{101L,14L},new String[]{"venuemanager,venueassistant"},new String[]{"场馆经理,场馆经理助理"}), + 任务发起("任务发起",new Long[]{101L},new String[]{"venuemanager"},new String[]{"场馆经理"}), + 任务审核("任务审核",new Long[]{19L},new String[]{"commdirector"},new String[]{"通信主管"}), + 图纸设计("图纸设计",new Long[]{15L},new String[]{"designer"},new String[]{"设计院人员"}), + 图纸确认("图纸确认",new Long[]{101L},new String[]{"venuemanager"},new String[]{"场馆经理"}), + 施工建设("施工建设",new Long[]{16L},new String[]{"builder"},new String[]{"施工队人员"}), + 工程监理("工程监理",new Long[]{17L},new String[]{"supervisor"},new String[]{"监理人员"}), + 现场验收("现场验收",new Long[]{101L},new String[]{"venuemanager"},new String[]{"场馆经理"}), + 任务派发("任务派发",new Long[]{101L},new String[]{"venuemanager"},new String[]{"场馆经理"}), +// 任务派发("任务派发",new Long[]{101L,14L},new String[]{"venuemanager,venueassistant"},new String[]{"场馆经理,场馆经理助理"}), + ; + + private final String taskName; + + private final Long[] roleId; + + private final String[] roleKey; + + private final String[] roleName; + + public static Long[] getRoleId(String taskName) { + for (TaskNameWithRoleEnum entry : values()) { + if (entry.getTaskName().equals(taskName)) { + return entry.getRoleId(); + } + } + return new Long[0]; + } + + public static String[] getRoleName(String taskName) { + for (TaskNameWithRoleEnum entry : values()) { + if (entry.getTaskName().equals(taskName)) { + return entry.getRoleName(); + } + } + return new String[0]; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/enums/WireTaskStatus.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/enums/WireTaskStatus.java new file mode 100644 index 0000000000000000000000000000000000000000..2b54c704c799fbbe68c02ffc2de5ebfa2f46d608 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/enums/WireTaskStatus.java @@ -0,0 +1,67 @@ +package com.ruoyi.eastcom_yw.domain.enums; + +public enum WireTaskStatus { + + rwfq(1, "任务发起"),rwpf(2, "任务派发") ,rwsh(3, "任务审核") ,tzsj(4,"图纸设计") ,tzqr(5,"图纸确认") ,sgjs(6,"施工建设"), + gcjl(7,"工程监理"),xcys(8,"现场验收"),lcjs(9,"流程结束"); + + /** code */ + private Integer code; + + /** 显示标签 */ + private String label; + + WireTaskStatus(Integer code, String label){ + + this.code = code; + + this.label = label; + } + + public static String getLabelByCode (Integer code) { + + for (WireTaskStatus enuma : WireTaskStatus.values()) { + + if (enuma.getCode().equals(code)) { + + return enuma.getLabel(); + } + } + return ""; + } + + public static Integer getCodeByLabel (String label) { + + for (WireTaskStatus enuma : WireTaskStatus.values()) { + + if (enuma.getLabel().equals(label)) { + + return enuma.getCode(); + } + } + return -1; + } + + + @Override + public String toString(){ + + return label; + + } + + public String getLabel() { + + return label; + + } + + + public Integer getCode(){ + + return this.code; + + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/model/AppEntity.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/model/AppEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..bba727b502c34722bcbb75db53b464e5ec4bbf82 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/model/AppEntity.java @@ -0,0 +1,19 @@ +package com.ruoyi.eastcom_yw.domain.model; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * @author los + */ +@Data +@TableName("m_app") +public class AppEntity { + private Long id; + private String appId; + private String appName; + private String appSecret; + private String accessToken; + private String isFlag; + private String ip; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/model/StepInfo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/model/StepInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..05c83d3894653289d51a2340c7b74989ec9cea1d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/model/StepInfo.java @@ -0,0 +1,9 @@ +package com.ruoyi.eastcom_yw.domain.model; + +import lombok.Data; + +@Data +public class StepInfo { + private String title; + private String info; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/SysUserParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/SysUserParam.java new file mode 100644 index 0000000000000000000000000000000000000000..5caef8767539588d8d4c30274abb3265d34d0f0e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/SysUserParam.java @@ -0,0 +1,12 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +@Data +public class SysUserParam extends CommonDTO { + private String userName; + private String nickName; + private Integer phoneNumber; + private Long sceneBigId; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwInspectQuestionConfigParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwInspectQuestionConfigParam.java new file mode 100644 index 0000000000000000000000000000000000000000..6d793f0bf8aa0805ca1d302396f38b343aff30bd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwInspectQuestionConfigParam.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwInspectQuestionConfigParam extends CommonDTO { + + private Long sceneBigId; + private String specialty; + private String questionType; + private String questionSonType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwRoutInspectConfigParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwRoutInspectConfigParam.java new file mode 100644 index 0000000000000000000000000000000000000000..a5083bd6a19894b3b9cf6b91cff1bbe2bccde82d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwRoutInspectConfigParam.java @@ -0,0 +1,33 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + + +/** + * @author huamile + */ +@Data +public class YwRoutInspectConfigParam extends CommonDTO { + + /** + * 场馆 + */ + private Long[] venueIds; + + /** + * 专业 + */ + private String specialty; + + private String beginDate; + + private String endDate; + + private Long userId; + + private String venueType; + + private String maintainType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwRoutInspectPlanParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwRoutInspectPlanParam.java new file mode 100644 index 0000000000000000000000000000000000000000..66696c6a33f9340ace2f086654f7324d9f031c33 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwRoutInspectPlanParam.java @@ -0,0 +1,38 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwRoutInspectPlanParam extends CommonDTO { + + private String taskNo; + + private String taskName; + + private Long[] venueIds; + + private String specialty; + + private String beginDate; + + private String endDate; + + private String city; + + private String county; + + private String taskStatus; + + private Long userId; + + private Boolean isApp = false; + + private String maintainType; + + private String venueType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwRoutInspectStatParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwRoutInspectStatParam.java new file mode 100644 index 0000000000000000000000000000000000000000..93c377922d1e8f1e254058b136df762a444d59ac --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwRoutInspectStatParam.java @@ -0,0 +1,46 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwRoutInspectStatParam extends CommonDTO { + + /** + * 地市 + */ + private String city; + + /** + * 区县 + */ + private String county; + + /** + * 场馆 + */ + private Long[] venueIds; + + /** + * 专业 + */ + private String specialty; + + private String beginDate; + + private String endDate; + + private Long userId; + + private String venueType; + + private String maintainType; + + private boolean isExport = false; + + private boolean taskFlag = false; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneAlarmParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneAlarmParam.java new file mode 100644 index 0000000000000000000000000000000000000000..dca47eb2e2739e93547cbc8a5c2daa129ae862ed --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneAlarmParam.java @@ -0,0 +1,18 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwSceneAlarmParam extends CommonDTO { + + private Long sceneId; + + private String alarmCode; + + private String keywords; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneCalendarParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneCalendarParam.java new file mode 100644 index 0000000000000000000000000000000000000000..e7679292c397c0ca98f736eec2182f0844ef7fac --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneCalendarParam.java @@ -0,0 +1,24 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwSceneCalendarParam extends CommonDTO { + + private Long sceneId; + + private String matchType; + + private String matchName; + + private String beginDate; + + private String endDate; + + private String keywords; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneMatchParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneMatchParam.java new file mode 100644 index 0000000000000000000000000000000000000000..414e4e18ad644f240f5c59e6002246bb7135bb81 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneMatchParam.java @@ -0,0 +1,7 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; + +public class YwSceneMatchParam extends CommonDTO { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementAgisParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementAgisParam.java new file mode 100644 index 0000000000000000000000000000000000000000..48a9b437a6a89798fb8725b12d82501610bedd58 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementAgisParam.java @@ -0,0 +1,15 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +@Data +public class YwSceneNetelementAgisParam extends CommonDTO { + + private Long sceneId; + private String sceneName; + private String keywords; + private Long sceneBigId; + private String alarmSpecityId; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementCsParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementCsParam.java new file mode 100644 index 0000000000000000000000000000000000000000..837b6057673c240b4d82b6a7e5863e33d250bb05 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementCsParam.java @@ -0,0 +1,15 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +@Data +public class YwSceneNetelementCsParam extends CommonDTO { + + private Long sceneId; + private String sceneName; + private String equipmentType; + private String networkingType; + private String keywords; + private Long sceneBigId; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementDhParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementDhParam.java new file mode 100644 index 0000000000000000000000000000000000000000..8c052e695595c9f68e3177b5c492a6edd53b4df4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementDhParam.java @@ -0,0 +1,18 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +@Data +public class YwSceneNetelementDhParam extends CommonDTO { + + private String city; + private String county; + private String netElementPhyname; + private String inRedline; + private Long sceneId; + private String sceneName; + private String roomType; + private String keywords; + private Long sceneBigId; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementParam.java new file mode 100644 index 0000000000000000000000000000000000000000..721f6061b3a08542458eabc4091f7a3428a9dbca --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementParam.java @@ -0,0 +1,18 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwSceneNetelementParam extends CommonDTO { + + private Long sceneId; + + private String status; + + private String keywords; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementWxParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementWxParam.java new file mode 100644 index 0000000000000000000000000000000000000000..05382fde02c02919fbacaa3dd1932a8a0542241a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneNetelementWxParam.java @@ -0,0 +1,16 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +@Data +public class YwSceneNetelementWxParam extends CommonDTO { + + private Long sceneId; + private String sceneName; + private String inRedline; + private String ci; + private String keywords; + private Long sceneBigId; + private Long[] sceneIds; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneParam.java new file mode 100644 index 0000000000000000000000000000000000000000..0d2f4e1d21a70f059676b6f85f28a1902f2d8c0e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneParam.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwSceneParam extends CommonDTO { + + private Long sceneBigId; + + private String venueLevel; + + private String areaCountyId; + + private String keywords; + + private String status; + + private String city; + + private Long[] venueIds; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneUserParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneUserParam.java new file mode 100644 index 0000000000000000000000000000000000000000..f561c9b697e2d3b20131a6f3545c44aeb66e30a5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSceneUserParam.java @@ -0,0 +1,24 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwSceneUserParam extends CommonDTO { + + private Long sceneId; + + private String status; + + private String belongArea; + + private Long roleId; + + private String specialty; + + private String keywords; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSignPlanParam.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSignPlanParam.java new file mode 100644 index 0000000000000000000000000000000000000000..419fdc2aeea3e83630c13b1a86dc2fac35465a73 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/param/YwSignPlanParam.java @@ -0,0 +1,63 @@ +package com.ruoyi.eastcom_yw.domain.param; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignPlanUserDTO; +import lombok.Data; + +import java.util.List; + +@Data +public class YwSignPlanParam { + + private Long id; + + private Long[] venueIds; + + @Excel(name = "场馆" , type = Excel.Type.ALL) + private String venueName; + + @Excel(name = "签到日期" , type = Excel.Type.ALL, dateFormat = "yyyy-MM-dd") + private String signDate; + + private String[] signDates; + + private String startDate; + + private String endDate; + + private Double latitude; + + private Double longitude; + + private Integer signScope; + + @Excel(name = "早签到时间" , type = Excel.Type.ALL, dateFormat = "HH:mm:ss") + private String beginTime; + + @Excel(name = "晚签到时间" , type = Excel.Type.ALL, dateFormat = "HH:mm:ss") + private String endTime; + + @Excel(name = "提前通知时间量" , type = Excel.Type.ALL) + private String repWarnInterval; + + @Excel(name = "提前签到时间量" , type = Excel.Type.ALL) + private Integer repSignInterval; + + @Excel(name = "通知方式" , type = Excel.Type.ALL) + private String noticeType; + + private String isOpen; + + private String createBy; + + private Boolean isExport=false; + + @Excel(name = "失败原因", type = Excel.Type.EXPORT) + private String reason; + + private Integer signNum; + + private List timePeriods; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2MmlListQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2MmlListQO.java new file mode 100644 index 0000000000000000000000000000000000000000..100c5610f25a81c72f249480f4dd65b2103c8ac6 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2MmlListQO.java @@ -0,0 +1,32 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * QO + *

+ * + * @author ck + * @since 2023-09-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2MmlListQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("场馆名称") + private String venueName; + + @ApiModelProperty("场馆id") + private Long venueId; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2SpotCellQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2SpotCellQO.java new file mode 100644 index 0000000000000000000000000000000000000000..0ad4c9c8918308ed415132a5f5cbd75cfaf5b3ae --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2SpotCellQO.java @@ -0,0 +1,137 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + *

+ * QO + *

+ * + * @author ck + * @since 2023-08-10 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2SpotCellQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + private String keywords; + + @TableField("id") + private Integer id; + + @TableField("omc") + private String omc; + + @ApiModelProperty("需要") + @TableField("县市") + private String 县市; + + @TableField("enodebid") + private Long enodebid; + + @TableField("本地小区标识") + private Long 本地小区标识; + + @TableField("小区标识") + private Long 小区标识; + + @ApiModelProperty("需要") + @TableField("站号") + private Long 站号; + + @ApiModelProperty("需要") + @TableField("ci") + private Long ci; + + @ApiModelProperty("需要") + @TableField("基站全称") + private String 基站全称; + + @TableField("en名称") + private String en名称; + + @ApiModelProperty("需要") + @TableField("小区名称") + private String 小区名称; + + @ApiModelProperty("需要") + @TableField("小区频段") + private String 小区频段; + + @ApiModelProperty("需要") + @TableField("纬度") + private Object 纬度; + + @ApiModelProperty("需要") + @TableField("经度") + private Object 经度; + + @TableField("纬度gcj") + private Object 纬度gcj; + + @TableField("经度gcj") + private Object 经度gcj; + + @ApiModelProperty("需要") + @TableField("室内室外") + private String 室内室外; + + @ApiModelProperty("需要") + @TableField("网络") + private String 网络; + + @TableField("现网状态") + private String 现网状态; + + @TableField("cgi") + private String cgi; + + @TableField("频点") + private Long 频点; + + @TableField("pci") + private Long pci; + + @TableField("tac") + private Long tac; + + @TableField("一级场景") + private String 一级场景; + + @TableField("二级场景") + private String 二级场景; + + @ApiModelProperty("需要") + @TableField("设备类型") + private String 设备类型; + + @ApiModelProperty("需要") + @TableField("带宽") + private Long 带宽; + + @ApiModelProperty("需要") + @TableField("方位角") + private Long 方位角; + + @TableField("扇区id") + private Long 扇区id; + + @TableField("更新时间") + private LocalDateTime 更新时间; + + @ApiModelProperty("景区ID,需要") + @TableField("景区id") + private Integer 景区id; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2SpotConfigQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2SpotConfigQO.java new file mode 100644 index 0000000000000000000000000000000000000000..f39a6be6c06df63fe15ab01fbb4b3791d4af04f7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2SpotConfigQO.java @@ -0,0 +1,38 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * QO + *

+ * + * @author ck + * @since 2023-08-09 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2SpotConfigQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @TableField("景区名称") + private String 景区名称; + + @TableField("行政区域") + private String 行政区域; + + @TableField("景区介绍") + private String 景区介绍; + + @TableField("景区大类") + private String 景区大类; + + private String keywords; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2ViewPowerAlarmQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2ViewPowerAlarmQO.java new file mode 100644 index 0000000000000000000000000000000000000000..930254eec3e62f8b1e512f1adc9d370d3df4ac20 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2ViewPowerAlarmQO.java @@ -0,0 +1,37 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.github.pagehelper.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * QO + *

+ * + * @author wqx + * @since 2023-08-31 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2ViewPowerAlarmQO extends CommonDTO { + + private static final long serialVersionUID = 1L; + + private String keywords; + + //开始时间 + private String startTime; + + //结束时间 + private String endTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2ViewWirelessAlarmQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2ViewWirelessAlarmQO.java new file mode 100644 index 0000000000000000000000000000000000000000..59883d05edac8a49a7d6323e6318a25b68f3bef1 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/Dp2ViewWirelessAlarmQO.java @@ -0,0 +1,100 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.github.pagehelper.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * QO + *

+ * + * @author wqx + * @since 2023-09-01 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2ViewWirelessAlarmQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @TableField("id") + private Long id; + + @TableField("eventtime") + private LocalDateTime eventtime; + + @TableField("alarmname") + private String alarmname; + + @TableField("omcname") + private String omcname; + + @TableField("site_id") + private String siteId; + + @TableField("site_name") + private String siteName; + + @TableField("area") + private String area; + + @TableField("alarmid") + private String alarmid; + + @TableField("sitetype") + private String sitetype; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("cell_name") + private String cellName; + + @TableField("场馆id") + private Long 场馆id; + + @TableField("场馆名称") + private String 场馆名称; + + @TableField("longitude") + private Object longitude; + + @TableField("latitude") + private Object latitude; + + @TableField("坐席编号") + private String 坐席编号; + + @TableField("场内场外") + private String 场内场外; + + @TableField("区域id") + private Integer 区域id; + + @TableField("故障处理人") + private String 故障处理人; + + @TableField("phonenumber") + private String phonenumber; + + private String keywords; + + private Integer type; + + //开始时间 + private String startTime; + + //结束时间 + private String endTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/DpKpiMonitorQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/DpKpiMonitorQO.java new file mode 100644 index 0000000000000000000000000000000000000000..72f6e8dcbb3c661ce0c0fb80b3734e388bd469ad --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/DpKpiMonitorQO.java @@ -0,0 +1,58 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DpKpiMonitorQO extends CommonDTO { + + @ApiModelProperty(value = "数据类型", required = true) + @NotBlank(message = "timetype不能为空") + private String datatype; + + @ApiModelProperty(value = "网络类型", required = true) + @NotBlank(message = "netType不能为空") + private String nettype; + + @ApiModelProperty(value = "场馆ids") + private Integer sceneid; + + @ApiModelProperty(value = "指标名称",required = true) + @NotBlank(message = "指标名称不能为空") + private String kpiname; + + + @ApiModelProperty(value = "开始时间") + @TableField("starttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private LocalDateTime starttime; + + @ApiModelProperty(value = "结束时间") + @TableField("endtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private LocalDateTime endtime; + + private String seatno; + + @ApiModelProperty(value = "查询表方式,1-查询特定表") + private int sceneruntype; + + @ApiModelProperty(value = "最大时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private LocalDateTime maxtime; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/DpSceneConfigQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/DpSceneConfigQO.java new file mode 100644 index 0000000000000000000000000000000000000000..4825b6eefeeac38c74a3a3a3025a913e9ad428b1 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/DpSceneConfigQO.java @@ -0,0 +1,80 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.github.pagehelper.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * QO + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DpSceneConfigQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("自增id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + + @ApiModelProperty("颜色等级") + @TableField("level") + private Short level; + + @ApiModelProperty("指标名称") + @TableField("name") + private String name; + + @ApiModelProperty("最小值") + @TableField("range1") + private Double range1; + + @ApiModelProperty("最大值") + @TableField("range2") + private Double range2; + + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @ApiModelProperty("备注") + @TableField("content") + private String content; + + + @ApiModelProperty("指标等级:cell、scene") + @TableField("type") + private String type; + + @ApiModelProperty("网络类型") + @TableField("nettype") + private String nettype; + + @ApiModelProperty("设备类型") + @TableField("celltype") + private String celltype; + + @ApiModelProperty("颜色分值") + @TableField("colorscore") + private Double colorscore; + + private BigDecimal value; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpi4gMinQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpi4gMinQO.java new file mode 100644 index 0000000000000000000000000000000000000000..8c574321ea0a88d578fb2d46ec1034464c79ca5b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpi4gMinQO.java @@ -0,0 +1,103 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.github.pagehelper.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆4G小区级1分钟指标QO + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi4gMinQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @TableField("groupid") + private Integer groupid; + + @TableField("时间") + private LocalDateTime 时间; + + @TableField("小区名称") + private String 小区名称; + + @TableField("地市区号") + private String 地市区号; + + @TableField("厂商id") + private String 厂商id; + + @TableField("avg_user") + private BigDecimal avgUser; + + @TableField("max_user") + private Integer maxUser; + + @TableField("prb_up") + private BigDecimal prbUp; + + @TableField("prb_down") + private BigDecimal prbDown; + + @TableField("avg_disturb") + private Integer avgDisturb; + + @TableField("speed_up") + private BigDecimal speedUp; + + @TableField("speed_down") + private BigDecimal speedDown; + + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @TableField("call_drop_rate") + private BigDecimal callDropRate; + + @TableField("act_avg_user") + private BigDecimal actAvgUser; + + @TableField("act_max_user") + private Integer actMaxUser; + + @TableField("volte") + private BigDecimal volte; + + @TableField("volte_succ_rate") + private BigDecimal volteSuccRate; + + @TableField("volte_drop_rate") + private BigDecimal volteDropRate; + + @TableField("data_up") + private BigDecimal dataUp; + + @TableField("data_down") + private BigDecimal dataDown; + + @TableField("v1_max") + private BigDecimal v1Max; + + @TableField("v1_avg") + private String v1Avg; + + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpi5gCellQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpi5gCellQO.java new file mode 100644 index 0000000000000000000000000000000000000000..f9551ee68f0d5012983338664fd2e724c485ea11 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpi5gCellQO.java @@ -0,0 +1,169 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.github.pagehelper.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆5G小区级15分钟指标QO + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi5gCellQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; +// @ApiModelProperty("id") +// @TableField("id") +// private Long id; + + @TableField("venue_id") + private Integer venueId; + + @TableField("venue_name") + private String venueName; + + @TableField("ci") + private String ci; + + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("小区名称") + private String 小区名称; + + @TableField("nr流量") + private Short nr流量; + + @TableField("上行5g流量") + private Short 上行5g流量; + + @TableField("下行5g流量") + private Short 下行5g流量; + + @TableField("小区rlc层下行丢包率") + private BigDecimal 小区rlc层下行丢包率; + + @TableField("小区级rlc层sdu下行空口丢包数") + private Short 小区级rlc层sdu下行空口丢包数; + + @TableField("小区rlc层收到的下行sdu包数") + private Short 小区rlc层收到的下行sdu包数; + + @TableField("平均用户数") + private Short 平均用户数; + + @TableField("最大用户数") + private Short 最大用户数; + + @TableField("sn异常释放率") + private BigDecimal sn异常释放率; + + @TableField("sgnb释放总次数") + private Short sgnb释放总次数; + + @TableField("sgnb触发sgnb异常释放总次数") + private Short sgnb触发sgnb异常释放总次数; + + @TableField("nsa_sgnb添加成功率") + private BigDecimal nsaSgnb添加成功率; + + @TableField("dc场景下发送sgnb增加成功的次数") + private Short dc场景下发送sgnb增加成功的次数; + + @TableField("dc场景下收到sgnb增加尝试的次数") + private Short dc场景下收到sgnb增加尝试的次数; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("rrc建立成功次数") + private Short rrc建立成功次数; + + @TableField("rrc建立请求消息次数") + private Short rrc建立请求消息次数; + + @TableField("小区中qos_flow建立成功次数") + private Short 小区中qosFlow建立成功次数; + + @TableField("小区中qos_flow建立尝试次数") + private Short 小区中qosFlow建立尝试次数; + + @TableField("小区中ng信令连接建立成功次数") + private Short 小区中ng信令连接建立成功次数; + + @TableField("小区中ng信令连接建立尝试次数") + private Short 小区中ng信令连接建立尝试次数; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("小区中ue上下文异常释放的次数") + private Short 小区中ue上下文异常释放的次数; + + @TableField("小区中ue上下文正常释放的次数") + private Short 小区中ue上下文正常释放的次数; + + @TableField("无线掉线率分母") + private Short 无线掉线率分母; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("切换成功率分子") + private Short 切换成功率分子; + + @TableField("切换成功率分母") + private Short 切换成功率分母; + + @TableField("下行平均使用的prb个数") + private Short 下行平均使用的prb个数; + + @TableField("下行平均可用prb个数") + private Short 下行平均可用prb个数; + + @TableField("上行平均使用的prb个数") + private Short 上行平均使用的prb个数; + + @TableField("上行平均可用prb个数") + private Short 上行平均可用prb个数; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("cell_name") + private String cellName; + + @TableField("pmsid") + private Long pmsid; + + @TableField("上行干扰值") + private Double 上行干扰值; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("endtime") + private LocalDateTime endtime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpi5gMinQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpi5gMinQO.java new file mode 100644 index 0000000000000000000000000000000000000000..8b872cd7f201d89885629059314bda9c9edf0fde --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpi5gMinQO.java @@ -0,0 +1,88 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.github.pagehelper.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆5G小区级1分钟指标QO + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi5gMinQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @TableField("groupid") + private Integer groupid; + + @TableField("时间") + private LocalDateTime 时间; + + @TableField("小区名称") + private String 小区名称; + + @TableField("地市区号") + private String 地市区号; + + @TableField("厂商id") + private String 厂商id; + + @TableField("prb_up") + private Double prbUp; + + @TableField("prb_down") + private Double prbDown; + + @TableField("up_disturb") + private Integer upDisturb; + + @TableField("speed_up") + private Double speedUp; + + @TableField("speed_down") + private Double speedDown; + + @TableField("act_max_user") + private Integer actMaxUser; + + @TableField("act_avg_user") + private Double actAvgUser; + + @TableField("rrc_avg_user") + private BigDecimal rrcAvgUser; + + @TableField("rrc_max_user") + private Integer rrcMaxUser; + + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @TableField("drop_call_rate") + private BigDecimal dropCallRate; + + @TableField("data_down") + private BigDecimal dataDown; + + @TableField("data_up") + private BigDecimal dataUp; + + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiCellMonitorQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiCellMonitorQO.java new file mode 100644 index 0000000000000000000000000000000000000000..8ad5abf48731f238bd3467c1f1cf6cf7ab5bb721 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiCellMonitorQO.java @@ -0,0 +1,96 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/14 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpiCellMonitorQO extends CommonDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "数据类型", required = true) + @NotBlank(message = "timetype不能为空") + private String datatype; + + @ApiModelProperty(value = "网络类型", required = true) + @NotBlank(message = "netType不能为空") + private String nettype; + + @ApiModelProperty(value = "区县id") + private String regionid; + + @ApiModelProperty(value = "区县id") + private String regionIdv; + + @ApiModelProperty(value = "场馆ids") + private Integer[] sceneids; + + @ApiModelProperty(value = "场馆id") + private Integer sceneid; + + @ApiModelProperty(value = "小区id(多选)") + @TableField("小区id") + private String[] villageids; + + @ApiModelProperty(value = "小区名称(多选)") + @TableField("小区名称") + private String[] villagenames; + + @ApiModelProperty(value = "开始时间", required = true) + @TableField("starttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "starttime不能为空") + private LocalDateTime starttime; + + @ApiModelProperty(value = "结束时间", required = true) + @TableField("endtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "endtime不能为空") + private LocalDateTime endtime; + + @ApiModelProperty(value = "排序字段名") + @NotBlank(message = "排序字段名不能为空") + private String sortcol; + + @ApiModelProperty(value = "排序") + @NotBlank(message = "排序不能为空") + private String sort; + + @ApiModelProperty(value = "坐席区(多选)") + private String[] seat; + + @ApiModelProperty(value = "坐席区颜色") + private String seatcolor; + + @ApiModelProperty(value = "指标名称") + @NotBlank(message = "指标名称不能为空") + private String kpiname; + + @ApiModelProperty(value = "是否为缓存查询(是:true)",required = true) + @NotNull(message = "isCache参数不能为空") + private Boolean iscache; + + private String seatno; + + + @ApiModelProperty(value = "查询表方式,1-查询特定表") + private int sceneruntype; + + private String venuetype; + private String maintaintype; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiCellQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiCellQO.java new file mode 100644 index 0000000000000000000000000000000000000000..fa6d52bc19f4e9101e7ebe80e9a413590af1d72f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiCellQO.java @@ -0,0 +1,90 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.github.pagehelper.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import reactor.util.annotation.NonNull; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + *

+ * 场馆4G小区级15分钟指标QO + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpiCellQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "网络类型:0-4G,1-5G", required = true) + @NotBlank(message = "netType不能为空") + private String netType; + + @ApiModelProperty(value = "区县id") + private String regionId; + + @ApiModelProperty(value = "区县id") + private String regionIdv; + + @ApiModelProperty(value = "场馆ids") + private Integer[] venueIds; + + @ApiModelProperty(value = "场馆id") + private Integer venueid; + + + @ApiModelProperty(value = "小区id(多选)") + @TableField("小区id") + private String[] villageIds; + + @ApiModelProperty(value = "小区名称(多选)") + @TableField("小区名称") + private String[] villageNames; + + @ApiModelProperty(value = "开始时间", required = true) + @TableField("starttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "starttime不能为空") + private LocalDateTime starttime; + + @ApiModelProperty(value = "结束时间", required = true) + @TableField("endtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "endtime不能为空") + private LocalDateTime endtime; + + @ApiModelProperty(value = "排序字段名") + @NotBlank(message = "排序字段名不能为空") + private String sortcol; + + @ApiModelProperty(value = "排序") + @NotBlank(message = "排序不能为空") + private String sort; + + private LocalDateTime querystarttime; + + private Integer queryvenueid; + + private String venuetype; + private String maintaintype; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiColorQo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiColorQo.java new file mode 100644 index 0000000000000000000000000000000000000000..772d45e9655ab6fc562074e9776dc24338776bcc --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiColorQo.java @@ -0,0 +1,44 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @author yqf + * @date 2023/4/26 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpiColorQo { + + + @ApiModelProperty(value = "网络类型") + private String nettype; + + @ApiModelProperty("最大用户数值") + private BigDecimal maxuservalue; + + @ApiModelProperty("上行prb利用率值") + private BigDecimal prbupvalue; + + @ApiModelProperty("下行prb利用率值") + private BigDecimal prbdownvalue; + + @ApiModelProperty("上行平均干扰值") + private BigDecimal avgdisvalue; + + @ApiModelProperty("小区频段") + private String freqtype; + + @ApiModelProperty("设备类型") + private String devicetype; + + @ApiModelProperty("带宽") + private Long bandwidth; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiMinQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiMinQO.java new file mode 100644 index 0000000000000000000000000000000000000000..8486b4806cdaa619125153b411362e22ae497d77 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiMinQO.java @@ -0,0 +1,73 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpiMinQO extends CommonDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "网络类型:0-4G,1-5G", required = true) + @NotBlank(message = "netType不能为空") + private String netType; + + @ApiModelProperty(value = "区县id") + private String regionId; + + @ApiModelProperty(value = "区县id") + private String regionIdv; + + @ApiModelProperty(value = "场馆ids") + private Integer[] venueIds; + + @ApiModelProperty(value = "场馆id") + private Integer venueid; + + @ApiModelProperty(value = "小区id(多选)") + @TableField("小区id") + private String[] villageIds; + + @ApiModelProperty(value = "小区名称(多选)") + @TableField("小区名称") + private String[] villageNames; + + @ApiModelProperty(value = "开始时间", required = true) + @TableField("starttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "starttime不能为空") + private LocalDateTime starttime; + + @ApiModelProperty(value = "结束时间", required = true) + @TableField("endtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "endtime不能为空") + private LocalDateTime endtime; + + @ApiModelProperty(value = "排序字段名") + @NotBlank(message = "排序字段名不能为空") + private String sortcol; + + @ApiModelProperty(value = "排序") + @NotBlank(message = "排序不能为空") + private String sort; + + private String venuetype; + private String maintaintype; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiVenueQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiVenueQO.java new file mode 100644 index 0000000000000000000000000000000000000000..72994a0e38d7115ad016ac2184544a50410361f0 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/PmKpiVenueQO.java @@ -0,0 +1,56 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpiVenueQO extends CommonDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "网络类型:1-4G,2-5G", required = true) + @NotBlank(message = "netType不能为空") + private String netType; + + @ApiModelProperty(value = "市级id") + private String cityId; + + @ApiModelProperty(value = "区县id") + private String regionId; + + @ApiModelProperty(value = "场馆ids") + @TableField("venue_id") + private Integer[] venueIds; + + @TableField("venue_id") + private Integer venueId; + + @ApiModelProperty(value = "开始时间", required = true) + @TableField("starttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "starttime不能为空") + private LocalDateTime starttime; + + @ApiModelProperty(value = "结束时间", required = true) + @TableField("endtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "endtime不能为空") + private LocalDateTime endtime; + + private String orderby; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/SysNoticeQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/SysNoticeQO.java new file mode 100644 index 0000000000000000000000000000000000000000..2a65ddee8699b644b7b87b37d52b98d85c64e9dd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/SysNoticeQO.java @@ -0,0 +1,138 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + *

+ * 通知公告表QO + *

+ * + * @author ck + * @since 2023-04-14 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class SysNoticeQO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("自增id") + @TableId(value = "notice_id", type = IdType.AUTO) + private Integer noticeId; + + @ApiModelProperty("通知标题") + @TableField("notice_title") + private String noticeTitle; + + @ApiModelProperty("通知类型--字典表sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("状态 0未读 1已读") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("插入时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("接收人") + @TableField("recive_user") + private Integer reciveUser; + + @ApiModelProperty("工作流id") + @TableField("flw_processid") + private String flwProcessid; + + @ApiModelProperty("工作流任务id") + @TableField("flw_taskid") + private String flwTaskid; + + @ApiModelProperty("实际发送时间") + @TableField("send_time") + private LocalDateTime sendTime; + + private LocalDateTime beginTime; + private LocalDateTime endTime; + + @ApiModelProperty("发送是否成功,1成功 0失败") + @TableField("send_status") + private String sendStatus; + + @ApiModelProperty("接收人手机号") + @TableField("recive_user_phone") + private String reciveUserPhone; + + @ApiModelProperty("计划发送时间(同天当前时间之前立即发送)") + @TableField("exp_send_time") + private LocalDateTime expSendTime; + + @ApiModelProperty("加入定时任务标记 默认0未加入 1已加入") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知对象ids数组") + @TableField("notice_object_id") + private String noticeObjectId; + + @ApiModelProperty("通知模板id") + @TableField("notice_model_id") + private Long noticeModelId; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + private String modelScene; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知对象(是指具体的通知接受者,呈现方式包括场馆+群组;分公司+群组名;地市+群组名;ITCC+群组名;场馆+个人名;分公司+个人名;地市+个人名;ITCC+个人名这几种组合。具体呈现内容和对象属性、通知方式相关联)") + @TableField("notice_object") + private String noticeObject; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("关联表id(yw_notice_handwork)") + @TableField("handwork_id") + private Long handworkId; + + @ApiModelProperty("关键字") + private String keyWord; + + private Integer pageNum; + + private Integer pageSize; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwDrsConfigQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwDrsConfigQO.java new file mode 100644 index 0000000000000000000000000000000000000000..04d2e90769d24b7507f0d3f38ab07152f329d70f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwDrsConfigQO.java @@ -0,0 +1,71 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +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.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + *

+ * DRS配置表QO + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwDrsConfigQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("任务名称") + @TableField("task_name") + private String taskName; + + @ApiModelProperty("任务类型 drs_task_type 0 / 1 签到 2巡检") + @TableField("drs_task_type") + private String drsTaskType; + + @ApiModelProperty("状态") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField(value = "update_by", fill = FieldFill.UPDATE) + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField(value = "update_time", fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("删除标记") + @TableField("del_flag") + private String delFlag; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwDrsTempTaskQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwDrsTempTaskQO.java new file mode 100644 index 0000000000000000000000000000000000000000..b1fab19a788dbd989535c562b9a2211cf490a88b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwDrsTempTaskQO.java @@ -0,0 +1,106 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +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.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * DRS临时任务表QO + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwDrsTempTaskQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("场馆属性") + private String venueType; + + @ApiModelProperty("维护类型") + private String maintainType; + + @ApiModelProperty("场馆id数组") + private List venueIds; + + @ApiModelProperty("任务日期") + @TableField("task_date") + private LocalDate taskDate; + + @ApiModelProperty("任务时间") + @TableField("task_time") + private LocalDateTime taskTime; + + @ApiModelProperty("任务结束时间") + @TableField("task_end_time") + private LocalDateTime taskEndTime; + + @ApiModelProperty("任务名称") + @TableField("task_name") + private String taskName; + + @ApiModelProperty("DRS任务类型 drs_task_type 0 / 1 签到 2巡检") + @TableField("drs_task_type") + private String drsTaskType; + + @ApiModelProperty("DRS任务状态 drs_task_status 0未开始 1进行中 2已完成") + @TableField("drs_task_status") + private String drsTaskStatus; + + @ApiModelProperty("自动状态变更 0自动 1手动") + @TableField("drs_auto_update") + private String drsAutoUpdate; + + @ApiModelProperty("状态") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("删除标记") + @TableField("del_flag") + private String delFlag; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwKpiConfigQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwKpiConfigQO.java new file mode 100644 index 0000000000000000000000000000000000000000..a65735c7e366a4ed5354b3663f38d542bd003423 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwKpiConfigQO.java @@ -0,0 +1,84 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.github.pagehelper.Page; +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 java.io.Serializable; +import java.time.LocalDateTime; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 指标字段阈值配置表QO + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwKpiConfigQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("序号") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("专业(字典表)") + @TableField("subject") + private String subject; + + @ApiModelProperty("网络模式(字典表)") + @TableField("net_type") + private String netType; + + @ApiModelProperty("指标字段") + @TableField("kpi_field") + private Long kpiField; + + @ApiModelProperty("阈值范围") + @TableField("threshold_value") + private String thresholdValue; + + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("最小是(包括本值)") + @TableField("min_value") + private Object minValue; + + @ApiModelProperty("最大值(不包括本值)") + @TableField("max_value") + private Object maxValue; + + @ApiModelProperty("指标名") + @TableField("kpi_field_name") + private String kpiFieldName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeBriefingQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeBriefingQO.java new file mode 100644 index 0000000000000000000000000000000000000000..bf8ff8c5cb1b7261bf63c485ec96c2380d25bd4f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeBriefingQO.java @@ -0,0 +1,112 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonAlias; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告简报计划表QO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeBriefingQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + //这个注解只在反序列化时起作用,指定该java属性可以接受的更多名称 (别名嘛~) + @JsonAlias({"city"}) + private String city; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private List venueId; + + @ApiModelProperty("场馆属性") + private String venueType; + + @ApiModelProperty("维护类型") + private String maintainType; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("发送日期") + @TableField("send_date") + private LocalDate sendDate; + + @ApiModelProperty("开始时间") + @TableField("begin_time") + private LocalDateTime beginTime; + + @ApiModelProperty("结束时间") + @TableField("end_time") + private LocalDateTime endTime; + + @ApiModelProperty("区县") + @TableField("county") + private String county; + + @ApiModelProperty("对象ids数组") + @TableField("object_ids") + private List objectIds; + + @ApiModelProperty("模板id") + @TableField("model_id") + private Long modelId; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("时间间隔(单位分)") + @TableField("time_interval") + private Integer timeInterval; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + private String noticeName; + + @ApiModelProperty("启用状态 sys_normal_disable 0启用 1停用") + @TableField("sys_normal_disable") + private String sysNormalDisable; + + @ApiModelProperty("关键字") + private String keyWord; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3文字简报 4h5简报)") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("发送方式 send_type (1自动发送 2手工发送)") + @TableField("send_type") + private String sendType; + + @ApiModelProperty("发送人员") + @TableField("send_user") + private Long sendUser; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeHandworkQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeHandworkQO.java new file mode 100644 index 0000000000000000000000000000000000000000..ddc38bc5a940a7d0868aef524e44967d6dac10f8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeHandworkQO.java @@ -0,0 +1,89 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告手工通知计划表QO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeHandworkQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + private String noticeName; + + @ApiModelProperty("通知模板id") + @TableField("notice_model") + private Long noticeModel; + + @ApiModelProperty("通知方式--sys_notice_type") + @TableField("notice_type") + private List noticeType; + + @ApiModelProperty("通知对象ids") + @TableField("notice_object") + private List noticeObject; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("通知状态yw_veriy_status 0待提交 1待审核 2已审核") + @TableField("notice_status") + private List noticeStatus; + + @ApiModelProperty("日期") + @TableField("notice_date") + private LocalDateTime noticeDate; + + @ApiModelProperty("开始时间") + private LocalDateTime beginTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("时间间隔(单位分)") + @TableField("time_interval") + private Integer timeInterval; + + @ApiModelProperty("工作流processid") + @TableField("flw_processid") + private String flwProcessid; + + @ApiModelProperty("申请人id") + @TableField("apply_id") + private Long applyId; + + @ApiModelProperty("审核人id") + @TableField("audit_id") + private Long auditId; + + @ApiModelProperty("已添加到sys_notice标记(0否 1是)") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("关键字") + private String keyWord; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeHandworkdetailQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeHandworkdetailQO.java new file mode 100644 index 0000000000000000000000000000000000000000..0bb5698771ef48f01804052cd8f2a09737b6b209 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeHandworkdetailQO.java @@ -0,0 +1,55 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + *

+ * 通知通告手工通知审核表QO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeHandworkdetailQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("手工通知id") + @TableField("handwork_id") + private Long handworkId; + + @ApiModelProperty("操作人(提交审核的人 或者 审核的人)") + @TableField("oprate_user") + private Long oprateUser; + + @ApiModelProperty("审核结果(关联字典表yw_veriy_result 0通过 1驳回)") + @TableField("veriy_result") + private String veriyResult; + + @ApiModelProperty("审核状态(关联字典表yw_veriy_status 0 待审核 1 已审核)") + @TableField("veriy_status") + private String veriyStatus; + + @ApiModelProperty("驳回原因") + @TableField("fail_reason") + private String failReason; + + @ApiModelProperty("附件") + @TableField("appendix") + private String appendix; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeListQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeListQO.java new file mode 100644 index 0000000000000000000000000000000000000000..936af69450afdbb0bd07a688d7df91aad265901e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeListQO.java @@ -0,0 +1,96 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告记录表QO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeListQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + private String noticeName; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + private String modelScene; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知方式--sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("通知时间(计划发送时间(同天当前时间之前立即发送))") + @TableField("notice_time") + private LocalDateTime noticeTime; + + @ApiModelProperty("通知对象") + @TableField("notice_object") + private String noticeObject; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("状态 0未读 1已读") + @TableField("status") + private String status; + + @ApiModelProperty("通知对象ids数组") + @TableField("notice_object_id") + private List noticeObjectId; + + @ApiModelProperty("通知模板id") + @TableField("notice_model_id") + private Long noticeModelId; + + @ApiModelProperty("实际发送时间") + @TableField("send_time") + private LocalDateTime sendTime; + + @ApiModelProperty("发送是否成功,1成功 0失败") + @TableField("send_status") + private String sendStatus; + + @ApiModelProperty("计划发送时间(同天当前时间之前立即发送)") + @TableField("exp_send_time") + private LocalDateTime expSendTime; + + @ApiModelProperty("加入定时任务标记 默认0未加入 1已加入") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("计划id(手工与简报会先配置计划)") + @TableField("plan_id") + private Long planId; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeModelQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeModelQO.java new file mode 100644 index 0000000000000000000000000000000000000000..86e0b3e8944a47d9cb5d3babdccd551662028bc9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeModelQO.java @@ -0,0 +1,80 @@ +package com.ruoyi.eastcom_yw.domain.qo; + + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.github.pagehelper.Page; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告模板表QO + *

+ * + * @author ck + * @since 2023-04-07 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeModelQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("模板名称") + @TableField("model_name") + private String modelName; + + @ApiModelProperty("模板内容") + @TableField("model_content") + private String modelContent; + + @ApiModelProperty("场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + private String modelScene; + + @ApiModelProperty("用户id") + @TableField(value = "create_user_id", fill = FieldFill.INSERT) + private Long createUserId; + + @ApiModelProperty("创建用户昵称") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("模板适用类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("备注(写一些触发要求)") + @TableField("model_des") + private String modelDes; + + @ApiModelProperty("模板类型--字典model_type 0事件触发型") + @TableField("model_type") + private String modelType; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeObjectQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeObjectQO.java new file mode 100644 index 0000000000000000000000000000000000000000..38852248e9f60ff05254fcfd330767193e55aecb --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwNoticeObjectQO.java @@ -0,0 +1,103 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + *

+ * 通知通告对象表QO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeObjectQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + private String city; + + @ApiModelProperty("区县") + @TableField("county") + private String county; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private List venueId; + + @ApiModelProperty("场馆属性") + private String venueType; + + @ApiModelProperty("维护类型") + private String maintainType; + + @ApiModelProperty("专业") + @TableField("specialty") + private Long specialty; + + @ApiModelProperty("角色id数组") + @TableField("role_ids") + private List roleIds; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("短信组名") + @TableField("message_name") + private String messageName; + + @ApiModelProperty("短信组内成员id数组") + @TableField("message_users") + private List messageUsers; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("群号") + @TableField("group_id") + private String groupId; + + @ApiModelProperty("群名") + @TableField("group_name") + private String groupName; + + @ApiModelProperty("备注") + @TableField("group_des") + private String groupDes; + + @ApiModelProperty("对象名称") + @TableField("object_name") + private String objectName; + + @ApiModelProperty("ivr组名") + @TableField("ivr_name") + private String ivrName; + + @ApiModelProperty("ivr组内成员id数组") + @TableField("ivr_users") + private List ivrUsers; + + @ApiModelProperty("关键字") + private String keyWord; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwSparePartsQO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwSparePartsQO.java new file mode 100644 index 0000000000000000000000000000000000000000..6ad276b1578c29f01d3f70b4cf123222f7829eaf --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/qo/YwSparePartsQO.java @@ -0,0 +1,59 @@ +package com.ruoyi.eastcom_yw.domain.qo; + +import com.github.pagehelper.Page; +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 java.io.Serializable; + +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 亚运备件表QO + *

+ * + * @author yqf + * @since 2023-08-31 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwSparePartsQO extends CommonDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("场馆名称") + @TableField("venue_name") + private String venueName; + + @ApiModelProperty("场馆类型") + @TableField("venue_type") + private String venueType; + + @ApiModelProperty("设备类型") + @TableField("device_type") + private String deviceType; + + @ApiModelProperty("专业") + @TableField("major") + private String major; + + + @ApiModelProperty("联系人") + @TableField("contacts") + private String contacts; + + @ApiModelProperty("联系电话") + @TableField("telephone") + private String telephone; + + @ApiModelProperty("搜索型号") + private String queryType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/AlarmStaticListVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/AlarmStaticListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..cd531e50d12ea07549c3606bceaaa0cc2810b7d3 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/AlarmStaticListVo.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class AlarmStaticListVo { + + private String venueName; + private Integer alarmNum; + private Integer alarmWxNum; + private Integer alarmCsNum; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/AlarmStatisticsListVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/AlarmStatisticsListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..16777c6b60383ffa3e856725a4029c29dfbbe933 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/AlarmStatisticsListVo.java @@ -0,0 +1,10 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +@Data +public class AlarmStatisticsListVo { + private String subscene_name; + private String profession; + private Integer alarm_count; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/AlarmTopListVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/AlarmTopListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..a19c4a5e61e6cb2c20dc7afbb8bce385ebc12427 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/AlarmTopListVo.java @@ -0,0 +1,18 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class AlarmTopListVo { + private String alarm_serial; + private String alarm_title; + private String subscene_name; + private String ne_name; + private String profession; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date alarm_occr_time; + private String handler; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/DictTreeVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/DictTreeVO.java new file mode 100644 index 0000000000000000000000000000000000000000..f56e59e7c2a69dfd84d0299ef9db2adf05ca52b5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/DictTreeVO.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DictTreeVO { + + private String label; + private String value; + private List children; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2AgisLink5miVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2AgisLink5miVO.java new file mode 100644 index 0000000000000000000000000000000000000000..d3bfb1c8489983bb775ea6721df839a6cce31f0a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2AgisLink5miVO.java @@ -0,0 +1,140 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * VO + *

+ * + * @author yqf + * @since 2023-08-18 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2AgisLink5miVO { + + + private static final long serialVersionUID = 1L; + + @TableField("stat_date") + private LocalDateTime statDate; + + @TableField("city_code") + private String cityCode; + + @TableField("city_name") + private String cityName; + + @TableField("venue_code") + private String venueCode; + + @TableField("venue_name") + private String venueName; + + @TableField("link_value_code") + private String linkValueCode; + + @TableField("link_value") + private String linkValue; + + @TableField("link_code") + private String linkCode; + + @TableField("link_name") + private String linkName; + + @TableField("bandwith") + private BigDecimal bandwith; + + @TableField("delay") + private BigDecimal delay; + + @TableField("jitter") + private BigDecimal jitter; + + @TableField("lpack_ratio") + private BigDecimal lpackRatio; + + @TableField("ul_velocity") + private BigDecimal ulVelocity; + + @TableField("dl_velocity") + private BigDecimal dlVelocity; + + @TableField("ul_flow") + private BigDecimal ulFlow; + + @TableField("dl_flow") + private BigDecimal dlFlow; + + @TableField("ul_band_ratio") + private BigDecimal ulBandRatio; + + @TableField("dl_band_ratio") + private BigDecimal dlBandRatio; + + @TableField("total_band_ratio") + private BigDecimal totalBandRatio; + + @TableField("load_time") + private LocalDateTime loadTime; + + @TableField("a_device_alias") + private String aDeviceAlias; + + @TableField("z_device_alias") + private String zDeviceAlias; + + @TableField("dl_max_24h_ratio") + private BigDecimal dlMax24hRatio; + + @TableField("ul_max_24h_ratio") + private BigDecimal ulMax24hRatio; + + @TableField("dl_avg_24h_ratio") + private BigDecimal dlAvg24hRatio; + + @TableField("ul_avg_24h_ratio") + private BigDecimal ulAvg24hRatio; + + @TableField("a_device_name") + private String aDeviceName; + + @TableField("a_port_name") + private String aPortName; + + @TableField("z_device_name") + private String zDeviceName; + + @TableField("z_port_name") + private String zPortName; + + @TableField("a_port_full_name") + private String aPortFullName; + + @TableField("z_port_full_name") + private String zPortFullName; + + @TableField("a_port_short_name") + private String aPortShortName; + + @TableField("z_port_short_name") + private String zPortShortName; + + @TableField("update_time") + private LocalDateTime updateTime; + + //AGIS流量 + private BigDecimal flowcount; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2PnNetVenue5miVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2PnNetVenue5miVO.java new file mode 100644 index 0000000000000000000000000000000000000000..0e20e19ef32541dac67761e5372106a34c62c49d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2PnNetVenue5miVO.java @@ -0,0 +1,138 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * VO + *

+ * + * @author yqf + * @since 2023-08-21 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2PnNetVenue5miVO { + + + private static final long serialVersionUID = 1L; + + @TableField("stat_date") + private LocalDateTime statDate; + + @TableField("city_code") + private String cityCode; + + @TableField("city_name") + private String cityName; + + @ApiModelProperty("互联网在线用户数") + @TableField("online_user_cnt") + private Double onlineUserCnt; + + @TableField("inter_exp_bandwith") + private Double interExpBandwith; + + @TableField("interc_bandwith") + private Double intercBandwith; + + @TableField("venue_bandwith") + private Double venueBandwith; + + @TableField("dl_inter_exp_flow") + private Double dlInterExpFlow; + + @TableField("ul_inter_exp_flow") + private Double ulInterExpFlow; + + @TableField("dl_interc_flow") + private Double dlIntercFlow; + + @TableField("ul_interc_flow") + private Double ulIntercFlow; + + @TableField("dl_venue_flow") + private Double dlVenueFlow; + + @TableField("ul_venue_flow") + private Double ulVenueFlow; + + @TableField("dl_inter_exp_band_ratio") + private Double dlInterExpBandRatio; + + @TableField("ul_inter_exp_band_ratio") + private Double ulInterExpBandRatio; + + @TableField("dl_interc_band_ratio") + private Double dlIntercBandRatio; + + @TableField("ul_interc_band_ratio") + private Double ulIntercBandRatio; + + @ApiModelProperty("互联网下行带宽利用率") + @TableField("dl_venue_band_ratio") + private Double dlVenueBandRatio; + + @ApiModelProperty("互联网上行带宽利用率") + @TableField("ul_venue_band_ratio") + private Double ulVenueBandRatio; + + @TableField("dl_inter_exp_velocity") + private Double dlInterExpVelocity; + + @TableField("ul_inter_exp_velocity") + private Double ulInterExpVelocity; + + @TableField("dl_interc_velocity") + private Double dlIntercVelocity; + + @TableField("ul_interc_velocity") + private Double ulIntercVelocity; + + @ApiModelProperty("互联网场馆出口_下行流速") + @TableField("dl_venue_velocity") + private Double dlVenueVelocity; + + @ApiModelProperty("互联网出口_上行流速") + @TableField("ul_venue_velocity") + private Double ulVenueVelocity; + + @TableField("interc_delay") + private Double intercDelay; + + @TableField("inter_exp_delay") + private Double interExpDelay; + + @TableField("interc_jitter") + private Double intercJitter; + + @TableField("inter_exp_jitter") + private Double interExpJitter; + + @TableField("interc_lpack_ratio") + private Double intercLpackRatio; + + @TableField("inter_exp_lpack_ratio") + private Double interExpLpackRatio; + + @TableField("load_time") + private LocalDateTime loadTime; + + @TableField("venue_code") + private String venueCode; + + @TableField("venue_name") + private String venueName; + + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2SpotCellVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2SpotCellVO.java new file mode 100644 index 0000000000000000000000000000000000000000..e4355f1bfe4f4162b5bdc4410c66a7462398a0fc --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2SpotCellVO.java @@ -0,0 +1,167 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + *

+ * VO + *

+ * + * @author ck + * @since 2023-08-10 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2SpotCellVO { + + + private static final long serialVersionUID = 1L; + + @TableField("id") + private Integer id; + + @TableField("omc") + @Excel(name = "OMC") + private String omc; + + @ApiModelProperty("需要") + @TableField("县市") + @Excel(name = "县市") + private String 县市; + + @TableField("enodebid") + @Excel(name = "enodebid") + private Long enodebid; + + @TableField("本地小区标识") + @Excel(name = "本地小区标识") + private Long 本地小区标识; + + @TableField("小区标识") + @Excel(name = "小区标识") + private Long 小区标识; + + @ApiModelProperty("需要") + @TableField("站号") + @Excel(name = "站号") + private Long 站号; + + @ApiModelProperty("需要") + @TableField("ci") + @Excel(name = "ci") + private Long ci; + + @ApiModelProperty("需要") + @TableField("基站全称") + @Excel(name = "基站全称") + private String 基站全称; + + @TableField("en名称") + @Excel(name = "en名称") + private String en名称; + + @ApiModelProperty("需要") + @TableField("小区名称") + @Excel(name = "小区名称") + private String 小区名称; + + @ApiModelProperty("需要") + @TableField("小区频段") + @Excel(name = "小区频段") + private String 小区频段; + + @ApiModelProperty("需要") + @TableField("纬度") + @Excel(name = "纬度") + private Double 纬度; + + @ApiModelProperty("需要") + @TableField("经度") + @Excel(name = "经度") + private Double 经度; + + @TableField("纬度gcj") + @Excel(name = "纬度gcj") + private Double 纬度gcj; + + @TableField("经度gcj") + @Excel(name = "经度gcj") + private Double 经度gcj; + + @ApiModelProperty("需要") + @TableField("室内室外") + @Excel(name = "室内室外") + private String 室内室外; + + @ApiModelProperty("需要") + @TableField("网络") + @Excel(name = "网络") + private String 网络; + + @TableField("现网状态") + @Excel(name = "现网状态") + private String 现网状态; + + @TableField("cgi") + @Excel(name = "cgi") + private String cgi; + + @TableField("频点") + @Excel(name = "频点") + private Long 频点; + + @TableField("pci") + @Excel(name = "pci") + private Long pci; + + @TableField("tac") + @Excel(name = "tac") + private Long tac; + + @TableField("一级场景") + @Excel(name = "一级场景") + private String 一级场景; + + @TableField("二级场景") + @Excel(name = "二级场景") + private String 二级场景; + + @ApiModelProperty("需要") + @TableField("设备类型") + @Excel(name = "设备类型") + private String 设备类型; + + @ApiModelProperty("需要") + @TableField("带宽") + @Excel(name = "带宽") + private Double 带宽; + + @ApiModelProperty("需要") + @TableField("方位角") + @Excel(name = "方位角") + private Long 方位角; + + @TableField("扇区id") + @Excel(name = "扇区id") + private Long 扇区id; + + @TableField("更新时间") + private LocalDateTime 更新时间; + + @ApiModelProperty("景区ID,需要") + @TableField("景区id") + @Excel(name = "景区id") + private Integer 景区id; + + + private String reason; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2SpotConfigVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2SpotConfigVO.java new file mode 100644 index 0000000000000000000000000000000000000000..65bc3cfea245f954897efb4b1c564ec6c5faaf73 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2SpotConfigVO.java @@ -0,0 +1,48 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * VO + *

+ * + * @author ck + * @since 2023-08-09 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2SpotConfigVO { + + + private static final long serialVersionUID = 1L; + + @TableField("景区id") + private Integer 景区id; + + @TableField("景区名称") + private String 景区名称; + + @TableField("行政区域") + private String 行政区域; + + @TableField("中心经度") + private Object 中心经度; + + @TableField("中心纬度") + private Object 中心纬度; + + @TableField("景区介绍") + private String 景区介绍; + + @TableField("景区大类") + private String 景区大类; + + @TableField("景区大类id") + private Integer 景区大类id; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2ViewPowerAlarmVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2ViewPowerAlarmVO.java new file mode 100644 index 0000000000000000000000000000000000000000..402e49fefc467965b3eaf3e2d9d003a86b1c524f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2ViewPowerAlarmVO.java @@ -0,0 +1,95 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * VO + *

+ * + * @author wqx + * @since 2023-08-31 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2ViewPowerAlarmVO { + + + private static final long serialVersionUID = 1L; + + @TableField("eventtime") + @Excel(name="告警时间") + private LocalDateTime eventtime; + + @TableField("alarmname") + @Excel(name="告警名称") + private String alarmname; + + @TableField("alarmid") + @Excel(name="告警ID") + private Long alarmid; + + @TableField("severity") + @Excel(name="severity") + private String severity; + + @TableField("site_id") + @Excel(name="基站ID") + private String siteId; + + @TableField("site_name") + @Excel(name="基站名称") + private String siteName; + + @TableField("device_name") + @Excel(name="设备名称") + private String deviceName; + + @TableField("owner") + @Excel(name="所有者") + private String owner; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("area") + @Excel(name="区域") + private String area; + + @TableField("logicalsites") + private String logicalsites; + + @TableField("场馆id") + @Excel(name="场馆ID") + private Integer 场馆id; + + @TableField("区域id") + @Excel(name="区域ID") + private Integer 区域id; + + @TableField("场馆名称") + @Excel(name="场馆名称") + private String 场馆名称; + + @TableField("故障处理人") + @Excel(name="故障处理人") + private String 故障处理人; + + @TableField("phonenumber") + @Excel(name="故障处理人联系电话") + private String phonenumber; + + @Excel(name="景区名称") + private String 景区名称; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2ViewWirelessAlarmVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2ViewWirelessAlarmVO.java new file mode 100644 index 0000000000000000000000000000000000000000..c8d3b9eaf0e63b7702d5389209457b78ff373213 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/Dp2ViewWirelessAlarmVO.java @@ -0,0 +1,110 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * VO + *

+ * + * @author wqx + * @since 2023-09-01 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Dp2ViewWirelessAlarmVO { + + + private static final long serialVersionUID = 1L; + + @TableField("id") + private Long id; + + @TableField("eventtime") + @Excel(name ="告警时间") + private LocalDateTime eventtime; + + @TableField("alarmname") + @Excel(name ="告警名称") + private String alarmname; + + @TableField("omcname") + @Excel(name ="OMC名称") + private String omcname; + + @TableField("site_id") + @Excel(name ="基站ID") + private String siteId; + + @TableField("site_name") + @Excel(name ="基站名称") + private String siteName; + + @TableField("area") + @Excel(name ="基站区域") + private String area; + + @TableField("alarmid") + @Excel(name ="告警ID") + private String alarmid; + + @TableField("sitetype") + @Excel(name ="基站类型") + private String sitetype; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("cell_name") + @Excel(name ="小区名称") + private String cellName; + + @TableField("场馆id") + @Excel(name ="场馆id") + private Long 场馆id; + + @TableField("场馆名称") + @Excel(name ="场馆名称") + private String 场馆名称; + + @TableField("longitude") + @Excel(name ="经度") + private Object longitude; + + @TableField("latitude") + @Excel(name ="纬度") + private Object latitude; + + @TableField("坐席编号") + @Excel(name ="坐席编号") + private String 坐席编号; + + @TableField("场内场外") + @Excel(name ="场内场外") + private String 场内场外; + + @TableField("区域id") + @Excel(name ="区域id") + private Integer 区域id; + + @TableField("故障处理人") + @Excel(name ="故障处理人") + private String 故障处理人; + + @TableField("phonenumber") + @Excel(name ="故障处理人手机") + private String phonenumber; + @Excel(name ="景区名称") + private String 景区名称; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/DpSceneConfigVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/DpSceneConfigVO.java new file mode 100644 index 0000000000000000000000000000000000000000..16954650853be3c79632d1c923622f531faed590 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/DpSceneConfigVO.java @@ -0,0 +1,94 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * VO + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DpSceneConfigVO { + + + private static final long serialVersionUID = 1L; + @Excel(name = "序号",width = 20) + @ApiModelProperty("自增id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Excel(name = "网络制式",width = 20) + @ApiModelProperty("网络类型") + @TableField("nettype") + private String nettype; + + @Excel(name = "指标等级",width = 20) + @ApiModelProperty("指标等级:cell、scene") + @TableField("type") + private String type; + + @Excel(name = "指标名称",width = 20) + @ApiModelProperty("指标名称") + @TableField("name") + private String name; + + @Excel(name = "设备类型",width = 20) + @ApiModelProperty("设备类型") + @TableField("celltype") + private String celltype; + + + @Excel(name = "最小值",width = 20) + @ApiModelProperty("最小值") + @TableField("range1") + private Object range1; + + @Excel(name = "最大值",width = 20) + @ApiModelProperty("最大值") + @TableField("range2") + private Object range2; + + @Excel(name = "颜色",width = 20) + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @Excel(name = "颜色分值",width = 20) + @ApiModelProperty("颜色分值") + @TableField("colorscore") + private Double colorscore; + + @Excel(name = "颜色等级",width = 20) + @ApiModelProperty("颜色等级") + @TableField("level") + private Short level; + + @Excel(name = "备注",width = 20) + @ApiModelProperty("备注") + @TableField("content") + private String content; + + + + + + + + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/DpcSeneControlVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/DpcSeneControlVo.java new file mode 100644 index 0000000000000000000000000000000000000000..3c477de58b1e4a933bed786ae7fc594fd223d968 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/DpcSeneControlVo.java @@ -0,0 +1,32 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author yqf + * @date 2023/4/21 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DpcSeneControlVo { + + @ApiModelProperty(value = "数据类型 1或15", required = true) + @NotNull(message = "mintype不能为空") + private Integer mintype; + + @ApiModelProperty(value = "网络类型", required = true) + @NotBlank(message = "nettype不能为空") + private String nettype; + + @ApiModelProperty(value = "指标名称", required = true) + @NotBlank(message = "kpiname不能为空") + private String kpiname; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/FlowContentVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/FlowContentVo.java new file mode 100644 index 0000000000000000000000000000000000000000..b42d5e8a998ded1774c17e83e8e6ba810d068e10 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/FlowContentVo.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.domain.vo; + + +import lombok.Data; + +@Data +public class FlowContentVo { + + private String flwId; + + private String name; + + private String text; + + private String matchName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/HmAlarmDeriveVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/HmAlarmDeriveVo.java new file mode 100644 index 0000000000000000000000000000000000000000..c6a4001bdf050108ee99f4a9cd3a8c1903be7e22 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/HmAlarmDeriveVo.java @@ -0,0 +1,56 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author jkj + * @since 2023-08-02 + */ +@Data +public class HmAlarmDeriveVo implements Serializable { + +private static final long serialVersionUID=1L; + + private Long id; + + private Long groupid; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime 告警时间; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime 恢复时间; + + private String 分公司; + + private String 网元名称; + + private String 端口; + + private String 场馆名称; + + private String 场馆等级; + + private String 告警名称; + + private String 详细位置; + + private String 专业; + + private String 网元属性; + + private String 端口类型; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime 告警插入时间; + +} \ No newline at end of file diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiLinkTrendVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiLinkTrendVo.java new file mode 100644 index 0000000000000000000000000000000000000000..b17c42c0773261b88d5ad411dbbfa3a57149b8d9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiLinkTrendVo.java @@ -0,0 +1,31 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @author yqf + * @date 2023/8/21 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class KpiLinkTrendVo { + + @TableField("链路名称") + private String linkname; + + @TableField("设备名称") + private String evicename; + + @TableField("指标值") + private BigDecimal number; + + @TableField("时间") + private String time; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiReport4gVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiReport4gVo.java new file mode 100644 index 0000000000000000000000000000000000000000..84d4a80d1419df95900c17856f953ae5ca9895e3 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiReport4gVo.java @@ -0,0 +1,69 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author yqf + * @date 2023/5/24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class KpiReport4gVo { + + + private List gbTop5List; + private List avgdisturbTop5List; + private List mauserTop5List; + private List prbupTop5List; + private List prbdownTop5List; + + @TableField("流量GB") + private BigDecimal 流量GB4g; + + @TableField("无线接通率") + private BigDecimal 无线接通率4g; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率4g; + + @TableField("切换成功率") + private BigDecimal 切换成功率4g; + + @TableField("上行平均干扰") + private Short 上行平均干扰4g; + + @TableField("最大用户数") + private BigDecimal 最大用户数4g; + +// @TableField("最大用户数") +// private String 最大用户数小区4g; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率4g; + +// @TableField("上行prb利用率") +// private String 上行prb利用率小区4g; + + @TableField("下行prb利用率") + private String 下行prb利用率4g; + +// @TableField("下行prb利用率") +// private String 下行prb利用率小区4g; + + + private List gbList; + private List avgdisturbList; + private List mauserList; + private List prbupList; + private List prbdownList; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiReport5gVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiReport5gVo.java new file mode 100644 index 0000000000000000000000000000000000000000..093e03bd0512ca9dcbd48cd933e7ba0ffebceaeb --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiReport5gVo.java @@ -0,0 +1,80 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author yqf + * @date 2023/5/24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class KpiReport5gVo { + +// @TableField("场馆id") +// private Integer 场馆id; +// +// @TableField("开始时间") +// private LocalDateTime 开始时间; +// +// @TableField("结束时间") +// private LocalDateTime 结束时间; + + @TableField("流量GB") + private BigDecimal 流量GB5g; + + @TableField("最大用户数") + private Short 最大用户数5g; + + @TableField("无线接通率") + private BigDecimal 无线接通率5g; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率5g; + + @TableField("切换成功率") + private BigDecimal 切换成功率5g; + + @TableField("上行干扰值") + private Double 上行干扰值5g; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率5g; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率5g; + + private List gbList; + private List avgdisturbList; + private List mauserList; + private List prbupList; + private List prbdownList; + + @TableField("上行流量") + private BigDecimal 上行流量5g; + + @TableField("下行流量") + private BigDecimal 下行流量5g; + + @TableField("小区RLC层下行丢包率") + private BigDecimal 小区RLC层下行丢包率5g; + + private List gbTop5List; + private List avgdisturbTop5List; + private List mauserTop5List; + private List prbupTop5List; + private List prbdownTop5List; + + @TableField("nsa_sgnb添加成功率") + private BigDecimal sgnb添加成功率5g; + + @TableField("sn异常释放率") + private BigDecimal sn异常释放率5g; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiTrendVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiTrendVo.java new file mode 100644 index 0000000000000000000000000000000000000000..dbff500c3e72bc4c4a117ffd14bd8e5b2af855c7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiTrendVo.java @@ -0,0 +1,32 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @author yqf + * @date 2023/5/24 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class KpiTrendVo { + + @TableField("指标名称") + private String name; + + @TableField("指标值") + private BigDecimal number; + + @TableField("时间") + private String time; + + public KpiTrendVo(String name, BigDecimal number) { + this.name = name; + this.number = number; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiVenueReportVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiVenueReportVo.java new file mode 100644 index 0000000000000000000000000000000000000000..5d2e5d0662729afb59bcc1d6addb36182bc4f414 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/KpiVenueReportVo.java @@ -0,0 +1,123 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/25 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class KpiVenueReportVo { + + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("开始时间") + private LocalDateTime 开始时间; + + @TableField("结束时间") + private LocalDateTime 结束时间; + + @TableField("流量GB") + private BigDecimal 流量GB4g; + + @TableField("无线接通率") + private BigDecimal 无线接通率4g; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率4g; + + @TableField("上行平均干扰") + private Short 上行平均干扰4g; + + @TableField("最大用户数") + private BigDecimal 最大用户数4g; + + + @TableField("平均用户数") + private BigDecimal 平均用户数4g; + + @TableField("最大用户数") + private String 最大用户数小区4g; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率4g; + + @TableField("上行prb利用率") + private String 上行prb利用率小区4g; + + @TableField("下行prb利用率") + private String 下行prb利用率4g; + + @TableField("下行prb利用率") + private String 下行prb利用率小区4g; + + @TableField("切换成功率") + private BigDecimal 切换成功率4g; + + + @TableField("流量GB") + private BigDecimal 流量GB5g; + + @TableField("平均用户数") + private BigDecimal 平均用户数5g; + + @TableField("最大用户数") + private Short 最大用户数5g; + + @TableField("sn异常释放率") + private BigDecimal sn异常释放率5g; + + @TableField("无线接通率") + private BigDecimal 无线接通率5g; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率5g; + + @TableField("切换成功率") + private BigDecimal 切换成功率5g; + + @TableField("上行干扰值") + private Double 上行干扰值5g; + + @TableField("nsa_sgnb添加成功率") + private BigDecimal sgnb添加成功率5g; + + + @TableField("最大用户数") + private BigDecimal 小区最大用户数5g; + + @TableField("最大用户数") + private String 小区最大用户数小区5g; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率5g; + + @TableField("上行prb利用率") + private String 上行prb利用率小区5g; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率5g; + + @TableField("下行prb利用率") + private String 下行prb利用率小区5g; + + @TableField("上行5g流量") + private BigDecimal 上行流量5g; + + @TableField("下行5g流量") + private BigDecimal 下行流量5g; + + @TableField("小区RLC层下行丢包率") + private BigDecimal 小区RLC层下行丢包率5g; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/MatchListVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/MatchListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..f3bcec3e7fe9d7634f5fd11d0255c9c1981d6f22 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/MatchListVo.java @@ -0,0 +1,15 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class MatchListVo { + private Long stadium_id; + private String stadium_name; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8", locale = "zh") + private Date event_time; + private String event_name; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/MedalListVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/MedalListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..364bd5cfc0a7c9fabcb5f2de0fb59085c94fe910 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/MedalListVo.java @@ -0,0 +1,12 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +@Data +public class MedalListVo { + private String area_name; + private Integer gold_count; + private Integer silver_count; + private Integer bronze_count; + private Integer medals_count; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/MonitorCellVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/MonitorCellVo.java new file mode 100644 index 0000000000000000000000000000000000000000..929c061af48771ea11e056825a33515ea513583b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/MonitorCellVo.java @@ -0,0 +1,71 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @author yqf + * @date 2023/4/13 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("MonitorCellVo实体类") +public class MonitorCellVo { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "排序") + private Integer orderid; + + @ApiModelProperty(value = "数据类型") + private String datatype; + + @ApiModelProperty(value = "网络类型") + private String nettype; + + @TableField("venue_id") + private Integer venueid; + + @ApiModelProperty(value = "场馆名称") + @TableField("venue_name") + private String venuename; + + @ApiModelProperty(value = "坐席编号") + private String seatid; + + @ApiModelProperty(value = "坐席颜色") + private String color; + + @ApiModelProperty(value = "坐席得分") + private Float score; + + @ApiModelProperty(value = "指标名") + private String kpiname; + + @ApiModelProperty(value = "小区类型") + private String celltype; + + @ApiModelProperty(value = "基站编号") + private Long stationno; + + @ApiModelProperty(value = "基站全称") + private String pointname; + + @ApiModelProperty(value = "坐席编号") + private String pointid; + + @ApiModelProperty(value = "经度") + private Double longitude; + + @ApiModelProperty(value = "纬度") + private Double latitude; + + private List celllist; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/NewsListVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/NewsListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..96ac0eef5dd6abded8935f511bc31133060b2a7d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/NewsListVo.java @@ -0,0 +1,14 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class NewsListVo { + private String title; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date news_time; + private String content; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi15CellMonitorVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi15CellMonitorVO.java new file mode 100644 index 0000000000000000000000000000000000000000..302b101ed2372b2d1d1a13fec470ef930f58ce10 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi15CellMonitorVO.java @@ -0,0 +1,108 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/14 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("PmKpi15CellMonitorVO实体类") +public class PmKpi15CellMonitorVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "网络类型") + private String nettype; + + @TableField("venue_id") + private Integer venueid; + + @Excel(name = "场馆名称",width = 20) + @ApiModelProperty(value = "场馆名称") + @TableField("venue_name") + private String venuename; + + @Excel(name = "坐席编号",width = 20) + @ApiModelProperty(value = "坐席编号") + private String 坐席编号; + + @TableField("cellcodeci") + private String cellcodeci; + + @Excel(name = "开始时间",width = 20,dateFormat = "yyyy-MM-dd HH:mm:ss") + @TableField("starttime") + private LocalDateTime starttime; + + @Excel(name = "场馆名称",width = 20) + @TableField("小区名称") + @ApiModelProperty(value = "小区名称") + private String 小区名称; + + @Excel(name = "最大用户数",width = 20) + @ApiModelProperty(value = "最大用户数") + @TableField("最大用户数") + private PmKpiVO 最大用户数; + + @Excel(name = "上行prb利用率",width = 20) + @ApiModelProperty(value = "上行prb利用率") + @TableField("上行prb利用率") + private PmKpiVO 上行prb利用率; + + @Excel(name = "下行prb利用率",width = 20) + @ApiModelProperty(value = "下行prb利用率") + @TableField("下行prb利用率") + private PmKpiVO 下行prb利用率; + + @Excel(name = "上行平均干扰",width = 20) + @ApiModelProperty(value = "上行平均干扰") + @TableField("上行平均干扰") + private PmKpiVO 上行平均干扰; + + @Excel(name = "结束时间",width = 20,dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "结束时间") + @TableField("endtime") + private LocalDateTime endtime; + + @ApiModelProperty(value = "综合得分") + private PmKpiVO 综合得分; + + + + @ApiModelProperty(value = "基站编号") + private Long stationno; + + @ApiModelProperty(value = "基站全称") + private String pointname; + + @ApiModelProperty(value = "坐席编号") + private String pointid; + + @ApiModelProperty(value = "经度") + private Double longitude; + + @ApiModelProperty(value = "纬度") + private Double latitude; + + @ApiModelProperty(value = "小区频段") + private String 小区频段; + + @ApiModelProperty(value = "设备类型") + private String 设备类型; + + @ApiModelProperty(value = "带宽") + private Long 带宽; + + @ApiModelProperty(value = "方位角") + private Long 方位角; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi15MinCellVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi15MinCellVO.java new file mode 100644 index 0000000000000000000000000000000000000000..0aaf6e7ab5e57153fd62fc4858646fab6db8c111 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi15MinCellVO.java @@ -0,0 +1,102 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author yqf + * @date 2023/4/12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi15MinCellVO { + + + private static final long serialVersionUID = 1L; +// @ApiModelProperty("id") +// @TableField("id") +// private Long id; + + private Integer orderId; + + @ApiModelProperty(value = "网络类型") + private String netType; + + @TableField("venue_id") + private Integer venueId; + + @ApiModelProperty(value = "场馆名称") + @TableField("venue_name") + private String venueName; + + @TableField("cellcodeci") + private String cellcodeci; + + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("小区名称") + @ApiModelProperty(value = "小区名称") + private String 小区名称; + + @ApiModelProperty(value = "平均用户数") + @TableField("平均用户数") + private PmKpiVO 平均用户数; + + @ApiModelProperty(value = "最大用户数") + @TableField("最大用户数") + private PmKpiVO 最大用户数; + + @ApiModelProperty(value = "上行prb利用率") + @TableField("上行prb利用率") + private PmKpiVO 上行prb利用率; + + @ApiModelProperty(value = "下行prb利用率") + @TableField("下行prb利用率") + private PmKpiVO 下行prb利用率; + + @ApiModelProperty(value = "上行平均干扰") + @TableField("上行平均干扰") + private PmKpiVO 上行平均干扰; + + @ApiModelProperty(value = "无线掉线率") + @TableField("无线掉线率") + private PmKpiVO 无线掉线率; + + @ApiModelProperty(value = "无线接通率") + @TableField("无线接通率") + private PmKpiVO 无线接通率; + + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("groupid") + private Long groupid; + + @ApiModelProperty(value = "结束时间") + @TableField("endtime") + private LocalDateTime endtime; + + private List kpi6HourData; + + @ApiModelProperty(value = "小区频段") + private String 小区频段; + + @ApiModelProperty(value = "设备类型") + private String 设备类型; + + @ApiModelProperty(value = "带宽") + private Long 带宽; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gCellVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gCellVO.java new file mode 100644 index 0000000000000000000000000000000000000000..04ab22fbd793ab3a6e92dbfea7e1dcc56a52a40d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gCellVO.java @@ -0,0 +1,224 @@ +package com.ruoyi.eastcom_yw.domain.vo; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + *

+ * 场馆4G小区级15分钟指标VO + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi4gCellVO { + + + private static final long serialVersionUID = 1L; + + @TableField("venue_id") + private Integer venueId; + + @TableField("venue_name") + @Excel(name = "场馆", width = 20,sort = 1) + private String venueName; + + @TableField("cellcodeci") + private String cellcodeci; + + @Excel(name = "开始时间",width = 20,dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 3) + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("小区名称") + @Excel(name = "小区名称",width = 20,sort = 2) + private String 小区名称; + + @Excel(name = "上行流量mb",width = 20) + @TableField("上行流量mb") + private BigDecimal 上行流量mb; + + @Excel(name = "下行流量mb",width = 20) + @TableField("下行流量mb") + private BigDecimal 下行流量mb; + + @Excel(name = "有效rrc连接平均数",width = 20) + @TableField("有效rrc连接平均数") + private BigDecimal 有效rrc连接平均数; + + @Excel(name = "有效rrc连接最大数",width = 20) + @TableField("有效rrc连接最大数") + private BigDecimal 有效rrc连接最大数; + + @Excel(name = "平均用户数",width = 20) + @TableField("平均用户数") + private BigDecimal 平均用户数; + + @Excel(name = "最大用户数",width = 20) + @TableField("最大用户数") + private BigDecimal 最大用户数; + + @Excel(name = "volte话务量",width = 20) + @TableField("volte话务量") + private BigDecimal volte话务量; + + @TableField("上行prb利用率") + @Excel(name = "上行prb利用率",width = 20) + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + @Excel(name = "下行prb利用率",width = 20) + private BigDecimal 下行prb利用率; + + @TableField("上行平均干扰") + @Excel(name = "上行平均干扰",width = 20) + private BigDecimal 上行平均干扰; + + @Excel(name = "rrc建立成功率",width = 20) + @TableField("rrc建立成功率") + private BigDecimal rrc建立成功率; + + @Excel(name = "e_rab建立成功率",width = 20) + @TableField("e_rab建立成功率") + private BigDecimal eRab建立成功率; + + @Excel(name = "qci为1的e_rab建立成功率",width = 20) + @TableField("qci为1的e_rab建立成功率") + private BigDecimal qci为1的eRab建立成功率; + + @Excel(name = "无线掉线率",width = 20) + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @Excel(name = "掉线次数",width = 20) + @TableField("掉线次数") + private BigDecimal 掉线次数; + + @Excel(name = "切换成功率",width = 20) + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @Excel(name = "esrvcc切换成功率",width = 20) + @TableField("esrvcc切换成功率") + private BigDecimal esrvcc切换成功率; + + @Excel(name = "esrvcc切换请求次数",width = 20) + @TableField("esrvcc切换请求次数") + private BigDecimal esrvcc切换请求次数; + + @Excel(name = "rrc重建成功率",width = 20) + @TableField("rrc重建成功率") + private BigDecimal rrc重建成功率; + + @Excel(name = "rrc重建次数",width = 20) + @TableField("rrc重建次数") + private BigDecimal rrc重建次数; + + @Excel(name = "volte掉话率",width = 20) + @TableField("volte掉话率") + private BigDecimal volte掉话率; + + @Excel(name = "volte掉话次数",width = 20) + @TableField("volte掉话次数") + private BigDecimal volte掉话次数; + + @Excel(name = "rru_puschprbassn",width = 20) + @TableField("rru_puschprbassn") + private BigDecimal rruPuschprbassn; + + @Excel(name = "rru_puschprbtot",width = 20) + @TableField("rru_puschprbtot") + private BigDecimal rruPuschprbtot; + + @Excel(name = "rru_pdschprbassn",width = 20) + @TableField("rru_pdschprbassn") + private BigDecimal rruPdschprbassn; + + @Excel(name = "rru_pdschprbtot",width = 20) + @TableField("rru_pdschprbtot") + private BigDecimal rruPdschprbtot; + + @Excel(name = "rrc_succconnestab",width = 20) + @TableField("rrc_succconnestab") + private BigDecimal rrcSuccconnestab; + + @Excel(name = "rrc_attconnestab",width = 20) + @TableField("rrc_attconnestab") + private BigDecimal rrcAttconnestab; + + @Excel(name = "erab_nbrsuccestab_1",width = 20) + @TableField("erab_nbrsuccestab_1") + private BigDecimal erabNbrsuccestab1; + + @Excel(name = "erab_nbrattestab",width = 20) + @TableField("erab_nbrattestab") + private BigDecimal erabNbrattestab; + + @Excel(name = "erab_nbrattestab_1",width = 20) + @TableField("erab_nbrattestab_1") + private BigDecimal erabNbrattestab1; + + @Excel(name = "切换成功率_分母",width = 20) + @TableField("切换成功率_分母") + private BigDecimal 切换成功率分母; + + @Excel(name = "切换成功率_分子",width = 20) + @TableField("切换成功率_分子") + private BigDecimal 切换成功率分子; + + @Excel(name = "掉线率_分母",width = 20) + @TableField("掉线率_分母") + private BigDecimal 掉线率分母; + + @Excel(name = "iratho_succoutgeran",width = 20) + @TableField("iratho_succoutgeran") + private BigDecimal irathoSuccoutgeran; + + @Excel(name = "rrc_attconnreestab",width = 20) + @TableField("rrc_attconnreestab") + private BigDecimal rrcAttconnreestab; + + @Excel(name = "volte掉话率_分母",width = 20) + @TableField("volte掉话率_分母") + private BigDecimal volte掉话率分母; + + @Excel(name = "erab_nbrsuccestab",width = 20) + @TableField("erab_nbrsuccestab") + private BigDecimal erabNbrsuccestab; + + @Excel(name = "omcname",width = 20) + @TableField("omcname") + private String omcname; + + @Excel(name = "无线接通率",width = 20) + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @Excel(name = "rrc_failconnestab",width = 20) + @TableField("rrc_failconnestab") + private BigDecimal rrcFailconnestab; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("groupid") + private Long groupid; + + @Excel(name = "结束时间",width = 20,dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 4) + @TableField("endtime") + private LocalDateTime endtime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gMinVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gMinVO.java new file mode 100644 index 0000000000000000000000000000000000000000..b2fc14108519e748ae7d9f86a722feb1bf63b449 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gMinVO.java @@ -0,0 +1,138 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆4G小区级1分钟指标VO + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi4gMinVO { + + + private static final long serialVersionUID = 1L; + + @Excel(name = "序号",width = 20) + private Integer orderId; + + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @TableField("groupid") + private Integer groupid; + + @Excel(name = "时间",width = 20) + @TableField("时间") + private LocalDateTime 时间; + + @TableField("地市区号") + private String 地市区号; + + @TableField("区县") + private String 区县; + + @Excel(name = "场馆名",width = 20) + private String venueName; + + @Excel(name = "小区名",width = 20) + @TableField("小区名称") + private String 小区名称; + + @Excel(name = "下行流量(MB)",width = 20) + @TableField("data_down") + private BigDecimal dataDown; + + @Excel(name = "上行流量(MB)",width = 20) + @TableField("data_up") + private BigDecimal dataUp; + + @Excel(name = "VOLTE掉话率(%)",width = 20) + @TableField("volte_drop_rate") + private BigDecimal volteDropRate; + + @Excel(name = "VOLTE接通率(%)",width = 20) + @TableField("volte_succ_rate") + private BigDecimal volteSuccRate; + + @Excel(name = "VOLTE语音话务量(ERL)",width = 20) + @TableField("volte") + private BigDecimal volte; + + @Excel(name = "最大激活用户数",width = 20) + @TableField("act_max_user") + private Integer actMaxUser; + + @Excel(name = "平均激活用户数",width = 20) + @TableField("act_avg_user") + private BigDecimal actAvgUser; + + @Excel(name = "无线掉线率(%)",width = 20) + @TableField("call_drop_rate") + private BigDecimal callDropRate; + + @Excel(name = "无线接通率(%)",width = 20) + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @Excel(name = "下行用户体验速率(Mbps)",width = 20) + @TableField("speed_down") + private BigDecimal speedDown; + + @Excel(name = "上行用户体验速率(Mbps)",width = 20) + @TableField("speed_up") + private BigDecimal speedUp; + + @Excel(name = "上行干扰(dBm)",width = 20) + @TableField("avg_disturb") + private Integer avgDisturb; + + @Excel(name = "下行PRB利用率(%)",width = 20) + @TableField("prb_down") + private BigDecimal prbDown; + + @Excel(name = "上行PRB利用率(%)",width = 20) + @TableField("prb_up") + private BigDecimal prbUp; + + @Excel(name = "小区内的最大用户数",width = 20) + @TableField("max_user") + private Integer maxUser; + + @Excel(name = "小区内的平均用户数",width = 20) + @TableField("avg_user") + private BigDecimal avgUser; + + @TableField("厂商id") + private String 厂商id; + + @Excel(name = "系统每PRB的上行所接收到的干扰和噪声的最大值",width = 20) + @TableField("v1_max") + private BigDecimal v1Max; + + @Excel(name = "系统每PRB的上行所接收到的干扰和噪声的平均值",width = 20) + @TableField("v1_avg") + private String v1Avg; + + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gVenueConvertVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gVenueConvertVO.java new file mode 100644 index 0000000000000000000000000000000000000000..a155987e4f4461c7a2415c001c0b56fc43387670 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gVenueConvertVO.java @@ -0,0 +1,43 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @author yqf + * @date 2023/4/12 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi4gVenueConvertVO { + + @ApiModelProperty(value = "小区总数") + private PmKpiVO villagecount; + + @ApiModelProperty(value = "异常小区数") + private PmKpiVO unusualcount; + + @ApiModelProperty(value = "最大用户数") + private PmKpiVO maxusercount; + + @ApiModelProperty(value = "上行prb利用率") + @TableField("上行prb利用率") + private PmKpiVO 上行prb利用率; + + @ApiModelProperty(value = "下行prb利用率") + @TableField("下行prb利用率") + private PmKpiVO 下行prb利用率; + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("场馆名称") + private String venueName; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gVenueVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gVenueVO.java new file mode 100644 index 0000000000000000000000000000000000000000..5e2efc3fb3d7c3275cf158b28be9ed258e7452ac --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi4gVenueVO.java @@ -0,0 +1,77 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi4gVenueVO { + + + private static final long serialVersionUID = 1L; + + + @TableId("id") + private Long id; + + @TableField("开始时间") + private LocalDateTime 开始时间; + + @TableField("入库时间") + private LocalDateTime 入库时间; + + @TableField("区县") + private String 区县; + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("流量GB") + private Short 流量GB; + + @TableField("最大用户数") + private Short 最大用户数; + + @TableField("话务量") + private Short 话务量; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("上行平均干扰") + private Short 上行平均干扰; + + @TableField("volte接通率") + private BigDecimal volte接通率; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("结束时间") + private LocalDateTime 结束时间; + + @TableField("平均用户数") + private BigDecimal 平均用户数; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi5gCellVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi5gCellVO.java new file mode 100644 index 0000000000000000000000000000000000000000..33a783f1e90324cabc4edfb4d1ce53941385a065 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi5gCellVO.java @@ -0,0 +1,206 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆5G小区级15分钟指标VO + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi5gCellVO { + + + private static final long serialVersionUID = 1L; + + @TableField("venue_id") + private Integer venueId; + + @TableField("venue_name") + @Excel(name = "场馆名称",width = 20) + private String venueName; + + @TableField("ci") + private String ci; + + @Excel(name = "开始时间",width = 20,dateFormat = "yyyy-MM-dd HH:mm:ss") + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("小区名称") + @Excel(name = "小区名称",width = 20) + private String 小区名称; + + @Excel(name = "nr流量",width = 20) + @TableField("nr流量") + private BigDecimal nr流量; + + @Excel(name = "上行5g流量",width = 20) + @TableField("上行5g流量") + private BigDecimal 上行5g流量; + + @Excel(name = "下行5g流量",width = 20) + @TableField("下行5g流量") + private BigDecimal 下行5g流量; + + @Excel(name = "小区rlc层下行丢包率",width = 20) + @TableField("小区rlc层下行丢包率") + private BigDecimal 小区rlc层下行丢包率; + + @Excel(name = "小区级rlc层sdu下行空口丢包数",width = 20) + @TableField("小区级rlc层sdu下行空口丢包数") + private BigDecimal 小区级rlc层sdu下行空口丢包数; + + @Excel(name = "小区rlc层收到的下行sdu包数",width = 20) + @TableField("小区rlc层收到的下行sdu包数") + private BigDecimal 小区rlc层收到的下行sdu包数; + + @Excel(name = "平均用户数",width = 20) + @TableField("平均用户数") + private BigDecimal 平均用户数; + + @Excel(name = "最大用户数",width = 20) + @TableField("最大用户数") + private BigDecimal 最大用户数; + + @Excel(name = "sn异常释放率",width = 20) + @TableField("sn异常释放率") + private BigDecimal sn异常释放率; + + @Excel(name = "sgnb释放总次数",width = 20) + @TableField("sgnb释放总次数") + private BigDecimal sgnb释放总次数; + + @Excel(name = "sgnb触发sgnb异常释放总次数",width = 20) + @TableField("sgnb触发sgnb异常释放总次数") + private BigDecimal sgnb触发sgnb异常释放总次数; + + @Excel(name = "nsa_sgnb添加成功率",width = 20) + @TableField("nsa_sgnb添加成功率") + private BigDecimal nsaSgnb添加成功率; + + @Excel(name = "dc场景下发送sgnb增加成功的次数",width = 20) + @TableField("dc场景下发送sgnb增加成功的次数") + private BigDecimal dc场景下发送sgnb增加成功的次数; + + @Excel(name = "dc场景下收到sgnb增加尝试的次数",width = 20) + @TableField("dc场景下收到sgnb增加尝试的次数") + private BigDecimal dc场景下收到sgnb增加尝试的次数; + + @Excel(name = "无线接通率",width = 20) + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @Excel(name = "rrc建立成功次数",width = 20) + @TableField("rrc建立成功次数") + private BigDecimal rrc建立成功次数; + + @Excel(name = "rrc建立请求消息次数",width = 20) + @TableField("rrc建立请求消息次数") + private BigDecimal rrc建立请求消息次数; + + @Excel(name = "小区中qos_flow建立成功次数",width = 20) + @TableField("小区中qos_flow建立成功次数") + private BigDecimal 小区中qosFlow建立成功次数; + + @Excel(name = "小区中qos_flow建立尝试次数",width = 20) + @TableField("小区中qos_flow建立尝试次数") + private BigDecimal 小区中qosFlow建立尝试次数; + + @Excel(name = "小区中ng信令连接建立成功次数",width = 20) + @TableField("小区中ng信令连接建立成功次数") + private BigDecimal 小区中ng信令连接建立成功次数; + + @Excel(name = "小区中ng信令连接建立尝试次数",width = 20) + @TableField("小区中ng信令连接建立尝试次数") + private BigDecimal 小区中ng信令连接建立尝试次数; + + @Excel(name = "无线掉线率",width = 20) + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @Excel(name = "小区中ue上下文异常释放的次数",width = 20) + @TableField("小区中ue上下文异常释放的次数") + private BigDecimal 小区中ue上下文异常释放的次数; + + @Excel(name = "小区中ue上下文正常释放的次数",width = 20) + @TableField("小区中ue上下文正常释放的次数") + private BigDecimal 小区中ue上下文正常释放的次数; + + @Excel(name = "无线掉线率分母",width = 20) + @TableField("无线掉线率分母") + private BigDecimal 无线掉线率分母; + + @Excel(name = "切换成功率",width = 20) + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @Excel(name = "切换成功率分子",width = 20) + @TableField("切换成功率分子") + private BigDecimal 切换成功率分子; + + @Excel(name = "切换成功率分母",width = 20) + @TableField("切换成功率分母") + private BigDecimal 切换成功率分母; + + @Excel(name = "下行平均使用的prb个数",width = 20) + @TableField("下行平均使用的prb个数") + private BigDecimal 下行平均使用的prb个数; + + @Excel(name = "下行平均可用prb个数",width = 20) + @TableField("下行平均可用prb个数") + private BigDecimal 下行平均可用prb个数; + + @Excel(name = "上行平均使用的prb个数",width = 20) + @TableField("上行平均使用的prb个数") + private BigDecimal 上行平均使用的prb个数; + + @Excel(name = "上行平均可用prb个数",width = 20) + @TableField("上行平均可用prb个数") + private BigDecimal 上行平均可用prb个数; + + @Excel(name = "上行prb利用率",width = 20) + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @Excel(name = "下行prb利用率",width = 20) + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("cell_name") + private String cellName; + + @TableField("pmsid") + private Long pmsid; + + @Excel(name = "上行干扰值",width = 20) + @TableField("上行干扰值") + private Double 上行干扰值; + + @TableField("update_time") + private LocalDateTime updateTime; + + @Excel(name = "结束时间",width = 20,dateFormat = "yyyy-MM-dd HH:mm:ss") + @TableField("endtime") + private LocalDateTime endtime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi5gMinVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi5gMinVO.java new file mode 100644 index 0000000000000000000000000000000000000000..2a4c84f2a916c0fb05d81944a2793aa2243a4093 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi5gMinVO.java @@ -0,0 +1,116 @@ +package com.ruoyi.eastcom_yw.domain.vo; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 场馆5G小区级1分钟指标VO + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi5gMinVO { + + + private static final long serialVersionUID = 1L; +@ApiModelProperty("id") +@TableField("id") +private Long id; + + @TableField("groupid") + private Integer groupid; + + @Excel(name = "序号",width = 20) + private Integer orderId; + + @Excel(name = "时间",width = 20) + @TableField("时间") + private LocalDateTime 时间; + + @TableField("地市区号") + private String 地市区号; + + @TableField("区县") + private String 区县; + + @Excel(name = "场馆名",width = 20) + private String venueName; + + @Excel(name = "小区名称",width = 20) + @TableField("小区名称") + private String 小区名称; + + @TableField("厂商id") + private String 厂商id; + + @Excel(name = "上行PRB平均利用率(%)",width = 20) + @TableField("prb_up") + private Double prbUp; + + @Excel(name = "下行PRB平均利用率(%)",width = 20) + @TableField("prb_down") + private Double prbDown; + + @Excel(name = "上行干扰(dBm)",width = 20) + @TableField("up_disturb") + private Integer upDisturb; + + @Excel(name = "上行用户平均速率(Mbps)",width = 20) + @TableField("speed_up") + private Double speedUp; + + @Excel(name = "下行用户平均速率(Mbps)",width = 20) + @TableField("speed_down") + private Double speedDown; + + @Excel(name = "小区最大激活用户数",width = 20) + @TableField("act_max_user") + private Integer actMaxUser; + + @Excel(name = "小区平均激活用户数",width = 20) + @TableField("act_avg_user") + private Double actAvgUser; + + @Excel(name = "小区内处于RRC连接态的平均用户数",width = 20) + @TableField("rrc_avg_user") + private BigDecimal rrcAvgUser; + + @Excel(name = "小区内处于RRC连接态的最大用户数",width = 20) + @TableField("rrc_max_user") + private Integer rrcMaxUser; + + @Excel(name = "无线接通率(%)",width = 20) + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @Excel(name = "无线掉线率(%)",width = 20) + @TableField("drop_call_rate") + private BigDecimal dropCallRate; + + @Excel(name = "下行流量(MB)",width = 20) + @TableField("data_down") + private BigDecimal dataDown; + + @Excel(name = "上行流量(MB)",width = 20) + @TableField("data_up") + private BigDecimal dataUp; + + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi5gVenueVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi5gVenueVO.java new file mode 100644 index 0000000000000000000000000000000000000000..6dc9334faf30a630fa4efc40b4b39b27795c9fcd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpi5gVenueVO.java @@ -0,0 +1,90 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 5G场馆级15分钟指标VO + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpi5gVenueVO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + + @TableField("开始时间") + private LocalDateTime 开始时间; + + @TableField("入库时间") + private LocalDateTime 入库时间; + + @TableField("区县") + private String 区县; + + @TableField("场馆id") + private Integer 场馆id; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("nsa_sgnb添加成功率") + private BigDecimal nsaSgnb添加成功率; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("sn异常释放率") + private BigDecimal sn异常释放率; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("流量GB") + private BigDecimal 流量GB; + + @TableField("最大用户数") + private Short 最大用户数; + + @TableField("话务量") + private BigDecimal 话务量; + + @TableField("上行干扰值") + private Double 上行干扰值; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("结束时间") + private LocalDateTime 结束时间; + + @TableField("平均用户数") + private BigDecimal 平均用户数; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpiOneMinVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpiOneMinVO.java new file mode 100644 index 0000000000000000000000000000000000000000..aa340f46822c39198972fb4b55d199feeee0016d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpiOneMinVO.java @@ -0,0 +1,85 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author yqf + * @date 2023/4/12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpiOneMinVO { + + private static final long serialVersionUID = 1L; + + private Integer orderId; + + @ApiModelProperty(value = "网络类型") + private String netType; + + @TableField("venue_id") + private Integer venueId; + + @Excel(name = "场馆名称", sort = 1) + @TableField("venue_name") + private String venueName; + + @TableField("cellcodeci") + private String cellcodeci; + + @TableField("groupid") + private Integer groupid; + + @TableField("时间") + private LocalDateTime 时间; + + @TableField("小区名称") + private String 小区名称; + + @ApiModelProperty(value = "平均用户数") + @TableField("平均用户数") + private PmKpiVO 平均用户数; + + @ApiModelProperty(value = "最大用户数") + @TableField("最大用户数") + private PmKpiVO 最大用户数; + + @ApiModelProperty(value = "上行prb利用率") + @TableField("上行prb利用率") + private PmKpiVO 上行prb利用率; + + @ApiModelProperty(value = "下行prb利用率") + @TableField("下行prb利用率") + private PmKpiVO 下行prb利用率; + + @ApiModelProperty(value = "上行平均干扰") + @TableField("上行平均干扰") + private PmKpiVO 上行平均干扰; + + @ApiModelProperty(value = "无线掉线率") + @TableField("无线掉线率") + private PmKpiVO 无线掉线率; + + @ApiModelProperty(value = "无线接通率") + @TableField("无线接通率") + private PmKpiVO 无线接通率; + + @ApiModelProperty(value = "小区频段") + private String 小区频段; + + @ApiModelProperty(value = "设备类型") + private String 设备类型; + + @ApiModelProperty(value = "带宽") + private Long 带宽; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpiVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpiVO.java new file mode 100644 index 0000000000000000000000000000000000000000..c5cb55d69179a0a4354ab819d0f9e33618ec4dd2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/PmKpiVO.java @@ -0,0 +1,52 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PmKpiVO { + + @ApiModelProperty(value = "数值") + private BigDecimal value; + + @ApiModelProperty(value = "最大数值") + private BigDecimal maxvalue; + + @ApiModelProperty(value = "颜色") + private String color; + + @ApiModelProperty(value = "分数") + private float score; + + @ApiModelProperty(value = "data") + private List data; + + public PmKpiVO(BigDecimal maxvalue, String color) { + this.maxvalue = maxvalue; + this.color = color; + } + + public PmKpiVO(BigDecimal value, BigDecimal maxvalue, String color) { + this.value = value; + this.maxvalue = maxvalue; + this.color = color; + } + + public PmKpiVO(String color) { + this.color = color; + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/RaceScheduleListVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/RaceScheduleListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..cc89f8ebc47b8044480f9dbb9504fb0b7f1fa823 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/RaceScheduleListVo.java @@ -0,0 +1,18 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class RaceScheduleListVo { + private Long stadium_id; + private String stadium_name; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date start_time; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date end_time; + private String task_name; + private String task_status; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/RecordVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/RecordVo.java new file mode 100644 index 0000000000000000000000000000000000000000..eeebeb6649004b53639448ff3252a5bd4684aed5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/RecordVo.java @@ -0,0 +1,27 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class RecordVo { + + private LocalDateTime time; + + private BigDecimal prbupcount; + private BigDecimal prbdowncount; + private BigDecimal maxusercount; + private BigDecimal avgdisturbcount; + private BigDecimal gbcount; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/SceneBaseStation.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/SceneBaseStation.java new file mode 100644 index 0000000000000000000000000000000000000000..9ab56faa08a35f92df5ec5bbb391d090ed041bab --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/SceneBaseStation.java @@ -0,0 +1,98 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author yqf + * @date 2023/6/5 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class SceneBaseStation extends ResultBean { + + @Excel(name = "站号", type = Excel.Type.ALL) + private String siteNo; + + @Excel(name = "基站名称", type = Excel.Type.ALL) + private String siteName; + + @Excel(name = "区域", type = Excel.Type.ALL) + private String region; + + @Excel(name = "RHUB编号", type = Excel.Type.ALL) + private String rhubName; + + @Excel(name = "RHUB柜框槽", type = Excel.Type.ALL) + private String rhubUniqueId; + + @Excel(name = "RHUB端口", type = Excel.Type.ALL) + private String rhubPortNo; + + @Excel(name = "pRRU编号", type = Excel.Type.ALL) + private String prruName; + + @Excel(name = "pRRU柜框槽", type = Excel.Type.ALL) + private String prruUniqueId; + + @Excel(name = "设备型号", type = Excel.Type.ALL) + private String prruModel; + + @Excel(name = "pRRU安装位置(CAD)", type = Excel.Type.ALL) + private String prruPosition; + + @Excel(name = "AP编号(CAD)", type = Excel.Type.ALL) + private String apId; + + @Excel(name = "天线编号(CAD)", type = Excel.Type.ALL) + private String antId; + + @Excel(name = "天线类型(CAD)", type = Excel.Type.ALL) + private String antType; + + @Excel(name = "覆盖区域(CAD)", type = Excel.Type.ALL) + private String coverageArea; + + @Excel(name = "本地小区标识", type = Excel.Type.ALL) + private String localCellId; + + @Excel(name = "CGI", type = Excel.Type.ALL) + private String cellCgi; + + @Excel(name = "小区名称", type = Excel.Type.ALL) + private String cellName; + + @Excel(name = "PCI", type = Excel.Type.ALL) + private String pci; + + @Excel(name = "频点", type = Excel.Type.ALL) + private String frequency; + + @Excel(name = "直连基带处理板端口信息", type = Excel.Type.ALL) + private String directlyBaseband; + + @Excel(name = "服务基带处理板信息", type = Excel.Type.ALL) + private String servingBaseband; + + @Excel(name = "单板配置类型", type = Excel.Type.ALL) + private String boardConfigType; + + +// private String mptUniqueId; +// private String fanUniqueId; +// private String peuUniqueId; +// private String rhubId; +// private String prruEsn; +// private String frequencyBand; +// private String prruInstallMode; +// private String antCoordinate; +// private String prruCoordinate; +// private String prruId; +// private String antInstallMode; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/SysNoticeVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/SysNoticeVO.java new file mode 100644 index 0000000000000000000000000000000000000000..ed401d0fef781af283b1915f47775b76d44c737b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/SysNoticeVO.java @@ -0,0 +1,185 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +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 com.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.mybatis.JsonListLongTypeHandler; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知公告表VO + *

+ * + * @author ck + * @since 2023-04-14 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "sys_notice" ,autoResultMap = true) +public class SysNoticeVO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("自增id") + @TableId(value = "notice_id", type = IdType.AUTO) + @Excel(name = "序号",sort = 1) + private Integer noticeId; + + @ApiModelProperty("通知标题") + @TableField("notice_title") + @Excel(name = "通知名称",sort = 2) + private String noticeTitle; + + @ApiModelProperty("通知类型--字典表sys_notice_type") + @TableField("notice_type") + @Excel(name = "通知方式", dictType = "sys_notice_type",sort = 7) + private String noticeType; + + @ApiModelProperty("通知类型--字典表sys_notice_type") + @BindDict(filedMapping = "noticeType", type = "sys_notice_type") + private String noticeTypeStr; + + @ApiModelProperty("通知内容") + @TableField("notice_content") +// @Excel(name = "通知内容") + private String noticeContent; + + @ApiModelProperty("状态 0未读 1已读") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField("create_by") +// @Excel(name = "创建人") + private String createBy; + + @ApiModelProperty("插入时间") + @TableField("create_time") +// @Excel(name = "通知时间",sort = 6,dateFormat = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("接收人") + @TableField("recive_user") + private Integer reciveUser; + + @ApiModelProperty("工作流id") + @TableField("flw_processid") + private String flwProcessid; + + @ApiModelProperty("工作流任务id") + @TableField("flw_taskid") + private String flwTaskid; + + @ApiModelProperty("实际发送时间") + @TableField("send_time") + @Excel(name = "实际通知时间",sort = 9,dateFormat = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime sendTime; + + @ApiModelProperty("发送是否成功,1成功 0失败") + @TableField("send_status") + private String sendStatus; + + @ApiModelProperty("接收人手机号") + @TableField("recive_user_phone") + private String reciveUserPhone; + + @ApiModelProperty("计划发送时间(同天当前时间之前立即发送)") + @TableField("exp_send_time") + @Excel(name = "通知时间",sort = 8,dateFormat = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expSendTime; + + @ApiModelProperty("加入定时任务标记 默认0未加入 1已加入") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知对象ids数组") + @TableField(value = "notice_object_id",typeHandler = JsonListLongTypeHandler.class) + private List noticeObjectId; + + @ApiModelProperty("通知对象ids数组") + @BindDict() + private List noticeObjectIdStr; + + @ApiModelProperty("通知模板id") + @TableField("notice_model_id") + private Long noticeModelId; + + @ApiModelProperty("通知模板名称") + @Excel(name = "模板名称",sort = 6) + private String noticeModelName; + + @ApiModelProperty("通知模板id") + @BindDict() + private YwNoticeModelVO noticeModelIdStr; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + @Excel(name = "通知场景",dictType = "yw_notice_scene",sort = 3) + private String modelScene; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @BindDict(filedMapping = "modelScene", type = "yw_notice_scene") + private String modelSceneStr; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + @Excel(name = "对象属性",dictType = "yw_notice_object",sort = 4) + private String objectProto; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @BindDict(filedMapping = "objectProto", type = "yw_notice_object") + private String objectProtoStr; + +// @ApiModelProperty("通知对象(是指具体的通知接受者,呈现方式包括场馆+群组;分公司+群组名;地市+群组名;ITCC+群组名;场馆+个人名;分公司+个人名;地市+个人名;ITCC+个人名这几种组合。具体呈现内容和对象属性、通知方式相关联)") +// @TableField("notice_object") +//// @Excel(name = "通知对象",sort = 7) +// private String noticeObject; + + @ApiModelProperty("对象名称数组") + @Excel(name = "对象名称",sort = 5) + private String noticeObject; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") +// @Excel(name = "通知类型",dictType = "model_suit_type") + private String modelSuitType; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @BindDict(filedMapping = "modelSuitType", type = "model_suit_type") + private String modelSuitTypeStr; + + @ApiModelProperty("关联表id(yw_notice_handwork)") + @TableField("handwork_id") + private Long handworkId; + + @ApiModelProperty("发送人(由谁发送)") + @TableField("send_user") + private Long sendUser; + + @ApiModelProperty("是否可修改 0否 1是") + private String canUpdate; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/SysUserVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/SysUserVo.java new file mode 100644 index 0000000000000000000000000000000000000000..78bb8b49df35e48f81ac8cb9146ab468ed2e2f76 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/SysUserVo.java @@ -0,0 +1,203 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.Type; +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.entity.SysRole; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * 用户对象 sys_user + * + * @author ruoyi + */ +@TableName("sys_user") +@Data +public class SysUserVo { + + /** + * 用户ID + */ +// @Excel(name = "ID", sort = 1) + @TableId(value = "user_id") + private Long userId; + + /** + * 部门ID + */ + @TableField(value = "dept_id") + private Long deptId; + + /** + * 用户账号 + */ + @TableField(value = "user_name") + private String userName; + + /** + * 用户昵称 + */ + @Excel(name = "姓名", type = Type.EXPORT, sort = 2) + @TableField(value = "nick_name") + private String nickName; + + @Excel(name = "专业", type = Type.EXPORT, sort = 7) + @TableField(value = "user_type") + private String userType; + + @TableField(exist = false) + private String userTypeStr; + + /** + * 用户邮箱 + */ + private String email; + + /** + * 手机号码 + */ + @Excel(name = "手机号码", type = Type.EXPORT, sort = 3) + @TableField(value = "phonenumber") + private String phonenumber; + + /** + * 用户性别 + */ + private String sex; + + /** + * 用户头像 + */ +// @Excel(name = "头像", sort = 4, type = Type.EXPORT) + private String avatar; + + /** + * 密码 + */ + private String password; + + /** + * 账号状态(0正常 1锁定 2冻结) + */ + @Excel(name = "账号状态", type = Type.EXPORT, sort = 5) + private String status; + + /** + * 删除标志(0代表存在 2代表删除) + */ + @TableField(value = "del_flag") + private String delFlag; + + /** + * 最后登录IP + */ +// @Excel(name = "最后登录IP", sort = 7) + @TableField(value = "login_ip") + private String loginIp; + + @TableField(value = "first_page") + private String firstPage; + + @Excel(name = "地市", type = Type.EXPORT, sort = 8) + private String city; + + + @Excel(name = "区县", type = Type.EXPORT, sort = 9) + private String county; + + @Excel(name = "场馆分区", type = Type.EXPORT, sort = 11) + private String distinctArea; + + @Excel(name = "是否要签到", type = Type.EXPORT, sort = 12) + private String needSign; + + /** + * 最后登录时间 + */ +// @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT, sort = 8) + @TableField(value = "login_date") + private Date loginDate; + + /** + * 部门对象 + */ + private SysDept dept; + + /** + * 角色对象 + */ + private List roles; + + /** + * 角色组 + */ + private Long[] roleIds; + + /** + * 岗位组 + */ + private Long[] postIds; + + /** + * 角色ID + */ + private Long roleId; + + private String belongArea; + + private String[] venueIds; + + private String[] venueNames; + + @Excel(name = "角色", sort = 6, type = Type.EXPORT) + private String strRoles; + + @Excel(name = "场馆", sort = 10, type = Type.EXPORT) + private String strVenueNames; + + private String strVenueIds; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date createTime; + + + private String strBelongArea; + + private String[] roleNames; + + public SysUserVo() { + + } + + public SysUserVo(Long userId) { + this.userId = userId; + } + + public boolean isAdmin() { + return isAdmin(this.userId); + } + + public static boolean isAdmin(Long userId) { + return userId != null && 1L == userId; + } + + public boolean isAdmin(SysUserVo user) { + Boolean isAdmin = false; + for (SysRole sysRole : user.getRoles()) { +// if("admin".equals(sysRole.getRoleKey())||"monitor".equals(sysRole.getRoleKey())) + if (sysRole.getRoleKey().contains("admin") || sysRole.getRoleKey().contains("monitor")) { + isAdmin = true; + break; + } + } + return isAdmin; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/TaskMangeListVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/TaskMangeListVo.java new file mode 100644 index 0000000000000000000000000000000000000000..bb0aa576273567d9aa9094469557ace3b7271eb2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/TaskMangeListVo.java @@ -0,0 +1,13 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +@Data +public class TaskMangeListVo { + private Long stadium_id; + private String stadium_name; + private Integer xunjian_finish_count; + private Integer xunjian_total_count; + private Integer buxian_finish_count; + private Integer buxian_total_count; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/WholeAreaAssureCellSheet.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/WholeAreaAssureCellSheet.java new file mode 100644 index 0000000000000000000000000000000000000000..2aeacb4638fe4177ca796cafd8e76fcbbd603c77 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/WholeAreaAssureCellSheet.java @@ -0,0 +1,35 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class WholeAreaAssureCellSheet { + private String cityCode; + @TableField(exist = false) + private String cityName; + private String countrysideCode; + @TableField(exist = false) + private String countrysideName; + private String rat; + private String cellName; + private String cgi; + private String lac; + private String ci; + private String baseStation; + private String siteId; + private String longitude; + private String latitude; + private String sceneTypeCode; + private String sceneTypeName; + private String sceneSubTypeCode; + private String sceneSubTypeName; + private String sceneCode; + private String sceneName; + private String coverSubSceneCode; + private String coverSubSceneName; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmAGISVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmAGISVo.java new file mode 100644 index 0000000000000000000000000000000000000000..017dc574b1549a9788a0a75cb532a05440bf21cd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmAGISVo.java @@ -0,0 +1,45 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + + +@Data +public class YwAlarmAGISVo { + + + private Integer venueId; + @Excel(name = "场馆" ,sort = 1) + private String cg; + private String gd; + + //带下划线开始的时候设计,前端已经在使用 + private String venue_id; + private String site_id; + @Excel(name = "网元名称" ,sort = 2) + private String site_name; + @Excel(name = "端口" ,sort = 3) + private String net_name; + + private Long alarmId; + private String alarmName; + private String siteId; + private String siteName; + private String netName; + @Excel(name = "告警名称" ,sort = 5) + private String name; + @Excel(name = "生成时间" ,sort = 5) + private String start; + @Excel(name = "恢复时间" ,sort = 6) + private String end; + @Excel(name = "红线内" ,sort = 4, readConverterExp = "Y=内,N=外") + private String inRedLine; + private String groupId; + private String alarmType; + private String alarmCode; + private String alarmLevel; + private String alarmLoc; + @Excel(name = "历时" ,sort = 7) + private String duration; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmAppVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmAppVo.java new file mode 100644 index 0000000000000000000000000000000000000000..9e3469b9f7a87dc464ec4a981014b22c51990dd4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmAppVo.java @@ -0,0 +1,12 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + +@Data +public class YwAlarmAppVo { + + private String specialty; + private List ywAlarmLastVoList; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmCSVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmCSVo.java new file mode 100644 index 0000000000000000000000000000000000000000..4670388c8e5456e0a9645f23fbddd3c31dcda70e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmCSVo.java @@ -0,0 +1,45 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + + +@Data +public class YwAlarmCSVo { + + + private Integer venueId; + @Excel(name = "场馆" ,sort = 1) + private String cg; + private String gd; + + //带下划线开始的时候设计,前端已经在使用 + private String venue_id; + private String site_id; + @Excel(name = "设备名称" ,sort = 2) + private String site_name; + @Excel(name = "端口号" ,sort = 3) + private String net_name; + + private Long alarmId; + private String alarmName; + private String siteId; + private String siteName; + private String netName; + @Excel(name = "告警名称" ,sort = 5) + private String name; + @Excel(name = "生成时间" ,sort = 5) + private String start; + @Excel(name = "恢复时间" ,sort = 6) + private String end; + @Excel(name = "红线内" ,sort = 4, readConverterExp = "Y=内,N=外") + private String inRedLine; + private String groupId; + private String alarmType; + private String alarmCode; + private String alarmLevel; + private String alarmLoc; + @Excel(name = "历时" ,sort = 7) + private String duration; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmClassificationDetail.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmClassificationDetail.java new file mode 100644 index 0000000000000000000000000000000000000000..2edda9e0ded8c32c8594cb88f0bec98e8519c7c1 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmClassificationDetail.java @@ -0,0 +1,13 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + +@Data +public class YwAlarmClassificationDetail { + private String alarmName; + private List alarmList; + + private Integer alarmNum; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmDHVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmDHVo.java new file mode 100644 index 0000000000000000000000000000000000000000..c53633bb71f440563363b266c0d0da76f180c0a9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmDHVo.java @@ -0,0 +1,45 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + + +@Data +public class YwAlarmDHVo { + + + private Integer venueId; + @Excel(name = "场馆" ,sort = 1) + private String cg; + private String gd; + + //带下划线开始的时候设计,前端已经在使用 + private String venue_id; + private String site_id; + @Excel(name = "基站名称" ,sort = 2) + private String site_name; + @Excel(name = "设备名称" ,sort = 3) + private String net_name; + + private Long alarmId; + private String alarmName; + private String siteId; + private String siteName; + private String netName; + @Excel(name = "告警名称" ,sort = 5) + private String name; + @Excel(name = "生成时间" ,sort = 5) + private String start; + @Excel(name = "恢复时间" ,sort = 6) + private String end; + @Excel(name = "红线内" ,sort = 4, readConverterExp = "Y=内,N=外") + private String inRedLine; + private String groupId; + private String alarmType; + private String alarmCode; + private String alarmLevel; + private String alarmLoc; + @Excel(name = "历时" ,sort = 7) + private String duration; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmInfoVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmInfoVo.java new file mode 100644 index 0000000000000000000000000000000000000000..d839c9ea5aabcffd10820a18319f103226e10fc4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmInfoVo.java @@ -0,0 +1,40 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class YwAlarmInfoVo { + + private String groupId; + private String primaryId; + private String processId; + private String taskId; + private String dealStatus; + private String beginTime; + private String alarmContent; + private String lastClearTime; + private String lastBeginTime; + private String hangupReason; + private String hangupTime; + private String siteId; + private String alarmLevel; + private String alarmType; + private String alarmTypeCode; + private String alarmLoc; + + private String venue_id; + private String cg; + private String gd; + private String site_name; + private String net_name; + private String name; + private String start; + private String end; + private List alarmchildren; + + private String siteType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmLastVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmLastVo.java new file mode 100644 index 0000000000000000000000000000000000000000..cf1fcf35d98ccb0826bd8b688308c709dec2e569 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmLastVo.java @@ -0,0 +1,31 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + + +@Data +public class YwAlarmLastVo extends YwAlarmVo { + + private String key; + private String state; + private String person; + private String userId; + private String processId; + private String taskId; + private String alarmStatus; + //是否当前登录用户待办 0否 1是 + private int isTodo; + private String dealStatus; + private String belongArea; + private String lastClearTime; + private List alarmchildren; + private Long opId; + private String isHangup; + private Integer clearNum; + private String clearNumDisplay; + + private String beginTime; + private String endTime; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmNewNumVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmNewNumVo.java new file mode 100644 index 0000000000000000000000000000000000000000..b1aa21bf5f2e185e4256b7220ee3972a729a6690 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmNewNumVo.java @@ -0,0 +1,18 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + +@Data +public class YwAlarmNewNumVo { + + private String alarmType; + + private Long Num; + + private Long redInNum; + + private Long redOutNum; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmNoticeVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmNoticeVo.java new file mode 100644 index 0000000000000000000000000000000000000000..390ee940b05e31e2467b09a3fa9a222d563e9ca7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmNoticeVo.java @@ -0,0 +1,13 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + +@Data +public class YwAlarmNoticeVo { + + private String groupId; + private String processId; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmQuestionVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmQuestionVo.java new file mode 100644 index 0000000000000000000000000000000000000000..58da23689aba3c836607cfedb1a578b436a3a073 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmQuestionVo.java @@ -0,0 +1,23 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author huamile + */ +@Data +public class YwAlarmQuestionVo { + + + private Long value; + + private String label; + + private String specialty; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmStatistics.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmStatistics.java new file mode 100644 index 0000000000000000000000000000000000000000..4c92c36d4fea8b04edd3125d8291c8cf4ba2484f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmStatistics.java @@ -0,0 +1,31 @@ +package com.ruoyi.eastcom_yw.domain.vo; + + +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; + +import java.util.Date; + +/** + * (YwAlarmStatistics)表实体类 + * + * @author lee + * @since 2023-04-24 20:22:13 + */ +@Data +public class YwAlarmStatistics extends Model { + // 时间 + private String time; + //专业 + private String profession; + //统计时间 + private Date createTime; + //id + private Long id; + //场馆id + private Long sceneId; + //告警数 + private Long num; + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmViewVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmViewVo.java new file mode 100644 index 0000000000000000000000000000000000000000..ca2d3f98ef499c346edff8dde6d366efe57c1698 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmViewVo.java @@ -0,0 +1,57 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.alibaba.fastjson2.JSONWriter; +import com.alibaba.fastjson2.annotation.JSONField; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class YwAlarmViewVo extends YwAlarmVo { + + private String key; + @Excel(name = "处理状态" ,sort = 14, readConverterExp = "1=未完成,2=挂起,4=已完成,5=人工闭环") + private String state; + @Excel(name = "反馈人" ,sort = 13) + private String person; + private String userId; + + private String processId; + private String taskId; + private String alarmStatus; + //是否当前登录用户待办 0否 1是 + private int isTodo; + private String dealStatus; + private String belongArea; + private String lastClearTime; + @JSONField(serializeFeatures = JSONWriter.Feature.WriteMapNullValue) + private List alarmchildren; + private Long opId; + private String isHangup; + //挂起的时长 + private Integer hangupTimespan; + private Integer clearNum; + @Excel(name = "故障数" ,sort = 12) + private String clearNumDisplay; + + private String noticeInfo; + + @Excel(name = "基站名称" ,sort = 3) + private String siteNameExport; + + @Excel(name = "告警网元" ,sort = 4) + private String netNameExport; + + private String record; + + @Excel(name = "网络类型" ,sort = 8) + private String siteType; + + private String alarmKey; + + @Excel(name = "阶段处理记录" ,sort = 15) + private String recordExport; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmVo.java new file mode 100644 index 0000000000000000000000000000000000000000..cea14f334d031a9ca25af666b20e49f4a6f682c4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmVo.java @@ -0,0 +1,58 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.alibaba.fastjson2.JSONWriter; +import com.alibaba.fastjson2.annotation.JSONField; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + + +@Data +public class YwAlarmVo { + + @Excel(name = "序号" ,sort = 1) + private Integer id; + + private Integer venueId; + @Excel(name = "场馆" ,sort = 2) + private String cg; + private String gd; + + //带下划线开始的时候设计,前端已经在使用 + private String venue_id; + private String site_id; + @Excel(name = "基站名称" ,sort = 3) + public String site_name; + @Excel(name = "告警网元" ,sort = 4) + public String net_name; + + private Long alarmId; + + private String alarmName; + + private String siteId; + + private String siteName; + + private String netName; + @Excel(name = "告警名称" ,sort = 6) + private String name; + @Excel(name = "生成时间" ,sort = 9) + private String start; + @Excel(name = "恢复时间" ,sort = 10) + private String end; + @Excel(name = "红线内" ,sort = 5, readConverterExp = "Y=内,N=外") + private String inRedLine; + private String groupId; + private String alarmType; + + private String alarmCode; + @Excel(name = "告警级别" ,sort = 7) + private String alarmLevel; + private String alarmLoc; + + @Excel(name = "历时" ,sort = 11) + private String duration; + + private String siteType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmWXVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmWXVo.java new file mode 100644 index 0000000000000000000000000000000000000000..8a69145e8deb300b42b41c8144721b805ceab9a6 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwAlarmWXVo.java @@ -0,0 +1,45 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + + +@Data +public class YwAlarmWXVo { + + + private Integer venueId; + @Excel(name = "场馆" ,sort = 1) + private String cg; + private String gd; + + //带下划线开始的时候设计,前端已经在使用 + private String venue_id; + private String site_id; + @Excel(name = "基站名称" ,sort = 2) + private String site_name; + @Excel(name = "告警网元" ,sort = 3) + private String net_name; + + private Long alarmId; + private String alarmName; + private String siteId; + private String siteName; + private String netName; + @Excel(name = "告警名称" ,sort = 5) + private String name; + @Excel(name = "生成时间" ,sort = 5) + private String start; + @Excel(name = "恢复时间" ,sort = 6) + private String end; + @Excel(name = "红线内" ,sort = 4, readConverterExp = "Y=内,N=外") + private String inRedLine; + private String groupId; + private String alarmType; + private String alarmCode; + private String alarmLevel; + private String alarmLoc; + @Excel(name = "历时" ,sort = 7) + private String duration; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwConstrucTeamVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwConstrucTeamVo.java new file mode 100644 index 0000000000000000000000000000000000000000..f0070220d49acf0e4ae4ff4570621da9d58c42d2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwConstrucTeamVo.java @@ -0,0 +1,14 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class YwConstrucTeamVo { + + //施工队名称 + private String venderName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwDrsConfigVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwDrsConfigVO.java new file mode 100644 index 0000000000000000000000000000000000000000..237ee88f53fbf1bdc7d117f55b2869d3b5758fd5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwDrsConfigVO.java @@ -0,0 +1,76 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +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.ruoyi.common.annotation.BindDict; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + *

+ * DRS配置表VO + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwDrsConfigVO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("任务名称") + @TableField("task_name") + private String taskName; + + @ApiModelProperty("任务类型 drs_task_type 1 签到 2巡检") + @TableField("drs_task_type") + private String drsTaskType; + + @ApiModelProperty("DRS任务类型 drs_task_type 1 签到 2巡检") + @TableField("drs_task_type") + @BindDict(filedMapping = "drsTaskType",type = "drs_task_type") + private String drsTaskTypeStr; + + @ApiModelProperty("状态") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField(value = "update_by", fill = FieldFill.UPDATE) + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField(value = "update_time", fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("删除标记") + @TableField("del_flag") + private String delFlag; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwDrsTempTaskVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwDrsTempTaskVO.java new file mode 100644 index 0000000000000000000000000000000000000000..96fd1d83b8c06a968c8c3d81dc20242f7c7407cf --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwDrsTempTaskVO.java @@ -0,0 +1,129 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +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.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.utils.poi.LocalDateExcelHandlerAdapter; +import com.ruoyi.common.utils.poi.LocalDateTimeExcelHandlerAdapter; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + *

+ * DRS临时任务表VO + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwDrsTempTaskVO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("configId") + private Long configId; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("场馆名称") + @Excel(name = "场馆名称", width = 25, sort = 1) + private String venueName; + + @ApiModelProperty("任务日期") + @TableField("task_date") + @Excel(name = "任务日期", dateFormat = "yyyy-MM-dd", width = 32, sort = 2, handler = LocalDateExcelHandlerAdapter.class) + private LocalDate taskDate; + + @ApiModelProperty("任务时间") + @TableField("task_time") + @Excel(name = "开始时间", dateFormat = "HH:mm:ss", width = 32, sort = 2, handler = LocalDateTimeExcelHandlerAdapter.class) + private LocalDateTime taskTime; + + @ApiModelProperty("任务结束时间") + @TableField("task_end_time") + @Excel(name = "结束时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 32, sort = 3, handler = LocalDateTimeExcelHandlerAdapter.class) + private LocalDateTime taskEndTime; + + @ApiModelProperty("任务名称") + @TableField("task_name") + @Excel(name = "任务名称", width = 25, sort = 3) + private String taskName; + + @ApiModelProperty("DRS任务类型 drs_task_type 0 / 1 签到 2巡检") + @TableField("drs_task_type") + private String drsTaskType; + + @ApiModelProperty("DRS任务类型 drs_task_type 0 / 1 签到 2巡检") + @TableField("drs_task_type") + @BindDict(filedMapping = "drsTaskType", type = "drs_task_type") + private String drsTaskTypeStr; + + @ApiModelProperty("DRS任务状态 drs_task_status 0未开始 1进行中 2已完成") + @TableField("drs_task_status") + @Excel(name = "任务状态", dictType = "drs_task_status", combo = {"未开始", "进行中", "已完成"}, width = 25, sort = 4) + private String drsTaskStatus; + + @ApiModelProperty("DRS任务状态 drs_task_status 0未开始 1进行中 2已完成") + @TableField("drs_task_status") + @BindDict(filedMapping = "drsTaskStatus", type = "drs_task_status") + private String drsTaskStatusStr; + + @ApiModelProperty("自动状态变更 drs_auto_update 0自动 1手动") + @TableField("drs_auto_update") + @Excel(name = "派发方式", dictType = "drs_auto_update", combo = {"自动", "手动"}, width = 25, sort = 4) + private String drsAutoUpdate; + + @ApiModelProperty("状态") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField(value = "create_by", fill = FieldFill.INSERT) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private LocalDateTime createTime; + + @ApiModelProperty("修改人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("修改时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("删除标记") + @TableField("del_flag") + private String delFlag; + + /** + * 失败原因 + */ + @Excel(name = "失败原因", type = Excel.Type.EXPORT, width = 40, sort = 15) + @TableField(exist = false) + private String reason; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwErrorAlarmVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwErrorAlarmVO.java new file mode 100644 index 0000000000000000000000000000000000000000..7b77c9c335d6638116e1bd7e96c990793512bcf9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwErrorAlarmVO.java @@ -0,0 +1,18 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +@Data +public class YwErrorAlarmVO { + + //告警id + private Long id; + + private String 场馆名称; + + private String 类型; + + private String 名称; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwInspectLogVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwInspectLogVo.java new file mode 100644 index 0000000000000000000000000000000000000000..313cc5ac0143d8da2da4d5196fc5da4ee5d6144a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwInspectLogVo.java @@ -0,0 +1,102 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * @author huamile + */ +@Data +public class YwInspectLogVo { + + private Long routInspectId; + + private Long sceneId; + + @Excel(name = "场馆",width = 20) + private String venueName; + + @Excel(name = "巡检日期",width = 20) + private String inspectDate; + + private String inspectSpecialty; + + @Excel(name = "巡检专业",width = 20) + private String specialtyName; + + @Excel(name = "开始时间",width = 20,exportFormat = "yyyy-MM-dd HH:mm:ss") + private Date beginTime; + + @Excel(name = "计划完成时间",width = 20,exportFormat = "yyyy-MM-dd HH:mm:ss") + private Date planFinTime; + + @Excel(name = "巡检类型",width = 20,replace = {"临时_0,计划_1"}) + private Integer type; + + @Excel(name = "任务名称",width = 20) + private String inspectName; + + @Excel(name = "巡检项数",width = 20) + private Integer checkNum; + + @Excel(name = "巡检类别",width = 20) + private String checkType; + + @Excel(name = "说明",width = 20) + private String checkDesc; + + @Excel(name = "周期次数",width = 20) + private Integer circle; + + @Excel(name = "截止时效",width = 20) + private Long stopTimeOption; + + @Excel(name = "间隔时间",width = 20) + private Long intervalTime; + + private Integer inspectUserId; + + private String jobNo; + + @Excel(name = "巡检人员",width = 20) + private String nickName; + + @Excel(name = "提醒时间",width = 20) + private String repWarnInterval; + + private String noticeType; + + @Excel(name = "通知方式",width = 20) + private String noticeName; + + private String areaCountyId; + + @Excel(name = "市",width = 20) + private String city; + + @Excel(name = "区县",width = 20) + private String county; + + private String flwProcessid; + + @Excel(name = "问题项数",width = 20) + private Integer questionNum; + + @Excel(name = "问题描述",width = 20) + private String questionDesc; + + private Integer feedBackUser; + + @Excel(name = "反馈人",width = 20) + private String feedBackUserName; + + @Excel(name = "反馈时间",width = 20) + private Date feedBackTime; + + private String description; + + private String dealStatus; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwInspectPlanStaticVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwInspectPlanStaticVo.java new file mode 100644 index 0000000000000000000000000000000000000000..938181d72d7c4be6e13da408d1fbc5d66394d0f0 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwInspectPlanStaticVo.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + * @author yqf + * @date 2023/6/27 + */ +@Data +public class YwInspectPlanStaticVo { + + private Long sceneId; + + @Excel(name = "场馆名称", sort = 1) + private String venueName; + + @Excel(name = "应完成", sort = 2) + private Integer allNum; + + @Excel(name = "已完成", sort = 3) + private Integer completedNum; + + @Excel(name = "完成率", sort = 4) + private String rate; + + private double finishRate; + + private String fileUrl; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwInspectPlanVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwInspectPlanVo.java new file mode 100644 index 0000000000000000000000000000000000000000..9c021985a0021858935d42875c88c8c96f44210c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwInspectPlanVo.java @@ -0,0 +1,28 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwInspectPlanVo extends YwInspectLogVo { + + @Excel(name = "任务号",width = 20) + private String taskNo; + + private String taskId; + + private String typeName; + + @Excel(name = "是否超时",width = 20) + private String timeoutOrNot; + + @Excel(name = "任务状态",width = 20) + private String taskStatus; + + //是否当前登录用户待办 0否 1是 + private int isTodo; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwKpiConfigVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwKpiConfigVO.java new file mode 100644 index 0000000000000000000000000000000000000000..63c6ecd52e5552047dc1d33e204231a87af8f328 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwKpiConfigVO.java @@ -0,0 +1,84 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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 java.io.Serializable; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 指标字段阈值配置表VO + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwKpiConfigVO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("序号") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("专业(字典表)") + @TableField("subject") + private String subject; + + @ApiModelProperty("网络模式(字典表)") + @TableField("net_type") + private String netType; + + @ApiModelProperty("指标字段") + @TableField("kpi_field") + private Long kpiField; + + @ApiModelProperty("阈值范围") + @TableField("threshold_value") + private String thresholdValue; + + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("最小是(包括本值)") + @TableField("min_value") + private Object minValue; + + @ApiModelProperty("最大值(不包括本值)") + @TableField("max_value") + private Object maxValue; + + @ApiModelProperty("指标名") + @TableField("kpi_field_name") + private String kpiFieldName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeBriefingPlanVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeBriefingPlanVO.java new file mode 100644 index 0000000000000000000000000000000000000000..97c9117f3412b560fde99a7152ac35610cd0a867 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeBriefingPlanVO.java @@ -0,0 +1,135 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.mybatis.JsonListLongTypeHandler; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "v_yw_notice_briefing_plan",autoResultMap = true) +public class YwNoticeBriefingPlanVO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + @Excel(name = "地市") + private String city; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("场馆名") + @Excel(name = "场馆名") + private String venueName; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + @Excel(name = "对象属性") + private String objectProto; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @BindDict(filedMapping = "objectProto", type = "yw_notice_object") + private String objectProtoStr; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + @Excel(name = "通知方式") + private String noticeType; + + @ApiModelProperty("通知方式sys_notice_type") + @BindDict(filedMapping = "noticeType", type = "sys_notice_type") + private String noticeTypeStr; + + @ApiModelProperty("发送日期") + @TableField("send_date") + @Excel(name = "发送日期") + private LocalDate sendDate; + + @ApiModelProperty("开始时间") + @TableField("begin_time") + @Excel(name = "开始时间") + private LocalDateTime beginTime; + + @ApiModelProperty("结束时间") + @TableField("end_time") + @Excel(name = "结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("区县") + @TableField("county") + @Excel(name = "区县") + private String county; + + @ApiModelProperty("对象ids数组") + @TableField(value = "object_ids") + private List objectIds; + + @ApiModelProperty("对象ids数组") + private String objectIdsStr; + + @ApiModelProperty("通知对象ids数组") + @BindDict() + private List noticeObjectIdStr; + + @ApiModelProperty("模板id") + @TableField("model_id") + private Long modelId; + + @ApiModelProperty("通知模板id") + @BindDict() + private YwNoticeModelVO noticeModelIdStr; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("时间间隔(单位分)") + @TableField("time_interval") + private Integer timeInterval; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + @Excel(name = "通知名称") + private String noticeName; + + @ApiModelProperty("启用状态 sys_normal_disable 0启用 1停用") + @TableField("sys_normal_disable") + @Excel(name = "启用状态") + private String sysNormalDisable; + + @ApiModelProperty("启用状态 sys_normal_disable 0启用 1停用") + @BindDict(filedMapping = "sysNormalDisable", type = "sys_normal_disable") + private String sysNormalDisableStr; + + @ApiModelProperty("发送时间") + private LocalDateTime sendTime; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3文字简报 4h5简报)") + @TableField("model_suit_type") + private String modelSuitType; + + @ApiModelProperty("发送方式 send_type (1自动发送 2手工发送)") + @TableField("send_type") + private String sendType; + + @ApiModelProperty("发送人员") + @TableField("send_user") + private Long sendUser; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeBriefingVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeBriefingVO.java new file mode 100644 index 0000000000000000000000000000000000000000..a2c37e69e350decc97a53654ea13b3b457cf3aca --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeBriefingVO.java @@ -0,0 +1,183 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.utils.poi.LocalDateExcelHandlerAdapter; +import com.ruoyi.common.utils.poi.LocalDateTimeExcelHandlerAdapter; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告简报计划表VO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeBriefingVO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + @Excel(name = "序号",type = Excel.Type.EXPORT,sort = 1) + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + @Excel(name = "地市", dictType = "yw_city",sort = 4) + private String city; + + @ApiModelProperty("地市") + @BindDict(filedMapping = "city", type = "yw_city") + private String cityStr; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("场馆名") + @Excel(name = "场馆名称",sort = 6) + private String venueName; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + @Excel(name = "对象属性", dictType = "yw_notice_object",sort = 3,combo={"场馆层","分公司层","亚运指挥层","ITCC层"}) + private String objectProto; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @BindDict(filedMapping = "objectProto", type = "yw_notice_object") + private String objectProtoStr; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + private List noticeType; + + @ApiModelProperty("通知方式sys_notice_type") + @Excel(name = "通知方式",sort = 14) + @BindDict(filedMapping = "noticeType", type = "sys_notice_type") + private String noticeTypeStr; + + //自定义handler没用 + @ApiModelProperty("发送日期") + @TableField("send_date") + @Excel(name = "发送日期",sort = 10,dateFormat = "yyyy-MM-dd",handler= LocalDateExcelHandlerAdapter.class) + private LocalDate sendDate; + + @ApiModelProperty("开始时间") + @TableField("begin_time") + @Excel(name = "开始时间",sort = 11,dateFormat = "yyyy-MM-dd HH:mm:ss",handler= LocalDateTimeExcelHandlerAdapter.class) + private LocalDateTime beginTime; + + @ApiModelProperty("结束时间") + @TableField("end_time") + @Excel(name = "结束时间",sort = 12,dateFormat = "yyyy-MM-dd HH:mm:ss",handler= LocalDateTimeExcelHandlerAdapter.class) + private LocalDateTime endTime; + + @ApiModelProperty("区县") + @TableField("county") + @Excel(name = "区县", dictType = "yw_county",sort = 5) + private String county; + + @ApiModelProperty("区县") + @BindDict(filedMapping = "county", type = "yw_county") + private String countyStr; + + @ApiModelProperty("对象ids数组") + @TableField("object_ids") + private List objectIds; + + @ApiModelProperty("对象名称数组") + private String objectNameStr; + + @ApiModelProperty("通知对象ids数组") + @BindDict() + private List noticeObjectIdStr; + + @ApiModelProperty("模板id") + @TableField("model_id") + private Long modelId; + + @ApiModelProperty("模板名") + @Excel(name = "通知模板",sort = 8) + private String modelName; + + @ApiModelProperty("通知模板id") + @BindDict() + private YwNoticeModelVO noticeModelIdStr; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("时间间隔(单位分)") + @TableField("time_interval") + @Excel(name = "通报间隔",sort = 9,combo = {"15","60","120"}) + private Integer timeInterval; + + @ApiModelProperty("对象名称") + @Excel(name = "通知对象",sort = 7) + private String objectName; + + @ApiModelProperty("通知名称") + @TableField("notice_name") +// @Excel(name = "通知名称",sort = 5) + private String noticeName; + + @ApiModelProperty("启用状态 sys_normal_disable 0启用 1停用") + @TableField("sys_normal_disable") + @Excel(name = "启用状态", dictType = "sys_normal_disable",sort = 10,combo = {"启用","停用"}) + private String sysNormalDisable; + + @ApiModelProperty("启用状态 sys_normal_disable 0启用 1停用") + @BindDict(filedMapping = "sysNormalDisable", type = "sys_normal_disable") + private String sysNormalDisableStr; + + /** + * 失败原因 + */ + @Excel(name = "失败原因",type = Excel.Type.EXPORT,sort = 15) + @TableField(exist = false) + private String reason; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3文字型简报 4H5型简报)") + @TableField("model_suit_type") + @Excel(name = "简报类型", dictType = "model_suit_type",sort = 2,combo = {"文字型简报","H5型简报"}) + private String modelSuitType; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3文字简报 4h5简报)") + @BindDict(filedMapping = "modelSuitType", type = "model_suit_type") + private String modelSuitTypeStr; + + @ApiModelProperty("发送方式 send_type (1自动发送 2手工发送)") + @TableField("send_type") + @Excel(name = "发送方式", dictType = "send_type",sort = 13,combo = {"自动发送","手工发送"}) + private String sendType; + + @ApiModelProperty("发送方式 send_type (1自动发送 2手工发送)") + @BindDict(filedMapping = "sendType", type = "send_type") + private String sendTypeStr; + + @ApiModelProperty("发送人员") + @TableField("send_user") + private Long sendUser; + + @ApiModelProperty("发送人员") + @Excel(name = "发送人员",sort = 10) + private String sendUserStr; + + @ApiModelProperty("发送人员") + @Excel(name = "发送人员手机号",sort = 10) + private String sendUserPhoneStr; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeHandworkVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeHandworkVO.java new file mode 100644 index 0000000000000000000000000000000000000000..f2964344123093db5cd0fae25c9a279f0263453d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeHandworkVO.java @@ -0,0 +1,134 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告手工通知计划表VO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeHandworkVO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + @Excel(name = "通知名称",sort = 1) + private String noticeName; + + @ApiModelProperty("通知模板id") + @TableField("notice_model") + private Long noticeModel; + + @ApiModelProperty("通知模板id") + @Excel(name = "通知模板",sort = 3) + private String noticeModelName; + + @ApiModelProperty("通知模板id") + @BindDict() + private YwNoticeModelVO noticeModelIdStr; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") +// @Excel(name = "通知场景",dictType = "yw_notice_scene",sort = 3) + private String modelScene; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @BindDict(filedMapping = "modelScene", type = "yw_notice_scene") + private String modelSceneStr; + + @ApiModelProperty("通知方式--sys_notice_type") + @TableField("notice_type") + private List noticeType; + + @ApiModelProperty("通知方式--sys_notice_type") + @Excel(name = "通知方式") + @BindDict(filedMapping = "noticeType", type = "sys_notice_type") + private String noticeTypeStr; + + @ApiModelProperty("通知对象ids") + @TableField("notice_object") + private List noticeObject; + + @ApiModelProperty("对象名称数组") + @Excel(name = "通知对象",sort = 4) + private String objectNameStr; + + @ApiModelProperty("通知对象ids数组") + @BindDict() + private List noticeObjectIdStr; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + @Excel(name = "通知内容",sort = 5) + private String noticeContent; + + @ApiModelProperty("通知状态yw_veriy_status 0待提交 1待审核 2已审核") + @TableField("notice_status") + @Excel(name = "通知状态",dictType = "yw_veriy_status",sort = 6) + private String noticeStatus; + + @ApiModelProperty("通知状态yw_veriy_status 0待提交 1待审核 2已审核") + @BindDict(filedMapping = "noticeStatus", type = "yw_veriy_status") + private String noticeStatusStr; + + @ApiModelProperty("日期") + @TableField("notice_date") + @Excel(name = "日期",dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 7) + private LocalDateTime noticeDate; + + @ApiModelProperty("开始时间") + @TableField("begin_time") + private LocalDateTime beginTime; + + @ApiModelProperty("结束时间") + @TableField("end_time") + private LocalDateTime endTime; + + @ApiModelProperty("时间间隔(单位分)") + @TableField("time_interval") + private Integer timeInterval; + + @ApiModelProperty("工作流processid") + @TableField("flw_processid") + private String flwProcessid; + + @ApiModelProperty("申请人id") + @TableField("apply_id") + private Long applyId; + + @ApiModelProperty("审核人id") + @TableField("audit_id") + private Long auditId; + + @ApiModelProperty("任务id") + private String taskId; + + @ApiModelProperty("已添加到sys_notice标记(0否 1是)") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知对象名称数组") + @TableField("notice_object_name_str") + private String noticeObjectNameStr; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeHandworkdetailVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeHandworkdetailVO.java new file mode 100644 index 0000000000000000000000000000000000000000..b04eda48cf8794b82eea91d25337be6a0a1c4969 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeHandworkdetailVO.java @@ -0,0 +1,61 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.BindDict; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *

+ * 通知通告手工通知审核表VO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeHandworkdetailVO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("手工通知id") + @TableField("handwork_id") + private Long handworkId; + + @ApiModelProperty("操作人(提交审核的人 或者 审核的人)") + @TableField("oprate_user") + private Long oprateUser; + + @ApiModelProperty("审核结果(关联字典表yw_veriy_result 0通过 1驳回)") + @TableField("veriy_result") + private String veriyResult; + + @ApiModelProperty("审核结果(关联字典表yw_veriy_result 0通过 1驳回)") + @BindDict(filedMapping = "veriyResult", type = "yw_veriy_result") + private String veriyResultStr; + + @ApiModelProperty("审核状态(关联字典表yw_veriy_status 0 待审核 1 已审核)") + @TableField("veriy_status") + private String veriyStatus; + + @ApiModelProperty("审核状态(关联字典表yw_veriy_status 0 待审核 1 已审核)") + @BindDict(filedMapping = "veriyStatus", type = "yw_veriy_status") + private String veriyStatusStr; + + @ApiModelProperty("驳回原因") + @TableField("fail_reason") + private String failReason; + + @ApiModelProperty("附件") + @TableField("appendix") + private String appendix; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeListVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeListVO.java new file mode 100644 index 0000000000000000000000000000000000000000..6ebc8e2662657af583deb418376b61a7aad4bbf4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeListVO.java @@ -0,0 +1,136 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告记录表VO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeListVO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + private Long id; + + @ApiModelProperty("通知名称") + @TableField("notice_name") + @Excel(name = "通知名称") + private String noticeName; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + @Excel(name = "通知场景") + private String modelScene; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @BindDict(filedMapping = "modelScene", type = "yw_notice_scene") + private String modelSceneStr; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + @Excel(name = "对象属性") + private String objectProto; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @BindDict(filedMapping = "objectProto", type = "yw_notice_object") + private String objectProtoStr; + + @ApiModelProperty("通知方式--sys_notice_type") + @TableField("notice_type") + @Excel(name = "通知方式") + private String noticeType; + + @ApiModelProperty("通知方式--sys_notice_type") + @BindDict(filedMapping = "noticeType", type = "sys_notice_type") + private String noticeTypeStr; + + @ApiModelProperty("通知时间(计划发送时间(同天当前时间之前立即发送))") + @TableField("notice_time") + @Excel(name = "通知时间") + private LocalDateTime noticeTime; + + @ApiModelProperty("通知对象") + @TableField("notice_object") + @Excel(name = "通知对象") + private String noticeObject; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + @Excel(name = "通知内容") + private String noticeContent; + + @ApiModelProperty("状态 0未读 1已读") + @TableField("status") + private String status; + + @ApiModelProperty("通知对象ids数组") + @TableField("notice_object_id") + private List noticeObjectId; + + @ApiModelProperty("通知对象ids数组") + @BindDict() + private List noticeObjectIdStr; + + @ApiModelProperty("通知模板id") + @TableField("notice_model_id") + private Long noticeModelId; + + @ApiModelProperty("通知模板id") + @BindDict() + private YwNoticeModelVO noticeModelIdStr; + + @ApiModelProperty("实际发送时间") + @TableField("send_time") + private LocalDateTime sendTime; + + @ApiModelProperty("发送是否成功,1成功 0失败") + @TableField("send_status") + private String sendStatus; + + @ApiModelProperty("计划发送时间(同天当前时间之前立即发送)") + @TableField("exp_send_time") + private LocalDateTime expSendTime; + + @ApiModelProperty("加入定时任务标记 默认0未加入 1已加入") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + @Excel(name = "通知类型") + private String modelSuitType; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @BindDict(filedMapping = "modelSuitType", type = "model_suit_type") + private String modelSuitTypeStr; + + @ApiModelProperty("计划id(手工与简报会先配置计划)") + @TableField("plan_id") + private Long planId; + + @ApiModelProperty("手工计划信息") + @BindDict + private YwNoticeHandworkVO YwNoticeHandworkVO; + + @ApiModelProperty("简报计划信息") + @BindDict + private YwNoticeBriefingVO ywNoticeBriefingVO; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeModelVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeModelVO.java new file mode 100644 index 0000000000000000000000000000000000000000..05af9bcbb715f1cdf21e9efd833c5cd6634e94a2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeModelVO.java @@ -0,0 +1,104 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + *

+ * 通知通告模板表VO + *

+ * + * @author ck + * @since 2023-04-07 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeModelVO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("id") + @TableField("id") + @Excel(name = "序号",sort = 1) + private Long id; + + @ApiModelProperty("模板名称") + @TableField("model_name") + @Excel(name = "模板名称",sort = 2) + private String modelName; + + @ApiModelProperty("模板内容") + @TableField("model_content") + @Excel(name = "模板内容",sort = 5) + private String modelContent; + + @ApiModelProperty("场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + @Excel(name = "模板场景", dictType = "yw_notice_scene",sort = 3) + private String modelScene; + + @ApiModelProperty("场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + @BindDict(filedMapping = "modelScene", type = "yw_notice_scene") + private String modelSceneStr; + + @ApiModelProperty("用户id") + @TableField(value = "create_user_id", fill = FieldFill.INSERT) + private Long createUserId; + + @ApiModelProperty("创建用户昵称") + @TableField(value = "create_by", fill = FieldFill.INSERT) + @Excel(name = "创建者",sort = 5) + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + @Excel(name = "创建时间",sort = 6,dateFormat = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @ApiModelProperty("模板适用类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + @Excel(name = "模板类型", dictType = "model_suit_type",sort = 4) + private String modelSuitType; + + @ApiModelProperty("模板适用类型 1 普通 2 手工 3简报") + @TableField("model_suit_type") + @BindDict(filedMapping = "modelSuitType", type = "model_suit_type") + private String modelSuitTypeStr; + + @ApiModelProperty("备注(写一些触发要求)") + @TableField("model_des") +// @Excel(name = "备注") + private String modelDes; + + @ApiModelProperty("模板类型--字典yw_model_type 0事件触发型") + @TableField("model_type") +// @Excel(name = "模板类型", dictType = "yw_model_type") + private String modelType; + + @ApiModelProperty("模板类型--字典yw_model_type 0事件触发型") + @TableField("model_type") + @BindDict(filedMapping = "modelType", type = "yw_model_type") + private String modelTypeStr; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("发送方式 send_type (1自动发送 2手工发送)") + private String sendTypeStr; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeObjectVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeObjectVO.java new file mode 100644 index 0000000000000000000000000000000000000000..6601fb6b56df74cfa948c19ada5e3a609a53a93a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeObjectVO.java @@ -0,0 +1,158 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + *

+ * 通知通告对象表VO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeObjectVO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + @Excel(name = "序号",sort = 1) + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + @Excel(name = "地市",dictType ="yw_city",sort = 4) + private String city; + + @ApiModelProperty("地市") + @BindDict(filedMapping = "city", type = "yw_city") + private String cityStr; + + @ApiModelProperty("区县") + @TableField("county") + @Excel(name = "区县",dictType ="yw_county",sort = 5 ) + private String county; + + @ApiModelProperty("区县") + @BindDict(filedMapping = "county", type = "yw_county") + private String countyStr; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("场馆名") + @Excel(name = "场馆",sort = 6) + private String venueName; + + @ApiModelProperty("专业") + @TableField("specialty") + private Long specialty; + + @ApiModelProperty("角色id数组") + @TableField("role_ids") + private List roleIds; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + @Excel(name = "对象属性",sort = 3,dictType = "yw_notice_object",combo={"场馆层","分公司层","亚运指挥层","ITCC层"}) + private String objectProto; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + @BindDict(filedMapping = "objectProto", type = "yw_notice_object") + private String objectProtoStr; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") +// @Excel(name = "通知方式", dictType = "sys_notice_type") + private String noticeType; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + @BindDict(filedMapping = "noticeType", type = "sys_notice_type") + private String noticeTypeStr; + + @ApiModelProperty("短信组名") + @TableField("message_name") + @Excel(name = "短信组名",sort = 9) + private String messageName; + + @ApiModelProperty("短信组内成员id数组") + @TableField("message_users") + private List messageUsers; + + @ApiModelProperty("短信组内成员id数组") + private List messageUsersStr; + + @ApiModelProperty("短信组内成员id数组") + @Excel(name = "短信组内成员",needMerge=true,sort = 10) + private String messageUsersExcelStr; + + @ApiModelProperty("短信组内成员id数组") + @Excel(name = "短信组内成员手机号",needMerge=true,sort = 11) + private String messageUsersExcelPhoneStr; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("群号") + @TableField("group_id") + @Excel(name = "群号",sort = 7) + private String groupId; + + @ApiModelProperty("群名") + @TableField("group_name") + @Excel(name = "群名",sort = 8) + private String groupName; + + @ApiModelProperty("备注") + @TableField("group_des") + @Excel(name = "备注",sort = 15) + private String groupDes; + + @ApiModelProperty("对象名称") + @TableField("object_name") + @Excel(name = "对象名称",sort = 2) + private String objectName; + + @ApiModelProperty("ivr组名") + @TableField("ivr_name") + @Excel(name = "ivr组名",sort = 12) + private String ivrName; + + @ApiModelProperty("ivr组内成员id数组") + @TableField("ivr_users") + private List ivrUsers; + + @ApiModelProperty("ivr组内成员id数组") + private List ivrUsersStr; + + @ApiModelProperty("ivr组内成员id数组") + @Excel(name = "ivr组内成员",sort = 13) + private String ivrUsersExcelStr; + + @ApiModelProperty("ivr组内成员id数组") + @Excel(name = "ivr组内成员手机号",sort = 14) + private String ivrUsersExcelPhoneStr; + + /** + * 失败原因 + */ + @Excel(name = "失败原因",type = Excel.Type.EXPORT,sort = 16) + @TableField(exist = false) + private String reason; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeObjectaVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeObjectaVO.java new file mode 100644 index 0000000000000000000000000000000000000000..bf0aae8e265b3604ed9f41c7e79a741e35e3f1de --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwNoticeObjectaVO.java @@ -0,0 +1,158 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + *

+ * 通知通告对象表VO + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwNoticeObjectaVO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("id") + @TableField("id") + @Excel(name = "序号",sort = 1) + private Long id; + + @ApiModelProperty("地市") + @TableField("city") + @Excel(name = "地市",dictType ="yw_city",sort = 4) + private String city; + + @ApiModelProperty("地市") + @BindDict(filedMapping = "city", type = "yw_city") + private String cityStr; + + @ApiModelProperty("区县") + @TableField("county") + @Excel(name = "区县",dictType ="yw_county",sort = 5 ) + private String county; + + @ApiModelProperty("区县") + @BindDict(filedMapping = "county", type = "yw_county") + private String countyStr; + + @ApiModelProperty("场馆id") + @TableField("venue_id") + private Long venueId; + + @ApiModelProperty("场馆名") + @Excel(name = "场馆名",sort = 6) + private String venueName; + + @ApiModelProperty("专业") + @TableField("specialty") + private Long specialty; + + @ApiModelProperty("角色id数组") + @TableField("role_ids") + private List roleIds; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + @Excel(name = "对象属性",sort = 3,dictType = "yw_notice_object") + private String objectProto; + + @ApiModelProperty("对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + @BindDict(filedMapping = "objectProto", type = "yw_notice_object") + private String objectProtoStr; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") +// @Excel(name = "通知方式", dictType = "sys_notice_type") + private String noticeType; + + @ApiModelProperty("通知方式sys_notice_type") + @TableField("notice_type") + @BindDict(filedMapping = "noticeType", type = "sys_notice_type") + private String noticeTypeStr; + + @ApiModelProperty("短信组名") + @TableField("message_name") + @Excel(name = "短信组名",sort = 9) + private String messageName; + + @ApiModelProperty("短信组内成员id数组") + @TableField("message_users") + private List messageUsers; + + @ApiModelProperty("短信组内成员id数组") + private List messageUsersStr; + + @ApiModelProperty("短信组内成员id数组") + @Excel(name = "短信组内成员",needMerge=true,sort = 10) + private String messageUsersExcelStr; + + @ApiModelProperty("短信组内成员id数组") + @Excel(name = "短信组内成员手机号",needMerge=true,sort = 11) + private String messageUsersExcelPhoneStr; + + @ApiModelProperty("排序号") + @TableField("order_num") + private Integer orderNum; + + @ApiModelProperty("群号") + @TableField("group_id") + @Excel(name = "群号",sort = 7) + private String groupId; + + @ApiModelProperty("群名") + @TableField("group_name") + @Excel(name = "群名",sort = 8) + private String groupName; + + @ApiModelProperty("备注") + @TableField("group_des") + @Excel(name = "备注",sort = 15) + private String groupDes; + + @ApiModelProperty("对象名称") + @TableField("object_name") + @Excel(name = "对象名称",sort = 2) + private String objectName; + + @ApiModelProperty("ivr组名") + @TableField("ivr_name") + @Excel(name = "ivr组名",sort = 12) + private String ivrName; + + @ApiModelProperty("ivr组内成员id数组") + @TableField("ivr_users") + private List ivrUsers; + + @ApiModelProperty("ivr组内成员id数组") + private List ivrUsersStr; + + @ApiModelProperty("ivr组内成员id数组") + @Excel(name = "ivr组内成员",sort = 13) + private String ivrUsersExcelStr; + + @ApiModelProperty("ivr组内成员id数组") + @Excel(name = "ivr组内成员手机号",sort = 14) + private String ivrUsersExcelPhoneStr; + + /** + * 失败原因 + */ + @Excel(name = "失败原因",sort = 16) + @TableField(exist = false) + private String reason; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneAlarmVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneAlarmVo.java new file mode 100644 index 0000000000000000000000000000000000000000..17617a808d3354d6a48e295067e82c6cf5768a8d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneAlarmVo.java @@ -0,0 +1,41 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +//import cn.afterturn.easypoi.excel.annotation.Excel; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwSceneAlarmVo { + + private Long id; + + @Excel(name = "场馆名称",width = 20,sort = 1) + private String venueName; + + @Excel(name = "告警名称",width = 20,sort = 2) + private String alarmName; + + private String specialty; + + @Excel(name = "专业",width = 20,sort = 3) + private String specialtyName; + + @Excel(name = "处理时长限制",width = 20,sort = 4) + private Long dealHour; + + @Excel(name = "告警编号",width = 20,sort = 5) + private String alarmCode; + + @Excel(name = "黑白名单",width = 20,sort = 6) + private String blackorwhite; + + @Excel(name = "告警等级",width = 20,sort = 7) + private Integer alarmLevel; + + @Excel(name = "状态",width = 20,sort = 8) + private String status; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneBaseInfoVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneBaseInfoVo.java new file mode 100644 index 0000000000000000000000000000000000000000..5491248e7025158de864cbdd4707e52ad67aefc7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneBaseInfoVo.java @@ -0,0 +1,9 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +@Data +public class YwSceneBaseInfoVo { + private String managerName; + private String phone; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneCalendar2Vo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneCalendar2Vo.java new file mode 100644 index 0000000000000000000000000000000000000000..c5d5ba548f726811b875df6ff34996c459badd4b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneCalendar2Vo.java @@ -0,0 +1,58 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.Data; + +import java.util.Date; + +/** + * @author huamile + */ +@Data +public class YwSceneCalendar2Vo extends ResultBean { + + private Long id; + + @Excel(name = "编号", sort = 1) + private String idStr; + + private Long sceneId; + + @Excel(name = "场馆", width = 20, sort = 2) + private String venueName; + + private String matchType; + + @Excel(name = "比赛类型", width = 20, sort = 3) + private String matchTypeName; + + @Excel(name = "比赛名称", width = 20, sort = 4) + private String matchName; + + @Excel(name = "比赛日期", width = 20, dateFormat = "yyyy-MM-dd", sort = 5) + private String matchDate; + + @Excel(name = "开始时间", width = 20, dateFormat = "HH:mm", sort = 6) + private String beginTime; + + @Excel(name = "结束时间", width = 20, dateFormat = "HH:mm", sort = 7) + private String endTime; + + private String status; + + @Excel(name = "状态", width = 20, sort = 8) + private String statusName; + + @Excel(name = "备注", width = 20, sort = 9) + private String matchRemark; + + private String createBy; + + private Date createTime; + + private String updateBy; + + private Date updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneCalendarVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneCalendarVo.java new file mode 100644 index 0000000000000000000000000000000000000000..60cea0e090e43deeac21d9a97ae5dfb7a154d77d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneCalendarVo.java @@ -0,0 +1,45 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +//import cn.afterturn.easypoi.excel.annotation.Excel; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwSceneCalendarVo { + + private Long id; + + private Long sceneId; + + @Excel(name = "场馆名称",width = 20,sort = 1) + private String venueName; + + private String matchType; + + @Excel(name = "赛事类型",width = 20,sort = 2) + private String matchTypeName; + + @Excel(name = "赛事名称",width = 20,sort = 3) + private String matchName; + + @Excel(name = "赛事说明",width = 20,sort = 4) + private String matchRemark; + + @Excel(name = "开始时间",width = 20,sort = 5) + private String beginTime; + + @Excel(name = "结束时间",width = 20,sort = 6) + private String endTime; + + @Excel(name = "比赛日期",width = 20,sort = 7) + private String matchDate; + + private String status; + + @Excel(name = "状态",width = 20,sort = 8) + private String statusName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneExportVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneExportVo.java new file mode 100644 index 0000000000000000000000000000000000000000..f519e809a79be06775b5540ca6b9ee8bee30be25 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneExportVo.java @@ -0,0 +1,57 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + * @author liqiz + */ +@Data +public class YwSceneExportVo { + + @Excel(name = "场馆标准名称", type = Excel.Type.EXPORT, sort = 1) + private String venueName; + + @Excel(name = "备注", type = Excel.Type.EXPORT, sort = 15) + private String venueDesc; + + @Excel(name = "地址", type = Excel.Type.EXPORT, sort = 14) + private String venueAddress; + + @Excel(name = "所属区县", type = Excel.Type.EXPORT, sort = 12) + private String county; + + @Excel(name = "纬度GPS", type = Excel.Type.EXPORT, sort = 8) + private Double latitude; + + @Excel(name = "经度GPS", type = Excel.Type.EXPORT, sort = 7) + private Double longitude; + + @Excel(name = "场馆属性", type = Excel.Type.EXPORT, sort = 5) + private String venueType; + + @Excel(name = "场馆级别", type = Excel.Type.EXPORT, sort = 6) + private String venueLevel; + + @Excel(name = "场馆简称", type = Excel.Type.EXPORT, sort = 2) + private String venueShortname; + + @Excel(name = "所属地市", type = Excel.Type.EXPORT, sort = 11) + private String city; + + @Excel(name = "场馆英文缩写", type = Excel.Type.EXPORT, sort = 3) + private String englishShortname; + + @Excel(name = "维护类别", type = Excel.Type.EXPORT, sort = 4) + private String maintainType; + + @Excel(name = "经度GCJ02", type = Excel.Type.EXPORT, sort = 9) + private Double longitudeGcj02; + + @Excel(name = "纬度GCJ02", type = Excel.Type.EXPORT, sort = 10) + private Double latitudeGcj02; + + @Excel(name = "赛事类型", type = Excel.Type.EXPORT, sort = 13) + private String matchType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneKPIStatisticsVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneKPIStatisticsVo.java new file mode 100644 index 0000000000000000000000000000000000000000..1457c22cfd9f82779fce038588f6b87356ec28e8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneKPIStatisticsVo.java @@ -0,0 +1,38 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +/** + * 场馆性能(15分粒度) + */ +@Data +public class YwSceneKPIStatisticsVo { + /** + * x轴 + */ + private String datetime; + /** + * 上行prb利用率 + */ + private Float value; + /** + * 下行prb利用率 + */ + private Float value2; + /** + * 最大用户数 + */ + private Float maxUserNum; + /** + * 上行平均干扰 + */ + private Float avgInterfere; + /** + * 流量GB + */ + private Float flux; + /** + * 无线接通率 + */ + private Float wirelessCompletionRate; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneMatchVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneMatchVo.java new file mode 100644 index 0000000000000000000000000000000000000000..997f78a698283c6847f53a266802ab20b0368680 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneMatchVo.java @@ -0,0 +1,54 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +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 com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.Data; + +import java.util.Date; + +/** + * @author los + */ +@Data +@TableName("yw_scene_match") +public class YwSceneMatchVo extends ResultBean { + @TableId(value = "id", type = IdType.AUTO) + private Long id; + @Excel(name = "编号", sort = 1) + @TableField(exist = false) + private String idStr; + private Long sceneId; + @Excel(name = "场馆名称", sort = 2) + @TableField(exist = false) + private String sceneName; + private String taskType; + @Excel(name = "赛程类型", sort = 3) + @TableField(exist = false) + private String taskTypeName; + @Excel(name = "赛程名称", sort = 4) + private String taskName; + private String taskStatus; + @Excel(name = "开始时间", dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 5) + @TableField(exist = false) + private String beginTimeStr; + private Date beginTime; + @Excel(name = "结束时间", dateFormat = "yyyy-MM-dd HH:mm:ss", sort = 6) + @TableField(exist = false) + private String endTimeStr; + private Date endTime; + @Excel(name = "赛程状态", sort = 7) + @TableField(exist = false) + private String taskStatusName; + + private String createBy; + + private Date createTime; + + private String updateBy; + + private Date updateTime; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetAgixStaVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetAgixStaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..9ab1cf67b7722f0b601521cfc67400a90b8de307 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetAgixStaVo.java @@ -0,0 +1,71 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author yqf + * @date 2023/8/14 + */ +@Data +public class YwSceneNetAgixStaVo { + + private String statdate; + //总流量 + private float flowcount; + + //汇聚-核心链路平均时延 + private float convcoreavgdelay; + + //汇聚-核心链路平均抖动 + private float convcoreavgjitter; + + //汇聚-核心链路平均丢包 + private float convcoreavglpackratio; + + //AGIS下行总流量 + private float dlconvcoreflow; + + //AGIS上行总流量 + private float ulconvcoreflow; + + //场馆出口下行流速 + private float dlvenuevelocity; + + //场馆出口上行流速 + private float ulvenuevelocity; + + //AGIS汇聚_CPU利用率 + private float conswitchcpuratio; + + //AGIS汇聚_内存利用率 + private float convswitchramratio; + + //AGIS接入_CPU利用率 + private float accessswitchcpuratio; + + //AGIS接入_内存利用率 + private float accessswitchraratio; + + //AGIS上行带宽利用率 + private float ulvenuebandratio; + + //AGIS下行带宽利用率 + private float dlvenuebandratio; + + //AGIS流量top5 + private List flowTop5List; + + //上行流速top5 + private List ullocityTop5List; + + //下行流速top5 + private List dllocityTop5List; + + //上行带宽利用率top5 + private List ulbandratioTop5List; + + //下行带宽利用率top5 + private List dlbandratioTop5List; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetFixtelRegSuccVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetFixtelRegSuccVo.java new file mode 100644 index 0000000000000000000000000000000000000000..f8acde840873a1bb4f595f51733a94bae1c950e8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetFixtelRegSuccVo.java @@ -0,0 +1,14 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/8/16 + */ +@Data +public class YwSceneNetFixtelRegSuccVo { + + private String time; + private float regsuccratio; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetFixtelStaVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetFixtelStaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..386cca0df62b9f9803b1c4f787acff45c8da9b94 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetFixtelStaVo.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author yqf + * @date 2023/8/15 + */ +@Data +public class YwSceneNetFixtelStaVo { + + private String statdate; + + //固话开户数 + private float opencnt; + + //固话在线用户数 + private float onlineusercnt; + + private float regsuccratio; + + private List list; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetStaVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetStaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..e7dc1f7d275b7e23fbc7429b079839411b774afd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetStaVo.java @@ -0,0 +1,54 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author yqf + * @date 2023/8/14 + */ +@Data +public class YwSceneNetStaVo { + + private String statdate; + + //互联网在线用户数 + private Integer onlineusercnt; + + //互联网上行带宽利用率 + private float ulvenuebandratio; + + //互联网下行带宽利用率 + private float dlvenuebandratio; + + //互联网场馆出口_下行流速 + private float dlvenuevelocity; + + //互联网出口_上行流速 + private float ulvenuevelocity; + + //总流量 + private float flowcount; + + //互联网出口带宽 + private float venuebandwith; + + private List list; + + +// //AGIS流量top5 +// private List flowTop5List; +// +// //上行流速top5 +// private List ullocityTop5List; +// +// //下行流速top5 +// private List dllocityTop5List; +// +// //上行带宽利用率top5 +// private List ulbandratioTop5List; +// +// //下行带宽利用率top5 +// private List dlbandratioTop5List; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetVelocityStaVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetVelocityStaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..f12d4ffacec3012aff02a2fe7f6e31d740d327db --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetVelocityStaVo.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/8/14 + */ +@Data +public class YwSceneNetVelocityStaVo { + + private String statdate; + + private float dlvenuevelocity; + + private float ulvenuevelocity; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetWifiStaVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetWifiStaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..21ee83c22049883de058aab5c56c2f4b6bf7d238 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetWifiStaVo.java @@ -0,0 +1,50 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author yqf + * @date 2023/8/21 + */ +@Data +public class YwSceneNetWifiStaVo { + + private String statdate; + //总流量 + private float flowcount; + + //下行流速 + private float dlvenuevelocity; + + //上行流速 + private float ulvenuevelocity; + + //上行带宽利用率 + private float ulvenuebandratio; + + //下行带宽利用率 + private float dlvenuebandratio; + + //互联网出口带宽 + private float venuebandwith; + + //互联网在线用户数 + private int onlineusercnt; + + //AGIS流量top5 + private List flowTop5List; + + //上行流速top5 + private List ullocityTop5List; + + //下行流速top5 + private List dllocityTop5List; + + //上行带宽利用率top5 + private List ulbandratioTop5List; + + //下行带宽利用率top5 + private List dlbandratioTop5List; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementAgis.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementAgis.java new file mode 100644 index 0000000000000000000000000000000000000000..8cd75bb670305cd41742e12f68d50e9e0c906c18 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementAgis.java @@ -0,0 +1,46 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author los + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwSceneNetelementAgis extends ResultBean { + @TableId(value = "id", type = IdType.AUTO) + private Long id; + private Long sceneId; + @Excel(name = "专业", type = Excel.Type.ALL, sort = 1) + private String alarmSpecityName; + private String alarmSpecityId; + @Excel(name = "场馆", type = Excel.Type.ALL, sort = 2) + private String sceneName; + @Excel(name = "网元名称", type = Excel.Type.ALL, sort = 3) + private String netElementName; + @Excel(name = "端口", type = Excel.Type.ALL, sort = 4) + private String portA; + @Excel(name = "设备类型", type = Excel.Type.ALL, sort = 5) + private String equipmentType; + @Excel(name = "对端网元", type = Excel.Type.ALL, sort = 6) + private String netElementB; + @Excel(name = "对端端口", type = Excel.Type.ALL, sort = 7) + private String portB; + @Excel(name = "对端设备类型", type = Excel.Type.ALL, sort = 8) + private String equipmentTypeB; + @Excel(name = "备注", type = Excel.Type.ALL, sort = 9) + private String desc; + private String updateBy; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date updateTime; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementCs.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementCs.java new file mode 100644 index 0000000000000000000000000000000000000000..743c643492b879b75a0f78fdcbffa760d43ec2eb --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementCs.java @@ -0,0 +1,45 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author los + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwSceneNetelementCs extends ResultBean { + @TableId(value = "id", type = IdType.AUTO) + private Long id; + private Long sceneId; + @Excel(name = "场馆", type = Excel.Type.ALL, sort = 1) + private String sceneName; + @Excel(name = "设备类型", type = Excel.Type.ALL, sort = 2) + private String equipmentType; + @Excel(name = "A端网元", type = Excel.Type.ALL, sort = 4) + private String netElementNameA; + @Excel(name = "A端端口", type = Excel.Type.ALL, sort = 5) + private String portA; + @Excel(name = "A端属性(红线内外)", type = Excel.Type.ALL, sort = 6) + private String attributeA; + @Excel(name = "组网类型", type = Excel.Type.ALL, sort = 3) + private String networkingType; + @Excel(name = "Z端网元", type = Excel.Type.ALL, sort = 7) + private String netElementZ; + @Excel(name = "Z端端口", type = Excel.Type.ALL, sort = 8) + private String portZ; + @Excel(name = "Z端属性(红线内外)", type = Excel.Type.ALL, sort = 9) + private String attributeZ; + private String updateBy; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date updateTime; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementDh.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementDh.java new file mode 100644 index 0000000000000000000000000000000000000000..3eecf57fb76d9ad25249874be038779c28266fbd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementDh.java @@ -0,0 +1,39 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @author los + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwSceneNetelementDh extends ResultBean { + @TableId(value = "id", type = IdType.AUTO) + private Long id; + @Excel(name = "地市", type = Excel.Type.ALL, sort = 2) + private String city; + @Excel(name = "区县", type = Excel.Type.ALL, sort = 3) + private String county; + @Excel(name = "物理站名", type = Excel.Type.ALL, sort = 4) + private String netElementPhyname; + @Excel(name = "红线内外", type = Excel.Type.ALL, sort = 6) + private String inRedline; + private Long sceneId; + @Excel(name = "场馆", type = Excel.Type.ALL, sort = 1) + private String sceneName; + @Excel(name = "机房类型", type = Excel.Type.ALL, sort = 5) + private String roomType; + private String updateBy; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date updateTime; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementWx.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementWx.java new file mode 100644 index 0000000000000000000000000000000000000000..a8132c729b8c95f90267966592ed5e389e1b6eae --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNetelementWx.java @@ -0,0 +1,125 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwSceneNetelementWx extends ResultBean { + @TableId(value = "id", type = IdType.AUTO) + private Long id; + private Long sceneId; + @Excel(name = "场馆名称", type = Excel.Type.ALL, sort = 1) + @TableField(exist = false) + private String sceneName; + @Excel(name = "场景名称", type = Excel.Type.ALL, sort = 1) + private String 场景名称; + @Excel(name = "OMC", type = Excel.Type.ALL, sort = 2) + private String omc; + @Excel(name = "地市", type = Excel.Type.ALL, sort = 3) + @TableField(exist = false) + private String city; + @Excel(name = "县市", type = Excel.Type.ALL, sort = 4) + @TableField(exist = false) + private String county; + private String 地市; + private String 县市; + @Excel(name = "enodebid", type = Excel.Type.ALL, sort = 5, cellType = Excel.ColumnType.NUMERIC) + private String enodebidStr; + private Integer enodebid; + @Excel(name = "本地小区标识", type = Excel.Type.ALL, sort = 6, cellType = Excel.ColumnType.NUMERIC) + private String 本地小区标识Str; + private Integer 本地小区标识; + @Excel(name = "小区标识", type = Excel.Type.ALL, sort = 7, cellType = Excel.ColumnType.NUMERIC) + private String 小区标识Str; + private Integer 小区标识; + @Excel(name = "站号", type = Excel.Type.ALL, sort = 8, cellType = Excel.ColumnType.NUMERIC) + private String 站号Str; + private Integer 站号; + @Excel(name = "基站全称", type = Excel.Type.ALL, sort = 9) + private String 基站全称; + @Excel(name = "en", type = Excel.Type.ALL, sort = 10) + private String en名称; + @Excel(name = "小区名称", type = Excel.Type.ALL, sort = 11) + private String 小区名称; + @Excel(name = "小区别名", type = Excel.Type.ALL, sort = 11) + private String 小区别名; + @Excel(name = "ci", type = Excel.Type.ALL, sort = 12) + private String ci; + @Excel(name = "红线内外", type = Excel.Type.ALL, sort = 13) + private String inRedline; + @Excel(name = "小区频段", type = Excel.Type.ALL, sort = 14) + private String 小区频段; + @Excel(name = "纬度", type = Excel.Type.ALL, sort = 15, cellType = Excel.ColumnType.NUMERIC) + private String 纬度Str; + private Double 纬度; + @Excel(name = "经度", type = Excel.Type.ALL, sort = 16, cellType = Excel.ColumnType.NUMERIC) + private String 经度Str; + private Double 经度; + @Excel(name = "纬度gcj", type = Excel.Type.ALL, sort = 17, cellType = Excel.ColumnType.NUMERIC) + private String 纬度gcj; + @Excel(name = "经度gcj", type = Excel.Type.ALL, sort = 18, cellType = Excel.ColumnType.NUMERIC) + private String 经度gcj; + @Excel(name = "室内室外", type = Excel.Type.ALL, sort = 19) + private String 室内室外; + @Excel(name = "网络", type = Excel.Type.ALL, sort = 20) + private String 网络; + @Excel(name = "0427现网状态", type = Excel.Type.ALL, sort = 21) + private String 现网状态; + @Excel(name = "CGI", type = Excel.Type.ALL, sort = 22) + private String cgi; + @Excel(name = "频点", type = Excel.Type.ALL, sort = 23, cellType = Excel.ColumnType.NUMERIC) + private String 频点Str; + private Integer 频点; + @Excel(name = "pci", type = Excel.Type.ALL, sort = 24, cellType = Excel.ColumnType.NUMERIC) + private String pciStr; + private Integer pci; + @Excel(name = "tac", type = Excel.Type.ALL, sort = 25, cellType = Excel.ColumnType.NUMERIC) + private String tacStr; + private Integer tac; + @Excel(name = "一级场景", type = Excel.Type.ALL, sort = 26) + private String 一级场景; + @Excel(name = "二级场景", type = Excel.Type.ALL, sort = 27) + private String 二级场景; + @Excel(name = "设备类型", type = Excel.Type.ALL, sort = 28) + private String 设备类型; + @Excel(name = "带宽", type = Excel.Type.ALL, sort = 29, cellType = Excel.ColumnType.NUMERIC) + private String 带宽Str; + private Integer 带宽; + @Excel(name = "方位角", type = Excel.Type.ALL, sort = 30, cellType = Excel.ColumnType.NUMERIC) + private String 方位角Str; + private Float 方位角; + @Excel(name = "扇区id", type = Excel.Type.ALL, sort = 31) + private String 扇区id; + @Excel(name = "坐席编号", type = Excel.Type.ALL, sort = 32) + private String 坐席编号; + @Excel(name = "场景类型编码", type = Excel.Type.ALL, sort = 33) + private String sceneTypeCode; + @Excel(name = "场景类型", type = Excel.Type.ALL, sort = 34) + private String sceneType; + @Excel(name = "场景子类型编码", type = Excel.Type.ALL, sort = 35) + private String subSceneTypeCode; + @Excel(name = "场景子类型", type = Excel.Type.ALL, sort = 36) + private String subSceneType; + @Excel(name = "场景编码", type = Excel.Type.ALL, sort = 37) + private String sceneCode; + @Excel(name = "覆盖子场景编码", type = Excel.Type.ALL, sort = 38) + private String coverSubSceneCode; + @Excel(name = "覆盖子场景", type = Excel.Type.ALL, sort = 39) + private String coverSubScene; + private String updateBy; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private Date updateTime; + + private String areacountyid; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNoticeinfo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNoticeinfo.java new file mode 100644 index 0000000000000000000000000000000000000000..8ffa0171f6ee16836913a88514c7de4e995e5d41 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneNoticeinfo.java @@ -0,0 +1,187 @@ +package com.ruoyi.eastcom_yw.domain.vo; + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.importer.beans.ResultBean; +import lombok.Data; + +/** + * (YwSceneNoticeinfo)表实体类 + * + * @author lee + * @since 2023-04-27 11:13:53 + */ +@Data +public class YwSceneNoticeinfo extends ResultBean { + + @TableId(type = IdType.AUTO) + private Long id; + + private Long sceneId; + + private Integer frontuser; + + private Integer backuser; + + private Integer emergencycar; + + private String county; + + private Integer publicNetNum; + + private int transportEquipNum; + + private Integer interfaceRingNum; + + private int netTotalNum; + + private Integer emergencyWarehouse; + + private Integer wxNetNum; + + //agis+wifi+voip + private Integer agisNetNum; + + private Integer dhNetNum; + + private Integer agisNum; + private Integer wifiNetNum; + private Integer voipNetNum; + + private Integer internetNetNum; + + private Integer publicTransportEquipNum; + + private Integer publicInterfaceRingNum; + + private Integer privateTransportEquipNum; + + private Integer privateInterfaceRingNum; + + private Integer supportcar; + + private Integer dictEquipNum; + + private Integer emergencyCommunicationCar; + + private Integer emergencyElectricCar; + + private Integer emergencyRepairCar; + + private Integer wifiSpare; + + private Integer dredgeSpare; + + private Integer transSpare; + + private Integer publicPowerEquip; + + private Integer privatePowerEquip; + + @Excel(name = "场馆名称", sort = 1) + @TableField(exist = false) + private String sceneName; + + @Excel(name = "无线网元数", sort = 2) + @TableField(exist = false) + private String wxNetNumStr; + + @Excel(name = "专网网元数", sort = 4) + @TableField(exist = false) + private String agisNetNumStr; + + @Excel(name = "动环网元数", sort = 3) + @TableField(exist = false) + private String dhNetNumStr; + + @Excel(name = "agis网元数", sort = 4) + @TableField(exist = false) + private String agisNumStr; + + @Excel(name = "互联网网元数", sort = 4) + @TableField(exist = false) + private String wifiNetNumStr; + + @Excel(name = "固话网元数", sort = 4) + @TableField(exist = false) + private String voipNetNumStr; + + @TableField(exist = false) + private String internetNetNumStr; + + @Excel(name = "公网传输设备", sort = 5) + @TableField(exist = false) + private String publicTransportEquipNumStr; + + @Excel(name = "公网接入环", sort = 6) + @TableField(exist = false) + private String publicInterfaceRingNumStr; + +// @Excel(name = "专网传输设备", sort = 7) + @TableField(exist = false) + private String privateTransportEquipNumStr; + +// @Excel(name = "专网接入环", sort = 8) + @TableField(exist = false) + private String privateInterfaceRingNumStr; + + @Excel(name = "现场保障人数", sort = 9) + @TableField(exist = false) + private String frontuserStr; + + @Excel(name = "后台保障人数", sort = 10) + @TableField(exist = false) + private String backuserStr; + + @Excel(name = "场馆部署应急车", sort = 11) + @TableField(exist = false) + private String emergencycarStr; + + @Excel(name = "场馆部署应急仓", sort = 12) + @TableField(exist = false) + private String emergencyWarehouseStr; + + @Excel(name = "保障车辆数", sort = 13) + @TableField(exist = false) + private String supportcarStr; + + @Excel(name = "DICT设备数", sort = 14) + @TableField(exist = false) + private String dictEquipNumStr; + + @Excel(name = "应急通信车", sort = 15) + @TableField(exist = false) + private String emergencyCommunicationCarStr; + + @Excel(name = "应急发电车", sort = 16) + @TableField(exist = false) + private String emergencyElectricCarStr; + + @Excel(name = "应急抢修车", sort = 17) + @TableField(exist = false) + private String emergencyRepairCarStr; + + @Excel(name = "无线备件数", sort = 18) + @TableField(exist = false) + private String wifiSpareStr; + + @Excel(name = "疏通备件数", sort = 19) + @TableField(exist = false) + private String dredgeSpareStr; + + @Excel(name = "传输备件数", sort = 20) + @TableField(exist = false) + private String transSpareStr; + + @Excel(name = "公网动力设备", sort = 21) + @TableField(exist = false) + private String publicPowerEquipStr; + + @Excel(name = "专网动力设备", sort = 22) + @TableField(exist = false) + private String privatePowerEquipStr; +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneRedisVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneRedisVO.java new file mode 100644 index 0000000000000000000000000000000000000000..e44881112e8b743d16c7b9790f24ca46eadbb995 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneRedisVO.java @@ -0,0 +1,12 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +@Data +public class YwSceneRedisVO { + + private Long id; + + private String venueName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTestDataInterface.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTestDataInterface.java new file mode 100644 index 0000000000000000000000000000000000000000..0feff02810871331c5c791ec2b727adb55c55c04 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTestDataInterface.java @@ -0,0 +1,23 @@ +package com.ruoyi.eastcom_yw.domain.vo; + + +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; + +/** + * (YwSceneTestDataInterface)表实体类 + * + * @author lee + * @since 2023-09-07 09:59:11 + */ +@Data +public class YwSceneTestDataInterface extends Model { + //接口地址 + private String url; + //是否启用(0否1是) + private String enable; + //场馆id + private Integer sceneId; + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTransGbStaVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTransGbStaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..c7b55b6ef9804eb24b533a3e590bc6bc129558e6 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTransGbStaVo.java @@ -0,0 +1,16 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/8/16 + */ +@Data +public class YwSceneTransGbStaVo { + + private String mename; + private String portname; + private float flow; + public String dateTime; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTransOpticalpowerStaVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTransOpticalpowerStaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..2a1d7d29392b5fd1f520a18bd1a7271c06972917 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTransOpticalpowerStaVo.java @@ -0,0 +1,20 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/8/16 + */ +@Data +public class YwSceneTransOpticalpowerStaVo { + + public String venue; + public String mename; + public String portname; + //收光功率 + public float inOpticalpower; + //出光功率 + public float outOpticalpower; + public String dateTime; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTransStaVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTransStaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..04a09321b52c39bb2831a2cca0e39548d27bad0c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneTransStaVo.java @@ -0,0 +1,20 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @author yqf + * @date 2023/8/29 + */ +@Data +public class YwSceneTransStaVo { + + private List opticalpowerTop5; + + private List outopticalpowerTop5; + + private String maxInOpticalpower; + private String maxOutOpticalpower; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneUserVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneUserVo.java new file mode 100644 index 0000000000000000000000000000000000000000..8f5e27a6e2e2bcae51a1f619938ce032138d0a25 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneUserVo.java @@ -0,0 +1,50 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +//import cn.afterturn.easypoi.excel.annotation.Excel; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class YwSceneUserVo { + + private Long id; + + @Excel(name = "场馆名称",width = 20) + private String venueName; + + private Long userId; + + @Excel(name = "姓名",width = 20) + private String userName; + + private String belongArea; + + private String distinctArea; + + @Excel(name = "所属区域",width = 20) + private String belongAreaName; + + @Excel(name = "手机号",width = 20) + private String phonenumber; + + @Excel(name = "角色",width = 20) + private String roleName; + + private String specialty; + + @Excel(name = "专业",width = 20) + private String specialtyName; + + private String status; + + @Excel(name = "状态",width = 20) + private String statusName; + +// @Excel(name = "是否需要签到",width = 20,replace = {"是_1,否_0"}) + @Excel(name = "是否需要签到",width = 20,readConverterExp = "0=否,1=是") + private String needSign; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneVo.java new file mode 100644 index 0000000000000000000000000000000000000000..9e02a22cda6527ff84e55dac137d843e79760b05 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSceneVo.java @@ -0,0 +1,93 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +//import cn.afterturn.easypoi.excel.annotation.Excel; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.eastcom_yw.domain.YwSceneFile; +import lombok.Data; + +import java.util.List; + +/** + * @author huamile + */ +@Data +public class YwSceneVo { + + @Excel(name = "ID",sort = 1) + private Long id; + + @Excel(name = "场馆名称",width = 20,sort = 2) + private String venueName; + + private String venueDesc; + + @Excel(name = "场馆地址",width = 20,sort = 3) + private String venueAddress; + + private String cityId; + + @Excel(name = "地市",width = 20,sort = 4) + private String city; + + private String areaCountyId; + + @Excel(name = "区县",width = 20,sort = 5) + private String county; + + @Excel(name = "经度",width = 20,sort = 6) + private Double latitude; + + @Excel(name = "纬度",width = 20,sort = 7) + private Double longitude; + + @Excel(name = "签到范围",width = 20,sort = 8) + private Integer signScope; + + private String venueType; + + @Excel(name = "场馆属性",width = 20,sort = 9) + private String venueTypeName; + + private String venueLevel; + + @Excel(name = "级别",width = 20,sort = 10) + private String venueLevelName; + + private Integer accPerson; + + private Integer status; + + private String statusName; + + @Excel(name = "所属场景ID",sort = 11) + private Long sceneBigId; + + @Excel(name = "简称",width = 20,sort = 12) + private String venueShortname; + + private String englishName; + + @Excel(name = "英文简称",width = 20,sort = 13) + private String englishShortname; + + private String maintainType; + + @Excel(name = "维护类型",width = 20,sort = 14) + private String maintainTypeName; + + @Excel(name = "GCJ02经度",width = 20,sort = 15) + private Double longitudeGcj02; + + @Excel(name = "GCJ02纬度",width = 20,sort = 16) + private Double latitudeGcj02; + + private List files; + + private List userIds; + + private String matchType; + + @Excel(name = "场馆类别",readConverterExp="1=场,2=馆", sort = 17) + private String venueCategory; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignLogStaticVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignLogStaticVo.java new file mode 100644 index 0000000000000000000000000000000000000000..8a63ede12166ba735c0adaa72719d3e97c37c929 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignLogStaticVo.java @@ -0,0 +1,27 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +@Data +public class YwSignLogStaticVo { + + private Long sceneId; + + @Excel(name = "场馆名称", sort = 1) + private String venueName; + + @Excel(name = "总人数", sort = 2) + private long allNum; + + @Excel(name = "签到人数", sort = 3) + private long finishNum; + + @Excel(name = "签到率", sort = 4) + private String strFinishRate; + + private double finishRate; + + private String fileUrl; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignLogVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignLogVo.java new file mode 100644 index 0000000000000000000000000000000000000000..312c03ffc60834d09de6b16abf00909e909cee00 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignLogVo.java @@ -0,0 +1,93 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class YwSignLogVo { + + private Long signPlanId; + + private Date beginTime; + + private Date endTime; + + @Excel(name = "应签到时间",sort = 7) + private String strBeginTime; + + @Excel(name = "应签退时间",sort = 12) + private String strEndTime; + + private Long userId; + + @Excel(name = "人员",sort = 4) + private String nickName; + + @Excel(name = "专业",sort = 6) + private String userTypeName; + + private String[] roleNames; + + private List sceneUser; + + @Excel(name = "场馆",sort = 3) + private String venueName; + + @Excel(name = "地市",sort = 1) + private String city; + + @Excel(name = "区县",sort = 2) + private String county; + + private Date signInTime; + + @Excel(name = "签到时间",sort = 8) + private String strSignInTime; + + @Excel(name = "签到经度",sort = 9) + private Double signInJ; + + @Excel(name = "签到纬度",sort = 10) + private Double signInW; + + private Long isDaiSignIn; + + private Date signOutTime; + + @Excel(name = "签退时间",sort = 13) + private String strSignOutTime; + + @Excel(name = "签退经度",sort = 14) + private Double signOutJ; + + @Excel(name = "签退纬度",sort = 15) + private Double signOutW; + + //签到状态显示值 + @Excel(name = "签到状态",sort = 11) + private String signType; + + //签到状态值 + private String signStatus; + + @Excel(name = "考勤",sort = 16) + private String checkType; + + @Excel(name = "所属区域",sort = 5) + private String belongArea; + + private String venueType; + + private String maintainType; + + private Double latitude; + + private Double longitude; + + private Integer signScope; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignPlanVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignPlanVo.java new file mode 100644 index 0000000000000000000000000000000000000000..55eba009da971059b2d4bd3101d18b223dcf5f97 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignPlanVo.java @@ -0,0 +1,73 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.entity.SysUser; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class YwSignPlanVo { + + private Long id; + + private Long sceneId; + + private Date signDate; + + private Date beginTime; + + private Date endTime; + + @Excel(name = "签到日期",cellType = Excel.ColumnType.STRING , sort = 5) + private String strSignDate; + + @Excel(name = "早签到时间",cellType = Excel.ColumnType.STRING, sort = 6) + private String strBeginTime; + + @Excel(name = "晚签到时间",cellType = Excel.ColumnType.STRING, sort = 7) + private String strEndTime; + + @Excel(name = "提醒时间量",sort = 8) + private String repWarnInterval; + + private Integer repSignInterval; + + @Excel(name = "状态",sort = 10,readConverterExp = "0=关闭,1=开启") + private String isOpen; + + private String areaCountyId; + + private String noticeType; + + @Excel(name = "通知方式",sort = 9) + private String noticeTypeName; + + @Excel(name = "场馆" ,sort = 1) + private String venueName; + + @Excel(name = "北纬" ,sort = 2) + private Double latitude; + + @Excel(name = "东经" ,sort = 3) + private Double longitude; + + @Excel(name = "签到范围(米)",sort = 4) + private Integer signScope; + + private String city; + + private String county; + + private Integer signNum; + + private List signUsers; + + private Date updateTime; + +// @Excel(name = "应签到人数",sort = 11) +// private Integer signUsersNum; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignUserVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignUserVo.java new file mode 100644 index 0000000000000000000000000000000000000000..bfa435cbf0ef69e85b67ce7cce68a7a316c9c644 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignUserVo.java @@ -0,0 +1,12 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Data; + +@Data +public class YwSignUserVo { + + private Long userId; + + private String userName; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignVo.java new file mode 100644 index 0000000000000000000000000000000000000000..f13ea282ae57bef1a0cbf0e567a3ab8717163c26 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSignVo.java @@ -0,0 +1,21 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class YwSignVo { + + //false不可签到 true可 + private Boolean couldSign; + //不可签到类型 + /** + * 1、时间不允许 + * 2、地理位置不允许 + * 3、时间和地理位置都不允许 + */ + private Integer failType; + //不可签到原因 + private String failMsg; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSparePartsVO.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSparePartsVO.java new file mode 100644 index 0000000000000000000000000000000000000000..9b861a793007469186273c3569e0f3b41e7386a1 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwSparePartsVO.java @@ -0,0 +1,122 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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 java.io.Serializable; +import java.time.LocalDateTime; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * 亚运备件表VO + *

+ * + * @author yqf + * @since 2023-08-31 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class YwSparePartsVO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("序号") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @Excel(name = "场馆名称", type = Excel.Type.ALL, sort = 1) + @ApiModelProperty("场馆名称") + @TableField("venue_name") + private String venueName; + + @Excel(name = "场馆类型", type = Excel.Type.ALL, sort = 2) + @ApiModelProperty("场馆类型") + @TableField("venue_type") + private String venueType; + + @Excel(name = "设备类型", type = Excel.Type.ALL, sort = 3) + @ApiModelProperty("设备类型") + @TableField("device_type") + private String deviceType; + + @Excel(name = "单板型号", type = Excel.Type.ALL, sort = 4) + @ApiModelProperty("单板型号") + @TableField("board_model") + private String boardModel; + + @Excel(name = "单板数量", type = Excel.Type.ALL, sort = 5) + @ApiModelProperty("单板数量") + @TableField("board_num") + private String boardNum; + + @Excel(name = "备件型号", type = Excel.Type.ALL, sort = 6) + @ApiModelProperty("备件型号") + @TableField("part_model") + private String partModel; + + @Excel(name = "通用数量", type = Excel.Type.ALL, sort = 7) + @ApiModelProperty("通用数量") + @TableField("current_num") + private String currentNum; + + @Excel(name = "需求数量", type = Excel.Type.ALL, sort = 8) + @ApiModelProperty("需求数量") + @TableField("need_num") + private String needNum; + + @Excel(name = "配置数量", type = Excel.Type.ALL, sort = 9) + @ApiModelProperty("配置数量") + @TableField("configure_num") + private String configureNum; + + @Excel(name = "缺口", type = Excel.Type.ALL, sort = 10) + @ApiModelProperty("缺口") + @TableField("gap_num") + private String gapNum; + + @Excel(name = "专业", type = Excel.Type.ALL, sort = 11) + @ApiModelProperty("专业") + @TableField("major") + private String major; + + @Excel(name = "备注", type = Excel.Type.ALL, sort = 12) + @ApiModelProperty("备注") + @TableField("comment") + private String comment; + + @Excel(name = "联系人", type = Excel.Type.ALL, sort = 13) + @ApiModelProperty("联系人") + @TableField("contacts") + private String contacts; + + @Excel(name = "联系电话", type = Excel.Type.ALL, sort = 14) + @ApiModelProperty("联系电话") + @TableField("telephone") + private String telephone; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("创建时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwWireTaskLogVo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwWireTaskLogVo.java new file mode 100644 index 0000000000000000000000000000000000000000..5d443fafb164d6dcad9788af2955d339daa2dfd7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/vo/YwWireTaskLogVo.java @@ -0,0 +1,112 @@ +package com.ruoyi.eastcom_yw.domain.vo; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.eastcom_yw.domain.dto.CommonDTO; +import lombok.Data; + +import java.util.Date; + +/** + * @author jkj + */ +@Data +public class YwWireTaskLogVo { + + private Long id; + /** + * 创建时间 + */ + private Date createTime; + + private String flwProcessid; + + private String taskId; + /** + * 结束时间 + */ + private Date endTime; + + @Excel(name = "任务开始时间",sort = 8) + private String strCreateTime; + + @Excel(name = "任务结束时间",sort = 9) + private String strEndTime; + + @Excel(name = "创建人",sort = 7) + private String createName; + + @Excel(name = "任务单号",sort = 1) + private String wireTaskId; + + @Excel(name = "任务名称",sort = 2) + private String wireTaskName; + + @Excel(name = "任务类型", readConverterExp = "1=临时布线,2=布线拆除", sort = 6) + private Integer taskType; + + private Long venueId; + + @Excel(name = "当前环节",sort = 10) + private String curStep; + + @Excel(name = "当前处理组",sort = 11) + private String dealUser; + + @Excel(name = "场馆",sort = 5) + private String venueName; + + @Excel(name = "地市",sort = 3) + private String city; + + @Excel(name = "区县",sort = 4) + private String county; + + /** + * 施工单位 + */ + private String construcUnit; + + //是否拆线 + private Integer isRemove; + + //是否结算 + private Integer isSettle; + + //报告路径 + private String report; + + //是否当前登录用户待办 0否 1是 + private int isTodo; + + @Excel(name = "任务子类",readConverterExp = "1=AGIS专网,2=互联网专网,3=固话专网",sort = 12) + private String taskSubType; + + @Excel(name = "比赛名称",sort = 13) + private String scxx; + + @Excel(name = "任务描述",sort = 14) + private String rwms; + + @Excel(name = "任务审核结果", readConverterExp = "0=驳回,1=通过",sort = 15) + private Integer shjg; + + @Excel(name = "任务审核说明",sort = 16) + private String shsm; + + @Excel(name = "图纸说明",sort = 17) + private String tzsm; + + @Excel(name = "图纸确认结果", readConverterExp = "0=驳回,1=通过",sort = 18) + private Integer tzjg; + + @Excel(name = "图纸确认说明",sort = 19) + private String tzqrsm; + + @Excel(name = "现场验收结果", readConverterExp = "0=驳回,1=通过",sort = 20) + private Integer ysjg; + + @Excel(name = "现场验收说明",sort = 21) + private String yssm; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/yw_alarm_deal_log.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/yw_alarm_deal_log.java new file mode 100644 index 0000000000000000000000000000000000000000..aff6c97dd2790551357bcd7febf92d5b52861620 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/yw_alarm_deal_log.java @@ -0,0 +1,59 @@ +package com.ruoyi.eastcom_yw.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("yw_alarm_deal_log") +public class yw_alarm_deal_log implements Serializable { + private static final long serialVersionUID=1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + private String alarmCode; + + private String alarmType; + + private String groupColnum; + + private String flwProcessid; + + private String dealUser; + + private String dealStatus; + + private Date beginTime; + + private Date endTime; + + private Long sceneBigId; + + private String primaryId; + + private String isRed; + + private Long sceneId; + + private Date alarmTime; + + private Integer hangupTimespan; + + private Long groupId; + + private String record; + + private String siteType; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/yw_alarm_deal_res.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/yw_alarm_deal_res.java new file mode 100644 index 0000000000000000000000000000000000000000..ac8377704d90138e7cf80599aa006f5548ec8765 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/domain/yw_alarm_deal_res.java @@ -0,0 +1,34 @@ +package com.ruoyi.eastcom_yw.domain; + +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 lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("v_yw_alarm_deal") +public class yw_alarm_deal_res implements Serializable { + + private static final long serialVersionUID=1L; + + private Long id; + + private String flwProcessid; + + private Date endTime; + + private String assignee; + + private String processstatus; + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImportSpareParts.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImportSpareParts.java new file mode 100644 index 0000000000000000000000000000000000000000..eea55b00ff98bd9c58aae25e4f8e443d4835702a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImportSpareParts.java @@ -0,0 +1,149 @@ +package com.ruoyi.eastcom_yw.importer; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSpareParts; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSparePartsDTO; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.mapper.YwSparePartsMapper; +import lombok.RequiredArgsConstructor; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; + +/** + * @author yqf + * @date 2023/8/31 + */ +@RequiredArgsConstructor +public class ImportSpareParts extends ImporterBase implements YwBatchAddService { + + + private final YwSparePartsMapper ywSparePartsMapper; + + { + cellFormatBeans.add(new CellFormatBean("场馆名称", "venueName", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆类型", "venueType", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("设备类型", "deviceType", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("单板型号", "boardModel", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("单板数量", "boardNum", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("备件型号", "partModel", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("通用数量", "currentNum", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("需求数量", "needNum", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("配置数量", "configureNum", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("缺口", "gapNum", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("专业", "major", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("备注", "comment", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("联系人", "contacts", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("联系电话", "telephone", "", "", "", "", "", "", "")); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @param j 列 + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + + } + + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + + String userName = SecurityUtils.getUsername(); + + + datas.forEach(x -> x.setCreateBy(userName)); + datas.forEach(x -> x.setCreateTime(LocalDateTime.now())); + + + ywSparePartsMapper.deleteAllData(); + + add(datas); + + } + + + /** + * 实现类提供具体插入方法 + * + * @param collect 数据 + */ + @Override + public void insertB(List collect) { + ywSparePartsMapper.insertBatch(collect); + } + + private boolean judgeIfEdit(YwSceneDTO dto, List scenes) { + for (YwScene ywScene : scenes) { + if (StringUtils.isNotEmpty(ywScene.getVenueName()) && dto.getVenueName().equals(ywScene.getVenueName()) & + dto.getSceneBigId().equals(ywScene.getSceneBigId())) { + dto.setId(ywScene.getId()); + return true; + } + } + return false; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterAgis.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterAgis.java new file mode 100644 index 0000000000000000000000000000000000000000..2874abe4d3a1206a70b16802d230db21d7f84b80 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterAgis.java @@ -0,0 +1,168 @@ +package com.ruoyi.eastcom_yw.importer; + +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.common.constant.NetElementConstants; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementAgis; +import com.ruoyi.eastcom_yw.mapper.YwSceneNetelementAgisMapper; +import com.ruoyi.common.importer.service.YwBatchAddService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author los + */ +@Slf4j +@RequiredArgsConstructor +public class ImporterAgis extends ImporterBase implements YwBatchAddService { + + private final YwSceneNetelementAgisMapper ywSceneNetelementAgisMapper; + + private String sceneName; + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行-1 + * @param j 列-1 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) { + + if ("sceneName".equals(format.getColumnEn())) { + if (isNotEmpty(s)) { + sceneName = (String) args[1]; + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType) && !sceneName.equals(s)) { + reasonS.append("单场馆覆盖导入模式下只能导入指定场馆。"); + } + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType) && s.contains("|")) { + reasonS.append("单场馆覆盖导入模式下场馆列不能包含|。"); + } + List ywSceneList = (List) args[0]; + List sceneNameList = ywSceneList.stream().map(x -> x.getVenueName()).collect(Collectors.toList()); + if (s.contains("|")) { + String[] str = s.split("\\|"); + for (String st : str) { + if (!sceneNameList.contains(st)) { + if (!reasonS.toString().contains("场馆不存在")) { + reasonS.append("场馆不存在。"); + } + } + } + } else { + if (!sceneNameList.contains(s)) { + reasonS.append("场馆不存在。"); + } + } + } + } + + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) { + + // 获取大场景下场馆信息 + List ywSceneList = (List) args[0]; + // 导入 + List list = new ArrayList<>(); + for (YwSceneNetelementAgis y : datas) { + if (y.getSceneName().contains("|")) { + String[] str = y.getSceneName().split("\\|"); + for (String s : str) { + YwSceneNetelementAgis n = new YwSceneNetelementAgis(); + BeanUtils.copyBeanProp(n, y); + n.setSceneName(s); + list.add(n); + } + } else { + list.add(y); + } + } + for (YwSceneNetelementAgis y : list) { + for (YwScene ywScene : ywSceneList) { + if (StringUtils.isNotEmpty(y.getSceneName()) && y.getSceneName().equals(ywScene.getVenueName())) { + y.setSceneId(ywScene.getId()); + break; + } + } + y.setAlarmSpecityId(DictUtils.getDictValue("yw_alarm_specialty", y.getAlarmSpecityName())); + y.setUpdateBy(SecurityUtils.getUsername()); + y.setUpdateTime(DateUtils.getNowDate()); + } + List collect = list.stream().filter(x -> x.getSceneId() != null).collect(Collectors.toList()); + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType)) { + ywSceneNetelementAgisMapper.deleteBySceneId(collect.get(0).getSceneId()); + } else { + ywSceneNetelementAgisMapper.deleteBySceneBigId(sceneBigId); + } + add(collect); + + } + + /** + * 实现类提供具体插入方法 + */ + @Override + public void insertB(List collect) { + ywSceneNetelementAgisMapper.insertBatch(collect); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterCalendar.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterCalendar.java new file mode 100644 index 0000000000000000000000000000000000000000..f3c2eb820a91d29647be5bd42788ebc2fafc38c7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterCalendar.java @@ -0,0 +1,223 @@ +package com.ruoyi.eastcom_yw.importer; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneCalendar; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendar2Vo; +import com.ruoyi.eastcom_yw.mapper.YwSceneCalendarMapper; +import lombok.RequiredArgsConstructor; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@RequiredArgsConstructor +public class ImporterCalendar extends ImporterBase implements YwBatchAddService { + + private final YwSceneCalendarMapper ywSceneCalendarMapper; + private String matchDate; + private String beginTime; + private String endTime; + + { + cellFormatBeans.add(new CellFormatBean("编号", "idStr", "", "", "true", "positiveInt", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆", "venueName", "false", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("比赛类型", "matchTypeName", "true", "", "", "", "", "yw_match_type", "", "")); + cellFormatBeans.add(new CellFormatBean("比赛名称", "matchName", "false", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("比赛日期", "matchDate", "false", "true", "", "", "yyyy-MM-dd", "", "", "")); + cellFormatBeans.add(new CellFormatBean("开始时间", "beginTime", "false", "true", "", "", "HH:mm", "", "", "")); + cellFormatBeans.add(new CellFormatBean("结束时间", "endTime", "false", "true", "", "", "HH:mm", "", "", "")); + cellFormatBeans.add(new CellFormatBean("状态", "statusName", "", "", "", "", "", "", "启用,停用", "")); + cellFormatBeans.add(new CellFormatBean("备注", "matchRemark", "", "", "", "", "", "", "", "")); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + if (isNotEmpty(beginTime) && isNotEmpty(endTime)) { + if (DateUtils.parseDate(endTime, "HH:mm"). + compareTo(DateUtils.parseDate(beginTime, "HH:mm")) <= 0) { + reasonL.append("结束时间必须晚于开始时间。"); + } + } + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @param j 列 + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + if (isNotEmpty(s)) { + if ("venueName".equals(format.getColumnEn())) { + String[] str = s.split("\\|"); + for (String s1 : str) { + if (!checkSceneExists(s1, (List) args[0])) { + reasonS.append("场馆[").append(s1).append("]不存在。"); + } + } + } else if ("matchDate".equals(format.getColumnEn())) { + matchDate = s; + if (DateUtils.parseDate(s, "yyyy-MM-dd"). + compareTo(DateUtils.parseDate(DateUtils.getDate())) < 0) { + reasonS.append("比赛日期不能早于当前日期。"); + } + } else if ("beginTime".equals(format.getColumnEn())) { + beginTime = s; + if (DateUtils.parseDate(matchDate + " " + s, "yyyy-MM-dd HH:mm"). + compareTo(DateUtils.getNowDate()) < 0) { + reasonS.append("开始时间不能早于当前时间。"); + } + } else if ("endTime".equals(format.getColumnEn())) { + endTime = s; + } + } + } + + private boolean checkSceneExists(String s, List ywSceneList) { + for (YwScene ywScene : ywSceneList) { + if (s.equals(ywScene.getVenueName())) { + return true; + } + } + return false; + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + // 导入 + List list = new ArrayList<>(); + for (YwSceneCalendar2Vo y : datas) { + String[] str = y.getVenueName().split("\\|"); + for (String s : str) { + YwSceneCalendar2Vo n = new YwSceneCalendar2Vo(); + BeanUtils.copyBeanProp(n, y); + n.setVenueName(s); + list.add(n); + } + } + for (YwSceneCalendar2Vo y : list) { + for (YwScene ywScene : (List) args[0]) { + if (StringUtils.isNotEmpty(y.getVenueName()) && y.getVenueName().equals(ywScene.getVenueName())) { + y.setSceneId(ywScene.getId()); + break; + } + } + y.setMatchType(DictUtils.getDictValue("yw_match_type", y.getMatchTypeName())); + if ("停用".equals(y.getStatusName())) { + y.setStatus("1"); + } else if ("启用".equals(y.getStatusName())) { + y.setStatus("0"); + } else { + y.setStatus("0"); + } + y.setId(isEmpty(y.getIdStr()) ? null : Long.parseLong(y.getIdStr())); + } + List collect = list.stream().filter(x -> x.getSceneId() != null).collect(Collectors.toList()); + String ids = ywSceneCalendarMapper.selectIds(sceneBigId); + if ("0".equals(importType)) { + ywSceneCalendarMapper.deleteBySceneBigId(sceneBigId); + for (YwSceneCalendar2Vo x : collect) { + x.setCreateBy(SecurityUtils.getUsername()); + x.setCreateTime(DateUtils.getNowDate()); + } + add(collect); + } else { + for (YwSceneCalendar2Vo v : collect) { + YwSceneCalendar ywSceneCalendar = new YwSceneCalendar(); + BeanUtils.copyBeanProp(ywSceneCalendar, v); + ywSceneCalendar.setId(v.getId()); + ywSceneCalendar.setBeginTime(DateUtils.parseDate(v.getBeginTime(), "HH:mm")); + ywSceneCalendar.setEndTime(DateUtils.parseDate(v.getEndTime(), "HH:mm")); + ywSceneCalendar.setMatchDate(DateUtils.parseDate(v.getMatchDate(), "yyyy-MM-dd")); + ywSceneCalendar.setMatchRemark(v.getMatchRemark()); + boolean exists = ywSceneCalendarMapper.exists(new LambdaQueryWrapper() +// .eq(YwSceneCalendar::getId, v.getId()) + .eq(YwSceneCalendar::getSceneId, v.getSceneId()) + .eq(YwSceneCalendar::getMatchType, v.getMatchType()) + .eq(YwSceneCalendar::getMatchName, v.getMatchName()) + .eq(YwSceneCalendar::getBeginTime, ywSceneCalendar.getBeginTime()) + .eq(YwSceneCalendar::getEndTime, ywSceneCalendar.getEndTime()) + .eq(YwSceneCalendar::getStatus, v.getStatus()) + .eq(YwSceneCalendar::getMatchRemark, v.getMatchRemark()) + ); +// if (ywSceneCalendar.getId() == null || !Arrays.asList(ids.split(",")).contains(String.valueOf(ywSceneCalendar.getId()))) { + if (!exists) { + ywSceneCalendar.setId(null); + ywSceneCalendar.setCreateBy(SecurityUtils.getUsername()); + ywSceneCalendar.setCreateTime(DateUtils.getNowDate()); + ywSceneCalendarMapper.insert(ywSceneCalendar); + } +// else { +// ywSceneCalendar.setUpdateBy(SecurityUtils.getUsername()); +// ywSceneCalendar.setUpdateTime(DateUtils.getNowDate()); +// ywSceneCalendarMapper.updateById(ywSceneCalendar); +// } + } + } + } + + /** + * 实现类提供具体插入方法 + * + * @param collect 数据 + */ + @Override + public void insertB(List collect) { + ywSceneCalendarMapper.insertBatch(collect); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterCs.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterCs.java new file mode 100644 index 0000000000000000000000000000000000000000..60abba060e9c080a75bb96c8d753ae138332a55b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterCs.java @@ -0,0 +1,184 @@ +package com.ruoyi.eastcom_yw.importer; + +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.common.constant.NetElementConstants; +import com.ruoyi.eastcom_yw.common.enums.InRedLine; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementCs; +import com.ruoyi.eastcom_yw.mapper.YwSceneNetelementCsMapper; +import com.ruoyi.common.importer.service.YwBatchAddService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@RequiredArgsConstructor +@Slf4j +public class ImporterCs extends ImporterBase implements YwBatchAddService { + + private final YwSceneNetelementCsMapper ywSceneNetelementCsMapper; + + private String sceneName; + + /** + * 实现类提供具体插入方法 + * + * @param collect + */ + @Override + public void insertB(List collect) { + ywSceneNetelementCsMapper.insertBatch(collect); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @param j + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + + if ("sceneName".equals(format.getColumnEn())) { + if (isNotEmpty(s)) { + sceneName = (String) args[1]; + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType) && !sceneName.equals(s)) { + reasonS.append("单场馆覆盖导入模式下只能导入指定场馆。"); + } + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType) && s.contains("|")) { + reasonS.append("单场馆覆盖导入模式下场馆列不能包含|。"); + } + List ywSceneList = (List) args[0]; + List sceneNameList = ywSceneList.stream().map(x -> x.getVenueName()).collect(Collectors.toList()); + if (s.contains("|")) { + String[] str = s.split("\\|"); + for (String st : str) { + if (!sceneNameList.contains(st)) { + if (!reasonS.toString().contains("场馆不存在")) { + reasonS.append("场馆不存在。"); + } + } + } + } else { + if (!sceneNameList.contains(s)) { + reasonS.append("场馆不存在。"); + } + } + } + } + + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + + List ywSceneList = (List) args[0]; + + // 导入 + List list = new ArrayList<>(); + for (YwSceneNetelementCs y : datas) { + if (y.getSceneName().contains("|")) { + String[] str = y.getSceneName().split("\\|"); + for (String s : str) { + YwSceneNetelementCs n = new YwSceneNetelementCs(); + BeanUtils.copyBeanProp(n, y); + n.setSceneName(s); + list.add(n); + } + } else { + list.add(y); + } + } + for (YwSceneNetelementCs y : list) { + if (isNotEmpty(y.getAttributeA()) && InRedLine.IN_RED_LINE.getLabel().equals(y.getAttributeA())) { + y.setAttributeA(InRedLine.IN_RED_LINE.getCode()); + } else if (isNotEmpty(y.getAttributeA()) && InRedLine.NOT_IN_RED_LINE.getLabel().equals(y.getAttributeA())) { + y.setAttributeA(InRedLine.NOT_IN_RED_LINE.getCode()); + } else { + y.setAttributeA(""); + } + + if (isNotEmpty(y.getAttributeZ()) && InRedLine.IN_RED_LINE.getLabel().equals(y.getAttributeZ())) { + y.setAttributeZ(InRedLine.IN_RED_LINE.getCode()); + } else if (isNotEmpty(y.getAttributeZ()) && InRedLine.NOT_IN_RED_LINE.getLabel().equals(y.getAttributeZ())) { + y.setAttributeZ(InRedLine.NOT_IN_RED_LINE.getCode()); + } else { + y.setAttributeZ(""); + } + for (YwScene ywScene : ywSceneList) { + if (isNotEmpty(y.getSceneName()) && y.getSceneName().equals(ywScene.getVenueName())) { + y.setSceneId(ywScene.getId()); + break; + } + } + y.setUpdateBy(SecurityUtils.getUsername()); + y.setUpdateTime(DateUtils.getNowDate()); + } + + List collect = list.stream().filter(x -> x.getSceneId() != null).collect(Collectors.toList()); + + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType)) { + ywSceneNetelementCsMapper.deleteBySceneId(collect.get(0).getSceneId()); + } else { + ywSceneNetelementCsMapper.deleteBySceneBigId(sceneBigId); + } + add(collect); + + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterDh.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterDh.java new file mode 100644 index 0000000000000000000000000000000000000000..d5c7c8bc427211ce69d1a22f58f6fa5f94d5bbe5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterDh.java @@ -0,0 +1,176 @@ +package com.ruoyi.eastcom_yw.importer; + +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.common.constant.NetElementConstants; +import com.ruoyi.eastcom_yw.common.enums.InRedLine; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementDh; +import com.ruoyi.eastcom_yw.mapper.YwSceneNetelementDhMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Slf4j +@RequiredArgsConstructor +public class ImporterDh extends ImporterBase implements YwBatchAddService { + + private final YwSceneNetelementDhMapper ywSceneNetelementDhMapper; + + private String sceneName; + + /** + * 实现类提供具体插入方法 + * + * @param collect + */ + @Override + public void insertB(List collect) { + ywSceneNetelementDhMapper.insertBatch(collect); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @param j + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + if ("sceneName".equals(format.getColumnEn())) { + if (isNotEmpty(s)) { + sceneName = (String) args[1]; + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType) && !sceneName.equals(s)) { + reasonS.append("单场馆覆盖导入模式下只能导入指定场馆。"); + } + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType) && s.contains("|")) { + reasonS.append("单场馆覆盖导入模式下场馆列不能包含|。"); + } + List ywSceneList = (List) args[0]; + List sceneNameList = ywSceneList.stream().map(x -> x.getVenueName()).collect(Collectors.toList()); + if (s.contains("|")) { + String[] str = s.split("\\|"); + for (String st : str) { + if (!sceneNameList.contains(st)) { + if (!reasonS.toString().contains("场馆不存在")) { + reasonS.append("场馆不存在。"); + } + } + } + } else { + if (!sceneNameList.contains(s)) { + reasonS.append("场馆不存在。"); + } + } + } + } + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + + // 获取大场景下场馆信息 + List ywSceneList = (List) args[0]; + + // 导入 + List list = new ArrayList<>(); + for (YwSceneNetelementDh y : datas) { + if (y.getSceneName().contains("|")) { + String[] str = y.getSceneName().split("\\|"); + for (String s : str) { + YwSceneNetelementDh n = new YwSceneNetelementDh(); + BeanUtils.copyBeanProp(n, y); + n.setSceneName(s); + list.add(n); + } + } else { + list.add(y); + } + } + + for (YwSceneNetelementDh y : list) { + if (InRedLine.IN_RED_LINE.getLabel().equals(y.getInRedline())) { + y.setInRedline(InRedLine.IN_RED_LINE.getCode()); + } else if (InRedLine.NOT_IN_RED_LINE.getLabel().equals(y.getInRedline())) { + y.setInRedline(InRedLine.NOT_IN_RED_LINE.getCode()); + } else { + y.setInRedline(""); + } + for (YwScene ywScene : ywSceneList) { + if (isNotEmpty(y.getSceneName()) && y.getSceneName().equals(ywScene.getVenueName())) { + y.setSceneId(ywScene.getId()); + y.setCity(StringUtils.isNotEmpty(ywScene.getCityId()) ? DictUtils.getDictLabel("yw_city", ywScene.getCityId()) : ""); + y.setCounty(StringUtils.isNotEmpty(ywScene.getAreaCountyId()) ? DictUtils.getDictLabel("yw_county", ywScene.getAreaCountyId()) : ""); + break; + } + } + y.setUpdateBy(SecurityUtils.getUsername()); + y.setUpdateTime(DateUtils.getNowDate()); + } + List collect = list.stream().filter(x -> x.getSceneId() != null).collect(Collectors.toList()); + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType)) { + ywSceneNetelementDhMapper.deleteBySceneId(collect.get(0).getSceneId()); + } else { + ywSceneNetelementDhMapper.deleteBySceneBigId(sceneBigId); + } + add(collect); + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterMatch.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterMatch.java new file mode 100644 index 0000000000000000000000000000000000000000..02220f6da3ca00a91a13832c74332976fca92056 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterMatch.java @@ -0,0 +1,198 @@ +package com.ruoyi.eastcom_yw.importer; + +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneMatchVo; +import com.ruoyi.eastcom_yw.mapper.YwSceneMatchMapper; +import lombok.RequiredArgsConstructor; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +@RequiredArgsConstructor +public class ImporterMatch extends ImporterBase implements YwBatchAddService { + + private final YwSceneMatchMapper ywSceneMatchMapper; + + { + cellFormatBeans.add(new CellFormatBean("编号", "idStr", "", "", "true", "positiveInt", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆名称", "sceneName", "false", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("赛程类型", "taskTypeName", "false", "", "", "", "", "yw_match_type", "", "")); + cellFormatBeans.add(new CellFormatBean("赛程名称", "taskName", "false", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("开始时间", "beginTimeStr", "false", "true", "", "", "yyyy-MM-dd HH:mm:ss", "", "", "")); + cellFormatBeans.add(new CellFormatBean("结束时间", "endTimeStr", "false", "true", "", "", "yyyy-MM-dd HH:mm:ss", "", "", "")); + cellFormatBeans.add(new CellFormatBean("赛程状态", "taskStatusName", "", "", "", "", "", "", "启用,停用", "")); + } + + private String beginTime; + + private String endTime; + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + if (isNotEmpty(beginTime) && isNotEmpty(endTime)) { + if (DateUtils.parseDate(endTime, "yyyy-MM-dd HH:mm:ss"). + compareTo(DateUtils.parseDate(beginTime, "yyyy-MM-dd HH:mm:ss")) <= 0) { + reasonL.append("结束时间必须晚于开始时间"); + } + } + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @param j 列 + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + if (isNotEmpty(s)) { + if ("sceneName".equals(format.getColumnEn())) { + String[] str = s.split("\\|"); + for (String s1 : str) { + if (!checkSceneExists(s1, (List) args[0])) { + reasonS.append("场馆[").append(s1).append("]不存在"); + } + } + } else if ("beginTimeStr".equals(format.getColumnEn())) { + beginTime = s; + if (DateUtils.parseDate(s, "yyyy-MM-dd HH:mm:ss").compareTo(DateUtils.getNowDate()) < 0) { + reasonS.append("开始时间不能早于当前时间。"); + } + } else if ("endTimeStr".equals(format.getColumnEn())) { + endTime = s; + } + } + } + + private boolean checkSceneExists(String sceneName, List ywSceneList) { + for (YwScene ywScene : ywSceneList) { + if (sceneName.equals(ywScene.getVenueName())) { + return true; + } + } + return false; + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + List list = new ArrayList<>(); + for (YwSceneMatchVo y : datas) { + String[] str = y.getSceneName().split("\\|"); + for (String s : str) { + YwSceneMatchVo n = new YwSceneMatchVo(); + BeanUtils.copyBeanProp(n, y); + n.setSceneName(s); + list.add(n); + } + } + for (YwSceneMatchVo y : list) { + for (YwScene ywScene : (List) args[0]) { + if (StringUtils.isNotEmpty(y.getSceneName()) && y.getSceneName().equals(ywScene.getVenueName())) { + y.setSceneId(ywScene.getId()); + break; + } + } + if ("停用".equals(y.getTaskStatusName())) { + y.setTaskStatus("1"); + } else if ("启用".equals(y.getTaskStatusName())) { + y.setTaskStatus("0"); + } else { + y.setTaskStatus("0"); + } + y.setId(isEmpty(y.getIdStr()) ? null : Long.parseLong(y.getIdStr())); + y.setTaskType(DictUtils.getDictValue("yw_match_type", y.getTaskTypeName())); + } + List collect = list.stream().filter(x -> x.getSceneId() != null).collect(Collectors.toList()); + String ids = ywSceneMatchMapper.selectIds(sceneBigId); + if ("0".equals(importType)) { + ywSceneMatchMapper.deleteBySceneBigId(sceneBigId); + for (YwSceneMatchVo x : collect) { + x.setBeginTime(DateUtils.parseDate(x.getBeginTimeStr(), "yyyy-MM-dd HH:mm:ss")); + x.setEndTime(DateUtils.parseDate(x.getEndTimeStr(), "yyyy-MM-dd HH:mm:ss")); + x.setCreateBy(SecurityUtils.getUsername()); + x.setCreateTime(DateUtils.getNowDate()); + } + add(collect); + } else { + for (YwSceneMatchVo v : collect) { + v.setBeginTime(DateUtils.parseDate(v.getBeginTimeStr(), "yyyy-MM-dd HH:mm:ss")); + v.setEndTime(DateUtils.parseDate(v.getEndTimeStr(), "yyyy-MM-dd HH:mm:ss")); + if (v.getId() == null || !Arrays.asList(ids.split(",")).contains(String.valueOf(v.getId()))) { + v.setId(null); + v.setCreateBy(SecurityUtils.getUsername()); + v.setCreateTime(DateUtils.getNowDate()); + ywSceneMatchMapper.insert(v); + } else { + v.setUpdateBy(SecurityUtils.getUsername()); + v.setUpdateTime(DateUtils.getNowDate()); + ywSceneMatchMapper.updateById(v); + } + } + } + } + + /** + * 实现类提供具体插入方法 + * + * @param collect 数据 + */ + @Override + public void insertB(List collect) { + ywSceneMatchMapper.insertBatch(collect); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterScene.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterScene.java new file mode 100644 index 0000000000000000000000000000000000000000..14d3856303861a6c9645dbdfed43e64a013c33b7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterScene.java @@ -0,0 +1,172 @@ +package com.ruoyi.eastcom_yw.importer; + +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneDTO; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneUserMapper; +import lombok.RequiredArgsConstructor; + +import java.util.Date; +import java.util.List; + +@RequiredArgsConstructor +public class ImporterScene extends ImporterBase implements YwBatchAddService { + + private final YwSceneMapper ywSceneMapper; + private final YwSceneUserMapper ywSceneUserMapper; + + { + cellFormatBeans.add(new CellFormatBean("场馆标准名称", "venueName", "false", "", "", "", "", "", "true")); + cellFormatBeans.add(new CellFormatBean("场馆简称", "venueShortname", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆英文缩写", "englishShortname", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("维护类别", "maintainType", "", "", "", "", "yw_scene_maintain_type", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆属性", "venueType", "", "", "", "", "yw_scene_type", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆级别", "venueLevel", "", "", "", "", "yw_scene_level", "", "")); + cellFormatBeans.add(new CellFormatBean("经度GPS", "longitudeStr", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("纬度GPS", "latitudeStr", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("经度GCJ02", "longitudeGcj02Str", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("纬度GCJ02", "latitudeGcj02Str", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("所属地市", "city", "false", "", "", "", "yw_city", "", "")); + cellFormatBeans.add(new CellFormatBean("所属区县", "county", "false", "", "", "", "yw_county", "", "")); + cellFormatBeans.add(new CellFormatBean("赛事类型", "matchType", "", "", "", "", "yw_match_type", "", "")); + cellFormatBeans.add(new CellFormatBean("地址", "venueAddress", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("备注", "venueDesc", "", "", "", "", "", "", "")); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @param j 列 + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + + List scenes = ywSceneMapper.selectList(null); + + String userName = SecurityUtils.getUsername(); + + for (YwSceneDTO ywScene : datas) { + String lonStr = ywScene.getLongitudeStr(); + String latStr = ywScene.getLatitudeStr(); + String lonGcjStr = ywScene.getLongitudeGcj02Str(); + String latGcjStr = ywScene.getLatitudeGcj02Str(); + ywScene.setLongitude(isEmpty(lonStr) ? null : Double.parseDouble(lonStr)); + ywScene.setLatitude(isEmpty(latStr) ? null : Double.parseDouble(latStr)); + ywScene.setLongitudeGcj02(isNotEmpty(lonGcjStr) ? Double.parseDouble(lonGcjStr) : null); + ywScene.setLatitudeGcj02(isNotEmpty(latGcjStr) ? Double.parseDouble(latGcjStr) : null); + ywScene.setSceneBigId(sceneBigId); + ywScene.setAreaCountyId(getDictValue("yw_county", ywScene.getCounty())); + ywScene.setCityId(getDictValue("yw_city", ywScene.getCity())); + ywScene.setMaintainType(getDictValue("yw_scene_maintain_type", ywScene.getMaintainType())); + ywScene.setVenueType(getDictValue("yw_scene_type", ywScene.getVenueType())); + ywScene.setVenueLevel(getDictValue("yw_scene_level", ywScene.getVenueLevel())); + + } + + if ("0".equals(importType)) { + // 覆盖导入 + ywSceneUserMapper.deleteBySceneBigId(sceneBigId); + ywSceneMapper.deleteBySceneBigId(sceneBigId); + datas.forEach(x -> x.setCreateBy(userName)); + add(datas); + } else if ("1".equals(importType)) { + // 更新导入 + for (YwSceneDTO ywScene : datas) { + if (!judgeIfEdit(ywScene, scenes)) { + ywScene.setCreateBy(userName); + ywScene.setCreateTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date())); + ywSceneMapper.insertSelective(ywScene); + } else { + ywScene.setUpdateBy(userName); + ywScene.setUpdateTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date())); + ywSceneMapper.updateByPrimaryKeySelective(ywScene); + } + } + } + + } + + /** + * 实现类提供具体插入方法 + * + * @param collect 数据 + */ + @Override + public void insertB(List collect) { + ywSceneMapper.insertBatch(collect); + } + + private boolean judgeIfEdit(YwSceneDTO dto, List scenes) { + for (YwScene ywScene : scenes) { + if (StringUtils.isNotEmpty(ywScene.getVenueName()) && dto.getVenueName().equals(ywScene.getVenueName()) & + dto.getSceneBigId().equals(ywScene.getSceneBigId())) { + dto.setId(ywScene.getId()); + return true; + } + } + return false; + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterSceneNoticeinfo.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterSceneNoticeinfo.java new file mode 100644 index 0000000000000000000000000000000000000000..d5433d76cf31ddb19375952d765452da0d33aeba --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterSceneNoticeinfo.java @@ -0,0 +1,176 @@ +package com.ruoyi.eastcom_yw.importer; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneNoticeinfoSearchDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNoticeinfo; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneNoticeinfoMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; + +@Slf4j +@RequiredArgsConstructor +public class ImporterSceneNoticeinfo extends ImporterBase implements YwBatchAddService { + + private final YwSceneNoticeinfoMapper ywSceneNoticeinfoMapper; + + private final YwSceneMapper ywSceneMapper; + + { + cellFormatBeans.add(new CellFormatBean("场馆名称", "sceneName", "false", "", "", "", "", "", "", "true")); + cellFormatBeans.add(new CellFormatBean("无线网元数", "wxNetNumStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("专网网元数", "agisNetNumStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("动环网元数", "dhNetNumStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("公网传输设备", "publicTransportEquipNumStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("公网接入环", "publicInterfaceRingNumStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("专网传输设备", "privateTransportEquipNumStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("专网接入环", "privateInterfaceRingNumStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("现场保障人数", "frontuserStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("后台保障人数", "backuserStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆部署应急车", "emergencycarStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆部署应急仓", "emergencyWarehouseStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("保障车辆数", "supportcarStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("DICT设备数", "dictEquipNumStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("应急通信车", "emergencyCommunicationCarStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("应急发电车", "emergencyElectricCarStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("应急抢修车", "emergencyRepairCarStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("无线备件数", "wifiSpareStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("疏通备件数", "dredgeSpareStr", "", "", "true", "nonNegative", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("传输备件数", "transSpareStr", "", "", "true", "nonNegative", "", "", "", "")); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @param j 列 + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + if (isNotEmpty(s)) { + if ("sceneName".equals(format.getColumnEn())) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(YwScene::getVenueName, s).eq(YwScene::getSceneBigId, 1); + YwScene ywScene = ywSceneMapper.selectOne(lambdaQueryWrapper); + if (ObjectUtils.isEmpty(ywScene)) { + reasonS.append("场馆不存在。"); + } + } + } + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + for (YwSceneNoticeinfo data : datas) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(YwScene::getVenueName, data.getSceneName()).eq(YwScene::getSceneBigId, 1); + data.setSceneId(ywSceneMapper.selectOne(lambdaQueryWrapper).getId()); + data.setAgisNetNum(StringUtils.isNotEmpty(data.getAgisNetNumStr()) ? Integer.parseInt(data.getAgisNetNumStr()) : null); + data.setWxNetNum(StringUtils.isNotEmpty(data.getWxNetNumStr()) ? Integer.parseInt(data.getWxNetNumStr()) : null); + data.setDhNetNum(StringUtils.isNotEmpty(data.getDhNetNumStr()) ? Integer.parseInt(data.getDhNetNumStr()) : null); + data.setInternetNetNum(StringUtils.isNotEmpty(data.getInternetNetNumStr()) ? Integer.parseInt(data.getInternetNetNumStr()) : null); + data.setPublicTransportEquipNum(StringUtils.isNotEmpty(data.getPublicTransportEquipNumStr()) ? Integer.parseInt(data.getPublicTransportEquipNumStr()) : null); + data.setPublicInterfaceRingNum(StringUtils.isNotEmpty(data.getPublicInterfaceRingNumStr()) ? Integer.parseInt(data.getPublicInterfaceRingNumStr()) : null); + data.setPrivateTransportEquipNum(StringUtils.isNotEmpty(data.getPrivateTransportEquipNumStr()) ? Integer.parseInt(data.getPrivateTransportEquipNumStr()) : null); + data.setPrivateInterfaceRingNum(StringUtils.isNotEmpty(data.getPrivateInterfaceRingNumStr()) ? Integer.parseInt(data.getPrivateInterfaceRingNumStr()) : null); + data.setFrontuser(StringUtils.isNotEmpty(data.getFrontuserStr()) ? Integer.parseInt(data.getFrontuserStr()) : null); + data.setBackuser(StringUtils.isNotEmpty(data.getBackuserStr()) ? Integer.parseInt(data.getBackuserStr()) : null); + data.setEmergencycar(StringUtils.isNotEmpty(data.getEmergencycarStr()) ? Integer.parseInt(data.getEmergencycarStr()) : null); + data.setEmergencyWarehouse(StringUtils.isNotEmpty(data.getEmergencyWarehouseStr()) ? Integer.parseInt(data.getEmergencyWarehouseStr()) : null); + data.setSupportcar(StringUtils.isNotEmpty(data.getSupportcarStr()) ? Integer.parseInt(data.getSupportcarStr()) : null); + data.setDictEquipNum(StringUtils.isNotEmpty(data.getDictEquipNumStr()) ? Integer.parseInt(data.getDictEquipNumStr()) : null); + data.setEmergencyCommunicationCar(StringUtils.isNotEmpty(data.getEmergencyCommunicationCarStr()) ? Integer.parseInt(data.getEmergencyCommunicationCarStr()) : null); + data.setEmergencyElectricCar(StringUtils.isNotEmpty(data.getEmergencyElectricCarStr()) ? Integer.parseInt(data.getEmergencyElectricCarStr()) : null); + data.setEmergencyRepairCar(StringUtils.isNotEmpty(data.getEmergencyRepairCarStr()) ? Integer.parseInt(data.getEmergencyRepairCarStr()) : null); + data.setWifiSpare(StringUtils.isNotEmpty(data.getWifiSpareStr()) ? Integer.parseInt(data.getWifiSpareStr()) : null); + data.setDredgeSpare(StringUtils.isNotEmpty(data.getDredgeSpareStr()) ? Integer.parseInt(data.getDredgeSpareStr()) : null); + data.setTransSpare(StringUtils.isNotEmpty(data.getTransSpareStr()) ? Integer.parseInt(data.getTransSpareStr()) : null); + data.setPublicPowerEquip(StringUtils.isNotEmpty(data.getPublicPowerEquipStr()) ? Integer.parseInt(data.getPublicPowerEquipStr()) : null); + data.setPrivatePowerEquip(StringUtils.isNotEmpty(data.getPrivatePowerEquipStr()) ? Integer.parseInt(data.getPrivatePowerEquipStr()) : null); + } + if ("1".equals(importType)) { + for (YwSceneNoticeinfo data : datas) { + YwSceneNoticeinfoSearchDTO dto = new YwSceneNoticeinfoSearchDTO(); + dto.setSceneId(data.getSceneId()); + List ywSceneNoticeinfos = ywSceneNoticeinfoMapper.selectBySearch(dto); + if (CollectionUtils.isNotEmpty(ywSceneNoticeinfos)) { + ywSceneNoticeinfoMapper.updateSelective(data); + } else { + ywSceneNoticeinfoMapper.insertSelective(data); + } + } + } else if ("0".equals(importType)) { + ywSceneNoticeinfoMapper.clear(); + add(datas); + } + } + + /** + * 实现类提供具体插入方法 + * + * @param collect 数据 + */ + @Override + public void insertB(List collect) { + ywSceneNoticeinfoMapper.insertBatch(collect); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterSceneUser.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterSceneUser.java new file mode 100644 index 0000000000000000000000000000000000000000..50c8b872df15c10fa06e1f20c3c3fd2391d2a84e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterSceneUser.java @@ -0,0 +1,377 @@ +package com.ruoyi.eastcom_yw.importer; + +import cn.hutool.core.collection.CollectionUtil; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.SysUserImp; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.mapper.YwSceneUserMapper; +import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.mapper.SysUserRoleMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@RequiredArgsConstructor +@Slf4j +public class ImporterSceneUser extends ImporterBase implements YwBatchAddService { + + private final SysUserMapper sysUserMapper; + + private final SysUserRoleMapper sysUserRoleMapper; + + private final YwSceneUserMapper ywSceneUserMapper; + + private String phoneNumber; + private String city; + private String county; + + { + cellFormatBeans.add(new CellFormatBean("姓名", "user_name", "", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("手机号码", "phonenumber", "false", "", "true", "phone", "", "", "", "true")); + cellFormatBeans.add(new CellFormatBean("账号状态", "status", "", "", "", "", "", "sys_user_status", "", "")); + cellFormatBeans.add(new CellFormatBean("角色", "roleName", "", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("专业", "specialty", "", "", "", "", "", "yw_specialty", "", "")); + cellFormatBeans.add(new CellFormatBean("地市", "city", "", "", "", "", "", "yw_city", "", "")); + cellFormatBeans.add(new CellFormatBean("区县", "county", "", "", "", "", "", "yw_county", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆", "sceneName", "", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆分区", "belongArea", "", "", "", "", "", "yw_belong_area", "", "")); + cellFormatBeans.add(new CellFormatBean("是否要签到", "needSign", "", "", "", "", "", "", "是,否", "")); + cellFormatBeans.add(new CellFormatBean("自有/三方", "ywUserBelong", "", "", "", "", "", "yw_user_belong", "", "")); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @param j 列 + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + + if ("phonenumber".equals(format.getColumnEn())) { + phoneNumber = s; + if (isNotEmpty(s)) { + if (s.length() != 11) { + reasonS.append("必须是11位手机号码。"); + } + } + } else if ("status".equals(format.getColumnEn())) { + if (isNotEmpty(s)) { + List sysUsers = sysUserMapper.selectUserByUserNameAndPhone(phoneNumber); + if (CollectionUtil.isNotEmpty(sysUsers)) { + SysUser sysUser = sysUsers.get(0); + if (sysUser != null) { + String statusOld = sysUser.getStatus(); + if (("0".equals(statusOld) || "2".equals(statusOld)) && "锁定".equals(s)) { + reasonS.append("不能将“正常”或“冻结”的账号修改为“锁定”。"); + } + } + } + } + } else if ("roleName".equals(format.getColumnEn())) { + if (isNotEmpty(s)) { + String[] str = s.split("\\|"); + List roleNames = new ArrayList<>(); + for (String t : str) { + if (roleNames.contains(t)) { + reasonS.append("角色重复。"); + } + roleNames.add(t); + SysRole role = checkRoleNameUnique((List) args[0], t); + if (role == null) { + reasonS.append("角色不存在。"); + } + } + } + } else if ("sceneName".equals(format.getColumnEn())) { + if (isNotEmpty(s)) { + String[] str = s.split("\\|"); + List sceneNames = new ArrayList<>(); + for (String t : str) { + if (sceneNames.contains(t)) { + reasonS.append("场馆重复。"); + } + sceneNames.add(t); + Long id = getSceneIdBySceneNameAndSceneBigId(t, sceneBigId, (List) args[1]); + if (id == null) { + reasonS.append("场馆不存在。"); + } else { + if(str.length<=1) { + YwScene scene = getSceneBySceneNameAndSceneBigId(t, sceneBigId, (List) args[1]); + if (scene != null && StringUtils.isNotEmpty(city) && (!city.equals(scene.getCityId()) || + !county.equals(scene.getAreaCountyId()))) { + reasonS.append("场馆不在该地市区县下。"); + } + } + } + } + } + } else if ("city".equals(format.getColumnEn())) { + city = getDictValue("yw_city", s); + } else if ("county".equals(format.getColumnEn())) { + county = getDictValue("yw_county", s); + } + + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + String userName = SecurityUtils.getUsername(); + List roles = (List) args[0]; + List ywScenes = (List) args[1]; + List ywSceneUsers = (List) args[2]; + for (SysUserImp user : datas) { + SysUser sysUser = new SysUser(); + sysUser.setUserName(user.getPhonenumber()); + sysUser.setNickName(user.getUser_name()); + sysUser.setPhonenumber(user.getPhonenumber()); + sysUser.setStatus(DictUtils.getDictValue("sys_user_status", user.getStatus())); + if (StringUtils.isNotEmpty(user.getBelongArea())) { + sysUser.setDistinctArea(getDictValue("yw_belong_area", user.getBelongArea())); + } + if (StringUtils.isNotEmpty(user.getSpecialty())) { + sysUser.setUserType(DictUtils.getDictValue("yw_specialty", user.getSpecialty())); + } + if (StringUtils.isNotEmpty(user.getCity())) { + sysUser.setCity(DictUtils.getDictValue("yw_city", user.getCity())); + } + if (StringUtils.isNotEmpty(user.getCounty())) { + sysUser.setCounty(DictUtils.getDictValue("yw_county", user.getCounty())); + } + if (StringUtils.isNotEmpty(user.getYwUserBelong())) { + sysUser.setYwUserBelong(DictUtils.getDictValue("yw_user_belong", user.getYwUserBelong())); + } + if (validateUserPhone(sysUser)) { + if (StringUtils.isEmpty(user.getUser_name())) { + sysUser.setNickName(user.getPhonenumber()); + } + if (StringUtils.isEmpty(user.getStatus())) { + sysUser.setStatus(DictUtils.getDictValue("sys_user_status", "正常")); + } + sysUser.setCreateBy(userName); + sysUser.setPassword(SecurityUtils.encryptPassword("123456")); + sysUserMapper.insertUser(sysUser); + } else { + sysUser.setUpdateBy(userName); + sysUser.setUpdateTime(DateUtils.getNowDate()); + sysUserMapper.updateUser(sysUser); + } + user.setUser_id(sysUser.getUserId()); + if (StringUtils.isEmpty(user.getNeedSign())) { + user.setNeedSign("否"); + } + } + if ("0".equals(importType)) { + for (SysUserImp user : datas) { + if (user.getUser_id() != null && StringUtils.isNotEmpty(user.getRoleName())) { + sysUserRoleMapper.deleteUserRoleByUserId(user.getUser_id()); + String[] str = user.getRoleName().split("\\|"); + List sysUserRoles = new ArrayList<>(); + for (String t : str) { + SysUserRole sysUserRole = new SysUserRole(); + sysUserRole.setUserId(user.getUser_id()); + SysRole sysRole = checkRoleNameUnique(roles, t); + if (sysRole != null) { + sysUserRole.setRoleId(sysRole.getRoleId()); + } + sysUserRoles.add(sysUserRole); + } + sysUserRoleMapper.batchUserRole(sysUserRoles); + } + } + } else if ("1".equals(importType)) { + for (SysUserImp user : datas) { + if (StringUtils.isNotEmpty(user.getRoleName()) && user.getUser_id() != null) { + String[] str = user.getRoleName().split("\\|"); + for (String t : str) { + addUserRole(user, t, roles, userName); + } + } + } + } + if ("1".equals(importType)) { + // 更新导入 + for (SysUserImp user : datas) { + if (user.getUser_id() != null && StringUtils.isNotEmpty(user.getSceneName())) { + String[] str = user.getSceneName().split("\\|"); + for (String t : str) { + addUserScene(user, t, sceneBigId, ywScenes, ywSceneUsers); + } + } + } + } else if ("0".equals(importType)) { + List list = new ArrayList<>(); + for (SysUserImp user : datas) { + // 先删除该用户下的场馆绑定 + if (user.getUser_id() != null && StringUtils.isNotEmpty(user.getSceneName())) { + ywSceneUserMapper.deleteCurrentBigSceneUserVenue(user.getUser_id(), sceneBigId); + String[] str = user.getSceneName().split("\\|"); + for (String t : str) { + YwSceneUser ywSceneUser = new YwSceneUser(); + ywSceneUser.setUserId(user.getUser_id()); + ywSceneUser.setSceneId(getSceneIdBySceneNameAndSceneBigId(t, sceneBigId, ywScenes)); + ywSceneUser.setCreateBy(userName); + ywSceneUser.setCreateTime(DateUtils.getNowDate()); + list.add(ywSceneUser); + } + } + } + add(list); + } + } + + private void addUserScene(SysUserImp user, String t, Long sceneBigId, List ywScenes, List ywSceneUsers) { + YwSceneUser ywSceneUser = new YwSceneUser(); + ywSceneUser.setUserId(user.getUser_id()); + ywSceneUser.setSceneId(getSceneIdBySceneNameAndSceneBigId(t, sceneBigId, ywScenes)); + String userName = SecurityUtils.getUsername(); + if (null != ywSceneUser.getSceneId() && null != ywSceneUser.getUserId()) { + if (validateUserScene(ywSceneUser, ywSceneUsers)) { + ywSceneUser.setCreateBy(userName); + ywSceneUser.setCreateTime(DateUtils.getNowDate()); + ywSceneUserMapper.insertSelective(ywSceneUser); + } else { + ywSceneUser.setUpdateTime(DateUtils.getNowDate()); + ywSceneUser.setUpdateBy(userName); + ywSceneUserMapper.updateByUserIdAndSceneId(ywSceneUser); + } + } + } + + private void addUserRole(SysUserImp user, String t, List roles, String userName) { + List list = new ArrayList<>(); + SysUserRole sysUserRole = new SysUserRole(); + sysUserRole.setUserId(user.getUser_id()); + SysRole role = checkRoleNameUnique(roles, t); + if (role != null) { + sysUserRole.setRoleId(role.getRoleId()); + } + if (null != sysUserRole.getUserId() && null != sysUserRole.getRoleId()) { + list.add(sysUserRole); + sysUserRoleMapper.deleteUserRoleInfo(sysUserRole); + log.info(userName + "删除用户角色,参数:" + sysUserRole); + sysUserRoleMapper.batchUserRole(list); + } + } + + private Long getSceneIdBySceneNameAndSceneBigId(String sceneName, Long sceneBigId, List ywScenes) { + for (YwScene ywScene : ywScenes) { + if (ywScene.getVenueName().equals(sceneName) && Objects.equals(sceneBigId, ywScene.getSceneBigId())) { + return ywScene.getId(); + } + } + return null; + } + + private YwScene getSceneBySceneNameAndSceneBigId(String sceneName, Long sceneBigId, List ywScenes) { + for (YwScene ywScene : ywScenes) { + if (ywScene.getVenueName().equals(sceneName) && Objects.equals(sceneBigId, ywScene.getSceneBigId())) { + return ywScene; + } + } + return null; + } + + private SysRole checkRoleNameUnique(List roles, String t) { + SysRole role = null; + for (SysRole r : roles) { + if (StringUtils.isNotEmpty(r.getRoleName()) && r.getRoleName().equals(t)) { + role = r; + break; + } + } + return role; + } + + private boolean validateUserScene(YwSceneUser ywSceneUser, List ywSceneUsers) { + for (YwSceneUser y : ywSceneUsers) { + if (ywSceneUser.getUserId().equals(y.getUserId()) && + ywSceneUser.getSceneId().equals(y.getSceneId())) { + return false; + } + } + return true; + } + + private boolean validateUserPhone(SysUser user) { + List sysUsers = sysUserMapper.selectUserByUserNameAndPhone(user.getPhonenumber()); + if (CollectionUtils.isEmpty(sysUsers)) { + return true; + } + user.setUserId(sysUsers.get(0).getUserId()); + return false; + } + + /** + * 实现类提供具体插入方法 + * + * @param collect 数据 + */ + @Override + public void insertB(List collect) { + ywSceneUserMapper.insertBatch(collect); + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterSignPlan.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterSignPlan.java new file mode 100644 index 0000000000000000000000000000000000000000..18857805dd61a32dca25eb588e0544f11f99edcb --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterSignPlan.java @@ -0,0 +1,183 @@ +package com.ruoyi.eastcom_yw.importer; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSignPlan; +import com.ruoyi.eastcom_yw.domain.YwSignPlanView; +import com.ruoyi.eastcom_yw.domain.dto.YwSignPlanDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignPlanImportDTO; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.mapper.YwSignPlanMapper; +import lombok.RequiredArgsConstructor; + +import java.util.Date; +import java.util.List; + +@RequiredArgsConstructor +public class ImporterSignPlan extends ImporterBase { + + private final YwSceneMapper ywSceneMapper; + private final YwSignPlanMapper ywSignPlanMapper; + private String signDate; + private String beginTime; + private String endTime; + private Date signBeginTime; + private String venueName; + + { + cellFormatBeans.add(new CellFormatBean("场馆", "venueName", "false", "", "", "", "", "", "", "true")); + cellFormatBeans.add(new CellFormatBean("签到日期", "signDate", "false", "true", "", "", "yyyy-MM-dd", "", "", "true")); + cellFormatBeans.add(new CellFormatBean("早签到时间", "beginTime", "false", "true", "", "", "HH:mm:ss", "", "", "")); + cellFormatBeans.add(new CellFormatBean("晚签到时间", "endTime", "false", "true", "", "", "HH:mm:ss", "", "", "")); + cellFormatBeans.add(new CellFormatBean("提醒时间量", "repWarnInterval", "false", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("通知方式", "noticeType", "false", "", "", "", "", "sys_notice_type", "", "")); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + if (isNotEmpty(venueName) && isNotEmpty(signDate)) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("venue_name", venueName); + queryWrapper.eq("scene_big_id", sceneBigId); + List venues = ywSceneMapper.selectList(queryWrapper); + if (venues.isEmpty()) { + reasonL.append("系统中没有该场馆。"); + } + Long venueId = venues.get(0).getId(); + LambdaQueryWrapper lambdaQueryWrapper2 = new LambdaQueryWrapper<>(); + lambdaQueryWrapper2.eq(YwSignPlan::getSceneId, venueId); + lambdaQueryWrapper2.eq(YwSignPlan::getSignDate, signDate); + // 验证是否存在这个场馆的签到日期 + List venuePlan = ywSignPlanMapper.selectList(lambdaQueryWrapper2); + if (!venuePlan.isEmpty()) { + reasonL.append("[").append(signDate).append("],场馆[").append(venueName).append("]的签到计划已存在"); + } + } + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @param j 列 + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + if (isNotEmpty(s)) { + if ("venueName".equals(format.getColumnEn())) { + venueName = s; + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (!user.isAdmin(user)) { + List venues = ywSceneMapper.getVenueByQuery(user.getUserId(), s, sceneBigId); + if (venues.isEmpty()) { + reasonS.append("当前用户没有操作[").append(s).append("]场馆的权限。"); + } + } + } else if ("signDate".equals(format.getColumnEn())) { + signDate = s; + Date signDate = DateUtils.parseDate(s, "yyyy-MM-dd"); + if (signDate.before(DateUtils.dateTime("yyyy-MM-dd", DateUtils.getDate()))) { + reasonS.append("签到日期不能早于当前日期。"); + } + } else if ("beginTime".equals(format.getColumnEn())) { + beginTime = s; + String beginTime = signDate + " " + s; + signBeginTime = DateUtils.parseDate(beginTime, "yyyy-MM-dd HH:mm:ss"); + if (signBeginTime.before(DateUtils.getNowDate())) { + reasonS.append("签到时间不能早于当前时间。"); + } + } else if ("endTime".equals(format.getColumnEn())) { + endTime = s; + String endTime = signDate + " " + s; + Date signEndTime = DateUtils.parseDate(endTime, "yyyy-MM-dd HH:mm:ss"); + if (signBeginTime != null && signEndTime.before(signBeginTime)) { + reasonS.append("晚签到时间必须大于早签到时间。"); + } + } else if ("repWarnInterval".equals(format.getColumnEn())) { + String[] arrIntervals = s.split(","); + for (String strInterval : arrIntervals) { + if (!StringUtils.isInt(strInterval)) { + reasonS.append("提醒时间量必须是数字,多个用英文逗号隔开"); + } else { + int interval = Integer.parseInt(strInterval); + if (interval <= 0) { + reasonS.append("提醒时间量必须大于0"); + } + } + } + } + } + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + for (YwSignPlanImportDTO data : datas) { + YwSignPlanDTO ywSignPlanDTO = new YwSignPlanDTO(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("venue_name", data.getVenueName()); + queryWrapper.eq("scene_big_id", sceneBigId); + List venues = ywSceneMapper.selectList(queryWrapper); + ywSignPlanDTO.setVenueIds(new Long[]{venues.get(0).getId()}); + ywSignPlanDTO.setSignDates(new String[]{data.getSignDate()}); + ywSignPlanDTO.setBeginTime(data.getBeginTime()); + ywSignPlanDTO.setEndTime(data.getEndTime()); + ywSignPlanDTO.setRepWarnInterval(data.getRepWarnInterval()); + ywSignPlanDTO.setNoticeType(DictUtils.getDictValue("sys_notice_type", data.getNoticeType())); + ywSignPlanDTO.setCreateBy(SecurityUtils.getUsername()); + ywSignPlanMapper.insertSignPlan(ywSignPlanDTO); + } + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterWx.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterWx.java new file mode 100644 index 0000000000000000000000000000000000000000..e81d23a7f699f9682d766873b0cd098f8ac71aa2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/importer/ImporterWx.java @@ -0,0 +1,233 @@ +package com.ruoyi.eastcom_yw.importer; + +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.service.YwBatchAddService; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.common.constant.NetElementConstants; +import com.ruoyi.eastcom_yw.common.enums.InRedLine; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementWx; +import com.ruoyi.eastcom_yw.mapper.YwSceneNetelementWxMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@RequiredArgsConstructor +@Slf4j +public class ImporterWx extends ImporterBase implements YwBatchAddService { + + private final YwSceneNetelementWxMapper ywSceneNetelementWxMapper; + + private String sceneName; + + /** + * 数据预处理 + * + * @param s cell + * @param cellFormatBean 校验规则 + */ + @Override + protected String preHandleCellValue(String s, CellFormatBean cellFormatBean) { + super.preHandleCellValue(s, cellFormatBean); + if ("city".equalsIgnoreCase(cellFormatBean.getColumnEn())) { + s = s.replaceAll("市", "").trim(); + } else if ("county".equalsIgnoreCase(cellFormatBean.getColumnEn())) { + s = s.replaceAll("区", "").trim(); + } else if ("带宽Str".equalsIgnoreCase(cellFormatBean.getColumnEn())) { + s = s.toUpperCase().replaceAll("M", "").trim(); + } + return s; + } + + /** + * 实现类提供具体插入方法 + * + * @param collect + */ + @Override + public void insertB(List collect) { + ywSceneNetelementWxMapper.insertBatch(collect); + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception { + + } + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @throws Exception 异常 + */ + @Override + protected void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception { + + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i + * @param j + * @throws Exception 异常 + */ + @Override + protected void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception { + + if ("sceneName".equals(format.getColumnEn())) { + if (isNotEmpty(s)) { + sceneName = (String) args[1]; + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType) && !sceneName.equals(s)) { + reasonS.append("单场馆覆盖导入模式下只能导入指定场馆。"); + } + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType) && s.contains("|")) { + reasonS.append("单场馆覆盖导入模式下场馆列不能包含|。"); + } + List ywSceneList = (List) args[0]; + List sceneNameList = ywSceneList.stream().map(x -> x.getVenueName()).collect(Collectors.toList()); + if (s.contains("|")) { + String[] str = s.split("\\|"); + for (String st : str) { + if (!sceneNameList.contains(st)) { + if (!reasonS.toString().contains("场馆不存在")) { + reasonS.append("场馆不存在。"); + } + } + } + } else { + if (!sceneNameList.contains(s)) { + reasonS.append("场馆不存在。"); + } + } + } + } + + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + @Override + protected void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception { + + List ywSceneList = (List) args[0]; + + // 导入 + List list1 = new ArrayList<>(); + for (YwSceneNetelementWx y : datas) { + if (y.getSceneName().contains("|")) { + String[] str = y.getSceneName().split("\\|"); + for (String s : str) { + YwSceneNetelementWx n = new YwSceneNetelementWx(); + BeanUtils.copyBeanProp(n, y); + n.setSceneName(s); + list1.add(n); + } + } else { + list1.add(y); + } + } + + List list = new ArrayList<>(); + List> maps = new ArrayList<>(); + for (YwSceneNetelementWx ywSceneNetelementWx : list1) { + boolean jump = false; + for (Map map : maps) { + if (map.get("sceneName").equalsIgnoreCase(ywSceneNetelementWx.getSceneName()) && + map.get("ci").equalsIgnoreCase(ywSceneNetelementWx.getCi())) { + jump = true; + break; + } + } + if (jump) { + continue; + } + list.add(ywSceneNetelementWx); + Map map = new HashMap<>(); + map.put("sceneName", ywSceneNetelementWx.getSceneName()); + map.put("ci", ywSceneNetelementWx.getCi()); + maps.add(map); + } + + for (YwSceneNetelementWx y : list) { + if (InRedLine.IN_RED_LINE.getLabel().equals(y.getInRedline())) { + y.setInRedline(InRedLine.IN_RED_LINE.getCode()); + } else if (InRedLine.NOT_IN_RED_LINE.getLabel().equals(y.getInRedline())) { + y.setInRedline(InRedLine.NOT_IN_RED_LINE.getCode()); + } else { + y.setInRedline(""); + } + for (YwScene ywScene : ywSceneList) { + if (StringUtils.isNotEmpty(y.getSceneName()) && y.getSceneName().equals(ywScene.getVenueName())) { + y.setSceneId(ywScene.getId()); + break; + } + } + y.setEnodebid(StringUtils.isNotEmpty(y.getEnodebidStr()) ? Integer.parseInt(y.getEnodebidStr()) : null); + y.set小区标识(StringUtils.isNotEmpty(y.get小区标识Str()) ? Integer.parseInt(y.get小区标识Str()) : null); + y.set本地小区标识(StringUtils.isNotEmpty(y.get本地小区标识Str()) ? Integer.parseInt(y.get本地小区标识Str()) : null); + y.set站号(StringUtils.isNotEmpty(y.get站号Str()) ? Integer.parseInt(y.get站号Str()) : null); + y.set频点(StringUtils.isNotEmpty(y.get频点Str()) ? Integer.parseInt(y.get频点Str()) : null); + y.setPci(StringUtils.isNotEmpty(y.getPciStr()) ? Integer.parseInt(y.getPciStr()) : null); + y.setTac(StringUtils.isNotEmpty(y.getTacStr()) ? Integer.parseInt(y.getTacStr()) : null); + y.set带宽(StringUtils.isNotEmpty(y.get带宽Str()) ? Integer.parseInt(y.get带宽Str()) : null); + y.set方位角(StringUtils.isNotEmpty(y.get方位角Str()) ? Float.parseFloat(y.get方位角Str()) : null); + y.set经度(StringUtils.isNotEmpty(y.get经度Str()) ? Double.parseDouble(y.get经度Str()) : null); + y.set纬度(StringUtils.isNotEmpty(y.get纬度Str()) ? Double.parseDouble(y.get纬度Str()) : null); + y.set地市(DictUtils.getDictValue("yw_city", y.getCity())); + y.set县市(DictUtils.getDictValue("yw_county", y.getCounty())); + y.setUpdateBy(SecurityUtils.getUsername()); + y.setUpdateTime(DateUtils.getNowDate()); + } + List collect = list.stream().filter(x -> x.getSceneId() != null).collect(Collectors.toList()); + if (NetElementConstants.SINGLE_SCENE_COVER.equals(importType)) { + Long id = collect.get(0).getSceneId(); + ywSceneNetelementWxMapper.deleteBySceneId(id); + } else { + ywSceneNetelementWxMapper.deleteBySceneBigId(sceneBigId); + } + add(collect, 0L, 100L); + + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/AppMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/AppMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..9886b325fccd972a5be701b5e80366318d0e6679 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/AppMapper.java @@ -0,0 +1,44 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.model.AppEntity; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +/** + * @author los + */ +public interface AppMapper extends BaseMapper { + + /** + * findApp + * + * @param appEntity + * @return + */ + @Select("SELECT id AS id ,APP_NAME AS appName, app_id as appId, app_secret as appSecret ,is_flag as isFlag , access_token as accessToken from m_app " + + "where app_id=#{appId} and app_secret=#{appSecret} and ip like concat('%', #{ip}, '%') and is_flag = '0'") + AppEntity findApp(AppEntity appEntity); + +// /** +// * +// * +// * @param appId +// * @return +// */ +// @Select("SELECT ID AS ID ,APP_NAME AS appName, app_id as appId, app_secret as appSecret ,is_flag as isFlag access_token as accessToken from m_app " +// + "where app_id=#{appId} and app_secret=#{appSecret} ") +// AppEntity findAppId(@Param("appId") String appId); + +// /** +// * 更新accessToken +// * +// * @param accessToken +// * @param appId +// * @return +// */ +// @Update(" update m_app set access_token =#{accessToken} where app_id=#{appId} ") +// int updateAccessToken(@Param("accessToken") String accessToken, @Param("appId") String appId); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/AppVersionConfigMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/AppVersionConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ce01396b3aac8acd612607efedb071dc5e73a4ec --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/AppVersionConfigMapper.java @@ -0,0 +1,10 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.AppVersionConfig; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AppVersionConfigMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2AgisLink5miMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2AgisLink5miMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..08f3a7c9de2730b203be5e67b473e611c988f110 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2AgisLink5miMapper.java @@ -0,0 +1,27 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.Dp2AgisLink5mi; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.vo.Dp2AgisLink5miVO; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author yqf + * @since 2023-08-18 + */ +public interface Dp2AgisLink5miMapper extends BaseMapper { + + + List getAgislinkTop5List(@Param("venueId") Integer venueId, + @Param("starttime") LocalDateTime starttime, + @Param("endtime")LocalDateTime endtime, + @Param("ordertype")String ordertype); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2MmlListMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2MmlListMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..e2d60dd1846138ce3ea6653b0200ade4a12a97dd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2MmlListMapper.java @@ -0,0 +1,21 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.Dp2MmlList; +import com.ruoyi.eastcom_yw.domain.qo.Dp2MmlListQO; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author ck + * @since 2023-09-12 + */ +public interface Dp2MmlListMapper extends BaseMapper { + + List list(Dp2MmlListQO qo); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2PnNetVenue5miMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2PnNetVenue5miMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..8e2db291b6dedd9d6a891e003bd8bef0e0cb8e30 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2PnNetVenue5miMapper.java @@ -0,0 +1,34 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.Dp2PnNetVenue5mi; +import com.ruoyi.eastcom_yw.domain.vo.Dp2PnNetVenue5miVO; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetAgixStaVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetStaVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetWifiStaVo; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author yqf + * @since 2023-08-21 + */ +public interface Dp2PnNetVenue5miMapper extends BaseMapper { + + List getNetVenueTop5List(@Param("venueId") Integer venueId, + @Param("starttime") LocalDateTime starttime, + @Param("endtime")LocalDateTime endtime, + @Param("ordertype")String ordertype); + + + YwSceneNetStaVo getNetVenueStatis(@Param("id") Long id, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2SpotCellMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2SpotCellMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..c79e2dd645938233f748feea01bb02d55b626383 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2SpotCellMapper.java @@ -0,0 +1,24 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.Dp2SpotCell; +import com.ruoyi.eastcom_yw.domain.qo.Dp2SpotCellQO; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author ck + * @since 2023-08-10 + */ +public interface Dp2SpotCellMapper extends BaseMapper { + + List list(Dp2SpotCellQO qo); + + @InterceptorIgnore(blockAttack = "true") + void deleteAll(); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2SpotConfigMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2SpotConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..91c2d21c26ba6ca5123e7eb10b9422e0a4f9b5fe --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2SpotConfigMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.Dp2SpotConfig; +import com.ruoyi.eastcom_yw.domain.qo.Dp2SpotConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2SpotConfigVO; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author ck + * @since 2023-08-09 + */ +public interface Dp2SpotConfigMapper extends BaseMapper { + + List list(Dp2SpotConfigQO qo); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2ViewPowerAlarmMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2ViewPowerAlarmMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ba04e41bdb4852dfff4ed8a83a9228f453a0c198 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2ViewPowerAlarmMapper.java @@ -0,0 +1,23 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.Dp2ViewPowerAlarm;; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewPowerAlarmQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewPowerAlarmVO; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author wqx + * @since 2023-08-31 + */ +public interface Dp2ViewPowerAlarmMapper extends BaseMapper { + + List list(Dp2ViewPowerAlarmQO qo); + + int updateDealStatus(Long alarmid); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2ViewWirelessAlarmMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2ViewWirelessAlarmMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..b05e8479abbbb05d7b87e37d6afeda5e58f7713b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/Dp2ViewWirelessAlarmMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.Dp2ViewWirelessAlarm; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewWirelessAlarmQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewWirelessAlarmVO; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author wqx + * @since 2023-09-01 + */ +public interface Dp2ViewWirelessAlarmMapper extends BaseMapper { + + public List list(Dp2ViewWirelessAlarmQO qo); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/DpSceneConfigMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/DpSceneConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..0778a9407a171ac33c5c1a5843343594e6720ad4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/DpSceneConfigMapper.java @@ -0,0 +1,58 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.DpSceneConfig; +import com.ruoyi.eastcom_yw.domain.qo.DpSceneConfigQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiColorQo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Mapper +public interface DpSceneConfigMapper extends BaseMapper { + + String getColorByQo(DpSceneConfigQO qo); + + Map getFourKpiColor(PmKpiColorQo qo); + + Map getkpiColorAndScore(@Param("kpiname") String kpiname, + @Param("kpivalue") Double kpivalue, + @Param("nettype") String nettype, + @Param("freqtype") String freqtype, + @Param("devicetype") String devicetype, + @Param("bandwidth") Long bandwidth); + + String getkpicolor(@Param("kpiname") String kpiname, + @Param("kpivalue") Double kpivalue, + @Param("nettype") String nettype, + @Param("freqtype") String freqtype, + @Param("devicetype") String devicetype, + @Param("bandwidth") Long bandwidth); + + Map getColor(List ids); + + int getkpicolorscore(@Param("kpiname") String kpiname, + @Param("kpivalue") Double kpivalue, + @Param("nettype") String nettype, + @Param("freqtype") String freqtype, + @Param("devicetype") String devicetype, + @Param("bandwidth") Long bandwidth); + + List listColor(); + + List listKpiName(); + + List getList(DpSceneConfigQO qo); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/HmAlarmDeriveMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/HmAlarmDeriveMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..4671c432b49511042d78a12b1cd57296b858dd9f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/HmAlarmDeriveMapper.java @@ -0,0 +1,18 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.HmAlarmDerive; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-08-02 + */ +@Mapper +public interface HmAlarmDeriveMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/LargeScreenMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/LargeScreenMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..3401f3058c984045bc45c1d1e49eb02f9f3359cd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/LargeScreenMapper.java @@ -0,0 +1,24 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.vo.*; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface LargeScreenMapper { + + List getTaskManageList(); + + List getMatchList(); + + List getRaceScheduleList(); + + List getMedalList(); + + List getNewsList(); + + List getAlarmTopList(); + + List getAlarmStatisticsList(); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi4gCellMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi4gCellMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..44e65b8d31db1c95f386f5a221e7147d954bbc6d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi4gCellMapper.java @@ -0,0 +1,74 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.PmKpiMaxEntity; +import com.ruoyi.eastcom_yw.domain.PmKpiMonitorEntity; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellMonitorQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiVenueQO; +import com.ruoyi.eastcom_yw.domain.vo.DpcSeneControlVo; +import com.ruoyi.eastcom_yw.domain.vo.KpiVenueReportVo; +import com.ruoyi.eastcom_yw.domain.vo.RecordVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + *

+ * 场馆4G小区级15分钟指标 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Mapper +public interface PmKpi4gCellMapper extends BaseMapper { + + PmKpiMaxEntity getMaxKpi(PmKpiCellQO qo); + + List getList(PmKpiCellQO qo); + +// List getMaxUserList(PmKpiCellQO qo); +// +// List getUpPrbList(PmKpiCellQO qo); + + List getKpiDataList(PmKpiCellQO qo); + + +// List getDownPrbList(PmKpiCellQO qo); + +// int getVillageCount(PmKpiVenueQO qo); + + List getKpiList(PmKpiCellMonitorQO qo); + + List getKpiCopyList(PmKpiCellMonitorQO qo); + + Map getLastTime(@Param("sceneid") Integer sceneid,@Param("seatno") String seatno); + + int updateDpcSeneControl(DpcSeneControlVo dpcSeneControlVo); + + KpiVenueReportVo getMaxuserData(@Param("venueId") Integer venueId, @Param("starttime")LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + KpiVenueReportVo getPrbUpData(@Param("venueId") Integer venueId, @Param("starttime")LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + KpiVenueReportVo getPrbDownData(@Param("venueId") Integer venueId, @Param("starttime")LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + + int getUnusualcount(@Param("venueId") Integer venueId, + @Param("starttime")LocalDateTime starttime, + @Param("endtime")LocalDateTime endtime, + @Param("nettype") String nettype); + + int getVillageCount(@Param("venueId") Integer venueId, + @Param("starttime")LocalDateTime starttime, + @Param("endtime")LocalDateTime endtime); + + Map getLastTimeByvenueIds(@Param("venueIds") Long[] venueIds); + + List getTop5List(@Param("venueId") Integer venueId, + @Param("starttime")LocalDateTime starttime, + @Param("endtime")LocalDateTime endtime, + @Param("ordertype")String ordertype); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi4gMinMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi4gMinMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..db7ced83486efc052dad93fe512a657ff9d83726 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi4gMinMapper.java @@ -0,0 +1,34 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellMonitorQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiMinQO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 场馆4G小区级1分钟指标 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Mapper +public interface PmKpi4gMinMapper extends BaseMapper { + + PmKpiMaxEntity getMaxKpi(PmKpiMinQO qo); + + List getList(PmKpiMinQO qo); + + List getKpiList(PmKpiCellMonitorQO qo); + + Map getLastTime(@Param("sceneid") Integer sceneid,@Param("seatno") String seatno); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi4gVenueMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi4gVenueMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..423913ea17532a3d192227e710ecddaa20f8b1b1 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi4gVenueMapper.java @@ -0,0 +1,35 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.PmKpi4gVenue; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiVenueQO; +import com.ruoyi.eastcom_yw.domain.vo.KpiVenueReportVo; +import com.ruoyi.eastcom_yw.domain.vo.RecordVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Mapper +public interface PmKpi4gVenueMapper extends BaseMapper { + + List getList(PmKpiVenueQO qo); + + KpiVenueReportVo getLastData(@Param("venueId") Integer venueId, @Param("starttime")LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + + BigDecimal getsumbg(@Param("venueId") Integer venueId, @Param("starttime")LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + + Map getLastTime(@Param("venueId") Integer venueId); + + Map getLastTimeByvenueIds(@Param("venueIds") Integer[] venueIds); + + List getKpiDataList(PmKpiVenueQO qo); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi5gCellMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi5gCellMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d7e0ee54531659f8768553f3810699f11fdc96c0 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi5gCellMapper.java @@ -0,0 +1,66 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.PmKpi5gCell; +import com.ruoyi.eastcom_yw.domain.PmKpiMaxEntity; +import com.ruoyi.eastcom_yw.domain.PmKpiMonitorEntity; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellMonitorQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.vo.KpiVenueReportVo; +import com.ruoyi.eastcom_yw.domain.vo.RecordVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + *

+ * 场馆5G小区级15分钟指标 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Mapper +public interface PmKpi5gCellMapper extends BaseMapper { + +// List getMaxUserList(PmKpiCellQO qo); +// +// List getUpPrbList(PmKpiCellQO qo); +// +// +// List getDownPrbList(PmKpiCellQO qo); + + List getKpiDataList(PmKpiCellQO qo); + + List getList(PmKpiCellQO qo); + + List getKpiList(PmKpiCellMonitorQO qo); + + List getKpiCopyList(PmKpiCellMonitorQO qo); + + Map getLastTime(@Param("sceneid") Integer sceneid,@Param("seatno") String seatno); + + PmKpiMaxEntity getMaxKpi(PmKpiCellQO qo); + + KpiVenueReportVo getMaxuserData(@Param("venueId") Integer venueId, @Param("starttime") LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + KpiVenueReportVo getPrbUpData(@Param("venueId") Integer venueId, @Param("starttime")LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + KpiVenueReportVo getPrbDownData(@Param("venueId") Integer venueId, @Param("starttime")LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + + int getUnusualcount(@Param("venueId") Integer venueId, + @Param("starttime")LocalDateTime starttime, + @Param("endtime")LocalDateTime endtime, + @Param("nettype") String nettype); + + int getVillageCount(@Param("venueId") Integer venueId, + @Param("starttime")LocalDateTime starttime, + @Param("endtime")LocalDateTime endtime); + + List getTop5List(@Param("venueId") Integer venueId, + @Param("starttime")LocalDateTime starttime, + @Param("endtime")LocalDateTime endtime, + @Param("ordertype")String ordertype); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi5gMinMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi5gMinMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..1d395778b4001c112a1e87655e655aa6ea013c50 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi5gMinMapper.java @@ -0,0 +1,35 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.PmKpi4gMin; +import com.ruoyi.eastcom_yw.domain.PmKpi5gMin; +import com.ruoyi.eastcom_yw.domain.PmKpiMaxEntity; +import com.ruoyi.eastcom_yw.domain.PmKpiMonitorEntity; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellMonitorQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiMinQO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 场馆5G小区级1分钟指标 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +public interface PmKpi5gMinMapper extends BaseMapper { + + PmKpiMaxEntity getMaxKpi(PmKpiMinQO qo); + + List getList(PmKpiMinQO qo); + + List getKpiList(PmKpiCellMonitorQO qo); + + Map getLastTime(@Param("sceneid") Integer sceneid, @Param("seatno") String seatno); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi5gVenueMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi5gVenueMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..c461843a53a9a38113845c01c68e1b049fcb3749 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/PmKpi5gVenueMapper.java @@ -0,0 +1,37 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.PmKpi5gVenue; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiVenueQO; +import com.ruoyi.eastcom_yw.domain.vo.KpiVenueReportVo; +import com.ruoyi.eastcom_yw.domain.vo.RecordVo; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + *

+ * 5G场馆级15分钟指标 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +public interface PmKpi5gVenueMapper extends BaseMapper { + + List getList(PmKpiVenueQO qo); + + KpiVenueReportVo getLastData(@Param("venueId") Integer venueId, @Param("starttime")LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + + BigDecimal getsumbg(@Param("venueId") Integer venueId, @Param("starttime") LocalDateTime starttime, @Param("endtime")LocalDateTime endtime); + + Map getLastTime(@Param("venueId") Integer venueId); + + Map getLastTimeByvenueIds(@Param("venueIds") Integer[] venueIds); + + List getKpiDataList(PmKpiVenueQO qo); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/SysNoticeMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/SysNoticeMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..0b9a44b7ab3fbeedaa682c949275996d56590875 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/SysNoticeMapper.java @@ -0,0 +1,40 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.domain.qo.SysNoticeQO; +import com.ruoyi.eastcom_yw.domain.vo.SysNoticeVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeBriefingVO; + +import java.util.List; + + +/** + *

+ * 通知公告表 Mapper 接口 + *

+ * + * @author ck + * @since 2023-04-14 + */ +public interface SysNoticeMapper extends BaseMapper { + + /** + * 公告已读,不要提醒 + * + * @param noticeIds 公告信息 + * @return 结果 + */ + public int isReadNotice(Long[] noticeIds); + + List selectToDoSMSList(); + + public List selectNoticeListByUser(Long reciveUserId); + + /** + * 查询未发送的简报计划 + */ + List selectToDoBriefingPlan(); + + List getData(SysNoticeQO qo); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmCSMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmCSMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..9f15537d35266737dbbe7ecfdd97cf9e7c7543d3 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmCSMapper.java @@ -0,0 +1,28 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwAlarmCS; +import com.ruoyi.eastcom_yw.domain.YwAlarmView; +import com.ruoyi.eastcom_yw.domain.YwAlarmWX; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmInfoVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmNewNumVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Mapper +public interface YwAlarmCSMapper extends BaseMapper { + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmDHMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmDHMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..30a7750d7eab14155e19daf67ec3d4a1ea289596 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmDHMapper.java @@ -0,0 +1,27 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwAlarmDH; +import com.ruoyi.eastcom_yw.domain.YwAlarmView; +import com.ruoyi.eastcom_yw.domain.YwAlarmWX; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmInfoVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmNewNumVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Mapper +public interface YwAlarmDHMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmHangupLogMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmHangupLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ed47dcf61a2d4a4d763c4fe4ba860263b8122a73 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmHangupLogMapper.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.YwAlarmHangupLog; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwAlarmHangupReover; +import com.ruoyi.eastcom_yw.domain.YwAlarmView; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-02-15 + */ +@Mapper +public interface YwAlarmHangupLogMapper extends BaseMapper { + + public List getYwAlarmHangupReoverList(); + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..dd27cc1aae1ec869168b059eec8d8e09254d62e4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmMapper.java @@ -0,0 +1,49 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwAlarm; +import com.ruoyi.eastcom_yw.domain.YwAlarmRecover; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.AlarmStaticListVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmNoticeVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmQuestionVo; +import com.ruoyi.eastcom_yw.domain.vo.YwErrorAlarmVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Mapper +public interface YwAlarmMapper extends BaseMapper { + public List getYwAlarmQuestionList(@Param("specialty") String specialty); + + List selectYwAlarmStaticList(@Param("alarmHour") String alarmHour,@Param("venueId") Long venueId); + + + List selectYwAlarmStaticList2(@Param("alarmVar") String alarmVar,@Param("alarmStart") String alarmStart,@Param("alarmEnd") String alarmEnd,@Param("venueId") Long venueId); + + + List selectYwAlarmCouldRecover(); + + List selectYwAlarmCouldNotice(); + + + int updateAlarmClearByAlarmId(YwAlarmDTO ywAlarmDTO); + + int updateAlarmClearByGroupId(YwAlarmDTO ywAlarmDTO); + + List selectAllAlarmWithError(); + + int updateOriginAlarmClose(YwAlarmDTO ywAlarmDTO); + + List revokeAlarm(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmOprateLogMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmOprateLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f468351d96508c8c0016aa6fb0b9c6d3fa737c65 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmOprateLogMapper.java @@ -0,0 +1,16 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.YwAlarmOprateLog; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-03-06 + */ +public interface YwAlarmOprateLogMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmStatisticsMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmStatisticsMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d0146e4d071abd2933bda2902a088e696727d18f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmStatisticsMapper.java @@ -0,0 +1,33 @@ +package com.ruoyi.eastcom_yw.mapper; +import java.util.Date; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmStatistics; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * (YwAlarmStatistics)表数据库访问层 + * + * @author lee + * @since 2023-04-24 20:22:12 + */ +public interface YwAlarmStatisticsMapper extends BaseMapper { + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + int deleteByCreateTimeBefore(); + + List selectBySceneIdAndCreateTime(@Param("sceneId") Long sceneId, @Param("createTime") Date createTime); + + List selectBySceneIdAndCreateTimeAndProfession(@Param("sceneId") Long sceneId, @Param("createTime") Date createTime, @Param("profession") String profession); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmViewMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmViewMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..a200f3df10541ab81aedb14e17a0c793e2523b96 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmViewMapper.java @@ -0,0 +1,63 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwAlarmView; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTONoPage; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmInfoVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmNewNumVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmViewVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Mapper +public interface YwAlarmViewMapper extends BaseMapper { + + public List getYwHandleList(); + + + public List getYwAlarmInfoListByGroup(@Param("groupId") String groupId); + + //20230314 为解决红线外无流程ID的问题,这边查询多个加用关联ID + public List getYwAlarmInfoList(@Param("processId") String processId); + + public List getYwAlarmNewNum(@Param("userId") Long userId,@Param("isAll") Boolean isAll); + + public Long getYwAlarmNewNumByDto(YwAlarmDTO alarmDTO); + + public Long getYwAlarmNewNumByDto2(YwAlarmDTONoPage alarmDTO); + + //查询次告警 + public List getYwAlarmByGroupId(@Param("alarmType") String alarmType,@Param("groupId") String groupId); + + public List getYwAlarmByGroupIds(@Param("alarmType") String alarmType,@Param("groupIds") long [] groupIds); + + //查所有告警 + public List getYwAlarmAll(@Param("alarmType") String alarmType,@Param("venueName") String venueName,@Param("startTime") String startTime,@Param("endTime") String endTime); + + //查询主告警 + public YwAlarmVo getYwAlarmLastByGroupId(@Param("alarmType") String alarmType,@Param("groupId") String groupId); + + public List getYwAlarmByDto(YwAlarmDTO alarmDTO); + + public List selectAlarmContent(@Param("groupId") String groupId); + + @Select("SELECT template_id\n" + + "FROM process_templates\n" + + "WHERE template_name = #{taskType}") + public String getTemplateId(@Param("taskType") String taskType); + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmWXMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmWXMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..183caffe798fbd30cddcc2c79fdaa39646609cb1 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwAlarmWXMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwAlarmView; +import com.ruoyi.eastcom_yw.domain.YwAlarmWX; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmInfoVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmNewNumVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Mapper +public interface YwAlarmWXMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwConstrucTeamMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwConstrucTeamMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..6c7a2c37e5be2080c7496bdfdc330455815b8f7d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwConstrucTeamMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.ruoyi.eastcom_yw.domain.vo.YwConstrucTeamVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface YwConstrucTeamMapper { + + public List getConstrucTeamByVenueId(@Param("venueId") Long venueId); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwDrsConfigMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwDrsConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..8910b249c9e16f16e86342d1b3f1fddede4d7246 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwDrsConfigMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwDrsConfig; +import com.ruoyi.eastcom_yw.domain.qo.YwDrsConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsConfigVO; + +import java.util.List; + +/** + *

+ * DRS配置表 Mapper 接口 + *

+ * + * @author ck + * @since 2023-06-13 + */ +public interface YwDrsConfigMapper extends BaseMapper { + + List list(YwDrsConfigQO qo); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwDrsTempTaskMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwDrsTempTaskMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..4543679fb8ef5e00a75729fa210914e18537c7dc --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwDrsTempTaskMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwDrsTempTask; +import com.ruoyi.eastcom_yw.domain.qo.YwDrsTempTaskQO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsTempTaskVO; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDate; +import java.util.List; + +/** + *

+ * DRS临时任务表 Mapper 接口 + *

+ * + * @author ck + * @since 2023-06-13 + */ +public interface YwDrsTempTaskMapper extends BaseMapper { + + List list(YwDrsTempTaskQO qo); + + List selectDrsPreviewByVenueIdAndDate(@Param("venueId") Long venueId, @Param("date") LocalDate date, @Param("commandVenueId") Long commandVenueId); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwKpiConfigMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwKpiConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f093f1cf8e08f58f9061d5d5c0242c7381256737 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwKpiConfigMapper.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwKpiConfig; + +/** + *

+ * 指标字段阈值配置表 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +public interface YwKpiConfigMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeBriefingMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeBriefingMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..3556908fbc470822fbbc87b506dc892de7e56ff5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeBriefingMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwNoticeBriefing; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeBriefingQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeBriefingPlanVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeBriefingVO; + +import java.util.List; + +/** + *

+ * 通知通告简报计划表 Mapper 接口 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeBriefingMapper extends BaseMapper { + + List selectBriefingPlan(); + + List selectNeedSendBriefing(); + + List getDataByPage(YwNoticeBriefingQO qo); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeHandworkMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeHandworkMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..36ad05eacfed8bbbda90a3f3ef5f787941ca65c6 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeHandworkMapper.java @@ -0,0 +1,23 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwNoticeHandwork; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 通知通告手工通知计划表 Mapper 接口 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeHandworkMapper extends BaseMapper { + + String selectTaskIdByProcessId(String flwProcessid); + + List selectPass(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeHandworkdetailMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeHandworkdetailMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f005354753a911213e54fc0ae401d262777ce473 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeHandworkdetailMapper.java @@ -0,0 +1,16 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwNoticeHandworkdetail; + +/** + *

+ * 通知通告手工通知审核表 Mapper 接口 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeHandworkdetailMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeListMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeListMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..e7847236c24615d047677e89c9da3049b75644d9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeListMapper.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwNoticeList; + +/** + *

+ * 通知通告记录表 Mapper 接口 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeListMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeModelMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeModelMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..6fc322be68e5cf4a9225c2099e2edbee96640c68 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeModelMapper.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwNoticeModel; + +/** + *

+ * 通知通告模板表 Mapper 接口 + *

+ * + * @author ck + * @since 2023-04-07 + */ +public interface YwNoticeModelMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeObjectMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeObjectMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ae241ee53f407a76e6136b2bffac47911de59c1e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeObjectMapper.java @@ -0,0 +1,20 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwNoticeObject; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 通知通告对象表 Mapper 接口 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeObjectMapper extends BaseMapper { + + List selectObjectsByVenueName(@Param("venueNames")List venueNames); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeUserMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeUserMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..eccff9d6d899afeacf1e7bdc57249dcde44d0df9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwNoticeUserMapper.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwNoticeUser; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Mapper +public interface YwNoticeUserMapper extends BaseMapper { + public List getYwNoticeUserList(@Param("flwId") String flwId,@Param("taskId") String taskId,@Param("groupId") String groupId,@Param("type") String type); + + public String getPhoneByGroupId(@Param("groupId") String groupId); + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectConfigMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..308867f59a771a563de73e84f9530c3157050e78 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectConfigMapper.java @@ -0,0 +1,19 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectConfig; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectConfigParam; + +import java.util.List; + +/** + * @author huamile + * @date 2023/1/18 15:26 + **/ +public interface YwRoutInspectConfigMapper extends BaseMapper { + + List getList(YwRoutInspectConfigParam param); + + Integer insertSelective(YwRoutInspectConfig config); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectLogMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d6530a3493715844a1ba51357d89c1996d315aa2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectLogMapper.java @@ -0,0 +1,21 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectLog; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectLogVo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface YwRoutInspectLogMapper extends BaseMapper { + + Integer insertSelective(YwRoutInspectLog ywRoutInspectLog); + + List getRoutInspectInfoList(String processId); + + void updateByflwProcessid(YwRoutInspectLog log); + + List getRoutInspectInfoListByJobNoAndFlowId(String jobNo); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectPlanMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectPlanMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..5b83cea0baae8ce94c8e1c73a181faddd49d147d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectPlanMapper.java @@ -0,0 +1,77 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectPlan; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectPlanDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectStatDTO; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectConfigParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectPlanParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectStatParam; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectLogVo; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectPlanVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * @author huamile + * @date 2023/1/17 16:05 + **/ +@Mapper +public interface YwRoutInspectPlanMapper extends BaseMapper { + + List getExecutablePlanList(@Param("now") String now); + + List getList(YwRoutInspectConfigParam param); + + List getListByJobNo(@Param("jobNo") String jobNo); + + List getPlanList(YwRoutInspectPlanParam param); + + Integer getNumOfAllPlan(YwRoutInspectStatParam param); + + Integer getNumOfCompletedPlan(YwRoutInspectStatParam param); + + Integer getAllNumOfPlan(YwRoutInspectStatParam param); + + Integer getNumOfQuestionPlan(YwRoutInspectStatParam param); + + List getStatListData(YwRoutInspectStatParam param); + + List getResultStatListData(YwRoutInspectStatParam param); + + List getStatListData20231012(YwRoutInspectStatParam param); + + List getResultStatListData20231012(YwRoutInspectStatParam param); + + /** + * 删除不在configIds中的同场馆同专业的配置 + * @param sceneId 场馆ID + * @param specialty 专业 + * @param configIds 配置ID列表 + * @return + */ + Integer delUselessConfig(@Param("sceneId") Long sceneId,@Param("specialty") String specialty, + @Param("configIds") List configIds); + + /** + * 删除不在list中的同工单号的巡检计划 + * @param jobNo 工单号 + * @param list 专业列表 + * @return + */ + Integer delUselessPlan(@Param("jobNo") String jobNo,@Param("list") List list); + + Integer insertSelective(YwInspectPlanDTO ywInspectPlanDTO); + + Integer updateByJobNoSelective(YwInspectPlanDTO ywInspectPlanDTO); + + @Select("SELECT template_id\n" + + "FROM process_templates\n" + + "WHERE template_name = '巡检任务'") + public String getInspectTemplateId(); + + List mergeResultStat(YwRoutInspectStatParam param); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectQuestionConfigMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectQuestionConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..084f0a1e1cf814c2eaf95c56b84a6c5a9886352b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwRoutInspectQuestionConfigMapper.java @@ -0,0 +1,23 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectQuestionConfig; +import com.ruoyi.eastcom_yw.domain.param.YwInspectQuestionConfigParam; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @author huamile + * @date 2023/2/4 17:02 + **/ +@Mapper +public interface YwRoutInspectQuestionConfigMapper extends BaseMapper { + + List getlist(YwInspectQuestionConfigParam param); + + Integer insertSelective(YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig); + + Integer updateByPrimaryKeySelective(YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneAlarmMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneAlarmMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..bd6094403fbe47c9a3d256d9884a46a8ef6cc250 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneAlarmMapper.java @@ -0,0 +1,27 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSceneAlarm; +import com.ruoyi.eastcom_yw.domain.param.YwSceneAlarmParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneAlarmVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author huamile + * @date 2023/2/14 10:33 + **/ +@Mapper +public interface YwSceneAlarmMapper extends BaseMapper { + + List getList(YwSceneAlarmParam param); + + List getListBySceneBigId(@Param("sceneBigId") Long sceneBigId); + + Integer insertSelective(YwSceneAlarm ywSceneAlarm); + + Integer updateByPrimaryKeySelective(YwSceneAlarm ywSceneAlarm); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneBigConfigMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneBigConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..9802868d7f86fc83da90b39301d9a7ed06a17aac --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneBigConfigMapper.java @@ -0,0 +1,20 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSceneBigConfig; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-12 + */ +@Mapper +public interface YwSceneBigConfigMapper extends BaseMapper { + + Long selectCurrentBig(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneCalendarMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneCalendarMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..78a322612469b2d0d6211466f65f4de7a08533bd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneCalendarMapper.java @@ -0,0 +1,86 @@ +package com.ruoyi.eastcom_yw.mapper; + +import java.util.Date; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSceneCalendar; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneCalendarDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendar2Vo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendarVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author huamile + * @date 2023/2/14 16:06 + **/ +@Mapper +public interface YwSceneCalendarMapper extends BaseMapper { + + /** + * 查询 + * + * @param param param + * @return list + */ + List getList(YwSceneCalendarParam param); + + /** + * 根据大场景id查询 + * + * @param sceneBigId 大场景id + * @return list + */ + List getListBySceneBigId(@Param("sceneBigId") Long sceneBigId); + + /** + * 新增 + * + * @param dto dto + * @return 插入条数 + */ + Integer insertSelective(YwSceneCalendarDTO dto); + + /** + * 根据主键更新 + * + * @param dto dto + * @return 更新条数 + */ + Integer updateByPrimaryKeySelective(YwSceneCalendarDTO dto); + + /** + * 批量插入 + * + * @param collect 数据 + */ + void insertBatch(List collect); + + /** + * 根据大场景id删除 + * + * @param sceneBigId 大场景id + */ + void deleteBySceneBigId(Long sceneBigId); + + /** + * 查询大场景下的id + * + * @param sceneBigId 大场景id + * @return ids + */ + String selectIds(@Param("sceneBigId") Long sceneBigId); + + /** + * 按条件查询 + * + * @param matchDate 比赛日期 + * @param sceneId 场景id + * @param endTime 结束时间 + * @return 符合条件数据 + */ + List selectByMatchDateAndSceneIdAndEndTimeGreaterThanEqualOrderByBeginTime(@Param("matchDate") Date matchDate, @Param("sceneId") Long sceneId, @Param("endTime") Date endTime); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..642ee4ae6cb5f29358bd853995f1af55401109d5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneMapper.java @@ -0,0 +1,69 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSceneBigConfig; +import com.ruoyi.eastcom_yw.domain.YwSceneFile; +import com.ruoyi.eastcom_yw.domain.dto.YwDataDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneRedisVO; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-12 + */ +@Mapper +public interface YwSceneMapper extends BaseMapper { + + public List getAllVenues(); + + public List getVenueByUserId(@Param("userId") Long userId); + + public List getVenueByArea(@Param("area") String area); + + public List getVenueByUserIdAndBigId(@Param("userId") Long userId,@Param("sceneBigId") Long sceneBigId); + + public List getVenueByQuery(@Param("userId") Long userId,@Param("venueName") String venueName,@Param("sceneBigId") Long sceneBigId); + + public List getSysUserByVenueAndOther(YwDataDTO ywDataDTO); + + + List getList(YwSceneParam param); + + List getSceneBySceneBigId(@Param("sceneBigId") Long sceneBigId); + + Integer insertSelective(YwSceneDTO dto); + + Integer updateByPrimaryKeySelective(YwSceneDTO dto); + + Long getCurrentSceneBigId(); + + List getFilesBySceneIds(@Param("ids") List ids); + + Integer insertFileSelective(YwSceneFile ywSceneFile); + + Integer updateFileByPrimaryKeySelective(YwSceneFile ywSceneFile); + + Integer delUselessFile(@Param("sceneId") Long id,@Param("ids") List ids); + + List getFileByCondition(@Param("sceneId") Long id,@Param("ids") List ids); + + List getSceneBigById(@Param("sceneBigId") Long id); + + void updateBySceneNameSelective(YwSceneDTO dto); + + void deleteBySceneBigId(Long sceneBigId); + + void insertBatch(List ywScenes); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneMatchMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneMatchMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..c062b2f841291af7158e1868776e2f49d7afc6ce --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneMatchMapper.java @@ -0,0 +1,20 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.param.YwSceneMatchParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneMatchVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface YwSceneMatchMapper extends BaseMapper { + void insertBatch(List collect); + + void deleteBySceneBigId(Long sceneBigId); + + List list(YwSceneMatchParam param); + + String selectIds(@Param("sceneBigId") Long sceneBigId); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementAgisMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementAgisMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..085b97b7ce0bd4ec71c4c1777855e4954cc606e0 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementAgisMapper.java @@ -0,0 +1,24 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementAgisParam; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementWxParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementAgis; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementCs; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementWx; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface YwSceneNetelementAgisMapper { + + List listAll(YwSceneNetelementAgisParam para); + + void deleteBySceneBigId(@Param("sceneBigId") Long sceneBigId); + + void insertBatch(@Param("list") List collect); + + int deleteBySceneId(@Param("sceneId") Long sceneId); + + int syncBySceneId(@Param("sceneId") Long sceneId); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementCsMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementCsMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ed5830e37bfb0d54cc0e427435608233d06b57e8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementCsMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementCsParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementCs; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementDh; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface YwSceneNetelementCsMapper { + void insertOne(YwSceneNetelementCs cs); + + List listAll(YwSceneNetelementCsParam param); + + void updateBySceneId(YwSceneNetelementCs x); + + int syncBySceneId(@Param("sceneId") Long sceneId); + + List selectBySceneId(YwSceneNetelementCs y); + + void deleteBySceneBigId(@Param("sceneBigId") Long sceneBigId); + + void insertBatch(List ywSceneNetelementWxes1); + + int deleteBySceneId(@Param("sceneId") Long sceneId); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementDhMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementDhMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..28f9bb65578508dbd87c188996952acea8482373 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementDhMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementDhParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementDh; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementWx; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface YwSceneNetelementDhMapper { + void insertOne(YwSceneNetelementDh cs); + + List listAll(YwSceneNetelementDhParam para); + + void updateBySceneId(YwSceneNetelementDh x); + + List selectById(YwSceneNetelementDh y); + + void deleteBySceneBigId(@Param("sceneBigId") Long sceneBigId); + + void insertBatch(List ywSceneNetelementWxes1); + + int deleteBySceneId(@Param("sceneId") Long sceneId); + + int syncBySceneId(@Param("sceneId") Long sceneId); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..3390f122c1a16453b62c9aae9b13b796a7a84b9f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementMapper.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSceneNetelement; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementParam; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author huamile + * @date 2023/2/14 14:59 + **/ +@Mapper +public interface YwSceneNetelementMapper extends BaseMapper { + + List getList(YwSceneNetelementParam param); + + List getListBySceneBigId(@Param("sceneBigId") Long sceneBigId); + + Integer insertSelective(YwSceneNetelement ywSceneNetelement); + + Integer updateByPrimaryKeySelective(YwSceneNetelement ywSceneNetelement); + + Integer[] getNetelementNum(); + + void dp_2_refresh_materialized_view(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementWxMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementWxMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..c994e863ed800e66ecfc03f9a7792c5d1070492d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNetelementWxMapper.java @@ -0,0 +1,31 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementWxParam; +import com.ruoyi.eastcom_yw.domain.vo.WholeAreaAssureCellSheet; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementWx; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface YwSceneNetelementWxMapper { + void insertOne(YwSceneNetelementWx cs); + + List listAll(YwSceneNetelementWxParam para); + + List listAll2(YwSceneNetelementWxParam para); + + void updateBySceneId(YwSceneNetelementWx x); + + List selectBySceneId(YwSceneNetelementWx y); + + void deleteBySceneBigId(@Param("sceneBigId") Long sceneBigId); + + int insertBatch(@Param("ywSceneNetelementWxCollection") Collection ywSceneNetelementWxCollection); + + List listSeatId(@Param("sceneId") Long sceneId); + + int deleteBySceneId(@Param("sceneId") Long sceneId); + + int syncBySceneId(@Param("sceneId") Long sceneId); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNoticeinfoMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNoticeinfoMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..3517aac46771c666f35f874631430df395b78dd7 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneNoticeinfoMapper.java @@ -0,0 +1,51 @@ +package com.ruoyi.eastcom_yw.mapper; + +import java.util.List; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneNoticeinfoSearchDTO; +import org.apache.ibatis.annotations.Param; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNoticeinfo; + +/** + * (YwSceneNoticeinfo)表数据库访问层 + * + * @author lee + * @since 2023-04-27 11:13:51 + */ +public interface YwSceneNoticeinfoMapper extends BaseMapper { + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 根据场馆id查询 + * + * @param sceneId 场馆id + * @return 数据 + */ + List selectBySceneId(@Param("sceneId") Long sceneId); + + /** + * 根据条件查询 + * + * @param ywSceneNoticeinfo 条件 + * @return 数据 + */ + List selectBySearch(YwSceneNoticeinfoSearchDTO ywSceneNoticeinfo); + + int insertSelective(YwSceneNoticeinfo ywSceneNoticeinfo); + + int updateSelective(YwSceneNoticeinfo ywSceneNoticeinfo); + + @InterceptorIgnore(blockAttack = "true") + int clear(); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwScenePictureMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwScenePictureMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..9d784fbbc5d8221f8e30a226d45ee9726a445f4a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwScenePictureMapper.java @@ -0,0 +1,88 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.ruoyi.eastcom_yw.domain.PmKpi5gCell; +import com.ruoyi.eastcom_yw.domain.vo.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + * @author los + */ +@Mapper +@Component +public interface YwScenePictureMapper { + + /** + * 查询单场馆布线任务总数 + * + * @param id 场馆id + * @return 单场馆布线任务总数 + */ + Integer getNumOfBXALL(Long id); + + /** + * 查询单场馆布线任务已完成数 + * + * @param id 场馆id + * @return 单场馆布线任务已完成数 + */ + Integer getNumOfBXComplete(Long id); + + List getAlarmStatistics(); + + /** + * 查询15分钟场馆级KPI指标 + * + * @param id 场馆id + * @param typeId 45g + * @return 指标 + */ + List getLineChartKpi(@Param("id") Long id, @Param("typeId") String typeId); + + List selectManagerInfoBySceneId(@Param("id") Long id); + + YwSceneNetAgixStaVo getNetAgixStatis(@Param("id") Long id, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); + + YwSceneNetStaVo getNetStatis(@Param("id") Long id, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); + + List getNetVelocityStatis(@Param("id") Long id, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); + + YwSceneNetFixtelStaVo getNetFixtelStatis(@Param("id") Long id, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); + + List getNetFixtelRegSuccStatis(@Param("id") Long id, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); + + List getGbtop5List(@Param("id") Long id); + + List getOpticalpowerTop5List(@Param("id") Long id,@Param("size") Integer size, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); + + List getOutOpticalpowerTop5List(@Param("id") Long id,@Param("size") Integer size, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); + + YwSceneTransOpticalpowerStaVo getMaxInOpticalpower(@Param("id") Long id, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); + + YwSceneTransOpticalpowerStaVo getMaxOutOpticalpower(@Param("id") Long id, + @Param("beginTime") LocalDateTime beginTime, + @Param("endTime") LocalDateTime endTime); + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneTestDataInterfaceMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneTestDataInterfaceMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..355fe6b7a820caf4961f96f8c2be1af26ae93c96 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneTestDataInterfaceMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneTestDataInterface; + +/** + * (YwSceneTestDataInterface)表数据库访问层 + * + * @author lee + * @since 2023-09-07 09:58:03 + */ +public interface YwSceneTestDataInterfaceMapper extends BaseMapper { + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneTestDataMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneTestDataMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ae5b145a150670e726072bb9ff43c8e0b3ad18be --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneTestDataMapper.java @@ -0,0 +1,38 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSceneTestData; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * (YwSceneTestData)表数据库访问层 + * + * @author lee + * @since 2023-04-26 18:26:34 + */ +public interface YwSceneTestDataMapper extends BaseMapper { + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + @InterceptorIgnore(blockAttack = "true") + int deleteAll(); + + /** + * 根据场馆id删除 + * + * @param entities idList + * @return + */ + int deleteBySceneIdIn(@Param("entities") List entities); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneUserMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneUserMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d0100984e97493aef3fafeb100f923e8a7213d4a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneUserMapper.java @@ -0,0 +1,50 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.domain.vo.SysUserVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneUserVo; +import com.ruoyi.eastcom_yw.domain.param.YwSceneUserParam; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author huamile + */ +@Mapper +public interface YwSceneUserMapper extends BaseMapper { + + List getList(YwSceneUserParam param); + + List getVenuesByUserId(@Param("userId") Long userId); + + List getVenuesByUserIds(@Param("userIds") List userIds); + + List getListBySceneBigId(@Param("sceneBigId") Long sceneBigId); + + Integer insertSelective(YwSceneUser ywSceneUser); + + Integer updateByPrimaryKeySelective(YwSceneUser ywSceneUser); + + void updateByUserIdAndSceneId(YwSceneUser ywSceneUser); + + List getListByUserIdAndSceneId(YwSceneUser ywSceneUser); + + List listSysUser(Long sceneBigId); + + void deleteBySceneBigId(Long sceneBigId); + + void insertBatch(List list); + + /** + * 清空当前用户当前大场景下的场馆绑定 + * + * @param userId 用户 + * @param sceneBigId 大场景 + * @return 删除条数 + */ + int deleteCurrentBigSceneUserVenue(@Param(value = "userId") Long userId, @Param(value = "sceneBigId") Long sceneBigId); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneViewMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneViewMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..08955df64ceb0dc571017b63151ed895253eee21 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSceneViewMapper.java @@ -0,0 +1,29 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneBigConfig; +import com.ruoyi.eastcom_yw.domain.YwSceneFile; +import com.ruoyi.eastcom_yw.domain.YwSceneView; +import com.ruoyi.eastcom_yw.domain.dto.YwDataDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-12 + */ +@Mapper +public interface YwSceneViewMapper extends BaseMapper { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSignLogMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSignLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f4379733ea74b468a2e48f49a34c8b9a94318fe1 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSignLogMapper.java @@ -0,0 +1,32 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSignLog; +import com.ruoyi.eastcom_yw.domain.dto.YwSignInDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +@Mapper +public interface YwSignLogMapper extends BaseMapper { + + //签到 + public void SingIn(YwSignInDTO ywSignInDTO); + + //个人签到 + public void sign(@Param("ywSignLog") YwSignLog ywSignLog,@Param("sceneId") Long sceneId); + + //配置签到记录 + public void AssignSignLog(); + + //根据计划ID删除签到记录 + public int deleteSignLogByPlan(@Param("id") Long id); + + + //根据计划ID删除多余的签到记录 + public int deleteSignLogUserByPlan(@Param("id") Long id); + + + //删除当天场馆不存在的签到记录表的人员 + public int deleteSignLogToday(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSignLogViewMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSignLogViewMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d122852a4c775cd128a6f291fbe1c3a5849f8354 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSignLogViewMapper.java @@ -0,0 +1,21 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSignLogView; +import com.ruoyi.eastcom_yw.domain.YwSignPlan; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogStaticVo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface YwSignLogViewMapper extends BaseMapper { + + List getSignLogStatic(YwSignLogDTO ywSignLogDTO); + + List getSignLogStatic20231012(YwSignLogDTO ywSignLogDTO); + + List getSignLogStaticForPic(YwSignLogDTO ywSignLogDTO); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSignPlanMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSignPlanMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f489f557b9fdb1607dd9b8e37ad72ae897f75282 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSignPlanMapper.java @@ -0,0 +1,27 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.eastcom_yw.domain.YwSignPlanRemind; +import com.ruoyi.eastcom_yw.domain.YwSignPlanView; +import com.ruoyi.eastcom_yw.domain.dto.YwSignPlanDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +@Mapper +public interface YwSignPlanMapper extends BaseMapper { + + public List getSignRemindList(); + + public int insertSignPlan(YwSignPlanDTO ywSignPlanDTO); + + public int updateSignPlan(YwSignPlanDTO ywSignPlanDTO); + + public int deleteSignPlan(@Param("id") Long id); + + public List getSignPlanList(@Param("userId") Long userId,@Param("venueId") Long venueId,@Param("signDate") String signDate); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSparePartsMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSparePartsMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..900403a63ae14fef9f2e4d8e1ea4443b298dce96 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwSparePartsMapper.java @@ -0,0 +1,28 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwSpareParts; +import com.ruoyi.eastcom_yw.domain.dto.YwSparePartsDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * 亚运备件表 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-08-31 + */ +@Mapper +public interface YwSparePartsMapper extends BaseMapper { + + void insertBatch(@Param("list") List list); + + + void deleteAllData(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwWireTaskLogMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwWireTaskLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..dcdd6740e40e18deeed6ee887fd2bc0f92d32702 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/YwWireTaskLogMapper.java @@ -0,0 +1,27 @@ +package com.ruoyi.eastcom_yw.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.YwWireTaskLog; +import com.ruoyi.eastcom_yw.domain.vo.FlowContentVo; +import com.ruoyi.eastcom_yw.domain.dto.YwWireTaskLogDTO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface YwWireTaskLogMapper extends BaseMapper { + + public String getWireTaskId(); + + public int insertWireTask(YwWireTaskLogDTO ywWireTaskLogDTO); + + public int updateWireTask(YwWireTaskLogDTO ywWireTaskLogDTO); + + public int updateWireTaskReport(YwWireTaskLogDTO ywWireTaskLogDTO); + + public int deleteWireTask(YwWireTaskLogDTO ywWireTaskLogDTO); + + public List getWireTaskFlowContent(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/yw_alarm_deal_logMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/yw_alarm_deal_logMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..67d0c1e868dde926f1aec836386449dbad3212d0 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/yw_alarm_deal_logMapper.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneDTO; +import com.ruoyi.eastcom_yw.domain.yw_alarm_deal_log; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * Mapper 接口 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Mapper +public interface yw_alarm_deal_logMapper extends BaseMapper { + + + Integer updateHangupSpantime(@Param("minute") double minute,@Param("processId") String processId); + + public Integer updateEndTime(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/yw_alarm_deal_resMapper.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/yw_alarm_deal_resMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f9bbdb06ae4f0d0c9d211405fcdfce59fcce8d02 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/mapper/yw_alarm_deal_resMapper.java @@ -0,0 +1,7 @@ +package com.ruoyi.eastcom_yw.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.eastcom_yw.domain.yw_alarm_deal_res; + +public interface yw_alarm_deal_resMapper extends BaseMapper { +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/AppVersionService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/AppVersionService.java new file mode 100644 index 0000000000000000000000000000000000000000..24c783a2b7b0e2acd4c4e61c4c83bc154d5f938c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/AppVersionService.java @@ -0,0 +1,8 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.AppVersionConfig; + +public interface AppVersionService extends IService { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/CommonService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/CommonService.java new file mode 100644 index 0000000000000000000000000000000000000000..731a06acb2e27a64608176ac17924e1f42cf5dbd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/CommonService.java @@ -0,0 +1,35 @@ +package com.ruoyi.eastcom_yw.service; + +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.core.domain.dto.HandleDataDTO; +import com.ruoyi.common.core.domain.dto.StartProcessInstanceDTO; +import com.ruoyi.common.core.domain.dto.TaskDTO; +import org.apache.poi.ss.formula.functions.T; + +import java.util.List; + +public interface CommonService { + + public String GetProcessDefinitionId(String template_id) throws Exception; + + public String StartProcess(StartProcessInstanceDTO startDTO) throws Exception; + + public Boolean UpdateProcessStatus(HandleDataDTO handleDataDTO) throws Exception; + + public JSONObject getTaskInfo(HandleDataDTO handleDataDTO) throws Exception; + + public Boolean agreeTask(HandleDataDTO handleDataDTO) throws Exception; + + public Boolean revokeTask(HandleDataDTO handleDataDTO) throws Exception; + + public JSONObject toDoList(TaskDTO taskDTO) throws Exception; + + //告警需要传alarmType,巡检布线不用 + public List selectCurrenUserTodoProcessId(String alarmType); + + + public String getToken(String userName,String password); + + public String getTokenByPhone(String phone,String code); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2MmlListService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2MmlListService.java new file mode 100644 index 0000000000000000000000000000000000000000..de07cc649d59d2695624efa910574ba2120dd2a4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2MmlListService.java @@ -0,0 +1,77 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.github.pagehelper.PageInfo; +import com.ruoyi.eastcom_yw.domain.Dp2MmlList; +import com.ruoyi.eastcom_yw.domain.qo.Dp2MmlListQO; + +import java.util.List; + +/** +*

+ * 服务类 + *

+* +* @author ck +* @since 2023-09-12 +*/ +public interface Dp2MmlListService extends IService { + + /** + * 列表 + * @param qo 根据需要进行传值 + * @return + */ + List getData(Dp2MmlListQO qo); + + /** + * 分页列表 + * @param qo 根据需要进行传值 + * @return + */ + PageInfo getDataByPage(Dp2MmlListQO qo); + +// /** +// * 详情 +// * @param id +// * @return +// */ +// Dp2MmlList fetchById(Long id); +// +// /** +// * 新增或修改 +// * @param dto 根据需要进行传值 +// * @return +// */ +// boolean saveOrUpdate(Dp2MmlList dto); +// +// /** +// * 删除(单个条目) +// * @param id +// * @return +// */ +// boolean deleteById(Long id); +// +// /** +// * 批量删除(多个条目) +// * +// * @param ids +// * @return +// */ +// boolean deleteByIdBatch(List ids); + + /** + * 导出 + * @param qo + * @return + */ + void export(Dp2MmlListQO qo); + + /** + * 导入 + * + * @param + * @return + */ +// AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2SpotCellService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2SpotCellService.java new file mode 100644 index 0000000000000000000000000000000000000000..6346593839d0e328295a03c915e2d158a27c7938 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2SpotCellService.java @@ -0,0 +1,85 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.Dp2SpotCell; +import com.ruoyi.eastcom_yw.domain.qo.Dp2SpotCellQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2SpotCellVO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author ck + * @since 2023-08-10 + */ +public interface Dp2SpotCellService extends IService { + + /** + * 列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(Dp2SpotCellQO qo); + + /** + * 分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + PageInfo getDataByPage(Dp2SpotCellQO qo); + + /** + * 详情 + * + * @param id + * @return + */ + Dp2SpotCellVO fetchById(Long id); + + /** + * 新增或修改 + * + * @param entity 根据需要进行传值 + * @return + */ + boolean saveOrUpdated(Dp2SpotCell entity); + + /** + * 删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 导出 + * + * @param qo + * @return + */ + void export(Dp2SpotCellQO qo); + + /** + * 导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2SpotConfigService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2SpotConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..f5db53c6d0b80f43ef6d1df9b7f34c691685081f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2SpotConfigService.java @@ -0,0 +1,88 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.Dp2SpotConfig; +import com.ruoyi.eastcom_yw.domain.dto.Dp2SpotConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2SpotConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2SpotConfigVO; + +import java.util.List; + +; + +/** + *

+ * 服务类 + *

+ * + * @author ck + * @since 2023-08-09 + */ +public interface Dp2SpotConfigService extends IService { + + /** + * 列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(Dp2SpotConfigQO qo); + + /** + * 分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + PageInfo getDataByPage(Dp2SpotConfigQO qo); + + /** + * 详情 + * + * @param id + * @return + */ + Dp2SpotConfigVO fetchById(Long id); + + /** + * 新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(Dp2SpotConfigDTO dto); + + /** + * 删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 导出 + * + * @param qo + * @return + */ + void export(Dp2SpotConfigQO qo); + + /** + * 导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2ViewPowerAlarmService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2ViewPowerAlarmService.java new file mode 100644 index 0000000000000000000000000000000000000000..771c0658ea95126092301d32dd9d231d04405e6c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2ViewPowerAlarmService.java @@ -0,0 +1,56 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2ViewPowerAlarm; +import com.ruoyi.eastcom_yw.domain.dto.Dp2ViewPowerAlarmDTO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewPowerAlarmQO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewWirelessAlarmQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewPowerAlarmVO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewWirelessAlarmVO; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** +*

+ * 服务类 + *

+* +* @author wqx +* @since 2023-08-31 +*/ +public interface Dp2ViewPowerAlarmService extends IService{ + + /** + * 列表 + * @param qo 根据需要进行传值 + * @return + */ + List getData(Dp2ViewPowerAlarmQO qo); + + /** + * 分页列表 + * @param qo 根据需要进行传值 + * @return + */ + PageInfo getDataByPage(Dp2ViewPowerAlarmQO qo); + + /** + * 详情 + * @param id + * @return + */ + Dp2ViewPowerAlarmVO fetchById(Long id); + + + public void export(Dp2ViewPowerAlarmQO qo) ; + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2ViewWirelessAlarmService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2ViewWirelessAlarmService.java new file mode 100644 index 0000000000000000000000000000000000000000..fd027ef89d232d418cb7c21cec4362708947db2a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/Dp2ViewWirelessAlarmService.java @@ -0,0 +1,82 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.Dp2ViewWirelessAlarm; +import com.ruoyi.eastcom_yw.domain.dto.Dp2ViewWirelessAlarmDTO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewWirelessAlarmQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewWirelessAlarmVO; + +import java.util.List; + +/** +*

+ * 服务类 + *

+* +* @author wqx +* @since 2023-09-01 +*/ +public interface Dp2ViewWirelessAlarmService extends IService { + + /** + * 列表 + * @param qo 根据需要进行传值 + * @return + */ + List getData(Dp2ViewWirelessAlarmQO qo); + + /** + * 分页列表 + * @param qo 根据需要进行传值 + * @return + */ + public PageInfo getDataByPage(Dp2ViewWirelessAlarmQO qo); + + /** + * 详情 + * @param id + * @return + */ + Dp2ViewWirelessAlarmVO fetchById(Long id); + + /** + * 新增或修改 + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(Dp2ViewWirelessAlarmDTO dto); + + /** + * 删除(单个条目) + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 导出 + * @param qo + * @return + */ + void export(Dp2ViewWirelessAlarmQO qo); + + /** + * 导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/DpSceneConfigService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/DpSceneConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..811df21048876075f48d30139be6edb799c173b3 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/DpSceneConfigService.java @@ -0,0 +1,86 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.DpSceneConfig; +import com.ruoyi.eastcom_yw.domain.dto.DpSceneConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.DpSceneConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.DpSceneConfigVO; + +import java.util.List; + +/** +*

+ * 服务类 + *

+* +* @author yqf +* @since 2023-04-12 +*/ +public interface DpSceneConfigService extends IService { + + /** + * 列表 + * @param qo 根据需要进行传值 + * @return + */ + List getData(DpSceneConfigQO qo); + + /** + * 分页列表 + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(DpSceneConfigQO qo); + + /** + * 详情 + * @param id + * @return + */ + DpSceneConfigVO fetchById(Long id); + + /** + * 新增或修改 + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(DpSceneConfigDTO dto); + + /** + * 删除(单个条目) + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 导出 + * @param qo + * @return + */ + void export(DpSceneConfigQO qo); + + /** + * 导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); + + List listColor(); + + List listKpiName(); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/HmAlarmDeriveService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/HmAlarmDeriveService.java new file mode 100644 index 0000000000000000000000000000000000000000..1657f007aae845300f319aa66876a5175879eae8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/HmAlarmDeriveService.java @@ -0,0 +1,23 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.eastcom_yw.domain.HmAlarmDerive; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmVo; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-08-02 + */ +public interface HmAlarmDeriveService extends IService { + + List getAlarmDerive(YwAlarmDTO alarmDTO); + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/LargeScreenService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/LargeScreenService.java new file mode 100644 index 0000000000000000000000000000000000000000..a07108a44538f0a2436a093a383e46ee0b69ac23 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/LargeScreenService.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.eastcom_yw.domain.model.AppEntity; +import com.ruoyi.eastcom_yw.domain.vo.*; + +import java.util.List; + +public interface LargeScreenService { + List getTaskManageList(); + + List getMatchList(); + + List getRaceScheduleList(); + + List getMedalList(); + + List getNewsList(); + + List getAlarmTopList(); + + List getAlarmStatisticsList(); + + boolean validate(String ip, AppEntity appEntity); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/OpenApiService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/OpenApiService.java new file mode 100644 index 0000000000000000000000000000000000000000..30c43fb32876410321e624e01c886ec5cbc6eb40 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/OpenApiService.java @@ -0,0 +1,15 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.dto.MmlObjectDTO; + +import java.util.List; + +/** + * @author yqf + * @date 2023/6/5 + */ +public interface OpenApiService { + + public AjaxResult getMsgByMML(MmlObjectDTO mmlObjectDTO); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi4gCellService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi4gCellService.java new file mode 100644 index 0000000000000000000000000000000000000000..0a03e610bc843d688e57190cf2fd16865617ce43 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi4gCellService.java @@ -0,0 +1,42 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi15MinCellVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gCellVO; + +import java.util.List; +import java.util.Map; + +/** + * @author yqf + * @date 2023/4/11 + */ +public interface PmKpi4gCellService extends IService { + + /** + * 场馆4G小区级15分钟指标列表 + * @param qo 根据需要进行传值 + * @return + */ + List getData(PmKpiCellQO qo); + + /** + * 场馆4G小区级15分钟指标分页列表 + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(PmKpiCellQO qo); + + + /** + * 场馆4G小区级15分钟指标导出 + * @param qo + * @return + */ + void export(PmKpiCellQO qo); + + Map getLastTime(Long[] venueIds); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi4gMinService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi4gMinService.java new file mode 100644 index 0000000000000000000000000000000000000000..8558a3ef567608287013206617ae1f2d4bbcb696 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi4gMinService.java @@ -0,0 +1,90 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.PmKpi4gMin; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi4gMinDTO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpi4gMinQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiMinQO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gMinVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpiOneMinVO; + +import java.util.List; + +/** + *

+ * 场馆4G小区级1分钟指标 服务类 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +public interface PmKpi4gMinService extends IService { + + /** + * 场馆4G小区级1分钟指标列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(PmKpiMinQO qo); + + /** + * 场馆4G小区级1分钟指标分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(PmKpiMinQO qo); + + /** + * 场馆4G小区级1分钟指标详情 + * + * @param id + * @return + */ + PmKpi4gMinVO fetchById(Long id); + + /** + * 场馆4G小区级1分钟指标新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(PmKpi4gMinDTO dto); + + /** + * 场馆4G小区级1分钟指标删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 场馆4G小区级1分钟指标批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 场馆4G小区级1分钟指标导出 + * + * @param qo + * @return + */ + void export(PmKpiMinQO qo); + + /** + * 场馆4G小区级1分钟指标导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi4gVenueService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi4gVenueService.java new file mode 100644 index 0000000000000000000000000000000000000000..8e6d11ecbd604dc879a49d02b1511a8f255c7ac8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi4gVenueService.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.PmKpi4gVenue; +import com.ruoyi.eastcom_yw.domain.PmKpi5gCell; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiVenueQO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gVenueConvertVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gVenueVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi5gCellVO; + +import java.util.Map; + +/** + * @author yqf + * @date 2023/4/11 + */ +public interface PmKpi4gVenueService extends IService { + + + /** + * 4G场馆级15分钟指标分页列表 + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(PmKpiVenueQO qo); + + Map get4gVenueLastTime(Integer[] venueIds); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi5gCellService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi5gCellService.java new file mode 100644 index 0000000000000000000000000000000000000000..821ed672c9da351726f9f361f47743ef8382f1f8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi5gCellService.java @@ -0,0 +1,42 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.PmKpi5gCell; +import com.ruoyi.eastcom_yw.domain.qo.PmKpi5gCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi15MinCellVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gCellVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi5gCellVO; + +import java.util.List; + +/** + * @author yqf + * @date 2023/4/11 + */ +public interface PmKpi5gCellService extends IService { + + + /** + * 场馆5G小区级15分钟指标列表 + * @param qo 根据需要进行传值 + * @return + */ + List getData(PmKpiCellQO qo); + + /** + * 场馆5G小区级15分钟指标分页列表 + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(PmKpiCellQO qo); + + + /** + * 场馆5G小区级15分钟指标导出 + * @param qo + * @return + */ + void export(PmKpiCellQO qo); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi5gMinService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi5gMinService.java new file mode 100644 index 0000000000000000000000000000000000000000..2f3060228f7acf7697baed88696e1fd674cd5207 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi5gMinService.java @@ -0,0 +1,84 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.PmKpi5gMin; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi5gMinDTO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpi5gMinQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiMinQO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi5gMinVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpiOneMinVO; + +import java.util.List; + +/** +*

+ * 场馆5G小区级1分钟指标 服务类 + *

+* +* @author yqf +* @since 2023-04-12 +*/ +public interface PmKpi5gMinService extends IService { + + /** + * 场馆5G小区级1分钟指标列表 + * @param qo 根据需要进行传值 + * @return + */ + List getData(PmKpiMinQO qo); + + /** + * 场馆5G小区级1分钟指标分页列表 + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(PmKpiMinQO qo); + + /** + * 场馆5G小区级1分钟指标详情 + * @param id + * @return + */ + PmKpi5gMinVO fetchById(Long id); + + /** + * 场馆5G小区级1分钟指标新增或修改 + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(PmKpi5gMinDTO dto); + + /** + * 场馆5G小区级1分钟指标删除(单个条目) + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 场馆5G小区级1分钟指标批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 场馆5G小区级1分钟指标导出 + * @param qo + * @return + */ + void export(PmKpiMinQO qo); + + /** + * 场馆5G小区级1分钟指标导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi5gVenueService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi5gVenueService.java new file mode 100644 index 0000000000000000000000000000000000000000..5417244a44533fc98b3d0c59bb63bf97ecf73360 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpi5gVenueService.java @@ -0,0 +1,36 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.eastcom_yw.domain.PmKpi5gVenue; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiVenueQO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gVenueConvertVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi5gVenueVO; + +import java.util.List; +import java.util.Map; + +/** +*

+ * 5G场馆级15分钟指标 服务类 + *

+* +* @author yqf +* @since 2023-04-12 +*/ +public interface PmKpi5gVenueService extends IService { + + + /** + * 5G场馆级15分钟指标分页列表 + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(PmKpiVenueQO qo); + + Map get5gVenueLastTime(Integer[] venueIds); + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpiMonitorCellService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpiMonitorCellService.java new file mode 100644 index 0000000000000000000000000000000000000000..5dfaeee06f1c1b9945f7ceb477e5bab23e4113cd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/PmKpiMonitorCellService.java @@ -0,0 +1,38 @@ +package com.ruoyi.eastcom_yw.service; + +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.pagehelper.PageInfo; +import com.ruoyi.eastcom_yw.domain.qo.DpKpiMonitorQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellMonitorQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiMinQO; +import com.ruoyi.eastcom_yw.domain.vo.DpcSeneControlVo; +import com.ruoyi.eastcom_yw.domain.vo.KpiVenueReportVo; +import com.ruoyi.eastcom_yw.domain.vo.MonitorCellVo; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi15MinCellVO; + +import java.time.LocalDateTime; +import java.util.Map; + +/** + * @author yqf + * @date 2023/4/13 + */ +public interface PmKpiMonitorCellService { + + PageInfo getMonitorCellList(PmKpiCellMonitorQO qo); + + + PageInfo getDpMonitorCellList(DpKpiMonitorQO qo); + + int updateDpcSeneControl(DpcSeneControlVo dpcSeneControlVo); + + KpiVenueReportVo getReportKpi(Integer venueid, LocalDateTime starttime, LocalDateTime endtime, Integer minute); + + JSONObject getReportKpiByJson(Integer venueid, LocalDateTime starttime, LocalDateTime endtime, Integer minute); + + void exportMonitorList(PmKpiCellMonitorQO qo); + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/SysNoticeService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/SysNoticeService.java new file mode 100644 index 0000000000000000000000000000000000000000..7adc604597fa2653d5754705793ee569ed797551 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/SysNoticeService.java @@ -0,0 +1,106 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.domain.dto.SysNoticeDTO; +import com.ruoyi.eastcom_yw.domain.qo.SysNoticeQO; +import com.ruoyi.eastcom_yw.domain.vo.SysNoticeVO; + +import java.util.List; + +/** + *

+ * 通知公告表 服务类 + *

+ * + * @author ck + * @since 2023-04-14 + */ +public interface SysNoticeService extends IService { + + /** + * 通知公告表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(SysNoticeQO qo); + + /** + * 通知公告表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(SysNoticeQO qo); + + /** + * 通知公告表详情 + * + * @param id + * @return + */ + SysNoticeVO fetchById(Long id); + + /** + * 通知公告表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(SysNoticeDTO dto); + + /** + * 通知公告表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 通知公告表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 通知公告表导出 + * + * @param qo + * @return + */ + void export(SysNoticeQO qo); + + /** + * 通知公告表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); + + + + public int isReadNotice(Long[] noticeIds); + + /** + * 查询定时任务需要发送的短信 notice_type=3 add_flag=0 currentTime-5minute <=exp_send_time<=currentTime 五分钟之内 + * @return 结果 + */ + List selectToDoSMSList(); + + public void eastcomYwSendSMSSchedule(); + + public void newEastcomYwSendSMSSchedule(); + + public void send(List sysNotices); + + void saveAndSendBriefing(SysNoticeDTO dto); + + public List selectNoticeListByUser(Long reciveUserId); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/WeatherService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/WeatherService.java new file mode 100644 index 0000000000000000000000000000000000000000..03106ea1bd8c4bf59a08b3c6686ed8ec7281a7eb --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/WeatherService.java @@ -0,0 +1,11 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.common.core.domain.AjaxResult; + +public interface WeatherService { + + /** + * 获取场馆天气详情 + */ + public AjaxResult fetchById(Long venueId); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmCSService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmCSService.java new file mode 100644 index 0000000000000000000000000000000000000000..80c6ada261ec346e47b68c1559ba2870d9c9f079 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmCSService.java @@ -0,0 +1,21 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.YwAlarmCS; +import com.ruoyi.eastcom_yw.domain.YwAlarmDH; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +public interface YwAlarmCSService extends IService { + + public TableDataInfo GetAlarmList(YwAlarmDTO alarmDTO); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmDHService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmDHService.java new file mode 100644 index 0000000000000000000000000000000000000000..25e9e6e4aeebe934ad5c71c2f1e33b9a383cf2d9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmDHService.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.YwAlarmDH; +import com.ruoyi.eastcom_yw.domain.YwAlarmView; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmInfoVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmNewNumVo; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +public interface YwAlarmDHService extends IService { + + public TableDataInfo GetAlarmList(YwAlarmDTO alarmDTO); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmHangupLogService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmHangupLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..405a6ec7c145e15a5692420c540bb79bf79aae90 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmHangupLogService.java @@ -0,0 +1,20 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.eastcom_yw.domain.YwAlarmHangupLog; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmHangupLogDTO; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-02-15 + */ +public interface YwAlarmHangupLogService extends IService { + public boolean insertYwAlarmHangupLog(YwAlarmHangupLogDTO ywAlarmHangupLogDTO); + + public void updateAlarmHangupSchedule(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmOprateLogService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmOprateLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..6ceda9d7e75caf411b0f1e7e1ada348ddc57e51b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmOprateLogService.java @@ -0,0 +1,16 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.eastcom_yw.domain.YwAlarmOprateLog; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-03-06 + */ +public interface YwAlarmOprateLogService extends IService { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmService.java new file mode 100644 index 0000000000000000000000000000000000000000..01742046801e43f5111eecacac85c162cb25b0f9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmService.java @@ -0,0 +1,32 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.YwAlarm; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmQuestionVo; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +public interface YwAlarmService extends IService { + public List getYwAlarmQuestionList(String specialty); + + public void YwAlarmAutoRecover(); + + /** + * 定时发送告警简报 + */ + void eastcomYwSendAlarmBriefingSchedule(); + + public boolean YwAlarmClear(YwAlarmDTO alarmDTO); + + public boolean YwAlarmClose(YwAlarmDTO alarmDTO); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmViewService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmViewService.java new file mode 100644 index 0000000000000000000000000000000000000000..3d54707d3738f38bdc7377ead87022d6b7828c5e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmViewService.java @@ -0,0 +1,55 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.YwAlarmView; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTONoPage; +import com.ruoyi.eastcom_yw.domain.vo.*; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +public interface YwAlarmViewService extends IService { + + public void insert_alarm_schedule(); + + + public void insert_alarmNotice_schedule(); + + public TableDataInfo GetAlarmList(YwAlarmDTO alarmDTO); + + + public List GetNewAlarmNum(Long userId); + + //管理员的角色不需要场馆的绑定 + public List GetNewAlarmNum(Long userId,Boolean isAdmin); + + public Long getYwAlarmNewNumByDto(YwAlarmDTO alarmDTO); + + public Long getYwAlarmNewNumByDto(YwAlarmDTONoPage alarmDTO); + + public List getYwAlarmByDto(YwAlarmDTO alarmDTO); + + public List GetAlarmInfoList(String processId); + + public List getYwAlarmInfoListByGroup(String groupId); + + public List GetAlarmInfoList(String processId,boolean isApp); + + public List getYwAlarmInfoListByGroup(String groupId,boolean isApp); + + public List getYwAlarmList(String alarmType,String venueName,String startTime,String endTime); + + public List getYwAlarmLessList(String alarmType,String groupId); + + public void updateAlarmLogEnd(String alarmType, Long group_id,Long userId); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmWXService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmWXService.java new file mode 100644 index 0000000000000000000000000000000000000000..8c6e70c3971b8c84e8760eec5f1490a691de4387 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwAlarmWXService.java @@ -0,0 +1,21 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.YwAlarmDH; +import com.ruoyi.eastcom_yw.domain.YwAlarmWX; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +public interface YwAlarmWXService extends IService { + + public TableDataInfo GetAlarmList(YwAlarmDTO alarmDTO); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwDrsConfigService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwDrsConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..08cb82cd63a832573c54f045e79ad00538e47ae5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwDrsConfigService.java @@ -0,0 +1,86 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwDrsConfig; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwDrsConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsConfigVO; + +import java.util.List; + +/** + *

+ * DRS配置表 服务类 + *

+ * + * @author ck + * @since 2023-06-13 + */ +public interface YwDrsConfigService extends IService { + + /** + * DRS配置表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwDrsConfigQO qo); + + /** + * DRS配置表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + PageInfo getDataByPage(YwDrsConfigQO qo); + + /** + * DRS配置表详情 + * + * @param id + * @return + */ + YwDrsConfigVO fetchById(Long id); + + /** + * DRS配置表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(YwDrsConfigDTO dto); + + /** + * DRS配置表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * DRS配置表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * DRS配置表导出 + * + * @param qo + * @return + */ + void export(YwDrsConfigQO qo); + + /** + * DRS配置表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwDrsTempTaskService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwDrsTempTaskService.java new file mode 100644 index 0000000000000000000000000000000000000000..69ce32a2c254bf51bbc5a44e027bb1096f65e107 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwDrsTempTaskService.java @@ -0,0 +1,89 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwDrsTempTask; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsTempTaskDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwDrsTempTaskQO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsTempTaskVO; + +import java.time.LocalDate; +import java.util.List; + +/** + *

+ * DRS临时任务表 服务类 + *

+ * + * @author ck + * @since 2023-06-13 + */ +public interface YwDrsTempTaskService extends IService { + + /** + * DRS临时任务表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwDrsTempTaskQO qo); + + /** + * DRS临时任务表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + PageInfo getDataByPage(YwDrsTempTaskQO qo); + + /** + * DRS临时任务表详情 + * + * @param id + * @return + */ + YwDrsTempTaskVO fetchById(Long id); + + /** + * DRS临时任务表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(YwDrsTempTaskDTO dto); + + /** + * DRS临时任务表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * DRS临时任务表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * DRS临时任务表导出 + * + * @param qo + * @return + */ + void export(YwDrsTempTaskQO qo); + + /** + * DRS临时任务表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); + + List drsPreview(Long venueId, LocalDate date); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwKpiConfigService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwKpiConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..6c1435dcd05500ff868fce05fd4e056f124ddc6b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwKpiConfigService.java @@ -0,0 +1,82 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwKpiConfig; +import com.ruoyi.eastcom_yw.domain.dto.YwKpiConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwKpiConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.YwKpiConfigVO; + +import java.util.List; + +/** +*

+ * 指标字段阈值配置表 服务类 + *

+* +* @author yqf +* @since 2023-04-11 +*/ +public interface YwKpiConfigService extends IService { + + /** + * 指标字段阈值配置表列表 + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwKpiConfigQO qo); + + /** + * 指标字段阈值配置表分页列表 + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(YwKpiConfigQO qo); + + /** + * 指标字段阈值配置表详情 + * @param id + * @return + */ + YwKpiConfigVO fetchById(Long id); + + /** + * 指标字段阈值配置表新增或修改 + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(YwKpiConfigDTO dto); + + /** + * 指标字段阈值配置表删除(单个条目) + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 指标字段阈值配置表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 指标字段阈值配置表导出 + * @param qo + * @return + */ + void export(YwKpiConfigQO qo); + + /** + * 指标字段阈值配置表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeBriefingService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeBriefingService.java new file mode 100644 index 0000000000000000000000000000000000000000..f6ddbeb335093fe207ca9c720700d696874403cd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeBriefingService.java @@ -0,0 +1,152 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwNoticeBriefing; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeBriefingDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeBriefingQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeBriefingVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告简报计划表 服务类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeBriefingService extends IService { + + /** + * 通知通告简报计划表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwNoticeBriefingQO qo); + + /** + * 通知通告简报计划表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(YwNoticeBriefingQO qo); + + /** + * 通知通告简报计划表详情 + * + * @param id + * @return + */ + YwNoticeBriefingVO fetchById(Long id); + + /** + * 通知通告简报计划表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(YwNoticeBriefingDTO dto); + + /** + * 通知通告简报计划表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 通知通告简报计划表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 通知通告简报计划表导出 + * + * @param qo + * @return + */ + void export(YwNoticeBriefingQO qo); + + /** + * 通知通告简报计划表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); + + /** + * 定时发送简报 + * + * @param + * @return + */ + void eastcomYwSendBriefingSchedule(); + + /** + * 自动切换发送方式定时任务 + * + * @param + * @return + */ + void eastcomYwUpdateBriefingSendTypeSchedule(); + + /** + * 保存json到本地 + */ + JSONObject getJson(Long venueId,Integer timeInterval); + + /** + * 组装场馆级简报 + * + * @param + * @return + */ + String assemblyVenueBriefing(LocalDateTime sendTime,Long venueId,Integer timeInterval,Long modelId); + + /** + * 组装场馆级简报JSON + */ + String assemblyVenueJsonToGetURL(LocalDateTime sendTime, Long venueId, Integer timeInterval); + + /** + * 组装区县级简报JSON + */ + String assemblyCountyJsonToGetURL(LocalDateTime sendTime, Long venueId, Integer timeInterval); + + /** + * 组装地市级简报JSON + */ + String assemblyCityJsonToGetURL(LocalDateTime sendTime, Long venueId, Integer timeInterval); + + /** + * 组装地市级简报 + * + * @param + * @return + */ + String assemblyCityBriefing(LocalDateTime sendTime,String city,Integer timeInterval,Long modelId); + + /** + * 组装区县级简报 + * + * @param + * @return + */ + String assemblyCountyBriefing(LocalDateTime sendTime,String city,Integer timeInterval); + + List getModel(Long venueId,String modelSuitType); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeHandworkService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeHandworkService.java new file mode 100644 index 0000000000000000000000000000000000000000..068692ee466982133fcd1e8b15999a93df4be718 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeHandworkService.java @@ -0,0 +1,92 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwNoticeHandwork; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeHandworkDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeHandworkQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeHandworkVO; + +import java.util.List; + +/** + *

+ * 通知通告手工通知计划表 服务类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeHandworkService extends IService { + + /** + * 通知通告手工通知计划表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwNoticeHandworkQO qo); + + /** + * 通知通告手工通知计划表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(YwNoticeHandworkQO qo); + + /** + * 通知通告手工通知计划表详情 + * + * @param id + * @return + */ + YwNoticeHandworkVO fetchById(Long id); + + /** + * 通知通告手工通知计划表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + Long saveOrUpdate(YwNoticeHandworkDTO dto); + + /** + * 通知通告手工通知计划表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 通知通告手工通知计划表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 通知通告手工通知计划表导出 + * + * @param qo + * @return + */ + void export(YwNoticeHandworkQO qo); + + /** + * 通知通告手工通知计划表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); + + /** + * 查询审核通过的手工通知添加到sys_notice等待发送 + */ + void eastcomSelectPassAndAddNoticeSchedule(); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeHandworkdetailService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeHandworkdetailService.java new file mode 100644 index 0000000000000000000000000000000000000000..83eaef2a32fb74591fae0665101b029b36662f58 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeHandworkdetailService.java @@ -0,0 +1,87 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwNoticeHandworkdetail; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeHandworkdetailDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeHandworkdetailQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeHandworkdetailVO; + +import java.util.List; + +/** + *

+ * 通知通告手工通知审核表 服务类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeHandworkdetailService extends IService { + + /** + * 通知通告手工通知审核表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwNoticeHandworkdetailQO qo); + + /** + * 通知通告手工通知审核表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(YwNoticeHandworkdetailQO qo); + + /** + * 通知通告手工通知审核表详情 + * + * @param id + * @return + */ + YwNoticeHandworkdetailVO fetchById(Long id); + + /** + * 通知通告手工通知审核表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(YwNoticeHandworkdetailDTO dto); + + /** + * 通知通告手工通知审核表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 通知通告手工通知审核表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 通知通告手工通知审核表导出 + * + * @param qo + * @return + */ + void export(YwNoticeHandworkdetailQO qo); + + /** + * 通知通告手工通知审核表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeListService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeListService.java new file mode 100644 index 0000000000000000000000000000000000000000..f326dcd0eaf7bebbf396267aa0beeb4e2b560191 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeListService.java @@ -0,0 +1,87 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwNoticeList; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeListDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeListQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeListVO; + +import java.util.List; + +/** + *

+ * 通知通告记录表 服务类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeListService extends IService { + + /** + * 通知通告记录表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwNoticeListQO qo); + + /** + * 通知通告记录表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(YwNoticeListQO qo); + + /** + * 通知通告记录表详情 + * + * @param id + * @return + */ + YwNoticeListVO fetchById(Long id); + + /** + * 通知通告记录表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(YwNoticeListDTO dto); + + /** + * 通知通告记录表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 通知通告记录表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 通知通告记录表导出 + * + * @param qo + * @return + */ + void export(YwNoticeListQO qo); + + /** + * 通知通告记录表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeModelService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeModelService.java new file mode 100644 index 0000000000000000000000000000000000000000..7d64b6ba280dee61c901f9814f328b761e5dd190 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeModelService.java @@ -0,0 +1,88 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwNoticeModel; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeModelDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeModelQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; + +import java.util.List; + +/** + *

+ * 通知通告模板表 服务类 + *

+ * + * @author ck + * @since 2023-04-07 + */ +public interface YwNoticeModelService extends IService { + + /** + * 通知通告模板表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwNoticeModelQO qo); + + /** + * 通知通告模板表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(YwNoticeModelQO qo); + + /** + * 通知通告模板表详情 + * + * @param id + * @return + */ + YwNoticeModelVO fetchById(Long id); + + /** + * 通知通告模板表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(YwNoticeModelDTO dto); + + /** + * 通知通告模板表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 通知通告模板表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 通知通告模板表导出 + * + * @param qo + * @return + */ + void export(YwNoticeModelQO qo); + + /** + * 通知通告模板表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeObjectService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeObjectService.java new file mode 100644 index 0000000000000000000000000000000000000000..a71a71a6a68057453ffa507b01b5793cb5453a76 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeObjectService.java @@ -0,0 +1,95 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwNoticeObject; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeObjectDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeObjectQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeObjectVO; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 通知通告对象表 服务类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +public interface YwNoticeObjectService extends IService { + + /** + * 通知通告对象表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwNoticeObjectQO qo); + + /** + * 通知通告对象表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(YwNoticeObjectQO qo); + + /** + * 通知通告对象表ByIds + */ + List fetchByIds(List ids); + + /** + * 通知通告对象表详情 + * + * @param id + * @return + */ + YwNoticeObjectVO fetchById(Long id); + + /** + * 通知通告对象表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(YwNoticeObjectDTO dto); + + /** + * 通知通告对象表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 通知通告对象表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 通知通告对象表导出 + * + * @param qo + * @return + */ + void export(YwNoticeObjectQO qo); + + /** + * 通知通告对象表导入 + * + * @param + * @return + */ + AjaxResult importData(List list, boolean updateSupport); + + Map allObject(); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeUserService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeUserService.java new file mode 100644 index 0000000000000000000000000000000000000000..5743c5f5ab2370b298cef3f85cea343192188e48 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwNoticeUserService.java @@ -0,0 +1,22 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.YwNoticeUser; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +public interface YwNoticeUserService extends IService { + + public List getYwNoticeUserList(String flwId,String taskId,String groupId,String type); + + public boolean noticeYW(String flwId,String groupId,String type); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectConfigService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..d380e9d1f2defb126b8cf9c85561a57d61e41508 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectConfigService.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectConfig; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectConfigParam; + +import java.util.List; + +/** + * @author huamile + * @date 2023/1/18 15:28 + **/ +public interface YwRoutInspectConfigService extends IService { + + List getInspectConfigList(YwRoutInspectConfigParam param); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectLogService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..84d5e2d48ee784bf05b432b8b7d062d07e6c11f5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectLogService.java @@ -0,0 +1,12 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectLog; + +/** + * @author huamile + */ +public interface YwRoutInspectLogService extends IService { + + void updateLog(YwRoutInspectLog log); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectPlanService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectPlanService.java new file mode 100644 index 0000000000000000000000000000000000000000..c15b689d461c3445a645f0f234d8abfe9858186d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectPlanService.java @@ -0,0 +1,93 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectPlan; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectStatDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectTaskDTO; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectConfigParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectPlanParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectStatParam; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmInfoVo; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectLogVo; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectPlanStaticVo; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.text.ParseException; +import java.util.List; +import java.util.Map; + +/** + * @author huamile + * @date 2023/1/17 16:05 + **/ +public interface YwRoutInspectPlanService extends IService { + + /** + * 将到点的巡检计划加入工作流中 + */ + void insetInspectSchedule(); + + /** + * 根据条件获取巡检计划列表,一个工单号一条记录 + * @param param 场馆,时间 + * @return + */ + List getList(YwRoutInspectConfigParam param); + + TableDataInfo getPlanList(YwRoutInspectPlanParam param); + + /** + * 根据条件获取巡检统计结果 + * @param param 地市,区县,场馆,专业 + * @return + */ + Map getStatData(YwRoutInspectStatParam param); + + /** + * 根据条件获取巡检统计列表 + * @param param 地市,区县,场馆,专业 + * @return + */ + Map getStatListData(YwRoutInspectStatParam param); + + /** + * 根据条件获取巡检统计结果 + * @param param 地市,区县,场馆,专业 + * @return + */ + Map getResultStatData(YwRoutInspectStatParam param); + + /** + * 根据条件获取巡检统计列表 + * @param param 地市,区县,场馆,专业 + * @return + */ + Map getResultStatListData(YwRoutInspectStatParam param); + + public List getRoutInspectInfoList(String processId); + + /** + * 创建巡检任务 + * @param dto + */ + AjaxResult create(YwInspectTaskDTO dto) throws Exception; + + /** + * 编辑巡检任务 + * @param dto + */ + void updatePlan(YwInspectTaskDTO dto) throws Exception; + + void export(YwRoutInspectConfigParam param, HttpServletRequest request, HttpServletResponse response); + + void planExport(YwRoutInspectPlanParam param, HttpServletRequest request, HttpServletResponse response); + + List mergeResultStat(YwRoutInspectStatParam param); + + boolean checkPlanStatus(String dto); + + List getInspectPlanStatic(YwRoutInspectStatParam param); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectQuestionConfigService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectQuestionConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..ac07a22fe0982a6204a0ae214ddec5e5d7a71bb0 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwRoutInspectQuestionConfigService.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectQuestionConfig; +import com.ruoyi.eastcom_yw.domain.param.YwInspectQuestionConfigParam; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author huamile + * @date 2023/2/4 16:50 + **/ +public interface YwRoutInspectQuestionConfigService extends IService { + + List getlist(YwInspectQuestionConfigParam param); + + Integer create(YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig); + + Integer updateByPrimaryKeySelective(YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig); + + void export(YwInspectQuestionConfigParam param, HttpServletRequest request, HttpServletResponse response); + + List appList(YwInspectQuestionConfigParam param); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneAlarmService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneAlarmService.java new file mode 100644 index 0000000000000000000000000000000000000000..bfddc210986ebcae1c8df3d5c368d9e4b2540144 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneAlarmService.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.YwSceneAlarm; +import com.ruoyi.eastcom_yw.domain.param.YwSceneAlarmParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneAlarmVo; +import org.apache.ibatis.annotations.Param; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author huamile + */ +public interface YwSceneAlarmService extends IService { + + List getList(YwSceneAlarmParam param); + + List getListBySceneBigId(Long sceneBigId); + + Integer create(YwSceneAlarm ywSceneAlarm); + + Integer updateByPrimaryKeySelective(YwSceneAlarm ywSceneAlarm); + + Integer delBySceneIds(List ids); + + void export(YwSceneAlarmParam param, HttpServletRequest request, HttpServletResponse response); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneCalendarService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneCalendarService.java new file mode 100644 index 0000000000000000000000000000000000000000..1a0afdb86a794a56f86134d068c67bc24965cf29 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneCalendarService.java @@ -0,0 +1,35 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwSceneCalendar; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneCalendarDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendar2Vo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendarVo; +import org.apache.ibatis.annotations.Param; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.text.ParseException; +import java.util.List; + +/** + * @author huamile + */ +public interface YwSceneCalendarService extends IService { + + List getList(YwSceneCalendarParam param); + + List getListBySceneBigId(Long sceneBigId); + + Integer create(YwSceneCalendarDTO dto); + + Integer updateByPrimaryKeySelective(YwSceneCalendarDTO dto); + + Integer delBySceneIds(List ids); + + void export(YwSceneCalendarParam param, HttpServletRequest request, HttpServletResponse response); + + AjaxResult importSceneCalendar(List vos, Long sceneBigId, String importType) throws Exception; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneMatchService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneMatchService.java new file mode 100644 index 0000000000000000000000000000000000000000..3dc46ee20ae35a9f34cad6bf805a260158c19055 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneMatchService.java @@ -0,0 +1,33 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.param.YwSceneMatchParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneMatchVo; + +import java.text.ParseException; +import java.util.List; + +/** + * @author los + */ +public interface YwSceneMatchService { + + /** + * 导入赛程 + * + * @param vos + * @param sceneBigId + * @param importType + * @return + * @throws ParseException + */ + AjaxResult importMatch(List vos, Long sceneBigId, String importType) throws Exception; + + /** + * 查询赛程 + * + * @param param + * @return + */ + List list(YwSceneMatchParam param); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementAgisService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementAgisService.java new file mode 100644 index 0000000000000000000000000000000000000000..0dadc4c54e888c63fc9725bae2655a16a2485ab1 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementAgisService.java @@ -0,0 +1,34 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementAgisParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementAgis; + +import java.util.List; + +/** + * @author huamile + * @date 2023/2/14 14:54 + **/ +public interface YwSceneNetelementAgisService { + + /** + * 导入 + * + * @param cs 数据 + * @param sceneBigId 大场景id + * @param opType 导入类型 + * @param sceneId + * @return + * @throws Exception + */ + AjaxResult importAgis(List cs, Long sceneBigId, String opType, String sceneId) throws Exception; + + /** + * 列表 + * + * @param para + * @return + */ + List list(YwSceneNetelementAgisParam para); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementCsService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementCsService.java new file mode 100644 index 0000000000000000000000000000000000000000..52633294590946e43e7c8157bf182cf4a2230fbf --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementCsService.java @@ -0,0 +1,32 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementCsParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementCs; + +import java.util.List; + +/** + * @author huamile + * @date 2023/2/14 14:54 + **/ +public interface YwSceneNetelementCsService { + + /** + * 导入 + * + * @param cs + * @param sceneBigId + * @param opType + * @param sceneId + * @return + */ + AjaxResult importCs(List cs, Long sceneBigId, String opType, String sceneId) throws Exception; + + /** + * 列表 + * @param param + * @return + */ + List list(YwSceneNetelementCsParam param); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementDhService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementDhService.java new file mode 100644 index 0000000000000000000000000000000000000000..eecef4bf5105348a728fd910a8d47a428640061e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementDhService.java @@ -0,0 +1,32 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementDhParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementDh; + +import java.util.List; + +/** + * @author huamile + * @date 2023/2/14 14:54 + **/ +public interface YwSceneNetelementDhService { + + /** + * 导入 + * + * @param cs + * @param sceneBigId + * @param opType + * @param sceneId + * @return + */ + AjaxResult importDh(List cs, Long sceneBigId, String opType, String sceneId) throws Exception; + + /** + * 列表 + * @param para + * @return + */ + List list(YwSceneNetelementDhParam para); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementService.java new file mode 100644 index 0000000000000000000000000000000000000000..ceac8d71771652a496e51bb1038e00a8b5242312 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementService.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.YwSceneNetelement; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementParam; +import org.apache.ibatis.annotations.Param; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author huamile + * @date 2023/2/14 14:54 + **/ +public interface YwSceneNetelementService extends IService { + + List getList(YwSceneNetelementParam param); + + List getListBySceneBigId(Long sceneBigId); + + Integer create(YwSceneNetelement ywSceneNetelement); + + Integer updateByPrimaryKeySelective(YwSceneNetelement ywSceneNetelement); + + Integer delBySceneIds(List ids); + + void export(YwSceneNetelementParam param, HttpServletRequest request, HttpServletResponse response); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementWxService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementWxService.java new file mode 100644 index 0000000000000000000000000000000000000000..2be6f36936e82198d1695ad8866ed7d7f25d994a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNetelementWxService.java @@ -0,0 +1,39 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementWxParam; +import com.ruoyi.eastcom_yw.domain.vo.WholeAreaAssureCellSheet; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementWx; + +import java.util.List; + +/** + * @author huamile + * @date 2023/2/14 14:54 + **/ +public interface YwSceneNetelementWxService { + + /** + * 导入 + * + * @param cs + * @param sceneBigId + * @param optType + * @param sceneId + * @return + */ + AjaxResult importWx(List cs, Long sceneBigId, String optType, String sceneId) throws Exception; + + /** + * 列表 + * @param para + * @return + */ + List list(YwSceneNetelementWxParam para); + + List list2(YwSceneNetelementWxParam para); + + List listCell(YwSceneNetelementWxParam param); + + List listSeat(Long sceneId); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNoticeinfoService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNoticeinfoService.java new file mode 100644 index 0000000000000000000000000000000000000000..b763d03f76603278bf7a4d51e29a9701b56e1d69 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneNoticeinfoService.java @@ -0,0 +1,39 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneNoticeinfoSearchDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNoticeinfo; + +import java.util.List; + +/** + * (YwSceneNoticeinfo)表服务接口 + * + * @author lee + * @since 2023-05-23 10:10:40 + */ +public interface YwSceneNoticeinfoService extends IService { + + /** + * 通过条件查询 + * + * @param ywSceneNoticeinfo 条件 + * @return 数据 + */ + List getNoticeinfoBySearch(YwSceneNoticeinfoSearchDTO ywSceneNoticeinfo); + + /** + * 批量导入 + * + * @param ywSceneNoticeinfos 数据 + * @param importType 导入模式 + * @return 导入结果 + */ + AjaxResult batchImport(List ywSceneNoticeinfos, String importType) throws Exception; + + void reset(Boolean isNet); + + void statisticsNetNum(); +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwScenePictureService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwScenePictureService.java new file mode 100644 index 0000000000000000000000000000000000000000..786275f29a056717e52acbbdaa1995a834403654 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwScenePictureService.java @@ -0,0 +1,71 @@ +package com.ruoyi.eastcom_yw.service; + +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.core.domain.AjaxResult; + +import java.util.Map; + +/** + * @author los + */ +public interface YwScenePictureService { + + /** + * 任务管理 + * + * @param id 场馆id + * @return 统计数据 + */ + JSONObject listTaskManage(Long id); + + /** + * 人员签到 + * + * @param id 场馆id + * @return 统计数据 + */ + JSONObject listSign(Long id); + + /** + * 场馆基本信息 + * + * @param id 场馆id + * @return 统计数据 + */ + JSONObject listMatchTop3(Long id); + + /** + * 场馆告警 + * + * @param id 场馆id + * @return 统计数据 + */ + JSONObject listAlarm(Long id); + + /** + * 场馆性能(15分粒度) + * + * @param id 场馆id + * @param typeId 45g + * @return 统计数据 + */ + JSONObject listKPI(Long id, String typeId); + + Map listKPIALL(Long id); + + AjaxResult listNetKpi(Long id, Integer type); + + AjaxResult listTransKpi(Long id, Integer type); + + JSONObject getAlarmTopDetail(Long id); + + void generateAlarmStatisticsEvery5Minutes(); + + /** + * 中小屏场馆画像-巡检统计数据 + * + * @param id 场馆id + * @return + */ + JSONObject listTaskManage2(Long id,Boolean taskFlag); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneService.java new file mode 100644 index 0000000000000000000000000000000000000000..7b7d856c6575e2d7506d4df03dd0fe623a36f08e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneService.java @@ -0,0 +1,78 @@ +package com.ruoyi.eastcom_yw.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.YwSceneView; +import com.ruoyi.eastcom_yw.domain.dto.YwDataDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneParam; +import com.ruoyi.eastcom_yw.domain.vo.SceneBaseStation; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneRedisVO; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneVo; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-12 + */ +public interface YwSceneService extends IService { + + + void loadingVenueCache(); + + public List selectVenues(); + + Object validateUserVenues(Object o,Class clazz,String targetName); + + /** + * 根据大场景id获取场馆 + * + * @param sceneBigId 大场景id + * @return 场馆 + */ + public List getVenueByBigId(Long sceneBigId); + + public List getVenueByUser(SysUser user); + + public List getVenueByUserCanNoData(SysUser user,Boolean display); + + public List getVenueByUser(SysUser user, Long sceneBigId); + + public List getSysUserByVenueAndOther(YwDataDTO ywDataDTO); + + List msgList(YwSceneParam param); + + void create(YwSceneDTO dto); + + void updateByPrimaryKeySelective(YwSceneDTO dto); + + void delByIds(List ids); + + void export(YwSceneParam param, HttpServletRequest request, HttpServletResponse response); + + void bigSceneExport(Long sceneBigId, HttpServletRequest request, HttpServletResponse response); + + void exportTemplate(HttpServletRequest request, HttpServletResponse response); + + void importSceneBigConfig(MultipartFile file) throws Exception; + + AjaxResult importYWScene(List list, Long sceneBigId, String importType) throws Exception; + + void exportReal(YwSceneParam param, HttpServletRequest request, HttpServletResponse response); + + void importStationByScene(MultipartFile multipartFile, Long sceneBigId, Long sceneId); + + void getJsonBySceneId(Long sceneId,HttpServletResponse response)throws Exception; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneTestDataService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneTestDataService.java new file mode 100644 index 0000000000000000000000000000000000000000..7a30bed409d685fc7ca2be6448e48bb6a8e08e5a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneTestDataService.java @@ -0,0 +1,13 @@ +package com.ruoyi.eastcom_yw.service; + +import com.alibaba.fastjson2.JSONObject; + +import java.util.List; + +public interface YwSceneTestDataService { + + void insertTestData(); + + List getList(); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneUserService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneUserService.java new file mode 100644 index 0000000000000000000000000000000000000000..5ba1bacb530eaf4be41599ba2c572793543569a5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSceneUserService.java @@ -0,0 +1,44 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.SysUserImp; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.domain.param.SysUserParam; +import com.ruoyi.eastcom_yw.domain.vo.SysUserVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneUserVo; +import com.ruoyi.eastcom_yw.domain.param.YwSceneUserParam; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author huamile + */ +public interface YwSceneUserService extends IService { + + List getList(YwSceneUserParam param); + + List getVenuesByUserId(Long userId); + + List getVenuesByUserIds(List userIds); + + List getListBySceneBigId(Long sceneBigId); + + void create(YwSceneUser ywSceneUser); + + void delete(Long userId); + + void updateByPrimaryKeySelective(YwSceneUser ywSceneUser); + + Integer delBySceneIds(List ids); + + void export(YwSceneUserParam param, HttpServletRequest request, HttpServletResponse response); + + AjaxResult importSysUser(List imps, Long sceneBigId, String importType) throws Exception; + + List listSysUser(SysUserParam para); + + void exportForImport(SysUserParam para, HttpServletRequest request, HttpServletResponse response); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSignLogService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSignLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..689ece6a54e0cb70f2c3d326f915b7c87595366a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSignLogService.java @@ -0,0 +1,15 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.YwSignLog; +import com.ruoyi.eastcom_yw.domain.dto.YwSignDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignInDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignVo; + +public interface YwSignLogService extends IService { + void SignIn(YwSignInDTO ywSignInDTO); + YwSignVo couldSign(YwSignDTO ywSignDTO); + Boolean sign(YwSignDTO ywSignDTO); + Boolean signTest(YwSignDTO ywSignDTO); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSignLogViewService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSignLogViewService.java new file mode 100644 index 0000000000000000000000000000000000000000..2e91c402251d77fbc2c5269683223f1c3c24e95b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSignLogViewService.java @@ -0,0 +1,24 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.YwSignLogView; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogStaticVo; + +import java.util.List; + +public interface YwSignLogViewService extends IService { + + TableDataInfo getSignLog(YwSignLogDTO ywSignLogDTO); + + + List getSignLogStatic(YwSignLogDTO ywSignLogDTO); + + List getSignLogAndPlan(Long venueId); + + List getSignLogByPlanId(Long signPlanId); + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSignPlanService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSignPlanService.java new file mode 100644 index 0000000000000000000000000000000000000000..77d6424435e132203eaca3a00fbd4088d62efe11 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSignPlanService.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.YwSignPlanView; +import com.ruoyi.eastcom_yw.domain.dto.YwSignPlanDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignPlanVo; + +import java.text.ParseException; +import java.util.List; + +public interface YwSignPlanService extends IService { + + TableDataInfo getSignPlan(YwSignPlanDTO ywSignPlanDTO); + + public boolean insertSignPlan(YwSignPlanDTO ywSignPlanDTO); + + public AjaxResult importSignPlan(List signPlanList, Boolean isUpdateSupport, Long sceneBigId) throws ParseException; + + public boolean updateSignPlan(YwSignPlanDTO ywSignPlanDTO); + + public boolean deleteSignPlan(Long id); + + public YwSignPlanVo handleYwSignPlan(YwSignPlanView ywSignPlanView); + + public List getSignPlan(Long venueId,String signDate); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSparePartsService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSparePartsService.java new file mode 100644 index 0000000000000000000000000000000000000000..926fd211fd75e874069a108d01bc01755d57cb78 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwSparePartsService.java @@ -0,0 +1,88 @@ +package com.ruoyi.eastcom_yw.service; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwSpareParts; +import com.ruoyi.eastcom_yw.domain.dto.YwSparePartsDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwSparePartsQO; +import com.ruoyi.eastcom_yw.domain.vo.YwSparePartsVO; + +import java.util.List; + +/** + *

+ * 亚运备件表 服务类 + *

+ * + * @author yqf + * @since 2023-08-31 + */ +public interface YwSparePartsService extends IService { + + /** + * 亚运备件表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + List getData(YwSparePartsQO qo); + + /** + * 亚运备件表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + IPage getDataByPage(YwSparePartsQO qo); + + /** + * 亚运备件表详情 + * + * @param id + * @return + */ + YwSparePartsVO fetchById(Long id); + + /** + * 亚运备件表新增或修改 + * + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(YwSparePartsDTO dto); + + /** + * 亚运备件表删除(单个条目) + * + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * 亚运备件表批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * 亚运备件表导出 + * + * @param qo + * @return + */ + void export(YwSparePartsQO qo); + + /** + * 亚运备件表导入 + * + * @param + * @return + */ + AjaxResult importData(List list) throws Exception ; +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwWireTaskLogService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwWireTaskLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..3c98b7f3058d0e17376c879ee689d3e6a804a662 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/YwWireTaskLogService.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.YwWireTaskLog; +import com.ruoyi.eastcom_yw.domain.dto.YwSignInDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwWireTaskLogDTO; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +public interface YwWireTaskLogService extends IService { + + Boolean insertWireTaskLog(YwWireTaskLogDTO ywWireTaskLogDTO); + + String insertWireTaskLogReWireTaskId(YwWireTaskLogDTO ywWireTaskLogDTO); + + Boolean updateWireTaskLog(YwWireTaskLogDTO ywWireTaskLogDTO); + + Boolean deleteWireTaskLog(YwWireTaskLogDTO ywWireTaskLogDTO); + + TableDataInfo getWireTaskLog(YwWireTaskLogDTO ywWireTaskLogDTO); + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2SpotCellConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2SpotCellConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..b0369d639da458edd5fbf954718b0988befbac53 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2SpotCellConvert.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.Dp2SpotCell; +import com.ruoyi.eastcom_yw.domain.dto.Dp2SpotCellDTO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2SpotCellVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface Dp2SpotCellConvert { + +Dp2SpotCellConvert INSTANCE = Mappers.getMapper(Dp2SpotCellConvert.class); + +Dp2SpotCell dtoToEntity(Dp2SpotCellDTO dto); + +Dp2SpotCellVO entityToVo(Dp2SpotCell entity); + +List entityToVoList(List entityList); + +Dp2SpotCellDTO entityToDto(Dp2SpotCell entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2SpotConfigConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2SpotConfigConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..59bc12ba675067bda355acbeb7b9db84082a2b12 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2SpotConfigConvert.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.Dp2SpotConfig; +import com.ruoyi.eastcom_yw.domain.dto.Dp2SpotConfigDTO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2SpotConfigVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface Dp2SpotConfigConvert { + +Dp2SpotConfigConvert INSTANCE = Mappers.getMapper(Dp2SpotConfigConvert.class); + +Dp2SpotConfig dtoToEntity(Dp2SpotConfigDTO dto); + +Dp2SpotConfigVO entityToVo(Dp2SpotConfig entity); + +List entityToVoList(List entityList); + +Dp2SpotConfigDTO entityToDto(Dp2SpotConfig entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2ViewPowerAlarmConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2ViewPowerAlarmConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..57e2ea3ece3c8e7db9afe9b35f795d73b7907b2d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2ViewPowerAlarmConvert.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.Dp2ViewPowerAlarm; +import com.ruoyi.eastcom_yw.domain.dto.Dp2ViewPowerAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewPowerAlarmVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface Dp2ViewPowerAlarmConvert { + +Dp2ViewPowerAlarmConvert INSTANCE = Mappers.getMapper(Dp2ViewPowerAlarmConvert.class); + +Dp2ViewPowerAlarm dtoToEntity(Dp2ViewPowerAlarmDTO dto); + +Dp2ViewPowerAlarmVO entityToVo(Dp2ViewPowerAlarm entity); + +List entityToVoList(List entityList); + +Dp2ViewPowerAlarmDTO entityToDto(Dp2ViewPowerAlarm entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2ViewWirelessAlarmConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2ViewWirelessAlarmConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..250927873999d5ad42ace99193ef1199d5066e04 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/Dp2ViewWirelessAlarmConvert.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.Dp2ViewWirelessAlarm; +import com.ruoyi.eastcom_yw.domain.dto.Dp2ViewWirelessAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewWirelessAlarmVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface Dp2ViewWirelessAlarmConvert { + +Dp2ViewWirelessAlarmConvert INSTANCE = Mappers.getMapper(Dp2ViewWirelessAlarmConvert.class); + +Dp2ViewWirelessAlarm dtoToEntity(Dp2ViewWirelessAlarmDTO dto); + +Dp2ViewWirelessAlarmVO entityToVo(Dp2ViewWirelessAlarm entity); + +List entityToVoList(List entityList); + +Dp2ViewWirelessAlarmDTO entityToDto(Dp2ViewWirelessAlarm entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/DpSceneConfigConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/DpSceneConfigConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..472b29ae9d3200656ef0f85d74efc824937aa96c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/DpSceneConfigConvert.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.DpSceneConfig; +import com.ruoyi.eastcom_yw.domain.dto.DpSceneConfigDTO; +import com.ruoyi.eastcom_yw.domain.vo.DpSceneConfigVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface DpSceneConfigConvert { + + DpSceneConfigConvert INSTANCE = Mappers.getMapper(DpSceneConfigConvert.class); + + DpSceneConfig dtoToEntity(DpSceneConfigDTO dto); + + DpSceneConfigVO entityToVo(DpSceneConfig entity); + + List entityToVoList(List entityList); + + DpSceneConfigDTO entityToDto(DpSceneConfig entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi4gCellConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi4gCellConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..576adf117318a5e7d7f3ca411482740bd1a0ad8c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi4gCellConvert.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi4gCellDTO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gCellVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface PmKpi4gCellConvert { + + PmKpi4gCellConvert INSTANCE = Mappers.getMapper(PmKpi4gCellConvert.class); + + PmKpi4gCell dtoToEntity(PmKpi4gCellDTO dto); + + PmKpi4gCellVO entityToVo(PmKpi4gCell entity); + + List entityToVoList(List entityList); + + PmKpi4gCellDTO entityToDto(PmKpi4gCell entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi4gMinConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi4gMinConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..2ce531b2d5182646dbe07dc9bc5fc89dfb1182bd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi4gMinConvert.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.PmKpi4gMin; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi4gMinDTO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gMinVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface PmKpi4gMinConvert { + + PmKpi4gMinConvert INSTANCE = Mappers.getMapper(PmKpi4gMinConvert.class); + + PmKpi4gMin dtoToEntity(PmKpi4gMinDTO dto); + + PmKpi4gMinVO entityToVo(PmKpi4gMin entity); + + List entityToVoList(List entityList); + + PmKpi4gMinDTO entityToDto(PmKpi4gMin entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi4gVenueConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi4gVenueConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..edd2496d1fef5eadd0d3a4bfb33a1141dd29260f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi4gVenueConvert.java @@ -0,0 +1,27 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.PmKpi4gVenue; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi4gVenueDTO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gVenueVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Mapper +public interface PmKpi4gVenueConvert { + + PmKpi4gVenueConvert INSTANCE = Mappers.getMapper(PmKpi4gVenueConvert.class); + + PmKpi4gVenue dtoToEntity(PmKpi4gVenueDTO dto); + + PmKpi4gVenueVO entityToVo(PmKpi4gVenue entity); + + List entityToVoList(List entityList); + + PmKpi4gVenueDTO entityToDto(PmKpi4gVenue entity); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi5gCellConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi5gCellConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..49b9545b84ade0d99d9aaaf9afb225a8543fb536 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi5gCellConvert.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.PmKpi5gCell; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi5gCellDTO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi5gCellVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface PmKpi5gCellConvert { + + PmKpi5gCellConvert INSTANCE = Mappers.getMapper(PmKpi5gCellConvert.class); + + PmKpi5gCell dtoToEntity(PmKpi5gCellDTO dto); + + PmKpi5gCellVO entityToVo(PmKpi5gCell entity); + + List entityToVoList(List entityList); + + PmKpi5gCellDTO entityToDto(PmKpi5gCell entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi5gMinConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi5gMinConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..c75c2fd138d8de54ee2892d639473f67c10289f6 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi5gMinConvert.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.PmKpi5gMin; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi5gMinDTO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi5gMinVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface PmKpi5gMinConvert { + + PmKpi5gMinConvert INSTANCE = Mappers.getMapper(PmKpi5gMinConvert.class); + + PmKpi5gMin dtoToEntity(PmKpi5gMinDTO dto); + + PmKpi5gMinVO entityToVo(PmKpi5gMin entity); + + List entityToVoList(List entityList); + + PmKpi5gMinDTO entityToDto(PmKpi5gMin entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi5gVenueConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi5gVenueConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..459c0574cb2d7ed52d329ae87d480c5a41392f6f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/PmKpi5gVenueConvert.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.PmKpi5gVenue; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi5gVenueDTO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi5gVenueVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface PmKpi5gVenueConvert { + + PmKpi5gVenueConvert INSTANCE = Mappers.getMapper(PmKpi5gVenueConvert.class); + + PmKpi5gVenue dtoToEntity(PmKpi5gVenueDTO dto); + + PmKpi5gVenueVO entityToVo(PmKpi5gVenue entity); + + List entityToVoList(List entityList); + + PmKpi5gVenueDTO entityToDto(PmKpi5gVenue entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/SysNoticeConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/SysNoticeConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..97838a2df934c8c48c94caf33d507401f6e4ebf8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/SysNoticeConvert.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.domain.dto.SysNoticeDTO; +import com.ruoyi.eastcom_yw.domain.vo.SysNoticeVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface SysNoticeConvert { + + SysNoticeConvert INSTANCE = Mappers.getMapper(SysNoticeConvert.class); + + SysNotice dtoToEntity(SysNoticeDTO dto); + + SysNoticeVO entityToVo(SysNotice entity); + + List entityToVoList(List entityList); + + SysNoticeDTO entityToDto(SysNotice entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwDrsConfigConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwDrsConfigConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..fa46c35d5f87468ecb07f3374e6f10811e732fee --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwDrsConfigConvert.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.YwDrsConfig; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsConfigDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsConfigVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface YwDrsConfigConvert { + + YwDrsConfigConvert INSTANCE = Mappers.getMapper(YwDrsConfigConvert.class); + + YwDrsConfig dtoToEntity(YwDrsConfigDTO dto); + + YwDrsConfigVO entityToVo(YwDrsConfig entity); + + List entityToVoList(List entityList); + + YwDrsConfigDTO entityToDto(YwDrsConfig entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwDrsTempTaskConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwDrsTempTaskConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..46a0fcc311c3c5d62828c5dffa64de5306c782b8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwDrsTempTaskConvert.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.YwDrsTempTask; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsTempTaskDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsTempTaskVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface YwDrsTempTaskConvert { + + YwDrsTempTaskConvert INSTANCE = Mappers.getMapper(YwDrsTempTaskConvert.class); + + YwDrsTempTask dtoToEntity(YwDrsTempTaskDTO dto); + + YwDrsTempTaskVO entityToVo(YwDrsTempTask entity); + + List entityToVoList(List entityList); + + YwDrsTempTaskDTO entityToDto(YwDrsTempTask entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwKpiConfigConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwKpiConfigConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..e4fe2c0a294cde94ed71899739aca01bcce3eaa4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwKpiConfigConvert.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.YwKpiConfig; +import com.ruoyi.eastcom_yw.domain.dto.YwKpiConfigDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwKpiConfigVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface YwKpiConfigConvert { + + YwKpiConfigConvert INSTANCE = Mappers.getMapper(YwKpiConfigConvert.class); + + YwKpiConfig dtoToEntity(YwKpiConfigDTO dto); + + YwKpiConfigVO entityToVo(YwKpiConfig entity); + + List entityToVoList(List entityList); + + YwKpiConfigDTO entityToDto(YwKpiConfig entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeBriefingConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeBriefingConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..c5b3c5276238867766921fd4784dc8f8bbe97d4f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeBriefingConvert.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.YwNoticeBriefing; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeBriefingDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeBriefingVO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface YwNoticeBriefingConvert { + + YwNoticeBriefingConvert INSTANCE = Mappers.getMapper(YwNoticeBriefingConvert.class); + + @Mapping(target = "noticeType",expression = "java(cn.hutool.json.JSONUtil.toJsonStr(dto.getNoticeType()))") + YwNoticeBriefing dtoToEntity(YwNoticeBriefingDTO dto); + + @Mapping(target = "noticeType",expression = "java(cn.hutool.json.JSONUtil.toList(entity.getNoticeType(),String.class))") + YwNoticeBriefingVO entityToVo(YwNoticeBriefing entity); + + List entityToVoList(List entityList); + + @Mapping(target = "noticeType",expression = "java(cn.hutool.json.JSONUtil.toList(entity.getNoticeType(),String.class))") + YwNoticeBriefingDTO entityToDto(YwNoticeBriefing entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeHandworkConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeHandworkConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..c684a057ea7dc341fa3ddbbb0ac961e728210346 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeHandworkConvert.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.YwNoticeHandwork; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeHandworkDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeHandworkVO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface YwNoticeHandworkConvert { + + YwNoticeHandworkConvert INSTANCE = Mappers.getMapper(YwNoticeHandworkConvert.class); + + @Mapping(target = "noticeType",expression = "java(cn.hutool.json.JSONUtil.toJsonStr(dto.getNoticeType()))") + YwNoticeHandwork dtoToEntity(YwNoticeHandworkDTO dto); + + @Mapping(target = "noticeType",expression = "java(cn.hutool.json.JSONUtil.toList(entity.getNoticeType(),String.class))") + YwNoticeHandworkVO entityToVo(YwNoticeHandwork entity); + + List entityToVoList(List entityList); + + @Mapping(target = "noticeType",expression = "java(cn.hutool.json.JSONUtil.toList(entity.getNoticeType(),String.class))") + YwNoticeHandworkDTO entityToDto(YwNoticeHandwork entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeHandworkdetailConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeHandworkdetailConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..be6aae84dff2115f921682a078fe02e51214efb5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeHandworkdetailConvert.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.YwNoticeHandworkdetail; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeHandworkdetailDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeHandworkdetailVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface YwNoticeHandworkdetailConvert { + + YwNoticeHandworkdetailConvert INSTANCE = Mappers.getMapper(YwNoticeHandworkdetailConvert.class); + + YwNoticeHandworkdetail dtoToEntity(YwNoticeHandworkdetailDTO dto); + + YwNoticeHandworkdetailVO entityToVo(YwNoticeHandworkdetail entity); + + List entityToVoList(List entityList); + + YwNoticeHandworkdetailDTO entityToDto(YwNoticeHandworkdetail entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeListConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeListConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..7f37cc586e3d77aabf9c52e5f1306a3606fd92f4 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeListConvert.java @@ -0,0 +1,25 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.YwNoticeList; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeListDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeListVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface YwNoticeListConvert { + + YwNoticeListConvert INSTANCE = Mappers.getMapper(YwNoticeListConvert.class); + + YwNoticeList dtoToEntity(YwNoticeListDTO dto); + + YwNoticeListVO entityToVo(YwNoticeList entity); + + List entityToVoList(List entityList); + + YwNoticeListDTO entityToDto(YwNoticeList entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeModelConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeModelConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..e7a4a6ca294f36f8a9f7b4d36a74c4dd87219def --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeModelConvert.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service.convert; + +import com.ruoyi.eastcom_yw.domain.YwNoticeModel; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeModelDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + + +@Mapper +public interface YwNoticeModelConvert { + + YwNoticeModelConvert INSTANCE = Mappers.getMapper(YwNoticeModelConvert.class); + + YwNoticeModel dtoToEntity(YwNoticeModelDTO dto); + + YwNoticeModelVO entityToVo(YwNoticeModel entity); + + List entityToVoList(List entityList); + + YwNoticeModelDTO entityToDto(YwNoticeModel entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeObjectConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeObjectConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..37874d32b07b7846c0950bc941c6c62efffb95a2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwNoticeObjectConvert.java @@ -0,0 +1,27 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.YwNoticeObject; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeObjectDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeObjectVO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface YwNoticeObjectConvert { + + YwNoticeObjectConvert INSTANCE = Mappers.getMapper(YwNoticeObjectConvert.class); + + YwNoticeObject dtoToEntity(YwNoticeObjectDTO dto); + + YwNoticeObjectVO entityToVo(YwNoticeObject entity); + + List entityToVoList(List entityList); + + YwNoticeObjectDTO entityToDto(YwNoticeObject entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwSparePartsConvert.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwSparePartsConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..adf60b38f05db769a7142f206d78feeec793e211 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/convert/YwSparePartsConvert.java @@ -0,0 +1,26 @@ +package com.ruoyi.eastcom_yw.service.convert; + + +import com.ruoyi.eastcom_yw.domain.YwSpareParts; +import com.ruoyi.eastcom_yw.domain.dto.YwSparePartsDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSparePartsVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface YwSparePartsConvert { + +YwSparePartsConvert INSTANCE = Mappers.getMapper(YwSparePartsConvert.class); + +YwSpareParts dtoToEntity(YwSparePartsDTO dto); + +YwSparePartsVO entityToVo(YwSpareParts entity); + +List entityToVoList(List entityList); + +YwSparePartsDTO entityToDto(YwSpareParts entity); + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/AppVersionServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/AppVersionServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0aa3574dcbce0bef9dc5cf6f60f186b7d4e88eaf --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/AppVersionServiceImpl.java @@ -0,0 +1,11 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.eastcom_yw.domain.AppVersionConfig; +import com.ruoyi.eastcom_yw.mapper.AppVersionConfigMapper; +import com.ruoyi.eastcom_yw.service.AppVersionService; +import org.springframework.stereotype.Service; + +@Service +public class AppVersionServiceImpl extends ServiceImpl implements AppVersionService { +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/CommonServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/CommonServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1562bda6781ed11057b628ac4f88bb581f0128ad --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/CommonServiceImpl.java @@ -0,0 +1,348 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.poi.excel.ExcelReader; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.core.domain.dto.HandleDataDTO; +import com.ruoyi.common.core.domain.dto.StartProcessInstanceDTO; +import com.ruoyi.common.core.domain.dto.TaskDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.LoginBody; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.RestTemplateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.*; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Component +public class CommonServiceImpl implements CommonService { + + @Autowired + private RestTemplateUtils restTemplate; + + + @Autowired + private YwSceneService yw_sceneService; + + @Value("${workFlowUrl}") + private String workFlowUrl; + + //查询ProcessDefinitionId + @Override + public String GetProcessDefinitionId(String template_id) throws Exception { + + String url_detail = workFlowUrl+"/workspace/process/detail?templateId=" + template_id; +// String url_detail = "http://localhost:8093/workspace/process/detail?templateId=" + template_id; + ResponseEntity responseEntityDetail = null; + + try { + responseEntityDetail = restTemplate.get(url_detail, this.getHeaders(),String.class); + } catch (Exception ex) { + throw new Exception("template_id:" + template_id + ",workspace/process/detail请求错误"); + } + + + if (responseEntityDetail == null) { + throw new Exception("workspace/process/detail没有正确的返回值"); + } + + String resDetail = responseEntityDetail.getBody(); + + JSONObject obj_resDetail = JSONObject.parseObject(resDetail); + + //必须要有processDefinitionId才可以创建工作流 + if (obj_resDetail.getBoolean("success")) { + + JSONObject obj_resultDetail = obj_resDetail.getJSONObject("result"); + + return obj_resultDetail.getString("processDefinitionId"); + + } + + throw new Exception("workspace/process/detail返回错误"); + + } + + //启动流程并返回流程ID + @Override + public String StartProcess(StartProcessInstanceDTO startDTO) throws Exception { + + ResponseEntity responseEntityStart =null; + + String url = workFlowUrl+"/workspace/process/start"; +// String url = "http://localhost:8093/workspace/process/start"; + + HttpEntity request = new HttpEntity(JSONObject.toJSONString(startDTO),this.getHeaders()); + + try { + responseEntityStart = restTemplate.exchange(url, HttpMethod.POST, request, String.class); + //延迟2秒请求 +// Thread.sleep(2000L); + } + catch (Exception ex){ + throw new Exception("workspace/process/start请求错误"); + } + + if(responseEntityStart==null) + { + throw new Exception("workspace/process/start没有正确的返回值"); + } + + String resStart = responseEntityStart.getBody(); + + JSONObject obj_resStart = JSONObject.parseObject(resStart); + + + if (obj_resStart.getBoolean("success")) { + return obj_resStart.getString("result"); + } + + throw new Exception("流程启动失败"); + + } + + //自定义当前流程状态 + @Override + public Boolean UpdateProcessStatus(HandleDataDTO handleDataDTO) throws Exception { + + ResponseEntity responseEntityStart =null; + + String url = workFlowUrl+"/workspace/assignee"; + + HttpEntity request = new HttpEntity(JSONObject.toJSONString(handleDataDTO),this.getHeaders()); + + try { + responseEntityStart = restTemplate.exchange(url, HttpMethod.POST, request, String.class); + } + catch (Exception ex){ + throw new Exception("workspace/assignee接口是错误的"); + } + + if(responseEntityStart==null) + { + throw new Exception("workspace/process/assignee没有正确的返回值"); + } + + String resStart = responseEntityStart.getBody(); + + JSONObject obj_resStart = JSONObject.parseObject(resStart); + + return obj_resStart.getBoolean("success"); + + } + + @Override + public JSONObject getTaskInfo(HandleDataDTO handleDataDTO) throws Exception { + ResponseEntity responseEntityStart =null; + + String url = workFlowUrl+"/workspace/process/taskInfo"; + + HttpEntity request = new HttpEntity(JSONObject.toJSONString(handleDataDTO),this.getHeaders()); + + try { + responseEntityStart = restTemplate.exchange(url, HttpMethod.POST, request, String.class); + } + catch (Exception ex){ + throw new Exception("workspace/process/taskInfo请求错误"+ex.getMessage()); + } + + if(responseEntityStart==null) + { + throw new Exception("workspace/process/taskInfo没有正确的返回值"); + } + + String resStart = responseEntityStart.getBody(); + + JSONObject obj_resStart = JSONObject.parseObject(resStart); + + + if (obj_resStart.getBoolean("success")) { + return obj_resStart.getJSONObject("result"); + } + + throw new Exception("节点详情查询失败"); + } + + @Override + public Boolean agreeTask(HandleDataDTO handleDataDTO) throws Exception { + + ResponseEntity responseEntityStart =null; + + String url = workFlowUrl+"/workspace/agree"; + + + HttpEntity request = new HttpEntity(JSONObject.toJSONString(handleDataDTO),this.getHeaders()); + + try { + responseEntityStart = restTemplate.exchange(url, HttpMethod.POST, request, String.class); + //延迟2秒请求 +// Thread.sleep(2000L); + } + catch (Exception ex){ + throw new Exception("请求workspace/agree接口发生错误"); + } + + if(responseEntityStart==null) + { + throw new Exception("workspace/agree没有正确的返回值"); + } + + String resStart = responseEntityStart.getBody(); + + JSONObject obj_resStart = JSONObject.parseObject(resStart); + + return obj_resStart.getBoolean("success"); + + } + + @Override + public Boolean revokeTask(HandleDataDTO handleDataDTO) throws Exception { + + ResponseEntity responseEntityStart =null; + + String url = workFlowUrl+"/workspace/revokeByProcess"; + + + HttpEntity request = new HttpEntity(JSONObject.toJSONString(handleDataDTO),this.getHeaders()); + + try { + responseEntityStart = restTemplate.exchange(url, HttpMethod.POST, request, String.class); + //延迟2秒请求 +// Thread.sleep(2000L); + } + catch (Exception ex){ + throw new Exception("请求接口发生错误"); + } + + if(responseEntityStart==null) + { + throw new Exception("没有正确的返回值"); + } + + String resStart = responseEntityStart.getBody(); + + JSONObject obj_resStart = JSONObject.parseObject(resStart); + + return obj_resStart.getBoolean("success"); + + } + + @Override + public JSONObject toDoList(TaskDTO taskDTO) throws Exception { + ResponseEntity responseEntityStart =null; + + String url = workFlowUrl+"/workspace/process/toDoList"; + + HttpEntity request = new HttpEntity(JSONObject.toJSONString(taskDTO),this.getHeaders()); + + try { + responseEntityStart = restTemplate.exchange(url, HttpMethod.POST, request, String.class); + } + catch (Exception ex){ + throw new Exception("workspace/process/toDoList请求错误"+ex.getMessage()); + } + + if(responseEntityStart==null) + { + throw new Exception("workspace/process/toDoList没有正确的返回值"); + } + + String resStart = responseEntityStart.getBody(); + + JSONObject obj_resStart = JSONObject.parseObject(resStart); + + + if (obj_resStart.getBoolean("success")) { + return obj_resStart.getJSONObject("result"); + } + + throw new Exception("待办查询失败"); + + } + + @Override + public List selectCurrenUserTodoProcessId(String alarmType) { + TaskDTO taskDTO = new TaskDTO(); + taskDTO.setPageNo(1); + taskDTO.setPageSize(10000); + UserInfo user = new UserInfo(); + LoginUser loginUser = SecurityUtils.getLoginUser(); + user.setId(loginUser.getUserId().toString()); + user.setName(loginUser.getUsername()); + List roles = loginUser.getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.toList()); + user.setRoles(roles); + user.setSpecialty(alarmType); + List venueByUser = yw_sceneService.getVenueByUser(loginUser.getUser()); + user.setVenue(venueByUser.stream().map(l->l.getId().toString()).collect(Collectors.toList())); + taskDTO.setCurrentUserInfo(user); + taskDTO.setSearchInfo(null); + taskDTO.setIsApp("true"); + List processIds=new ArrayList<>(); + try { + JSONObject jsonObject = toDoList(taskDTO); + processIds = jsonObject.getList("records", JSONObject.class).stream().map(l -> l.getString("processInstanceId")).collect(Collectors.toList()); + } catch (Exception e) { + e.printStackTrace(); + } + return processIds; + } + + + //获取登录的token,仅测试用 + @Override + public String getToken(String userName, String password) + { +// String url ="http://192.168.97.212:9010/login"; +// String url ="http://192.168.5.132:8081/login"; + String url ="http://localhost:9010/login"; + LoginBody login =new LoginBody(); + login.setUsername(userName); + login.setPassword(password); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity request = new HttpEntity(JSONObject.toJSONString(login),headers); + ResponseEntity responseEntity = restTemplate.post(url,request,String.class); + String token = JSONObject.parseObject(responseEntity.getBody()).getString("token"); + return token; + } + + @Override + public String getTokenByPhone(String phone, String code) + { +// String url ="http://192.168.97.212:9010/login"; +// String url ="http://192.168.5.132:8081/login"; + String url ="http://localhost:8080/login"; + LoginBody login =new LoginBody(); + login.setPhone(phone); + login.setCode(code); + login.setLoginType("1"); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity request = new HttpEntity(JSONObject.toJSONString(login),headers); + ResponseEntity responseEntity = restTemplate.post(url,request,String.class); + String token = JSONObject.parseObject(responseEntity.getBody()).getString("token"); + return token; + } + + private HttpHeaders getHeaders() + { + HttpHeaders headers = new HttpHeaders(); + headers.add("isSys","true"); + headers.setContentType(MediaType.APPLICATION_JSON); + return headers; + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2MmlListServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2MmlListServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4588c1078fba2e42cd7702514a2da2d849e0997f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2MmlListServiceImpl.java @@ -0,0 +1,115 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2MmlList; +import com.ruoyi.eastcom_yw.domain.qo.Dp2MmlListQO; +import com.ruoyi.eastcom_yw.mapper.Dp2MmlListMapper; +import com.ruoyi.eastcom_yw.service.Dp2MmlListService; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author ck + * @since 2023-09-12 + */ +@Service +public class Dp2MmlListServiceImpl extends ServiceImpl implements Dp2MmlListService { + + @Resource + private Dp2MmlListMapper dp2MmlListMapper; + + /** + * 列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(Dp2MmlListQO qo) { + qo.setPageNum(null); + qo.setPageSize(null); + return dp2MmlListMapper.list(qo); + } + + /** + * 分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public PageInfo getDataByPage(Dp2MmlListQO qo) { + PageHelper.startPage(qo.getPageNum(),qo.getPageSize()); + List list = getData(qo); + return PageInfo.of(list); + } + +// @Override +// public Dp2MmlList fetchById(Long id) { +// Dp2MmlList entity = dp2MmlListMapper.selectById(id); +// return Dp2MmlListConvert.INSTANCE.entityToVo(entity); +// } +// +// @Override +// public boolean saveOrUpdate(Dp2MmlList dto) { +// Dp2MmlList entity = Dp2MmlListConvert.INSTANCE.dtoToEntity(dto); +// return saveOrUpdate(entity); +// } +// +// @Override +// public boolean deleteById(Long id) { +// return removeById(id); +// } +// +// @Override +// public boolean deleteByIdBatch(List ids) { +// return SqlHelper.retBool(dp2MmlListMapper.deleteBatchIds(ids)); +// } + + @Override + public void export(Dp2MmlListQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(Dp2MmlList.class); + try { + util.exportExcel(response, data, "导出结果"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + +// @Override +// public AjaxResult importData(List list, boolean updateSupport) { +// // 核查模板 +// if (CollUtil.isEmpty(list)) { +// return AjaxResult.error("导入模板不正确。"); +// } +// +// // 核查 +// // boolean checkFlag; +// // checkFlag = checkData(cs, ywSceneList); +// // if (checkFlag) { +// // checkFlag = checkUnique(cs); +// // } +// // if (!checkFlag) { +// // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); +// // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); +// // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); +// // } +// // saveBatch(list); +// return null; +// } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2SpotCellServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2SpotCellServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fd20a533ea626279047f0e437fa3efc9b9d03b47 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2SpotCellServiceImpl.java @@ -0,0 +1,312 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.CoordinateConversionUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2SpotCell; +import com.ruoyi.eastcom_yw.domain.qo.Dp2SpotCellQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2SpotCellVO; +import com.ruoyi.eastcom_yw.mapper.Dp2SpotCellMapper; +import com.ruoyi.eastcom_yw.service.Dp2SpotCellService; +import com.ruoyi.eastcom_yw.service.convert.Dp2SpotCellConvert; +import com.ruoyi.system.mapper.SysDictDataMapper; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author ck + * @since 2023-08-10 + */ +@Service +public class Dp2SpotCellServiceImpl extends ServiceImpl implements Dp2SpotCellService { + + @Resource + private Dp2SpotCellMapper dp2SpotCellMapper; + +// @Resource +// private Dp2SpotConfigMapper dp2SpotConfigMapper; + + @Resource + private SysDictDataMapper sysDictDataMapper; + + /** + * 列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(Dp2SpotCellQO qo) { + qo.setPageNum(null); + qo.setPageSize(null); + return dp2SpotCellMapper.list(qo); + } + + /** + * 分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public PageInfo getDataByPage(Dp2SpotCellQO qo) { + PageHelper.startPage(qo.getPageNum(),qo.getPageSize()); + List list = dp2SpotCellMapper.list(qo); + return PageInfo.of(list); + } + + @Override + public Dp2SpotCellVO fetchById(Long id) { + Dp2SpotCell entity = dp2SpotCellMapper.selectById(id); + return Dp2SpotCellConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdated(Dp2SpotCell entity) { +// List dp2SpotConfigs = dp2SpotConfigMapper.selectList(new LambdaQueryWrapper().eq(Dp2SpotConfig::get景区名称, entity.get二级场景())); +// if(dp2SpotConfigs.isEmpty()){ +// throw new ServiceException("【二级场景】未找到匹配的景区名称"); +// }else { +// entity.set景区id(dp2SpotConfigs.get(0).get景区id()); +// } + Double 经度 = entity.get经度(); + Double 纬度 = entity.get纬度(); + // WGS84转GCj02 + String s = CoordinateConversionUtils.wgs84togcj02(经度, 纬度); + double lng02 = Double.parseDouble(s.split(",")[0]); + double lat02 = Double.parseDouble(s.split(",")[1]); + entity.set经度gcj(NumberUtil.round(lng02,6).doubleValue()); + entity.set纬度gcj(NumberUtil.round(lat02,6).doubleValue()); + + entity.set更新时间(LocalDateTime.now()); + + //字典翻译 + if(entity.get县市()!=null) { + String label = sysDictDataMapper.selectDictLabel("yw_county", entity.get县市()); + if(StrUtil.isBlank(label)){ + throw new ServiceException("【县市】不正确"); + } + entity.set县市(label); + } +// if(entity.get网络()!=null) { +// String label = sysDictDataMapper.selectDictLabel("yw_nettype", entity.get网络()); +// if(StrUtil.isBlank(label)){ +// throw new ServiceException("【网络】不正确"); +// } +// entity.set网络(label); +// } +// if(entity.get设备类型()!=null) { +// entity.set设备类型(sysDictDataMapper.selectDictLabel("spot_cell_type", entity.get设备类型())); +// } + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(dp2SpotCellMapper.deleteBatchIds(ids)); + } + + @Override + public void export(Dp2SpotCellQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + if(CollUtil.isNotEmpty(data)){ + for (Dp2SpotCell datum : data) { + if(datum.get带宽()!=null) { + datum.set带宽str(datum.get带宽().toString() + "M"); + } + } + } + ExcelUtil util = new ExcelUtil<>(Dp2SpotCell.class); + util.hideColumn("reason"); + try { + util.exportExcel(response, data, "信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + //判断cgi不能重复 +// List cgiList = list.stream().map(Dp2SpotCell::getCgi).collect(Collectors.toList()); +// HashSet set = new HashSet<>(cgiList); +// if(cgiList.size()!=set.size()){ +// return AjaxResult.error("存在cgi相同数据,请保证cgi唯一"); +// } + + List countyDictData = sysDictDataMapper.selectDictDataByType("yw_county"); + List countyList = countyDictData.stream().map(SysDictData::getDictLabel).collect(Collectors.toList()); + +// List nettypeDictData = sysDictDataMapper.selectDictDataByType("yw_nettype"); +// List nettypeList = nettypeDictData.stream().map(SysDictData::getDictLabel).collect(Collectors.toList()); + +// List dp2SpotConfigs = dp2SpotConfigMapper.selectList(null); +// List collect = dp2SpotConfigs.stream().map(Dp2SpotConfig::get景区介绍).distinct().collect(Collectors.toList()); +// List collect2 = dp2SpotConfigs.stream().map(Dp2SpotConfig::get景区名称).distinct().collect(Collectors.toList()); +// collect.addAll(collect2); +// Map map = dp2SpotConfigs.stream().collect(Collectors.toMap(Dp2SpotConfig::get景区名称, Dp2SpotConfig::get景区id)); + + boolean checkFlag = true; + for (Dp2SpotCell vo : list) { + if (StrUtil.isBlank(vo.get基站全称())) { + return AjaxResult.error("导入模板不正确。"); + } + StringBuilder builder = new StringBuilder(); + +// int num=0; +// for (String cgi : cgiList) { +// if(vo.getCgi().equals(cgi)){ +// num++; +// } +// } +// if(num>1){ +// builder.append("【cgi】重复;"); +// checkFlag = false; +// } + if (StrUtil.isBlank(vo.get县市())) { +// builder.append("【县市】为空;"); +// checkFlag = false; + }else { + //判断是否是字典中的值 +// String yw_county = sysDictDataMapper.selectDictValue("yw_county", vo.get县市()); + //去掉县市的区 + vo.set县市(vo.get县市().replace("区","")); + if(!countyList.contains(vo.get县市())){ + builder.append("【县市】不正确;"); + checkFlag = false; + } + } +// if (vo.get站号() == null) { +// builder.append("【站号】为空;"); +// checkFlag = false; +// } + if (StrUtil.isBlank(vo.get基站全称())) { + builder.append("【基站全称】不能为空;"); + } + if (StrUtil.isBlank(vo.get小区名称())) { + builder.append("【小区名称】为空;"); + checkFlag = false; + } +// if (StrUtil.isBlank(vo.get小区频段())) { +// builder.append("【小区频段】为空;"); +// checkFlag = false; +// } + if (vo.get纬度() == null) { + builder.append("【纬度】为空;"); + checkFlag = false; + } + if (vo.get经度() == null) { + builder.append("【经度】为空;"); + checkFlag = false; + } +// if (StrUtil.isBlank(vo.get室内室外())) { +// builder.append("【室内室外】为空;"); +// checkFlag = false; +// } + if (StrUtil.isBlank(vo.get网络())) { + builder.append("【网络】为空;"); + checkFlag = false; + }else { + //判断是否是字典中的值 +// String yw_nettype = sysDictDataMapper.selectDictValue("yw_nettype", vo.get网络()); +// if(!nettypeList.contains(vo.get网络())){ +// builder.append("【网络】不正确;"); +// checkFlag = false; +// } + } +// if (StrUtil.isBlank(vo.get设备类型())) { +// builder.append("【设备类型】为空;"); +// checkFlag = false; +// } +// if (vo.get带宽str() == null) { +// builder.append("【带宽】为空;"); +// checkFlag = false; +// } +// if (vo.get方位角() == null) { +// builder.append("【方位角】为空;"); +// checkFlag = false; +// } +// if (!collect.contains(vo.get一级场景())) { +// builder.append("【一级场景】未找到匹配的景区介绍;"); +// checkFlag = false; +// } +// List dp2SpotConfigs = dp2SpotConfigMapper.selectList(new LambdaQueryWrapper().eq(Dp2SpotConfig::get景区名称, vo.get二级场景())); +// if(!map.containsKey(vo.get二级场景())){ +// //设置景区id,根据二级场景匹配 +// builder.append("【二级场景】未找到匹配的景区名称;"); +// checkFlag = false; +// }else { +// vo.set景区id(map.get(vo.get二级场景())); +// } + vo.setReason(builder.toString()); + } + if (!checkFlag) { + ExcelUtil util = new ExcelUtil<>(Dp2SpotCell.class); + String fileName = (String) util.exportExcel(list, "场馆对应网元导入结果").get(AjaxResult.MSG_TAG); + return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + } else { + dp2SpotCellMapper.deleteAll(); + importList(list); + } + return AjaxResult.success(); + } + + + private void importList(List list) { + for (Dp2SpotCell entity : list) { + Double 经度 = entity.get经度(); + Double 纬度 = entity.get纬度(); + // WGS84转GCj02 + String s = CoordinateConversionUtils.wgs84togcj02(经度, 纬度); + double lng02 = Double.parseDouble(s.split(",")[0]); + double lat02 = Double.parseDouble(s.split(",")[1]); + entity.set经度gcj(NumberUtil.round(lng02,6).doubleValue()); + entity.set纬度gcj(NumberUtil.round(lat02,6).doubleValue()); + //带宽转换 + String 带宽str = entity.get带宽str(); + entity.set带宽(Double.valueOf(带宽str.replace("M",""))); + + entity.set更新时间(LocalDateTime.now()); + +// Dp2SpotCell dp2SpotCell = dp2SpotCellMapper.selectOne(new LambdaQueryWrapper() +// .eq(Dp2SpotCell::getCgi, entity.getCgi()) +// ); +// if (dp2SpotCell!=null) { +// entity.setId(dp2SpotCell.getId()); +// } + } + saveOrUpdateBatch(list); + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2SpotConfigServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2SpotConfigServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3ecc528d927ef7658dca0d144de1995ec8aa0069 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2SpotConfigServiceImpl.java @@ -0,0 +1,130 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2SpotConfig; +import com.ruoyi.eastcom_yw.domain.dto.Dp2SpotConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2SpotConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2SpotConfigVO; +import com.ruoyi.eastcom_yw.mapper.Dp2SpotConfigMapper; +import com.ruoyi.eastcom_yw.service.Dp2SpotConfigService; +import com.ruoyi.eastcom_yw.service.convert.Dp2SpotConfigConvert; +import com.ruoyi.system.mapper.SysDictDataMapper; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author ck + * @since 2023-08-09 + */ +@Service +public class Dp2SpotConfigServiceImpl extends ServiceImpl implements Dp2SpotConfigService { + + @Resource + private Dp2SpotConfigMapper dp2SpotConfigMapper; + + @Resource + private SysDictDataMapper sysDictDataMapper; + + /** + * 列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(Dp2SpotConfigQO qo) { + return dp2SpotConfigMapper.list(qo); + } + + /** + * 分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public PageInfo getDataByPage(Dp2SpotConfigQO qo) { + PageHelper.startPage(qo.getPageNum(),qo.getPageSize()); + List list = dp2SpotConfigMapper.list(qo); + return PageInfo.of(list); + } + + @Override + public Dp2SpotConfigVO fetchById(Long id) { + Dp2SpotConfig entity = dp2SpotConfigMapper.selectById(id); + return Dp2SpotConfigConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(Dp2SpotConfigDTO dto) { + Dp2SpotConfig entity = Dp2SpotConfigConvert.INSTANCE.dtoToEntity(dto); + //翻译字典值 + if(entity.get行政区域()!=null) { + entity.set行政区域(sysDictDataMapper.selectDictLabel("yw_county", entity.get行政区域())); + } + if(entity.get景区大类()!=null) { + entity.set景区大类(sysDictDataMapper.selectDictLabel("spot_type", entity.get景区大类())); + } + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(dp2SpotConfigMapper.deleteBatchIds(ids)); + } + + @Override + public void export(Dp2SpotConfigQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(Dp2SpotConfigVO.class); + try { + util.exportExcel(response, data, "信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2ViewPowerAlarmServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2ViewPowerAlarmServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ef6d958bed6f5f1c277ce9c51f08ba40c6f3564e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2ViewPowerAlarmServiceImpl.java @@ -0,0 +1,86 @@ +package com.ruoyi.eastcom_yw.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; + +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2ViewPowerAlarm; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewPowerAlarmQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewPowerAlarmVO; +import com.ruoyi.eastcom_yw.mapper.Dp2ViewPowerAlarmMapper; +import com.ruoyi.eastcom_yw.service.Dp2ViewPowerAlarmService; +import com.ruoyi.eastcom_yw.service.convert.Dp2ViewPowerAlarmConvert; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** +*

+ * 服务实现类 + *

+* +* @author wqx +* @since 2023-08-31 +*/ +@Service +@RequiredArgsConstructor +public class Dp2ViewPowerAlarmServiceImpl extends ServiceImpl implements Dp2ViewPowerAlarmService { + + @Resource + private Dp2ViewPowerAlarmMapper dp2ViewPowerAlarmMapper; + + + /** + * 列表 + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(Dp2ViewPowerAlarmQO qo) { + qo.setPageNum(null); + qo.setPageSize(null); + List list = dp2ViewPowerAlarmMapper.list(qo); + return list; + } + + /** + * 分页列表 + * @param qo 根据需要进行传值 + * @return + */ + @Override + public PageInfo getDataByPage(Dp2ViewPowerAlarmQO qo) { + PageHelper.startPage(qo.getPageNum(),qo.getPageSize()); + List list = dp2ViewPowerAlarmMapper.list(qo); + return PageInfo.of(list); + } + + + + @Override + public Dp2ViewPowerAlarmVO fetchById(Long id) { + Dp2ViewPowerAlarm entity = dp2ViewPowerAlarmMapper.selectById(id); + return Dp2ViewPowerAlarmConvert.INSTANCE.entityToVo(entity); + } + + @Override + public void export(Dp2ViewPowerAlarmQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(Dp2ViewPowerAlarmVO.class); + try { + util.exportExcel(response, data, "场馆和城市侧动环告警"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2ViewWirelessAlarmServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2ViewWirelessAlarmServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cea0325be775234a30d06826f8c9857e127d7b65 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/Dp2ViewWirelessAlarmServiceImpl.java @@ -0,0 +1,129 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2ViewWirelessAlarm; +import com.ruoyi.eastcom_yw.domain.dto.Dp2ViewWirelessAlarmDTO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewWirelessAlarmQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewPowerAlarmVO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewWirelessAlarmVO; +import com.ruoyi.eastcom_yw.mapper.Dp2ViewWirelessAlarmMapper; +import com.ruoyi.eastcom_yw.service.Dp2ViewWirelessAlarmService; +import com.ruoyi.eastcom_yw.service.convert.Dp2ViewWirelessAlarmConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** +*

+ * 服务实现类 + *

+* +* @author wqx +* @since 2023-09-01 +*/ +@Service +public class Dp2ViewWirelessAlarmServiceImpl extends ServiceImpl implements Dp2ViewWirelessAlarmService { + + @Resource + private Dp2ViewWirelessAlarmMapper dp2ViewWirelessAlarmMapper; + + /** + * 列表 + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(Dp2ViewWirelessAlarmQO qo) { + qo.setPageNum(null); + qo.setPageSize(null); + List list = dp2ViewWirelessAlarmMapper.list(qo); + return list; + } + + /** + * 分页列表 + * @param qo 根据需要进行传值 + * @return + */ + @Override + public PageInfo getDataByPage(Dp2ViewWirelessAlarmQO qo) { + PageHelper.startPage(qo.getPageNum(),qo.getPageSize()); + List list = dp2ViewWirelessAlarmMapper.list(qo); + return PageInfo.of(list); + } + + @Override + public Dp2ViewWirelessAlarmVO fetchById(Long id) { + Dp2ViewWirelessAlarm entity = dp2ViewWirelessAlarmMapper.selectById(id); + return Dp2ViewWirelessAlarmConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(Dp2ViewWirelessAlarmDTO dto) { + Dp2ViewWirelessAlarm entity = Dp2ViewWirelessAlarmConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(dp2ViewWirelessAlarmMapper.deleteBatchIds(ids)); + } + + @Override + public void export(Dp2ViewWirelessAlarmQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(Dp2ViewWirelessAlarmVO.class); + try { + util.exportExcel(response, data, "场馆和城市侧无线告警"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/DpSceneConfigServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/DpSceneConfigServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e787142276f64afdd98a9078dc4b67ffd357443c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/DpSceneConfigServiceImpl.java @@ -0,0 +1,166 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.DpSceneConfig; +import com.ruoyi.eastcom_yw.domain.dto.DpSceneConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.DpSceneConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.DpSceneConfigVO; +import com.ruoyi.eastcom_yw.mapper.DpSceneConfigMapper; +import com.ruoyi.eastcom_yw.service.DpSceneConfigService; +import com.ruoyi.eastcom_yw.service.convert.DpSceneConfigConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Service +public class DpSceneConfigServiceImpl extends ServiceImpl implements DpSceneConfigService { + + @Resource + private DpSceneConfigMapper dpSceneConfigMapper; + + /** + * 列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(DpSceneConfigQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + .like(StrUtil.isNotBlank(qo.getName()), DpSceneConfig::getName, qo.getName()) + .eq(StrUtil.isNotBlank(qo.getNettype()), DpSceneConfig::getNettype, qo.getNettype()) + .eq(StrUtil.isNotBlank(qo.getType()), DpSceneConfig::getType, qo.getType()) + .orderByAsc(DpSceneConfig::getId); + List list = dpSceneConfigMapper.selectList(queryWrapper); + return DpSceneConfigConvert.INSTANCE.entityToVoList(list); + } + + /** + * 分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(DpSceneConfigQO qo) { +// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// queryWrapper +// .like(StrUtil.isNotBlank(qo.getName()), DpSceneConfig::getName, qo.getName()) +// .like(StrUtil.isNotBlank(qo.getCelltype()), DpSceneConfig::getCelltype, qo.getCelltype()) +// .eq(StrUtil.isNotBlank(qo.getNettype()), DpSceneConfig::getNettype, qo.getNettype()) +// .eq(StrUtil.isNotBlank(qo.getType()), DpSceneConfig::getType, qo.getType()) +// .orderByAsc(DpSceneConfig::getNettype,DpSceneConfig::getType,DpSceneConfig::getName,DpSceneConfig::getCelltype,DpSceneConfig::getLevel); + + Page voPage = new Page<>(); + List list = dpSceneConfigMapper.getList(qo); + List voList = new ArrayList<>(); + for (DpSceneConfig dpSceneConfig : list) { + DpSceneConfigVO dpSceneConfigVO = new DpSceneConfigVO(); + BeanUtil.copyProperties(dpSceneConfig,dpSceneConfigVO); + voList.add(dpSceneConfigVO); + } + voPage.setRecords(voList); + voPage.setTotal(PageInfo.of(list).getTotal()); + return voPage; + } + + @Override + public DpSceneConfigVO fetchById(Long id) { + DpSceneConfig entity = dpSceneConfigMapper.selectById(id); + return DpSceneConfigConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(DpSceneConfigDTO dto) { + DpSceneConfig entity = DpSceneConfigConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(dpSceneConfigMapper.deleteBatchIds(ids)); + } + + @Override + public void export(DpSceneConfigQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(DpSceneConfigVO.class); + try { + util.exportExcel(response, data, "信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } + + @Override + public List listColor(){ + return dpSceneConfigMapper.listColor(); + } + + @Override + public List listKpiName(){ + List list = dpSceneConfigMapper.listKpiName(); + list.removeIf(s -> s.equals(KpiConstants.YW_FIELD_ALL)); + list.add(KpiConstants.YW_FIELD_ALL); + return list; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/HmAlarmDeriveServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/HmAlarmDeriveServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4e21bc449daf52d1c8c647f7f60b5f5ee4938213 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/HmAlarmDeriveServiceImpl.java @@ -0,0 +1,192 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.HmAlarmDerive; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmVo; +import com.ruoyi.eastcom_yw.mapper.HmAlarmDeriveMapper; +import com.ruoyi.eastcom_yw.service.HmAlarmDeriveService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-08-02 + */ +@Service +public class HmAlarmDeriveServiceImpl extends ServiceImpl implements HmAlarmDeriveService { + + @Resource + HmAlarmDeriveMapper hmAlarmDeriveMapper; + + @Resource + YwSceneService ywSceneService; + + @Override + public List getAlarmDerive(YwAlarmDTO alarmDTO) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + //如果没有传入场馆就用当前登录用户的配置的场馆 + List lstVenue = new ArrayList<>(); + if (alarmDTO.getVenues() == null) { + + //管理员不需要设置场馆 + if (!user.isAdmin(user)) { + + ywSceneService.getVenueByUser(user).forEach( + venue -> { + lstVenue.add(venue.getVenueName()); + } + ); + alarmDTO.setVenueNames(lstVenue); + } + } + if (alarmDTO.getVenues() != null) { + + if(alarmDTO.getVenues().size() == 0) { + //管理员不需要设置场馆 + if (!user.isAdmin(user)) { + + ywSceneService.getVenueByUser(user).forEach( + venue -> { + lstVenue.add(venue.getVenueName()); + } + ); + alarmDTO.setVenueNames(lstVenue); + } + } + if(alarmDTO.getVenues().size() > 0) { + + LambdaQueryWrapper queryScene =new LambdaQueryWrapper<>(); + + queryScene.in(YwScene::getId,alarmDTO.getVenues()); + + List lstScene = ywSceneService.getBaseMapper().selectList(queryScene); + + for(YwScene scene : lstScene) + { + lstVenue.add(scene.getVenueName()); + } + + } + alarmDTO.setVenueNames(lstVenue); + } + + LambdaQueryWrapper query =new LambdaQueryWrapper<>(); + + if(StringUtils.isNotEmpty(alarmDTO.getVenueType())) + { + query.apply("场馆名称 in (SELECT venue_name FROM yw_scene where match_type = {0})",alarmDTO.getVenueType()); + } + + if(StringUtils.isNotEmpty(alarmDTO.getMaintainType())) + { + query.apply("场馆名称 in (SELECT venue_name FROM yw_scene where maintain_type = {0})",alarmDTO.getMaintainType()); + + } + + if(StringUtils.isNotEmpty(alarmDTO.getCounty())) { + + if("0571".equals(alarmDTO.getCounty())) + { + query.eq(HmAlarmDerive::get分公司,"杭州"); + } + else + { + alarmDTO.setCounty(DictUtils.getDictLabel("yw_county", alarmDTO.getCounty())); + query.eq(HmAlarmDerive::get分公司,alarmDTO.getCounty()); + } + + } + + if(StringUtils.isNotEmpty(alarmDTO.getCity())) { + + List datas = DictUtils.getDictCache("yw_county"); + + List lstCounty = datas.stream().filter(x->x.getDictValue().contains(alarmDTO.getCity())).map(SysDictData::getDictLabel).collect(Collectors.toList()); + + //分公司字段存在杭州的值 + if("0571".equals(alarmDTO.getCity())) + { + lstCounty.add("杭州"); + } + + query.in(HmAlarmDerive::get分公司, lstCounty); + } + + query.in(ObjectUtils.isNotEmpty(alarmDTO.getCountys()),HmAlarmDerive::get分公司,alarmDTO.getCountys()); + + query.in(!alarmDTO.getVenueNames().isEmpty(),HmAlarmDerive::get场馆名称,alarmDTO.getVenueNames()); + + if(StringUtils.isNotEmpty(alarmDTO.getSearchBox())) + { + query.and( + queryLess -> queryLess.like(HmAlarmDerive::get网元名称,alarmDTO.getSearchBox()).or(). + like(HmAlarmDerive::get告警名称,alarmDTO.getSearchBox()) + ); + + } + + if (StringUtils.isNotEmpty(alarmDTO.getStartTime())&&StringUtils.isNotEmpty(alarmDTO.getEndTime())) + { + try + { + if(alarmDTO.getStartTime().length()==10) { + alarmDTO.setStartTime(alarmDTO.getStartTime()+"T00:00:00"); + } + if(alarmDTO.getEndTime().length()==10) { + alarmDTO.setEndTime(alarmDTO.getEndTime()+"T23:59:59"); + } + if(alarmDTO.getStartTime().length()==19 && alarmDTO.getEndTime().length()==19) { + alarmDTO.setStart(LocalDateTime.parse(alarmDTO.getStartTime().replace(" ","T"))); + alarmDTO.setEnd(LocalDateTime.parse(alarmDTO.getEndTime().replace(" ","T"))); + } + } + catch (Exception ex) + { + throw new ServiceException(ex.getMessage()); + } + + } + + query.between(ObjectUtils.isNotEmpty(alarmDTO.getStart())&&ObjectUtils.isNotEmpty(alarmDTO.getEnd()),HmAlarmDerive::get告警时间,alarmDTO.getStart(),alarmDTO.getEnd()); + + query.orderByDesc(HmAlarmDerive::get恢复时间); + + List lstDerive = hmAlarmDeriveMapper.selectList(query); + + for(HmAlarmDerive derive : lstDerive) + { + derive.setAlarmId(derive.getId()); + derive.setAlarmKey(derive.getAlarmId()+"||0"); + if(ObjectUtils.isNotEmpty(derive.get恢复时间())) + { + derive.setAlarmKey(derive.getAlarmId()+"||1"); + } + } + + return lstDerive; + + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/LargeScreenServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/LargeScreenServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b1849ea71f08a1e8bb7c20c7c3b2e98e57c6546c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/LargeScreenServiceImpl.java @@ -0,0 +1,62 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.ruoyi.eastcom_yw.domain.model.AppEntity; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.AppMapper; +import com.ruoyi.eastcom_yw.mapper.LargeScreenMapper; +import com.ruoyi.eastcom_yw.service.LargeScreenService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@RequiredArgsConstructor +public class LargeScreenServiceImpl implements LargeScreenService { + + private final LargeScreenMapper largeScreenMapper; + + private final AppMapper appMapper; + + @Override + public List getTaskManageList() { + return largeScreenMapper.getTaskManageList(); + } + + @Override + public List getMatchList() { + return largeScreenMapper.getMatchList(); + } + + @Override + public List getRaceScheduleList() { + return largeScreenMapper.getRaceScheduleList(); + } + + @Override + public List getMedalList() { + return largeScreenMapper.getMedalList(); + } + + @Override + public List getNewsList() { + return largeScreenMapper.getNewsList(); + } + + @Override + public List getAlarmTopList() { + return largeScreenMapper.getAlarmTopList(); + } + + @Override + public List getAlarmStatisticsList() { + return largeScreenMapper.getAlarmStatisticsList(); + } + + @Override + public boolean validate(String ip, AppEntity appEntity) { + appEntity.setIp(ip); + return appMapper.findApp(appEntity) != null ? true : false; + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/OpenApiServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/OpenApiServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fc727d295e567cce2c477f296653e1d29df83847 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/OpenApiServiceImpl.java @@ -0,0 +1,41 @@ +package com.ruoyi.eastcom_yw.service.impl; + + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.http.HttpUtils; +import com.ruoyi.eastcom_yw.domain.dto.MmlObjectDTO; +import com.ruoyi.eastcom_yw.service.OpenApiService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * @author yqf + * @date 2023/6/5 + */ +@Service +@RequiredArgsConstructor +public class OpenApiServiceImpl implements OpenApiService { + + private static final String url = "http://10.71.80.224:53335/datasnap/rest/tmml/sitemml"; + + @Override + public AjaxResult getMsgByMML(MmlObjectDTO mmlObjectDTO) { + String json = JSON.toJSONString(mmlObjectDTO); + System.out.println(json); + String result = HttpUtils.postJosnContent(url, json); +// String result = geetStr(); + JSONObject jsonObject = JSONObject.parseObject(result); + + System.out.println(result); + if (jsonObject.get("code").equals("1")) { + return AjaxResult.success(jsonObject.get("message")); + } else { + return AjaxResult.error("调用远程接口错误",jsonObject.get("message")); + } + + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi4gCellServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi4gCellServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1c73da2dad52a2edff16eff49608a5f4c19e06d5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi4gCellServiceImpl.java @@ -0,0 +1,208 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.PmKpiMaxEntity; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.qo.DpSceneConfigQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiColorQo; +import com.ruoyi.eastcom_yw.domain.qo.YwKpiConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.DpSceneConfigMapper; +import com.ruoyi.eastcom_yw.mapper.PmKpi4gCellMapper; +import com.ruoyi.eastcom_yw.service.DpSceneConfigService; +import com.ruoyi.eastcom_yw.service.PmKpi4gCellService; +import com.ruoyi.eastcom_yw.service.YwKpiConfigService; +import com.ruoyi.eastcom_yw.service.convert.PmKpi4gCellConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Service +public class PmKpi4gCellServiceImpl extends ServiceImpl implements PmKpi4gCellService { + + @Autowired + private PmKpi4gCellMapper pmKpi4gCellMapper; + + @Autowired + private DpSceneConfigService dpSceneConfigService; + + @Autowired + private DpSceneConfigMapper dpSceneConfigMapper; + + /** + * 场馆4G小区级15分钟指标列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(PmKpiCellQO qo) { + qo.setPageSize(0); + List list = pmKpi4gCellMapper.getList(qo); + return PmKpi4gCellConvert.INSTANCE.entityToVoList(list); + } + + + /** + * 场馆4G小区级15分钟指标分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(PmKpiCellQO qo) { + + PageUtils.startPage(qo, PmKpiCellQO.class); + List records = pmKpi4gCellMapper.getList(qo); + List list = new ArrayList<>(); + + if (!records.isEmpty()) { + qo.setPageSize(0); + PmKpiMaxEntity maxKpi = pmKpi4gCellMapper.getMaxKpi(qo); + BigDecimal maxuserNum = maxKpi.getMaxuserNum(); + BigDecimal prbupNum = maxKpi.getPrbupNum(); + BigDecimal prbdownNum = maxKpi.getPrbdownNum(); + BigDecimal avgNum = maxKpi.getAvgNum(); + BigDecimal succesNum = maxKpi.getSuccesNum(); + BigDecimal failNum = maxKpi.getFailNum(); + BigDecimal avgDisturb = maxKpi.getAvgDisturb(); + + for (PmKpi4gCell pmKpi4gCell : records) { + PmKpi15MinCellVO vo = new PmKpi15MinCellVO(); + BeanUtil.copyProperties(pmKpi4gCell, vo); + + DpSceneConfigQO configQO = new DpSceneConfigQO(); + configQO.setNettype(qo.getNetType()); + + vo.setNetType(qo.getNetType()); + + BigDecimal defaultNum = new BigDecimal(0); + PmKpiColorQo kpiColorQo = new PmKpiColorQo(); + kpiColorQo.setPrbupvalue(null != pmKpi4gCell.get上行prb利用率() ? pmKpi4gCell.get上行prb利用率() : defaultNum); + kpiColorQo.setPrbdownvalue(null != pmKpi4gCell.get下行prb利用率() ? pmKpi4gCell.get下行prb利用率() : defaultNum); + kpiColorQo.setAvgdisvalue(null != pmKpi4gCell.get上行平均干扰() ? pmKpi4gCell.get上行平均干扰() : defaultNum); + kpiColorQo.setMaxuservalue(null != pmKpi4gCell.get最大用户数() ? pmKpi4gCell.get最大用户数() : defaultNum); + kpiColorQo.setFreqtype(pmKpi4gCell.get小区频段()); + kpiColorQo.setDevicetype(pmKpi4gCell.get设备类型()); + kpiColorQo.setBandwidth(pmKpi4gCell.get带宽()); + kpiColorQo.setNettype(qo.getNetType()); + + Map fourKpiColor = dpSceneConfigMapper.getFourKpiColor(kpiColorQo); + + //平均用户 + PmKpiVO avgUser = new PmKpiVO(avgNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gCell.get平均用户数()) { + avgUser.setValue(pmKpi4gCell.get平均用户数()); + } + vo.set平均用户数(avgUser); + + //干扰值 + PmKpiVO disb = new PmKpiVO(avgDisturb, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gCell.get上行平均干扰()) { + disb.setValue(pmKpi4gCell.get上行平均干扰()); + disb.setColor(fourKpiColor.get("avgdiscolor").toString()); + } + vo.set上行平均干扰(disb); + + //无线接通率 + PmKpiVO success = new PmKpiVO(succesNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gCell.get无线接通率()) { + success.setValue(pmKpi4gCell.get无线接通率()); + } + vo.set无线接通率(success); + + //无线掉线率 + PmKpiVO failrate = new PmKpiVO(failNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gCell.get无线掉线率()) { + failrate.setValue(pmKpi4gCell.get无线掉线率()); + } + vo.set无线掉线率(failrate); + + //最大用户数 + LocalDateTime starttime = qo.getStarttime().minusHours(6); + qo.setQuerystarttime(starttime); + qo.setQueryvenueid(pmKpi4gCell.getVenueId()); + qo.setVillageIds(new String[]{pmKpi4gCell.getCellcodeci()}); + List dataList = pmKpi4gCellMapper.getKpiDataList(qo); + vo.setKpi6HourData(dataList); + + PmKpiVO maxUserVo = new PmKpiVO(maxuserNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gCell.get最大用户数()) { + maxUserVo.setValue(pmKpi4gCell.get最大用户数()); + maxUserVo.setColor(fourKpiColor.get("maxusercolor").toString()); + } + maxUserVo.setData(dataList); + vo.set最大用户数(maxUserVo); + + //上行prb利用率 + PmKpiVO upPrbVo = new PmKpiVO(prbupNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gCell.get上行prb利用率()) { + upPrbVo.setValue(pmKpi4gCell.get上行prb利用率()); + upPrbVo.setColor(fourKpiColor.get("prbupcolor").toString()); + } + upPrbVo.setData(dataList); + vo.set上行prb利用率(upPrbVo); + + //下行prb利用率 + PmKpiVO downPrbVo = new PmKpiVO(prbdownNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gCell.get下行prb利用率()) { + downPrbVo.setValue(pmKpi4gCell.get下行prb利用率()); + downPrbVo.setColor(fourKpiColor.get("prbdowncolor").toString()); + } + downPrbVo.setData(dataList); + vo.set下行prb利用率(downPrbVo); + list.add(vo); + } + + } + + IPage voPage = new Page<>(); + voPage.setRecords(list); + voPage.setTotal(PageInfo.of(records).getTotal()); + return voPage; + } + + + @Override + public void export(PmKpiCellQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(PmKpi4gCellVO.class); + try { + util.exportExcel(response, data, "场馆4G小区级15分钟指标信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public Map getLastTime(Long[] venueIds){ + return pmKpi4gCellMapper.getLastTimeByvenueIds(venueIds); + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi4gMinServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi4gMinServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4ae91c44d8883c00cdc29f4f2a40ab6dfc745861 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi4gMinServiceImpl.java @@ -0,0 +1,269 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.PmKpi4gMin; +import com.ruoyi.eastcom_yw.domain.PmKpi5gCell; +import com.ruoyi.eastcom_yw.domain.PmKpiMaxEntity; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi4gMinDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.qo.DpSceneConfigQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpi4gMinQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiColorQo; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiMinQO; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.DpSceneConfigMapper; +import com.ruoyi.eastcom_yw.mapper.PmKpi4gMinMapper; +import com.ruoyi.eastcom_yw.service.PmKpi4gMinService; +import com.ruoyi.eastcom_yw.service.convert.PmKpi4gMinConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + *

+ * 场馆4G小区级1分钟指标 服务实现类 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Service +public class PmKpi4gMinServiceImpl extends ServiceImpl implements PmKpi4gMinService { + + @Resource + private PmKpi4gMinMapper pmKpi4gMinMapper; + + @Autowired + private DpSceneConfigMapper dpSceneConfigMapper; + + /** + * 场馆4G小区级1分钟指标列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(PmKpiMinQO qo) { + qo.setPageSize(0); + List list = pmKpi4gMinMapper.getList(qo); + return PmKpi4gMinConvert.INSTANCE.entityToVoList(list); + } + + /** + * 场馆4G小区级1分钟指标分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(PmKpiMinQO qo) { + + PageUtils.startPage(qo, PmKpiMinQO.class); + List records = pmKpi4gMinMapper.getList(qo); + List list = new ArrayList<>(); + + if (!records.isEmpty()) { + qo.setPageSize(0); + PmKpiMaxEntity maxKpi = pmKpi4gMinMapper.getMaxKpi(qo); + BigDecimal maxuserNum = maxKpi.getMaxuserNum(); + BigDecimal prbupNum = maxKpi.getPrbupNum(); + BigDecimal prbdownNum = maxKpi.getPrbdownNum(); + BigDecimal avgNum = maxKpi.getAvgNum(); + BigDecimal succesNum = maxKpi.getSuccesNum(); + BigDecimal failNum = maxKpi.getFailNum(); + BigDecimal avgDisturb = maxKpi.getAvgDisturb(); + + for (PmKpi4gMin pmKpi4gMin : records) { + PmKpiOneMinVO vo = new PmKpiOneMinVO(); + BeanUtil.copyProperties(pmKpi4gMin, vo); + + DpSceneConfigQO configQO = new DpSceneConfigQO(); + configQO.setCelltype(qo.getNetType()); + + vo.setNetType(qo.getNetType()); + + BigDecimal defaultNum = new BigDecimal(0); + PmKpiColorQo kpiColorQo = new PmKpiColorQo(); + kpiColorQo.setPrbupvalue(null != pmKpi4gMin.getPrbUp() ? pmKpi4gMin.getPrbUp() : defaultNum); + kpiColorQo.setPrbdownvalue(null != pmKpi4gMin.getPrbDown() ? pmKpi4gMin.getPrbDown() : defaultNum); + kpiColorQo.setAvgdisvalue(null != pmKpi4gMin.getAvgDisturb() ? BigDecimal.valueOf(pmKpi4gMin.getAvgDisturb()) : defaultNum); + kpiColorQo.setMaxuservalue(null != pmKpi4gMin.getMaxUser() ? BigDecimal.valueOf(pmKpi4gMin.getMaxUser()) : defaultNum); + kpiColorQo.setFreqtype(pmKpi4gMin.get小区频段()); + kpiColorQo.setDevicetype(pmKpi4gMin.get设备类型()); + kpiColorQo.setBandwidth(pmKpi4gMin.get带宽()); + kpiColorQo.setNettype(qo.getNetType()); + + Map fourKpiColor = dpSceneConfigMapper.getFourKpiColor(kpiColorQo); + + //平均用户 + PmKpiVO avgUser = new PmKpiVO(avgNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gMin.getAvgUser()) { + avgUser.setValue(pmKpi4gMin.getAvgUser()); + } + vo.set平均用户数(avgUser); + + //干扰值 + PmKpiVO disb = new PmKpiVO(avgDisturb, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gMin.getAvgDisturb()) { + disb.setValue(BigDecimal.valueOf(pmKpi4gMin.getAvgDisturb())); +// configQO.setValue(BigDecimal.valueOf(pmKpi4gMin.getAvgDisturb())); +// configQO.setName(KpiConstants.YW_FIELD_AVG_DIS); +// String avgdisbColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != avgdisbColor) { +// disb.setColor(avgdisbColor); +// } + disb.setColor(fourKpiColor.get("avgdiscolor").toString()); + } + vo.set上行平均干扰(disb); + + //无线接通率 + PmKpiVO success = new PmKpiVO(succesNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gMin.getCallSuccRate()) { + success.setValue(pmKpi4gMin.getCallSuccRate()); + } + vo.set无线接通率(success); + + //无线掉线率 + PmKpiVO failrate = new PmKpiVO(failNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gMin.getCallDropRate()) { + failrate.setValue(pmKpi4gMin.getCallDropRate()); + } + vo.set无线掉线率(failrate); + + //最大用户数 + PmKpiVO maxUserVo = new PmKpiVO(maxuserNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gMin.getMaxUser()) { + maxUserVo.setValue(BigDecimal.valueOf(pmKpi4gMin.getMaxUser())); +// configQO.setName(KpiConstants.YW_FIELD_MAX_USER); +// configQO.setValue(BigDecimal.valueOf(pmKpi4gMin.getMaxUser())); +// String maxUserColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != maxUserColor) { +// maxUserVo.setColor(maxUserColor); +// } + maxUserVo.setColor(fourKpiColor.get("maxusercolor").toString()); + } + vo.set最大用户数(maxUserVo); + + //上行prb利用率 + PmKpiVO upPrbVo = new PmKpiVO(prbupNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gMin.getPrbUp()) { + upPrbVo.setValue(pmKpi4gMin.getPrbUp()); +// configQO.setName(KpiConstants.YW_FIELD_RPB_DOWN); +// configQO.setValue(pmKpi4gMin.getPrbUp()); +// String upPrbVoColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != upPrbVoColor) { +// upPrbVo.setColor(upPrbVoColor); +// } + upPrbVo.setColor(fourKpiColor.get("prbupcolor").toString()); + } + vo.set上行prb利用率(upPrbVo); + + //下行prb利用率 + PmKpiVO downPrbVo = new PmKpiVO(prbdownNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gMin.getPrbDown()) { + downPrbVo.setValue(pmKpi4gMin.getPrbDown()); +// configQO.setName(KpiConstants.YW_FIELD_RPB_DOWN); +// configQO.setValue(pmKpi4gMin.getPrbDown()); +// String downPrbVoColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != downPrbVoColor) { +// downPrbVo.setColor(downPrbVoColor); +// } + downPrbVo.setColor(fourKpiColor.get("prbdowncolor").toString()); + } + vo.set下行prb利用率(downPrbVo); + + list.add(vo); + } + } + + IPage voPage = new Page<>(); + voPage.setRecords(list); + voPage.setTotal(PageInfo.of(records).getTotal()); + return voPage; + } + + @Override + public PmKpi4gMinVO fetchById(Long id) { + PmKpi4gMin entity = pmKpi4gMinMapper.selectById(id); + return PmKpi4gMinConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(PmKpi4gMinDTO dto) { + PmKpi4gMin entity = PmKpi4gMinConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(pmKpi4gMinMapper.deleteBatchIds(ids)); + } + + @Override + public void export(PmKpiMinQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(PmKpi4gMinVO.class); + try { + util.exportExcel(response, data, "场馆4G小区级1分钟指标信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi4gVenueServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi4gVenueServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..cf4a170d8c77ad366dda4c9d4a6c99b89e690892 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi4gVenueServiceImpl.java @@ -0,0 +1,117 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.PmKpi4gVenue; +import com.ruoyi.eastcom_yw.domain.PmKpi5gCell; +import com.ruoyi.eastcom_yw.domain.qo.DpSceneConfigQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiVenueQO; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.DpSceneConfigMapper; +import com.ruoyi.eastcom_yw.mapper.PmKpi4gCellMapper; +import com.ruoyi.eastcom_yw.mapper.PmKpi4gVenueMapper; +import com.ruoyi.eastcom_yw.service.PmKpi4gCellService; +import com.ruoyi.eastcom_yw.service.PmKpi4gVenueService; +import com.ruoyi.eastcom_yw.service.YwKpiConfigService; +import com.ruoyi.eastcom_yw.service.convert.PmKpi4gCellConvert; +import com.ruoyi.eastcom_yw.service.convert.PmKpi4gVenueConvert; +import com.ruoyi.eastcom_yw.service.convert.PmKpi5gCellConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Service +public class PmKpi4gVenueServiceImpl extends ServiceImpl implements PmKpi4gVenueService { + @Autowired + private PmKpi4gVenueMapper pmKpi4gVenueMapper; + + @Autowired + private PmKpi4gCellMapper pmKpi4gCellMapper; + + @Autowired + private DpSceneConfigMapper dpSceneConfigMapper; + + + + @Override + public IPage getDataByPage(PmKpiVenueQO qo) { + PageUtils.startPage(qo, PmKpiVenueQO.class); + List records = pmKpi4gVenueMapper.getList(qo); + List list = new ArrayList<>(); + + + DpSceneConfigQO configQO = new DpSceneConfigQO(); + configQO.setNettype(qo.getNetType()); + + for (PmKpi4gVenue pmKpi4gVenue : records) { + BigDecimal num = new BigDecimal("0"); + + PmKpi4gVenueConvertVO vo = new PmKpi4gVenueConvertVO(); + BeanUtil.copyProperties(pmKpi4gVenue, vo); + + //异常小区数 + int count = pmKpi4gCellMapper.getUnusualcount(pmKpi4gVenue.get场馆id(), qo.getStarttime(), qo.getEndtime(), qo.getNetType()); + PmKpiVO unusualcount = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + unusualcount.setValue(BigDecimal.valueOf(count)); + vo.setUnusualcount(unusualcount); + + //上行prb利用率 + PmKpiVO prbUpVo = new PmKpiVO( KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gVenue.get上行prb利用率()) { + prbUpVo.setValue(pmKpi4gVenue.get上行prb利用率()); + prbUpVo.setColor(pmKpi4gVenue.getPrbupColor()); + } + vo.set上行prb利用率(prbUpVo); + + //下行prb利用率 + PmKpiVO prbdownVo = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gVenue.get下行prb利用率()) { + prbdownVo.setValue(pmKpi4gVenue.get下行prb利用率()); + prbdownVo.setColor(pmKpi4gVenue.getPrbdownColor()); + } + vo.set下行prb利用率(prbdownVo); + + //小区总数 + int villageCount = pmKpi4gCellMapper.getVillageCount(pmKpi4gVenue.get场馆id(),qo.getStarttime(),qo.getEndtime()); + PmKpiVO countVO = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + countVO.setValue(BigDecimal.valueOf(villageCount)); + vo.setVillagecount(countVO); + + // 计算最大用户最大值 + PmKpiVO maxUserVo = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi4gVenue.get最大用户数()) { + maxUserVo.setValue(BigDecimal.valueOf(pmKpi4gVenue.get最大用户数())); + } + vo.setMaxusercount(maxUserVo); + + list.add(vo); + } + + IPage voPage = new Page<>(); + voPage.setRecords(list); + voPage.setTotal(PageInfo.of(records).getTotal()); + return voPage; + } + + @Override + public Map get4gVenueLastTime(Integer[] venueIds){ + return pmKpi4gVenueMapper.getLastTimeByvenueIds(venueIds); + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi5gCellServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi5gCellServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c1e337e22fc576c0cf5ffc369b7bd11677bd33bd --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi5gCellServiceImpl.java @@ -0,0 +1,229 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.PmKpi5gCell; +import com.ruoyi.eastcom_yw.domain.PmKpiMaxEntity; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.qo.DpSceneConfigQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpi5gCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiColorQo; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.DpSceneConfigMapper; +import com.ruoyi.eastcom_yw.mapper.PmKpi4gCellMapper; +import com.ruoyi.eastcom_yw.mapper.PmKpi5gCellMapper; +import com.ruoyi.eastcom_yw.service.PmKpi5gCellService; +import com.ruoyi.eastcom_yw.service.convert.PmKpi4gCellConvert; +import com.ruoyi.eastcom_yw.service.convert.PmKpi5gCellConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Service +public class PmKpi5gCellServiceImpl extends ServiceImpl implements PmKpi5gCellService { + + @Autowired + private PmKpi5gCellMapper pmKpi5gCellMapper; + + + @Autowired + private DpSceneConfigMapper dpSceneConfigMapper; + + + /** + * 场馆5G小区级15分钟指标列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(PmKpiCellQO qo) { + qo.setPageSize(0); + List list = pmKpi5gCellMapper.getList(qo); + return PmKpi5gCellConvert.INSTANCE.entityToVoList(list); + } + + /** + * 场馆5G小区级15分钟指标分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(PmKpiCellQO qo) { + PageUtils.startPage(qo, PmKpiCellQO.class); + List records = pmKpi5gCellMapper.getList(qo); + List list = new ArrayList<>(); + + if (!records.isEmpty()) { + qo.setPageSize(0); + PmKpiMaxEntity maxKpi = pmKpi5gCellMapper.getMaxKpi(qo); + BigDecimal maxuserNum = maxKpi.getMaxuserNum(); + BigDecimal prbupNum = maxKpi.getPrbupNum(); + BigDecimal prbdownNum = maxKpi.getPrbdownNum(); + BigDecimal avgNum = maxKpi.getAvgNum(); + BigDecimal succesNum = maxKpi.getSuccesNum(); + BigDecimal failNum = maxKpi.getFailNum(); + BigDecimal avgDisturb = maxKpi.getAvgDisturb(); + + + for (PmKpi5gCell pmKpi5gCell : records) { + PmKpi15MinCellVO vo = new PmKpi15MinCellVO(); + BeanUtil.copyProperties(pmKpi5gCell, vo); + vo.setCellcodeci(pmKpi5gCell.getCi()); + + DpSceneConfigQO configQO = new DpSceneConfigQO(); + configQO.setCelltype(qo.getNetType()); + + vo.setNetType(qo.getNetType()); + + BigDecimal defaultNum = new BigDecimal(0); + PmKpiColorQo kpiColorQo = new PmKpiColorQo(); + kpiColorQo.setPrbupvalue(null != pmKpi5gCell.get上行prb利用率() ? pmKpi5gCell.get上行prb利用率() : defaultNum); + kpiColorQo.setPrbdownvalue(null != pmKpi5gCell.get下行prb利用率() ? pmKpi5gCell.get下行prb利用率() : defaultNum); + kpiColorQo.setAvgdisvalue(null != pmKpi5gCell.get上行干扰值() ? BigDecimal.valueOf(pmKpi5gCell.get上行干扰值()) : defaultNum); + kpiColorQo.setMaxuservalue(null != pmKpi5gCell.get最大用户数() ? pmKpi5gCell.get最大用户数() : defaultNum); + kpiColorQo.setFreqtype(pmKpi5gCell.get小区频段()); + kpiColorQo.setDevicetype(pmKpi5gCell.get设备类型()); + kpiColorQo.setBandwidth(pmKpi5gCell.get带宽()); + kpiColorQo.setNettype(qo.getNetType()); + + Map fourKpiColor = dpSceneConfigMapper.getFourKpiColor(kpiColorQo); + + //平均用户 + PmKpiVO avgUser = new PmKpiVO(avgNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gCell.get平均用户数()) { + avgUser.setValue(pmKpi5gCell.get平均用户数()); + } + vo.set平均用户数(avgUser); + + //干扰值 + PmKpiVO disb = new PmKpiVO(avgDisturb, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gCell.get上行干扰值()) { + disb.setValue(BigDecimal.valueOf(pmKpi5gCell.get上行干扰值())); +// configQO.setValue(BigDecimal.valueOf(pmKpi5gCell.get上行干扰值())); +// configQO.setName(KpiConstants.YW_FIELD_AVG_DIS); +// String avgdisbColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != avgdisbColor) { +// disb.setColor(avgdisbColor); +// } + disb.setColor(fourKpiColor.get("avgdiscolor").toString()); + } + vo.set上行平均干扰(disb); + + //无线接通率 + PmKpiVO success = new PmKpiVO(succesNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gCell.get无线接通率()) { + success.setValue(pmKpi5gCell.get无线接通率()); + } + vo.set无线接通率(success); + + //无线掉线率 + PmKpiVO failrate = new PmKpiVO(failNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gCell.get无线掉线率()) { + failrate.setValue(pmKpi5gCell.get无线掉线率()); + } + vo.set无线掉线率(failrate); + + //最大用户数 + LocalDateTime starttime = qo.getStarttime().minusHours(6); + qo.setQuerystarttime(starttime); + qo.setQueryvenueid(pmKpi5gCell.getVenueId()); + qo.setVillageIds(new String[]{pmKpi5gCell.getCi()}); + List dataList = pmKpi5gCellMapper.getKpiDataList(qo); + vo.setKpi6HourData(dataList); + + PmKpiVO maxUserVo = new PmKpiVO(maxuserNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gCell.get最大用户数()) { + maxUserVo.setValue(pmKpi5gCell.get最大用户数()); +// configQO.setValue(pmKpi5gCell.get最大用户数()); +// configQO.setName(KpiConstants.YW_FIELD_MAX_USER); +// String maxUserColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != maxUserColor) { +// maxUserVo.setColor(maxUserColor); +// } + maxUserVo.setColor(fourKpiColor.get("maxusercolor").toString()); + } + maxUserVo.setData(dataList); + vo.set最大用户数(maxUserVo); + + //上行prb利用率 +// List upPrbList = pmKpi5gCellMapper.getUpPrbList(qo); + PmKpiVO upPrbVo = new PmKpiVO(prbupNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gCell.get上行prb利用率()) { + upPrbVo.setValue(pmKpi5gCell.get上行prb利用率()); +// configQO.setName(KpiConstants.YW_FIELD_RPB_UP); +// configQO.setValue(pmKpi5gCell.get上行prb利用率()); +// String upPrbVoColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != upPrbVoColor) { +// upPrbVo.setColor(upPrbVoColor); +// } + upPrbVo.setColor(fourKpiColor.get("prbupcolor").toString()); + } + upPrbVo.setData(dataList); + vo.set上行prb利用率(upPrbVo); + + //下行prb利用率 +// List downPrbList = pmKpi5gCellMapper.getDownPrbList(qo); + PmKpiVO downPrbVo = new PmKpiVO(prbdownNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gCell.get下行prb利用率()) { + downPrbVo.setValue(pmKpi5gCell.get下行prb利用率()); +// configQO.setName(KpiConstants.YW_FIELD_RPB_DOWN); +// configQO.setValue(pmKpi5gCell.get下行prb利用率()); +// String downPrbVoColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != downPrbVoColor) { +// downPrbVo.setColor(downPrbVoColor); +// } + downPrbVo.setColor(fourKpiColor.get("prbdowncolor").toString()); + + } + downPrbVo.setData(dataList); + vo.set下行prb利用率(downPrbVo); + + list.add(vo); + } + } + IPage voPage = new Page<>(); + voPage.setRecords(list); + voPage.setTotal(PageInfo.of(records).getTotal()); + return voPage; + } + + + @Override + public void export(PmKpiCellQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(PmKpi5gCellVO.class); + try { + util.exportExcel(response, data, "场馆5G小区级15分钟指标信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi5gMinServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi5gMinServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fe97bac6b8f8e864cadf4ebf3882c277ecb51177 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi5gMinServiceImpl.java @@ -0,0 +1,271 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.PmKpi4gMin; +import com.ruoyi.eastcom_yw.domain.PmKpi5gMin; +import com.ruoyi.eastcom_yw.domain.PmKpiMaxEntity; +import com.ruoyi.eastcom_yw.domain.dto.PmKpi5gMinDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.qo.DpSceneConfigQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpi5gMinQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiColorQo; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiMinQO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi5gMinVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpiOneMinVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpiVO; +import com.ruoyi.eastcom_yw.domain.vo.RecordVo; +import com.ruoyi.eastcom_yw.mapper.DpSceneConfigMapper; +import com.ruoyi.eastcom_yw.mapper.PmKpi5gMinMapper; +import com.ruoyi.eastcom_yw.service.PmKpi5gMinService; +import com.ruoyi.eastcom_yw.service.convert.PmKpi5gMinConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + *

+ * 场馆5G小区级1分钟指标 服务实现类 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Service +public class PmKpi5gMinServiceImpl extends ServiceImpl implements PmKpi5gMinService { + + @Resource + private PmKpi5gMinMapper pmKpi5gMinMapper; + + @Autowired + private DpSceneConfigMapper dpSceneConfigMapper; + + /** + * 场馆5G小区级1分钟指标列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(PmKpiMinQO qo) { + qo.setPageSize(0); + List list = pmKpi5gMinMapper.getList(qo); + return PmKpi5gMinConvert.INSTANCE.entityToVoList(list); + } + + /** + * 场馆5G小区级1分钟指标分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(PmKpiMinQO qo) { + PageUtils.startPage(qo, PmKpiMinQO.class); + List records = pmKpi5gMinMapper.getList(qo); + List list = new ArrayList<>(); + + if (!records.isEmpty()) { + qo.setPageSize(0); + PmKpiMaxEntity maxKpi = pmKpi5gMinMapper.getMaxKpi(qo); + BigDecimal maxuserNum = maxKpi.getMaxuserNum(); + BigDecimal prbupNum = maxKpi.getPrbupNum(); + BigDecimal prbdownNum = maxKpi.getPrbdownNum(); + BigDecimal avgNum = maxKpi.getAvgNum(); + BigDecimal succesNum = maxKpi.getSuccesNum(); + BigDecimal failNum = maxKpi.getFailNum(); + BigDecimal avgDisturb = maxKpi.getAvgDisturb(); + + for (PmKpi5gMin pmKpi5gMin : records) { + PmKpiOneMinVO vo = new PmKpiOneMinVO(); + BeanUtil.copyProperties(pmKpi5gMin, vo); + + + DpSceneConfigQO configQO = new DpSceneConfigQO(); + configQO.setCelltype(qo.getNetType()); + vo.setNetType(qo.getNetType()); + + BigDecimal defaultNum = new BigDecimal(0); + PmKpiColorQo kpiColorQo = new PmKpiColorQo(); + kpiColorQo.setPrbupvalue(null != pmKpi5gMin.getPrbUp() ? BigDecimal.valueOf(pmKpi5gMin.getPrbUp()) : defaultNum); + kpiColorQo.setPrbdownvalue(null != pmKpi5gMin.getPrbDown() ? BigDecimal.valueOf(pmKpi5gMin.getPrbDown()) : defaultNum); + kpiColorQo.setAvgdisvalue(null != pmKpi5gMin.getUpDisturb() ? BigDecimal.valueOf(pmKpi5gMin.getUpDisturb()) : defaultNum); + kpiColorQo.setMaxuservalue(null != pmKpi5gMin.getRrcMaxUser() ? BigDecimal.valueOf(pmKpi5gMin.getRrcMaxUser()) : defaultNum); + kpiColorQo.setFreqtype(pmKpi5gMin.get小区频段()); + kpiColorQo.setDevicetype(pmKpi5gMin.get设备类型()); + kpiColorQo.setBandwidth(pmKpi5gMin.get带宽()); + kpiColorQo.setNettype(qo.getNetType()); + + Map fourKpiColor = dpSceneConfigMapper.getFourKpiColor(kpiColorQo); + + //平均用户 + PmKpiVO avgUser = new PmKpiVO(avgNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gMin.getRrcAvgUser()) { + avgUser.setValue(pmKpi5gMin.getRrcAvgUser()); + } + + vo.set平均用户数(avgUser); + + //干扰值 + PmKpiVO upDisturb = new PmKpiVO(avgDisturb, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gMin.getUpDisturb()) { + upDisturb.setValue(BigDecimal.valueOf(pmKpi5gMin.getUpDisturb())); +// configQO.setValue(BigDecimal.valueOf(pmKpi5gMin.getUpDisturb())); +// configQO.setName(KpiConstants.YW_FIELD_AVG_DIS); +// String avgdisbColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != avgdisbColor) { +// upDisturb.setColor(avgdisbColor); +// } + upDisturb.setColor(fourKpiColor.get("avgdiscolor").toString()); + } + vo.set上行平均干扰(upDisturb); + + //无线接通率 + PmKpiVO success = new PmKpiVO(succesNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gMin.getCallSuccRate()) { + success.setValue(pmKpi5gMin.getCallSuccRate()); + } + vo.set无线接通率(success); + + //无线掉线率 + PmKpiVO failrate = new PmKpiVO(failNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gMin.getDropCallRate()) { + failrate.setValue(pmKpi5gMin.getDropCallRate()); + } + vo.set无线掉线率(failrate); + + //最大用户数 + PmKpiVO maxUserVo = new PmKpiVO(maxuserNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gMin.getRrcMaxUser()) { + maxUserVo.setValue(BigDecimal.valueOf(pmKpi5gMin.getRrcMaxUser())); +// configQO.setName(KpiConstants.YW_FIELD_MAX_USER); +// configQO.setValue(BigDecimal.valueOf(pmKpi5gMin.getRrcMaxUser())); +// String maxUserColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != maxUserColor) { +// maxUserVo.setColor(maxUserColor); +// } + maxUserVo.setColor(fourKpiColor.get("maxusercolor").toString()); + } + vo.set最大用户数(maxUserVo); + + //上行prb利用率 + PmKpiVO upPrbVo = new PmKpiVO(prbupNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gMin.getPrbUp()) { + upPrbVo.setValue(BigDecimal.valueOf((pmKpi5gMin.getPrbUp()))); +// configQO.setValue(BigDecimal.valueOf(pmKpi5gMin.getPrbUp())); +// configQO.setName(KpiConstants.YW_FIELD_RPB_UP); +// String upPrbVoColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != upPrbVoColor) { +// upPrbVo.setColor(upPrbVoColor); +// } + upPrbVo.setColor(fourKpiColor.get("prbupcolor").toString()); + } + + vo.set上行prb利用率(upPrbVo); + + //下行prb利用率 + PmKpiVO downPrbVo = new PmKpiVO(prbdownNum, KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gMin.getPrbDown()) { + downPrbVo.setValue(BigDecimal.valueOf(pmKpi5gMin.getPrbDown())); +// configQO.setValue(BigDecimal.valueOf(pmKpi5gMin.getPrbDown())); +// configQO.setName(KpiConstants.YW_FIELD_RPB_DOWN); +// String downPrbVoColor = dpSceneConfigMapper.getColorByQo(configQO); +// if (null != downPrbVoColor) { +// downPrbVo.setColor(downPrbVoColor); +// } + downPrbVo.setColor(fourKpiColor.get("prbdowncolor").toString()); + } + vo.set下行prb利用率(downPrbVo); + + list.add(vo); + } + } + + IPage voPage = new Page<>(); + voPage.setRecords(list); + voPage.setTotal(PageInfo.of(records).getTotal()); + return voPage; + } + + @Override + public PmKpi5gMinVO fetchById(Long id) { + PmKpi5gMin entity = pmKpi5gMinMapper.selectById(id); + return PmKpi5gMinConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(PmKpi5gMinDTO dto) { + PmKpi5gMin entity = PmKpi5gMinConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(pmKpi5gMinMapper.deleteBatchIds(ids)); + } + + @Override + public void export(PmKpiMinQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(PmKpi5gMinVO.class); + try { + util.exportExcel(response, data, "场馆5G小区级1分钟指标信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi5gVenueServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi5gVenueServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2dd5ec30b5fa185ff3f4039af8164af133e39672 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpi5gVenueServiceImpl.java @@ -0,0 +1,127 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.PmKpi4gVenue; +import com.ruoyi.eastcom_yw.domain.PmKpi5gCell; +import com.ruoyi.eastcom_yw.domain.PmKpi5gVenue; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiVenueQO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi4gVenueConvertVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpi5gVenueVO; +import com.ruoyi.eastcom_yw.domain.vo.PmKpiVO; +import com.ruoyi.eastcom_yw.mapper.PmKpi4gCellMapper; +import com.ruoyi.eastcom_yw.mapper.PmKpi5gCellMapper; +import com.ruoyi.eastcom_yw.mapper.PmKpi5gVenueMapper; +import com.ruoyi.eastcom_yw.service.PmKpi5gVenueService; +import com.ruoyi.eastcom_yw.service.convert.PmKpi5gVenueConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.RequestContextHolder; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + *

+ * 5G场馆级15分钟指标 服务实现类 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Service +public class PmKpi5gVenueServiceImpl extends ServiceImpl implements PmKpi5gVenueService { + + @Resource + private PmKpi5gVenueMapper pmKpi5gVenueMapper; + + @Autowired + private PmKpi5gCellMapper pmKpi5gCellMapper; + + + /** + * 5G场馆级15分钟指标分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(PmKpiVenueQO qo) { + PageUtils.startPage(qo, PmKpiVenueQO.class); + List records = pmKpi5gVenueMapper.getList(qo); + + List list = new ArrayList<>(); + + BigDecimal num = new BigDecimal("0"); + for (PmKpi5gVenue pmKpi5gVenue : records) { + PmKpi4gVenueConvertVO vo = new PmKpi4gVenueConvertVO(); + BeanUtil.copyProperties(pmKpi5gVenue, vo); + + //异常小区数 + int count = pmKpi5gCellMapper.getUnusualcount(pmKpi5gVenue.get场馆id(), qo.getStarttime(), qo.getEndtime(), qo.getNetType()); + PmKpiVO unusualcount = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + unusualcount.setValue(BigDecimal.valueOf(count)); + vo.setUnusualcount(unusualcount); + + //上行prb利用率 + PmKpiVO prbUpVo = new PmKpiVO( KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gVenue.get上行prb利用率()) { + prbUpVo.setValue(pmKpi5gVenue.get上行prb利用率()); + prbUpVo.setColor(pmKpi5gVenue.getPrbupColor()); + } + vo.set上行prb利用率(prbUpVo); + + //下行prb利用率 + PmKpiVO prbdownVo = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gVenue.get下行prb利用率()) { + prbdownVo.setValue(pmKpi5gVenue.get下行prb利用率()); + prbdownVo.setColor(pmKpi5gVenue.getPrbdownColor()); + } + vo.set下行prb利用率(prbdownVo); + + //小区总数 + int villageCount = pmKpi5gCellMapper.getVillageCount(pmKpi5gVenue.get场馆id(),qo.getStarttime(),qo.getEndtime()); + PmKpiVO countVO = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + countVO.setValue(BigDecimal.valueOf(villageCount)); + vo.setVillagecount(countVO); + + + // 计算最大用户最大值 + PmKpiVO maxUserVo = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != pmKpi5gVenue.get最大用户数()) { + maxUserVo.setValue(BigDecimal.valueOf(pmKpi5gVenue.get最大用户数())); + } + vo.setMaxusercount(maxUserVo); + + list.add(vo); + } + IPage voPage = new Page<>(); + voPage.setRecords(list); + voPage.setTotal(PageInfo.of(records).getTotal()); + return voPage; + } + + @Override + public Map get5gVenueLastTime(Integer[] venueIds){ + return pmKpi5gVenueMapper.getLastTimeByvenueIds(venueIds); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpiMonitorCellServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpiMonitorCellServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5d00af120966d80b6c8fdb8b317e477b0e3aced8 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/PmKpiMonitorCellServiceImpl.java @@ -0,0 +1,747 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.PmKpi4gCell; +import com.ruoyi.eastcom_yw.domain.PmKpi4gMin; +import com.ruoyi.eastcom_yw.domain.PmKpi5gMin; +import com.ruoyi.eastcom_yw.domain.PmKpiMonitorEntity; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.qo.*; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.PmKpiMonitorCellService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author yqf + * @date 2023/4/13 + */ +@Service +public class PmKpiMonitorCellServiceImpl implements PmKpiMonitorCellService { + + @Autowired + private PmKpi4gCellMapper pmKpi4gCellMapper; + + @Autowired + private PmKpi5gCellMapper pmKpi5gCellMapper; + + @Autowired + private Dp2AgisLink5miMapper agisLink5miMapper; + + @Autowired + private Dp2PnNetVenue5miMapper netVenue5miMapper; + + @Autowired + private DpSceneConfigMapper dpSceneConfigMapper; + + + @Autowired + private PmKpi4gMinMapper pmKpi4gMinMapper; + + + @Autowired + private PmKpi5gMinMapper pmKpi5gMinMapper; + + @Autowired + private PmKpi4gVenueMapper pmKpi4gVenueMapper; + + @Autowired + private PmKpi5gVenueMapper pmKpi5gVenueMapper; + + @Autowired + private YwScenePictureMapper ywScenePictureMapper; + + @Autowired + private Dp2PnNetVenue5miMapper dp2PnNetVenue5miMapper; + + @Autowired + private RedisCache redisCache; + + private String cell_key = CacheConstants.YW_KPIMONITORCELL_INFO; + private String min_key = CacheConstants.YW_KPIMONITORMIN_INFO; + + @Override + public PageInfo getMonitorCellList(PmKpiCellMonitorQO qo) { + PageInfo pageInfo = new PageInfo(); + Integer pageNum = qo.getPageNum(); + Integer pageSize = qo.getPageSize(); + List allList = new ArrayList<>(); + if (qo.getIscache()) { + if (qo.getDatatype().equals(KpiConstants.YW_DATATYPE_15)) { + allList = redisCache.getCacheObject(cell_key); + } else { + allList = redisCache.getCacheObject(min_key); + } + } else { + List voList = getMonitorVoList(qo); + + Map> map = voList.stream().collect(Collectors.groupingBy(e -> e.get坐席编号() + "|" + e.getVenueid())); + for (String key : map.keySet()) { + List list = map.get(key); + BigDecimal num = new BigDecimal("0.00"); + float score = 0; + MonitorCellVo monitorCellVo = new MonitorCellVo(); + monitorCellVo.setSeatid(key.substring(0, key.indexOf("|"))); + monitorCellVo.setCelllist(map.get(key)); + monitorCellVo.setVenuename(map.get(key).get(0).getVenuename()); + monitorCellVo.setVenueid(map.get(key).get(0).getVenueid()); + monitorCellVo.setPointid(map.get(key).get(0).getPointid()); + monitorCellVo.setStationno(map.get(key).get(0).getStationno()); + monitorCellVo.setPointname(map.get(key).get(0).getPointname()); + monitorCellVo.setLongitude(map.get(key).get(0).getLongitude()); + monitorCellVo.setLatitude(map.get(key).get(0).getLatitude()); + + //根据坐席分值判断颜色 + DpSceneConfigQO sceneConfigQO = new DpSceneConfigQO(); + sceneConfigQO.setNettype(qo.getNettype()); + + String seatcolor = ""; + int seatscore = 0; + String frequency = null; + String devicetype = null; + Long bandwidth = null; + + if (qo.getKpiname().equals(KpiConstants.YW_FIELD_ALL)) { + for (PmKpi15CellMonitorVO vo : map.get(key)) { + if (null != vo.get综合得分().getValue()) { + if (vo.get综合得分().getValue().compareTo(num) > 0) { + num = vo.get综合得分().getValue(); + } +// num = num.add(vo.get综合得分().getValue()); + } + } + + } else if (qo.getKpiname().equals(KpiConstants.YW_FIELD_RPB_UP)) { + //坐席指标值按所有小区最差的,上行prb利用率越大越差 +// num = list.stream().map(s -> s.get上行prb利用率().getValue().intValue()).max(Integer::compareTo).get(); + for (PmKpi15CellMonitorVO vo : map.get(key)) { + if (null != vo.get上行prb利用率().getValue()) { + if (score <= vo.get上行prb利用率().getScore()) { + score = vo.get上行prb利用率().getScore(); + num = vo.get上行prb利用率().getValue(); + } + } + } + + + } else if (qo.getKpiname().equals(KpiConstants.YW_FIELD_RPB_DOWN)) { +// num = list.stream().map(s -> s.get下行prb利用率().getValue().intValue()).max(Integer::compareTo).get(); + for (PmKpi15CellMonitorVO vo : map.get(key)) { + if (null != vo.get下行prb利用率().getValue()) { + if (score <= vo.get下行prb利用率().getScore()) { + score = vo.get下行prb利用率().getScore(); + num = vo.get下行prb利用率().getValue(); + } + } + } + + } else if (qo.getKpiname().equals(KpiConstants.YW_FIELD_MAX_USER)) { + //分设备类型 +// num = list.stream().map(s -> s.get最大用户数().getValue().intValue()).max(Integer::compareTo).get(); + for (PmKpi15CellMonitorVO vo : map.get(key)) { + if (null != vo.get最大用户数().getValue()) { + if (score <= vo.get最大用户数().getScore()) { + score = vo.get最大用户数().getScore(); + num = vo.get最大用户数().getValue(); + frequency = vo.get小区频段(); + devicetype = vo.get设备类型(); + bandwidth = vo.get带宽(); + } + } + } + + } else if (qo.getKpiname().equals(KpiConstants.YW_FIELD_AVG_DIS)) { +// num = list.stream().map(s -> s.get上行平均干扰().getValue().intValue()).max(Integer::compareTo).get(); + for (PmKpi15CellMonitorVO vo : map.get(key)) { + if (null != vo.get上行平均干扰().getValue()) { + if (score <= vo.get上行平均干扰().getScore()) { + score = vo.get上行平均干扰().getScore(); + num = vo.get上行平均干扰().getValue(); + } + } + } + } + + sceneConfigQO.setName(qo.getKpiname()); + sceneConfigQO.setValue(num); + Map colorAndScore = dpSceneConfigMapper.getkpiColorAndScore(qo.getKpiname(), num.doubleValue(), qo.getNettype(), + frequency, devicetype, bandwidth); +// seatcolor = dpSceneConfigMapper.getkpicolor(qo.getKpiname(), num.doubleValue(), qo.getNettype(), +// frequency, devicetype, bandwidth); +// seatscore = dpSceneConfigMapper.getkpicolorscore(qo.getKpiname(), num.doubleValue(), qo.getNettype(), +// frequency, devicetype, bandwidth); + monitorCellVo.setColor(colorAndScore.get("color").toString()); + monitorCellVo.setScore(Float.valueOf(colorAndScore.get("score").toString())); + + monitorCellVo.setKpiname(qo.getKpiname()); + monitorCellVo.setDatatype(qo.getDatatype()); + monitorCellVo.setNettype(qo.getNettype()); + + allList.add(monitorCellVo); + } + + //把多次查询组装查询 + + + if (null != qo.getSeatcolor() && !qo.getSeatcolor().equals("")) { + allList = allList.stream().filter(e -> e.getColor().equals(qo.getSeatcolor())).collect(Collectors.toList()); + } + + if (null != qo.getSortcol() && null != qo.getSort()) { + if (qo.getSort().equals(KpiConstants.YW_SORT_DESC)) { + allList = allList.stream().sorted(Comparator.comparing(MonitorCellVo::getScore).reversed()).collect(Collectors.toList()); + } else { + allList = allList.stream().sorted(Comparator.comparing(MonitorCellVo::getScore)).collect(Collectors.toList()); + } + + } + + int orderid = 1; + for (MonitorCellVo monitorCellVo : allList) { + monitorCellVo.setOrderid(orderid); + orderid++; + } + + + if (qo.getDatatype().equals(KpiConstants.YW_DATATYPE_15)) { + redisCache.deleteObject(cell_key); + redisCache.setCacheObject(cell_key, allList); + } else { + redisCache.deleteObject(min_key); + redisCache.setCacheObject(min_key, allList); + } + + } + pageInfo = getPageInfo(pageNum, pageSize, allList); + return pageInfo; + } + + private List getMonitorVoList(PmKpiCellMonitorQO qo) { + List voList = new ArrayList<>(); + List kpiList = new ArrayList<>(); + if (qo.getDatatype().equals(KpiConstants.YW_DATATYPE_15)) { + if (qo.getNettype().equals(KpiConstants.YW_NETTYPE_4G)) { + qo.setPageSize(0); + if (qo.getSceneruntype() == KpiConstants.YW_SCENE_RUNTYPE) { + kpiList = pmKpi4gCellMapper.getKpiCopyList(qo); + } else { + kpiList = pmKpi4gCellMapper.getKpiList(qo); + } + + } else { + qo.setPageSize(0); + if (qo.getSceneruntype() == KpiConstants.YW_SCENE_RUNTYPE) { + kpiList = pmKpi5gCellMapper.getKpiCopyList(qo); + } else { + kpiList = pmKpi5gCellMapper.getKpiList(qo); + } + + } + } else { + if (qo.getNettype().equals(KpiConstants.YW_NETTYPE_4G)) { + qo.setPageSize(0); + kpiList = pmKpi4gMinMapper.getKpiList(qo); + } else { + qo.setPageSize(0); + kpiList = pmKpi5gMinMapper.getKpiList(qo); + } + } + kpiList = kpiList.stream().filter(e -> null != e.get坐席编号()).collect(Collectors.toList()); + if (qo.getKpiname().equals(KpiConstants.YW_FIELD_RPB_UP)) { + kpiList = kpiList.stream().filter(e -> null != e.get上行prb利用率() && !e.get上行prb利用率().equals(new BigDecimal("0.00"))).collect(Collectors.toList()); + } else if (qo.getKpiname().equals(KpiConstants.YW_FIELD_RPB_DOWN)) { + kpiList = kpiList.stream().filter(e -> null != e.get下行prb利用率() && !e.get下行prb利用率().equals(new BigDecimal("0.00"))).collect(Collectors.toList()); + } else if (qo.getKpiname().equals(KpiConstants.YW_FIELD_AVG_DIS)) { + kpiList = kpiList.stream().filter(e -> null != e.get上行平均干扰() && !e.get上行平均干扰().equals(new BigDecimal("0.00"))).collect(Collectors.toList()); + } else if (qo.getKpiname().equals(KpiConstants.YW_FIELD_MAX_USER)) { + kpiList = kpiList.stream().filter(e -> null != e.get最大用户数() && !e.get最大用户数().equals(BigDecimal.ZERO)).collect(Collectors.toList()); + } + for (PmKpiMonitorEntity monitorEntity : kpiList) { + PmKpi15CellMonitorVO vo = new PmKpi15CellMonitorVO(); + BeanUtil.copyProperties(monitorEntity, vo); + + DpSceneConfigQO configQO = new DpSceneConfigQO(); + configQO.setNettype(qo.getNettype()); + + //根据各指标值查出对应的颜色 + //上行prb利用率 + PmKpiVO prbUp = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != monitorEntity.get上行prb利用率()) { + prbUp.setValue(monitorEntity.get上行prb利用率()); + prbUp.setColor(monitorEntity.getPrbupColor()); + prbUp.setScore(monitorEntity.getPrbupScore()); + } + vo.set上行prb利用率(prbUp); + + //下行prb利用率 + PmKpiVO prbDown = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != monitorEntity.get下行prb利用率()) { + prbDown.setValue(monitorEntity.get下行prb利用率()); + prbDown.setColor(monitorEntity.getPrbdownColor()); + prbDown.setScore(monitorEntity.getPrbdownScore()); + } + vo.set下行prb利用率(prbDown); + + //上行平均干扰 + PmKpiVO avgDisturb = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != monitorEntity.get上行平均干扰()) { + avgDisturb.setValue(monitorEntity.get上行平均干扰()); + avgDisturb.setColor(monitorEntity.getAvgdisColor()); + avgDisturb.setScore(monitorEntity.getAvgdisScore()); + } + vo.set上行平均干扰(avgDisturb); + + //最大用户数 + PmKpiVO maxUser = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != monitorEntity.get最大用户数()) { + maxUser.setValue(monitorEntity.get最大用户数()); + maxUser.setColor(monitorEntity.getMaxuserColor()); + maxUser.setScore(monitorEntity.getMaxuserScore()); + } + vo.set最大用户数(maxUser); + + + ////综合得分 + PmKpiVO allkpi = new PmKpiVO(KpiConstants.YW_KPI_COLOR_DEFAULT); +// allkpi.setValue(BigDecimal.valueOf(getMaxScore(prbUp.getScore(), prbDown.getScore(), avgDisturb.getScore(), maxUser.getScore()))); + allkpi.setValue(BigDecimal.valueOf(prbUp.getScore() + prbDown.getScore() + maxUser.getScore())); + configQO.setName(KpiConstants.YW_FIELD_ALL); + configQO.setValue(allkpi.getValue()); + Map colorAndScore = dpSceneConfigMapper.getkpiColorAndScore(KpiConstants.YW_FIELD_ALL, + allkpi.getValue().doubleValue(), qo.getNettype(), null, null, null); +// String allcolor = dpSceneConfigMapper.getkpicolor(KpiConstants.YW_FIELD_ALL, +// allkpi.getValue().doubleValue(), qo.getNettype(), null, null, null); +// int allscore = dpSceneConfigMapper.getkpicolorscore(KpiConstants.YW_FIELD_ALL, +// allkpi.getValue().doubleValue(), qo.getNettype(), null, null, null); + allkpi.setColor(colorAndScore.get("color").toString()); + allkpi.setScore(Float.parseFloat(colorAndScore.get("score").toString())); + vo.set综合得分(allkpi); + + + vo.setNettype(qo.getNettype()); + voList.add(vo); + } + + return voList; + } + + private float getMaxScore(float prbUp, float prbDown, float avgDisturb, float maxUser) { + float score = 0; + if (prbUp > score) { + score = prbUp; + } + if (prbDown > score) { + score = prbDown; + } + if (avgDisturb > score) { + score = avgDisturb; + } + if (maxUser > score) { + score = maxUser; + } + return score; + } + + public static PageInfo getPageInfo(int currentPage, int pageSize, List list) { + int total = list.size(); + if (total > pageSize) { + int toIndex = pageSize * currentPage; + if (toIndex > total) { + toIndex = total; + } + int totalPage = total % pageSize == 0 ? (total / pageSize) : (total / pageSize) + 1; + if (totalPage < currentPage) { + list = new ArrayList<>(); + } else { + list = list.subList(pageSize * (currentPage - 1), toIndex); + } + } + Page page = new Page<>(currentPage, pageSize); + page.addAll(list); + page.setPages((total + pageSize - 1) / pageSize); + page.setTotal(total); + return new PageInfo<>(page); + } + + @Override + public PageInfo getDpMonitorCellList(DpKpiMonitorQO qo) { + Map map = new HashMap<>(); + if (qo.getDatatype().equals(KpiConstants.YW_DATATYPE_15)) { + if (qo.getNettype().equals(KpiConstants.YW_NETTYPE_4G)) { + map = pmKpi4gCellMapper.getLastTime(qo.getSceneid(), qo.getSeatno()); + } else { + map = pmKpi5gCellMapper.getLastTime(qo.getSceneid(), qo.getSeatno()); + } + } else { + if (qo.getNettype().equals(KpiConstants.YW_NETTYPE_4G)) { + map = pmKpi4gMinMapper.getLastTime(qo.getSceneid(), qo.getSeatno()); + } else { + map = pmKpi5gMinMapper.getLastTime(qo.getSceneid(), qo.getSeatno()); + } + } + + PageInfo pageInfo = new PageInfo(); + if (null != map && map.size() > 0) { + LocalDateTime starttime = ((Timestamp) map.get("starttime")).toLocalDateTime(); + LocalDateTime endtime = ((Timestamp) map.get("endtime")).toLocalDateTime(); + qo.setStarttime(starttime); + qo.setEndtime(endtime); + PmKpiCellMonitorQO monitorQO = new PmKpiCellMonitorQO(); + monitorQO.setIscache(false); + BeanUtil.copyProperties(qo, monitorQO); + monitorQO.setPageNum(1); + monitorQO.setPageSize(20000); + //用于演示版本 + if (qo.getSceneruntype() == KpiConstants.YW_SCENE_RUNTYPE) { + monitorQO.setEndtime(qo.getMaxtime()); + monitorQO.setStarttime(qo.getMaxtime().minusMinutes(15)); //提前15分钟 + monitorQO.setSceneruntype(qo.getSceneruntype()); + } + pageInfo = getMonitorCellList(monitorQO); + } + + return pageInfo; + } + + @Override + public int updateDpcSeneControl(DpcSeneControlVo dpcSeneControlVo) { + return pmKpi4gCellMapper.updateDpcSeneControl(dpcSeneControlVo); + } + + @Override + public KpiVenueReportVo getReportKpi(Integer venueid, LocalDateTime starttime, LocalDateTime endtime, Integer minute) { + KpiVenueReportVo reportVo = new KpiVenueReportVo(); + if (null == starttime || null == endtime) { + Map lastTimeMap = pmKpi5gVenueMapper.getLastTime(venueid); + if (null == lastTimeMap) { + return null; + } + starttime = ((Timestamp) lastTimeMap.get("endtime")).toLocalDateTime().minusMinutes(minute); + endtime = ((Timestamp) lastTimeMap.get("endtime")).toLocalDateTime(); + } + + BigDecimal sumbg5g = pmKpi5gVenueMapper.getsumbg(venueid, starttime, endtime); + if (null != sumbg5g) { + reportVo.set流量GB5g(sumbg5g); + } + + + BigDecimal sumbg4g = pmKpi4gVenueMapper.getsumbg(venueid, starttime, endtime); + if (null == sumbg4g) { + Map lastTimeMap = pmKpi4gVenueMapper.getLastTime(venueid); + if (null == lastTimeMap) { + return null; + } + starttime = ((Timestamp) lastTimeMap.get("starttime")).toLocalDateTime(); + endtime = ((Timestamp) lastTimeMap.get("endtime")).toLocalDateTime(); + } + sumbg4g = pmKpi4gVenueMapper.getsumbg(venueid, starttime, endtime); + LocalDateTime laststarttime = endtime.minusMinutes(15); + KpiVenueReportVo lastData4g = pmKpi4gVenueMapper.getLastData(venueid, laststarttime, endtime); + KpiVenueReportVo maxuserData4g = pmKpi4gCellMapper.getMaxuserData(venueid, laststarttime, endtime); + KpiVenueReportVo prbUpData4g = pmKpi4gCellMapper.getPrbUpData(venueid, laststarttime, endtime); + KpiVenueReportVo prbDownData4g = pmKpi4gCellMapper.getPrbDownData(venueid, laststarttime, endtime); + + reportVo.set开始时间(starttime); + reportVo.set结束时间(endtime); + + if (null != sumbg4g) { + reportVo.set流量GB4g(sumbg4g); + } + if (null != lastData4g) { + reportVo.set场馆id(lastData4g.get场馆id()); + reportVo.set无线掉线率4g(lastData4g.get无线掉线率4g()); + reportVo.set无线接通率4g(lastData4g.get无线接通率4g()); + reportVo.set上行平均干扰4g(lastData4g.get上行平均干扰4g()); + reportVo.set最大用户数4g(lastData4g.get最大用户数4g()); + } + if (null != maxuserData4g) { + reportVo.set最大用户数小区4g(maxuserData4g.get最大用户数小区4g()); + } + if (null != prbUpData4g) { + reportVo.set上行prb利用率4g(prbUpData4g.get上行prb利用率4g()); + reportVo.set上行prb利用率小区4g(prbUpData4g.get上行prb利用率小区4g()); + } + + if (null != prbDownData4g) { + reportVo.set下行prb利用率4g(prbDownData4g.get下行prb利用率4g()); + reportVo.set下行prb利用率小区4g(prbDownData4g.get下行prb利用率小区4g()); + } + + + if (null == sumbg5g) { + Map lastTimeMap = pmKpi4gVenueMapper.getLastTime(venueid); + if (null == lastTimeMap) { + return null; + } + starttime = ((Timestamp) lastTimeMap.get("endtime")).toLocalDateTime().minusMinutes(minute); + endtime = ((Timestamp) lastTimeMap.get("endtime")).toLocalDateTime(); + } + laststarttime = endtime.minusMinutes(15); + KpiVenueReportVo lastData5g = pmKpi5gVenueMapper.getLastData(venueid, laststarttime, endtime); + KpiVenueReportVo maxuserData5g = pmKpi5gCellMapper.getMaxuserData(venueid, laststarttime, endtime); + KpiVenueReportVo prbUpData5g = pmKpi5gCellMapper.getPrbUpData(venueid, laststarttime, endtime); + KpiVenueReportVo prbDownData5g = pmKpi5gCellMapper.getPrbDownData(venueid, laststarttime, endtime); + + + if (null != lastData5g) { + reportVo.set平均用户数5g(lastData5g.get平均用户数5g()); + reportVo.set最大用户数5g(lastData5g.get最大用户数5g()); + reportVo.setSn异常释放率5g(lastData5g.getSn异常释放率5g()); + reportVo.set无线接通率5g(lastData5g.get无线接通率5g()); + reportVo.set无线掉线率5g(lastData5g.get无线掉线率5g()); + reportVo.set切换成功率5g(lastData5g.get切换成功率5g()); + reportVo.set上行干扰值5g(lastData5g.get上行干扰值5g()); + reportVo.setSgnb添加成功率5g(lastData5g.getSgnb添加成功率5g()); + } + if (null != maxuserData5g) { + reportVo.set小区最大用户数5g(maxuserData5g.get小区最大用户数5g()); + reportVo.set小区最大用户数小区5g(maxuserData5g.get小区最大用户数小区5g()); + } + if (null != prbUpData5g) { + reportVo.set上行prb利用率5g(prbUpData5g.get上行prb利用率5g()); + reportVo.set上行prb利用率小区5g(prbUpData5g.get上行prb利用率小区5g()); + } + if (null != prbDownData5g) { + reportVo.set下行prb利用率5g(prbDownData5g.get下行prb利用率5g()); + reportVo.set下行prb利用率小区5g(prbDownData5g.get下行prb利用率小区5g()); + } + return reportVo; + } + + @Override + public JSONObject getReportKpiByJson(Integer venueid, LocalDateTime starttime, LocalDateTime endtime, Integer minute) { + if (null == starttime || null == endtime) { + Map lastTimeMap = pmKpi5gVenueMapper.getLastTime(venueid); + if (null == lastTimeMap) { + return null; + } + starttime = ((Timestamp) lastTimeMap.get("endtime")).toLocalDateTime().minusMinutes(minute); + endtime = ((Timestamp) lastTimeMap.get("endtime")).toLocalDateTime(); + } + BigDecimal sumbg5g = pmKpi5gVenueMapper.getsumbg(venueid, starttime, endtime); + + if (null == sumbg5g) { + Map lastTimeMap = pmKpi4gVenueMapper.getLastTime(venueid); + if (null == lastTimeMap) { + return null; + } + starttime = ((Timestamp) lastTimeMap.get("endtime")).toLocalDateTime().minusMinutes(minute); + endtime = ((Timestamp) lastTimeMap.get("endtime")).toLocalDateTime(); + } + + JSONObject jsonObject = new JSONObject(); + + KpiVenueReportVo venueReportVo = getReportKpi(venueid, starttime, endtime, minute); + + KpiReport4gVo kpiReport4gVo = new KpiReport4gVo(); + if (venueReportVo == null) { + return null; + } + BeanUtil.copyProperties(venueReportVo, kpiReport4gVo); + + + PmKpiVenueQO kpiVenueQO = new PmKpiVenueQO(); + kpiVenueQO.setVenueId(venueid); + kpiVenueQO.setStarttime(endtime.minusHours(24)); + kpiVenueQO.setEndtime(endtime); + + kpiVenueQO.setPageSize(0); + List data4gList = pmKpi4gVenueMapper.getKpiDataList(kpiVenueQO); + + DateTimeFormatter fmt = DateTimeFormatter.ofPattern("HH:mm"); + List gb4gList = data4gList.stream().map( + red -> new KpiTrendVo("总流量", red.getGbcount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + List avgdisturb4gList = data4gList.stream().map( + red -> new KpiTrendVo("上行平均干扰", red.getAvgdisturbcount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + List mauser4gList = data4gList.stream().map( + red -> new KpiTrendVo("最大用户数", red.getMaxusercount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + List prbup4gList = data4gList.stream().map( + red -> new KpiTrendVo("上行prb利用率", red.getPrbupcount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + List prbdown4gList = data4gList.stream().map( + red -> new KpiTrendVo("下行prb利用率", red.getPrbdowncount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + + kpiReport4gVo.setGbList(gb4gList); + kpiReport4gVo.setAvgdisturbList(avgdisturb4gList); + kpiReport4gVo.setPrbupList(prbup4gList); + kpiReport4gVo.setPrbdownList(prbdown4gList); + kpiReport4gVo.setMauserList(mauser4gList); + + List gb4gTop5ist = pmKpi4gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_4G_GB).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), i.get上行流量mb())).collect(Collectors.toList()); + List avgdisturb4gTop5ist = pmKpi4gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_4G_DISTURB).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), i.get上行平均干扰())).collect(Collectors.toList()); + List mauser4gTop5ist = pmKpi4gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_4G_MAXUSER).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), i.get最大用户数())).collect(Collectors.toList()); + List prbup4gTop5ist = pmKpi4gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_4G_PRBUP).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), i.get上行prb利用率())).collect(Collectors.toList()); + List prbdown4gTop5ist = pmKpi4gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_4G_PRBDOWN).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), i.get下行prb利用率())).collect(Collectors.toList()); + + kpiReport4gVo.setGbTop5List(gb4gTop5ist); + kpiReport4gVo.setAvgdisturbTop5List(avgdisturb4gTop5ist); + kpiReport4gVo.setMauserTop5List(mauser4gTop5ist); + kpiReport4gVo.setPrbupTop5List(prbup4gTop5ist); + kpiReport4gVo.setPrbdownTop5List(prbdown4gTop5ist); + + + KpiReport5gVo kpiReport5gVo = new KpiReport5gVo(); + BeanUtil.copyProperties(venueReportVo, kpiReport5gVo); + + List data5gList = pmKpi5gVenueMapper.getKpiDataList(kpiVenueQO); + + List gb5gList = data5gList.stream().map( + red -> new KpiTrendVo("总流量", red.getGbcount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + List avgdisturb5gList = data5gList.stream().map( + red -> new KpiTrendVo("上行平均干扰", red.getAvgdisturbcount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + List mauser5gList = data5gList.stream().map( + red -> new KpiTrendVo("最大用户数", red.getMaxusercount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + List prbup5gList = data5gList.stream().map( + red -> new KpiTrendVo("上行prb利用率", red.getPrbupcount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + List prbdown5gList = data5gList.stream().map( + red -> new KpiTrendVo("下行prb利用率", red.getPrbdowncount(), fmt.format(red.getTime()))).collect(Collectors.toList()); + kpiReport5gVo.setGbList(gb5gList); + kpiReport5gVo.setAvgdisturbList(avgdisturb5gList); + kpiReport5gVo.setPrbupList(prbup5gList); + kpiReport5gVo.setPrbdownList(prbdown5gList); + kpiReport5gVo.setMauserList(mauser5gList); + + List gb5gTop5ist = pmKpi5gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_5G_GB).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), i.get上行5g流量())).collect(Collectors.toList()); + List avgdisturb5gTop5ist = pmKpi5gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_5G_DISTURB).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), BigDecimal.valueOf(i.get上行干扰值()))).collect(Collectors.toList()); + List mauser5gTop5ist = pmKpi5gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_5G_MAXUSER).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), i.get最大用户数())).collect(Collectors.toList()); + List prbup5gTop5ist = pmKpi5gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_5G_PRBUP).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), i.get上行prb利用率())).collect(Collectors.toList()); + List prbdown5gTop5ist = pmKpi5gCellMapper.getTop5List(venueid, starttime, endtime, KpiConstants.FIELD_5G_PRBDOWN).stream() + .map(i -> new KpiTrendVo(i.get小区名称(), i.get下行prb利用率())).collect(Collectors.toList()); + + kpiReport5gVo.setGbTop5List(gb5gTop5ist); + kpiReport5gVo.setAvgdisturbTop5List(avgdisturb5gTop5ist); + kpiReport5gVo.setMauserTop5List(mauser5gTop5ist); + kpiReport5gVo.setPrbupTop5List(prbup5gTop5ist); + kpiReport5gVo.setPrbdownTop5List(prbdown5gTop5ist); + + jsonObject.put("kpiReport4gVo", kpiReport4gVo); + jsonObject.put("kpiReport5gVo", kpiReport5gVo); + + + YwSceneNetAgixStaVo agixStaVo = ywScenePictureMapper.getNetAgixStatis(venueid.longValue(), starttime, endtime); + jsonObject.put("kpiReportAgix", agixStaVo); + + DateTimeFormatter dft = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + if (null != agixStaVo) { + + List flowTop5List = agisLink5miMapper.getAgislinkTop5List(venueid, starttime, endtime, KpiConstants.FIELD_AGIS_FLOWCOUNT).stream() + .map(i -> new KpiLinkTrendVo(i.getLinkName(), i.getADeviceName(), i.getFlowcount(), i.getStatDate().format(dft))).collect(Collectors.toList()); + List ullocityTop5List = agisLink5miMapper.getAgislinkTop5List(venueid, starttime, endtime, KpiConstants.FIELD_AGIS_UL_VELOCITY).stream() + .map(i -> new KpiLinkTrendVo(i.getLinkName(), i.getADeviceName(), i.getUlVelocity(), i.getStatDate().format(dft))).collect(Collectors.toList()); + List dllocityTop5List = agisLink5miMapper.getAgislinkTop5List(venueid, starttime, endtime, KpiConstants.FIELD_AGIS_DL_VELOCITY).stream() + .map(i -> new KpiLinkTrendVo(i.getLinkName(), i.getADeviceName(), i.getDlVelocity(), i.getStatDate().format(dft))).collect(Collectors.toList()); + List ulbandratioTop5List = agisLink5miMapper.getAgislinkTop5List(venueid, starttime, endtime, KpiConstants.FIELD_AGIS_UL_BAND_RATIO).stream() + .map(i -> new KpiLinkTrendVo(i.getLinkName(), i.getADeviceName(), i.getUlBandRatio(), i.getStatDate().format(dft))).collect(Collectors.toList()); + List dlbandratioTop5List = agisLink5miMapper.getAgislinkTop5List(venueid, starttime, endtime, KpiConstants.FIELD_AGIS_DL_BAND_RATIO).stream() + .map(i -> new KpiLinkTrendVo(i.getLinkName(), i.getADeviceName(), i.getDlBandRatio(), i.getStatDate().format(dft))).collect(Collectors.toList()); + + agixStaVo.setFlowTop5List(flowTop5List); + agixStaVo.setUllocityTop5List(ullocityTop5List); + agixStaVo.setDllocityTop5List(dllocityTop5List); + agixStaVo.setUlbandratioTop5List(ulbandratioTop5List); + agixStaVo.setDlbandratioTop5List(dlbandratioTop5List); + + } + YwSceneNetStaVo netStatis = ywScenePictureMapper.getNetStatis(venueid.longValue(), starttime, endtime); + jsonObject.put("kpiReportNet", netStatis); + + + YwSceneNetFixtelStaVo fixtelStaVo = ywScenePictureMapper.getNetFixtelStatis(venueid.longValue(), starttime, endtime); + if(null == fixtelStaVo){ + fixtelStaVo = ywScenePictureMapper.getNetFixtelStatis(venueid.longValue(), null, null); + } + jsonObject.put("kpiReportFixtel", fixtelStaVo); + + + YwSceneTransStaVo transStaVo = new YwSceneTransStaVo(); + + List opticalpowerTop5 = ywScenePictureMapper.getOpticalpowerTop5List(venueid.longValue(), 3, starttime, endtime); + jsonObject.put("kpiReportOpticalpowerTop5", opticalpowerTop5); + + String maxInOpticalpower = ""; + YwSceneTransOpticalpowerStaVo maxInOpticalpowerVo = ywScenePictureMapper.getMaxInOpticalpower(venueid.longValue(), starttime, endtime); + if (null != maxInOpticalpowerVo) { + maxInOpticalpower = maxInOpticalpowerVo.getInOpticalpower() + ""; + }else { + maxInOpticalpowerVo = ywScenePictureMapper.getMaxInOpticalpower(venueid.longValue(), null, null); + maxInOpticalpower = maxInOpticalpowerVo.getInOpticalpower() + ""; + starttime = LocalDateTime.parse(maxInOpticalpowerVo.getDateTime(),dft); + endtime = LocalDateTime.parse(maxInOpticalpowerVo.getDateTime(),dft).plusMinutes(minute); + opticalpowerTop5 = ywScenePictureMapper.getOpticalpowerTop5List(venueid.longValue(), 3, starttime, endtime); + } + + String maxOutOpticalpower = ""; + + + + List outopticalpowerTop5 = ywScenePictureMapper.getOutOpticalpowerTop5List(venueid.longValue(), 3, starttime, endtime); + + YwSceneTransOpticalpowerStaVo maxOutOpticalpowerVo = ywScenePictureMapper.getMaxOutOpticalpower(venueid.longValue(), starttime, endtime); + if(null != maxOutOpticalpowerVo){ + maxOutOpticalpower = maxOutOpticalpowerVo.getOutOpticalpower() + ""; + }else { + maxOutOpticalpowerVo = ywScenePictureMapper.getMaxOutOpticalpower(venueid.longValue(), null, null); + maxOutOpticalpower = maxOutOpticalpowerVo.getOutOpticalpower() + ""; + starttime = LocalDateTime.parse(maxOutOpticalpowerVo.getDateTime(),dft); + endtime = LocalDateTime.parse(maxOutOpticalpowerVo.getDateTime(),dft).plusMinutes(minute); + outopticalpowerTop5 = ywScenePictureMapper.getOutOpticalpowerTop5List(venueid.longValue(), 3, starttime, endtime); + } + + + transStaVo.setOpticalpowerTop5(opticalpowerTop5); + transStaVo.setOutopticalpowerTop5(outopticalpowerTop5); + transStaVo.setMaxInOpticalpower(maxInOpticalpower); + transStaVo.setMaxOutOpticalpower(maxOutOpticalpower); + + jsonObject.put("kpiReportOpticalpower", transStaVo); + + + return jsonObject; + } + + @Override + public void exportMonitorList(PmKpiCellMonitorQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getMonitorVoList(qo); + ExcelUtil util = new ExcelUtil<>(PmKpi15CellMonitorVO.class); + try { + util.exportExcel(response, data, "性能监控数据信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/SysNoticeServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/SysNoticeServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2a31b08d2cc537107a2aa03f43189aed122a33f0 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/SysNoticeServiceImpl.java @@ -0,0 +1,341 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.domain.YwNoticeBriefing; +import com.ruoyi.eastcom_yw.domain.dto.SysNoticeDTO; +import com.ruoyi.eastcom_yw.domain.qo.SysNoticeQO; +import com.ruoyi.eastcom_yw.domain.vo.SysNoticeVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeObjectVO; +import com.ruoyi.eastcom_yw.mapper.SysNoticeMapper; +import com.ruoyi.eastcom_yw.mapper.YwNoticeBriefingMapper; +import com.ruoyi.eastcom_yw.service.SysNoticeService; +import com.ruoyi.eastcom_yw.service.YwNoticeModelService; +import com.ruoyi.eastcom_yw.service.YwNoticeObjectService; +import com.ruoyi.eastcom_yw.service.convert.SysNoticeConvert; +import com.ruoyi.framework.web.domain.dto.MobileOfficesDTO; +import com.ruoyi.framework.web.service.sms.MessageService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 通知公告表 服务实现类 + *

+ * + * @author ck + * @since 2023-04-14 + */ +@Service +@Slf4j +public class SysNoticeServiceImpl extends ServiceImpl implements SysNoticeService { + + @Resource + private SysNoticeMapper sysNoticeMapper; + + @Resource + private YwNoticeModelService ywNoticeModelService; + + @Resource + private YwNoticeObjectService ywNoticeObjectService; + + @Resource + private YwNoticeBriefingMapper ywNoticeBriefingMapper; + + @Resource + private MessageService messageService; + + + /** + * 通知公告表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(SysNoticeQO qo) { + if(qo.getExpSendTime()!=null){ + LocalDateTime expSendTime = qo.getExpSendTime(); + qo.setBeginTime(LocalDateTimeUtil.beginOfDay(expSendTime)); + qo.setEndTime(LocalDateTimeUtil.endOfDay(expSendTime)); + } + qo.setPageNum(null); + qo.setPageSize(null); + List data = sysNoticeMapper.getData(qo); + for (SysNoticeVO vo : data) { + translate(vo); + } + return data; + } + + /** + * 通知公告表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(SysNoticeQO qo) { + + if (qo.getExpSendTime() != null) { + LocalDateTime begin = LocalDateTimeUtil.beginOfDay(qo.getExpSendTime()); + LocalDateTime end = LocalDateTimeUtil.endOfDay(qo.getExpSendTime()); + qo.setBeginTime(begin); + qo.setEndTime(end); + } + List vos = sysNoticeMapper.getData(qo); + //翻译场馆和用户名 + for (SysNoticeVO vo : vos) { + translate(vo); + Long userId = SecurityUtils.getUserId(); + vo.setCanUpdate("0"); + if (vo.getSendUser() != null && userId.equals(vo.getSendUser()) && "3".equals(vo.getModelSuitType()) && "2".equals(vo.getAddFlag())) { + if (vo.getHandworkId() != null) { + YwNoticeBriefing briefing = ywNoticeBriefingMapper.selectById(vo.getHandworkId()); + if (briefing != null) { + if ("0".equals(briefing.getSysNormalDisable())) { + vo.setCanUpdate("1"); + } + } + } + } + } + IPage voPage = new Page<>(); + voPage.setRecords(vos); + voPage.setTotal(PageInfo.of(vos).getTotal()); + return voPage; + } + + @Override + public SysNoticeVO fetchById(Long id) { + SysNotice entity = sysNoticeMapper.selectById(id); + SysNoticeVO vo = SysNoticeConvert.INSTANCE.entityToVo(entity); + translate(vo); + return vo; + } + + @Override + public boolean saveOrUpdate(SysNoticeDTO dto) { + SysNotice entity = SysNoticeConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(sysNoticeMapper.deleteBatchIds(ids)); + } + + @Override + public void export(SysNoticeQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + for (int i = 1; i < data.size() + 1; i++) { + SysNoticeVO sysNoticeVO = data.get(i - 1); + sysNoticeVO.setNoticeId(i); + } + ExcelUtil util = new ExcelUtil<>(SysNoticeVO.class); + try { + util.exportExcel(response, data, "通知记录"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } + + @Override + public int isReadNotice(Long[] noticeIds) { + return sysNoticeMapper.isReadNotice(noticeIds); + } + + /** + * 查询所有需要发送的短信 + */ + @Override + public List selectToDoSMSList() { + return sysNoticeMapper.selectToDoSMSList(); + } + + @Override + public void eastcomYwSendSMSSchedule() { + List sysNotices = this.selectToDoSMSList(); + for (SysNotice sysNotice : sysNotices) { + sysNotice.setAddFlag("1"); + this.updateById(sysNotice); + } + + for (SysNotice sysNotice : sysNotices) { + JSONObject res = null; + //实际发送短信 + res = messageService.sendSMS(sysNotice.getNoticeContent(), sysNotice.getReciveUserPhone()); + //保存发送结果 + sysNotice.setSendTime(LocalDateTime.now()); + if ("1".equals(res.getString("code"))) { + sysNotice.setSendStatus("1"); + } else { + sysNotice.setSendStatus("0"); + } + sysNotice.setRemark(res.getString("message")); + this.updateById(sysNotice); + } + } + + @Override + @Transactional + public void newEastcomYwSendSMSSchedule() { + List sysNotices = this.selectToDoSMSList(); + if(CollUtil.isEmpty(sysNotices)){ + return; + } + send(sysNotices); + } + + @Override + @Transactional + public void send(List sysNotices) { + for (SysNotice sysNotice : sysNotices) { + sysNotice.setAddFlag("1"); + this.updateById(sysNotice); + } + + for (SysNotice sysNotice : sysNotices) { + JSONObject res = null; + if ("3".equals(sysNotice.getNoticeType()) && ("1".equals(sysNotice.getModelSuitType()) || "2".equals(sysNotice.getModelSuitType()))) { + log.info("发送短信++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + res = messageService.sendSMS(sysNotice.getNoticeContent(), sysNotice.getReciveUserPhone()); + } else if ("5".equals(sysNotice.getNoticeType())) { + MobileOfficesDTO dto = new MobileOfficesDTO(); + dto.setMobileoffices(sysNotice.getGroupId()); + dto.setMobileoffice_user(null); + dto.setFile(null); + dto.setFilename(null); + dto.setImg(null); + dto.setImgname(null); + dto.setContent(sysNotice.getNoticeContent()); + res = messageService.sendMobileOffice(dto); + } else if ("7".equals(sysNotice.getNoticeType()) && ("1".equals(sysNotice.getModelSuitType()) || "2".equals(sysNotice.getModelSuitType()))) { + res = messageService.sendIvr(sysNotice.getNoticeContent(), sysNotice.getReciveUserPhone()); + } else { + log.info("发送短信++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + res = messageService.sendSMS(sysNotice.getNoticeContent(), sysNotice.getReciveUserPhone()); + } + + //保存发送结果 + sysNotice.setSendTime(LocalDateTime.now()); + if (res != null) { + if ("1".equals(res.getString("code"))) { + sysNotice.setSendStatus("1"); + } else { + sysNotice.setSendStatus("0"); + } + sysNotice.setRemark(res.getString("message")); + this.updateById(sysNotice); + } else { + sysNotice.setRemark("三方短信无反馈"); + log.error("三方短信无反馈"); + sysNotice.setSendStatus("0"); + this.updateById(sysNotice); + } + } + } + + + @Override + public void saveAndSendBriefing(SysNoticeDTO dto) { +// saveOrUpdate(dto); + SysNotice byId = getById(dto.getNoticeId()); + if (byId != null) { + if ("1".equals(byId.getAddFlag())) { + throw new ServiceException("手工简报已发送"); + } + if (byId.getHandworkId() != null) { + YwNoticeBriefing briefing = ywNoticeBriefingMapper.selectById(byId.getHandworkId()); + if (briefing == null) { + throw new ServiceException("简报计划不存在"); + } else { + if ("1".equals(briefing.getSysNormalDisable())) { + throw new ServiceException("简报计划已停用"); + } + } + } + byId.setNoticeContent(dto.getNoticeContent()); + byId.setNoticeContent(byId.getNoticeContent().replaceAll("<.*?>", "").replace("\n(在此输入其他性能数据)","").replace("(","").replace("(","").replace(")","").replace(")","").replaceAll("(\\s*)", "").replaceAll("\\(\\s*\\)", "")); + + ArrayList sysNotices = new ArrayList<>(); + + sysNotices.add(byId); + send(sysNotices); +// byId.setAddFlag("0"); +// byId.setExpSendTime(LocalDateTime.now()); +// sysNoticeMapper.updateById(byId); + } + } + + @Override + public List selectNoticeListByUser(Long reciveUserId) { + return sysNoticeMapper.selectNoticeListByUser(reciveUserId); + } + + private void translate(SysNoticeVO vo) { + YwNoticeModelVO modelVO = ywNoticeModelService.fetchById(vo.getNoticeModelId()); + vo.setNoticeModelIdStr(modelVO); + if (modelVO != null) { + vo.setNoticeModelName(modelVO.getModelName()); + } + + List objectIds = vo.getNoticeObjectId(); + if (CollUtil.isNotEmpty(objectIds)) { + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + vo.setNoticeObjectIdStr(objectVOS); + vo.setNoticeObject(objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(","))); + } + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/WeatherServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/WeatherServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..21978dcb78ef3f92f84dc5376d6213c7da98a692 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/WeatherServiceImpl.java @@ -0,0 +1,102 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.http.HttpUtil; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.service.WeatherService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.Iterator; + +@Service +@Slf4j +public class WeatherServiceImpl implements WeatherService { + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private YwSceneService ywSceneService; + + @Override + public AjaxResult fetchById(Long venueId) { + YwScene venue = ywSceneService.getById(venueId); + if (venue == null) { + throw new ServiceException("场馆不存在"); + } + String venueName = venue.getVenueName(); + String url = "https://szqx.hzqx.com/getUrl?cache=1&url=/hzcitybrain/homepage/GetAllStadiumInfo_v1"; + String response = HttpUtil.get(url); + JsonNode jsonNode = null; + try { + jsonNode = objectMapper.readTree(response); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + HashMap map = extractDataFromJson(jsonNode); + if (!map.containsKey(venueName)) { + throw new ServiceException("未取到匹配的场馆名:" + venueName); + } + String stationCode = map.get(venueName); + String queryTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + String queryUrl = "https://szqx.hzqx.com/getUrl?url=/hzcitybrain/zdz/complex/GetNearDataByStationCodeAndWeatherKeys_v3?" + + "dataRate=fiveminute%26stationCode="+stationCode+"%26weatherKeys=rain_sum_1h,airtemp_current,rh_current,wind_current,stapressure_current,vis_current,comfort_current" + + "%26queryTime="+queryTime+"%26isNeedStationInfo=false%26blackType=-1"; + String response1 = HttpUtil.get(queryUrl); + JsonNode dataNode = null; + try { + dataNode = objectMapper.readTree(response1); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + JsonNode rows1 = dataNode.withArray("Rows").get(0); + HashMap resMap = new HashMap<>(); + resMap.put("近一小时降水", rows1.get(4).asText()); + resMap.put("温度", rows1.get(6).asText()); + resMap.put("湿度", rows1.get(8).asText()); + resMap.put("风速", rows1.get(11).asText()); + resMap.put("气压", rows1.get(14).asText()); + resMap.put("能见度", rows1.get(16).asText()); + return AjaxResult.success(resMap); + } + + // 提取方法,解析JsonNode并返回HashMap + private HashMap extractDataFromJson(JsonNode jsonNode) { + Iterator rows = jsonNode.withArray("Rows").iterator(); + HashMap map = new HashMap<>(); + while (rows.hasNext()) { + JsonNode next = rows.next(); + map.put(next.get(1).asText(), next.get(23).asText()); + } + return map; + } + + public static void main(String[] args) { + String s = HttpUtil.get("https://szqx.hzqx.com/getUrl?cache=1&url=/hzcitybrain/homepage/GetAllStadiumInfo_v1"); + JsonNode jsonNode = null; + ObjectMapper objectMapper = new ObjectMapper(); + try { + jsonNode = objectMapper.readTree(s); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + Iterator rows = jsonNode.withArray("Rows").iterator(); + HashMap map = new HashMap<>(); + while (rows.hasNext()) { + JsonNode next = rows.next(); + map.put(next.get(23).asText(), next.get(1).asText()); + } + + + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmCSServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmCSServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..730259c5faaf841ccfb97a6c2fe9c8d1d33a8cca --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmCSServiceImpl.java @@ -0,0 +1,225 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.constant.AlarmConstants; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.constant.TaskConstants; +import com.ruoyi.common.core.domain.dto.StartProcessInstanceDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSearchDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmInfoVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmLastVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmNewNumVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmVo; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.mapper.YwAlarmCSMapper; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.YwAlarmCSService; +import com.ruoyi.eastcom_yw.service.YwAlarmOprateLogService; +import com.ruoyi.eastcom_yw.service.YwAlarmCSService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Service +public class YwAlarmCSServiceImpl extends ServiceImpl implements YwAlarmCSService { + + @Autowired + private YwAlarmCSMapper ywAlarmCSMapper; + + @Autowired + private YwAlarmViewMapper ywAlarmViewMapper; + + @Autowired + private YwAlarmOprateLogService ywAlarmOprateLogService; + + @Autowired + private CommonService commonService; + + @Override + public TableDataInfo GetAlarmList(YwAlarmDTO alarmDTO) { + + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + + //告警当前的处理状态 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getDealStatus()),YwAlarmView::getDealStatus, alarmDTO.getDealStatus()); + + //告警的状态 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmStatus())&&"0".equals(alarmDTO.getAlarmStatus()), YwAlarmView::getAlarmStatus, alarmDTO.getAlarmStatus()); + + //告警名称模糊查询 + lambdaQueryWrapper.like(StringUtils.isNotEmpty(alarmDTO.getAlarmName()),YwAlarmView::get告警名称, alarmDTO.getAlarmName()); + + //告警的区县 + //20230303区县改为AreaCountyId查询 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getCounty()), YwAlarmView::getAreaCountyId, alarmDTO.getCounty()); + + //告警的场馆 + lambdaQueryWrapper.in(CollUtil.isNotEmpty(alarmDTO.getVenues()), YwAlarmView::get场馆id, alarmDTO.getVenues()); + + //告警的类型 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmType()), YwAlarmView::getAlarmType, alarmDTO.getAlarmType()); + + //告警的专业 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmGroup()), YwAlarmView::getAlarmType, alarmDTO.getAlarmGroup()); + + //告警的专业 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getInRedLine()), YwAlarmView::get红线内, alarmDTO.getInRedLine()); + + //告警的时间 + lambdaQueryWrapper.between(ObjectUtils.isNotEmpty(alarmDTO.getStartTime()) && ObjectUtils.isNotEmpty(alarmDTO.getEndTime()), YwAlarmView::get告警时间, alarmDTO.getStartTime(), alarmDTO.getEndTime()+" 23:59:59"); + + //告警搜索框 + if(StrUtil.isNotBlank(alarmDTO.getSearchBox())){ + lambdaQueryWrapper.and(i->i.like(YwAlarmView::get告警名称,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::getDealUser,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get基站号,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get基站名,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get网元名称,alarmDTO.getSearchBox())); + } + + + Page page= ywAlarmCSMapper.selectPage(new Page<>(alarmDTO.getPageNum(), alarmDTO.getPageSize()),lambdaQueryWrapper); + + TableDataInfo rspData = new TableDataInfo(); + + rspData.setTotal(page.getTotal()); + + List listVo=new ArrayList<>(); + + for(YwAlarmView ywAlarmsLast: page.getRecords()) + { + + int clearNum=0; + + YwAlarmLastVo ywAlarmLastVo=new YwAlarmLastVo(); + + LambdaQueryWrapper lambdaQueryWrapperOper=new LambdaQueryWrapper<>(); + lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getAlarmGroup, ywAlarmsLast.get关联组号()); + lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getUserId,alarmDTO.getUserId()); + ywAlarmLastVo.setOpId(0L); + //查询告警用户是否点击 + ywAlarmOprateLogService.list(lambdaQueryWrapperOper).forEach( + ywAlarmOprateLog -> { + ywAlarmLastVo.setOpId(ywAlarmOprateLog.getId()); + } + ); + + ywAlarmLastVo.setKey(ywAlarmsLast.getId()); + if(ObjectUtils.isEmpty(ywAlarmsLast.get场馆id())) + { + continue; + } + ywAlarmLastVo.setVenue_id(ywAlarmsLast.get场馆id().toString()); + ywAlarmLastVo.setCg(ywAlarmsLast.get场馆名称()); + //工单号 +// ywAlarmLastVo.setGd(""); + ywAlarmLastVo.setSite_id(ywAlarmsLast.get基站号()); + ywAlarmLastVo.setSite_name(ywAlarmsLast.get基站名()); + ywAlarmLastVo.setNet_name(ywAlarmsLast.get网元名称()); + ywAlarmLastVo.setGroupId(ywAlarmsLast.get关联组号()); + ywAlarmLastVo.setName(ywAlarmsLast.get告警名称()); + ywAlarmLastVo.setStart(ywAlarmsLast.get告警时间()); + ywAlarmLastVo.setEnd(ywAlarmsLast.get恢复时间()); + if(StringUtils.isNotEmpty(ywAlarmsLast.get恢复时间())) + { + clearNum++; + } + ywAlarmLastVo.setInRedLine(ywAlarmsLast.get红线内()); + ywAlarmLastVo.setUserId(ywAlarmsLast.getDealUserId()); + ywAlarmLastVo.setPerson(ywAlarmsLast.getDealUser()); + //冗余state + ywAlarmLastVo.setState(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setAlarmStatus(ywAlarmsLast.getAlarmStatus()); + ywAlarmLastVo.setDealStatus(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setState(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setProcessId(ywAlarmsLast.getProcessId()); + ywAlarmLastVo.setTaskId(ywAlarmsLast.getTaskId()); + //20230308增加了反馈人的红蓝白区标签 + ywAlarmLastVo.setBelongArea(ywAlarmsLast.getBelongArea()); + //用户判断主告警和次告警是否全部恢复了,空表示没有,全部恢复显示最新的恢复时间 + ywAlarmLastVo.setLastClearTime(ywAlarmsLast.getLastClearTime()); + + ywAlarmLastVo.setIsHangup(ywAlarmsLast.getIsHangup()); + + //查询次要告警 + List ywAlarmListLess = ywAlarmViewMapper.getYwAlarmByGroupId(ywAlarmsLast.getAlarmType(),ywAlarmsLast.get关联组号()); + //当前告警总数 + int alarmNum = ywAlarmListLess.size()+1; + + List ywAlarmVoList=new ArrayList(); + if(ywAlarmListLess.size()>0) + { + for(YwAlarmVo ywAlarmLess: ywAlarmListLess) + { + +// 设计问题导致前端用了Net_name和Site_name + YwAlarmVo ywAlarmVo = new YwAlarmVo(); + + BeanUtils.copyBeanProp(ywAlarmVo,ywAlarmLess); + + ywAlarmVo.setNet_name(ywAlarmLess.getNetName()); + + ywAlarmVo.setSite_name(ywAlarmLess.getSiteName()); + + if(StringUtils.isNotEmpty(ywAlarmLess.getEnd())) + { + clearNum++; + } + + ywAlarmVoList.add(ywAlarmVo); + + } + } + ywAlarmLastVo.setAlarmchildren(ywAlarmVoList); + ywAlarmLastVo.setClearNum(clearNum); + ywAlarmLastVo.setClearNumDisplay(clearNum+"/"+alarmNum); + + // //查询工作流,比较是否是当前登录用户的待办 + //APP端 + if(alarmDTO.getIsAPP()) { + List processIds = commonService.selectCurrenUserTodoProcessId(alarmDTO.getAlarmType()); + if (CollUtil.isNotEmpty(processIds)) { + for (String processId : processIds) { + if (processId.equals(ywAlarmLastVo.getProcessId())) { + ywAlarmLastVo.setIsTodo(1); + } + } + } + } + + listVo.add(ywAlarmLastVo); + } + + rspData.setRows(listVo); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + return rspData; + + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmDHServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmDHServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d8034c1d6c730a30d3e231d5fc8e573250967f19 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmDHServiceImpl.java @@ -0,0 +1,216 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.YwAlarmDH; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmLastVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmVo; +import com.ruoyi.eastcom_yw.mapper.YwAlarmDHMapper; +import com.ruoyi.eastcom_yw.mapper.YwAlarmDHMapper; +import com.ruoyi.eastcom_yw.mapper.YwAlarmMapper; +import com.ruoyi.eastcom_yw.mapper.YwAlarmViewMapper; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.YwAlarmDHService; +import com.ruoyi.eastcom_yw.service.YwAlarmDHService; +import com.ruoyi.eastcom_yw.service.YwAlarmOprateLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Service +public class YwAlarmDHServiceImpl extends ServiceImpl implements YwAlarmDHService { + + @Autowired + private YwAlarmDHMapper ywAlarmDHMapper; + @Autowired + private YwAlarmViewMapper ywAlarmViewMapper; + @Autowired + private YwAlarmOprateLogService ywAlarmOprateLogService; + + @Autowired + private CommonService commonService; + + @Override + public TableDataInfo GetAlarmList(YwAlarmDTO alarmDTO) { + + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + + //告警当前的处理状态 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getDealStatus()),YwAlarmView::getDealStatus, alarmDTO.getDealStatus()); + + //告警的状态 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmStatus())&&"0".equals(alarmDTO.getAlarmStatus()), YwAlarmView::getAlarmStatus, alarmDTO.getAlarmStatus()); + + //告警名称模糊查询 + lambdaQueryWrapper.like(StringUtils.isNotEmpty(alarmDTO.getAlarmName()),YwAlarmView::get告警名称, alarmDTO.getAlarmName()); + + //告警的区县 + //20230303区县改为AreaCountyId查询 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getCounty()), YwAlarmView::getAreaCountyId, alarmDTO.getCounty()); + + //告警的场馆 + lambdaQueryWrapper.in(CollUtil.isNotEmpty(alarmDTO.getVenues()), YwAlarmView::get场馆id, alarmDTO.getVenues()); + + //告警的类型 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmType()), YwAlarmView::getAlarmType, alarmDTO.getAlarmType()); + + //告警的专业 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmGroup()), YwAlarmView::getAlarmType, alarmDTO.getAlarmGroup()); + + //告警的专业 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getInRedLine()), YwAlarmView::get红线内, alarmDTO.getInRedLine()); + + //告警的时间 + lambdaQueryWrapper.between(ObjectUtils.isNotEmpty(alarmDTO.getStartTime()) && ObjectUtils.isNotEmpty(alarmDTO.getEndTime()), YwAlarmView::get告警时间, alarmDTO.getStartTime(), alarmDTO.getEndTime()+" 23:59:59"); + + //告警搜索框 + if(StrUtil.isNotBlank(alarmDTO.getSearchBox())){ + lambdaQueryWrapper.and(i->i.like(YwAlarmView::get告警名称,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::getDealUser,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get基站号,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get基站名,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get网元名称,alarmDTO.getSearchBox())); + } + + + Page page= ywAlarmDHMapper.selectPage(new Page<>(alarmDTO.getPageNum(), alarmDTO.getPageSize()),lambdaQueryWrapper); + + TableDataInfo rspData = new TableDataInfo(); + + rspData.setTotal(page.getTotal()); + + List listVo=new ArrayList<>(); + + for(YwAlarmView ywAlarmsLast: page.getRecords()) + { + + int clearNum=0; + + YwAlarmLastVo ywAlarmLastVo=new YwAlarmLastVo(); + + LambdaQueryWrapper lambdaQueryWrapperOper=new LambdaQueryWrapper<>(); + lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getAlarmGroup, ywAlarmsLast.get关联组号()); + lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getUserId,alarmDTO.getUserId()); + ywAlarmLastVo.setOpId(0L); + //查询告警用户是否点击 + ywAlarmOprateLogService.list(lambdaQueryWrapperOper).forEach( + ywAlarmOprateLog -> { + ywAlarmLastVo.setOpId(ywAlarmOprateLog.getId()); + } + ); + + ywAlarmLastVo.setKey(ywAlarmsLast.getId()); + if(ObjectUtils.isEmpty(ywAlarmsLast.get场馆id())) + { + continue; + } + ywAlarmLastVo.setVenue_id(ywAlarmsLast.get场馆id().toString()); + ywAlarmLastVo.setCg(ywAlarmsLast.get场馆名称()); + //工单号 +// ywAlarmLastVo.setGd(""); + ywAlarmLastVo.setSite_id(ywAlarmsLast.get基站号()); + ywAlarmLastVo.setSite_name(ywAlarmsLast.get基站名()); + ywAlarmLastVo.setNet_name(ywAlarmsLast.get网元名称()); + ywAlarmLastVo.setGroupId(ywAlarmsLast.get关联组号()); + ywAlarmLastVo.setName(ywAlarmsLast.get告警名称()); + ywAlarmLastVo.setStart(ywAlarmsLast.get告警时间()); + ywAlarmLastVo.setEnd(ywAlarmsLast.get恢复时间()); + if(StringUtils.isNotEmpty(ywAlarmsLast.get恢复时间())) + { + clearNum++; + } + ywAlarmLastVo.setInRedLine(ywAlarmsLast.get红线内()); + ywAlarmLastVo.setUserId(ywAlarmsLast.getDealUserId()); + ywAlarmLastVo.setPerson(ywAlarmsLast.getDealUser()); + //冗余state + ywAlarmLastVo.setState(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setAlarmStatus(ywAlarmsLast.getAlarmStatus()); + ywAlarmLastVo.setDealStatus(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setState(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setProcessId(ywAlarmsLast.getProcessId()); + ywAlarmLastVo.setTaskId(ywAlarmsLast.getTaskId()); + //20230308增加了反馈人的红蓝白区标签 + ywAlarmLastVo.setBelongArea(ywAlarmsLast.getBelongArea()); + //用户判断主告警和次告警是否全部恢复了,空表示没有,全部恢复显示最新的恢复时间 + ywAlarmLastVo.setLastClearTime(ywAlarmsLast.getLastClearTime()); + + ywAlarmLastVo.setIsHangup(ywAlarmsLast.getIsHangup()); + + //查询次要告警 + List ywAlarmListLess = ywAlarmViewMapper.getYwAlarmByGroupId(ywAlarmsLast.getAlarmType(),ywAlarmsLast.get关联组号()); + //当前告警总数 + int alarmNum = ywAlarmListLess.size()+1; + + List ywAlarmVoList=new ArrayList(); + if(ywAlarmListLess.size()>0) + { + for(YwAlarmVo ywAlarmLess: ywAlarmListLess) + { + +// 设计问题导致前端用了Net_name和Site_name + YwAlarmVo ywAlarmVo = new YwAlarmVo(); + + BeanUtils.copyBeanProp(ywAlarmVo,ywAlarmLess); + + ywAlarmVo.setNet_name(ywAlarmLess.getNetName()); + + ywAlarmVo.setSite_name(ywAlarmLess.getSiteName()); + + if(StringUtils.isNotEmpty(ywAlarmLess.getEnd())) + { + clearNum++; + } + + ywAlarmVoList.add(ywAlarmVo); + + } + } + ywAlarmLastVo.setAlarmchildren(ywAlarmVoList); + ywAlarmLastVo.setClearNum(clearNum); + ywAlarmLastVo.setClearNumDisplay(clearNum+"/"+alarmNum); + + // //查询工作流,比较是否是当前登录用户的待办 + //APP端 + if(alarmDTO.getIsAPP()) { + List processIds = commonService.selectCurrenUserTodoProcessId(alarmDTO.getAlarmType()); + if (CollUtil.isNotEmpty(processIds)) { + for (String processId : processIds) { + if (processId.equals(ywAlarmLastVo.getProcessId())) { + ywAlarmLastVo.setIsTodo(1); + } + } + } + } + + listVo.add(ywAlarmLastVo); + } + + rspData.setRows(listVo); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + return rspData; + + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmHangupLogServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmHangupLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5bf997f55d52c31102fae43bbb0a0769816b3b4a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmHangupLogServiceImpl.java @@ -0,0 +1,161 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.common.constant.AlarmConstants; +import com.ruoyi.common.core.domain.dto.HandleDataDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.YwAlarmHangupLog; +import com.ruoyi.eastcom_yw.domain.YwAlarmHangupReover; +import com.ruoyi.eastcom_yw.domain.YwAlarmView; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmHangupLogDTO; +import com.ruoyi.eastcom_yw.domain.yw_alarm_deal_log; +import com.ruoyi.eastcom_yw.mapper.YwAlarmHangupLogMapper; +import com.ruoyi.eastcom_yw.mapper.yw_alarm_deal_logMapper; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.YwAlarmHangupLogService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-02-15 + */ +@Service +public class YwAlarmHangupLogServiceImpl extends ServiceImpl implements YwAlarmHangupLogService { + + @Autowired + private YwAlarmHangupLogMapper ywAlarmHangupLogMapper; + + + @Autowired + private yw_alarm_deal_logMapper yw_alarm_deal_logMapper; + + + @Autowired + private CommonService commonService; + + @Transactional(rollbackFor = Exception.class) + @Override + public boolean insertYwAlarmHangupLog(YwAlarmHangupLogDTO ywAlarmHangupLogDTO) { + + if(StringUtils.isEmpty(ywAlarmHangupLogDTO.getFlwProcessid())) + { + throw new ServiceException("挂起的流程号不允许为空"); + } + + Date hangupEnd = DateUtils.parseDate(ywAlarmHangupLogDTO.getHangupTime()); + + YwAlarmHangupLog ywAlarmHangupLog=new YwAlarmHangupLog(); + ywAlarmHangupLog.setHangupUserId(ywAlarmHangupLogDTO.getHangupUserId()); + ywAlarmHangupLog.setHangupTime(hangupEnd); + ywAlarmHangupLog.setHangupReason(ywAlarmHangupLogDTO.getHangupReason()); + ywAlarmHangupLog.setFlwProcessid(ywAlarmHangupLogDTO.getFlwProcessid()); + ywAlarmHangupLog.setFlwTaskid(ywAlarmHangupLogDTO.getFlwTaskid()); + ywAlarmHangupLog.setHangupStatus(ywAlarmHangupLogDTO.getHangupStatus()); + + //如果是取消挂起,需要计算这次挂起的时长累加到deal_log表 + if("0".equals(ywAlarmHangupLogDTO.getHangupStatus())) + { + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("hangup_status","2"); + queryWrapper.eq("flw_processid",ywAlarmHangupLogDTO.getFlwProcessid()); + queryWrapper.eq("flw_taskid",ywAlarmHangupLogDTO.getFlwTaskid()); + queryWrapper.orderByDesc("hangup_time"); + YwAlarmHangupLog hangupLog = ywAlarmHangupLogMapper.selectList(queryWrapper).get(0); + Date hangupBegin =hangupLog.getHangupTime(); + + //这里用的是分钟,不满一分钟按一分钟算 + double durMinute = Math.ceil((double) ((DateUtils.getNowDate().getTime() - hangupBegin.getTime()) / (1000*60))); + + if(yw_alarm_deal_logMapper.updateHangupSpantime(durMinute,ywAlarmHangupLogDTO.getFlwProcessid())==0) + { + throw new ServiceException("取消挂起失败,挂起时长更新出错,请联系管理员"); + } + } + if(StringUtils.isNotEmpty(ywAlarmHangupLogDTO.getRecoveryTime())) + { + ywAlarmHangupLog.setRecoveryTime(DateUtils.parseDate(ywAlarmHangupLogDTO.getRecoveryTime())); + } + if(ywAlarmHangupLogMapper.insert(ywAlarmHangupLog)>0) + { + return true; + } + if("2".equals(ywAlarmHangupLogDTO.getHangupStatus())) { + throw new ServiceException("挂起失败,请联系管理员"); + } + if("0".equals(ywAlarmHangupLogDTO.getHangupStatus())) { + throw new ServiceException("取消挂起失败,请联系管理员"); + } + return false; + } + + @Override + @Deprecated + public void updateAlarmHangupSchedule() { + + List list = ywAlarmHangupLogMapper.getYwAlarmHangupReoverList(); + + for (YwAlarmHangupReover ywAlarmHangupReover : list) + { + try { + + boolean res=false; + + + HandleDataDTO handleDataDTO = new HandleDataDTO(); + UserInfo user = new UserInfo(); + user.setId(ywAlarmHangupReover.getHangupUserId().toString()); + handleDataDTO.setProcessInstanceId(ywAlarmHangupReover.getFlwProcessid()); + handleDataDTO.setTaskId(ywAlarmHangupReover.getFlwTaskid()); + handleDataDTO.setCurrentUserInfo(user); + //这2个在agreeTask没有用 + handleDataDTO.setTransferUserInfo(user); + handleDataDTO.setTransferType(1); + + //0表示告警没有全部恢复,需要退回重新处理,1表示告警全部恢复了,这个告警就不用处理,自动完结 + if (AlarmConstants.NoRecover.equals(ywAlarmHangupReover.getIsRecover())) { + + res = commonService.UpdateProcessStatus(handleDataDTO); + + } + + if (AlarmConstants.Recover.equals(ywAlarmHangupReover.getIsRecover())) { + + res = commonService.agreeTask(handleDataDTO); + } + + if(res) + { + //回填挂起记录表的恢复结果 + YwAlarmHangupLog ywAlarmHangupLog=new YwAlarmHangupLog(); + ywAlarmHangupLog.setId(ywAlarmHangupReover.getId()); + ywAlarmHangupLog.setRecoveryResult(ywAlarmHangupReover.getIsRecover()); + ywAlarmHangupLogMapper.updateById(ywAlarmHangupLog); + + } + + } + catch (Exception e) { + System.out.println(e.getMessage()); + continue; + } + } + + } + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmOprateLogServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmOprateLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e4abe276434035d9dd696c4bbc9bf2d1bb5cb0f6 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmOprateLogServiceImpl.java @@ -0,0 +1,20 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.ruoyi.eastcom_yw.domain.YwAlarmOprateLog; +import com.ruoyi.eastcom_yw.mapper.YwAlarmOprateLogMapper; +import com.ruoyi.eastcom_yw.service.YwAlarmOprateLogService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-03-06 + */ +@Service +public class YwAlarmOprateLogServiceImpl extends ServiceImpl implements YwAlarmOprateLogService { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c9d42a8e496f174b3be2304cc853b2bd007fa6a9 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmServiceImpl.java @@ -0,0 +1,402 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ArrayUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.dto.HandleDataDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.common.constant.AlarmConstants; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmInfoVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmQuestionVo; +import com.ruoyi.eastcom_yw.domain.vo.YwErrorAlarmVO; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.SysNoticeService; +import com.ruoyi.eastcom_yw.service.YwAlarmService; +import com.ruoyi.eastcom_yw.service.YwAlarmViewService; +import com.ruoyi.framework.web.domain.dto.MobileOfficesDTO; +import com.ruoyi.framework.web.service.sms.MessageService; +import com.ruoyi.system.mapper.SysDictDataMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Service +@Slf4j +public class YwAlarmServiceImpl extends ServiceImpl implements YwAlarmService { + + + @Autowired + private YwAlarmMapper ywAlarmMapper; + + @Autowired + private YwAlarmViewMapper ywAlarmViewMapper; + + @Autowired + private CommonService commonService; + + @Autowired + private YwNoticeModelMapper ywNoticeModelMapper; + + @Autowired + private YwSceneMapper ywSceneMapper; + + @Autowired + private YwNoticeObjectMapper ywNoticeObjectMapper; + + @Autowired + private SysDictDataMapper sysDictDataMapper; + + @Resource + private MessageService messageService; + + @Resource + private SysNoticeService sysNoticeService; + + @Resource + private ThreadPoolTaskExecutor threadPool; + + @Resource + private YwAlarmViewService ywAlarmViewService; + + + @Override + public List getYwAlarmQuestionList(String specialty) { + return ywAlarmMapper.getYwAlarmQuestionList(specialty); + } + + @Override + public void YwAlarmAutoRecover() { + + List list = ywAlarmMapper.selectYwAlarmCouldRecover(); + HandleDataDTO handleDataDTO = new HandleDataDTO(); + UserInfo user = new UserInfo(); +// 恢复人的ID,比如某个用户叫自动恢复 + user.setId("2"); + handleDataDTO.setCurrentUserInfo(user); + for (YwAlarmRecover recover : list) { + handleDataDTO.setProcessInstanceId(recover.getFlwProcessid()); + handleDataDTO.setTaskId(recover.getFlwTaskid()); + + List infoList = ywAlarmViewMapper.getYwAlarmInfoList(recover.getFlwProcessid()); + + if (infoList.isEmpty()) { + continue; + } + + JSONObject json = new JSONObject(); + json.put("input_cleartime", recover.getLastClearTime()); + json.put("input_user", "自动恢复"); + + if (StringUtils.isNotEmpty(infoList.get(0).getAlarmContent())) { + json.put("textarea_gjxx", infoList.get(0).getAlarmContent().replace("##", "\r\n")); + } + + + handleDataDTO.setFormData(json); + handleDataDTO.setOldFromData("need"); + try { + boolean res = commonService.agreeTask(handleDataDTO); + if(res) + { + YwAlarmDTO alarmDTO =new YwAlarmDTO(); + alarmDTO.setAlarmId(recover.getAlarmId()); + alarmDTO.setAlarmType(recover.getAlarmType()); + //更新源数据的状态为关闭,后面相同场馆的groupid另起一个新的 + ywAlarmMapper.updateOriginAlarmClose(alarmDTO); + } + } catch (Exception ex) { + log.error(ex.getMessage()); + break; + } + } + + } + + @Override + @Transactional + public boolean YwAlarmClear(YwAlarmDTO alarmDTO) { + if (StringUtils.isNotEmpty(alarmDTO.getAlarmType())) { + if ("tel".equals(alarmDTO.getAlarmType())) { + alarmDTO.setAlarmType("voip"); + } + + if (ArrayUtil.contains(AlarmConstants.ALARMS, alarmDTO.getAlarmType())) { + + boolean isOk = false; + + if (StringUtils.isNotEmpty(alarmDTO.getProcessId())) { + + if (ObjectUtils.isNotEmpty(alarmDTO.getGroupId())) { + if (alarmDTO.getGroupId() > 0) { + isOk = true; + } + } + + if(isOk) { + HandleDataDTO dto = new HandleDataDTO(); + UserInfo user = new UserInfo(); + user.setId(SecurityUtils.getUserId().toString()); + user.setName(SecurityUtils.getLoginUser().getNickName()); + dto.setTaskName("alarm"); + dto.setCurrentUserInfo(user); + dto.setProcessInstanceId(alarmDTO.getProcessId()); + try { + boolean res = commonService.revokeTask(dto); + if (res) { + int num = ywAlarmMapper.updateAlarmClearByGroupId(alarmDTO); + if(num>0) { + ywAlarmViewService.updateAlarmLogEnd(alarmDTO.getAlarmType(), alarmDTO.getGroupId(),SecurityUtils.getUserId()); + } + ywAlarmMapper.updateOriginAlarmClose(alarmDTO); + } +// else { +// throw new ServiceException("闭环失败"); +// return true; +// } + return true; + } catch (Exception e) { + throw new ServiceException(e.getMessage()); + } + } + + } else { + + if (ObjectUtils.isNotEmpty(alarmDTO.getAlarmId())&&alarmDTO.getAlarmId() > 0) { + + isOk = true; + + } + + if(isOk) { + + if(ObjectUtils.isNotEmpty(alarmDTO.getGroupId()) && alarmDTO.getGroupId() > 0) + { + if(alarmDTO.getGroupId().equals(alarmDTO.getAlarmId())) { + int num = ywAlarmMapper.updateAlarmClearByGroupId(alarmDTO); + if (num > 0) { + ywAlarmViewService.updateAlarmLogEnd(alarmDTO.getAlarmType(), alarmDTO.getGroupId(),SecurityUtils.getUserId()); + } + ywAlarmMapper.updateOriginAlarmClose(alarmDTO); + } + else + { + ywAlarmMapper.updateAlarmClearByAlarmId(alarmDTO); + } + } + else + { + ywAlarmMapper.updateAlarmClearByAlarmId(alarmDTO); + } + return true; + + } + } + throw new ServiceException("参数缺失,告警未处理"); + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + @Override + public boolean YwAlarmClose(YwAlarmDTO alarmDTO) { + if (StringUtils.isNotEmpty(alarmDTO.getAlarmType())) { + if ("tel".equals(alarmDTO.getAlarmType())) { + alarmDTO.setAlarmType("voip"); + } + if (ArrayUtil.contains(AlarmConstants.ALARMS, alarmDTO.getAlarmType())) { + int res = ywAlarmMapper.updateOriginAlarmClose(alarmDTO); + if(res>0) + { + return true; + } + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + @Override + public void eastcomYwSendAlarmBriefingSchedule() { + long startTime = System.currentTimeMillis(); + //查询所有未恢复告警 + List vos = ywAlarmMapper.selectAllAlarmWithError(); + if (CollUtil.isEmpty(vos)) { + log.info("没有需要发送的告警"); + } + //查询模板 + YwNoticeModel model = ywNoticeModelMapper.selectById(22); + if (model == null) { + throw new ServiceException("告警简报模板未配置"); + } + //查询需要发送的对象 + List venueNames = vos.stream().map(YwErrorAlarmVO::get场馆名称).collect(Collectors.toList()); + List objects = ywNoticeObjectMapper.selectObjectsByVenueName(venueNames); + if (CollUtil.isEmpty(objects)) { + throw new ServiceException("对象未配置"); + } + Map> objectMap = objects.stream().collect(Collectors.groupingBy(YwNoticeObject::getVenueName)); + //当前时间 + LocalDateTime now = LocalDateTime.now(); + String time = now.format(DateTimeFormatter.ofPattern("MM月dd日HH时")); + //告警专业 + List yw_alarm_specialty = sysDictDataMapper.selectDictDataByType("yw_alarm_specialty"); + //统计 + Map> map = vos.stream().collect(Collectors.groupingBy(YwErrorAlarmVO::get场馆名称)); + Set keys = map.keySet(); + + // 使用线程池中线程分批处理业务逻辑,并行处理任务提高终端响应速度 + CountDownLatch latch = new CountDownLatch(keys.size()); + for (String key : keys) { + threadPool.submit(() -> { + try { + extracted(model, objectMap, time, yw_alarm_specialty, map, key); + } catch (Exception e) { + log.error("调用下游系统出现错误,异常逻辑处理......"); + } finally { + // 业务逻辑处理完毕,计数器减一【当前线程处理任务完毕,线程释放进入线程池,等待处理下一个任务】 + latch.countDown(); + } + }); + } + try { + latch.await(); + } catch (Exception e) { + log.error("等待超时", e); + throw new RuntimeException("系统处理超时,请稍后再试"); + } +// threadPool.shutdown(); + long endTime = System.currentTimeMillis(); + long executionTime = endTime - startTime; + System.out.println("发送告警简报执行时间:" + executionTime + " 毫秒"); + } + + private void extracted(YwNoticeModel model, Map> objectMap, String time, List yw_alarm_specialty, Map> map, String key) { + System.out.println(Thread.currentThread().getName() + "开始执行"); + List list = map.get(key); + if (CollUtil.isEmpty(list)) { + return; + } + String venueName = list.get(0).get场馆名称(); + + String allNum = String.valueOf(list.size()); + + String modelContent = model.getModelContent(); + for (SysDictData sysDictData : yw_alarm_specialty) { + String num = String.valueOf(list.stream().filter(l -> sysDictData.getDictValue().equals(l.get类型())).count()); + //8.17 名称去重 + String name = list.stream().filter(l -> sysDictData.getDictValue().equals(l.get类型())).map(YwErrorAlarmVO::get名称).distinct().collect(Collectors.joining(",\n")); + modelContent = modelContent.replace("${" + sysDictData.getDictValue() + "Num}", num).replace("${" + sysDictData.getDictValue() + "Name}", name); + } + String content = modelContent.replace("${时间}", time).replace("${场馆名}", venueName).replace("${总告警数}", allNum); + + log.info(venueName+"告警简报原内容"+content); + String regex = "(?m)^(.*共计0条.*)*$\r\n"; // 正则表达式匹配0条的行,并包括换行符 + String res = content.replaceAll(regex, ""); + log.info(venueName+"告警简报去除0条后最终发送内容"+res); + + List objectList = objectMap.get(venueName); + if (CollUtil.isEmpty(objectList)) { + log.error(venueName + "场馆未配置发送对象"); + return; + } + boolean flag = true; + StringBuilder code = new StringBuilder(); + StringBuilder message = new StringBuilder(); + for (YwNoticeObject object : objectList) { + + MobileOfficesDTO dto = new MobileOfficesDTO(); + dto.setMobileoffices(object.getGroupId()); + dto.setMobileoffice_user(null); + dto.setFile(null); + dto.setFilename(null); + dto.setImg(null); + dto.setImgname(null); + dto.setContent(res); + + JSONObject jsonObject = null; + try { + log.info(object.getVenueName() + ":开始发送移动办公告警简报"); + jsonObject = messageService.sendMobileOffice(dto); + } catch (Exception e) { + log.error(object.getVenueName() + ":发送移动办公失败"); + } + //sys_notice新增已发送记录 + if (jsonObject == null) { + flag = false; + log.error(object.getVenueName() + ":三方移动办公无反馈"); + } else { + log.info("code:" + jsonObject.getString("code") + ",message:" + jsonObject.getString("message")); + message.append(jsonObject.getString("message")).append(","); + } + + } + List objectIds = objectList.stream().map(YwNoticeObject::getId).collect(Collectors.toList()); + String objectNames = objectList.stream().map(YwNoticeObject::getObjectName).collect(Collectors.joining(",")); + String groupId = objectList.stream().map(YwNoticeObject::getGroupId).collect(Collectors.joining(",")); + SysNotice sysNotice = new SysNotice(); + sysNotice.setNoticeContent(content); + sysNotice.setStatus("0"); + sysNotice.setCreateBy("sys"); + sysNotice.setCreateTime(LocalDateTime.now()); + sysNotice.setUpdateBy("sys"); + sysNotice.setUpdateTime(LocalDateTime.now()); + sysNotice.setReciveUser(null); + sysNotice.setFlwProcessid(null); + sysNotice.setFlwTaskid(null); + sysNotice.setReciveUserPhone(null); + sysNotice.setExpSendTime(LocalDateTime.now()); + sysNotice.setNoticeObjectId(objectIds); + sysNotice.setNoticeModelId(model.getId()); + sysNotice.setModelScene("17"); + sysNotice.setObjectProto("0"); + sysNotice.setModelSuitType("3"); + sysNotice.setHandworkId(null); + sysNotice.setGroupId(groupId); + sysNotice.setNoticeType("5"); + sysNotice.setNoticeObject(venueName + ":" + groupId); + sysNotice.setNoticeContent(res); + sysNotice.setAddFlag("1"); + sysNotice.setSendTime(LocalDateTime.now()); + if (flag) { + sysNotice.setRemark(message.toString()); + sysNotice.setSendStatus("1"); + } else { + sysNotice.setRemark("三方移动办公无反馈"); + sysNotice.setSendStatus("0"); + } + + sysNotice.setNoticeObjectNameStr(objectNames); + sysNotice.setNoticeTitle(venueName + "告警简报"); + sysNoticeService.save(sysNotice); + System.out.println(Thread.currentThread().getName() + "结束执行"); + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmViewServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmViewServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fd3f70b4132a78419b27536b374afb69413ac0dc --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmViewServiceImpl.java @@ -0,0 +1,819 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.constant.AlarmConstants; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.constant.TaskConstants; +import com.ruoyi.common.core.domain.dto.StartProcessInstanceDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.*; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTONoPage; +import com.ruoyi.eastcom_yw.domain.dto.YwSearchDTO; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.*; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.poifs.crypt.dsig.services.TimeStampService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Service +@Slf4j +public class YwAlarmViewServiceImpl extends ServiceImpl implements YwAlarmViewService { + + @Autowired + private YwAlarmViewMapper ywAlarmViewMapper; + + @Autowired + private YwAlarmMapper ywAlarmMapper; + + @Autowired + private yw_alarm_deal_logMapper alarm_deal_logMapper; + + @Autowired + private CommonService commonService; + + @Autowired + private YwAlarmOprateLogService ywAlarmOprateLogService; + + @Autowired + private YwNoticeUserService ywNoticeUserService; + + @Override + public void insert_alarm_schedule() { + + List list = ywAlarmViewMapper.getYwHandleList(); + + if(list.size()>0) { + + + //需要通过template_id从钉钉的workspace/process/detail取ProcessDefinitionId + //查询告警处理的工作流模板ID + String template_id = ""; + try { + template_id = ywAlarmViewMapper.getTemplateId(TaskConstants.ALARM); + } catch (Exception e) { + log.error(e.getMessage()); + return; + } + + if (StringUtils.isEmpty(template_id)) + { + //todo:有空需要让异常入数据库,方便查询 + log.error("没有找到告警工作流template_id"); + return; + } + + + String processDefinitionId = ""; + try { + processDefinitionId = commonService.GetProcessDefinitionId(template_id); + } catch (Exception e) { + log.error(e.getMessage()); + return; + } + + if (StringUtils.isEmpty(processDefinitionId)) + { + log.error("没有正确的工作流processDefinitionId"); + return; + } + + + UserInfo user = new UserInfo(); + user.setId("2"); + user.setName("系统"); + user.setType("user"); + user.setSex("1"); + user.setSelected(true); + + for (YwAlarmView alarm_handle : list) { + + //从数据库取下内容 + List alarmContent = ywAlarmViewMapper.selectAlarmContent(alarm_handle.get关联组号()); + if(alarmContent.isEmpty()) + { + continue; + } + + //保存数据到yw_alarm_deal_log + yw_alarm_deal_log alarm_deal = new yw_alarm_deal_log(); + alarm_deal.setAlarmCode(alarm_handle.get告警编号()); + alarm_deal.setAlarmType(alarm_handle.getAlarmType()); + alarm_deal.setGroupColnum(alarm_handle.get关联组号()); + alarm_deal.setGroupId(Long.parseLong(alarm_handle.get关联组号())); + alarm_deal.setBeginTime(DateUtils.getNowDate()); + alarm_deal.setPrimaryId(alarm_handle.getId()); + alarm_deal.setIsRed(alarm_handle.get红线内()); + alarm_deal.setSceneId(alarm_handle.get场馆id()); + alarm_deal.setAlarmTime(DateUtils.parseDate(alarm_handle.get告警时间())); + alarm_deal.setSiteType(alarm_handle.get类型()); + //定时器更新endTime,暂时先不用 +// if(StringUtils.isNotEmpty(alarm_handle.get恢复时间())) { +// alarm_deal.setEndTime(DateUtils.parseDate(alarm_handle.get恢复时间())); +// } + if (StringUtils.isNotEmpty(alarm_handle.get红线内())) { + //20230303只有在红线内的告警才需要生成工作流 + if (AlarmConstants.RedInLine.equals(alarm_handle.get红线内())) { + YwSearchDTO ywSearchDTO = new YwSearchDTO(); + ywSearchDTO.setArea_county_id(alarm_handle.getAreaCountyId()); + ywSearchDTO.setVenue_id(alarm_handle.get场馆id().toString()); + ywSearchDTO.setVenue_name(alarm_handle.get场馆名称()); + ywSearchDTO.setCity(alarm_handle.getCity()); + ywSearchDTO.setCounty(alarm_handle.getCounty()); + ywSearchDTO.setTask_type(TaskConstants.ALARM); + ywSearchDTO.setAlarm_name(alarm_handle.get告警名称()); + ywSearchDTO.setNet_name(alarm_handle.get网元名称()); + ywSearchDTO.setSite_name(alarm_handle.get基站名()); + + //20230303工作流增加任务名称 + ywSearchDTO.setTask_name(alarm_handle.get基站号() + " " + alarm_handle.get告警名称()); + //20230307工作流增加专业 + ywSearchDTO.setSpecialty(alarm_handle.get告警类型()); + + StartProcessInstanceDTO startDTO = new StartProcessInstanceDTO(); + startDTO.setStartUserInfo(user); + startDTO.setProcessDefinitionId(processDefinitionId); + + JSONObject json = new JSONObject(); + + String groupId = ""; + + //20230327 agis和其它的工作流都指派到专网zw的专业下 + + + + if("agis".equals(alarm_handle.getAlarmType())||"wifi".equals(alarm_handle.getAlarmType())||"voip".equals(alarm_handle.getAlarmType())) + { + alarm_handle.setAlarmType("zw"); +// alarm_handle.set告警类型("专网"); + } + + groupId = MessageFormat.format("{0}|{1}|gz", alarm_handle.get场馆id().toString().replace(",",""), alarm_handle.getAlarmType()); + + json.put("input_cg_zy_id", groupId); + json.put("input_gjbh", alarm_handle.get关联组号()); + json.put("input_zyfl", alarm_handle.get告警类型()); + + +// json.put("textarea_gjxx", MessageFormat.format("----------杭州奥体中心游泳馆----------##告警网元:{0},告警名称:{1},告警时间:{2}", alarm_handle.get网元名称(), alarm_handle.get告警名称(), alarm_handle.get告警时间())); + json.put("textarea_gjxx", alarmContent.get(0).replace("##","\r\n")); + json.put("textarea_gzyy", ""); + json.put("pictureupload_sczp", null); + //20230217 增加查询条件 + json.put("input_search", JSONObject.toJSONString(ywSearchDTO)); + + startDTO.setFormData(json); + try { + String res_flwprocessid = commonService.StartProcess(startDTO); + if (StringUtils.isNotEmpty(res_flwprocessid)) { + alarm_deal.setFlwProcessid(res_flwprocessid); + + alarm_deal_logMapper.insert(alarm_deal); + + //20230510告警太多,加了新的逻辑,5分钟后如果没有全部恢复就发 +// boolean res = ywNoticeUserService.noticeYW(res_flwprocessid,groupId,TaskConstants.ALARM); +// if(!res) +// { +// log.error("告警工作流已生成,提醒没有发送成功"); +// } + + } + } catch (Exception e) { + log.error(e.getMessage()); + break; + } + } + + if (AlarmConstants.RedOutLine.equals(alarm_handle.get红线内())) { + //非红线内的直接进入记录表,用于查看 + try { + alarm_deal_logMapper.insert(alarm_deal); + } catch (Exception e) { + log.error(e.getMessage()); + break; + } + } + } + + if (StringUtils.isEmpty(alarm_handle.get红线内())) { + //非红线内的直接进入记录表,用于查看 + try { + alarm_deal_logMapper.insert(alarm_deal); + } catch (Exception e) { + log.error(e.getMessage()); + break; + } + } + + + } + + } + + } + + @Override + public void insert_alarmNotice_schedule() { + List list = ywAlarmMapper.selectYwAlarmCouldNotice(); + for (YwAlarmNoticeVo alarmNotice : list) { + ywNoticeUserService.noticeYW(alarmNotice.getProcessId(),alarmNotice.getGroupId(),TaskConstants.ALARM); + } + } + + @Override + public TableDataInfo GetAlarmList(YwAlarmDTO alarmDTO) { + + //特殊要求,传2时代表dealStatus为2,与alarmStatus无关 + if("2".equals(alarmDTO.getAlarmStatus())){ + alarmDTO.setDealStatus("2"); + alarmDTO.setAlarmStatus(""); + } + + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + + //告警当前的处理状态 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getDealStatus()),YwAlarmView::getDealStatus, alarmDTO.getDealStatus()); + + //告警的状态 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmStatus())&&"0".equals(alarmDTO.getAlarmStatus()), YwAlarmView::getAlarmStatus, alarmDTO.getAlarmStatus()); + + //告警名称模糊查询 + lambdaQueryWrapper.like(StringUtils.isNotEmpty(alarmDTO.getAlarmName()),YwAlarmView::get告警名称, alarmDTO.getAlarmName()); + + //告警的区县 + //20230303区县改为AreaCountyId查询 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getCounty()), YwAlarmView::getAreaCountyId, alarmDTO.getCounty()); + + //告警的场馆 + lambdaQueryWrapper.in(CollUtil.isNotEmpty(alarmDTO.getVenues()), YwAlarmView::get场馆id, alarmDTO.getVenues()); + + //告警的类型 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmType()), YwAlarmView::getAlarmType, alarmDTO.getAlarmType()); + + //告警的专业 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmGroup()), YwAlarmView::getAlarmType, alarmDTO.getAlarmGroup()); + + //告警是否红线内 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getInRedLine()), YwAlarmView::get红线内, alarmDTO.getInRedLine()); + + //告警的时间 + lambdaQueryWrapper.between(ObjectUtils.isNotEmpty(alarmDTO.getStartTime()) && ObjectUtils.isNotEmpty(alarmDTO.getEndTime()), YwAlarmView::get告警时间, alarmDTO.getStartTime(), alarmDTO.getEndTime()+" 23:59:59"); + + //告警搜索框 + if(StrUtil.isNotBlank(alarmDTO.getSearchBox())){ + lambdaQueryWrapper.and(i->i.like(YwAlarmView::get告警名称,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::getDealUser,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get基站号,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get基站名,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get网元名称,alarmDTO.getSearchBox())); + } + + + Page page= ywAlarmViewMapper.selectPage(new Page<>(alarmDTO.getPageNum(), alarmDTO.getPageSize()),lambdaQueryWrapper); + + TableDataInfo rspData = new TableDataInfo(); + + rspData.setTotal(page.getTotal()); + + List listVo=new ArrayList<>(); + + for(YwAlarmView ywAlarmsLast: page.getRecords()) + { + + int clearNum=0; + + YwAlarmLastVo ywAlarmLastVo=new YwAlarmLastVo(); + + LambdaQueryWrapper lambdaQueryWrapperOper=new LambdaQueryWrapper<>(); + lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getAlarmGroup, ywAlarmsLast.get关联组号()); + lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getUserId,alarmDTO.getUserId()); + ywAlarmLastVo.setOpId(0L); + //查询告警用户是否点击 + ywAlarmOprateLogService.list(lambdaQueryWrapperOper).forEach( + ywAlarmOprateLog -> { + ywAlarmLastVo.setOpId(ywAlarmOprateLog.getId()); + } + ); + + ywAlarmLastVo.setKey(ywAlarmsLast.getId()); + if(ObjectUtils.isEmpty(ywAlarmsLast.get场馆id())) + { + continue; + } + ywAlarmLastVo.setVenue_id(ywAlarmsLast.get场馆id().toString()); + ywAlarmLastVo.setCg(ywAlarmsLast.get场馆名称()); + //工单号 +// ywAlarmLastVo.setGd(""); + ywAlarmLastVo.setSite_id(ywAlarmsLast.get基站号()); + ywAlarmLastVo.setSite_name(ywAlarmsLast.get基站名()); + ywAlarmLastVo.setNet_name(ywAlarmsLast.get网元名称()); + ywAlarmLastVo.setGroupId(ywAlarmsLast.get关联组号()); + ywAlarmLastVo.setName(ywAlarmsLast.get告警名称()); + ywAlarmLastVo.setStart(ywAlarmsLast.get告警时间()); +// ywAlarmLastVo.setEnd(ywAlarmsLast.get恢复时间()); +//告警:主告警记录中恢复时间是呈现该组告警最后一条恢复子告警的恢复时间,在子告警中恢复时间是呈现该条告警的恢复时间 + Date newDate = DateUtils.parseDate(ywAlarmsLast.get恢复时间()); + if(StringUtils.isNotEmpty(ywAlarmsLast.get恢复时间())) + { + clearNum++; + } + ywAlarmLastVo.setInRedLine(ywAlarmsLast.get红线内()); + ywAlarmLastVo.setUserId(ywAlarmsLast.getDealUserId()); + ywAlarmLastVo.setPerson(ywAlarmsLast.getDealUser()); + //冗余state + ywAlarmLastVo.setState(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setAlarmStatus(ywAlarmsLast.getAlarmStatus()); + ywAlarmLastVo.setDealStatus(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setState(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setProcessId(ywAlarmsLast.getProcessId()); + ywAlarmLastVo.setTaskId(ywAlarmsLast.getTaskId()); + //20230308增加了反馈人的红蓝白区标签 + ywAlarmLastVo.setBelongArea(ywAlarmsLast.getBelongArea()); + //用户判断主告警和次告警是否全部恢复了,空表示没有,全部恢复显示最新的恢复时间 + ywAlarmLastVo.setLastClearTime(ywAlarmsLast.getLastClearTime()); + + ywAlarmLastVo.setIsHangup(ywAlarmsLast.getIsHangup()); + + //查询次要告警 + List ywAlarmListLess = ywAlarmViewMapper.getYwAlarmByGroupId(ywAlarmsLast.getAlarmType(),ywAlarmsLast.get关联组号()); + //当前告警总数 + int alarmNum = ywAlarmListLess.size()+1; + + List ywAlarmVoList=new ArrayList(); + if(ywAlarmListLess.size()>0) + { + for(YwAlarmVo ywAlarmLess: ywAlarmListLess) + { + +// 设计问题导致前端用了Net_name和Site_name + ywAlarmLess.setNet_name(ywAlarmLess.getNetName()); + + ywAlarmLess.setSite_name(ywAlarmLess.getSiteName()); + + if(StringUtils.isNotEmpty(ywAlarmLess.getEnd())) + { + clearNum++; + } + + Date lessEnd = DateUtils.parseDate(ywAlarmLess.getEnd()); + + if(lessEnd.after(newDate)) + { + newDate.setTime(lessEnd.getTime()); + } + + ywAlarmVoList.add(ywAlarmLess); + + } + } + + if(alarmNum == clearNum) + { + + } + + ywAlarmLastVo.setAlarmchildren(ywAlarmVoList); + ywAlarmLastVo.setClearNum(clearNum); + ywAlarmLastVo.setClearNumDisplay(clearNum+"/"+alarmNum); + + // //查询工作流,比较是否是当前登录用户的待办 + //APP端 + if(alarmDTO.getIsAPP()) { + List processIds = commonService.selectCurrenUserTodoProcessId(alarmDTO.getAlarmType()); + if (CollUtil.isNotEmpty(processIds)) { + for (String processId : processIds) { + if (processId.equals(ywAlarmLastVo.getProcessId())) { + ywAlarmLastVo.setIsTodo(1); + } + } + } + } + + + listVo.add(ywAlarmLastVo); + } + + rspData.setRows(listVo); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + return rspData; + + } + + + + @Override + public List GetNewAlarmNum(Long userId) { + return ywAlarmViewMapper.getYwAlarmNewNum(userId,false); + } + + @Override + public List GetNewAlarmNum(Long userId,Boolean isAdmin) { + return ywAlarmViewMapper.getYwAlarmNewNum(userId,isAdmin); + } + + @Override + public Long getYwAlarmNewNumByDto(YwAlarmDTO alarmDTO) { + + //传1为全量告警,显示全部告警,所以不用设置AlarmStatus的值 + if("1".equals(alarmDTO.getAlarmStatus())){ + alarmDTO.setAlarmStatus(""); + } + + if(alarmDTO.getIsAPP()) { + //特殊要求,传2时代表dealStatus为2,与alarmStatus无关 + if ("2".equals(alarmDTO.getAlarmStatus())) { + alarmDTO.setDealStatus("2"); + alarmDTO.setAlarmStatus(""); + } + } + return ywAlarmViewMapper.getYwAlarmNewNumByDto(alarmDTO); + } + + @Override + public Long getYwAlarmNewNumByDto(YwAlarmDTONoPage alarmDTO) { + + //传1为全量告警,显示全部告警,所以不用设置AlarmStatus的值 + if("1".equals(alarmDTO.getAlarmStatus())){ + alarmDTO.setAlarmStatus(""); + } + + if(alarmDTO.getIsAPP()) { + //特殊要求,传2时代表dealStatus为2,与alarmStatus无关 + if ("2".equals(alarmDTO.getAlarmStatus())) { + alarmDTO.setDealStatus("2"); + alarmDTO.setAlarmStatus(""); + } + } + return ywAlarmViewMapper.getYwAlarmNewNumByDto2(alarmDTO); + } + + @Override + public List getYwAlarmByDto(YwAlarmDTO alarmDTO) { + //传1为全量告警,显示全部告警,所以不用设置AlarmStatus的值 + if("1".equals(alarmDTO.getAlarmStatus())){ + alarmDTO.setAlarmStatus(""); + } + //APP特殊要求,传2时代表dealStatus为2,与alarmStatus无关 + if("2".equals(alarmDTO.getAlarmStatus())){ + alarmDTO.setDealStatus("2"); + alarmDTO.setAlarmStatus(""); + } + + List lstAlarmlasts = ywAlarmViewMapper.getYwAlarmByDto(alarmDTO); + + List processIds = new ArrayList<>(); + +// if(lstAlarmlasts.size()>0&&alarmDTO.getIsAPP()) { +// processIds = commonService.selectCurrenUserTodoProcessId(alarmDTO.getAlarmType()); +// } + + long [] groupIds = lstAlarmlasts.stream().map(YwAlarmViewVo::getGroupId).mapToLong(num -> Long.parseLong(num)).toArray(); + + List ywAlarmListLesses = null; + + List ywAlarmOprateLogList = null; + + if(groupIds.length > 0) + { + ywAlarmListLesses = ywAlarmViewMapper.getYwAlarmByGroupIds(alarmDTO.getAlarmType(),groupIds); + + //查询告警用户是否点击 + LambdaQueryWrapper lambdaQueryWrapperOper = new LambdaQueryWrapper<>(); + lambdaQueryWrapperOper.in(YwAlarmOprateLog::getAlarmGroup, lstAlarmlasts.stream().map(YwAlarmViewVo::getGroupId).toArray()); + lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getUserId, alarmDTO.getUserId()); + ywAlarmOprateLogList = ywAlarmOprateLogService.list(lambdaQueryWrapperOper); + } + + for(YwAlarmViewVo ywAlarmsLast: lstAlarmlasts) + { + int clearNum=0; + + String last_clear_time = ""; + + //主告警ID就是关联组号 + ywAlarmsLast.setKey(ywAlarmsLast.getGroupId()); + + ywAlarmsLast.setVenue_id(ywAlarmsLast.getVenueId().toString()); + + ywAlarmsLast.setSite_id(ywAlarmsLast.getSiteId()); + + ywAlarmsLast.setSite_name(ywAlarmsLast.getSiteName()); + + ywAlarmsLast.setNet_name(ywAlarmsLast.getNetName()); + + if(!alarmDTO.getIsExport()) { + //查询告警用户是否点击 +// LambdaQueryWrapper lambdaQueryWrapperOper = new LambdaQueryWrapper<>(); +// lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getAlarmGroup, ywAlarmsLast.getGroupId()); +// lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getUserId, alarmDTO.getUserId()); + ywAlarmsLast.setOpId(0L); + if(ywAlarmOprateLogList!=null) + { + List ywAlarmOperateLog = ywAlarmOprateLogList.stream().filter(x->x.getAlarmGroup().equals(ywAlarmsLast.getGroupId())).collect(Collectors.toList()); + //设置是否点击 +// ywAlarmOprateLogService.list(lambdaQueryWrapperOper).forEach( +// ywAlarmOprateLog -> { +// ywAlarmsLast.setOpId(ywAlarmOprateLog.getId()); +// } +// ); + + if(!ywAlarmOperateLog.isEmpty()) + { + ywAlarmsLast.setOpId(ywAlarmOperateLog.get(0).getId()); + } + } + } + + //查询次要告警 +// List ywAlarmListLess = ywAlarmViewMapper.getYwAlarmByGroupId(ywAlarmsLast.getAlarmType(),ywAlarmsLast.getGroupId()); + List ywAlarmListLess = ywAlarmListLesses.stream().filter(x->x.getGroupId().equals(ywAlarmsLast.getGroupId())).collect(Collectors.toList()); + + if(ObjectUtils.isEmpty(ywAlarmListLess)) + { + ywAlarmListLess = ywAlarmViewMapper.getYwAlarmByGroupId(ywAlarmsLast.getAlarmType(),ywAlarmsLast.getGroupId()); + } + + //当前告警总数 + int alarmNum = ywAlarmListLess.size(); + + if(ywAlarmListLess.size()>0) + { + for(YwAlarmVo ywAlarmLess: ywAlarmListLess) + { + +// 设计问题导致前端用了Net_name和Site_name + ywAlarmLess.setNet_name(ywAlarmLess.getNetName()); + + ywAlarmLess.setSite_name(ywAlarmLess.getSiteName()); + + ywAlarmLess.setInRedLine(ywAlarmsLast.getInRedLine()); + +// 设置最早的告警时间 + if(ywAlarmLess.getGroupId().equals(ywAlarmLess.getAlarmId().toString())) + { + //主告警的告警等级从子告警的主告警上取 + // ywAlarmsLast.setAlarmLevel(ywAlarmLess.getAlarmLevel()); + ywAlarmsLast.setStart(ywAlarmLess.getStart()); + } + + if(StringUtils.isNotEmpty(ywAlarmLess.getEnd())) + { + clearNum++; + + if(last_clear_time.isEmpty()) { + + last_clear_time=ywAlarmLess.getEnd(); + + } + + if(!last_clear_time.isEmpty()) + { + Date dateLast = DateUtils.parseDate(last_clear_time); + Date dateCompare = DateUtils.parseDate(ywAlarmLess.getEnd()); + if(dateCompare.after(dateLast)) + { + last_clear_time = ywAlarmLess.getEnd(); + } + } + } + } + } + + //APP端不需要子告警的列表,但是需要子告警的数量 + if(!alarmDTO.getIsAPP()) { + + ywAlarmsLast.setAlarmchildren(ywAlarmListLess); + + } + + //查询工作流,比较是否是当前登录用户的待办 + //APP端 +// if(alarmDTO.getIsAPP()) { +// if (CollUtil.isNotEmpty(processIds)) { +// for (String processId : processIds) { +// if (processId.equals(ywAlarmsLast.getProcessId())) { +// ywAlarmsLast.setIsTodo(1); +// } +// } +// } +// } + ywAlarmsLast.setAlarmKey(ywAlarmsLast.getGroupId()+"|"+ywAlarmsLast.getProcessId()+"|0"); + ywAlarmsLast.setEnd(null); + //必须是全部恢复了才给最后的恢复时间 + if(clearNum == alarmNum) + { + ywAlarmsLast.setLastClearTime(last_clear_time); + ywAlarmsLast.setEnd(last_clear_time); + ywAlarmsLast.setAlarmKey(ywAlarmsLast.getGroupId()+"|"+ywAlarmsLast.getProcessId()+"|1"); + } + + ywAlarmsLast.setClearNum(clearNum); + ywAlarmsLast.setClearNumDisplay(clearNum+"/"+alarmNum); + } + + return lstAlarmlasts; + } + + @Override + public List GetAlarmInfoList(String processId) { + + List list = ywAlarmViewMapper.getYwAlarmInfoList(processId); + return handleAlarmInfo(list); + + } + + @Override + public List getYwAlarmInfoListByGroup(String groupId) { + List list = ywAlarmViewMapper.getYwAlarmInfoListByGroup(groupId); + return handleAlarmInfo(list); + } + + @Override + public List GetAlarmInfoList(String processId, boolean isApp) { + List list = ywAlarmViewMapper.getYwAlarmInfoList(processId); + return handleAlarmInfo(list,isApp); + } + + @Override + public List getYwAlarmInfoListByGroup(String groupId, boolean isApp) { + List list = ywAlarmViewMapper.getYwAlarmInfoListByGroup(groupId); + return handleAlarmInfo(list,isApp); + } + + @Override + public List getYwAlarmList(String alarmType, String venueName, String startTime, String endTime) { + if(StringUtils.isEmpty(alarmType)) + { + throw new ServiceException("告警类型不为空"); + } + if(StringUtils.isEmpty(venueName)) + { + throw new ServiceException("场馆不为空"); + } + if(StringUtils.isEmpty(startTime)) + { + throw new ServiceException("告警开始时间不为空"); + } + if(StringUtils.isEmpty(endTime)) + { + throw new ServiceException("告警结束时间不为空"); + } + return ywAlarmViewMapper.getYwAlarmAll(alarmType,venueName,startTime,endTime); + } + + @Override + public List getYwAlarmLessList(String alarmType, String groupId) { + return ywAlarmViewMapper.getYwAlarmByGroupId(alarmType,groupId); + } + + private List handleAlarmInfo(List list) + { + list.forEach( + + ywAlarmInfoVo -> { + + +// LambdaQueryWrapper lambdaQueryWrapper2=new LambdaQueryWrapper<>(); +// +// lambdaQueryWrapper2.ne(YwAlarm::getId, ywAlarmInfoVo.getPrimaryId()); +// +// lambdaQueryWrapper2.eq(YwAlarm::get关联组号,ywAlarmInfoVo.getGroupId()); +// +// //202030315 修复了不同告警类型ID可能重复的BUG,需要多关联告警类型 +// //info的alarmType变成了value +// lambdaQueryWrapper2.eq(YwAlarm::getAlarmType,ywAlarmInfoVo.getAlarmType()); +// +// YwAlarm mainAlarm = ywAlarmMapper.selectOne(new LambdaQueryWrapper().eq(YwAlarm::getId, ywAlarmInfoVo.getPrimaryId()).eq(YwAlarm::getAlarmType,ywAlarmInfoVo.getAlarmType())); + + //20230327 + //根据不同告警类型查询不同的告警表的数据,效率上会快些 + YwAlarmVo mainAlarm = ywAlarmViewMapper.getYwAlarmLastByGroupId(ywAlarmInfoVo.getAlarmType(),ywAlarmInfoVo.getGroupId()); + + if(mainAlarm!=null){ + ywAlarmInfoVo.setCg(mainAlarm.getCg()); + ywAlarmInfoVo.setNet_name(mainAlarm.getNetName()); + ywAlarmInfoVo.setSite_name(mainAlarm.getSiteName()); + ywAlarmInfoVo.setName(mainAlarm.getName()); + ywAlarmInfoVo.setStart(mainAlarm.getStart()); + ywAlarmInfoVo.setEnd(mainAlarm.getEnd()); + ywAlarmInfoVo.setSiteType(mainAlarm.getSiteType()); + } + + //20230320 + //查询次要告警 + List ywAlarmListLess = ywAlarmViewMapper.getYwAlarmByGroupId(ywAlarmInfoVo.getAlarmType(),ywAlarmInfoVo.getGroupId()); + String alarmZWType = DictUtils.getDictLabel("yw_alarm_specialty",ywAlarmInfoVo.getAlarmType()); + ywAlarmInfoVo.setAlarmTypeCode(ywAlarmInfoVo.getAlarmType()); + ywAlarmInfoVo.setAlarmType(alarmZWType); + ywAlarmInfoVo.setAlarmchildren(ywAlarmListLess); + + //老的获取子告警的方法 +// if(ywAlarmMapper.selectList(lambdaQueryWrapper2).size()>0) +// { +// List ywAlarmVoList=new ArrayList(); +// +// ywAlarmMapper.selectList(lambdaQueryWrapper2).forEach( +// ywAlarm -> { +// YwAlarmVo ywAlarmVo=new YwAlarmVo(); +// ywAlarmVo.setCg(ywAlarm.get场馆名称()); +// ywAlarmVo.setSite_id(ywAlarm.get基站号()); +// ywAlarmVo.setNet_name(ywAlarm.get网元名称()); +// ywAlarmVo.setSite_name(ywAlarm.get基站名()); +// ywAlarmVo.setName(ywAlarm.get告警名称()); +// ywAlarmVo.setStart(ywAlarm.get告警时间()); +// ywAlarmVo.setEnd(ywAlarm.get恢复时间()); +// ywAlarmVoList.add(ywAlarmVo); +// } +// ); +// +// ywAlarmInfoVo.setAlarmchildren(ywAlarmVoList); +// +// } + + } + ); + + return list; + } + + private List handleAlarmInfo(List list,boolean isApp) + { + list.forEach( + + ywAlarmInfoVo -> { + + //20230327 + //根据不同告警类型查询不同的告警表的数据,效率上会快些 + YwAlarmVo mainAlarm = ywAlarmViewMapper.getYwAlarmLastByGroupId(ywAlarmInfoVo.getAlarmType(),ywAlarmInfoVo.getGroupId()); + + if(mainAlarm!=null){ + ywAlarmInfoVo.setCg(mainAlarm.getCg()); + ywAlarmInfoVo.setNet_name(mainAlarm.getNetName()); + ywAlarmInfoVo.setSite_name(mainAlarm.getSiteName()); + ywAlarmInfoVo.setName(mainAlarm.getName()); + ywAlarmInfoVo.setStart(mainAlarm.getStart()); + ywAlarmInfoVo.setEnd(mainAlarm.getEnd()); + ywAlarmInfoVo.setSiteType(mainAlarm.getSiteType()); + } + + if(isApp) { + //20230320 + //查询次要告警 + List ywAlarmListLess = ywAlarmViewMapper.getYwAlarmByGroupId(ywAlarmInfoVo.getAlarmType(), ywAlarmInfoVo.getGroupId()); + String alarmZWType = DictUtils.getDictLabel("yw_alarm_specialty", ywAlarmInfoVo.getAlarmType()); + ywAlarmInfoVo.setAlarmType(alarmZWType); + ywAlarmInfoVo.setAlarmchildren(ywAlarmListLess); + } + + } + ); + + return list; + } + + @Override + public void updateAlarmLogEnd(String alarmType,Long group_id,Long userId) + { + //更新告警记录的恢复时间 + yw_alarm_deal_log alarm_deal = new yw_alarm_deal_log(); + alarm_deal.setEndTime(DateUtils.parseDate(DateUtils.getTime())); + alarm_deal.setDealUser(userId.toString()); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("alarm_type", alarmType); + updateWrapper.eq("group_id", group_id); + alarm_deal_logMapper.update(alarm_deal,updateWrapper); + + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmWXServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmWXServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7afab1c05eef9c89d9f5a5921c607867532043c5 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwAlarmWXServiceImpl.java @@ -0,0 +1,216 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.YwAlarmWX; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmLastVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmVo; +import com.ruoyi.eastcom_yw.mapper.YwAlarmViewMapper; +import com.ruoyi.eastcom_yw.mapper.YwAlarmWXMapper; +import com.ruoyi.eastcom_yw.mapper.YwAlarmMapper; +import com.ruoyi.eastcom_yw.mapper.YwAlarmWXMapper; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.YwAlarmWXService; +import com.ruoyi.eastcom_yw.service.YwAlarmOprateLogService; +import com.ruoyi.eastcom_yw.service.YwAlarmWXService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Service +public class YwAlarmWXServiceImpl extends ServiceImpl implements YwAlarmWXService { + + @Autowired + private YwAlarmWXMapper ywAlarmWXMapper; + + @Autowired + private YwAlarmViewMapper ywAlarmViewMapper; + @Autowired + private YwAlarmOprateLogService ywAlarmOprateLogService; + + @Autowired + private CommonService commonService; + + @Override + public TableDataInfo GetAlarmList(YwAlarmDTO alarmDTO) { + + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + + //告警当前的处理状态 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getDealStatus()),YwAlarmView::getDealStatus, alarmDTO.getDealStatus()); + + //告警的状态 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmStatus())&&"0".equals(alarmDTO.getAlarmStatus()), YwAlarmView::getAlarmStatus, alarmDTO.getAlarmStatus()); + + //告警名称模糊查询 + lambdaQueryWrapper.like(StringUtils.isNotEmpty(alarmDTO.getAlarmName()),YwAlarmView::get告警名称, alarmDTO.getAlarmName()); + + //告警的区县 + //20230303区县改为AreaCountyId查询 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getCounty()), YwAlarmView::getAreaCountyId, alarmDTO.getCounty()); + + //告警的场馆 + lambdaQueryWrapper.in(CollUtil.isNotEmpty(alarmDTO.getVenues()), YwAlarmView::get场馆id, alarmDTO.getVenues()); + + //告警的类型 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmType()), YwAlarmView::getAlarmType, alarmDTO.getAlarmType()); + + //告警的专业 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getAlarmGroup()), YwAlarmView::getAlarmType, alarmDTO.getAlarmGroup()); + + //告警的专业 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(alarmDTO.getInRedLine()), YwAlarmView::get红线内, alarmDTO.getInRedLine()); + + //告警的时间 + lambdaQueryWrapper.between(ObjectUtils.isNotEmpty(alarmDTO.getStartTime()) && ObjectUtils.isNotEmpty(alarmDTO.getEndTime()), YwAlarmView::get告警时间, alarmDTO.getStartTime(), alarmDTO.getEndTime()+" 23:59:59"); + + //告警搜索框 + if(StrUtil.isNotBlank(alarmDTO.getSearchBox())){ + lambdaQueryWrapper.and(i->i.like(YwAlarmView::get告警名称,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::getDealUser,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get基站号,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get基站名,alarmDTO.getSearchBox()) + .or().like(YwAlarmView::get网元名称,alarmDTO.getSearchBox())); + } + + + Page page= ywAlarmWXMapper.selectPage(new Page<>(alarmDTO.getPageNum(), alarmDTO.getPageSize()),lambdaQueryWrapper); + + TableDataInfo rspData = new TableDataInfo(); + + rspData.setTotal(page.getTotal()); + + List listVo=new ArrayList<>(); + + for(YwAlarmView ywAlarmsLast: page.getRecords()) + { + + int clearNum=0; + + YwAlarmLastVo ywAlarmLastVo=new YwAlarmLastVo(); + + LambdaQueryWrapper lambdaQueryWrapperOper=new LambdaQueryWrapper<>(); + lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getAlarmGroup, ywAlarmsLast.get关联组号()); + lambdaQueryWrapperOper.eq(YwAlarmOprateLog::getUserId,alarmDTO.getUserId()); + ywAlarmLastVo.setOpId(0L); + //查询告警用户是否点击 + ywAlarmOprateLogService.list(lambdaQueryWrapperOper).forEach( + ywAlarmOprateLog -> { + ywAlarmLastVo.setOpId(ywAlarmOprateLog.getId()); + } + ); + + ywAlarmLastVo.setKey(ywAlarmsLast.getId()); + if(ObjectUtils.isEmpty(ywAlarmsLast.get场馆id())) + { + continue; + } + ywAlarmLastVo.setVenue_id(ywAlarmsLast.get场馆id().toString()); + ywAlarmLastVo.setCg(ywAlarmsLast.get场馆名称()); + //工单号 +// ywAlarmLastVo.setGd(""); + ywAlarmLastVo.setSite_id(ywAlarmsLast.get基站号()); + ywAlarmLastVo.setSite_name(ywAlarmsLast.get基站名()); + ywAlarmLastVo.setNet_name(ywAlarmsLast.get网元名称()); + ywAlarmLastVo.setGroupId(ywAlarmsLast.get关联组号()); + ywAlarmLastVo.setName(ywAlarmsLast.get告警名称()); + ywAlarmLastVo.setStart(ywAlarmsLast.get告警时间()); + ywAlarmLastVo.setEnd(ywAlarmsLast.get恢复时间()); + if(StringUtils.isNotEmpty(ywAlarmsLast.get恢复时间())) + { + clearNum++; + } + ywAlarmLastVo.setInRedLine(ywAlarmsLast.get红线内()); + ywAlarmLastVo.setUserId(ywAlarmsLast.getDealUserId()); + ywAlarmLastVo.setPerson(ywAlarmsLast.getDealUser()); + //冗余state + ywAlarmLastVo.setState(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setAlarmStatus(ywAlarmsLast.getAlarmStatus()); + ywAlarmLastVo.setDealStatus(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setState(ywAlarmsLast.getDealStatus()); + ywAlarmLastVo.setProcessId(ywAlarmsLast.getProcessId()); + ywAlarmLastVo.setTaskId(ywAlarmsLast.getTaskId()); + //20230308增加了反馈人的红蓝白区标签 + ywAlarmLastVo.setBelongArea(ywAlarmsLast.getBelongArea()); + //用户判断主告警和次告警是否全部恢复了,空表示没有,全部恢复显示最新的恢复时间 + ywAlarmLastVo.setLastClearTime(ywAlarmsLast.getLastClearTime()); + + ywAlarmLastVo.setIsHangup(ywAlarmsLast.getIsHangup()); + + //查询次要告警 + List ywAlarmListLess = ywAlarmViewMapper.getYwAlarmByGroupId(ywAlarmsLast.getAlarmType(),ywAlarmsLast.get关联组号()); + //当前告警总数 + int alarmNum = ywAlarmListLess.size()+1; + + List ywAlarmVoList=new ArrayList(); + if(ywAlarmListLess.size()>0) + { + for(YwAlarmVo ywAlarmLess: ywAlarmListLess) + { + +// 设计问题导致前端用了Net_name和Site_name + YwAlarmVo ywAlarmVo = new YwAlarmVo(); + + BeanUtils.copyBeanProp(ywAlarmVo,ywAlarmLess); + + ywAlarmVo.setNet_name(ywAlarmLess.getNetName()); + + ywAlarmVo.setSite_name(ywAlarmLess.getSiteName()); + + if(StringUtils.isNotEmpty(ywAlarmLess.getEnd())) + { + clearNum++; + } + + ywAlarmVoList.add(ywAlarmVo); + + } + } + ywAlarmLastVo.setAlarmchildren(ywAlarmVoList); + ywAlarmLastVo.setClearNum(clearNum); + ywAlarmLastVo.setClearNumDisplay(clearNum+"/"+alarmNum); + + // //查询工作流,比较是否是当前登录用户的待办 + //APP端 + if(alarmDTO.getIsAPP()) { + List processIds = commonService.selectCurrenUserTodoProcessId(alarmDTO.getAlarmType()); + if (CollUtil.isNotEmpty(processIds)) { + for (String processId : processIds) { + if (processId.equals(ywAlarmLastVo.getProcessId())) { + ywAlarmLastVo.setIsTodo(1); + } + } + } + } + + listVo.add(ywAlarmLastVo); + } + + rspData.setRows(listVo); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + return rspData; + + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwDrsConfigServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwDrsConfigServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c47f638b5c8ae6f0683ac6eee6ecd9f51349071c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwDrsConfigServiceImpl.java @@ -0,0 +1,119 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwDrsConfig; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwDrsConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsConfigVO; +import com.ruoyi.eastcom_yw.mapper.YwDrsConfigMapper; +import com.ruoyi.eastcom_yw.service.YwDrsConfigService; +import com.ruoyi.eastcom_yw.service.convert.YwDrsConfigConvert; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + *

+ * DRS配置表 服务实现类 + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Service +public class YwDrsConfigServiceImpl extends ServiceImpl implements YwDrsConfigService { + + @Resource + private YwDrsConfigMapper ywDrsConfigMapper; + + /** + * DRS配置表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwDrsConfigQO qo) { + return ywDrsConfigMapper.list(qo); + } + + /** + * DRS配置表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public PageInfo getDataByPage(YwDrsConfigQO qo) { + PageHelper.startPage(qo.getPageNum(),qo.getPageSize()); + List list = getData(qo); + return PageInfo.of(list); + } + + @Override + public YwDrsConfigVO fetchById(Long id) { + YwDrsConfig entity = ywDrsConfigMapper.selectById(id); + return YwDrsConfigConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(YwDrsConfigDTO dto) { + YwDrsConfig entity = YwDrsConfigConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywDrsConfigMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwDrsConfigQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(YwDrsConfigVO.class); + try { + util.exportExcel(response, data, "DRS配置表信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwDrsTempTaskServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwDrsTempTaskServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d9cf4ead3ca01a1f52c70d0029b030067405ccee --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwDrsTempTaskServiceImpl.java @@ -0,0 +1,410 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsTempTaskDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsTempTaskTimeDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwDrsTempTaskQO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsTempTaskVO; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.YwDrsTempTaskService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.convert.YwDrsTempTaskConvert; +import com.ruoyi.system.mapper.SysUserRoleMapper; +import com.ruoyi.system.service.ISysDictDataService; +import com.ruoyi.system.service.ISysDictTypeService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * DRS临时任务表 服务实现类 + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Service +public class YwDrsTempTaskServiceImpl extends ServiceImpl implements YwDrsTempTaskService { + + @Resource + private YwDrsTempTaskMapper ywDrsTempTaskMapper; + + @Resource + private YwSceneMapper ywSceneMapper; + + @Resource + private YwSceneUserMapper ywSceneUserMapper; + + @Resource + private SysUserRoleMapper sysUserRoleMapper; + + @Resource + private YwSceneService ywSceneService; + + @Resource + private YwSignPlanMapper ywSignPlanMapper; + + @Resource + private YwSignLogMapper ywSignLogMapper; + + @Resource + private ISysDictTypeService sysDictTypeService; + + @Resource + private ISysDictDataService dictDataService; + + /** + * DRS临时任务表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwDrsTempTaskQO qo) { + Long userId = SecurityUtils.getUserId(); + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (!user.isAdmin(user)) { + List ywSceneUsers = ywSceneUserMapper.selectList(new LambdaQueryWrapper().eq(YwSceneUser::getUserId, userId)); + List venueIds = ywSceneUsers.stream().map(YwSceneUser::getSceneId).collect(Collectors.toList()); + if (CollUtil.isEmpty(venueIds)) { + throw new ServiceException("当前登录用户未绑定场馆"); + } + qo.setVenueIds(venueIds); + } + qo.setPageNum(null); + qo.setPageSize(null); + List list = ywDrsTempTaskMapper.list(qo); + translate(list); + return list; + } + + private void translate(List list) { + if (CollUtil.isNotEmpty(list)) { + for (YwDrsTempTaskVO vo : list) { + YwScene scene = ywSceneMapper.selectById(vo.getVenueId()); + if (scene != null) { + vo.setVenueName(scene.getVenueName()); + } + if ("0".equals(vo.getDrsAutoUpdate()) && vo.getTaskTime() != null && vo.getTaskEndTime() != null) { + LocalDateTime now = LocalDateTime.now(); + if (now.isBefore(vo.getTaskTime())) { + vo.setDrsTaskStatus("0"); + } else if (now.isAfter(vo.getTaskEndTime())) { + vo.setDrsTaskStatus("2"); + } else if (now.isBefore(vo.getTaskEndTime()) && now.isAfter(vo.getTaskTime())) { + vo.setDrsTaskStatus("1"); + } else { + throw new ServiceException("任务开始时间与结束时间有错误"); + } + } + if ("1".equals(vo.getDrsAutoUpdate())) { + vo.setTaskEndTime(null); + } + } + } + } + + /** + * DRS临时任务表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public PageInfo getDataByPage(YwDrsTempTaskQO qo) { + Long userId = SecurityUtils.getUserId(); + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (!user.isAdmin(user)) { + List ywSceneUsers = ywSceneUserMapper.selectList(new LambdaQueryWrapper().eq(YwSceneUser::getUserId, userId)); + List venueIds = ywSceneUsers.stream().map(YwSceneUser::getSceneId).collect(Collectors.toList()); + if (CollUtil.isEmpty(venueIds)) { + throw new ServiceException("当前登录用户未绑定场馆"); + } + qo.setVenueIds(venueIds); + } + + if (qo.getVenueId() == null && (StrUtil.isNotBlank(qo.getVenueType()) || StrUtil.isNotBlank(qo.getMaintainType()))) { + List ywSceneList = ywSceneMapper.selectList(new LambdaQueryWrapper().eq(StrUtil.isNotBlank(qo.getVenueType()), YwScene::getVenueType, qo.getVenueType()) + .eq(StrUtil.isNotBlank(qo.getMaintainType()), YwScene::getMaintainType, qo.getMaintainType())); + if (CollUtil.isNotEmpty(ywSceneList)) { + List venueIds = ywSceneList.stream().map(YwScene::getId).collect(Collectors.toList()); + qo.setVenueIds(venueIds); + } + } + + PageHelper.startPage(qo.getPageNum(), qo.getPageSize()); + List list = ywDrsTempTaskMapper.list(qo); + translate(list); + return PageInfo.of(list); + } + + @Override + public YwDrsTempTaskVO fetchById(Long id) { + YwDrsTempTask entity = ywDrsTempTaskMapper.selectById(id); + YwDrsTempTaskVO vo = YwDrsTempTaskConvert.INSTANCE.entityToVo(entity); + YwScene scene = ywSceneMapper.selectById(vo.getVenueId()); + if (scene != null) { + vo.setVenueName(scene.getVenueName()); + } + if ("0".equals(vo.getDrsAutoUpdate()) && vo.getTaskTime() != null && vo.getTaskEndTime() != null) { + LocalDateTime now = LocalDateTime.now(); + if (now.isBefore(vo.getTaskTime())) { + vo.setDrsTaskStatus("0"); + } else if (now.isAfter(vo.getTaskEndTime())) { + vo.setDrsTaskStatus("2"); + } else if (now.isBefore(vo.getTaskEndTime()) && now.isAfter(vo.getTaskTime())) { + vo.setDrsTaskStatus("1"); + } else { + throw new ServiceException("任务开始时间与结束时间有错误"); + } + } + return vo; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean saveOrUpdate(YwDrsTempTaskDTO dto) { + List ywDrsTempTaskTimes = dto.getYwDrsTempTaskTimes(); + for (YwDrsTempTaskTimeDTO ywDrsTempTaskTime : ywDrsTempTaskTimes) { + if(StrUtil.isBlank(ywDrsTempTaskTime.getTaskName())){ + throw new ServiceException("任务名称必填"); + } + YwDrsTempTask entity = YwDrsTempTaskConvert.INSTANCE.dtoToEntity(dto); + entity.setTaskTime(ywDrsTempTaskTime.getTaskTime()); + entity.setTaskEndTime(ywDrsTempTaskTime.getTaskEndTime()); + entity.setDrsAutoUpdate(ywDrsTempTaskTime.getDrsAutoUpdate()); + entity.setDrsTaskStatus(ywDrsTempTaskTime.getDrsTaskStatus()); + entity.setTaskName(ywDrsTempTaskTime.getTaskName()); + + YwDrsTempTask one = getOne(new LambdaQueryWrapper() + .eq(YwDrsTempTask::getVenueId, entity.getVenueId()) + .eq(YwDrsTempTask::getTaskDate, entity.getTaskDate()) + .eq(YwDrsTempTask::getTaskTime, entity.getTaskTime()) + .eq(YwDrsTempTask::getTaskName, entity.getTaskName())); + if (one != null && !one.getId().equals(dto.getId())) { + throw new ServiceException("数据重复(场馆、任务日期、任务开始时间、任务名称)"); + } + + entity.setDrsTaskType(null); + if ("1".equals(entity.getDrsAutoUpdate())) { + entity.setTaskEndTime(null); + } + if ("0".equals(entity.getDrsAutoUpdate()) && entity.getTaskEndTime() == null) { + throw new ServiceException("状态变更为自动时需要输入任务结束时间"); + } + saveOrUpdate(entity); + } + return true; + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywDrsTempTaskMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwDrsTempTaskQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(YwDrsTempTaskVO.class); + util.hideColumn("reason"); + try { + util.exportExcel(response, data, "DRS临时任务表信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + boolean checkFlag = true; + for (YwDrsTempTaskVO vo : list) { + if (StrUtil.isBlank(vo.getTaskName())) { + return AjaxResult.error("导入模板不正确。任务名称为空"); + } + + StringBuilder builder = new StringBuilder(); + if (StrUtil.isBlank(vo.getVenueName())) { + builder.append("【场馆名称】为空;"); + checkFlag = false; + } else { + String venueName = vo.getVenueName(); + List scenes = ywSceneService.list(new LambdaQueryWrapper().eq(YwScene::getVenueName, venueName)); + if (CollUtil.isEmpty(scenes)) { + builder.append("【场馆名】不存在;"); + checkFlag = false; + } + } + if (vo.getTaskTime() == null) { + builder.append("【开始时间】为空;"); + checkFlag = false; + } + if (StrUtil.isBlank(vo.getDrsAutoUpdate())) { + builder.append("【派发方式】不能为空;"); + checkFlag = false; + } else if ("0".equals(vo.getDrsAutoUpdate()) && vo.getTaskEndTime() == null) { + builder.append("【派发方式】为自动时,【结束时间】不能为空;"); + checkFlag = false; + } else if ("0".equals(vo.getDrsAutoUpdate()) && vo.getTaskEndTime().isBefore(vo.getTaskTime())) { + builder.append("结束时间应晚于开始时间;"); + checkFlag = false; + } + if (StrUtil.isBlank(vo.getTaskName())) { + builder.append("【任务名称】为空;"); + checkFlag = false; + } + if (!"0".equals(vo.getDrsAutoUpdate())) { + if (StrUtil.isBlank(vo.getDrsTaskStatus())) { + builder.append("【派发方式】为手动时,【任务状态】不能为空;"); + checkFlag = false; + } else { + List drs_task_status = sysDictTypeService.selectDictDataByType("drs_task_status").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + if (!drs_task_status.contains(vo.getDrsTaskStatus())) { + builder.append("【任务状态】不存在;"); + checkFlag = false; + } + } + } + vo.setReason(builder.toString()); + } + if (!checkFlag) { + ExcelUtil util = new ExcelUtil<>(YwDrsTempTaskVO.class); + util.hideColumn("taskDate"); + String fileName = (String) util.exportExcel(list, "DRS临时任务导入结果").get(AjaxResult.MSG_TAG); + return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + } else { + importList(list); + } + + return AjaxResult.success(); + } + + private void importList(List list) { + List entityList = new ArrayList<>(); + for (YwDrsTempTaskVO vo : list) { + YwDrsTempTask entity = new YwDrsTempTask(); + String venueName = vo.getVenueName(); + List scenes = ywSceneService.list(new LambdaQueryWrapper().eq(YwScene::getVenueName, venueName)); + if (CollUtil.isNotEmpty(scenes)) { + YwScene scene = scenes.get(0); + entity.setVenueId(scene.getId()); + } + + LocalDate taskDate = vo.getTaskDate(); + LocalTime taskTime = LocalTime.from(vo.getTaskTime()); + LocalDateTime binTime = LocalDateTime.of(taskDate, taskTime); + entity.setTaskDate(taskDate); + entity.setTaskTime(binTime); + if (vo.getTaskEndTime() != null) { + LocalTime taskEndTime = LocalTime.from(vo.getTaskEndTime()); + LocalDateTime endTime = LocalDateTime.of(taskDate, taskEndTime); + entity.setTaskEndTime(endTime); + } + + entity.setTaskName(vo.getTaskName()); + entity.setDrsTaskType(null); + entity.setDrsTaskStatus(vo.getDrsTaskStatus()); + entity.setDrsAutoUpdate(vo.getDrsAutoUpdate()); + entity.setRemark(""); + + List ywDrsTempTasks = ywDrsTempTaskMapper.selectList(new LambdaQueryWrapper() + .eq(YwDrsTempTask::getVenueId, entity.getVenueId()) + .eq(YwDrsTempTask::getTaskDate, entity.getTaskDate()) + .eq(YwDrsTempTask::getTaskTime, entity.getTaskTime()) + .eq(YwDrsTempTask::getTaskName, entity.getTaskName()) + ); + if (CollUtil.isNotEmpty(ywDrsTempTasks)) { + YwDrsTempTask ywDrsTempTask = ywDrsTempTasks.get(0); + entity.setId(ywDrsTempTask.getId()); + } + entityList.add(entity); + } + saveOrUpdateBatch(entityList); + } + + @Override + public List drsPreview(Long venueId, LocalDate date) { + YwScene scene = ywSceneMapper.selectOne(new LambdaQueryWrapper().eq(YwScene::getVenueName, "杭州亚运会运行保障指挥部")); + if (scene == null) { + throw new ServiceException("名为'杭州亚运会运行保障指挥部'的场馆不存在"); + } + List vos = ywDrsTempTaskMapper.selectDrsPreviewByVenueIdAndDate(venueId, date, scene.getId()); + if (venueId.equals(scene.getId())) { + List configIds = vos.stream().map(YwDrsTempTaskVO::getConfigId).collect(Collectors.toList()); + if (configIds.contains(1L) && configIds.contains(2L)) { + vos.removeIf(l -> l.getConfigId() == 2L); + } + if (configIds.contains(4L) && configIds.contains(5L)) { + vos.removeIf(l -> l.getConfigId() == 4L); + } + } + List handlerSign = vos.stream().filter(l -> "1".equals(l.getDrsTaskType()) && l.getTaskName().contains("签到")).collect(Collectors.toList()); + for (YwDrsTempTaskVO signVo : handlerSign) { + Long sceneId = signVo.getVenueId(); + LocalDateTime binTime = signVo.getTaskTime(); + YwSignPlanView ywSignPlanView = ywSignPlanMapper.selectOne(new LambdaQueryWrapper() + .eq(YwSignPlanView::getSceneId, sceneId) + .eq(YwSignPlanView::getBeginTime, binTime) + .eq(YwSignPlanView::getIsOpen, "1") + ); + //应签到数 + Long all = ywSignLogMapper.selectCount(new LambdaQueryWrapper() + .eq(YwSignLog::getSignPlanId, ywSignPlanView.getId()) + .eq(YwSignLog::getSignType, 0) + ); + //已签到数 + Long complate = ywSignLogMapper.selectCount(new LambdaQueryWrapper() + .eq(YwSignLog::getSignPlanId, ywSignPlanView.getId()) + .eq(YwSignLog::getSignType, 0) + .isNotNull(YwSignLog::getSignTime) + ); + signVo.setRemark(complate + "/" + all); + } + for (YwDrsTempTaskVO vo : vos) { + String tasktypevalue = dictDataService.selectDictLabel("drs_task_type", vo.getDrsTaskType()); + if (null != tasktypevalue) { + vo.setDrsTaskTypeStr(tasktypevalue); + } + + String taskstatusvalue = dictDataService.selectDictLabel("drs_task_status", vo.getDrsTaskStatus()); + if (null != taskstatusvalue) { + vo.setDrsTaskStatusStr(taskstatusvalue); + } + } + return vos; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwKpiConfigServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwKpiConfigServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..bff2a0097969fa6a7d5519ab78e2b99ec9c0d35a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwKpiConfigServiceImpl.java @@ -0,0 +1,149 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwKpiConfig; +import com.ruoyi.eastcom_yw.domain.dto.YwKpiConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwKpiConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.YwKpiConfigVO; +import com.ruoyi.eastcom_yw.mapper.YwKpiConfigMapper; +import com.ruoyi.eastcom_yw.service.YwKpiConfigService; +import com.ruoyi.eastcom_yw.service.convert.YwKpiConfigConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 指标字段阈值配置表 服务实现类 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Service +public class YwKpiConfigServiceImpl extends ServiceImpl implements YwKpiConfigService { + + @Resource + private YwKpiConfigMapper ywKpiConfigMapper; + + /** + * 指标字段阈值配置表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwKpiConfigQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 序号 + .eq(qo.getId() != null, YwKpiConfig::getId, qo.getId()) + // 专业(1-无线) + .eq(qo.getSubject() != null, YwKpiConfig::getSubject, qo.getSubject()) + // 网络模式(1-4G,2-5G) + .eq(qo.getNetType() != null, YwKpiConfig::getNetType, qo.getNetType()) + // 指标字段 + .eq(qo.getKpiField() != null, YwKpiConfig::getKpiField, qo.getKpiField()) + ; + List list = ywKpiConfigMapper.selectList(queryWrapper); + return YwKpiConfigConvert.INSTANCE.entityToVoList(list); + } + + /** + * 指标字段阈值配置表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(YwKpiConfigQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 序号 + .eq(qo.getId() != null, YwKpiConfig::getId, qo.getId()) + // 专业(1-无线) + .eq(qo.getSubject() != null, YwKpiConfig::getSubject, qo.getSubject()) + // 网络模式(1-4G,2-5G) + .eq(qo.getNetType() != null, YwKpiConfig::getNetType, qo.getNetType()) + // 指标字段 + .eq(qo.getKpiField() != null, YwKpiConfig::getKpiField, qo.getKpiField()) + ; + + Page page = page(new Page<>(qo.getPageNum(), qo.getPageSize()), queryWrapper); + IPage voPage = page.convert(YwKpiConfigConvert.INSTANCE::entityToVo); + return voPage; + } + + @Override + public YwKpiConfigVO fetchById(Long id) { + YwKpiConfig entity = ywKpiConfigMapper.selectById(id); + return YwKpiConfigConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(YwKpiConfigDTO dto) { + YwKpiConfig entity = YwKpiConfigConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywKpiConfigMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwKpiConfigQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(YwKpiConfigVO.class); + try { + util.exportExcel(response, data, "指标字段阈值配置表信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeBriefingServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeBriefingServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..833f1109340ed10c071e136256d49ef6c7441798 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeBriefingServiceImpl.java @@ -0,0 +1,1598 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.fastjson2.JSONWriter; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeBriefingDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeBriefingQO; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.YwAlarmMapper; +import com.ruoyi.eastcom_yw.mapper.YwNoticeBriefingMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneMatchMapper; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.eastcom_yw.service.convert.YwNoticeBriefingConvert; +import com.ruoyi.eastcom_yw.service.convert.YwNoticeModelConvert; +import com.ruoyi.framework.web.domain.dto.MobileOfficesDTO; +import com.ruoyi.framework.web.service.sms.MessageService; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.ISysDictDataService; +import com.ruoyi.system.service.ISysDictTypeService; +import com.ruoyi.system.service.ISysUserService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileItemFactory; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.stream.Collectors; + +/** + *

+ * 通知通告简报计划表 服务实现类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Service +@Slf4j +public class YwNoticeBriefingServiceImpl extends ServiceImpl implements YwNoticeBriefingService { + + @Resource + private YwNoticeBriefingMapper ywNoticeBriefingMapper; + + @Resource + private YwSceneService ywSceneService; + + @Resource + private YwSceneMatchMapper ywSceneMatchMapper; + + @Resource + private YwScenePictureService ywScenePictureService; + + @Resource + private YwNoticeModelService ywNoticeModelService; + + @Resource + private YwNoticeObjectService ywNoticeObjectService; + + @Resource + private MessageService messageService; + + @Resource + private ISysDictDataService dictDataService; + + @Resource + private SysNoticeService sysNoticeService; + + @Resource + private ISysUserService sysUserService; + + @Resource + private SysUserMapper sysUserMapper; + + @Resource + private ISysDictTypeService sysDictTypeService; + + @Resource + private ISysDictDataService sysDictDataService; + + @Resource + private YwAlarmMapper ywAlarmMapper; + + @Resource + private PmKpiMonitorCellService pmKpiMonitorCellService; + + @Resource + private YwSceneMapper ywSceneMapper; + + @Resource + private ThreadPoolTaskExecutor threadPool; + + @Value("${file.briefingJsonPath}") + private String briefingJsonPath; + + @Value("${file.briefingShortUrl}") + private String briefingShortUrl; + + /** + * 通知通告简报计划表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwNoticeBriefingQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 地市 + .eq(StrUtil.isNotBlank(qo.getCity()), YwNoticeBriefing::getCity, qo.getCity()) + // 场馆id + .in(CollUtil.isNotEmpty(qo.getVenueId()), YwNoticeBriefing::getVenueId, qo.getVenueId()) + // 对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层) + .eq(StrUtil.isNotBlank(qo.getObjectProto()), YwNoticeBriefing::getObjectProto, qo.getObjectProto()) + // 通知方式sys_notice_type + .eq(StrUtil.isNotBlank(qo.getNoticeType()), YwNoticeBriefing::getNoticeType, qo.getNoticeType()) + // 发送日期 + .eq(qo.getSendDate() != null, YwNoticeBriefing::getSendDate, qo.getSendDate()) + // 开始时间 + .eq(qo.getBeginTime() != null, YwNoticeBriefing::getBeginTime, qo.getBeginTime()) + // 结束时间 + .eq(qo.getEndTime() != null, YwNoticeBriefing::getEndTime, qo.getEndTime()) + // 区县 + .eq(StrUtil.isNotBlank(qo.getCounty()), YwNoticeBriefing::getCounty, qo.getCounty()) + // 对象ids数组 +// .eq(StrUtil.isNotBlank(qo.getObjectIds()), YwNoticeBriefing::getObjectIds, qo.getObjectIds()) + // 模板id + .eq(qo.getModelId() != null, YwNoticeBriefing::getModelId, qo.getModelId()) + // 排序号 + .eq(qo.getOrderNum() != null, YwNoticeBriefing::getOrderNum, qo.getOrderNum()) + // 时间间隔(单位分) + .eq(qo.getTimeInterval() != null, YwNoticeBriefing::getTimeInterval, qo.getTimeInterval()) + // 通知名称 + .like(StrUtil.isNotBlank(qo.getNoticeName()), YwNoticeBriefing::getNoticeName, qo.getNoticeName()) + .orderBy(true, false, YwNoticeBriefing::getId) + ; + List list = ywNoticeBriefingMapper.selectList(queryWrapper); + if (CollUtil.isEmpty(list)) { + return new ArrayList<>(); + } + List vos = YwNoticeBriefingConvert.INSTANCE.entityToVoList(list); + //翻译场馆、对象数组、模板 + for (YwNoticeBriefingVO vo : vos) { + translate(vo); + } + if (StrUtil.isNotBlank(qo.getKeyWord())) { + vos = vos.stream().filter(l -> l.getObjectNameStr().contains(qo.getKeyWord()) || l.getNoticeName().contains(qo.getKeyWord())).collect(Collectors.toList()); + } + return vos; + } + + + /** + * 通知通告简报计划表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(YwNoticeBriefingQO qo) { + + if (CollUtil.isEmpty(qo.getVenueId()) && (StrUtil.isNotBlank(qo.getVenueType()) || StrUtil.isNotBlank(qo.getMaintainType()))) { + List ywSceneList = ywSceneMapper.selectList(new LambdaQueryWrapper().eq(StrUtil.isNotBlank(qo.getVenueType()), YwScene::getVenueType, qo.getVenueType()) + .eq(StrUtil.isNotBlank(qo.getMaintainType()), YwScene::getMaintainType, qo.getMaintainType())); + if (CollUtil.isNotEmpty(ywSceneList)) { + List venueIds = ywSceneList.stream().map(YwScene::getId).collect(Collectors.toList()); + qo.setVenueId(venueIds); + } + } + +// List data = ywNoticeBriefingMapper.getDataByPage(qo); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 地市 + .eq(StrUtil.isNotBlank(qo.getCity()), YwNoticeBriefing::getCity, qo.getCity()) + // 场馆id + .in(CollUtil.isNotEmpty(qo.getVenueId()), YwNoticeBriefing::getVenueId, qo.getVenueId()) + // 对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层) + .eq(StrUtil.isNotBlank(qo.getObjectProto()), YwNoticeBriefing::getObjectProto, qo.getObjectProto()) + // 通知方式sys_notice_type + .eq(StrUtil.isNotBlank(qo.getNoticeType()), YwNoticeBriefing::getNoticeType, qo.getNoticeType()) + //简报类型briefing_type + .eq(StrUtil.isNotBlank(qo.getModelSuitType()), YwNoticeBriefing::getModelSuitType, qo.getModelSuitType()) + //发送方式send_type + .eq(StrUtil.isNotBlank(qo.getSendType()), YwNoticeBriefing::getSendType, qo.getSendType()) + //发送用户send_user + .eq(qo.getSendUser() != null, YwNoticeBriefing::getSendUser, qo.getSendUser()) + // 发送日期 + .eq(qo.getSendDate() != null, YwNoticeBriefing::getSendDate, qo.getSendDate()) + // 开始时间 + .eq(qo.getBeginTime() != null, YwNoticeBriefing::getBeginTime, qo.getBeginTime()) + // 结束时间 + .eq(qo.getEndTime() != null, YwNoticeBriefing::getEndTime, qo.getEndTime()) + // 区县 + .eq(StrUtil.isNotBlank(qo.getCounty()), YwNoticeBriefing::getCounty, qo.getCounty()) + // 对象ids数组 +// .in(StrUtil.isNotBlank(qo.getObjectIds()), YwNoticeBriefing::getObjectIds, qo.getObjectIds()) + // 模板id + .eq(qo.getModelId() != null, YwNoticeBriefing::getModelId, qo.getModelId()) + // 时间间隔(单位分) + .eq(qo.getTimeInterval() != null, YwNoticeBriefing::getTimeInterval, qo.getTimeInterval()) + // 通知名称 + .like(StrUtil.isNotBlank(qo.getNoticeName()), YwNoticeBriefing::getNoticeName, qo.getNoticeName()) + .orderBy(true, false, YwNoticeBriefing::getId) + ; + + Page page = page(new Page<>(qo.getPageNum(), qo.getPageSize()), queryWrapper); + IPage voPage = page.convert(YwNoticeBriefingConvert.INSTANCE::entityToVo); + List vos = voPage.getRecords(); + if (CollUtil.isEmpty(vos)) { + return new Page<>(); + } + for (YwNoticeBriefingVO vo : vos) { + translate(vo); + } + voPage.setRecords(vos); + return voPage; + } + + @Override + public YwNoticeBriefingVO fetchById(Long id) { + YwNoticeBriefing entity = ywNoticeBriefingMapper.selectById(id); + YwNoticeBriefingVO vo = YwNoticeBriefingConvert.INSTANCE.entityToVo(entity); + translate(vo); + return vo; + } + + @Override + public boolean saveOrUpdate(YwNoticeBriefingDTO dto) { + if (dto.getId() != null) { + YwNoticeBriefing entity = ywNoticeBriefingMapper.selectById(dto.getId()); + if (entity == null) { + throw new ServiceException("未查询到可修改数据"); + } + if (entity.getSysNormalDisable() == null || "0".equals(entity.getSysNormalDisable())) { + throw new ServiceException("请先停用该简报后再修改"); + } + } + YwNoticeBriefing entity = YwNoticeBriefingConvert.INSTANCE.dtoToEntity(dto); + + if ("3".equals(dto.getModelSuitType()) && StrUtil.isBlank(entity.getNoticeType())) { + throw new ServiceException("请至少选择一种通知方式"); + } + if ("2".equals(dto.getSendType()) && dto.getSendUser() == null) { + throw new ServiceException("选择手工发送时需要选择发送人员"); + } + //发送方式根据模板中动态配置框是否有内容判断 + Long modelId = dto.getModelId(); + YwNoticeModel model = ywNoticeModelService.getById(modelId); + String modelContent = model.getModelContent(); + if ("3".equals(dto.getModelSuitType()) && hasContent(modelContent)) { + entity.setSendType("2"); + } else { + entity.setSendType("1"); + } + if ("0".equals(entity.getObjectProto())) { + YwScene scene = ywSceneService.getById(dto.getVenueId()); + //根据场馆查地市区域 + entity.setCity(scene.getCityId()); + entity.setCounty(scene.getAreaCountyId()); + entity.setNoticeName(scene.getVenueName() + "简报"); + } + if ("1".equals(entity.getObjectProto())) { + //根据区域查地市 + entity.setCity(entity.getCounty().substring(0, 4)); + String name = dictDataService.selectDictLabel("yw_county", dto.getCounty()); + entity.setNoticeName(name + "简报"); + } + if ("2".equals(entity.getObjectProto())) { + String name = dictDataService.selectDictLabel("yw_city", dto.getCity()); + entity.setNoticeName(name + "简报"); + } + //通知通报-简报定制-新建简报确定后,后台自动启动该条记录(页面操作列呈现“已启动”,点击“已启动”将停用该条计划->“未启动”)。 + //通知通报-简报定制只有现将“已启动”停用为“未启动”,才可以支持修改该条计划(即修改功能才可用),修改完确定后,后台自动启动该条记录 + entity.setSysNormalDisable("0"); + if (CollUtil.isNotEmpty(dto.getObjectIds())) { + List objectIds = dto.getObjectIds().stream().map(Long::parseLong).collect(Collectors.toList()); + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + if (CollUtil.isNotEmpty(objectVOS)) { + entity.setNoticeObjectNameStr(objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(","))); + } + } + if (dto.getSendUser() == null) { + Long userId = SecurityUtils.getUserId(); + entity.setSendUser(userId); + } + + if (entity.getId() == null) { + List ywNoticeBriefings = ywNoticeBriefingMapper.selectList(new LambdaQueryWrapper() + .eq(YwNoticeBriefing::getCity, entity.getCity()) + .eq(StrUtil.isNotBlank(entity.getCounty()), YwNoticeBriefing::getCounty, entity.getCounty()) + .eq(entity.getVenueId() != null, YwNoticeBriefing::getVenueId, entity.getVenueId()) + .eq(YwNoticeBriefing::getObjectProto, entity.getObjectProto()) + .eq(YwNoticeBriefing::getTimeInterval, entity.getTimeInterval()) + .eq(entity.getSendDate() != null, YwNoticeBriefing::getSendDate, entity.getSendDate()) + .eq(entity.getModelId() != null, YwNoticeBriefing::getModelId, entity.getModelId())); + + if (CollUtil.isNotEmpty(ywNoticeBriefings)) { + throw new ServiceException("已制定当天计划,无需重复制定"); + } + } + return saveOrUpdate(entity); + } + + + private boolean hasContent(String modelContent) { + String s = StrUtil.cleanBlank(modelContent); + boolean flag = false; + int startIndex = 0; + int endIndex; + while ((startIndex = s.indexOf("(", startIndex)) != -1) { + endIndex = s.indexOf(")", startIndex + 1); + if (endIndex != -1) { + String s2 = s.substring(startIndex + 1, endIndex).trim(); + if (!"在此输入其他性能数据".equals(s2)) { + flag = true; + break; + } + startIndex = endIndex + 1; + } else { + break; + } + } + return flag; + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywNoticeBriefingMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwNoticeBriefingQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + for (YwNoticeBriefingVO vo : data) { + if (vo.getModelId() != null) { + YwNoticeModel model = ywNoticeModelService.getById(vo.getModelId()); + if (model != null) { + vo.setModelName(model.getModelName()); + } + } + List objectIds = vo.getObjectIds(); + if (CollUtil.isNotEmpty(objectIds)) { + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + if (CollUtil.isNotEmpty(objectVOS)) { + String names = objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(",")); + vo.setObjectName(names); + } + } + } + for (int i = 1; i < data.size() + 1; i++) { + YwNoticeBriefingVO ywNoticeBriefingVO = data.get(i - 1); + ywNoticeBriefingVO.setId((long) i); + } + ExcelUtil util = new ExcelUtil<>(YwNoticeBriefingVO.class); + util.hideColumn("reason"); + try { + util.exportExcel(response, data, "简报定制"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + @Transactional + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + for (YwNoticeBriefingVO vo : list) { + if (vo == null) { + return AjaxResult.error("导入模板不正确。"); + } + if (vo.getTimeInterval() == null) { + return AjaxResult.error("导入模板不正确。通报间隔为空"); + } + } + boolean checkFlag = true; + + for (int i = 0; i < list.size(); i++) { + StringBuilder builder = new StringBuilder(); + YwNoticeBriefingVO vo = list.get(i); + + List ywNoticeBriefings = ywNoticeBriefingMapper.selectList(new LambdaQueryWrapper() + .eq(YwNoticeBriefing::getCity, vo.getCity()) + .eq(StrUtil.isNotBlank(vo.getCounty()), YwNoticeBriefing::getCounty, vo.getCounty()) + .eq(vo.getVenueId() != null, YwNoticeBriefing::getVenueId, vo.getVenueId()) + .eq(YwNoticeBriefing::getObjectProto, vo.getObjectProto()) + .eq(YwNoticeBriefing::getTimeInterval, vo.getTimeInterval()) + .eq(vo.getSendDate() != null, YwNoticeBriefing::getSendDate, vo.getSendDate()) + .eq(vo.getModelId() != null, YwNoticeBriefing::getModelId, vo.getModelId())); + if (CollUtil.isNotEmpty(ywNoticeBriefings)) { + YwNoticeBriefing briefing = ywNoticeBriefings.get(0); + if (briefing != null && "0".equals(briefing.getSysNormalDisable())) { + builder.append("已经启用的模板不允许导入修改;"); + checkFlag = false; + } + } + + if (StrUtil.isBlank(vo.getModelSuitType())) { + builder.append("【简报类型】为空;"); + checkFlag = false; + } else { + List model_suit_type = sysDictTypeService.selectDictDataByType("model_suit_type").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + if (!model_suit_type.contains(vo.getModelSuitType())) { + builder.append("【简报类型】不存在;"); + checkFlag = false; + } + } + if ("3".equals(vo.getModelSuitType())) { + List send_type = sysDictTypeService.selectDictDataByType("send_type").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + if (StrUtil.isBlank(vo.getSendType())) { + builder.append("【发送方式】为空;"); + checkFlag = false; + } else if (!send_type.contains(vo.getSendType())) { + builder.append("【发送方式】不存在;"); + checkFlag = false; + } else if ("2".equals(vo.getSendType()) && (StrUtil.isBlank(vo.getSendUserStr()) || StrUtil.isBlank(vo.getSendUserPhoneStr()))) { + builder.append("【发送方式】为手工发送时需填发送人员;"); + checkFlag = false; + } else { + List sysUsers = sysUserMapper.selectUserByRoleKey("noticemaster"); + List nameAndPhone = sysUsers.stream().map(l -> l.getNickName() + l.getPhonenumber()).collect(Collectors.toList()); + String s = vo.getSendUserStr() + vo.getSendUserPhoneStr(); + SysUser sysUser = sysUserMapper.selectUserById(1L); + String admin = sysUser.getNickName() + sysUser.getPhonenumber(); + nameAndPhone.add(admin); + if (!nameAndPhone.contains(s)) { + builder.append("该发送人员姓名手机号有误或无通知审核员角色"); + checkFlag = false; + } + } + } + + if (StrUtil.isBlank(vo.getNoticeTypeStr())) { + throw new ServiceException("请至少选择一种通知方式"); + } else { + vo.setNoticeTypeStr("[\"移动办公\"]"); + try { + vo.setNoticeType(JSONUtil.toList(vo.getNoticeTypeStr(), String.class)); + } catch (Exception e) { + builder.append("【通知方式】不存在;"); + checkFlag = false; + } + } + if (StrUtil.isBlank(vo.getObjectProto())) { + builder.append("【对象属性】为空或不存在;"); + checkFlag = false; + } + List scenes = new ArrayList<>(); + if ("0".equals(vo.getObjectProto())) { + if (StrUtil.isBlank(vo.getVenueName())) { + builder.append("【场馆名】不能为空;"); + checkFlag = false; + } else { + String venueName = vo.getVenueName(); + scenes = ywSceneService.list(new LambdaQueryWrapper().eq(YwScene::getVenueName, venueName)); + if (CollUtil.isEmpty(scenes)) { + builder.append("【场馆名】不存在;"); + checkFlag = false; + } + } + } + if ("1".equals(vo.getObjectProto())) { + if (StrUtil.isBlank(vo.getCounty())) { + builder.append("【区县】为空;"); + checkFlag = false; + } else { + List yw_county = sysDictTypeService.selectDictDataByType("yw_county").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + if (!yw_county.contains(vo.getCounty())) { + builder.append("【区县】不存在;"); + checkFlag = false; + } + } + } + if ("2".equals(vo.getObjectProto())) { + if (StrUtil.isBlank(vo.getCity())) { + builder.append("【地市】为空;"); + checkFlag = false; + } else { + List yw_city = sysDictTypeService.selectDictDataByType("yw_city").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + if (!yw_city.contains(vo.getCity())) { + builder.append("【地市】不存在;"); + checkFlag = false; + } + } + } + if (vo.getTimeInterval() == null) { + builder.append("【通报间隔】为空;"); + checkFlag = false; + } else { + if (vo.getTimeInterval() != 15 && vo.getTimeInterval() != 60 && vo.getTimeInterval() != 120) { + builder.append("【通报间隔】不存在;"); + checkFlag = false; + } + } + if (StrUtil.isBlank(vo.getSysNormalDisable())) { + builder.append("【启用状态】为空;"); + checkFlag = false; + } else { + List sys_normal_disable = sysDictTypeService.selectDictDataByType("sys_normal_disable").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + if (!sys_normal_disable.contains(vo.getSysNormalDisable())) { + builder.append("【启用状态】不存在;"); + checkFlag = false; + } + } + + if (StrUtil.isNotBlank(vo.getObjectName())) { + ArrayList objectNames = CollUtil.toList(vo.getObjectName().split(",")); + for (String objectName : objectNames) { + YwNoticeObject object = ywNoticeObjectService.getOne(new LambdaQueryWrapper().eq(YwNoticeObject::getObjectName, objectName)); + if (object == null) { + builder.append("【对象名称】").append("不存在;"); + checkFlag = false; + } else { + if (!vo.getObjectProto().equals(object.getObjectProto())) { + builder.append("对象属性不正确;"); + checkFlag = false; + } + if ("0".equals(vo.getObjectProto())) { + if (CollUtil.isNotEmpty(scenes)) { + List venueIds = scenes.stream().map(YwScene::getId).collect(Collectors.toList()); + if (!venueIds.contains(object.getVenueId())) { + builder.append("【场馆名称】与【通知对象】未对应;"); + checkFlag = false; + } + } + } + } + + } + } + if (StrUtil.isNotBlank(vo.getModelName())) { + YwNoticeModel model = ywNoticeModelService.getOne(new LambdaQueryWrapper().eq(YwNoticeModel::getModelName, vo.getModelName())); + if (model == null) { + builder.append("【通知模板】").append("不存在;"); + checkFlag = false; + } else { + if (!vo.getModelSuitType().equals(model.getModelSuitType())) { + builder.append("【简报类型】与【通知模板】未对应;"); + checkFlag = false; + } + } + } + if (vo.getSendDate() == null) { + builder.append("【发送日期】不能为空;"); + checkFlag = false; + } else { + if (vo.getSendDate().isBefore(LocalDate.now())) { + builder.append("发送日期不能早于当前时间;"); + checkFlag = false; + } + } + if (vo.getBeginTime() == null || vo.getEndTime() == null) { + builder.append("【开始时间】与【结束时间】不能为空;"); + checkFlag = false; + } else { + if (vo.getBeginTime().isBefore(LocalDateTime.now())) { + builder.append("开始时间不能早于当前时间;"); + checkFlag = false; + } + if (vo.getEndTime().isBefore(vo.getBeginTime())) { + builder.append("结束时间不能早于开始时间;"); + checkFlag = false; + } + if (vo.getSendDate() != null && !(vo.getSendDate().equals(vo.getBeginTime().toLocalDate()) && vo.getSendDate().equals(vo.getEndTime().toLocalDate()))) { + builder.append("结束时间与开始时间应与发送日期为同一天;"); + checkFlag = false; + } + } + + vo.setReason(builder.toString()); + } +// if (checkFlag) { +// checkFlag = checkUnique(list); +// } + if (!checkFlag) { + ExcelUtil util = new ExcelUtil<>(YwNoticeBriefingVO.class); + util.hideColumn("id"); + String fileName = (String) util.exportExcel(list, "简报定制导入结果").get(AjaxResult.MSG_TAG); + return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + } else { + importList(list); + } + + return AjaxResult.success(); + } + + private void importList(List list) { + ArrayList ywNoticeBriefings = new ArrayList<>(); + for (YwNoticeBriefingVO vo : list) { + YwNoticeBriefing entity = new YwNoticeBriefing(); + + List split = vo.getNoticeType(); + ArrayList strings = new ArrayList<>(); + for (String s : split) { + String value = dictDataService.selectDictValue("sys_notice_type", s); + strings.add(value); + } + entity.setNoticeType(JSONUtil.toJsonStr(strings)); + + entity.setCity(vo.getCity()); + entity.setCounty(vo.getCounty()); + if ("0".equals(vo.getObjectProto())) { + String venueName = vo.getVenueName(); + List scenes = ywSceneService.list(new LambdaQueryWrapper().eq(YwScene::getVenueName, venueName)); + if (CollUtil.isNotEmpty(scenes)) { + YwScene scene = scenes.get(0); + entity.setVenueId(scene.getId()); + entity.setCounty(scene.getAreaCountyId()); + entity.setCity(scene.getAreaCountyId().substring(0, 4)); + entity.setNoticeName(scene.getVenueName() + "简报"); + } + } + if ("1".equals(vo.getObjectProto())) { + entity.setCity(vo.getCounty().substring(0, 4)); + String name = dictDataService.selectDictLabel("yw_county", vo.getCounty()); + entity.setNoticeName(name + "简报"); + } + if ("2".equals(entity.getObjectProto())) { + String name = dictDataService.selectDictLabel("yw_city", vo.getCity()); + entity.setNoticeName(name + "简报"); + } + entity.setObjectProto(vo.getObjectProto()); + if (StrUtil.isNotBlank(vo.getObjectName())) { + ArrayList objectNames = CollUtil.toList(vo.getObjectName().split(",")); + List objects = ywNoticeObjectService.list + (new LambdaQueryWrapper().in(YwNoticeObject::getObjectName, objectNames)); + if (CollUtil.isNotEmpty(objects)) { + List objectIds = objects.stream().map(YwNoticeObject::getId).collect(Collectors.toList()); + entity.setObjectIds(objectIds); + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + if (CollUtil.isNotEmpty(objectVOS)) { + entity.setNoticeObjectNameStr(objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(","))); + } + } + } + if (StrUtil.isNotBlank(vo.getModelName())) { + YwNoticeModel model = ywNoticeModelService.getOne(new LambdaQueryWrapper().eq(YwNoticeModel::getModelName, vo.getModelName())); + entity.setModelId(model.getId()); + if (hasContent(model.getModelContent())) { + entity.setSendType("2"); + } else { + entity.setSendType("1"); + } + } + entity.setTimeInterval(vo.getTimeInterval()); + entity.setSendDate(vo.getSendDate()); + entity.setBeginTime(vo.getBeginTime()); + entity.setEndTime(vo.getEndTime()); + entity.setSysNormalDisable(vo.getSysNormalDisable()); + entity.setModelSuitType(vo.getModelSuitType()); + + SysUser sysUser = sysUserService.selectUserByPhone(vo.getSendUserPhoneStr()); + if (sysUser != null) { + entity.setSendUser(sysUser.getUserId()); + } + //查询是否存在对象名称相同的数据,如果存在则更新 + List briefingList = ywNoticeBriefingMapper.selectList(new LambdaQueryWrapper() + .eq(YwNoticeBriefing::getCity, entity.getCity()) + .eq(StrUtil.isNotBlank(entity.getCounty()), YwNoticeBriefing::getCounty, entity.getCounty()) + .eq(entity.getVenueId() != null, YwNoticeBriefing::getVenueId, entity.getVenueId()) + .eq(YwNoticeBriefing::getObjectProto, entity.getObjectProto()) + .eq(YwNoticeBriefing::getTimeInterval, entity.getTimeInterval()) + .eq(entity.getSendDate() != null, YwNoticeBriefing::getSendDate, entity.getSendDate()) + .eq(entity.getModelId() != null, YwNoticeBriefing::getModelId, entity.getModelId()) + .eq(StrUtil.isNotBlank(entity.getNoticeObjectNameStr()), YwNoticeBriefing::getNoticeObjectNameStr, entity.getNoticeObjectNameStr())); + if (CollUtil.isNotEmpty(briefingList)) { + YwNoticeBriefing briefing = briefingList.get(0); + entity.setId(briefing.getId()); + ywNoticeBriefingMapper.updateById(entity); + } else { + ywNoticeBriefings.add(entity); + } + } + saveBatch(ywNoticeBriefings); + + } + + private boolean checkUnique(List vos) { + boolean checkFlag = true; + List matchNameList = new ArrayList<>(); + for (YwNoticeBriefingVO imp : vos) { + StringBuilder reason = new StringBuilder(); + if (matchNameList.contains(imp.getObjectName())) { + checkFlag = false; + reason.append("表格中多条记录对象名称有重复。"); + } + matchNameList.add(imp.getObjectName()); + imp.setReason(reason.toString()); + } + return checkFlag; + } + + @Override + public void eastcomYwSendBriefingSchedule() { + long startTime = System.currentTimeMillis(); + log.info("开始执行简报发送任务"); + List vos = ywNoticeBriefingMapper.selectNeedSendBriefing(); + if (CollUtil.isEmpty(vos)) { + return; + } + // 使用线程池中线程分批处理业务逻辑,并行处理任务提高终端响应速度 + CountDownLatch latch = new CountDownLatch(vos.size()); + for (YwNoticeBriefingPlanVO vo : vos) { + threadPool.submit(() -> { + try { + extracted(vo); + } catch (Exception e) { + log.error("调用下游系统出现错误,异常逻辑处理......"); + } finally { + // 业务逻辑处理完毕,计数器减一【当前线程处理任务完毕,线程释放进入线程池,等待处理下一个任务】 + latch.countDown(); + } + }); + } + try { + latch.await(); + } catch (Exception e) { + log.error("等待超时", e); + throw new RuntimeException("系统处理超时,请稍后再试"); + } +// threadPool.shutdown(); + long endTime = System.currentTimeMillis(); + long executionTime = endTime - startTime; + log.info("结束执行简报发送任务,任务耗时"+executionTime+ " 毫秒"); + } + + private void extracted(YwNoticeBriefingPlanVO vo) { + if (StrUtil.isBlank(vo.getObjectProto())) { + log.error(vo.getId() + "未指定对象属性是哪层"); + return; + } + String content = ""; + String urlContent = ""; + if ("0".equals(vo.getObjectProto())) { + if (vo.getVenueId() == null) { + log.error(vo.getId() + "场馆级简报未指定场馆id"); + return; + } + try { + if (vo.getModelId() != null && "3".equals(vo.getModelSuitType())) { + log.info("开始组装场馆级简报"); + content = assemblyVenueBriefing(vo.getSendTime(), vo.getVenueId(), vo.getTimeInterval(), vo.getModelId()); + log.info("结束组装场馆级简报"); + } else if (vo.getModelId() != null && "4".equals(vo.getModelSuitType())) { + log.info("开始组装H5简报"); + content = assemblyVenueJsonToGetURL(vo.getSendTime(), vo.getVenueId(), vo.getTimeInterval()); + log.info("结束组装H5简报"); + } + } catch (Exception e) { + log.error("组装场馆级简报失败:" + e.getMessage()); + content = "组装场馆级简报失败:" + e.getMessage(); + } + } else if ("1".equals(vo.getObjectProto())) { + if (StrUtil.isBlank(vo.getCounty())) { + log.error(vo.getId() + "区县级简报未指定区县"); + return; + } + try { + if (vo.getModelId() != null && 22 == vo.getModelId()) { + content = assemblyCountyBriefing(vo.getSendTime(), vo.getCounty(), vo.getTimeInterval()); + } else if (vo.getModelId() != null && 23 == vo.getModelId()) { + content = assemblyCountyJsonToGetURL(vo.getSendTime(), vo.getVenueId(), vo.getTimeInterval()); + } + } catch (Exception e) { + log.error("组装区县级简报失败:" + e.getMessage()); + return; + } + } else if ("2".equals(vo.getObjectProto())) { + if (StrUtil.isBlank(vo.getCity())) { + log.error(vo.getId() + "地市级简报未指定市"); + return; + } + try { + if (vo.getModelId() != null && "3".equals(vo.getModelSuitType())) { + content = assemblyCityBriefing(vo.getSendTime(), vo.getCity(), vo.getTimeInterval(), vo.getModelId()); + } else if (vo.getModelId() != null && "4".equals(vo.getModelSuitType())) { + content = assemblyCityJsonToGetURL(vo.getSendTime(), vo.getVenueId(), vo.getTimeInterval()); + } + } catch (Exception e) { + log.error("组装地市级简报失败:" + e.getMessage()); + content = "组装地市级简报失败:" + e.getMessage(); + } + } + String objectIdsStr = vo.getObjectIdsStr(); + List objectIds = JSONUtil.toList(objectIdsStr, Long.class); + if (CollUtil.isEmpty(objectIds)) { + log.error(vo.getId() + "简报未配置发送对象"); + return; + } + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + if (CollUtil.isEmpty(objectVOS)) { + log.error(vo.getId() + "简报配置发送对象错误,该对象id已失效"); + return; + } + + String noticeType = vo.getNoticeType(); + List strings = JSONUtil.toList(noticeType, String.class); + for (YwNoticeObjectVO object : objectVOS) { + log.info("开始对象发送:"+object.getObjectName()); + //群 + if (strings.contains("5") && StrUtil.isNotBlank(object.getGroupId())) { + SysNotice sysNotice = getSysNotice(content, vo, objectIds, object); + sysNotice.setGroupId(object.getGroupId()); + sysNotice.setNoticeType("5"); + sysNotice.setNoticeObject(sysNotice.getNoticeObject() + ":" + object.getGroupName()); + if ("2".equals(vo.getSendType()) && "3".equals(vo.getModelSuitType())) { + //手工通知 + sysNotice.setAddFlag("2"); + sysNotice.setExpSendTime(vo.getSendTime()); + sysNotice.setSendUser(vo.getSendUser()); + sysNoticeService.save(sysNotice); + } else { + MobileOfficesDTO dto = new MobileOfficesDTO(); + dto.setMobileoffices(object.getGroupId()); + dto.setMobileoffice_user(null); + dto.setFile(null); + dto.setFilename(null); + dto.setImg(null); + dto.setImgname(null); + + String res = content.replaceAll("<.*?>", "").replace("\n(在此输入其他性能数据)", "").replaceAll("(\\s*)", "").replaceAll("\\(\\s*\\)", "").replace("(", "").replace("(", "").replace(")", "").replace(")", ""); + System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" + res); + dto.setContent(res); + + JSONObject jsonObject = null; + try { + jsonObject = messageService.sendMobileOffice(dto); + } catch (Exception e) { + log.error("发送移动办公失败"); + } + //sys_notice新增已发送记录 + if (jsonObject != null) { + sysNotice.setRemark(jsonObject.getString("message")); + sysNotice.setSendStatus(jsonObject.getString("code")); + } + sysNotice.setNoticeContent(res); + sysNotice.setAddFlag("1"); + sysNotice.setSendTime(LocalDateTime.now()); + sysNoticeService.save(sysNotice); + } + } + //短信 + if (strings.contains("3") && CollUtil.isNotEmpty(object.getMessageUsers())) { + List messageUsers = object.getMessageUsers(); + + List sysUsers = getSysUsers(messageUsers); + + String phone = sysUsers.stream().map(SysUser::getPhonenumber).collect(Collectors.joining(",")); + SysNotice sysNotice = getSysNotice(content, vo, objectIds, object); + sysNotice.setNoticeType("3"); + sysNotice.setReciveUserPhone(phone); + sysNotice.setNoticeObject(sysNotice.getNoticeObject() + ":" + object.getMessageName()); + if ("2".equals(vo.getSendType())) { + //手工通知 + sysNotice.setAddFlag("0"); + sysNotice.setExpSendTime(vo.getSendTime().plusMinutes(10)); + sysNoticeService.save(sysNotice); + } else { + JSONObject jsonObject = null; + try { + jsonObject = messageService.sendSMS(content, phone); + } catch (Exception e) { + log.error("发送短信群失败"); + } + //sys_notice新增已发送记录 + if (jsonObject != null) { + sysNotice.setRemark(jsonObject.getString("message")); + sysNotice.setSendStatus(jsonObject.getString("code")); + } + sysNotice.setAddFlag("1"); + sysNotice.setSendTime(LocalDateTime.now()); + sysNoticeService.save(sysNotice); + } + } + //IVR + if (strings.contains("7") && CollUtil.isNotEmpty(object.getIvrUsers())) { + List ivrUsers = object.getIvrUsers(); + + List sysUsers = getSysUsers(ivrUsers); + + String phone = sysUsers.stream().map(SysUser::getPhonenumber).collect(Collectors.joining(",")); + SysNotice sysNotice = getSysNotice(content, vo, objectIds, object); + sysNotice.setNoticeType("7"); + sysNotice.setReciveUserPhone(phone); + sysNotice.setNoticeObject(sysNotice.getNoticeObject() + ":" + object.getIvrName()); + + + if ("2".equals(vo.getSendType())) { + //手工通知 + sysNotice.setAddFlag("0"); + sysNotice.setExpSendTime(vo.getSendTime().plusMinutes(10)); + sysNoticeService.save(sysNotice); + } else { + JSONObject jsonObject = null; + try { + jsonObject = messageService.sendIvr(content, phone); + } catch (Exception e) { + log.error("发送IVR失败"); + } + //sys_notice新增已发送记录 + if (jsonObject != null) { + sysNotice.setRemark(jsonObject.getString("message")); + sysNotice.setSendStatus(jsonObject.getString("code")); + } + sysNotice.setAddFlag("1"); + sysNotice.setSendTime(LocalDateTime.now()); + sysNoticeService.save(sysNotice); + } + } + log.info("结束对象发送:"+object.getObjectName()); + } + } + + @Override + public void eastcomYwUpdateBriefingSendTypeSchedule() { + List list = ywNoticeModelService.list(new LambdaQueryWrapper().eq(YwNoticeModel::getModelSuitType, "3")); + for (YwNoticeModel model : list) { + String modelContent = model.getModelContent(); + if (hasContent(modelContent)) { + ywNoticeBriefingMapper.update(null, new LambdaUpdateWrapper() + .eq(YwNoticeBriefing::getModelId, model.getId()).set(YwNoticeBriefing::getSendType, "2")); + } else { + ywNoticeBriefingMapper.update(null, new LambdaUpdateWrapper() + .eq(YwNoticeBriefing::getModelId, model.getId()).set(YwNoticeBriefing::getSendType, "1")); + } + } + } + + private List getSysUsers(List ivrUsers) { + List sysUsers = sysUserService.selectUserByIds(ivrUsers); + if (CollUtil.isEmpty(sysUsers)) { + log.error("用户不存在"); + } + if (ivrUsers.size() != sysUsers.size()) { + log.error("未找到全部需发送用户"); + } + return sysUsers; + } + + private SysNotice getSysNotice(String content, YwNoticeBriefingPlanVO vo, List objectIds, YwNoticeObjectVO object) { + SysNotice sysNotice = new SysNotice(); + + sysNotice.setNoticeContent(content); + sysNotice.setStatus("0"); + sysNotice.setCreateBy("sys"); + sysNotice.setCreateTime(LocalDateTime.now()); + sysNotice.setUpdateBy("sys"); + sysNotice.setUpdateTime(LocalDateTime.now()); + sysNotice.setReciveUser(null); + sysNotice.setFlwProcessid(null); + sysNotice.setFlwTaskid(null); + sysNotice.setReciveUserPhone(null); + sysNotice.setExpSendTime(vo.getSendTime()); + sysNotice.setNoticeObjectId(objectIds); + sysNotice.setNoticeModelId(vo.getModelId()); + sysNotice.setModelScene("17"); + sysNotice.setObjectProto(vo.getObjectProto()); + sysNotice.setModelSuitType(vo.getModelSuitType()); + sysNotice.setHandworkId(vo.getId()); + + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + if (CollUtil.isNotEmpty(objectVOS)) { + sysNotice.setNoticeObjectNameStr(objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(","))); + } + + String name = ""; + if ("0".equals(vo.getObjectProto())) { + Long venueId = object.getVenueId(); + YwScene scene = ywSceneService.getById(venueId); + name = scene.getVenueName(); + } + if ("2".equals(vo.getObjectProto())) { + name = dictDataService.selectDictLabel("yw_city", object.getCity()); + } + sysNotice.setNoticeObject(name); + sysNotice.setNoticeTitle(name + "简报"); + return sysNotice; + } + + @Override + public JSONObject getJson(Long venueId, Integer timeInterval) { + JSONObject pm = null; + JSONObject mm = null; + JSONObject am = null; + try { + pm = pmKpiMonitorCellService.getReportKpiByJson(venueId.intValue(), null, null, timeInterval); + } catch (Exception e) { + e.printStackTrace(); + log.error("获取pm组装简报数据出错:" + e.getMessage()); + } + try { + mm = ywScenePictureService.listMatchTop3(venueId); + } catch (Exception e) { + e.printStackTrace(); + log.error("获取mm组装简报数据出错:" + e.getMessage()); + } + try { + am = ywScenePictureService.getAlarmTopDetail(venueId); + } catch (Exception e) { + e.printStackTrace(); + log.error("获取am组装简报数据出错:" + e.getMessage()); + } + JSONObject object = new JSONObject(); + YwScene scene = ywSceneService.getById(venueId); + object.put("venueId", scene.getId()); + object.put("venueName", scene.getVenueName()); + object.put("maintainType", scene.getMaintainType()); + String end = LocalDateTime.now().format(DateTimeFormatter.ofPattern("HH:mm")); + String bin = LocalDateTime.now().minusMinutes(timeInterval).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + object.put("sendTime", bin + "~" + end); + object.put("MM", mm); + object.put("AM", am); + object.put("PM", pm); + log.info("开始保存json文件到本地"); + String fileName = saveFile(object); + log.info("结束保存json文件到本地"); + object.put("fileName", fileName); + return object; + } + + private String saveFile(JSONObject object) { + String json = object.toJSONString(JSONWriter.Feature.PrettyFormat,JSONWriter.Feature.WriteMapNullValue); + String venueName = (String) object.get("venueName"); + String fileName = "test_" + UUID.randomUUID() + ".json"; + File file = new File(briefingJsonPath + fileName); + BufferedWriter writer = null; + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try { + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, false), StandardCharsets.UTF_8)); + writer.write(json); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (writer != null) { + writer.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + System.out.println("文件写入成功!"); + return fileName; + } + + @Override + public String assemblyVenueJsonToGetURL(LocalDateTime sendTime, Long venueId, Integer timeInterval) { + JSONObject json = getJson(venueId, timeInterval); + String fileName = json.getString("fileName"); +// File file = new File(briefingJsonPath + fileName); +// FileItem fileItem = this.getMultipartFile(file, "templFileItem"); +// MultipartFile multipartFile = new CommonsMultipartFile(fileItem); + Map map = new HashMap<>(); + map.put("confvalue", "asiagame"); + map.put("file", FileUtil.file(briefingJsonPath + fileName)); + log.info("开始上传json文件"); + String post = HttpUtil.post(briefingShortUrl, map); + log.info("结束上传json文件"); + return post; + } + + /** + * 将file转换成fileItem + * + * @param file + * @param fieldName + * @return + */ + private FileItem getMultipartFile(File file, String fieldName) { + FileItemFactory factory = new DiskFileItemFactory(16, null); + FileItem item = factory.createItem(fieldName, "text/plain", true, file.getName()); + int bytesRead = 0; + byte[] buffer = new byte[8192]; + try { + FileInputStream fis = new FileInputStream(file); + OutputStream os = item.getOutputStream(); + while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) { + os.write(buffer, 0, bytesRead); + } + os.close(); + fis.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return item; + } + + @Override + public String assemblyCountyJsonToGetURL(LocalDateTime sendTime, Long venueId, Integer timeInterval) { + KpiVenueReportVo reportKpi = pmKpiMonitorCellService.getReportKpi(venueId.intValue(), null, null, timeInterval); + if (reportKpi == null) { + log.info("当前没有性能数据"); + reportKpi = new KpiVenueReportVo(); + reportKpi.set开始时间(sendTime.minusMinutes(timeInterval)); + reportKpi.set结束时间(sendTime); + } + return "区县级h5简报"; + } + + @Override + public String assemblyCityJsonToGetURL(LocalDateTime sendTime, Long venueId, Integer timeInterval) { + return "地市级h5简报"; + } + + + @Override + public String assemblyVenueBriefing(LocalDateTime sendTime, Long venueId, Integer timeInterval, Long modelId) { + + JSONObject data = getJson(venueId, timeInterval); + YwNoticeModelVO modelVO = ywNoticeModelService.fetchById(modelId); + if (modelVO == null) { + throw new ServiceException("模板id" + modelId + "不存在"); + } + String modelContent = modelVO.getModelContent(); + YwScene scene = ywSceneService.getById(venueId); + + if ("A".equals(scene.getMaintainType())) { + String s = modelA(modelContent, data); + log.info("A类场馆简报:" + s); + return s; + } else if ("B".equals(scene.getMaintainType())) { + String s = modelB(modelContent, data); + log.info("B类场馆简报:" + s); + return s; + } + return "场馆未分AB类"; + } + + public String replacePlaceholder(String content, JsonNode jsonNode, Map map) { + for (Map.Entry entry : map.entrySet()) { + JsonNode valueNode = jsonNode.get(entry.getValue()); + String value = (valueNode != null) ? valueNode.asText() : "0"; + content = content.replace("${" + entry.getKey() + "}", value); + } + return content; + } + + private String modelA(String modelContent, JSONObject data) { + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode jsonNode = null; + try { + jsonNode = objectMapper.readTree(data.toJSONString()); + } catch (JsonProcessingException e) { + e.printStackTrace(); + log.error("json树转化错误:" + e.getMessage()); + } + if (jsonNode != null) { + JsonNode mm = jsonNode.get("MM"); + JsonNode am = jsonNode.get("AM"); + + Map map1 = new HashMap<>(); + map1.put("A类场馆名称", "venueName"); + map1.put("系统日期", "sendTime"); + + modelContent = replacePlaceholder(modelContent, jsonNode, map1); + if (mm != null) { + Map map = new HashMap<>(); + map.put("现场保障人员", "frontUser"); + map.put("后台保障人员", "backUser"); + map.put("场馆部署应急车", "emergencyCarNum"); + map.put("应急仓", "emergencyWarehouse"); + + map.put("AGIS专网网元总数", "agisNetNum"); + map.put("AGIS专网当前未恢复告警数", "agisAlarm"); + map.put("WIFI互联网网元总数", "internetNetNum"); + map.put("WIFI互联网当前未恢复告警数", "wifiAlarm"); + map.put("公网无线网元个数", "wxNetNum"); + map.put("无线当前未恢复告警数", "wxAlarm"); + map.put("专网传输设备套数", "privateTransportEquipNum"); + map.put("专网传输接入环个数", "privateInterfaceRingNum"); + map.put("专网传输当前未恢复告警数", "privateAlarm"); + map.put("公网传输设备套数", "publicTransportEquipNum"); + map.put("公网传输接入环个数", "publicInterfaceRingNum"); + map.put("公网传输当前未恢复告警数", "publicAlarm"); + + modelContent = replacePlaceholder(modelContent, mm, map); + } + + if (jsonNode.get("PM") != null) { + JsonNode pm4g = jsonNode.get("PM").get("kpiReport4gVo"); + JsonNode pm5g = jsonNode.get("PM").get("kpiReport5gVo"); + JsonNode kpiReportAgix = jsonNode.get("PM").get("kpiReportAgix"); + JsonNode kpiReportNet = jsonNode.get("PM").get("kpiReportNet"); + JsonNode kpiReportOpticalpowerTop5 = jsonNode.get("PM").get("kpiReportOpticalpower").get("opticalpowerTop5"); + if (pm4g != null) { + Map map = new HashMap<>(); + map.put("场馆总流量4G", "流量GB4g"); + map.put("上行平均干扰4G", "上行平均干扰4g"); + map.put("上行PRB利用率4G", "上行prb利用率4g"); + map.put("下行PRB利用率4G", "下行prb利用率4g"); + map.put("最大用户数4G", "最大用户数4g"); + map.put("无线接通率4G", "无线接通率4g"); + map.put("无线掉线率4G", "无线掉线率4g"); + + modelContent = replacePlaceholder(modelContent, pm4g, map); + } + if (pm5g != null) { + Map map = new HashMap<>(); + map.put("场馆总流量5G", "流量GB5g"); + map.put("小区RLC层下行丢包率5G", "小区RLC层下行丢包率5g"); + map.put("上行PRB利用率5G", "上行prb利用率5g"); + map.put("下行PRB利用率5G", "下行prb利用率5g"); + map.put("最大用户数5G", "最大用户数5g"); + map.put("平均用户数5G", "平均用户数5g"); + map.put("SN异常释放率5G", "sn异常释放率5g"); + map.put("SgNB添加成功率5G", "sgnb添加成功率5g"); + map.put("切换成功率5G", "切换成功率5g"); + map.put("无线接通率5G", "无线接通率5g"); + map.put("无线掉线率5G", "无线掉线率5g"); + + modelContent = replacePlaceholder(modelContent, pm5g, map); + } + if (kpiReportAgix != null) { + Map map = new HashMap<>(); + map.put("汇聚-核心链路平均时延", "convcoreavgdelay"); + map.put("汇聚-核心链路平均抖动", "convcoreavgjitter"); + map.put("汇聚-核心链路平均丢包", "convcoreavglpackratio"); + map.put("AGIS下行总流量", "dlconvcoreflow"); + map.put("AGIS上行总流量", "ulconvcoreflow"); + map.put("场馆出口下行流速", "dlvenuevelocity"); + map.put("场馆出口上行流速", "ulvenuevelocity"); + map.put("AGIS下行带宽利用率", "dlvenuebandratio"); + map.put("AGIS上行带宽利用率", "ulvenuebandratio"); + map.put("AGIS汇聚_CPU利用率", "conswitchcpuratio"); + map.put("AGIS汇聚_内存利用率", "convswitchramratio"); + map.put("AGIS接入_CPU利用率", "accessswitchcpuratio"); + map.put("AGIS接入_内存利用率", "accessswitchraratio"); + + modelContent = replacePlaceholder(modelContent, kpiReportAgix, map); + } + if (kpiReportNet != null) { + Map map = new HashMap<>(); + map.put("互联网场馆出口_下行流速", "dlvenuevelocity"); + map.put("互联网出口_上行流速", "ulvenuevelocity"); + map.put("互联网下行带宽利用率", "dlvenuebandratio"); + map.put("互联网上行带宽利用率", "ulvenuebandratio"); + + modelContent = replacePlaceholder(modelContent, kpiReportNet, map); + } + if (kpiReportOpticalpowerTop5 != null) { + //实时收光功率前五 + Iterator iterator = kpiReportOpticalpowerTop5.iterator(); + StringBuilder stringBuilder = new StringBuilder(); + while (iterator.hasNext()) { + JsonNode next = iterator.next(); + String mename = next.get("mename").asText(); + String portname = next.get("portname").asText(); + String inOpticalpower = next.get("inOpticalpower").asText(); + stringBuilder.append(mename).append("(").append(portname).append("):").append(inOpticalpower).append("\r\n"); + } + modelContent = modelContent.replace("${toplist}", stringBuilder.toString()); + } + } + } + + //去掉空数据 + if (modelContent.contains("场馆现有杭州移动现场保障人员0人,后台保障人员0人,场馆部署应急车0辆,应急仓0个")) { + modelContent = modelContent.replace("场馆现有杭州移动现场保障人员0人,后台保障人员0人,场馆部署应急车0辆,应急仓0个 。", ""); + } + if (modelContent.contains("现场保障人员0人")) { + modelContent = modelContent.replace("现场保障人员0人,", ""); + } + if (modelContent.contains("后台保障人员0人")) { + modelContent = modelContent.replace("后台保障人员0人,", ""); + } + if (modelContent.contains("场馆部署应急车0辆")) { + modelContent = modelContent.replace("场馆部署应急车0辆,", ""); + } + if (modelContent.contains("应急仓0个")) { + modelContent = modelContent.replace(",应急仓0个", ""); + } + if (modelContent.contains("汇聚交换机CPU占用率0.0%以内")) { + modelContent = modelContent.replace("汇聚交换机CPU占用率0.0%以内", "汇聚交换机CPU占用率0.0%"); + } + if (modelContent.contains("内存使用率0.0%以内")) { + modelContent = modelContent.replace("内存使用率0.0%以内", "内存使用率0.0%"); + } + + modelContent = modelContent.replaceAll("\\$\\{([^}]+)}", "0"); + return modelContent; + } + + private String modelB(String modelContent, JSONObject data) { + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode jsonNode = null; + try { + jsonNode = objectMapper.readTree(data.toJSONString()); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + if (jsonNode != null) { + JsonNode mm = jsonNode.get("MM"); + JsonNode am = jsonNode.get("AM"); + Map map1 = new HashMap<>(); + map1.put("B类场馆名称", "venueName"); + map1.put("系统日期", "sendTime"); + + modelContent = replacePlaceholder(modelContent, jsonNode, map1); + if (mm != null) { + Map map = new HashMap<>(); + map.put("现场保障人员", "frontUser"); + map.put("后台保障人员", "backUser"); + + map.put("公网无线网元个数", "wxNetNum"); + map.put("无线当前未恢复告警数", "wxAlarm"); + map.put("传输设备套数", "publicTransportEquipNum"); + map.put("传输接入环个数", "publicInterfaceRingNum"); + map.put("传输当前未恢复告警数", "publicAlarm"); + + modelContent = replacePlaceholder(modelContent, mm, map); + } + if (jsonNode.get("PM") != null) { + JsonNode pm4g = jsonNode.get("PM").get("kpiReport4gVo"); + JsonNode pm5g = jsonNode.get("PM").get("kpiReport5gVo"); + JsonNode kpiReportAgix = jsonNode.get("PM").get("kpiReportAgix"); + JsonNode kpiReportNet = jsonNode.get("PM").get("kpiReportNet"); + JsonNode kpiReportOpticalpowerTop5 = jsonNode.get("PM").get("kpiReportOpticalpower").get("opticalpowerTop5"); + if (pm4g != null) { + Map map = new HashMap<>(); + map.put("场馆总流量4G", "流量GB4g"); + map.put("上行平均干扰4G", "上行平均干扰4g"); + map.put("上行PRB利用率4G", "上行prb利用率4g"); + map.put("下行PRB利用率4G", "下行prb利用率4g"); + map.put("最大用户数4G", "最大用户数4g"); + map.put("无线接通率4G", "无线接通率4g"); + map.put("无线掉线率4G", "无线掉线率4g"); + + modelContent = replacePlaceholder(modelContent, pm4g, map); + } + + if (pm5g != null) { + Map map = new HashMap<>(); + map.put("场馆总流量5G", "流量GB5g"); + map.put("小区RLC层下行丢包率5G", "小区RLC层下行丢包率5g"); + map.put("上行PRB利用率5G", "上行prb利用率5g"); + map.put("下行PRB利用率5G", "下行prb利用率5g"); + map.put("最大用户数5G", "最大用户数5g"); + map.put("平均用户数5G", "平均用户数5g"); + map.put("SN异常释放率5G", "sn异常释放率5g"); + map.put("SgNB添加成功率5G", "sgnb添加成功率5g"); + map.put("切换成功率5G", "切换成功率5g"); + map.put("无线接通率5G", "无线接通率5g"); + map.put("无线掉线率5G", "无线掉线率5g"); + + modelContent = replacePlaceholder(modelContent, pm5g, map); + } + if (kpiReportAgix != null) { + Map map = new HashMap<>(); + map.put("汇聚-核心链路平均时延", "convcoreavgdelay"); + map.put("汇聚-核心链路平均抖动", "convcoreavgjitter"); + map.put("汇聚-核心链路平均丢包", "convcoreavglpackratio"); + map.put("AGIS下行总流量", "dlconvcoreflow"); + map.put("AGIS上行总流量", "ulconvcoreflow"); + map.put("场馆出口下行流速", "dlvenuevelocity"); + map.put("场馆出口上行流速", "ulvenuevelocity"); + map.put("AGIS下行带宽利用率", "dlvenuebandratio"); + map.put("AGIS上行带宽利用率", "ulvenuebandratio"); + map.put("AGIS汇聚_CPU利用率", "conswitchcpuratio"); + map.put("AGIS汇聚_内存利用率", "convswitchramratio"); + map.put("AGIS接入_CPU利用率", "accessswitchcpuratio"); + map.put("AGIS接入_内存利用率", "accessswitchraratio"); + + modelContent = replacePlaceholder(modelContent, kpiReportAgix, map); + } + if (kpiReportNet != null) { + Map map = new HashMap<>(); + map.put("互联网场馆出口_下行流速", "dlvenuevelocity"); + map.put("互联网出口_上行流速", "ulvenuevelocity"); + map.put("互联网下行带宽利用率", "dlvenuebandratio"); + map.put("互联网上行带宽利用率", "ulvenuebandratio"); + + modelContent = replacePlaceholder(modelContent, kpiReportNet, map); + } + if (kpiReportOpticalpowerTop5 != null) { + //实时收光功率前五 + Iterator iterator = kpiReportOpticalpowerTop5.iterator(); + StringBuilder stringBuilder = new StringBuilder(); + while (iterator.hasNext()) { + JsonNode next = iterator.next(); + String mename = next.get("mename").asText(); + String portname = next.get("portname").asText(); + String inOpticalpower = next.get("inOpticalpower").asText(); + stringBuilder.append(mename).append("(").append(portname).append("):").append(inOpticalpower).append("\r\n"); + } + modelContent = modelContent.replace("${toplist}", stringBuilder.toString()); + } + } + } + if (modelContent.contains("场馆现有杭州移动现场保障人员0人,后台保障人员0人")) { + modelContent = modelContent.replace("场馆现有杭州移动现场保障人员0人,后台保障人员0人 。", ""); + } + if (modelContent.contains("现场保障人员0人")) { + modelContent = modelContent.replace("现场保障人员0人,", ""); + } + if (modelContent.contains("后台保障人员0人")) { + modelContent = modelContent.replace(",后台保障人员0人", ""); + } + modelContent = modelContent.replaceAll("\\$\\{([^}]+)}", "0"); + return modelContent; + } + + + @Override + public String assemblyCityBriefing(LocalDateTime sendTime, String city, Integer timeInterval, Long modelId) { + List alarmStaticListVos = ywAlarmMapper.selectYwAlarmStaticList2("yyyy-mm-dd hh24:mi", sendTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), sendTime.plusMinutes(15).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), 2L); + AlarmStaticListVo alarmStaticListVo = new AlarmStaticListVo(); + if (CollUtil.isNotEmpty(alarmStaticListVos)) { + alarmStaticListVo = alarmStaticListVos.get(0); + } + String cityStr = sysDictDataService.selectDictLabel("yw_city", city); + +// try { + +// } catch (Exception e) { +// throw new ServiceException("查询性能数据失败"); +// } + List list = ywSceneMatchMapper.selectList(new LambdaQueryWrapper().eq(YwSceneMatchVo::getTaskStatus, "0").le(YwSceneMatchVo::getBeginTime, new Date()).ge(YwSceneMatchVo::getEndTime, new Date())); + if (CollUtil.isEmpty(list)) { + throw new ServiceException("当前时间没有赛事配置"); + } + List sceneIds = list.stream().map(YwSceneMatchVo::getSceneId).collect(Collectors.toList()); + List scenes = ywSceneService.list(new LambdaQueryWrapper().eq(YwScene::getCityId, city).in(YwScene::getId, sceneIds)); + if (CollUtil.isEmpty(scenes)) { + throw new ServiceException("场馆不存在" + sceneIds); + } + + String b = cityStr + "涉及赛事场馆" + scenes.size() + "个,其中" + "\n"; + StringBuilder f = new StringBuilder(); + String binTime = ""; + String endTime = ""; + for (int i = 0; i < scenes.size(); i++) { + KpiVenueReportVo reportKpi = null; + LocalDateTime bin = LocalDateTime.now(); + reportKpi = pmKpiMonitorCellService.getReportKpi(scenes.get(i).getId().intValue(), null, null, timeInterval); + LocalDateTime end = LocalDateTime.now(); + System.out.println("查询性能数据耗时:" + LocalDateTimeUtil.between(bin, end) + "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + if (reportKpi == null) { + f.append("\n").append(i + 1).append(".").append(scenes.get(i).getVenueName()).append("场馆当前没有性能数据"); + log.info("当前没有性能数据"); + reportKpi = new KpiVenueReportVo(); + reportKpi.set开始时间(sendTime.minusMinutes(timeInterval)); + reportKpi.set结束时间(sendTime); + } + JSONObject jsonObject = ywScenePictureService.listMatchTop3(scenes.get(i).getId()); + binTime = reportKpi.get开始时间().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")); + endTime = reportKpi.get结束时间().format(DateTimeFormatter.ofPattern("HH:mm")); + String e = (i + 1) + "." + scenes.get(i).getVenueName() + "场馆性能情况" + "\n" + + "1)总体情况:红线内外网元总数" + jsonObject.get("netTotalNum") + "个,保障区域网元均无异常告警" + jsonObject.get("totalAlarm") + "。杭州移动现场保障人员" + jsonObject.get("frontUser") + "人,后台保障人员" + jsonObject.get("backUser") + "人,场馆部署应急车" + jsonObject.get("emergencyCarNum") + "辆。\n" + + "2)传输情况:场馆保障共涉及传输设备" + jsonObject.get("transportEquipNum") + "台,接入环" + jsonObject.get("interfaceRingNum") + "个,目前环路状态、设备端口及业务连通性均正常,无告警" + jsonObject.get("csAlarm") + "。 \n" + + "3)4/5G公网情况:网元总数" + jsonObject.get("publicNetNum") + "个,无异常告警" + jsonObject.get("publicAlarm") + ",网络运行正常,网络性能数据正常。 \n"; + String c = "4)4G性能指标:总流量" + reportKpi.get流量GB4g() + "GB;" + + "无线接通率:" + reportKpi.get无线接通率4g() + "%;" + + "无线掉线率:" + reportKpi.get无线掉线率4g() + "%;\n" + + "上行平均干扰:" + reportKpi.get上行平均干扰4g() + ";\n" + + "单小区最高用户数:" + reportKpi.get最大用户数4g() + "个 " + + "(" + reportKpi.get最大用户数小区4g() + ");\n" + + "下行PRB利用率最高:" + reportKpi.get下行prb利用率4g() + "% " + + "(" + reportKpi.get下行prb利用率小区4g() + ");\n" + + "上行PRB利用率最高:" + reportKpi.get上行prb利用率4g() + "% " + + "(" + reportKpi.get上行prb利用率小区4g() + ");\n"; + String d = "5)5G性能指标:总流量" + reportKpi.get流量GB5g() + "GB;" + + "平均用户数:" + reportKpi.get平均用户数5g() + "个;" + + "最大用户数:" + reportKpi.get小区最大用户数5g() + "个;" + + "SN异常释放率:" + reportKpi.getSn异常释放率5g() + "%;" + + "SgNB添加成功率:" + reportKpi.getSgnb添加成功率5g() + "%;" + + "无线接通率:" + reportKpi.get无线接通率5g() + "%;" + + "无线掉线率:" + reportKpi.get无线掉线率5g() + "%;" + + "上行干扰值:" + reportKpi.get上行干扰值5g() + ";" + + "nsa_sgnb添加成功率:" + reportKpi.getSgnb添加成功率5g() + "%;" + + "切换成功率:" + reportKpi.get切换成功率5g() + "%;\n" + + "上行PRB平均利用率最高:" + reportKpi.get上行prb利用率5g() + "%" + + "(" + reportKpi.get上行prb利用率小区5g() + ")\n" + + "下行PRB平均利用率最高:" + reportKpi.get下行prb利用率5g() + "%" + + "(" + reportKpi.get下行prb利用率小区5g() + ")。\n"; + f = new StringBuilder(f + "\n" + e + c + d); + } + String a = "2023 " + cityStr + "亚运保障简报\n" + binTime + "~" + endTime + "\n"; + + return a + b + f; + } + + @Override + public String assemblyCountyBriefing(LocalDateTime sendTime, String county, Integer timeInterval) { + return "XX区县级简报"; + } + + @Override + public List getModel(Long venueId, String modelSuitType) { + List list = ywNoticeModelService.list(new LambdaQueryWrapper() + .eq(venueId != null, YwNoticeModel::getVenueId, venueId) + .and(i -> i.eq(YwNoticeModel::getModelSuitType, "3")).or().eq(YwNoticeModel::getModelSuitType, "4")); +// .eq(StrUtil.isNotBlank(modelSuitType),YwNoticeModel::getModelSuitType,modelSuitType)); + if (StrUtil.isNotBlank(modelSuitType)) { + list = list.stream().filter(l -> modelSuitType.equals(l.getModelSuitType())).collect(Collectors.toList()); + } + List ywNoticeModelVOS = YwNoticeModelConvert.INSTANCE.entityToVoList(list); + for (YwNoticeModelVO vo : ywNoticeModelVOS) { + String modelContent = vo.getModelContent(); + if (hasContent(modelContent)) { + vo.setSendTypeStr("手工发送"); + } else { + vo.setSendTypeStr("自动发送"); + } + } + return ywNoticeModelVOS; + } + + + private List calculationTimePoint(LocalDateTime beginTime, LocalDateTime endTime, + int timeInterval) { +// beginTime.minusMinutes() + return null; + } + + private void translate(YwNoticeBriefingVO vo) { + YwScene entity = ywSceneService.getById(vo.getVenueId()); + if (entity != null) { + vo.setVenueName(entity.getVenueName()); + } + YwNoticeModelVO modelVO = ywNoticeModelService.fetchById(vo.getModelId()); + vo.setNoticeModelIdStr(modelVO); + if (modelVO != null) { + vo.setModelName(modelVO.getModelName()); + } + List objectIds = vo.getObjectIds(); + if (CollUtil.isNotEmpty(objectIds)) { + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + if (CollUtil.isNotEmpty(objectVOS)) { + vo.setNoticeObjectIdStr(objectVOS); + vo.setObjectNameStr(objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(","))); + } + } + List split = vo.getNoticeType(); + ArrayList strings = new ArrayList<>(); + for (String s : split) { + String value = dictDataService.selectDictLabel("sys_notice_type", s); + strings.add(value); + } + vo.setNoticeTypeStr(JSONUtil.toJsonStr(strings)); + Long sendUser = vo.getSendUser(); + SysUser sysUser = sysUserService.selectUserById(sendUser); + if (sysUser != null) { + vo.setSendUserStr(sysUser.getNickName()); + vo.setSendUserPhoneStr(sysUser.getPhonenumber()); + } + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeHandworkServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeHandworkServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..3ec6b187216e9699fb2c16c078066c526ac41fa6 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeHandworkServiceImpl.java @@ -0,0 +1,382 @@ +package com.ruoyi.eastcom_yw.service.impl; + + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.domain.YwNoticeHandwork; +import com.ruoyi.eastcom_yw.domain.YwNoticeObject; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeHandworkDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeHandworkQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeBriefingVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeHandworkVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeObjectVO; +import com.ruoyi.eastcom_yw.mapper.YwNoticeHandworkMapper; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.eastcom_yw.service.convert.YwNoticeHandworkConvert; +import com.ruoyi.system.service.ISysDictDataService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 通知通告手工通知计划表 服务实现类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Service +@Slf4j +public class YwNoticeHandworkServiceImpl extends ServiceImpl implements YwNoticeHandworkService { + + @Resource + private YwNoticeHandworkMapper ywNoticeHandworkMapper; + + @Resource + private YwNoticeModelService ywNoticeModelService; + + @Resource + private YwNoticeObjectService ywNoticeObjectService; + + @Resource + private ISysDictDataService dictDataService; + + @Resource + private YwSceneService ywSceneService; + + @Resource + private SysNoticeService sysNoticeService; + + /** + * 通知通告手工通知计划表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwNoticeHandworkQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 通知名称 + .like(StrUtil.isNotBlank(qo.getNoticeName()), YwNoticeHandwork::getNoticeName, qo.getNoticeName()) + // 通知模板id + .eq(qo.getNoticeModel() != null, YwNoticeHandwork::getNoticeModel, qo.getNoticeModel()) + // 通知方式--sys_notice_type + .in(CollUtil.isNotEmpty(qo.getNoticeType()), YwNoticeHandwork::getNoticeType, qo.getNoticeType()) + // 通知对象ids + .in(CollUtil.isNotEmpty(qo.getNoticeObject()), YwNoticeHandwork::getNoticeObject, qo.getNoticeObject()) + // 通知内容 +// .eq(StrUtil.isNotBlank(qo.getNoticeContent()), YwNoticeHandwork::getNoticeContent, qo.getNoticeContent()) +// // 通知状态yw_veriy_status 0待提交 1待审核 2已审核 +// .in(CollUtil.isNotEmpty(qo.getNoticeStatus()), YwNoticeHandwork::getNoticeStatus, qo.getNoticeStatus()) + // 日期 + .between(qo.getBeginTime() != null && qo.getEndTime() != null, YwNoticeHandwork::getNoticeDate, qo.getBeginTime(), qo.getEndTime()) + // 开始时间 +// .eq(qo.getBeginTime() != null, YwNoticeHandwork::getBeginTime, qo.getBeginTime()) +// // 结束时间 +// .eq(qo.getEndTime() != null, YwNoticeHandwork::getEndTime, qo.getEndTime()) + // 时间间隔(单位分) +// .eq(qo.getTimeInterval() != null, YwNoticeHandwork::getTimeInterval, qo.getTimeInterval()) + .orderBy(true, false, YwNoticeHandwork::getId) + ; + List list = ywNoticeHandworkMapper.selectList(queryWrapper); + if (CollUtil.isEmpty(list)) { + return new ArrayList<>(); + } + List vos = YwNoticeHandworkConvert.INSTANCE.entityToVoList(list); + //翻译场馆、对象数组、模板 + for (YwNoticeHandworkVO vo : vos) { + String taskId = ywNoticeHandworkMapper.selectTaskIdByProcessId(vo.getFlwProcessid()); + vo.setTaskId(taskId); + translate(vo); + } + if (StrUtil.isNotBlank(qo.getKeyWord())) { + vos = vos.stream().filter(l -> l.getObjectNameStr().contains(qo.getKeyWord()) || l.getNoticeName().contains(qo.getKeyWord())).collect(Collectors.toList()); + } + return vos; + } + + /** + * 通知通告手工通知计划表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(YwNoticeHandworkQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + if (StrUtil.isNotBlank(qo.getKeyWord())) { + queryWrapper.and(i -> i.like(YwNoticeHandwork::getNoticeName, qo.getKeyWord()) + .or().like(YwNoticeHandwork::getNoticeObjectNameStr, qo.getKeyWord()) + .or().like(YwNoticeHandwork::getNoticeContent, qo.getKeyWord()) + ); + } + // 通知对象ids + if (CollUtil.isNotEmpty(qo.getNoticeObject())) { + queryWrapper.like(CollUtil.isNotEmpty(qo.getNoticeObject()), YwNoticeHandwork::getNoticeObject, qo.getNoticeObject().get(0)); + } + queryWrapper + // 通知名称 + .like(StrUtil.isNotBlank(qo.getNoticeName()), YwNoticeHandwork::getNoticeName, qo.getNoticeName()) + + // 通知模板id + .eq(qo.getNoticeModel() != null, YwNoticeHandwork::getNoticeModel, qo.getNoticeModel()) + // 通知方式--sys_notice_type + .in(CollUtil.isNotEmpty(qo.getNoticeType()), YwNoticeHandwork::getNoticeType, qo.getNoticeType()) + + // 通知内容 +// .eq(StrUtil.isNotBlank(qo.getNoticeContent()), YwNoticeHandwork::getNoticeContent, qo.getNoticeContent()) +// // 通知状态yw_veriy_status 0待提交 1待审核 2已审核 +// .in(CollUtil.isNotEmpty(qo.getNoticeStatus()), YwNoticeHandwork::getNoticeStatus, qo.getNoticeStatus()) + // 日期 + .between(qo.getBeginTime() != null && qo.getEndTime() != null, YwNoticeHandwork::getNoticeDate, qo.getBeginTime(), qo.getEndTime()) + // 开始时间 +// .eq(qo.getBeginTime() != null, YwNoticeHandwork::getBeginTime, qo.getBeginTime()) +// // 结束时间 +// .eq(qo.getEndTime() != null, YwNoticeHandwork::getEndTime, qo.getEndTime()) + // 时间间隔(单位分) +// .eq(qo.getTimeInterval() != null, YwNoticeHandwork::getTimeInterval, qo.getTimeInterval()) + .orderBy(true, false, YwNoticeHandwork::getId) + ; + + Page page = page(new Page<>(qo.getPageNum(), qo.getPageSize()), queryWrapper); + IPage voPage = page.convert(YwNoticeHandworkConvert.INSTANCE::entityToVo); + + List vos = voPage.getRecords(); + if (CollUtil.isEmpty(vos)) { + return new Page<>(); + } + for (YwNoticeHandworkVO vo : vos) { + String taskId = ywNoticeHandworkMapper.selectTaskIdByProcessId(vo.getFlwProcessid()); + vo.setTaskId(taskId); + translate(vo); + } +// if(StrUtil.isNotBlank(qo.getKeyWord())){ +// vos = vos.stream().filter(l -> l.getObjectNameStr().contains(qo.getKeyWord()) || l.getNoticeName().contains(qo.getKeyWord())).collect(Collectors.toList()); +// } + voPage.setRecords(vos); + return voPage; + } + + @Override + public YwNoticeHandworkVO fetchById(Long id) { + YwNoticeHandwork entity = ywNoticeHandworkMapper.selectById(id); + YwNoticeHandworkVO vo = YwNoticeHandworkConvert.INSTANCE.entityToVo(entity); + translate(vo); + return vo; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Long saveOrUpdate(YwNoticeHandworkDTO dto) { + YwNoticeHandwork entity = YwNoticeHandworkConvert.INSTANCE.dtoToEntity(dto); + if (CollUtil.isNotEmpty(entity.getNoticeObject())) { + List objectVOS = ywNoticeObjectService.fetchByIds(entity.getNoticeObject()); + if (CollUtil.isNotEmpty(objectVOS)) { + entity.setNoticeObjectNameStr(objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(","))); + } + } + entity.setAddFlag("0"); + saveOrUpdate(entity); + return entity.getId(); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywNoticeHandworkMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwNoticeHandworkQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + for (int i = 1; i < data.size() + 1; i++) { + YwNoticeHandworkVO vo = data.get(i - 1); + vo.setId((long) i); + } + ExcelUtil util = new ExcelUtil<>(YwNoticeHandworkVO.class); + util.hideColumn("reason"); + try { + util.exportExcel(response, data, "手工通知计划"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + saveBatch(list); + return AjaxResult.success(); + } + + @Override + @Transactional + public void eastcomSelectPassAndAddNoticeSchedule() { + //查询审核通过(name_ = 'processStatus' and text_ = '4')并且尚未添加到sys_notice的手工通知(add_flag = '0') + List ywNoticeHandworkList = ywNoticeHandworkMapper.selectPass(); + //添加到sys_notice + for (YwNoticeHandwork ywNoticeHandwork : ywNoticeHandworkList) { + List objectIds = ywNoticeHandwork.getNoticeObject(); + if (CollUtil.isEmpty(objectIds)) { + continue; + } + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + + String noticeType = ywNoticeHandwork.getNoticeType(); + List strings = JSONUtil.toList(noticeType, String.class); + if (CollUtil.isNotEmpty(objectVOS)) { + for (YwNoticeObjectVO vo : objectVOS) { + if (strings.contains("5") && StrUtil.isNotBlank(vo.getGroupId())) { + SysNotice sysNotice = getSysNotice(ywNoticeHandwork, objectIds, vo); + sysNotice.setNoticeType("5"); + sysNotice.setReciveUserPhone(null); + sysNotice.setNoticeObject(sysNotice.getNoticeObject() + ":" + vo.getGroupName()); + sysNotice.setGroupId(vo.getGroupId()); + + sysNoticeService.saveOrUpdate(sysNotice); + } + if (strings.contains("3") && CollUtil.isNotEmpty(vo.getMessageUsers())) { + SysNotice sysNotice = getSysNotice(ywNoticeHandwork, objectIds, vo); + sysNotice.setNoticeType("3"); + sysNotice.setReciveUserPhone(vo.getMessageUsersExcelPhoneStr()); + sysNotice.setNoticeObject(sysNotice.getNoticeObject() + ":" + vo.getMessageName()); + sysNotice.setGroupId(null); + + sysNoticeService.saveOrUpdate(sysNotice); + } + if (strings.contains("7") && CollUtil.isNotEmpty(vo.getIvrUsers())) { + SysNotice sysNotice = getSysNotice(ywNoticeHandwork, objectIds, vo); + sysNotice.setNoticeType("7"); + sysNotice.setReciveUserPhone(vo.getIvrUsersExcelPhoneStr()); + sysNotice.setNoticeObject(sysNotice.getNoticeObject() + ":" + vo.getIvrName()); + + sysNoticeService.saveOrUpdate(sysNotice); + } + } + ywNoticeHandwork.setAddFlag("1"); + ywNoticeHandworkMapper.updateById(ywNoticeHandwork); + } + } + } + + + private SysNotice getSysNotice(YwNoticeHandwork ywNoticeHandwork, List objectIds, YwNoticeObjectVO vo) { + SysNotice sysNotice = new SysNotice(); + sysNotice.setNoticeTitle(ywNoticeHandwork.getNoticeName()); + sysNotice.setNoticeContent(ywNoticeHandwork.getNoticeContent()); + sysNotice.setStatus("0"); + sysNotice.setCreateBy("sys"); + sysNotice.setCreateTime(LocalDateTime.now()); + sysNotice.setUpdateBy("sys"); + sysNotice.setUpdateTime(LocalDateTime.now()); + sysNotice.setFlwProcessid(ywNoticeHandwork.getFlwProcessid()); + sysNotice.setFlwTaskid(null); + sysNotice.setSendTime(null); + sysNotice.setSendStatus(null); + sysNotice.setExpSendTime(ywNoticeHandwork.getNoticeDate()); + sysNotice.setAddFlag("0"); + sysNotice.setModelSuitType("2"); + sysNotice.setHandworkId(ywNoticeHandwork.getId()); + sysNotice.setReciveUser(null); + sysNotice.setNoticeObjectId(objectIds); + sysNotice.setObjectProto(vo.getObjectProto()); + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + if (CollUtil.isNotEmpty(objectVOS)) { + sysNotice.setNoticeObjectNameStr(objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(","))); + } + + String name = ""; + if ("0".equals(vo.getObjectProto())) { + Long venueId = vo.getVenueId(); + YwScene scene = ywSceneService.getById(venueId); + name = scene.getVenueName(); + } + if ("1".equals(vo.getObjectProto())) { + name = dictDataService.selectDictLabel("yw_county", vo.getCounty()); + } + if ("2".equals(vo.getObjectProto())) { + name = dictDataService.selectDictLabel("yw_city", vo.getCity()); + } + Long modelId = ywNoticeHandwork.getNoticeModel(); + if (modelId != null) { + YwNoticeModelVO modelVO = ywNoticeModelService.fetchById(modelId); + if (modelVO != null) { + sysNotice.setNoticeModelId(modelVO.getId()); + sysNotice.setModelScene(modelVO.getModelScene()); + } + } + sysNotice.setNoticeObject(name); + return sysNotice; + } + + private void translate(YwNoticeHandworkVO vo) { + + YwNoticeModelVO modelVO = ywNoticeModelService.fetchById(vo.getNoticeModel()); + if (modelVO != null) { + vo.setNoticeModelIdStr(modelVO); + vo.setNoticeModelName(modelVO.getModelName()); + vo.setModelScene(modelVO.getModelScene()); + vo.setModelSceneStr(modelVO.getModelSceneStr()); + } + List objectIds = vo.getNoticeObject(); + if (CollUtil.isNotEmpty(objectIds)) { + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + if (CollUtil.isNotEmpty(objectVOS)) { + vo.setNoticeObjectIdStr(objectVOS); + vo.setNoticeObjectNameStr(objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(","))); + vo.setObjectNameStr(objectVOS.stream().map(YwNoticeObjectVO::getObjectName).collect(Collectors.joining(","))); + } + } + List split = vo.getNoticeType(); + ArrayList strings = new ArrayList<>(); + for (String s : split) { + String value = dictDataService.selectDictLabel("sys_notice_type", s); + strings.add(value); + } + vo.setNoticeTypeStr(JSONUtil.toJsonStr(strings)); + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeHandworkdetailServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeHandworkdetailServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e1416443ba1e39a1380cd954d6ab6b6547105157 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeHandworkdetailServiceImpl.java @@ -0,0 +1,153 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeHandworkdetail; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeHandworkdetailDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeHandworkdetailQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeHandworkdetailVO; +import com.ruoyi.eastcom_yw.mapper.YwNoticeHandworkdetailMapper; +import com.ruoyi.eastcom_yw.service.YwNoticeHandworkdetailService; +import com.ruoyi.eastcom_yw.service.convert.YwNoticeHandworkdetailConvert; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + *

+ * 通知通告手工通知审核表 服务实现类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Service +public class YwNoticeHandworkdetailServiceImpl extends ServiceImpl implements YwNoticeHandworkdetailService { + + @Resource + private YwNoticeHandworkdetailMapper ywNoticeHandworkdetailMapper; + + /** + * 通知通告手工通知审核表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwNoticeHandworkdetailQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 手工通知id + .eq(qo.getHandworkId() != null, YwNoticeHandworkdetail::getHandworkId, qo.getHandworkId()) + // 操作人(提交审核的人 或者 审核的人) + .eq(qo.getOprateUser() != null, YwNoticeHandworkdetail::getOprateUser, qo.getOprateUser()) + // 审核结果(关联字典表yw_veriy_result 0通过 1驳回) + .eq(StrUtil.isNotBlank(qo.getVeriyResult()), YwNoticeHandworkdetail::getVeriyResult, qo.getVeriyResult()) + // 审核状态(关联字典表yw_veriy_status 0 待审核 1 已审核) + .eq(StrUtil.isNotBlank(qo.getVeriyStatus()), YwNoticeHandworkdetail::getVeriyStatus, qo.getVeriyStatus()) + // 驳回原因 + .eq(StrUtil.isNotBlank(qo.getFailReason()), YwNoticeHandworkdetail::getFailReason, qo.getFailReason()) + // 附件 + .eq(StrUtil.isNotBlank(qo.getAppendix()), YwNoticeHandworkdetail::getAppendix, qo.getAppendix()) + ; + List list = ywNoticeHandworkdetailMapper.selectList(queryWrapper); + return YwNoticeHandworkdetailConvert.INSTANCE.entityToVoList(list); + } + + /** + * 通知通告手工通知审核表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(YwNoticeHandworkdetailQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 手工通知id + .eq(qo.getHandworkId() != null, YwNoticeHandworkdetail::getHandworkId, qo.getHandworkId()) + // 操作人(提交审核的人 或者 审核的人) + .eq(qo.getOprateUser() != null, YwNoticeHandworkdetail::getOprateUser, qo.getOprateUser()) + // 审核结果(关联字典表yw_veriy_result 0通过 1驳回) + .eq(StrUtil.isNotBlank(qo.getVeriyResult()), YwNoticeHandworkdetail::getVeriyResult, qo.getVeriyResult()) + // 审核状态(关联字典表yw_veriy_status 0 待审核 1 已审核) + .eq(StrUtil.isNotBlank(qo.getVeriyStatus()), YwNoticeHandworkdetail::getVeriyStatus, qo.getVeriyStatus()) + // 驳回原因 + .eq(StrUtil.isNotBlank(qo.getFailReason()), YwNoticeHandworkdetail::getFailReason, qo.getFailReason()) + // 附件 + .eq(StrUtil.isNotBlank(qo.getAppendix()), YwNoticeHandworkdetail::getAppendix, qo.getAppendix()) + ; + + Page page = page(new Page<>(qo.getPageNum(), qo.getPageSize()), queryWrapper); + IPage voPage = page.convert(YwNoticeHandworkdetailConvert.INSTANCE::entityToVo); + return voPage; + } + + @Override + public YwNoticeHandworkdetailVO fetchById(Long id) { + YwNoticeHandworkdetail entity = ywNoticeHandworkdetailMapper.selectById(id); + return YwNoticeHandworkdetailConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(YwNoticeHandworkdetailDTO dto) { + YwNoticeHandworkdetail entity = YwNoticeHandworkdetailConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywNoticeHandworkdetailMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwNoticeHandworkdetailQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(YwNoticeHandworkdetailVO.class); + try { + util.exportExcel(response, data, "通知通告手工通知审核表信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeListServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeListServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..617a43d3a1efcfa3ed6068662409e4701e661568 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeListServiceImpl.java @@ -0,0 +1,238 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeList; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeListDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeListQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeHandworkVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeListVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeObjectVO; +import com.ruoyi.eastcom_yw.mapper.YwNoticeListMapper; +import com.ruoyi.eastcom_yw.service.YwNoticeListService; +import com.ruoyi.eastcom_yw.service.YwNoticeModelService; +import com.ruoyi.eastcom_yw.service.YwNoticeObjectService; +import com.ruoyi.eastcom_yw.service.convert.YwNoticeHandworkConvert; +import com.ruoyi.eastcom_yw.service.convert.YwNoticeListConvert; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 通知通告记录表 服务实现类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Service +public class YwNoticeListServiceImpl extends ServiceImpl implements YwNoticeListService { + + @Resource + private YwNoticeListMapper ywNoticeListMapper; + + @Resource + private YwNoticeModelService ywNoticeModelService; + + @Resource + private YwNoticeObjectService ywNoticeObjectService; + + /** + * 通知通告记录表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwNoticeListQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper +// // 通知名称(关键字) + .like(StrUtil.isNotBlank(qo.getNoticeName()), YwNoticeList::getNoticeName, qo.getNoticeName()) + // 通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....) + .eq(StrUtil.isNotBlank(qo.getModelScene()), YwNoticeList::getModelScene, qo.getModelScene()) + // 对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层) + .eq(StrUtil.isNotBlank(qo.getObjectProto()), YwNoticeList::getObjectProto, qo.getObjectProto()) + // 通知方式--sys_notice_type + .eq(StrUtil.isNotBlank(qo.getNoticeType()), YwNoticeList::getNoticeType, qo.getNoticeType()) + // 通知时间(计划发送时间(同天当前时间之前立即发送)) +// .eq(qo.getNoticeTime() != null, YwNoticeList::getNoticeTime, qo.getNoticeTime()) +// // 通知对象 +// .eq(StrUtil.isNotBlank(qo.getNoticeObject()), YwNoticeList::getNoticeObject, qo.getNoticeObject()) +// // 通知内容 +// .eq(StrUtil.isNotBlank(qo.getNoticeContent()), YwNoticeList::getNoticeContent, qo.getNoticeContent()) +// // 状态 0未读 1已读 +// .in(CollUtil.isNotEmpty(qo.getStatus()), YwNoticeList::getStatus, qo.getStatus()) +// // 通知对象ids数组 +// .eq(StrUtil.isNotBlank(qo.getNoticeObjectId()), YwNoticeList::getNoticeObjectId, qo.getNoticeObjectId()) +// // 通知模板id +// .eq(qo.getNoticeModelId() != null, YwNoticeList::getNoticeModelId, qo.getNoticeModelId()) +// // 实际发送时间 + .orderBy(true,false, YwNoticeList::getSendTime) +// // 发送是否成功,1成功 0失败 +// .in(CollUtil.isNotEmpty(qo.getSendStatus()), YwNoticeList::getSendStatus, qo.getSendStatus()) +// // 计划发送时间(同天当前时间之前立即发送) +// .eq(qo.getExpSendTime() != null, YwNoticeList::getExpSendTime, qo.getExpSendTime()) +// // 加入定时任务标记 默认0未加入 1已加入 +// .in(CollUtil.isNotEmpty(qo.getAddFlag()), YwNoticeList::getAddFlag, qo.getAddFlag()) +// // 通知类型model_suit_type 1 普通 2 手工 3简报 +// .in(CollUtil.isNotEmpty(qo.getModelSuitType()), YwNoticeList::getModelSuitType, qo.getModelSuitType()) +// // 计划id(手工与简报会先配置计划) +// .eq(qo.getPlanId() != null, YwNoticeList::getPlanId, qo.getPlanId()) + ; + List list = ywNoticeListMapper.selectList(queryWrapper); + if(CollUtil.isEmpty(list)){ + return new ArrayList<>(); + } + List vos = YwNoticeListConvert.INSTANCE.entityToVoList(list); + //翻译场馆、对象数组、模板 + for (YwNoticeListVO vo : vos) { + translate(vo); + } + return vos; + } + + /** + * 通知通告记录表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(YwNoticeListQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper +// // 通知名称(关键字) + .like(StrUtil.isNotBlank(qo.getNoticeName()), YwNoticeList::getNoticeName, qo.getNoticeName()) + // 通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....) + .eq(StrUtil.isNotBlank(qo.getModelScene()), YwNoticeList::getModelScene, qo.getModelScene()) + // 对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层) + .eq(StrUtil.isNotBlank(qo.getObjectProto()), YwNoticeList::getObjectProto, qo.getObjectProto()) + // 通知方式--sys_notice_type + .eq(StrUtil.isNotBlank(qo.getNoticeType()), YwNoticeList::getNoticeType, qo.getNoticeType()) + // 通知时间(计划发送时间(同天当前时间之前立即发送)) +// .eq(qo.getNoticeTime() != null, YwNoticeList::getNoticeTime, qo.getNoticeTime()) +// // 通知对象 +// .eq(StrUtil.isNotBlank(qo.getNoticeObject()), YwNoticeList::getNoticeObject, qo.getNoticeObject()) +// // 通知内容 +// .eq(StrUtil.isNotBlank(qo.getNoticeContent()), YwNoticeList::getNoticeContent, qo.getNoticeContent()) +// // 状态 0未读 1已读 +// .in(CollUtil.isNotEmpty(qo.getStatus()), YwNoticeList::getStatus, qo.getStatus()) +// // 通知对象ids数组 +// .eq(StrUtil.isNotBlank(qo.getNoticeObjectId()), YwNoticeList::getNoticeObjectId, qo.getNoticeObjectId()) +// // 通知模板id +// .eq(qo.getNoticeModelId() != null, YwNoticeList::getNoticeModelId, qo.getNoticeModelId()) +// // 实际发送时间 + .orderBy(true,false, YwNoticeList::getSendTime) +// // 发送是否成功,1成功 0失败 +// .in(CollUtil.isNotEmpty(qo.getSendStatus()), YwNoticeList::getSendStatus, qo.getSendStatus()) +// // 计划发送时间(同天当前时间之前立即发送) +// .eq(qo.getExpSendTime() != null, YwNoticeList::getExpSendTime, qo.getExpSendTime()) +// // 加入定时任务标记 默认0未加入 1已加入 +// .in(CollUtil.isNotEmpty(qo.getAddFlag()), YwNoticeList::getAddFlag, qo.getAddFlag()) +// // 通知类型model_suit_type 1 普通 2 手工 3简报 +// .in(CollUtil.isNotEmpty(qo.getModelSuitType()), YwNoticeList::getModelSuitType, qo.getModelSuitType()) +// // 计划id(手工与简报会先配置计划) +// .eq(qo.getPlanId() != null, YwNoticeList::getPlanId, qo.getPlanId()) + ; + + Page page = page(new Page<>(qo.getPageNum(), qo.getPageSize()), queryWrapper); + IPage voPage = page.convert(YwNoticeListConvert.INSTANCE::entityToVo); + + List vos = voPage.getRecords(); + if(CollUtil.isEmpty(vos)){ + return new Page<>(); + } + for (YwNoticeListVO vo : vos) { + translate(vo); + } + voPage.setRecords(vos); + return voPage; + } + + @Override + public YwNoticeListVO fetchById(Long id) { + YwNoticeList entity = ywNoticeListMapper.selectById(id); + YwNoticeListVO vo = YwNoticeListConvert.INSTANCE.entityToVo(entity); + translate(vo); + return vo; + } + + @Override + public boolean saveOrUpdate(YwNoticeListDTO dto) { + YwNoticeList entity = YwNoticeListConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywNoticeListMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwNoticeListQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(YwNoticeListVO.class); + try { + util.exportExcel(response, data, "通知通告记录表信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } + + private void translate(YwNoticeListVO vo) { + + YwNoticeModelVO modelVO = ywNoticeModelService.fetchById(vo.getNoticeModelId()); + vo.setNoticeModelIdStr(modelVO); + + List objectIds = vo.getNoticeObjectId(); + if(CollUtil.isNotEmpty(objectIds)){ + List objectVOS = ywNoticeObjectService.fetchByIds(objectIds); + vo.setNoticeObjectIdStr(objectVOS); + } + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeModelServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeModelServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..54f442215c8604467e5d1a62f0f6f88158c0c74e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeModelServiceImpl.java @@ -0,0 +1,237 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeBriefing; +import com.ruoyi.eastcom_yw.domain.YwNoticeModel; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeModelDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeModelQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; +import com.ruoyi.eastcom_yw.mapper.YwNoticeBriefingMapper; +import com.ruoyi.eastcom_yw.mapper.YwNoticeModelMapper; +import com.ruoyi.eastcom_yw.service.YwNoticeModelService; +import com.ruoyi.eastcom_yw.service.convert.YwNoticeModelConvert; +import com.ruoyi.system.service.ISysDictDataService; +import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + *

+ * 通知通告模板表 服务实现类 + *

+ * + * @author ck + * @since 2023-04-07 + */ +@Service +public class YwNoticeModelServiceImpl extends ServiceImpl implements YwNoticeModelService { + + @Resource + private YwNoticeModelMapper ywNoticeModelMapper; + @Resource + private YwNoticeBriefingMapper ywNoticeBriefingMapper; + + @Resource + private ISysDictDataService sysDictDataService; + + /** + * 通知通告模板表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwNoticeModelQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 模板名称 + .like(StrUtil.isNotBlank(qo.getModelName()), YwNoticeModel::getModelName, qo.getModelName()) + // 模板内容 + .like(StrUtil.isNotBlank(qo.getModelContent()), YwNoticeModel::getModelContent, qo.getModelContent()) + // 场景--字典yw_notice_scene (0一般告警 1重大告警 ....) + .eq(StrUtil.isNotBlank(qo.getModelScene()), YwNoticeModel::getModelScene, qo.getModelScene()) + // 用户名称 + .like(StrUtil.isNotBlank(qo.getCreateBy()), YwNoticeModel::getCreateBy, qo.getCreateBy()) + // 创建时间 + .eq(qo.getCreateTime() != null, YwNoticeModel::getCreateTime, qo.getCreateTime()) + // 模板适用类型 1 普通 2 手工 3简报 + .eq(StrUtil.isNotBlank(qo.getModelSuitType()), YwNoticeModel::getModelSuitType, qo.getModelSuitType()) + // 备注(写一些触发要求) + .like(StrUtil.isNotBlank(qo.getModelDes()), YwNoticeModel::getModelDes, qo.getModelDes()) + // 模板类型--字典model_type 0事件触发型 + .eq(StrUtil.isNotBlank(qo.getModelType()), YwNoticeModel::getModelType, qo.getModelType()) + // 排序号 + .eq(qo.getOrderNum() != null, YwNoticeModel::getOrderNum, qo.getOrderNum()) + .orderBy(true, false, YwNoticeModel::getId) + ; + List list = ywNoticeModelMapper.selectList(queryWrapper); + List ywNoticeModelVOS = YwNoticeModelConvert.INSTANCE.entityToVoList(list); + for (YwNoticeModelVO vo : ywNoticeModelVOS) { + String modelContent = vo.getModelContent(); + if (hasContent(modelContent)) { + vo.setSendTypeStr("手工发送"); + } else { + vo.setSendTypeStr("自动发送"); + } + } + return ywNoticeModelVOS; + } + + private boolean hasContent(String modelContent) { + String s = StrUtil.cleanBlank(modelContent); + String[] split = s.split(" getDataByPage(YwNoticeModelQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 模板名称 + .like(StrUtil.isNotBlank(qo.getModelName()), YwNoticeModel::getModelName, qo.getModelName()) + // 模板内容 + .like(StrUtil.isNotBlank(qo.getModelContent()), YwNoticeModel::getModelContent, qo.getModelContent()) + // 场景--字典yw_notice_scene (0一般告警 1重大告警 ....) + .eq(StrUtil.isNotBlank(qo.getModelScene()), YwNoticeModel::getModelScene, qo.getModelScene()) + // 用户名称 + .like(StrUtil.isNotBlank(qo.getCreateBy()), YwNoticeModel::getCreateBy, qo.getCreateBy()) + // 创建时间 + .eq(qo.getCreateTime() != null, YwNoticeModel::getCreateTime, qo.getCreateTime()) + // 模板适用类型 1 普通 2 手工 3简报 + .eq(StrUtil.isNotBlank(qo.getModelSuitType()), YwNoticeModel::getModelSuitType, qo.getModelSuitType()) + // 备注(写一些触发要求) + .like(StrUtil.isNotBlank(qo.getModelDes()), YwNoticeModel::getModelDes, qo.getModelDes()) + // 模板类型--字典model_type 0事件触发型 + .eq(StrUtil.isNotBlank(qo.getModelType()), YwNoticeModel::getModelType, qo.getModelType()) + // 排序号 + .eq(qo.getOrderNum() != null, YwNoticeModel::getOrderNum, qo.getOrderNum()) + .orderBy(true, false, YwNoticeModel::getId) + ; + + Page page = page(new Page<>(qo.getPageNum(), qo.getPageSize()), queryWrapper); + IPage voPage = page.convert(YwNoticeModelConvert.INSTANCE::entityToVo); + + List ywNoticeModelVOS = voPage.getRecords(); + for (YwNoticeModelVO vo : ywNoticeModelVOS) { + String modelContent = vo.getModelContent(); + if (hasContent(modelContent)) { + vo.setSendTypeStr("手工发送"); + } else { + vo.setSendTypeStr("自动发送"); + } + } + voPage.setRecords(ywNoticeModelVOS); + return voPage; + } + + @Override + public YwNoticeModelVO fetchById(Long id) { + YwNoticeModel ywNoticeModel = ywNoticeModelMapper.selectById(id); + YwNoticeModelVO modelVO = YwNoticeModelConvert.INSTANCE.entityToVo(ywNoticeModel); + if (modelVO != null) { + translate(modelVO); + } + return modelVO; + } + + @Override + public boolean saveOrUpdate(YwNoticeModelDTO dto) { + YwNoticeModel entity = YwNoticeModelConvert.INSTANCE.dtoToEntity(dto); + if (entity.getId() != null&&"3".equals(entity.getModelSuitType())) { + String modelContent = entity.getModelContent(); + String newModelContent = modelContent.replaceAll("(\\s*)", "(在此输入其他性能数据)").replaceAll("\\(\\s*\\)", "(在此输入其他性能数据)"); + entity.setModelContent(newModelContent); + if (hasContent(modelContent)) { + ywNoticeBriefingMapper.update(null, new LambdaUpdateWrapper() + .eq(YwNoticeBriefing::getModelId, entity.getId()).set(YwNoticeBriefing::getSendType, "2")); + } else { + ywNoticeBriefingMapper.update(null, new LambdaUpdateWrapper() + .eq(YwNoticeBriefing::getModelId, entity.getId()).set(YwNoticeBriefing::getSendType, "1")); + } + } + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywNoticeModelMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwNoticeModelQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + for (int i = 1; i < data.size() + 1; i++) { + YwNoticeModelVO vo = data.get(i - 1); + vo.setId((long) i); + } + ExcelUtil util = new ExcelUtil<>(YwNoticeModelVO.class); + util.hideColumn("reason"); + try { + util.exportExcel(response, data, "通知通告模板表信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 +// boolean checkFlag; +// checkFlag = checkData(cs, ywSceneList); +// if (checkFlag) { +// checkFlag = checkUnique(cs); +// } +// if (!checkFlag) { +// ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); +// String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); +// return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); +// } + saveBatch(list); + return AjaxResult.success(); + + } + + private void translate(YwNoticeModelVO vo) { + String ywNoticeScene = sysDictDataService.selectDictLabel("yw_notice_scene", vo.getModelSuitType()); + vo.setModelSceneStr(ywNoticeScene); + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeObjectServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeObjectServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7b387f59b5eb5ff486eba54000aadd91c46d3f9f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeObjectServiceImpl.java @@ -0,0 +1,607 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeObject; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeObjectDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeObjectQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeObjectVO; +import com.ruoyi.eastcom_yw.mapper.YwNoticeObjectMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.service.YwNoticeObjectService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.convert.YwNoticeObjectConvert; +import com.ruoyi.system.service.ISysDictDataService; +import com.ruoyi.system.service.ISysDictTypeService; +import com.ruoyi.system.service.ISysUserService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 通知通告对象表 服务实现类 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Service +public class YwNoticeObjectServiceImpl extends ServiceImpl implements YwNoticeObjectService { + + @Resource + private YwNoticeObjectMapper ywNoticeObjectMapper; + + @Resource + private YwSceneService ywSceneService; + + @Resource + private YwSceneMapper ywSceneMapper; + + @Resource + private ISysUserService sysUserService; + + @Resource + private ISysDictDataService sysDictDataService; + + @Resource + private ISysDictTypeService sysDictTypeService; + + /** + * 通知通告对象表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwNoticeObjectQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 地市 + .eq(StrUtil.isNotBlank(qo.getCity()), YwNoticeObject::getCity, qo.getCity()) + // 区县 + .eq(StrUtil.isNotBlank(qo.getCounty()), YwNoticeObject::getCounty, qo.getCounty()) + // 场馆id + .in(CollUtil.isNotEmpty(qo.getVenueId()), YwNoticeObject::getVenueId, qo.getVenueId()) + // 专业 +// .eq(qo.getSpecialty() != null, YwNoticeObject::getSpecialty, qo.getSpecialty()) + // 角色id数组 +// .eq(StrUtil.isNotBlank(qo.getRoleIds()), YwNoticeObject::getRoleIds, qo.getRoleIds()) + // 对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层) + .eq(StrUtil.isNotBlank(qo.getObjectProto()), YwNoticeObject::getObjectProto, qo.getObjectProto()) + // 通知方式sys_notice_type +// .in(CollUtil.isNotEmpty(qo.getNoticeType()), YwNoticeObject::getNoticeType, qo.getNoticeType()) +// // 短信组名 +// .eq(StrUtil.isNotBlank(qo.getMessageName()), YwNoticeObject::getMessageName, qo.getMessageName()) +// // 短信组内成员id数组 +// .eq(StrUtil.isNotBlank(qo.getMessageUsers()), YwNoticeObject::getMessageUsers, qo.getMessageUsers()) +// // 排序号 +// .eq(qo.getOrder() != null, YwNoticeObject::getOrder, qo.getOrder()) +// // 群号 +// .eq(StrUtil.isNotBlank(qo.getGroupId()), YwNoticeObject::getGroupId, qo.getGroupId()) +// // 群名 +// .eq(StrUtil.isNotBlank(qo.getGroupName()), YwNoticeObject::getGroupName, qo.getGroupName()) +// // 备注 +// .eq(StrUtil.isNotBlank(qo.getGroupDes()), YwNoticeObject::getGroupDes, qo.getGroupDes()) + // 对象名称 + .like(StrUtil.isNotBlank(qo.getKeyWord()), YwNoticeObject::getObjectName, qo.getObjectName()) + // ivr组名 +// .eq(StrUtil.isNotBlank(qo.getIvrName()), YwNoticeObject::getIvrName, qo.getIvrName()) +// // ivr组内成员id数组 +// .eq(StrUtil.isNotBlank(qo.getIvrUsers()), YwNoticeObject::getIvrUsers, qo.getIvrUsers()) + //手工通知:查询条件“通知对象”,按选项升序排序(先按数字,再按首字母) + .last("ORDER BY convert_to(object_name,'GB18030')") + ; + List list = ywNoticeObjectMapper.selectList(queryWrapper); + List vos = YwNoticeObjectConvert.INSTANCE.entityToVoList(list); + //翻译场馆和用户名 + for (YwNoticeObjectVO vo : vos) { + translate(vo); + } + return vos; + } + + /** + * 通知通告对象表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(YwNoticeObjectQO qo) { + + if (CollUtil.isEmpty(qo.getVenueId())&&(StrUtil.isNotBlank(qo.getVenueType())||StrUtil.isNotBlank(qo.getMaintainType()))) { + List ywSceneList = ywSceneMapper.selectList(new LambdaQueryWrapper().eq(StrUtil.isNotBlank(qo.getVenueType()), YwScene::getVenueType, qo.getVenueType()) + .eq(StrUtil.isNotBlank(qo.getMaintainType()), YwScene::getMaintainType, qo.getMaintainType())); + if(CollUtil.isNotEmpty(ywSceneList)){ + List venueIds = ywSceneList.stream().map(YwScene::getId).collect(Collectors.toList()); + qo.setVenueId(venueIds); + } + } + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 地市 + .eq(StrUtil.isNotBlank(qo.getCity()), YwNoticeObject::getCity, qo.getCity()) + // 区县 + .eq(StrUtil.isNotBlank(qo.getCounty()), YwNoticeObject::getCounty, qo.getCounty()) + // 场馆id + .in(CollUtil.isNotEmpty(qo.getVenueId()), YwNoticeObject::getVenueId, qo.getVenueId()) + // 专业 +// .eq(qo.getSpecialty() != null, YwNoticeObject::getSpecialty, qo.getSpecialty()) + // 角色id数组 +// .eq(StrUtil.isNotBlank(qo.getRoleIds()), YwNoticeObject::getRoleIds, qo.getRoleIds()) + // 对象属性yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层) + .eq(StrUtil.isNotBlank(qo.getObjectProto()), YwNoticeObject::getObjectProto, qo.getObjectProto()) + // 通知方式sys_notice_type +// .in(CollUtil.isNotEmpty(qo.getNoticeType()), YwNoticeObject::getNoticeType, qo.getNoticeType()) +// // 短信组名 +// .eq(StrUtil.isNotBlank(qo.getMessageName()), YwNoticeObject::getMessageName, qo.getMessageName()) +// // 短信组内成员id数组 +// .eq(StrUtil.isNotBlank(qo.getMessageUsers()), YwNoticeObject::getMessageUsers, qo.getMessageUsers()) +// // 排序号 +// .eq(qo.getOrder() != null, YwNoticeObject::getOrder, qo.getOrder()) +// // 群号 +// .eq(StrUtil.isNotBlank(qo.getGroupId()), YwNoticeObject::getGroupId, qo.getGroupId()) +// // 群名 +// .eq(StrUtil.isNotBlank(qo.getGroupName()), YwNoticeObject::getGroupName, qo.getGroupName()) +// // 备注 +// .eq(StrUtil.isNotBlank(qo.getGroupDes()), YwNoticeObject::getGroupDes, qo.getGroupDes()) + // 对象名称 + .like(StrUtil.isNotBlank(qo.getObjectName()), YwNoticeObject::getObjectName, qo.getObjectName()) + // 关键字 + .like(StrUtil.isNotBlank(qo.getKeyWord()), YwNoticeObject::getObjectName, qo.getKeyWord()) + // ivr组名 +// .eq(StrUtil.isNotBlank(qo.getIvrName()), YwNoticeObject::getIvrName, qo.getIvrName()) +// // ivr组内成员id数组 +// .eq(StrUtil.isNotBlank(qo.getIvrUsers()), YwNoticeObject::getIvrUsers, qo.getIvrUsers()) +// .orderBy(true, false, YwNoticeObject::getId) + //手工通知:查询条件“通知对象”,按选项升序排序(先按数字,再按首字母) + .last("ORDER BY convert_to(object_name,'GB18030')") + ; + + Page page = page(new Page<>(qo.getPageNum(), qo.getPageSize()), queryWrapper); + IPage voPage = page.convert(YwNoticeObjectConvert.INSTANCE::entityToVo); + + List vos = voPage.getRecords(); + //翻译场馆和用户名 + for (YwNoticeObjectVO vo : vos) { + translate(vo); + } + voPage.setRecords(vos); + return voPage; + } + + @Override + public List fetchByIds(List ids) { + List entityList = ywNoticeObjectMapper.selectBatchIds(ids); + List vos = YwNoticeObjectConvert.INSTANCE.entityToVoList(entityList); + if (CollUtil.isNotEmpty(entityList)) { + for (YwNoticeObjectVO vo : vos) { + translate(vo); + } + } + return vos; + } + + @Override + public YwNoticeObjectVO fetchById(Long id) { + YwNoticeObject entity = ywNoticeObjectMapper.selectById(id); + YwNoticeObjectVO vo = YwNoticeObjectConvert.INSTANCE.entityToVo(entity); + translate(vo); + return vo; + } + + @Override + public boolean saveOrUpdate(YwNoticeObjectDTO dto) { + if (StrUtil.isBlank(dto.getGroupId()) && CollUtil.isEmpty(dto.getMessageUsers()) && CollUtil.isEmpty(dto.getIvrUsers())) { + throw new ServiceException("请至少填写一项通知方式!移动办公需填写群号,短信IVR则需选择成员"); + } + YwNoticeObject entity = YwNoticeObjectConvert.INSTANCE.dtoToEntity(dto); + if (dto.getId() == null) { + List ywNoticeObjects = ywNoticeObjectMapper.selectList(new LambdaQueryWrapper().eq(YwNoticeObject::getObjectName, dto.getObjectName())); + if (CollUtil.isNotEmpty(ywNoticeObjects)) { + throw new ServiceException("对象名称已存在"); + } + } + if ("0".equals(entity.getObjectProto())) { + YwScene scene = ywSceneService.getById(dto.getVenueId()); + //根据场馆查地市区域 + entity.setCity(scene.getCityId()); + entity.setCounty(scene.getAreaCountyId()); + } + if ("1".equals(entity.getObjectProto())) { + //根据区域查地市 + entity.setCity(entity.getCounty().substring(0, 4)); + } + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywNoticeObjectMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwNoticeObjectQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + for (int i = 1; i < data.size() + 1; i++) { + YwNoticeObjectVO vo = data.get(i - 1); + vo.setId((long) i); + } + ExcelUtil util = new ExcelUtil<>(YwNoticeObjectVO.class); + util.hideColumn("reason"); + try { + util.exportExcel(response, data, "通知通告对象表信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + @Transactional + public AjaxResult importData(List list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + for (YwNoticeObjectVO vo : list) { + if (vo == null) { + return AjaxResult.error("导入模板不正确。"); + } + if (StrUtil.isBlank(vo.getGroupId()) && StrUtil.isBlank(vo.getMessageName()) && StrUtil.isBlank(vo.getIvrName())) { + return AjaxResult.error("导入模板不正确。"); + } + } + boolean checkFlag = true; + + for (int i = 0; i < list.size(); i++) { + StringBuilder builder = new StringBuilder(); + YwNoticeObjectVO vo = list.get(i); + if (StrUtil.isBlank(vo.getObjectName())) { + builder.append("【对象名称】不能为空;"); + checkFlag = false; + } + if (StrUtil.isBlank(vo.getObjectProto())) { + builder.append("【对象属性】为空;"); + checkFlag = false; + } + List yw_notice_object = sysDictTypeService.selectDictDataByType("yw_notice_object").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + if (!yw_notice_object.contains(vo.getObjectProto())) { + builder.append("【对象属性】不存在"); + checkFlag = false; + } + if ("0".equals(vo.getObjectProto())) { + if (StrUtil.isBlank(vo.getVenueName())) { + builder.append("【场馆名】不能为空;"); + checkFlag = false; + } else { + String venueName = vo.getVenueName(); + List scenes = ywSceneService.list(new LambdaQueryWrapper().eq(YwScene::getVenueName, venueName)); + if (CollUtil.isEmpty(scenes)) { + builder.append("【场馆名】不存在;"); + checkFlag = false; + } + } + } + + + if ("1".equals(vo.getObjectProto())) { + if(StrUtil.isBlank(vo.getCounty())) { + builder.append("【区县】为空;"); + checkFlag = false; + }else { + List yw_county = sysDictTypeService.selectDictDataByType("yw_county").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + if (!yw_county.contains(vo.getCounty())) { + builder.append("【区县】不存在;"); + checkFlag = false; + } + } + } + if ("2".equals(vo.getObjectProto())) { + if(StrUtil.isBlank(vo.getCity())) { + builder.append("【地市】为空;"); + checkFlag = false; + }else { + List yw_city = sysDictTypeService.selectDictDataByType("yw_city").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); + if (!yw_city.contains(vo.getCity())) { + builder.append("【地市】不存在;"); + checkFlag = false; + } + } + } + if (StrUtil.isBlank(vo.getGroupId()) && StrUtil.isEmpty(vo.getMessageUsersExcelPhoneStr()) && StrUtil.isEmpty(vo.getIvrUsersExcelPhoneStr())) { + builder.append("请至少填写一项通知方式!移动办公需填写群号,短信IVR则需选择成员;"); + checkFlag = false; + } + +// 校验手机号是否存在 + String messageUsersExcelPhoneStr = vo.getMessageUsersExcelPhoneStr(); + if (StrUtil.isNotBlank(messageUsersExcelPhoneStr)) { + String[] strings = messageUsersExcelPhoneStr.split(","); + for (String string : strings) { + SysUser sysUser = sysUserService.selectUserByPhone(string); + if (sysUser == null) { + builder.append("短信组内手机号码:").append(string).append(",在系统中不存在;"); + checkFlag = false; + } + } + } + + String ivrUsersExcelPhoneStr = vo.getIvrUsersExcelPhoneStr(); + if (StrUtil.isNotBlank(ivrUsersExcelPhoneStr)) { + String[] strings = ivrUsersExcelPhoneStr.split(","); + for (String string : strings) { + SysUser sysUser = sysUserService.selectUserByPhone(string); + if (sysUser == null) { + builder.append("IVR组内手机号码:").append(string).append(",在系统中不存在;"); + checkFlag = false; + } + } + } + //校验姓名是否存在 + String messageUsersExcelStr = vo.getMessageUsersExcelStr(); + if (StrUtil.isNotBlank(messageUsersExcelStr)) { + String[] strings = messageUsersExcelStr.split(","); + for (String string : strings) { + List sysUsers = sysUserService.selectUserByNickName(string); + if (CollUtil.isEmpty(sysUsers)) { + builder.append("短信组内成员:").append(string).append(",在系统中不存在;"); + checkFlag = false; + } + } + } + + String ivrUsersExcelStr = vo.getIvrUsersExcelStr(); + if (StrUtil.isNotBlank(ivrUsersExcelStr)) { + String[] strings = ivrUsersExcelStr.split(","); + for (String string : strings) { + List sysUsers = sysUserService.selectUserByNickName(string); + if (CollUtil.isEmpty(sysUsers)) { + builder.append("IVR组内成员:").append(string).append(",在系统中不存在;"); + checkFlag = false; + } + } + } + + //校验姓名+手机号是否存在 +// String messageUsersExcelStr = vo.getMessageUsersExcelStr(); +// String messageUsersExcelPhoneStr = vo.getMessageUsersExcelPhoneStr(); + if (StrUtil.isNotBlank(messageUsersExcelPhoneStr) || StrUtil.isNotBlank(messageUsersExcelStr)) { + String[] nicknames = messageUsersExcelStr.split(","); + String[] phones = messageUsersExcelPhoneStr.split(","); + if (nicknames.length != phones.length) { + builder.append("短信组用户姓名与手机号个数不匹配"); + checkFlag = false; + } else { + for (int j = 0; j < nicknames.length; j++) { + String nickname = nicknames[j]; + String phone = phones[j]; + SysUser sysUser = sysUserService.selectUserByNickNameAndPhone(nickname, phone); + if (sysUser==null) { + builder.append("短信组").append(nickname).append("+").append(phone).append(":组合不存在;"); + checkFlag = false; + } + } + } + } + + if (StrUtil.isNotBlank(ivrUsersExcelPhoneStr) || StrUtil.isNotBlank(ivrUsersExcelStr)) { + String[] nicknames = ivrUsersExcelStr.split(","); + String[] phones = ivrUsersExcelPhoneStr.split(","); + if (nicknames.length != phones.length) { + builder.append("IVR组用户姓名与手机号个数不匹配"); + checkFlag = false; + } else { + for (int j = 0; j < nicknames.length; j++) { + String nickname = nicknames[j]; + String phone = phones[j]; + SysUser sysUser = sysUserService.selectUserByNickNameAndPhone(nickname, phone); + if (sysUser==null) { + builder.append("IVR组").append(nickname).append("+").append(phone).append(":组合不存在;"); + checkFlag = false; + } + } + } + } + vo.setReason(builder.toString()); + } + if (checkFlag) { + checkFlag = checkUnique(list); + } + if (!checkFlag) { + ExcelUtil util = new ExcelUtil<>(YwNoticeObjectVO.class); + String fileName = (String) util.exportExcel(list, "通知对象导入结果").get(AjaxResult.MSG_TAG); + return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + } else { + importList(list); + } + + return AjaxResult.success(); + } + + private void importList(List list) { + ArrayList ywNoticeObjects = new ArrayList<>(); + for (YwNoticeObjectVO vo : list) { + YwNoticeObject entity = new YwNoticeObject(); + entity.setCity(vo.getCity()); + entity.setCounty(vo.getCounty()); + entity.setObjectName(vo.getObjectName()); + if ("0".equals(vo.getObjectProto())) { + String venueName = vo.getVenueName(); + List scenes = ywSceneService.list(new LambdaQueryWrapper().eq(YwScene::getVenueName, venueName)); + if (CollUtil.isNotEmpty(scenes)) { + YwScene scene = scenes.get(0); + entity.setVenueId(scene.getId()); + entity.setCounty(scene.getAreaCountyId()); + entity.setCity(scene.getAreaCountyId().substring(0, 4)); + } + + } + if ("1".equals(vo.getObjectProto())) { + entity.setCity(vo.getCounty().substring(0, 4)); + } + entity.setObjectProto(vo.getObjectProto()); + entity.setMessageName(vo.getMessageName()); + String messageUsersExcelPhoneStr = vo.getMessageUsersExcelPhoneStr(); + if (StrUtil.isNotBlank(messageUsersExcelPhoneStr)) { + String[] strings = messageUsersExcelPhoneStr.split(","); + List sysUsers = sysUserService.selectUserListByPhones(strings); + if (CollUtil.isNotEmpty(sysUsers)) { + List userIds = sysUsers.stream().map(SysUser::getUserId).collect(Collectors.toList()); + entity.setMessageUsers(userIds); + } + } + + entity.setGroupId(vo.getGroupId()); + entity.setGroupName(vo.getGroupName()); + entity.setGroupDes(vo.getGroupDes()); + entity.setIvrName(vo.getIvrName()); + String ivrUsersExcelPhoneStr = vo.getIvrUsersExcelPhoneStr(); + if (StrUtil.isNotBlank(ivrUsersExcelPhoneStr)) { + String[] strings = ivrUsersExcelPhoneStr.split(","); + List sysUsers = sysUserService.selectUserListByPhones(strings); + if (CollUtil.isNotEmpty(sysUsers)) { + List userIds = sysUsers.stream().map(SysUser::getUserId).collect(Collectors.toList()); + entity.setIvrUsers(userIds); + } + } + //查询是否存在对象名称相同的数据,如果存在则更新 + YwNoticeObject object = ywNoticeObjectMapper.selectOne(new LambdaQueryWrapper().in(YwNoticeObject::getObjectName, vo.getObjectName())); + if (object != null) { + entity.setId(object.getId()); + ywNoticeObjectMapper.updateById(entity); + } else { + ywNoticeObjects.add(entity); + } + } + saveBatch(ywNoticeObjects); + + } + + private boolean checkUnique(List vos) { + boolean checkFlag = true; + List matchNameList = new ArrayList<>(); + for (YwNoticeObjectVO imp : vos) { + StringBuilder reason = new StringBuilder(); + if (matchNameList.contains(imp.getObjectName())) { + checkFlag = false; + reason.append("表格中多条记录对象名称有重复。"); + } + matchNameList.add(imp.getObjectName()); + imp.setReason(reason.toString()); + } + return checkFlag; + } + + @Override + public Map allObject() { + List data = this.getData(new YwNoticeObjectQO()); + List venueIds = data.stream().map(YwNoticeObjectVO::getVenueId).distinct().collect(Collectors.toList()); + List ywSceneList = ywSceneService.listByIds(venueIds); + if (CollUtil.isEmpty(ywSceneList)) { + return new HashMap(); + } + List ids = ywSceneList.stream().map(YwScene::getId).collect(Collectors.toList()); + venueIds.removeAll(ids); + List list = data.stream().filter(l -> !("0".equals(l.getObjectProto()) && venueIds.contains(l.getVenueId()))).collect(Collectors.toList()); +// 过滤出包含移动办公的 + List collect = list.stream().filter(l -> StrUtil.isNotBlank(l.getGroupId())).collect(Collectors.toList()); + Map>>> map = collect.stream().collect(Collectors.groupingBy(l -> { + String label = sysDictDataService.selectDictLabel("yw_notice_object", l.getObjectProto()); + return l.getObjectProto() + "," + label; + }, Collectors.groupingBy(l -> { + if ("0".equals(l.getObjectProto())) { + YwScene scene = ywSceneService.getById(l.getVenueId()); + if (scene == null) { + throw new ServiceException(l.getObjectName() + ":该对象关联场馆被删除,请重新配置该对象"); + } + return l.getVenueId().toString() + "," + scene.getVenueName(); + } else if ("1".equals(l.getObjectProto())) { + String label = sysDictDataService.selectDictLabel("yw_county", l.getCounty()); + return l.getCounty() + "," + label; + } else if ("2".equals(l.getObjectProto())) { + String label = sysDictDataService.selectDictLabel("yw_city", l.getCity()); + return l.getCity() + "," + label; + } else if ("3".equals(l.getObjectProto())) { + return "ITCC层" + "," + "浙江省"; + } else { + return "未知"; + } + }, Collectors.groupingBy( + l -> { + StringBuilder builder = new StringBuilder(); + builder.append("【"); + ArrayList strings = new ArrayList<>(); + if (StrUtil.isNotBlank(l.getGroupId())) { + strings.add("移"); + } + if (CollUtil.isNotEmpty(l.getMessageUsers())) { + strings.add("短"); + } + if (CollUtil.isNotEmpty(l.getIvrUsers())) { + strings.add("IVR"); + } + String join = StrUtil.join(",", strings); + builder.append(join); + builder.append("】"); +// return l.getId() + "," + l.getObjectName() + builder; + return l.getId() + "," + l.getObjectName(); + })))); + return map; + } + + private void translate(YwNoticeObjectVO vo) { + YwScene entity = ywSceneService.getById(vo.getVenueId()); + if (entity != null) { + vo.setVenueName(entity.getVenueName()); + } + List messageUsers = vo.getMessageUsers(); + if (CollUtil.isNotEmpty(messageUsers)) { + List sysUsers = sysUserService.selectUserByIds(messageUsers); + if (CollUtil.isNotEmpty(sysUsers)) { + vo.setMessageUsersStr(sysUsers.stream().map(SysUser::getNickName).collect(Collectors.toList())); + vo.setMessageUsersExcelStr(StringUtils.join(vo.getMessageUsersStr(), ",")); + vo.setMessageUsersExcelPhoneStr(sysUsers.stream().map(SysUser::getPhonenumber).collect(Collectors.joining(","))); + } + } + + List ivrUsers = vo.getIvrUsers(); + if (CollUtil.isNotEmpty(ivrUsers)) { + List sysUsers = sysUserService.selectUserByIds(ivrUsers); + if (CollUtil.isNotEmpty(sysUsers)) { + vo.setIvrUsersStr(sysUsers.stream().map(SysUser::getNickName).collect(Collectors.toList())); + vo.setIvrUsersExcelStr(StringUtils.join(vo.getIvrUsersStr(), ",")); + vo.setIvrUsersExcelPhoneStr(sysUsers.stream().map(SysUser::getPhonenumber).collect(Collectors.joining(","))); + } + } + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeUserServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeUserServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a0d39ac99d969c1e621cec2eb62962d29f05ee67 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwNoticeUserServiceImpl.java @@ -0,0 +1,262 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.date.LocalDateTimeUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.constant.AlarmConstants; +import com.ruoyi.common.constant.TaskConstants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.common.enums.FlowDealStatus; +import com.ruoyi.eastcom_yw.common.enums.WireTaskType; +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.domain.YwNoticeObject; +import com.ruoyi.eastcom_yw.domain.YwNoticeUser; +import com.ruoyi.eastcom_yw.domain.YwWireTaskLog; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeModelQO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeObjectQO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmInfoVo; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectLogVo; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeObjectVO; +import com.ruoyi.eastcom_yw.mapper.YwAlarmViewMapper; +import com.ruoyi.eastcom_yw.mapper.YwNoticeUserMapper; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.system.service.ISysUserService; +import org.apache.commons.text.StringSubstitutor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Service +public class YwNoticeUserServiceImpl extends ServiceImpl implements YwNoticeUserService { + + protected final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private YwNoticeUserMapper ywNoticeUserMapper; + + @Autowired + private YwAlarmViewService ywAlarmViewService; + + @Autowired + private YwRoutInspectPlanService ywRoutInspectPlanService; + + @Autowired + private ISysUserService userService; + + @Autowired + private SysNoticeService sysNoticeService; + + @Autowired + private YwNoticeObjectService ywNoticeObjectService; + + @Autowired + private YwNoticeModelService ywNoticeModelService; + + + @Override + public List getYwNoticeUserList(String flwId, String taskId, String groupId,String type) { + return ywNoticeUserMapper.getYwNoticeUserList(flwId,taskId,groupId,type); + } + + @Override + public boolean noticeYW(String flwId, String groupId, String type) { + + Map valuesMap = new HashMap(); + SysNotice notice=new SysNotice(); + //告警发移动办公群,其它暂时发短信 + if(type.equals(TaskConstants.ALARM)) + { + List alarms = ywAlarmViewService.GetAlarmInfoList(flwId,false); + + if(alarms.isEmpty()) + { + logger.error(flwId+"没有查询到相关的告警信息"); + return false; + } + + String venueId = groupId.split("\\|")[0]; + YwNoticeObjectQO qo =new YwNoticeObjectQO(); + List lstVenueId = new ArrayList<>(); + lstVenueId.add(Long.parseLong(venueId)); + qo.setVenueId(lstVenueId); + qo.setObjectProto("0"); + Map> mapGroupIds = ywNoticeObjectService.getData(qo).stream().collect(Collectors.groupingBy(YwNoticeObjectVO::getGroupId)); + if(mapGroupIds.isEmpty()) + { + logger.error(flwId+"告警的场馆没有配置正确的移动办公数据,无法发送"); + return false; + } + + YwAlarmInfoVo alarm = alarms.get(0); + + String zy = DictUtils.getDictLabel("yw_alarm_specialty",alarm.getAlarmType()); + + valuesMap.put("场馆名称", alarm.getCg()); + valuesMap.put("专业名称", zy); + valuesMap.put("告警网元或告警基站",alarm.getSite_name()); + + if (StringUtils.isNotEmpty(alarm.getNet_name())) { + valuesMap.put("告警端口", alarm.getNet_name()); + } + + valuesMap.put("告警名称", alarm.getName()); + valuesMap.put("告警生成时间", alarm.getStart()); + valuesMap.put("告警最近生成时间", alarm.getLastBeginTime()); + valuesMap.put("告警等级", alarm.getAlarmLevel()); + valuesMap.put("定位信息", alarm.getAlarmLoc()); + + + notice.setNoticeTitle("一般告警提醒"); + //从通知模版里面取,后期处理 + String noticeContent = "告警提醒:${场馆名称}${专业名称}一般告警,告警网元:${告警网元或告警基站},告警名称:${告警名称},告警时间:${告警生成时间}"; + if(!(alarm.getAlarmType().equals("wx")||alarm.getAlarmType().equals("dh"))) { + if (StringUtils.isNotEmpty(alarm.getNet_name())) { + noticeContent = noticeContent.replace("${告警网元或告警基站}","${告警网元或告警基站},告警端口:${告警端口}"); + } + } + YwNoticeModelQO ywNoticeModelQO = new YwNoticeModelQO(); + ywNoticeModelQO.setModelScene("0"); + List noticeModelVOList = ywNoticeModelService.getData(ywNoticeModelQO); + + if(!noticeModelVOList.isEmpty()) + { + notice.setNoticeTitle(noticeModelVOList.get(0).getModelName()); + noticeContent = noticeModelVOList.get(0).getModelContent(); + if(!(alarm.getAlarmType().equals("wx")||alarm.getAlarmType().equals("dh"))) { + if (StringUtils.isNotEmpty(alarm.getNet_name())) { + noticeContent = noticeContent.replace("${告警网元或告警基站}","${告警网元或告警基站}\n" + "【告警端口】${告警端口}"); + } + } + } + + StringSubstitutor sub = new StringSubstitutor(valuesMap); + String content= sub.replace(noticeContent); + + +// List lstNoticeObjectId = new ArrayList<>(); +// lstNoticeObjectId.add(noticeObjectId); +// notice.setNoticeObjectId(lstNoticeObjectId); + //TODO:后期可以通过相关字段设置对应的告警级别,目前全都是一般告警 + notice.setModelScene("0"); + notice.setObjectProto("0"); + notice.setNoticeModelId(1L); + //通知类型 + notice.setCreateTime(LocalDateTimeUtil.now()); + notice.setModelSuitType("1"); + notice.setNoticeTitle("一般告警提醒"); + notice.setNoticeContent(content); + notice.setNoticeType("5"); + + notice.setFlwProcessid(flwId); + notice.setExpSendTime(LocalDateTimeUtil.now()); + for(Map.Entry> entry : mapGroupIds.entrySet()) + { + notice.setGroupId(entry.getKey()); + boolean res = sysNoticeService.save(notice); + if(!res) + { + logger.error(entry.getKey() + "移动办公群没有发送成功"); + } + } + + return true; + + } + + else if(type.equals(TaskConstants.INSPECT)) + { + List inspects = ywRoutInspectPlanService.getRoutInspectInfoList(flwId); + + if(inspects.isEmpty()) + { + logger.error(flwId+"没有查询到相关的巡检信息"); + return false; + } + + YwInspectLogVo inspect = inspects.get(0); + valuesMap.put("场馆名称", inspect.getVenueName()); + valuesMap.put("专业名称", inspect.getSpecialtyName()); + + notice.setNoticeTitle("场馆巡检任务下发通知"); + String noticeContent = "${场馆名称}巡检提醒:场馆经理已发布${专业名称}新的巡检任务,请注意待办任务更新"; + + YwNoticeModelQO ywNoticeModelQO = new YwNoticeModelQO(); + ywNoticeModelQO.setModelScene("8"); + List noticeModelVOList = ywNoticeModelService.getData(ywNoticeModelQO); + + if(!noticeModelVOList.isEmpty()) + { + notice.setNoticeTitle(noticeModelVOList.get(0).getModelName()); + noticeContent = noticeModelVOList.get(0).getModelContent(); + } + + StringSubstitutor sub = new StringSubstitutor(valuesMap); + String content= sub.replace(noticeContent); + notice.setNoticeContent(content); + notice.setNoticeType("3"); + } + + notice.setCreateTime(LocalDateTimeUtil.now()); + notice.setStatus("0"); + notice.setCreateBy("sys"); + + if(notice.getNoticeType().equals("3")) { + + String phoneNumber = ""; + + if(!groupId.contains("|")) + { + try { + SysUser user = userService.selectUserById(Long.parseLong(groupId)); + if(ObjectUtils.isNotEmpty(user)) { + phoneNumber = user.getPhonenumber(); + } + } + catch(Exception ex) { + logger.error(flwId+"出错了,groupId不正确"); + } + } + else + { + phoneNumber = ywNoticeUserMapper.getPhoneByGroupId(groupId); + } + + if (StringUtils.isEmpty(phoneNumber)) { + logger.error(flwId + "没有相关提醒人员,无法发送短信"); + return false; + } + + if (StringUtils.isNotEmpty(phoneNumber)) { + notice.setExpSendTime(LocalDateTimeUtil.now()); + notice.setFlwProcessid(flwId); + notice.setReciveUserPhone(phoneNumber); + return sysNoticeService.save(notice); + } + } + + + + return false; + + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectConfigServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectConfigServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..897e673a6ea9462448fd63eab4c584dfd125031e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectConfigServiceImpl.java @@ -0,0 +1,28 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectConfig; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectConfigParam; +import com.ruoyi.eastcom_yw.mapper.YwRoutInspectConfigMapper; +import com.ruoyi.eastcom_yw.service.YwRoutInspectConfigService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author huamile + * @date 2023/1/17 16:05 + **/ +@Service +@RequiredArgsConstructor +public class YwRoutInspectConfigServiceImpl extends ServiceImpl implements YwRoutInspectConfigService { + + private final YwRoutInspectConfigMapper ywRoutInspectConfigMapper; + + @Override + public List getInspectConfigList(YwRoutInspectConfigParam param) { + return ywRoutInspectConfigMapper.getList(param); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectLogServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d9c168711268b6ea2c7ac5dffb8c5fabfeece0e6 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectLogServiceImpl.java @@ -0,0 +1,30 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectLog; +import com.ruoyi.eastcom_yw.mapper.YwRoutInspectLogMapper; +import com.ruoyi.eastcom_yw.service.YwRoutInspectLogService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * @author huamile + */ +@Service +@RequiredArgsConstructor +public class YwRoutInspectLogServiceImpl extends ServiceImpl implements YwRoutInspectLogService { + + private final YwRoutInspectLogMapper ywRoutInspectLogMapper; + + @Override + public void updateLog(YwRoutInspectLog log) { + Long userId = SecurityUtils.getUserId(); + log.setFeedBackUser(userId.toString()); + log.setFeedBackTime(new Date()); + ywRoutInspectLogMapper.updateByflwProcessid(log); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectPlanServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectPlanServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..adfd198142b961d6ff97b9315374d05762d45f6b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectPlanServiceImpl.java @@ -0,0 +1,661 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageInfo; +import com.google.common.collect.Maps; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.constant.TaskConstants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.dto.StartProcessInstanceDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.*; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.poi.EasyPoiExcelUtil; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.reflect.ReflectUtils; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectConfig; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectLog; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectPlan; +import com.ruoyi.eastcom_yw.domain.YwSceneFile; +import com.ruoyi.eastcom_yw.domain.dto.*; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectConfigParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectPlanParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectStatParam; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectLogVo; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectPlanStaticVo; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectPlanVo; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.YwNoticeUserService; +import com.ruoyi.eastcom_yw.service.YwRoutInspectConfigService; +import com.ruoyi.eastcom_yw.service.YwRoutInspectPlanService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * @author huamile + * @date 2023/1/17 16:05 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class YwRoutInspectPlanServiceImpl extends ServiceImpl implements YwRoutInspectPlanService { + + private final RedisCache redisCache; + + private final CommonService commonService; + private final YwRoutInspectConfigService ywRoutInspectConfigService; + + private final YwSceneMapper ywSceneMapper; + private final YwRoutInspectLogMapper ywRoutInspectLogMapper; + private final YwRoutInspectPlanMapper ywRoutInspectPlanMapper; + private final YwRoutInspectConfigMapper ywRoutInspectConfigMapper; + + private final YwAlarmViewMapper ywAlarmViewMapper; + + private final YwNoticeUserService ywNoticeUserService; + + private String processDefinitionId = StringUtils.EMPTY; + private final String JOBNOPREFIX = "XJ"; + + private Long getUserId() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (user.isAdmin(user) || user.isCenter(user) || user.isLeader(user)) { + return null; + } else { + return user.getUserId(); + } + } + + @Override + public void insetInspectSchedule() { + //获取当前时间 + Calendar instance = Calendar.getInstance(); + instance.set(Calendar.SECOND, 0); + instance.set(Calendar.MILLISECOND, 0); + Date now = instance.getTime(); + + List executablePlanList = + ywRoutInspectPlanMapper.getExecutablePlanList(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(now)); + + if (executablePlanList.size() > 0) { + + String templateId = ywAlarmViewMapper.getTemplateId(TaskConstants.INSPECT); + + if (StringUtils.isNotEmpty(templateId)) { + try { + processDefinitionId = commonService.GetProcessDefinitionId(templateId); + } catch (Exception e) { + log.error(e.getMessage()); + return; + } + + UserInfo user = new UserInfo(); + user.setId("2"); + user.setName("系统"); + user.setType("user"); + user.setSex("1"); + user.setSelected(true); + + for (YwInspectLogVo ywInspectLogVo : executablePlanList) { + //筛选,巡检工作流到时间创建工作流定时任务,满足条件执行下面代码 +// boolean flag = false; +// if (now.compareTo(ywInspectLogVo.getBeginTime()) == 0) { +// flag = true; +// } else if (ywInspectLogVo.getCircle() > 1) { +// for (Integer i = 1; i < ywInspectLogVo.getCircle(); i++) { +// Calendar calendar = Calendar.getInstance(); +// calendar.setTime(ywInspectLogVo.getBeginTime()); +// calendar.add(Calendar.MINUTE, ywInspectLogVo.getIntervalTime().intValue()); +// Date time = calendar.getTime(); +// if (now.compareTo(time) == 0) { +// flag = true; +// break; +// } +// } +// } + + log.info("巡检JOB时间" + now + ", " + ywInspectLogVo); + +// if (flag) { + StartProcessInstanceDTO startDTO = new StartProcessInstanceDTO(); + startDTO.setStartUserInfo(user); + startDTO.setProcessDefinitionId(processDefinitionId); + JSONObject json = new JSONObject(); + String groupId = MessageFormat.format("{0}|{1}|xj", ywInspectLogVo.getSceneId().toString().replace(",", ""), ywInspectLogVo.getInspectSpecialty()); + //场馆ID和 + json.put("input_cg_zy_id", groupId); + json.put("input_cg", ywInspectLogVo.getVenueName()); + json.put("input_zy", ywInspectLogVo.getSpecialtyName()); + json.put("input_limit", ywInspectLogVo.getStopTimeOption()); + json.put("input_fkr", ""); + json.put("input_fksj", ""); + json.put("textarea_xjfk", ""); + json.put("input_xjxs", ywInspectLogVo.getCheckNum()); + json.put("input_zcxs", ywInspectLogVo.getCheckNum()); + json.put("input_wtxs", "0"); + json.put("select_wtdl1", ""); + json.put("select_wtxl1", ""); + json.put("textarea_wtms1", ""); + json.put("pictureupload_wtzp1", null); + json.put("textarea_wtms2", ""); + json.put("pictureupload_wtzp2", null); + json.put("textarea_wtms3", ""); + json.put("pictureupload_wtzp3", null); + json.put("textarea_wtms4", ""); + json.put("pictureupload_wtzp4", null); + json.put("textarea_wtms5", ""); + json.put("pictureupload_wtzp5", null); + json.put("textarea_wtms6", ""); + json.put("pictureupload_wtzp6", null); + json.put("textarea_wtms7", ""); + json.put("pictureupload_wtzp7", null); + json.put("textarea_wtms8", ""); + json.put("pictureupload_wtzp8", null); + json.put("textarea_wtms9", ""); + json.put("pictureupload_wtzp9", null); + json.put("textarea_wtms10", ""); + json.put("pictureupload_wtzp10", null); + json.put("pictureupload_pz", null); + + YwSearchDTO ywSearchDTO = new YwSearchDTO(); + ywSearchDTO.setArea_county_id(ywInspectLogVo.getAreaCountyId()); + ywSearchDTO.setTask_type(TaskConstants.INSPECT); + ywSearchDTO.setVenue_id(ywInspectLogVo.getSceneId().toString()); + ywSearchDTO.setVenue_name(ywInspectLogVo.getVenueName()); + ywSearchDTO.setCounty(ywInspectLogVo.getCounty()); + ywSearchDTO.setCity(ywInspectLogVo.getCity()); + //20230303工作流增加任务名称 + ywSearchDTO.setTask_name(ywInspectLogVo.getInspectName()); + json.put("input_search", JSONObject.toJSONString(ywSearchDTO)); + + startDTO.setFormData(json); + try { + String res_flwprocessid = commonService.StartProcess(startDTO); + + if (StringUtils.isNotEmpty(res_flwprocessid)) { + //保存数据到巡检日志表 + YwRoutInspectLog ywRoutInspectLog = new YwRoutInspectLog(); + //巡检计划id + ywRoutInspectLog.setRoutInspectId(ywInspectLogVo.getRoutInspectId()); + //检查项数 + ywRoutInspectLog.setCheckNum(ywInspectLogVo.getCheckNum()); + //返回的工作流流程id + ywRoutInspectLog.setFlwProcessid(res_flwprocessid); + + if (ywRoutInspectLogMapper.insertSelective(ywRoutInspectLog) > 0) { + boolean res = ywNoticeUserService.noticeYW(res_flwprocessid, groupId, TaskConstants.INSPECT); + if (!res) { + log.error("告警工作流已生成,提醒没有发送成功"); + } + + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } +// } + } + } + } + } + + @Override + public List getList(YwRoutInspectConfigParam param) { + param.setUserId(getUserId()); + PageUtils.startPage(param, YwRoutInspectConfigParam.class); + return ywRoutInspectPlanMapper.getList(param); + } + + @Override + public TableDataInfo getPlanList(YwRoutInspectPlanParam param) { + param.setUserId(getUserId()); + TableDataInfo rspData = new TableDataInfo(); + rspData.setTotal(0); + PageUtils.startPage(param, YwRoutInspectPlanParam.class); + List planList = ywRoutInspectPlanMapper.getPlanList(param); + if (planList.size() > 0) { + long total = PageInfo.of(planList).getTotal(); + rspData.setTotal(total); + for (YwInspectPlanVo vo : planList) { + vo.setTaskNo(vo.getFlwProcessid()); + if (vo.getType() != null) { + vo.setTypeName(vo.getType() == 0 ? "临时" : "计划"); + } + if (vo.getFeedBackTime() != null) { + //TODO 需要修改,是否超时根据配置表中stop_time_option字段判断 + + vo.setTimeoutOrNot(vo.getFeedBackTime().after(vo.getPlanFinTime()) ? "是" : "否"); + vo.setTaskStatus("已反馈"); + } else if (vo.getFeedBackTime() == null && StringUtils.isNotEmpty(vo.getFlwProcessid())) { + vo.setTimeoutOrNot(new Date().after(vo.getPlanFinTime()) ? "是" : "否"); + vo.setTaskStatus("执行中"); + } else { + vo.setTimeoutOrNot(new Date().after(vo.getPlanFinTime()) ? "是" : "否"); + vo.setTaskStatus("未启动"); + } +// if ("1".equals(vo.getDealStatus())) { +// vo.setTaskStatus("处理中"); +// } else if ("4".equals(vo.getDealStatus())) { +// vo.setTaskStatus("已反馈"); +// } + + } + + if (param.getIsApp()) { + //查询工作流,比较是否是当前登录用户的待办 + List processIds = commonService.selectCurrenUserTodoProcessId(null); + if (CollUtil.isNotEmpty(processIds)) { + for (String processId : processIds) { + planList.stream().filter(l -> processId.equals(l.getFlwProcessid())).findAny().ifPresent(a -> { + a.setIsTodo(1); + }); + } + } + } + } + rspData.setRows(planList); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + return rspData; + } + + @Override + public Map getStatData(YwRoutInspectStatParam param) { + if (!param.isExport()) { + param.setPageNum(null); + param.setPageSize(null); + } +// setDefaultTime(param); + //大屏调用此方法是未登录状态 + if(!param.isTaskFlag()){ + param.setUserId(getUserId()); + } + Integer numOfCompletedPlan = ywRoutInspectPlanMapper.getNumOfCompletedPlan(param); + Integer numOfAllPlan = ywRoutInspectPlanMapper.getNumOfAllPlan(param); + Double rate = 0.00d; + if (numOfAllPlan != 0) { + rate = new BigDecimal((numOfCompletedPlan.doubleValue() / numOfAllPlan) * 100) + .setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + Map map = new HashMap<>(3); + map.put("rate", rate); + map.put("numOfAllPlan", numOfAllPlan); + map.put("numOfCompletedPlan", numOfCompletedPlan); + + return map; + } + + @Override + public Map getStatListData(YwRoutInspectStatParam param) { + PageUtils.startPage(param, YwRoutInspectStatParam.class); +// setDefaultTime(param); + //大屏调用此方法是未登录状态 + if(!param.isTaskFlag()){ + param.setUserId(getUserId()); + } + List list = ywRoutInspectPlanMapper.getStatListData20231012(param); +// addImg(list); + + Map map = Maps.newHashMap(); + map.put("beginDate", param.getBeginDate()); + map.put("endDate", param.getEndDate()); + map.put("total", list.size()); + map.put("list", list); + return map; + } + + + @Override + public Map getResultStatData(YwRoutInspectStatParam param) { + if (!param.isExport()) { + param.setPageNum(null); + param.setPageSize(null); + } +// setDefaultTime(param); + //大屏调用此方法是未登录状态 + if(!param.isTaskFlag()){ + param.setUserId(getUserId()); + } + Integer numOfQuestionPlan = ywRoutInspectPlanMapper.getNumOfQuestionPlan(param) == null ? 0 : ywRoutInspectPlanMapper.getNumOfQuestionPlan(param); + Integer numOfAllPlan = ywRoutInspectPlanMapper.getAllNumOfPlan(param) == null ? 0 : ywRoutInspectPlanMapper.getAllNumOfPlan(param); + Integer numOfNoQuPlan = 0; + + if (numOfQuestionPlan < numOfAllPlan) { + numOfNoQuPlan = numOfAllPlan - numOfQuestionPlan; + } + + Double rate = 0.00d; + if (numOfAllPlan != 0) { + rate = new BigDecimal((numOfNoQuPlan.doubleValue() / numOfAllPlan) * 100) + .setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + } + + Map map = new HashMap<>(3); + map.put("rate", rate); + map.put("numOfAllPlan", numOfAllPlan); + map.put("numOfNoQuPlan", numOfNoQuPlan); + + return map; + } + + @Override + public Map getResultStatListData(YwRoutInspectStatParam param) { + PageUtils.startPage(param, YwRoutInspectStatParam.class); +// setDefaultTime(param); + param.setUserId(getUserId()); + List list = ywRoutInspectPlanMapper.getResultStatListData20231012(param); +// addImg(list); +// + Map map = Maps.newHashMap(); + map.put("beginDate", param.getBeginDate()); + map.put("endDate", param.getEndDate()); + map.put("total", list.size()); + map.put("list", list); + return map; + } + + @Override + public List getRoutInspectInfoList(String processId) { + return ywRoutInspectLogMapper.getRoutInspectInfoList(processId); + } + + private void createSinglePlan(YwInspectTaskDTO dto) throws Exception { + YwInspectPlanDTO ywRoutInspectPlan = dto.getYwRoutInspectPlan(); + + List specialtyList = ywRoutInspectPlan.getSpecialtyList(); + if (CollectionUtil.isNotEmpty(specialtyList)) { + String jobNo = getJobNo(); + ywRoutInspectPlan.setJobNo(jobNo); + ywRoutInspectPlan.setInspectDate(DateUtils.parseDate(ywRoutInspectPlan.getBeginTime().split(" ")[0], "yyyy-MM-dd")); + for (String specialty : specialtyList) { + ywRoutInspectPlan.setInspectSpecialty(specialty); + ywRoutInspectPlanMapper.insertSelective(ywRoutInspectPlan); + } + } + + /*List list = dto.getList(); + List configIds = list.stream().filter(c -> c.getId() != null). + map(YwRoutInspectConfig::getId).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(configIds)) { + ywRoutInspectPlanMapper.delUselessConfig(ywRoutInspectPlan.getSceneId(), + ywRoutInspectPlan.getInspectSpecialty(),configIds); + } + for (int i = 0; i < list.size(); i++) { + YwRoutInspectConfig config = list.get(i); + + List specialtyList = ywRoutInspectPlan.getSpecialtyList(); + if (CollectionUtil.isNotEmpty(specialtyList)) { + for (String specialty : specialtyList) { + ywRoutInspectPlan.setInspectSpecialty(specialty); + addData(ywRoutInspectPlan,config); + ywRoutInspectPlanMapper.insertSelective(ywRoutInspectPlan); + } + } + + if (config.getId() != null) { + ywRoutInspectConfigService.updateById(config); + } else { + ywRoutInspectConfigMapper.insertSelective(config); + } + }*/ + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult create(YwInspectTaskDTO dto) throws Exception { + List> timePeriods = dto.getYwRoutInspectPlan().getTimePeriods(); + if (timePeriods == null) { + return AjaxResult.error("操作失败"); + } + boolean checkFlag; + for (Map map : timePeriods) { + YwInspectTaskDTO taskDTO = new YwInspectTaskDTO(); + BeanUtils.copyBeanProp(taskDTO, dto); + YwInspectPlanDTO ywInspectPlanDTO = taskDTO.getYwRoutInspectPlan(); + ywInspectPlanDTO.setBeginTime(map.get("beginTime")); + ywInspectPlanDTO.setPlanFinTime(map.get("planFinTime")); + List specialtyList = ywInspectPlanDTO.getSpecialtyList(); + if (CollectionUtil.isNotEmpty(specialtyList)) { + for (String special : specialtyList) { + checkFlag = validUnique(ywInspectPlanDTO, special); + if (!checkFlag) { + return AjaxResult.error("巡检计划重复,操作失败"); + } + } + } + } + for (Map map : timePeriods) { + YwInspectTaskDTO taskDTO = new YwInspectTaskDTO(); + BeanUtils.copyBeanProp(taskDTO, dto); + taskDTO.getYwRoutInspectPlan().setBeginTime(map.get("beginTime")); + taskDTO.getYwRoutInspectPlan().setPlanFinTime(map.get("planFinTime")); + createSinglePlan(taskDTO); + } + return AjaxResult.success(); + } + + private boolean validUnique(YwInspectPlanDTO ywInspectPlanDTO, String special) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwRoutInspectPlan::getSceneId, ywInspectPlanDTO.getSceneId()); + queryWrapper.eq(YwRoutInspectPlan::getInspectSpecialty, special); + queryWrapper.eq(YwRoutInspectPlan::getBeginTime, DateUtils.parseDate(ywInspectPlanDTO.getBeginTime())); + queryWrapper.eq(YwRoutInspectPlan::getPlanFinTime, DateUtils.parseDate(ywInspectPlanDTO.getPlanFinTime())); + List plans = ywRoutInspectPlanMapper.selectList(queryWrapper); + if (CollectionUtil.isNotEmpty(plans)) { + return false; + } + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updatePlan(YwInspectTaskDTO dto) throws Exception { + YwInspectPlanDTO ywRoutInspectPlan = dto.getYwRoutInspectPlan(); + if (ywRoutInspectPlan.getBeginTime() != null) { + ywRoutInspectPlan.setInspectDate(DateUtils.parseDate(ywRoutInspectPlan.getBeginTime().split(" ")[0], "yyyy-MM-dd")); + } + List list = ywRoutInspectPlanMapper.getListByJobNo(ywRoutInspectPlan.getJobNo()); + List collect = list.stream().map(plan -> plan.getInspectSpecialty()).collect(Collectors.toList()); + ywRoutInspectPlanMapper.delUselessPlan(ywRoutInspectPlan.getJobNo(), ywRoutInspectPlan.getSpecialtyList()); + List updateList = collect; + updateList.retainAll(ywRoutInspectPlan.getSpecialtyList()); + ywRoutInspectPlanMapper.updateByJobNoSelective(ywRoutInspectPlan); + + List addList = ywRoutInspectPlan.getSpecialtyList(); + addList.removeAll(collect); + if (CollectionUtil.isNotEmpty(addList)) { + for (String specialty : addList) { + ywRoutInspectPlan.setInspectSpecialty(specialty); + ywRoutInspectPlanMapper.insertSelective(ywRoutInspectPlan); + } + } + + /*List list = dto.getList(); + if (list.size() > 0) { + YwRoutInspectConfig config = list.get(0); + + YwInspectPlanDTO ywRoutInspectPlan = dto.getYwRoutInspectPlan(); + addData(ywRoutInspectPlan,config); + ywRoutInspectPlanMapper.updateByPrimaryKeySelective(ywRoutInspectPlan); + }*/ + } + + @Override + public void export(YwRoutInspectConfigParam param, HttpServletRequest request, HttpServletResponse response) { + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + List logList = getList(param); + + List list = new ArrayList<>(); + for (int i = 0; i < logList.size(); i++) { + YwInspectLogVo ywInspectLogVo = logList.get(i); + YwInspectPlanExportDTO dto = new YwInspectPlanExportDTO(); + BeanUtils.copyBeanProp(dto, ywInspectLogVo); + if (StringUtils.isNotEmpty(dto.getNoticeType())) { + dto.setNoticeType(DictUtils.getDictLabel("sys_notice_type", dto.getNoticeType())); + } + list.add(dto); + } + + EasyPoiExcelUtil.exportExcel(null, YwInspectPlanExportDTO.class, list, request, response); + } + + @Override + public void planExport(YwRoutInspectPlanParam param, HttpServletRequest request, HttpServletResponse response) { + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + List planList = ReflectUtils.toList(getPlanList(param).getRows(), YwInspectPlanVo.class); + + List list = new ArrayList<>(); + for (int i = 0; i < planList.size(); i++) { + YwInspectPlanVo ywInspectPlanVo = planList.get(i); + YwInspectTaskExportDTO dto = new YwInspectTaskExportDTO(); + BeanUtils.copyBeanProp(dto, ywInspectPlanVo); + dto.setRate((ywInspectPlanVo.getQuestionNum() == null ? "--" : ywInspectPlanVo.getQuestionNum()) + + "/" + (ywInspectPlanVo.getCheckNum() == null ? "--" : ywInspectPlanVo.getCheckNum())); + dto.setErrorNum(ywInspectPlanVo.getQuestionNum()); + dto.setNum(ywInspectPlanVo.getCheckNum()); + list.add(dto); + } + + ExcelUtil util = new ExcelUtil<>(YwInspectTaskExportDTO.class); + util.exportExcel(response, list, "巡检记录导出"); + } + + @Override + public List mergeResultStat(YwRoutInspectStatParam param) { + Map statListData = getStatListData(param); + Map resultStatListData = getResultStatListData(param); + List list = (List) statListData.get("list"); + List resList = (List) resultStatListData.get("list"); + if (CollUtil.isNotEmpty(list)) { + for (YwInspectStatDTO dto : list) { + for (YwInspectStatDTO resDto : resList) { + if (dto.getSceneId().equals(resDto.getSceneId())) { + dto.setResulRate(resDto.getRate()); + dto.setResultAllNum(resDto.getAllNum()); + dto.setResulNormalNum(resDto.getCompletedNum()); + } + } + } + } + return list; + } + + @Override + public boolean checkPlanStatus(String dto) { + List list = ywRoutInspectLogMapper.getRoutInspectInfoListByJobNoAndFlowId(dto); + if (!CollectionUtils.isEmpty(list)) { + return true; + } + return false; + } + + @Override + public List getInspectPlanStatic(YwRoutInspectStatParam param) { + List list = ywRoutInspectPlanMapper.getStatListData(param); + List staticVos = new ArrayList<>(); + DecimalFormat df = new DecimalFormat("#.00"); + for (YwInspectStatDTO dto : list) { + YwInspectPlanStaticVo staticVo = new YwInspectPlanStaticVo(); + BeanUtils.copyProperties(dto, staticVo); + staticVo.setRate(df.format(dto.getRate())); + staticVos.add(staticVo); + + } + return staticVos; + } + + private void addData(YwInspectPlanDTO dto, YwRoutInspectConfig config) { + dto.setCheckNum(config.getCheckNum()); + dto.setCheckType(config.getCheckType()); + dto.setCheckDesc(config.getCheckDesc()); + dto.setCircle(config.getCircle()); + dto.setStopTimeOption(config.getStopTimeOption()); + dto.setIntervalTime(config.getIntervalTime()); + dto.setInspectUserId(config.getInspectUserId()); + dto.setRepWarnInterval(config.getRepWarnInterval()); + dto.setNoticeType(config.getNoticeType()); + } + + private String getJobNo() { + String date = new SimpleDateFormat("yyyyMMdd").format(new Date()); + String key = JOBNOPREFIX + date; + + if (redisCache.hasKey(key)) { + String value = redisCache.getCacheObject(key).toString(); + String[] split = value.split("_"); + if (split.length == 3) { + int i = Integer.parseInt(split[2]) + 1; + String num = String.format("%04d", i); + String v = split[0] + "_" + split[1] + "_" + num; + redisCache.setCacheObject(key, v, 1, TimeUnit.DAYS); + return v; + } + } + String value = JOBNOPREFIX + "_" + date + "_" + "0001"; + redisCache.setCacheObject(key, value, 1, TimeUnit.DAYS); + return value; + } + + private void setDefaultTime(YwRoutInspectStatParam param) { + String beginDate = param.getBeginDate(); + if (StrUtil.isBlank(beginDate)) { + String date = DateUtils.getDate(); + beginDate = date + " 00:00:00"; + param.setBeginDate(beginDate); + } + String endDate = param.getEndDate(); + if (StrUtil.isBlank(endDate)) { + Calendar instance = Calendar.getInstance(); + instance.setTime(new Date()); + instance.add(Calendar.HOUR_OF_DAY, -1); + instance.set(Calendar.SECOND, 0); + instance.set(Calendar.MILLISECOND, 0); + Date time = instance.getTime(); + endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time); + param.setEndDate(endDate); + } + } + + private void addImg(List list) { + if (CollectionUtil.isNotEmpty(list)) { + List ids = list.stream().map(dto -> dto.getSceneId()).collect(Collectors.toList()); + List files = ywSceneMapper.getFilesBySceneIds(ids); + if (CollectionUtil.isNotEmpty(files)) { + for (YwInspectStatDTO dto : list) { + for (YwSceneFile file : files) { + if ("pic".equals(file.getFileType()) && dto.getSceneId().equals(file.getSceneId())) { + dto.setImageurl(file.getFileUrl()); + break; + } + } + } + } + } + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectQuestionConfigServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectQuestionConfigServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5dbe47e501dd7a485eb15904dd24685cd7db0c0e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwRoutInspectQuestionConfigServiceImpl.java @@ -0,0 +1,73 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.poi.EasyPoiExcelUtil; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectQuestionConfig; +import com.ruoyi.eastcom_yw.domain.param.YwInspectQuestionConfigParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneVo; +import com.ruoyi.eastcom_yw.mapper.YwRoutInspectQuestionConfigMapper; +import com.ruoyi.eastcom_yw.service.YwRoutInspectQuestionConfigService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author huamile + * @date 2023/2/ 16:50 + **/ +@Service +@RequiredArgsConstructor +public class YwRoutInspectQuestionConfigServiceImpl extends ServiceImpl implements YwRoutInspectQuestionConfigService { + + private final YwRoutInspectQuestionConfigMapper ywRoutInspectQuestionConfigMapper; + + @Override + public List getlist(YwInspectQuestionConfigParam param) { + if (null == param.getPageSize()) { + param.setPageSize(Integer.MAX_VALUE); + } + PageUtils.startPage(param,YwInspectQuestionConfigParam.class); + return ywRoutInspectQuestionConfigMapper.getlist(param); + } + + @Override + public Integer create(YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig) { + return ywRoutInspectQuestionConfigMapper.insertSelective(ywRoutInspectQuestionConfig); + } + + @Override + public Integer updateByPrimaryKeySelective(YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig) { + return ywRoutInspectQuestionConfigMapper.updateByPrimaryKeySelective(ywRoutInspectQuestionConfig); + } + + @Override + public void export(YwInspectQuestionConfigParam param, HttpServletRequest request, HttpServletResponse response) { + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + List list = getlist(param); + + ExcelUtil util = new ExcelUtil<>(YwRoutInspectQuestionConfig.class); + util.exportExcel(response, list, "巡检问题类型配置"); + +// EasyPoiExcelUtil.exportExcel("巡检问题类型配置",YwRoutInspectQuestionConfig.class,list,request,response); + } + + @Override + public List appList(YwInspectQuestionConfigParam param) { + PageUtils.startPage(param,YwInspectQuestionConfigParam.class); + return ywRoutInspectQuestionConfigMapper.selectList(new LambdaQueryWrapper() + .eq(param.getSceneBigId()!=null,YwRoutInspectQuestionConfig::getSceneBigId,param.getSceneBigId()) + .eq(StrUtil.isNotBlank(param.getSpecialty()),YwRoutInspectQuestionConfig::getSpecialtyId,param.getSpecialty()) + .eq(StrUtil.isNotBlank(param.getQuestionType()),YwRoutInspectQuestionConfig::getQuestionType,param.getQuestionType()) + .eq(StrUtil.isNotBlank(param.getQuestionSonType()),YwRoutInspectQuestionConfig::getQuestionSonType,param.getQuestionSonType()) + ); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneAlarmServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneAlarmServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1956b80babbbdd0cd7efe9a36c92e72018a7c874 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneAlarmServiceImpl.java @@ -0,0 +1,74 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.poi.EasyPoiExcelUtil; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwSceneAlarm; +import com.ruoyi.eastcom_yw.domain.param.YwSceneAlarmParam; +import com.ruoyi.eastcom_yw.domain.param.YwSceneUserParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneAlarmVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneVo; +import com.ruoyi.eastcom_yw.mapper.YwSceneAlarmMapper; +import com.ruoyi.eastcom_yw.service.YwSceneAlarmService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author huamile + */ +@Service +@RequiredArgsConstructor +public class YwSceneAlarmServiceImpl extends ServiceImpl implements YwSceneAlarmService { + + private final YwSceneAlarmMapper ywSceneAlarmMapper; + + @Override + public List getList(YwSceneAlarmParam param) { + PageUtils.startPage(param, YwSceneUserParam.class); + return ywSceneAlarmMapper.getList(param); + } + + @Override + public List getListBySceneBigId(Long sceneBigId) { + return ywSceneAlarmMapper.getListBySceneBigId(sceneBigId); + } + + @Override + public Integer create(YwSceneAlarm ywSceneAlarm) { + return ywSceneAlarmMapper.insertSelective(ywSceneAlarm); + } + + @Override + public Integer updateByPrimaryKeySelective(YwSceneAlarm ywSceneAlarm) { + return ywSceneAlarmMapper.updateByPrimaryKeySelective(ywSceneAlarm); + } + + @Override + public Integer delBySceneIds(List ids) { + if (CollectionUtil.isNotEmpty(ids)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(YwSceneAlarm::getSceneId,ids); + return ywSceneAlarmMapper.delete(wrapper); + } + return null; + } + + @Override + public void export(YwSceneAlarmParam param, HttpServletRequest request, HttpServletResponse response) { + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + List list = getList(param); + + ExcelUtil util = new ExcelUtil<>(YwSceneAlarmVo.class); + util.exportExcel(response, list, "场馆告警配置"); + +// EasyPoiExcelUtil.exportExcel("场馆告警配置", YwSceneAlarmVo.class,list,request,response); + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneCalendarServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneCalendarServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..de14155ebb946eb455a163d1daaff5b0659a2d5f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneCalendarServiceImpl.java @@ -0,0 +1,94 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.utils.*; +import com.ruoyi.common.utils.poi.EasyPoiExcelUtil; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneCalendar; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneCalendarDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneAlarmVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendar2Vo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendarVo; +import com.ruoyi.eastcom_yw.importer.ImporterCalendar; +import com.ruoyi.eastcom_yw.mapper.YwSceneCalendarMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.service.YwSceneCalendarService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author huamile + */ +@Service +@RequiredArgsConstructor +public class YwSceneCalendarServiceImpl extends ServiceImpl implements YwSceneCalendarService { + + private final YwSceneCalendarMapper ywSceneCalendarMapper; + private final YwSceneMapper ywSceneMapper; + + @Override + public List getList(YwSceneCalendarParam param) { + PageUtils.startPage(param, YwSceneCalendarParam.class); + return ywSceneCalendarMapper.getList(param); + } + + @Override + public List getListBySceneBigId(Long sceneBigId) { + return ywSceneCalendarMapper.getListBySceneBigId(sceneBigId); + } + + @Override + public Integer create(YwSceneCalendarDTO dto) { + return ywSceneCalendarMapper.insertSelective(dto); + } + + @Override + public Integer updateByPrimaryKeySelective(YwSceneCalendarDTO dto) { + return ywSceneCalendarMapper.updateByPrimaryKeySelective(dto); + } + + @Override + public Integer delBySceneIds(List ids) { + if (CollectionUtil.isNotEmpty(ids)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(YwSceneCalendar::getSceneId, ids); + return ywSceneCalendarMapper.delete(wrapper); + } + return null; + } + + @Override + public void export(YwSceneCalendarParam param, HttpServletRequest request, HttpServletResponse response) { + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + List list = getList(param); + ExcelUtil util = new ExcelUtil<>(YwSceneCalendarVo.class); + util.exportExcel(response, list, "场馆赛事配置"); + +// EasyPoiExcelUtil.exportExcel("场馆赛事配置", YwSceneCalendarVo.class, list, request, response); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importSceneCalendar(List vos, Long sceneBigId, String importType) throws Exception { + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(sceneBigId != null, YwScene::getSceneBigId, sceneBigId); + List ywSceneList = ywSceneMapper.selectList(lambdaQueryWrapper); + + ImporterBase importerBase = new ImporterCalendar(ywSceneCalendarMapper); + return importerBase.doAdd(vos, sceneBigId, importType, ywSceneList); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneMatchServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneMatchServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..351cce7180112462784552b056c36eafd3871c2c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneMatchServiceImpl.java @@ -0,0 +1,49 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.param.YwSceneMatchParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneMatchVo; +import com.ruoyi.eastcom_yw.importer.ImporterMatch; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneMatchMapper; +import com.ruoyi.eastcom_yw.service.YwSceneMatchService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * @author los + */ +@Service +@RequiredArgsConstructor +public class YwSceneMatchServiceImpl implements YwSceneMatchService { + + private final YwSceneMatchMapper ywSceneMatchMapper; + private final YwSceneMapper ywSceneMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importMatch(List vos, Long sceneBigId, String importType) throws Exception { + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(sceneBigId != null, YwScene::getSceneBigId, sceneBigId); + List ywSceneList = ywSceneMapper.selectList(lambdaQueryWrapper); + + ImporterBase importerBase = new ImporterMatch(ywSceneMatchMapper); + return importerBase.doAdd(vos, sceneBigId, importType, ywSceneList); + + } + + @Override + public List list(YwSceneMatchParam param) { + PageUtils.startPage(param, YwSceneMatchParam.class); + return ywSceneMatchMapper.list(param); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementAgisServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementAgisServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c44e542e21c754079c2635f0c721e955e378305f --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementAgisServiceImpl.java @@ -0,0 +1,77 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementAgisParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementAgis; +import com.ruoyi.eastcom_yw.importer.ImporterAgis; +import com.ruoyi.eastcom_yw.mapper.YwSceneNetelementAgisMapper; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementAgisService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author los + */ +@Service +@RequiredArgsConstructor +public class YwSceneNetelementAgisServiceImpl implements YwSceneNetelementAgisService { + + private final YwSceneService ywSceneService; + + private final YwSceneNetelementAgisMapper ywSceneNetelementAgisMapper; + + @Override + public List list(YwSceneNetelementAgisParam para) { + PageUtils.startPage(para, YwSceneNetelementAgisParam.class); + List wxes = ywSceneNetelementAgisMapper.listAll(para); + wxes.forEach(x -> x.setAlarmSpecityName(DictUtils.getDictLabel("yw_alarm_specialty", x.getAlarmSpecityId()))); + return wxes; + } + + /** + * 导入 + * + * @param cs 数据 + * @param sceneBigId 大场景id + * @param opType 导入类型 + * @param sceneId + * @return + * @throws Exception + */ + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importAgis(List cs, Long sceneBigId, String opType, String sceneId) throws Exception { + + // 获取大场景下场馆信息 + List ywSceneList = ywSceneService.getVenueByBigId(sceneBigId); + + List cellFormatBeans = new ArrayList<>(); + genFormatList(cellFormatBeans); + ImporterBase importer = new ImporterAgis(ywSceneNetelementAgisMapper); + + return importer.doAdd(cs, cellFormatBeans, sceneBigId, opType, ywSceneList, sceneId); + } + + private void genFormatList(List cellFormatBeans) { + cellFormatBeans.add(new CellFormatBean("专业", "alarmSpecityName", "false", "false", "", "", "yw_alarm_specialty", "", "")); + cellFormatBeans.add(new CellFormatBean("场馆", "sceneName", "false", "false", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("网元名称", "netElementName", "false", "false", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("端口", "portA", "true", "false", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("设备类型", "equipmentType", "true", "false", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("对端网元", "netElementB", "true", "false", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("对端端口", "portB", "true", "false", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("对端设备类型", "equipmentTypeB", "true", "false", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("备注", "desc", "true", "false", "", "", "", "", "")); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementCsServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementCsServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e1156810d64544a37c6329a9fe58e0bb6c8ce52b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementCsServiceImpl.java @@ -0,0 +1,78 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.eastcom_yw.common.enums.InRedLine; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementCsParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementCs; +import com.ruoyi.eastcom_yw.importer.ImporterCs; +import com.ruoyi.eastcom_yw.mapper.YwSceneNetelementCsMapper; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementCsService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author los + */ +@Service +@RequiredArgsConstructor +public class YwSceneNetelementCsServiceImpl implements YwSceneNetelementCsService { + + private final YwSceneService ywSceneService; + + private final YwSceneNetelementCsMapper ywSceneNetelementCsMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importCs(List cs, Long sceneBigId, String opType, String sceneId) throws Exception { + + // 获取大场景下场馆信息 + List ywSceneList = ywSceneService.getVenueByBigId(sceneBigId); + + List cellFormatBeans = new ArrayList<>(); + genFormatList(cellFormatBeans); + ImporterBase importer = new ImporterCs(ywSceneNetelementCsMapper); + + return importer.doAdd(cs, cellFormatBeans, sceneBigId, opType, ywSceneList, sceneId); + } + + private void genFormatList(List cellFormatBeans) { + cellFormatBeans.add(new CellFormatBean("场馆", "sceneName", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("设备类型", "equipmentType", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("组网类型", "networkingType", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("A端网元", "netElementNameA", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("A端端口", "portA", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("A端属性(红线内外)", "attributeA", "", "", "", "", "", "内,外", "")); + cellFormatBeans.add(new CellFormatBean("Z端网元", "netElementZ", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("Z端端口", "portZ", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("Z端属性(红线内外)", "attributeZ", "", "", "", "", "", "内,外", "")); + } + + @Override + public List list(YwSceneNetelementCsParam param) { + PageUtils.startPage(param, YwSceneNetelementCsParam.class); + List cs = ywSceneNetelementCsMapper.listAll(param); + cs.forEach(x -> { + if (InRedLine.IN_RED_LINE.getCode().equals(x.getAttributeA())) { + x.setAttributeA(InRedLine.IN_RED_LINE.getLabel()); + } else if (InRedLine.NOT_IN_RED_LINE.getCode().equals(x.getAttributeA())) { + x.setAttributeA(InRedLine.NOT_IN_RED_LINE.getLabel()); + } + if (InRedLine.IN_RED_LINE.getCode().equals(x.getAttributeZ())) { + x.setAttributeZ(InRedLine.IN_RED_LINE.getLabel()); + } else if (InRedLine.NOT_IN_RED_LINE.getCode().equals(x.getAttributeZ())) { + x.setAttributeZ(InRedLine.NOT_IN_RED_LINE.getLabel()); + } + }); + return cs; + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementDhServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementDhServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9c1bbd8c9c4427933d00ee4130e6304966ae4a53 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementDhServiceImpl.java @@ -0,0 +1,70 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.eastcom_yw.common.enums.InRedLine; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementDhParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementDh; +import com.ruoyi.eastcom_yw.importer.ImporterDh; +import com.ruoyi.eastcom_yw.mapper.YwSceneNetelementDhMapper; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementDhService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author los + */ +@Service +@RequiredArgsConstructor +public class YwSceneNetelementDhServiceImpl implements YwSceneNetelementDhService { + + private final YwSceneService ywSceneService; + + private final YwSceneNetelementDhMapper ywSceneNetelementDhMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importDh(List ywSceneNetelementDhes, Long sceneBigId, String opType, String sceneId) throws Exception { + + // 获取大场景下场馆信息 + List ywSceneList = ywSceneService.getVenueByBigId(sceneBigId); + + List cellFormatBeans = new ArrayList<>(); + genFormatList(cellFormatBeans); + ImporterBase importer = new ImporterDh(ywSceneNetelementDhMapper); + + return importer.doAdd(ywSceneNetelementDhes, cellFormatBeans, sceneBigId, opType, ywSceneList, sceneId); + } + + private void genFormatList(List cellFormatBeans) { + cellFormatBeans.add(new CellFormatBean("场馆", "sceneName", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("地市", "city", "", "", "", "", "yw_city", "", "")); + cellFormatBeans.add(new CellFormatBean("区县", "county", "", "", "", "", "yw_county", "", "")); + cellFormatBeans.add(new CellFormatBean("物理站名", "netElementPhyname", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("机房类型", "roomType", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("红线内外", "inRedline", "false", "", "", "", "", "内,外", "")); + } + + @Override + public List list(YwSceneNetelementDhParam para) { + PageUtils.startPage(para, YwSceneNetelementDhParam.class); + List dhs = ywSceneNetelementDhMapper.listAll(para); + dhs.forEach(x -> { + if (InRedLine.IN_RED_LINE.getCode().equals(x.getInRedline())) { + x.setInRedline(InRedLine.IN_RED_LINE.getLabel()); + } else if (InRedLine.NOT_IN_RED_LINE.getCode().equals(x.getInRedline())) { + x.setInRedline(InRedLine.NOT_IN_RED_LINE.getLabel()); + } + }); + return dhs; + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..eea4790ba19df891daa237d2e3e9a4d1560684d3 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementServiceImpl.java @@ -0,0 +1,86 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.poi.EasyPoiExcelUtil; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwSceneNetelement; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendarVo; +import com.ruoyi.eastcom_yw.mapper.YwSceneNetelementMapper; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author huamile + */ +@Service +@RequiredArgsConstructor +public class YwSceneNetelementServiceImpl extends ServiceImpl implements YwSceneNetelementService { + + private final YwSceneNetelementMapper ywSceneNetelementMapper; + + @Override + public List getList(YwSceneNetelementParam param) { + PageUtils.startPage(param,YwSceneNetelementParam.class); + return ywSceneNetelementMapper.getList(param); + } + + @Override + public List getListBySceneBigId(Long sceneBigId) { + return ywSceneNetelementMapper.getListBySceneBigId(sceneBigId); + } + + @Override + public Integer create(YwSceneNetelement ywSceneNetelement) { + validate(ywSceneNetelement); + return ywSceneNetelementMapper.insertSelective(ywSceneNetelement); + } + + @Override + public Integer updateByPrimaryKeySelective(YwSceneNetelement ywSceneNetelement) { + validate(ywSceneNetelement); + return ywSceneNetelementMapper.updateByPrimaryKeySelective(ywSceneNetelement); + } + + @Override + public Integer delBySceneIds(List ids) { + if (CollectionUtil.isNotEmpty(ids)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(YwSceneNetelement::getSceneId,ids); + return ywSceneNetelementMapper.delete(wrapper); + } + return null; + } + + @Override + public void export(YwSceneNetelementParam param, HttpServletRequest request, HttpServletResponse response) { + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + List list = getList(param); + ExcelUtil util = new ExcelUtil<>(YwSceneNetelement.class); + util.exportExcel(response, list, "场馆网元配置"); +// EasyPoiExcelUtil.exportExcel("场馆网元配置", YwSceneNetelement.class,list,request,response); + } + + private void validate(YwSceneNetelement ywSceneNetelement) { + //根据网元名称去重 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StrUtil.isNotBlank(ywSceneNetelement.getNetElementName()),YwSceneNetelement::getNetElementName,ywSceneNetelement.getNetElementName()); + wrapper.ne(ywSceneNetelement.getId() != null,YwSceneNetelement::getId,ywSceneNetelement.getId()); + List list = ywSceneNetelementMapper.selectList(wrapper); + if (CollectionUtil.isNotEmpty(list)) { + throw new ServiceException("网元重复"); + } + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementWxServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementWxServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fc99fe945f5e3fe95b55570acd1d83bf9d5aa466 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNetelementWxServiceImpl.java @@ -0,0 +1,151 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.common.enums.InRedLine; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementWxParam; +import com.ruoyi.eastcom_yw.domain.vo.WholeAreaAssureCellSheet; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementWx; +import com.ruoyi.eastcom_yw.importer.ImporterWx; +import com.ruoyi.eastcom_yw.mapper.YwSceneNetelementWxMapper; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementWxService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author los + */ +@Service +@RequiredArgsConstructor +public class YwSceneNetelementWxServiceImpl implements YwSceneNetelementWxService { + + private final YwSceneService ywSceneService; + + private final YwSceneNetelementWxMapper ywSceneNetelementWxMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importWx(List ywSceneNetelementWxes, Long sceneBigId, String optType, String sceneId) throws Exception { + + // 获取大场景下场馆信息 + List ywSceneList = ywSceneService.getVenueByBigId(sceneBigId); + + List cellFormatBeans = new ArrayList<>(); + genFormatList(cellFormatBeans); + ImporterBase importer = new ImporterWx(ywSceneNetelementWxMapper); + + return importer.doAdd(ywSceneNetelementWxes, cellFormatBeans, sceneBigId, optType, ywSceneList, sceneId); + + } + + private void genFormatList(List cellFormatBeans) { + cellFormatBeans.add(new CellFormatBean("场馆名称", "sceneName", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场景名称", "场景名称", "true", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("OMC", "omc", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("地市", "city", "false", "", "", "", "yw_city", "", "")); + cellFormatBeans.add(new CellFormatBean("县市", "county", "false", "", "", "", "yw_county", "", "")); + cellFormatBeans.add(new CellFormatBean("enodebid", "enodebidStr", "", "", "true", "integer", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("本地小区标识", "本地小区标识Str", "", "", "true", "integer", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("小区标识", "小区标识Str", "", "", "true", "integer", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("站号", "站号Str", "", "", "true", "integer", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("基站全称", "基站全称", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("en", "en名称", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("小区名称", "小区名称", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("小区别名", "小区别名", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("ci", "ci", "false", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("红线内外", "inRedline", "false", "", "", "", "", "内,外", "")); + cellFormatBeans.add(new CellFormatBean("小区频段", "小区频段", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("纬度", "纬度Str", "", "", "true", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("经度", "经度Str", "", "", "true", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("纬度gcj", "纬度gcj", "", "", "true", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("经度gcj", "经度gcj", "", "", "true", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("室内室外", "室内室外", "", "", "", "", "", "室内,室外", "")); + cellFormatBeans.add(new CellFormatBean("网络", "网络", "", "", "", "", "", "4G,5G,2G", "")); + cellFormatBeans.add(new CellFormatBean("0427现网状态", "现网状态", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("CGI", "cgi", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("频点", "频点Str", "", "", "true", "integer", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("pci", "pciStr", "", "", "true", "integer", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("tac", "tacStr", "", "", "true", "integer", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("一级场景", "一级场景", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("二级场景", "二级场景", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("设备类型", "设备类型", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("带宽", "带宽Str", "", "", "true", "integer", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("方位角", "方位角Str", "", "", "true", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("扇区id", "扇区id", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("坐席编号", "坐席编号", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场景类型编码", "sceneTypeCode", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场景类型", "sceneType", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场景子类型编码", "subSceneTypeCode", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场景子类型", "subSceneType", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("场景编码", "sceneCode", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("覆盖子场景编码", "coverSubSceneCode", "", "", "", "", "", "", "")); + cellFormatBeans.add(new CellFormatBean("覆盖子场景", "coverSubScene", "", "", "", "", "", "", "")); + } + + @Override + public List list(YwSceneNetelementWxParam para) { + PageUtils.startPage(para, YwSceneNetelementWxParam.class); + List wxes = ywSceneNetelementWxMapper.listAll(para); + wxes.forEach(x -> { + if (InRedLine.IN_RED_LINE.getCode().equals(x.getInRedline())) { + x.setInRedline(InRedLine.IN_RED_LINE.getLabel()); + } else if (InRedLine.NOT_IN_RED_LINE.getCode().equals(x.getInRedline())) { + x.setInRedline(InRedLine.NOT_IN_RED_LINE.getLabel()); + } + x.setEnodebidStr(StringUtils.nonNullString(x.getEnodebid())); + x.set本地小区标识Str(StringUtils.nonNullString(x.get本地小区标识())); + x.set小区标识Str(StringUtils.nonNullString(x.get小区标识())); + x.set站号Str(StringUtils.nonNullString(x.get站号())); + x.set频点Str(StringUtils.nonNullString(x.get频点())); + x.setPciStr(StringUtils.nonNullString(x.getPci())); + x.setTacStr(StringUtils.nonNullString(x.getTac())); + x.set带宽Str(StringUtils.nonNullString(x.get带宽())); + x.set方位角Str(StringUtils.nonNullString(x.get方位角())); + x.set经度Str(StringUtils.nonNullString(x.get经度())); + x.set纬度Str(StringUtils.nonNullString(x.get纬度())); + x.setCity(StringUtils.isNotEmpty(x.get地市()) ? DictUtils.getDictLabel("yw_city", x.get地市()) : null); + x.setCounty(StringUtils.isNotEmpty(x.get县市()) ? DictUtils.getDictLabel("yw_county", x.get县市()) : null); + }); + return wxes; + } + + @Override + public List list2(YwSceneNetelementWxParam para) { + PageUtils.startPage(para, YwSceneNetelementWxParam.class); + List wxes = ywSceneNetelementWxMapper.listAll2(para); + return wxes; + } + + @Override + public List listCell(YwSceneNetelementWxParam param) { + PageUtils.clearPage(); + List list = ywSceneNetelementWxMapper.listAll(param); + list = list.stream().filter(e -> null != e.get小区名称() && !e.get小区名称().equals("")).collect(Collectors.toList()); + for (YwSceneNetelementWx netelementWx : list) { + if (netelementWx.getAreacountyid() != null && !netelementWx.getAreacountyid().equals("")) + netelementWx.setCity(netelementWx.getAreacountyid().substring(0, 4)); + } + return list; + } + + + @Override + public List listSeat(Long sceneId) { + PageUtils.clearPage(); + List list = ywSceneNetelementWxMapper.listSeatId(sceneId); + list = list.stream().filter(e -> null != e.get坐席编号() && !e.get坐席编号().equals("")).collect(Collectors.toList()); + return list; + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNoticeinfoServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNoticeinfoServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9817da3dc34b0b7de6b49dd7b3c05ecabb844d8e --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneNoticeinfoServiceImpl.java @@ -0,0 +1,272 @@ +package com.ruoyi.eastcom_yw.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneNoticeinfoSearchDTO; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.importer.ImporterSceneNoticeinfo; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.YwSceneNoticeinfoService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.yaml.snakeyaml.util.ArrayUtils; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * (YwSceneNoticeinfo)表服务实现类 + * + * @author lee + * @since 2023-05-23 10:10:42 + */ +@Service("ywSceneNoticeinfoService") +@RequiredArgsConstructor +public class YwSceneNoticeinfoServiceImpl extends ServiceImpl implements YwSceneNoticeinfoService { + + private final YwSceneNoticeinfoMapper ywSceneNoticeinfoMapper; + + private final YwSceneMapper ywSceneMapper; + + private final YwSceneNetelementMapper ywSceneNetelementMapper; + + private final YwSceneNetelementWxMapper ywSceneNetelementWxMapper; + private final YwSceneNetelementCsMapper ywSceneNetelementCsMapper; + private final YwSceneNetelementDhMapper ywSceneNetelementDhMapper; + private final YwSceneNetelementAgisMapper ywSceneNetelementAgisMapper; + + /** + * 通过条件查询 + * + * @param ywSceneNoticeinfo 条件 + * @return 数据 + */ + @Override + public List getNoticeinfoBySearch(YwSceneNoticeinfoSearchDTO ywSceneNoticeinfo) { + List ywSceneNoticeinfos = ywSceneNoticeinfoMapper.selectBySearch(ywSceneNoticeinfo); + for (YwSceneNoticeinfo sceneNoticeinfo : ywSceneNoticeinfos) { + if (sceneNoticeinfo.getId() == 1) { + sceneNoticeinfo.setSceneName("合计"); + break; + } + } + return ywSceneNoticeinfos; + } + + public static T calculateDynamicFieldSums(Boolean isNet,List entities, Class clazz) { + + T sumEntity; + try { + sumEntity = clazz.getDeclaredConstructor().newInstance(); + Field[] fields = clazz.getDeclaredFields(); + + //只处理网元类的 + if(isNet) { + List netColumn = new ArrayList<>(); + netColumn.add("wxNetNum"); + netColumn.add("dhNetNum"); + netColumn.add("agisNetNum"); + netColumn.add("agisNum"); + netColumn.add("wifiNetNum"); + netColumn.add("voipNetNum"); + netColumn.add("publicTransportEquipNum"); + fields = Arrays.stream(fields).filter(x -> netColumn.contains(x.getName())).toArray(Field[]::new); + } + + for (Field field : fields) { + + if (isNumericField(field.getType())) { + field.setAccessible(true); + int fieldValueSum = 0; + + for (T entity : entities) { + if (field.get(entity) != null) { + int fieldValue = (int) field.get(entity); + fieldValueSum += fieldValue; + } + } + + field.set(sumEntity, fieldValueSum); + } + } + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + return sumEntity; + } + + private static boolean isNumericField(Class fieldType) { + return fieldType == int.class || fieldType == Integer.class; + } + + /** + * 批量导入 + * + * @param ywSceneNoticeinfos 数据 + * @param importType 导入模式 + * @return 导入结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult batchImport(List ywSceneNoticeinfos, String importType) throws Exception { + ImporterBase importer = new ImporterSceneNoticeinfo(ywSceneNoticeinfoMapper, ywSceneMapper); + return importer.doAdd(ywSceneNoticeinfos, null, importType); + } + + @Override + public void reset(Boolean isNet) { + YwSceneNoticeinfoSearchDTO ywSceneNoticeinfo = new YwSceneNoticeinfoSearchDTO(); + ywSceneNoticeinfo.setPageNum(null); + ywSceneNoticeinfo.setPageSize(null); + List allVos = ywSceneNoticeinfoMapper.selectBySearch(ywSceneNoticeinfo); + allVos.remove(0); + YwSceneNoticeinfo sum = calculateDynamicFieldSums(isNet,allVos, YwSceneNoticeinfo.class); + //蓝色雨季: + //专网的根据网元名称去重统计 + // + //蓝色雨季: + //动环的是根据物理站名去重统计 + // + //蓝色雨季: + //传输是根据A端网元去重统计 + // + //蓝色雨季: + //无线也要根据小区ci去重 + //所有原来统计出来各个场馆的告警的4个数据不正确,需要重新取 + Integer [] res =ywSceneNetelementMapper.getNetelementNum(); + //wx + sum.setWxNetNum(res[0]); + //dh + sum.setDhNetNum(res[1]); + //cs + sum.setPublicTransportEquipNum(res[2]); + // agis+wifi+voip + sum.setAgisNetNum(res[3]+res[4]+res[5]); + //agis + sum.setAgisNum(res[3]); + //wifi + sum.setWifiNetNum(res[4]); + //voip + sum.setVoipNetNum(res[5]); + sum.setId(1L); + ywSceneNoticeinfoMapper.updateById(sum); + } + + @Override + @Transactional + public void statisticsNetNum() { + List noticeinfos = ywSceneNoticeinfoMapper.selectBySearch(null); + //无线网元数 + Map wxMap = ywSceneNetelementWxMapper.listAll(null).stream().collect(Collectors.groupingBy(YwSceneNetelementWx::getSceneId, Collectors.summingInt(e -> 1))); + //专网网元数 + Map agisMap = ywSceneNetelementAgisMapper.listAll(null).stream().collect(Collectors.groupingBy(YwSceneNetelementAgis::getSceneId, Collectors.summingInt(e -> 1))); + Map agisNumMap = ywSceneNetelementAgisMapper.listAll(null).stream().filter(l->"agis".equals(l.getAlarmSpecityId())).collect(Collectors.groupingBy(YwSceneNetelementAgis::getSceneId, Collectors.summingInt(e -> 1))); + Map wifiMap = ywSceneNetelementAgisMapper.listAll(null).stream().filter(l->"wifi".equals(l.getAlarmSpecityId())).collect(Collectors.groupingBy(YwSceneNetelementAgis::getSceneId, Collectors.summingInt(e -> 1))); + Map voipMap = ywSceneNetelementAgisMapper.listAll(null).stream().filter(l->"voip".equals(l.getAlarmSpecityId())).collect(Collectors.groupingBy(YwSceneNetelementAgis::getSceneId, Collectors.summingInt(e -> 1))); + //动环网元数 + Map dhMap = ywSceneNetelementDhMapper.listAll(null).stream().collect(Collectors.groupingBy(YwSceneNetelementDh::getSceneId, Collectors.summingInt(e -> 1))); + //公网传输设备 + Map csMap = ywSceneNetelementCsMapper.listAll(null).stream().collect(Collectors.groupingBy(YwSceneNetelementCs::getSceneId, Collectors.summingInt(e -> 1))); + //专网传输设备 +// ywSceneNetelementAgisService.list(); + + ArrayList list = new ArrayList<>(); + for (YwSceneNoticeinfo noticeinfo : noticeinfos) { + YwSceneNoticeinfo sceneNoticeinfo = new YwSceneNoticeinfo(); + sceneNoticeinfo.setId(noticeinfo.getId()); + boolean flag = false; + + + Integer wxReal = wxMap.get(noticeinfo.getSceneId()); + Integer wx = noticeinfo.getWxNetNum(); + if (wxReal == null && (wx == null || wx != 0)) { + sceneNoticeinfo.setWxNetNum(0); + flag = true; + } else if (wxReal != null && !wxReal.equals(wx)) { + sceneNoticeinfo.setWxNetNum(wxReal); + flag = true; + } + + Integer agisReal = agisMap.get(noticeinfo.getSceneId()); +// agis+wifi+voip + Integer agis = noticeinfo.getAgisNetNum(); + if (agisReal == null && (agis == null || agis != 0)) { + sceneNoticeinfo.setAgisNetNum(0); + flag = true; + } else if (agisReal != null && !agisReal.equals(agis)) { + sceneNoticeinfo.setAgisNetNum(agisReal); + flag = true; + } + + Integer agisNumReal = agisNumMap.get(noticeinfo.getSceneId()); + Integer agisNum = noticeinfo.getAgisNum(); + if (agisNumReal == null && (agisNum == null || agisNum != 0)) { + sceneNoticeinfo.setAgisNum(0); + flag = true; + } else if (agisNumReal != null && !agisNumReal.equals(agis)) { + sceneNoticeinfo.setAgisNum(agisNumReal); + flag = true; + } + + Integer wifiReal = wifiMap.get(noticeinfo.getSceneId()); + Integer wifi = noticeinfo.getWifiNetNum(); + if (wifiReal == null && (wifi == null || wifi != 0)) { + sceneNoticeinfo.setWifiNetNum(0); + sceneNoticeinfo.setInternetNetNum(0); + flag = true; + } else if (wifiReal != null && !wifiReal.equals(agis)) { + sceneNoticeinfo.setWifiNetNum(wifiReal); + sceneNoticeinfo.setInternetNetNum(wifiReal); + flag = true; + } + + Integer voipReal = voipMap.get(noticeinfo.getSceneId()); + Integer voip = noticeinfo.getVoipNetNum(); + if (voipReal == null && (voip == null || voip != 0)) { + sceneNoticeinfo.setVoipNetNum(0); + flag = true; + } else if (voipReal != null && !voipReal.equals(agis)) { + sceneNoticeinfo.setVoipNetNum(voipReal); + flag = true; + } + + Integer dhReal = dhMap.get(noticeinfo.getSceneId()); + Integer dh = noticeinfo.getDhNetNum(); + if (dhReal == null && (dh == null || dh != 0)) { + sceneNoticeinfo.setDhNetNum(0); + flag = true; + } else if (dhReal != null && !dhReal.equals(dh)) { + sceneNoticeinfo.setDhNetNum(dhReal); + flag = true; + } + + Integer csReal = csMap.get(noticeinfo.getSceneId()); + Integer cs = noticeinfo.getPublicTransportEquipNum(); + if (csReal == null && (cs == null || cs != 0)) { + sceneNoticeinfo.setPublicTransportEquipNum(0); + flag = true; + } else if (csReal != null && !csReal.equals(cs)) { + sceneNoticeinfo.setPublicTransportEquipNum(csReal); + flag = true; + } + + if (flag) { + list.add(sceneNoticeinfo); + } + } + updateBatchById(list); + //调用一次重置总和 + reset(true); + } + +} + diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwScenePictureServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwScenePictureServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..16cb8b9cbec5e8370b006563abc755eba6bc1a39 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwScenePictureServiceImpl.java @@ -0,0 +1,724 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.YwSceneCalendar; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectStatParam; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.YwAlarmViewService; +import com.ruoyi.eastcom_yw.service.YwRoutInspectPlanService; +import com.ruoyi.eastcom_yw.service.YwScenePictureService; +import com.ruoyi.eastcom_yw.service.YwSignLogViewService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.ParseException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author los + */ +@RequiredArgsConstructor +@Service("ywScenePictureServiceImpl") +public class YwScenePictureServiceImpl implements YwScenePictureService { + + private final YwSignLogViewService ywSignLogViewService; + private final YwAlarmViewService ywAlarmViewService; + private final YwRoutInspectPlanService ywRoutInspectPlanService; + + private final YwScenePictureMapper ywScenePictureMapper; + private final YwSceneCalendarMapper ywSceneCalendarMapper; + + private final YwAlarmStatisticsMapper ywAlarmStatisticsMapper; + private final YwSceneNoticeinfoMapper ywSceneNoticeinfoMapper; + + private final YwSignLogViewMapper ywSignLogViewMapper; + + + /** + * 任务管理 + * + * @param id 场馆id + * @return 统计值 + */ + @Override + public JSONObject listTaskManage(Long id) { + JSONObject jsonObject = new JSONObject(); + YwRoutInspectStatParam ywRoutInspectStatParam = new YwRoutInspectStatParam(); + ywRoutInspectStatParam.setVenueIds(new Long[]{id}); + + String date = DateUtils.getDate(); + + ywRoutInspectStatParam.setBeginDate(date); + ywRoutInspectStatParam.setEndDate(date + " 23:59:59"); + ywRoutInspectStatParam.setTaskFlag(true); + + // 巡检正常率 + Map resultStatData = ywRoutInspectPlanService.getResultStatData(ywRoutInspectStatParam); + + // 巡检完成率 + Map statData = ywRoutInspectPlanService.getStatData(ywRoutInspectStatParam); + + // 布线完成率 + /*Integer numOfBxAll = ywScenePictureMapper.getNumOfBXALL(id); + Integer numOfBxComplete = ywScenePictureMapper.getNumOfBXComplete(id); + double rateBxComplete = 0.00d; + if (numOfBxAll != 0) { + rateBxComplete = BigDecimal.valueOf((numOfBxComplete.doubleValue() / numOfBxAll) * 100) + .setScale(2, RoundingMode.HALF_UP).doubleValue(); + }*/ + + // 应巡检数、实巡检数、异常巡检数 + jsonObject.put("xjNumOfAllPlan", statData.get("numOfAllPlan")); + jsonObject.put("xjNumOfCompletedPlan", statData.get("numOfCompletedPlan")); + jsonObject.put("xjNumOfQuesPlan", (Integer) resultStatData.get("numOfAllPlan") - (Integer) resultStatData.get("numOfNoQuPlan")); + + return jsonObject; + } + + /** + * 人员签到 + * + * @param id 场馆id + * @return 统计值 + */ + @Override + public JSONObject listSign(Long id) { + JSONObject jsonObject = new JSONObject(); + + YwSignLogDTO ywSignLogDTO = new YwSignLogDTO(); + ywSignLogDTO.setVenueIds(new Long[]{id}); + ywSignLogDTO.setGenTime(true); + ywSignLogDTO.setStartDate(DateUtils.parseDateToStr("yyyy-MM-dd", DateUtils.getNowDate())); + ywSignLogDTO.setEndDate(DateUtils.parseDateToStr("yyyy-MM-dd", DateUtils.getNowDate())+" 23:59:59"); + ywSignLogDTO.setToday(true); + + List signLogStatic = ywSignLogViewMapper.getSignLogStatic20231012(ywSignLogDTO); + + if (signLogStatic == null || signLogStatic.size() == 0) { + // 应签到数/实签到数/签到率 + jsonObject.put("signAllNum", 0); + jsonObject.put("signFinishNum",0); + jsonObject.put("signFinishRate",0.0); + + } + else { + // 应签到数/实签到数/签到率 + jsonObject.put("signAllNum", signLogStatic.get(0).getAllNum()); + jsonObject.put("signFinishNum", signLogStatic.get(0).getFinishNum()); + jsonObject.put("signFinishRate", BigDecimal.valueOf(signLogStatic.get(0).getFinishRate() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue()); + } + return jsonObject; + } + + /** + * 场馆基本信息 + * + * @param id 场馆id + * @return 统计值 + */ + @Override + public JSONObject listMatchTop3(Long id) { + JSONObject jsonObject = new JSONObject(); + + // 简报用 + YwSceneNoticeinfo ywSceneNoticeinfo = new YwSceneNoticeinfo(); + List ywSceneNoticeinfos = ywSceneNoticeinfoMapper.selectBySceneId(id); + if (CollectionUtil.isNotEmpty(ywSceneNoticeinfos)) { + ywSceneNoticeinfo = ywSceneNoticeinfos.get(0); + } + //无线网元数 + jsonObject.put("wxNetNum", ywSceneNoticeinfo.getWxNetNum()); + //AGIS网元数 + jsonObject.put("agisNetNum", ywSceneNoticeinfo.getAgisNetNum()); + //互联网网元数 + jsonObject.put("internetNetNum", ywSceneNoticeinfo.getInternetNetNum()); + //公网传输设备 + jsonObject.put("publicTransportEquipNum", ywSceneNoticeinfo.getPublicTransportEquipNum()); + //公网接入环 + jsonObject.put("publicInterfaceRingNum", ywSceneNoticeinfo.getPublicInterfaceRingNum()); + //专网传输设备 + jsonObject.put("privateTransportEquipNum", ywSceneNoticeinfo.getPrivateTransportEquipNum()); + //专网接入环 + jsonObject.put("privateInterfaceRingNum", ywSceneNoticeinfo.getPrivateInterfaceRingNum()); + //现场保障人员 + jsonObject.put("frontUser", ywSceneNoticeinfo.getFrontuser()); + //后台保障人员 + jsonObject.put("backUser", ywSceneNoticeinfo.getBackuser()); + //场馆部署应急车 + jsonObject.put("emergencyCarNum", ywSceneNoticeinfo.getEmergencycar()); + //场馆部署应急仓 + jsonObject.put("emergencyWarehouse", ywSceneNoticeinfo.getEmergencyWarehouse()); + Map alarmMap = getAlarmStatisticsAccordingSceneId(id, "Y"); + //AGIS专网 未恢复告警数 + jsonObject.put("agisAlarm", alarmMap.get("agis")); + //无线 未恢复告警数 + jsonObject.put("wxAlarm", alarmMap.get("wx")); + //wifi 未恢复告警数 + jsonObject.put("wifiAlarm", alarmMap.get("wifi")); + //专网传输 未恢复告警数 + jsonObject.put("privateAlarm", alarmMap.get("agis")); + //公网传输 未恢复告警数 + jsonObject.put("publicAlarm", alarmMap.get("cs")); + + Map n = getAlarmStatisticsAccordingSceneId(id, "N"); + //AGIS专网 未恢复告警数 红线外 + jsonObject.put("agisAlarmBydRedLine", n.get("agis")); + //无线 未恢复告警数 红线外 + jsonObject.put("wxAlarmBydRedLine", n.get("wx")); + //专网传输 未恢复告警数 红线外 + jsonObject.put("privateAlarmBydRedLine", n.get("agis")); + //公网传输 未恢复告警数 红线外 + jsonObject.put("publicAlarmBydRedLine", n.get("cs")); + /*//总体情况:告警数 + jsonObject.put("totalAlarm", alarmMap.get("wx") + alarmMap.get("cs") + alarmMap.get("dh") + alarmMap.get("agis")); + //传输情况:告警数 + jsonObject.put("csAlarm", alarmMap.get("cs")); + //45G公网情况:告警数 + jsonObject.put("publicAlarm", alarmMap.get("wx") + alarmMap.get("cs") + alarmMap.get("dh"));*/ + /*//总体情况:红线内外网元总数 + jsonObject.put("netTotalNum", ywSceneNoticeinfo.getNetTotalNum()); + //传输情况:传输设备 + jsonObject.put("transportEquipNum", ywSceneNoticeinfo.getTransportEquipNum()); + //传输情况:接入环 + jsonObject.put("interfaceRingNum", ywSceneNoticeinfo.getInterfaceRingNum()); + //45G公网情况:网元总数 + jsonObject.put("publicNetNum", ywSceneNoticeinfo.getPublicNetNum());*/ + + // 场馆画像用 + /*YwSceneNetelementWxParam param1 = new YwSceneNetelementWxParam(); + param1.setSceneId(id); + List wx = ywSceneNetelementWxMapper.listAll(param1); + if (wx != null) { + jsonObject.put("netNum", wx.size()); + } else { + jsonObject.put("netNum", 0); + } + YwSceneNetelementCsParam param2 = new YwSceneNetelementCsParam(); + param2.setSceneId(id); + List cs = ywSceneNetelementCsMapper.listAll(param2); + if (cs != null) { + jsonObject.put("equipNum", cs.size()); + } else { + jsonObject.put("equipNum", 0); + }*/ + jsonObject.put("netNum", ywSceneNoticeinfo.getNetTotalNum()); + jsonObject.put("equipNum", ywSceneNoticeinfo.getTransportEquipNum()); + + if (id == 2) { + jsonObject.put("manager", "李前兴"); + jsonObject.put("phone", "15088689169"); + } else if (id == 25) { + jsonObject.put("manager", "周珍"); + jsonObject.put("phone", "15868882228"); + } else { + List manager = ywScenePictureMapper.selectManagerInfoBySceneId(id); + if (manager != null && manager.size() > 0) { + jsonObject.put("manager", manager.get(0).getManagerName()); + jsonObject.put("phone", manager.get(0).getPhone()); + } else { + jsonObject.put("manager", null); + jsonObject.put("phone", null); + } + } + + + Date dateDay = null; + Date dateTime = null; + + try { + dateDay = DateUtils.parseDate(DateUtils.parseDateToStr("yyyy-MM-dd", DateUtils.getNowDate()), "yyyy-MM-dd"); + dateTime = DateUtils.parseDate(DateUtils.parseDateToStr("HH:mm:ss", DateUtils.getNowDate()), "HH:mm:ss"); + } catch (ParseException e) { + e.printStackTrace(); + } + List calendarList = null; + if (dateDay != null && dateTime != null) { + calendarList = ywSceneCalendarMapper.selectByMatchDateAndSceneIdAndEndTimeGreaterThanEqualOrderByBeginTime(dateDay, id, dateTime); + for (YwSceneCalendar ywSceneCalendar : calendarList) { + if (StringUtils.isNotEmpty(ywSceneCalendar.getMatchType())) { + // 赛事图标 + ywSceneCalendar.setUrl("/profile/upload/matchicon/" + ywSceneCalendar.getMatchType() + ".png"); + //场馆画像版赛事图标 + ywSceneCalendar.setScenePictureUrl("/profile/upload/scenePictureMatchicon/" + ywSceneCalendar.getMatchType() + ".png"); + ywSceneCalendar.setMatchType(DictUtils.getDictLabel("yw_match_type", ywSceneCalendar.getMatchType())); + } + } + } + jsonObject.put("matchTop", calendarList); + return jsonObject; + } + + public void generateAlarmStatisticsEvery5Minutes() { + Calendar instance = Calendar.getInstance(); + instance.add(Calendar.MINUTE, 1); + instance.set(Calendar.SECOND, 0); + instance.set(Calendar.MILLISECOND, 0); + Date now = instance.getTime(); + YwAlarmDTO ywAlarmDTO = new YwAlarmDTO(); + // 去除分页 + ywAlarmDTO.setPageNum(1); + ywAlarmDTO.setPageSize(Integer.MAX_VALUE); + // 查实时的 + ywAlarmDTO.setAlarmStatus("0"); + // 排除挂起的 + ywAlarmDTO.setDealStatus("1"); + // 排除红线外的 + ywAlarmDTO.setInRedLine("Y"); + // 不需要排序 + ywAlarmDTO.setOrderByTime("no"); + + String[] alarmTypes = new String[]{"wx", "cs", "dh", "agis"}; + Map> alarmMap = new HashMap<>(4); + for (String alarmType : alarmTypes) { + // 查相应专业的 + ywAlarmDTO.setAlarmType(alarmType); + // 过滤掉故障数清零的 + List ywAlarmByDto = ywAlarmViewService.getYwAlarmByDto(ywAlarmDTO).stream(). + filter(x -> !x.getClearNumDisplay().split("/")[0].equals(x.getClearNumDisplay().split("/")[1])). + collect(Collectors.toList()); + alarmMap.put(alarmType, ywAlarmByDto); + } + + List ywAlarmStatistics = new ArrayList<>(); + for (String next : alarmMap.keySet()) { + Set sceneSet = new HashSet<>(); + List ywAlarmViewVos = alarmMap.get(next); + for (YwAlarmViewVo ywAlarmViewVo : ywAlarmViewVos) { + if (ywAlarmViewVo.getVenueId() != null) { + sceneSet.add(ywAlarmViewVo.getVenueId()); + } + } + for (Integer integer : sceneSet) { + YwAlarmStatistics ywAlarmStatistics1 = new YwAlarmStatistics(); + int count = 0; + for (YwAlarmViewVo ywAlarmViewVo : ywAlarmViewVos) { + if (Objects.equals(integer, ywAlarmViewVo.getVenueId())) { + count++; + } + } + ywAlarmStatistics1.setSceneId(Long.valueOf(integer)); + ywAlarmStatistics1.setNum((long) count); + ywAlarmStatistics1.setProfession(next); + ywAlarmStatistics1.setCreateTime(now); + ywAlarmStatistics.add(ywAlarmStatistics1); + } + } + + if(ywAlarmStatistics.size()>0) { + ywAlarmStatisticsMapper.deleteByCreateTimeBefore(); + ywAlarmStatisticsMapper.insertBatch(ywAlarmStatistics); + } + } + + /** + * 中小屏场馆画像-巡检统计数据 + * + * @param id 场馆id + * @return + */ + @Override + public JSONObject listTaskManage2(Long id,Boolean taskFlag) { + JSONObject jsonObject = new JSONObject(); + YwRoutInspectStatParam ywRoutInspectStatParam = new YwRoutInspectStatParam(); + ywRoutInspectStatParam.setVenueIds(new Long[]{id}); + + LocalDateTime now = LocalDateTime.now(); + +// String date = DateUtils.getDate(); + + String date = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + + ywRoutInspectStatParam.setBeginDate(date); + + String time = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + + ywRoutInspectStatParam.setEndDate(time); + + ywRoutInspectStatParam.setTaskFlag(taskFlag); + + // 巡检正常率 + Map resultStatData = ywRoutInspectPlanService.getResultStatData(ywRoutInspectStatParam); + + // 巡检完成率 + Map statData = ywRoutInspectPlanService.getStatData(ywRoutInspectStatParam); + + // 应巡检数、实巡检数、异常巡检数 + jsonObject.put("xjNumOfAllPlan", statData.get("numOfAllPlan")); + jsonObject.put("xjNumOfCompletedPlan", statData.get("numOfCompletedPlan")); + jsonObject.put("xjNumOfQuesPlan", (Integer) resultStatData.get("numOfAllPlan") - (Integer) resultStatData.get("numOfNoQuPlan")); + + return jsonObject; + } + + /** + * 场馆告警 + * + * @param id 场馆id + * @return 统计值 + */ + @Override + public JSONObject listAlarm(Long id) { + + Map alarmMap = getAlarmStatisticsAccordingSceneId(id, "Y"); + + /*List xaxis = new ArrayList<>(); + List value = new ArrayList<>(); + List value2 = new ArrayList<>(); + List value3 = new ArrayList<>(); + List value4 = new ArrayList<>(); + + Calendar instance = Calendar.getInstance(); + instance.set(Calendar.SECOND, 0); + instance.set(Calendar.MILLISECOND, 0); + Date now = instance.getTime(); + instance.add(Calendar.MINUTE, -15); + Date nowMinus15Min = instance.getTime(); + instance.add(Calendar.MINUTE, -15); + Date nowMinus30Min = instance.getTime(); + instance.add(Calendar.MINUTE, -15); + Date nowMinus45Min = instance.getTime();*/ + + JSONObject jsonObject = new JSONObject(); +/* + xaxis.add(DateUtils.parseDateToStr("HH:mm", nowMinus45Min)); + xaxis.add(DateUtils.parseDateToStr("HH:mm", nowMinus30Min)); + xaxis.add(DateUtils.parseDateToStr("HH:mm", nowMinus15Min)); + xaxis.add(DateUtils.parseDateToStr("HH:mm", now)); + + YwAlarmStatistics ywWxAlarmStatistics15 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus15Min, "wx").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus15Min, "wx").get(0); + YwAlarmStatistics ywWxAlarmStatistics30 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus30Min, "wx").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus30Min, "wx").get(0); + YwAlarmStatistics ywWxAlarmStatistics45 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus45Min, "wx").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus45Min, "wx").get(0); + YwAlarmStatistics ywCsAlarmStatistics15 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus15Min, "cs").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus15Min, "cs").get(0); + YwAlarmStatistics ywCsAlarmStatistics30 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus30Min, "cs").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus30Min, "cs").get(0); + YwAlarmStatistics ywCsAlarmStatistics45 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus45Min, "cs").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus45Min, "cs").get(0); + YwAlarmStatistics ywDhAlarmStatistics15 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus15Min, "dh").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus15Min, "dh").get(0); + YwAlarmStatistics ywDhAlarmStatistics30 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus30Min, "dh").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus30Min, "dh").get(0); + YwAlarmStatistics ywDhAlarmStatistics45 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus45Min, "dh").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus45Min, "dh").get(0); + YwAlarmStatistics ywAgisAlarmStatistics15 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus15Min, "agis").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus15Min, "agis").get(0); + YwAlarmStatistics ywAgisAlarmStatistics30 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus30Min, "agis").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus30Min, "agis").get(0); + YwAlarmStatistics ywAgisAlarmStatistics45 = ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus45Min, "agis").size() == 0 ? null : ywAlarmStatisticsMapper.selectBySceneIdAndCreateTimeAndProfession(id, nowMinus45Min, "agis").get(0); + + value.add(null == ywWxAlarmStatistics45 ? 0 : ywWxAlarmStatistics45.getNum().intValue()); + value.add(null == ywWxAlarmStatistics30 ? 0 : ywWxAlarmStatistics30.getNum().intValue()); + value.add(null == ywWxAlarmStatistics15 ? 0 : ywWxAlarmStatistics15.getNum().intValue()); + value.add(alarmMap.get("wx")); + + value2.add(null == ywCsAlarmStatistics45 ? 0 : ywCsAlarmStatistics45.getNum().intValue()); + value2.add(null == ywCsAlarmStatistics30 ? 0 : ywCsAlarmStatistics30.getNum().intValue()); + value2.add(null == ywCsAlarmStatistics15 ? 0 : ywCsAlarmStatistics15.getNum().intValue()); + value2.add(alarmMap.get("cs")); + + value3.add(null == ywDhAlarmStatistics45 ? 0 : ywDhAlarmStatistics45.getNum().intValue()); + value3.add(null == ywDhAlarmStatistics30 ? 0 : ywDhAlarmStatistics30.getNum().intValue()); + value3.add(null == ywDhAlarmStatistics15 ? 0 : ywDhAlarmStatistics15.getNum().intValue()); + value3.add(alarmMap.get("dh")); + + value4.add(null == ywAgisAlarmStatistics45 ? 0 : ywAgisAlarmStatistics45.getNum().intValue()); + value4.add(null == ywAgisAlarmStatistics30 ? 0 : ywAgisAlarmStatistics30.getNum().intValue()); + value4.add(null == ywAgisAlarmStatistics15 ? 0 : ywAgisAlarmStatistics15.getNum().intValue()); + value4.add(alarmMap.get("agis"));*/ + +// jsonObject.put("xaxis", xaxis); + jsonObject.put("wx", alarmMap.get("wx")); + jsonObject.put("cs", alarmMap.get("cs")); + jsonObject.put("dh", alarmMap.get("dh")); + jsonObject.put("agis", alarmMap.get("agis")); + jsonObject.put("wifi", alarmMap.get("wifi")); + jsonObject.put("voip", alarmMap.get("voip")); + jsonObject.put("public", alarmMap.get("wx") + alarmMap.get("cs") + alarmMap.get("dh")); + jsonObject.put("private", alarmMap.get("agis") + alarmMap.get("wifi") + alarmMap.get("voip")); + + return jsonObject; + + } + + /** + * 场馆性能(15分粒度) + * + * @param id 场馆id + * @param typeId 4g5g + * @return 统计数据 + */ + @Override + public JSONObject listKPI(Long id, String typeId) { + + JSONObject jsonObject = new JSONObject(); + List list = ywScenePictureMapper.getLineChartKpi(id, typeId); + List xaxis = new ArrayList<>(); + List value = new ArrayList<>(); + List value2 = new ArrayList<>(); + List value3 = new ArrayList<>(); + List value4 = new ArrayList<>(); + List value5 = new ArrayList<>(); + List value6 = new ArrayList<>(); + Float maxUserNum = 0f; + Float avgInterfere = 0f; + Float flux = 0f; + Float wirelessCompletionRate = 0f; + + if (list != null && list.size() == 0) { + Calendar instance = Calendar.getInstance(); + instance.set(Calendar.SECOND, 0); + instance.set(Calendar.MILLISECOND, 0); + Date now = instance.getTime(); + instance.add(Calendar.MINUTE, -15); + Date nowMinus15Min = instance.getTime(); + instance.add(Calendar.MINUTE, -15); + Date nowMinus30Min = instance.getTime(); + instance.add(Calendar.MINUTE, -15); + Date nowMinus45Min = instance.getTime(); + instance.add(Calendar.MINUTE, -15); + Date nowMinus60Min = instance.getTime(); + xaxis.add(DateUtils.parseDateToStr("HH:mm", nowMinus60Min)); + xaxis.add(DateUtils.parseDateToStr("HH:mm", nowMinus45Min)); + xaxis.add(DateUtils.parseDateToStr("HH:mm", nowMinus30Min)); + xaxis.add(DateUtils.parseDateToStr("HH:mm", nowMinus15Min)); + xaxis.add(DateUtils.parseDateToStr("HH:mm", now)); + for (int i = 0; i < 5; i++) { + value.add(0f); + value2.add(0f); + value3.add(0f); + value4.add(0f); + value5.add(0f); + value6.add(0f); + } + } else if (list != null) { + for (int i = 0; i < list.size(); i++) { + YwSceneKPIStatisticsVo vo = list.get(i); + xaxis.add(vo.getDatetime()); + value.add(vo.getValue()); + value2.add(vo.getValue2()); + value3.add(vo.getMaxUserNum()); + value4.add(vo.getAvgInterfere()); + value5.add(vo.getFlux()); + value6.add(vo.getWirelessCompletionRate()); + if (i == list.size() - 1) { + maxUserNum = vo.getMaxUserNum(); + avgInterfere = vo.getAvgInterfere(); + flux = vo.getFlux(); + wirelessCompletionRate = vo.getWirelessCompletionRate(); + } + } + } + + jsonObject.put("xaxis", xaxis); + jsonObject.put("value", StringUtils.isNull(value) ? 0f : value); + jsonObject.put("value2", StringUtils.isNull(value2) ? 0f : value2); + jsonObject.put("value3", StringUtils.isNull(value3) ? 0f : value3); + jsonObject.put("value4", StringUtils.isNull(value4) ? 0f : value4); + jsonObject.put("value5", StringUtils.isNull(value5) ? 0f : value5); + jsonObject.put("value6", StringUtils.isNull(value6) ? 0f : value6); + jsonObject.put("maxUserNum", StringUtils.isNull(maxUserNum) ? 0f : maxUserNum); + jsonObject.put("avgInterfere", StringUtils.isNull(avgInterfere) ? 0f : avgInterfere); + jsonObject.put("flux", StringUtils.isNull(flux) ? 0f : flux); + jsonObject.put("wirelessCompletionRate", StringUtils.isNull(wirelessCompletionRate) ? 0f : wirelessCompletionRate); + + return jsonObject; + + } + + @Override + public Map listKPIALL(Long id) { + + Map map = new HashMap<>(); + + JSONObject kpi4g = listKPI(id, "1"); + + map.put("4g", kpi4g); + + + JSONObject kpi5g = listKPI(id, "2"); + + map.put("5g", kpi5g); + + return map; + } + + @Override + public AjaxResult listNetKpi(Long id, Integer type) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + if (type == 1) { + YwSceneNetAgixStaVo netAgixStatis = ywScenePictureMapper.getNetAgixStatis(id, null, null); + if (null != netAgixStatis) { + return AjaxResult.success(netAgixStatis); + } + } else if (type == 2) { + YwSceneNetStaVo netStatis = ywScenePictureMapper.getNetStatis(id, null, null); + if (null != netStatis) { + String statdate = netStatis.getStatdate(); + LocalDateTime endTime = LocalDateTime.parse(statdate, formatter); + LocalDateTime beginTime = endTime.minusHours(3); + netStatis.setList(ywScenePictureMapper.getNetVelocityStatis(id, beginTime, endTime)); + return AjaxResult.success(netStatis); + } + } else if (type == 3) { + YwSceneNetFixtelStaVo netFixtelStatis = ywScenePictureMapper.getNetFixtelStatis(id,null,null); + if (null != netFixtelStatis) { + String statdate = netFixtelStatis.getStatdate(); + LocalDateTime endTime = LocalDateTime.parse(statdate, formatter); + LocalDateTime beginTime = endTime.minusHours(3); + List netFixtelRegSuccStatis = ywScenePictureMapper.getNetFixtelRegSuccStatis(id, beginTime, endTime); + netFixtelStatis.setList(netFixtelRegSuccStatis); + return AjaxResult.success(netFixtelStatis); + } + } + AjaxResult ajaxResult = AjaxResult.success(); + ajaxResult.put("data", null); + return ajaxResult; + } + + @Override + public AjaxResult listTransKpi(Long id, Integer type) { + if (type == 1) { + List gbtop5List = ywScenePictureMapper.getGbtop5List(id); + return AjaxResult.success(gbtop5List); + } else if (type == 2) { + List list = ywScenePictureMapper.getOpticalpowerTop5List(id,5,null,null); + return AjaxResult.success(list); + } + AjaxResult ajaxResult = AjaxResult.success(); + ajaxResult.put("data", null); + return ajaxResult; + } + + /** + * 简报H5版本查询告警详细 + * + * @param id 场馆id + * @return 告警详细 + */ + @Override + public JSONObject getAlarmTopDetail(Long id) { + JSONObject js = new JSONObject(); + YwAlarmDTO ywAlarmDTO = new YwAlarmDTO(); + // 去除分页 + ywAlarmDTO.setPageNum(1); + ywAlarmDTO.setPageSize(Integer.MAX_VALUE); + // 查实时的 + ywAlarmDTO.setAlarmStatus("0"); + // 排除挂起的 + ywAlarmDTO.setDealStatus("1"); + // 排除红线外的 + ywAlarmDTO.setInRedLine("Y"); + // 不要排序 + ywAlarmDTO.setOrderByTime("no"); + List ids = new ArrayList<>(); + ids.add(id); + // 查该场馆的 + ywAlarmDTO.setVenues(ids); + String[] alarmTypes = new String[]{"wx", "cs", "dh", "agis", "wifi", "voip"}; + for (String alarmType : alarmTypes) { + // 查相应专业的 + ywAlarmDTO.setAlarmType(alarmType); + // 过滤掉故障数清零的 + List ywAlarmByDto = ywAlarmViewService.getYwAlarmByDto(ywAlarmDTO).stream(). + filter(x -> !x.getClearNumDisplay().split("/")[0].equals(x.getClearNumDisplay().split("/")[1])). + collect(Collectors.toList()); + LinkedHashMap linkedHashMap = getAlarmDetailAccordingSceneId(ywAlarmByDto); + List otherAlarms = new ArrayList<>(); + Integer cOthers = 0; + int c = 0; + List ywAlarmClassificationDetails = new ArrayList<>(); + for (String k : linkedHashMap.keySet()) { + c++; + if (c > 4) { + otherAlarms.addAll(ywAlarmByDto.stream().filter(x -> k.equals(x.getName())).collect(Collectors.toList())); + cOthers = cOthers + (int) ywAlarmByDto.stream().filter(x -> k.equals(x.getName())).count(); + } else { + YwAlarmClassificationDetail ywAlarmClassificationDetail = new YwAlarmClassificationDetail(); + ywAlarmClassificationDetail.setAlarmName(k); + ywAlarmClassificationDetail.setAlarmList(ywAlarmByDto.stream().filter(x -> k.equals(x.getName())).collect(Collectors.toList())); + ywAlarmClassificationDetail.setAlarmNum((int) ywAlarmByDto.stream().filter(x -> k.equals(x.getName())).count()); + ywAlarmClassificationDetails.add(ywAlarmClassificationDetail); + } + } + if (c > 4) { + YwAlarmClassificationDetail ywAlarmClassificationDetail = new YwAlarmClassificationDetail(); + ywAlarmClassificationDetail.setAlarmName("其他告警"); + ywAlarmClassificationDetail.setAlarmList(otherAlarms); + ywAlarmClassificationDetail.setAlarmNum(cOthers); + ywAlarmClassificationDetails.add(ywAlarmClassificationDetail); + } + js.put(alarmType + "AlarmDetail", JSONArray.parseArray(JSON.toJSONString(ywAlarmClassificationDetails))); + } + return js; + } + + private LinkedHashMap getAlarmDetailAccordingSceneId(List ywAlarmByDto) { + Set alarmNameSet = new HashSet<>(); + Map alarmNameCountMap = new HashMap<>(); + + for (YwAlarmViewVo ywAlarmViewVo : ywAlarmByDto) { + alarmNameSet.add(ywAlarmViewVo.getName()); + } + for (String s : alarmNameSet) { + int count = 0; + for (YwAlarmViewVo ywAlarmViewVo : ywAlarmByDto) { + if (s.equals(ywAlarmViewVo.getName())) { + count++; + } + } + alarmNameCountMap.put(s, count); + } + List> entryList = new ArrayList<>(alarmNameCountMap.entrySet()); + entryList.sort((o1, o2) -> { + //正序排列,倒序反过来 + return o2.getValue() - o1.getValue(); + }); + LinkedHashMap linkedHashMap = new LinkedHashMap<>(); + for (Map.Entry e : entryList) { + linkedHashMap.put(e.getKey(), e.getValue()); + } + + return linkedHashMap; + } + + private Map getAlarmStatisticsAccordingSceneId(Long id, String inRedLine) { + YwAlarmDTO ywAlarmDTO = new YwAlarmDTO(); + // 去除分页 + ywAlarmDTO.setPageNum(1); + ywAlarmDTO.setPageSize(Integer.MAX_VALUE); + // 查实时的 + ywAlarmDTO.setAlarmStatus("0"); + // 排除挂起的 + ywAlarmDTO.setDealStatus("1"); + // 排除红线外的 + ywAlarmDTO.setInRedLine(inRedLine); + // 不要排序 + ywAlarmDTO.setOrderByTime("no"); + List ids = new ArrayList<>(); + ids.add(id); + // 查该场馆的 + ywAlarmDTO.setVenues(ids); + + String[] alarmTypes = new String[]{"wx", "cs", "dh", "agis", "wifi", "voip"}; + Map alarmMap = new HashMap<>(6); + for (String alarmType : alarmTypes) { + // 查相应专业的 + ywAlarmDTO.setAlarmType(alarmType); + // 过滤掉故障数清零的 + List ywAlarmByDto = ywAlarmViewService.getYwAlarmByDto(ywAlarmDTO).stream(). + filter(x -> !x.getClearNumDisplay().split("/")[0].equals(x.getClearNumDisplay().split("/")[1])). + collect(Collectors.toList()); + alarmMap.put(alarmType, ywAlarmByDto.size()); + } + return alarmMap; + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b9f13694c6b60cf7699c89233a0532995a3b3e81 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneServiceImpl.java @@ -0,0 +1,706 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.afterturn.easypoi.entity.vo.NormalExcelConstants; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Maps; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.ExcelSelector; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ZipUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.common.utils.poi.EasyPoiExcelUtil; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.dto.YwDataDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneParam; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.importer.ImporterScene; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.system.service.ISysDictDataService; +import lombok.RequiredArgsConstructor; +import org.apache.commons.compress.utils.Lists; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.PostConstruct; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-12 + */ +@Service +@RequiredArgsConstructor +public class YwSceneServiceImpl extends ServiceImpl implements YwSceneService { + + private final YwSceneMapper ywSceneMapper; + + private final YwSceneUserMapper ywSceneUserMapper; + + private final ISysDictDataService dictDataService; + private final YwSceneUserService ywSceneUserService; + private final YwSceneAlarmService ywSceneAlarmService; + private final YwSceneCalendarService ywSceneCalendarService; + private final YwSceneNetelementService ywSceneNetelementService; + + private final YwSceneNetelementDhMapper ywSceneNetelementDh; + + private final YwSceneNetelementWxMapper ywSceneNetelementWx; + + private final YwSceneNetelementAgisMapper ywSceneNetelementAgis; + + private final YwSceneNetelementCsMapper ywSceneNetelementCs; + + private final RedisCache redisCache; + + private String key = CacheConstants.YW_VENUES; + + @Value("${file.sceneJsonPath}") + private String sceneJsonPath; + + @PostConstruct + public void init() { + loadingVenueCache(); + } + + @Override + public void loadingVenueCache() { + List list = ywSceneMapper.getAllVenues(); + redisCache.setCacheObject(key, list); + } + + @Override + public List selectVenues() { + + + if (redisCache.hasKey(key)) { + try { + List res = redisCache.getCacheObject(key); + if (ObjectUtils.isEmpty(res)) { + throw new Exception(); + } + return res; + } catch (Exception ex) { + + List list = ywSceneMapper.getAllVenues(); + + redisCache.setCacheObject(key, list); + + return list; + + } + } + + List list = ywSceneMapper.getAllVenues(); + + redisCache.setCacheObject(key, list); + + return list; + } + + @Override + public Object validateUserVenues(Object o, Class clazz, String targetName) { + + try { + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!(user.isAdmin(user) || user.isCenter(user))) { + Field handleField = clazz.getDeclaredField(targetName); + handleField.setAccessible(true); + if("venueIds".equals(targetName)) { + boolean needSet = false; + if (ObjectUtils.isEmpty(handleField.get(o))) { + needSet = true; + } + if (needSet) { + List ywScenes = this.getVenueByUser(user); + Long[] lVenueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + handleField.set(o, lVenueIds); + } + } + } + + } + catch (Exception ex) + { + log.error("处理类异常:原因:"+ex.getMessage()); + } + finally { + return o; + } + + } + + /** + * 根据大场景id获取场馆 + * + * @param sceneBigId 大场景id + * @return 场馆 + */ + @Override + public List getVenueByBigId(Long sceneBigId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(sceneBigId != null, YwScene::getSceneBigId, sceneBigId); + List ywSceneList = ywSceneMapper.selectList(lambdaQueryWrapper); + return ywSceneList; + } + + @Override + public List getVenueByUser(SysUser user) { + List list = new ArrayList(); + boolean isAdmin = user.isAdmin(user); + + if (isAdmin) { + list = ywSceneMapper.getVenueByUserId(null); + } + if (!isAdmin) { + + //是否领导角色 + boolean isLeader = user.isLeader(user); + + if (isLeader) { + + list = ywSceneMapper.getVenueByUserId(user.getUserId()); + + if (list.size() == 0) { + + if (StringUtils.isNotEmpty(user.getCounty())) { + list = ywSceneMapper.getVenueByArea(user.getCounty()); + + } else if (StringUtils.isNotEmpty(user.getCity())) { + list = ywSceneMapper.getVenueByArea(user.getCity()); + + } else { + + //如果用户查出来没有配置场馆,就设置一个不能够查询的场馆用户用户查询 + list = ywSceneMapper.getVenueByUserId(null); + } + } + } + + + if (!isLeader) { + //中心库显示全部 + boolean isCenterRole = user.isCenter(user); + if (isCenterRole) { + list = ywSceneMapper.getVenueByUserId(null); + } + if (!isCenterRole) { + list = ywSceneMapper.getVenueByUserId(user.getUserId()); + } + //如果用户查出来没有配置场馆,就设置一个不能够查询的场馆用户用户查询 + if (list.size() == 0) { + YwScene scene = new YwScene(); + scene.setId(-1L); + scene.setVenueName("该用户没有场馆"); + list.add(scene); + } + } + + } + + //查询场馆图片 +// for (YwScene scene : list) { +// Long id = scene.getId(); +// List ywSceneFiles = ywSceneMapper.getFileByCondition(id, null); +// if (CollUtil.isNotEmpty(ywSceneFiles)) { +// scene.setYwSceneFile(ywSceneFiles.get(0)); +// } +// } + + return list; + + } + + @Override + public List getVenueByUserCanNoData(SysUser user,Boolean display) { + List list = new ArrayList(); + if (user.isAdmin(user)) { + if(display) + { + list = ywSceneMapper.getVenueByUserId(null); + } + //list = ywSceneMapper.getVenueByUserId(null); + return list; + } else { + //是否领导角色 + boolean isLeader = user.isLeader(user); + if (isLeader) { + + list = ywSceneMapper.getVenueByUserId(user.getUserId()); + + if (list.size() == 0) { + + if (StringUtils.isNotEmpty(user.getCounty())) { + list = ywSceneMapper.getVenueByArea(user.getCounty()); + + } else if (StringUtils.isNotEmpty(user.getCity())) { + list = ywSceneMapper.getVenueByArea(user.getCity()); + } else { + if(display) + { + list = ywSceneMapper.getVenueByUserId(null); + } + return list; + } + } + } + if (!isLeader) { + //中心库显示全部 + boolean isCenterRole = user.isCenter(user); + if (isCenterRole) { + if(display) + { + list = ywSceneMapper.getVenueByUserId(null); + } + return list; + } + if (!isCenterRole) { + list = ywSceneMapper.getVenueByUserId(user.getUserId()); + } + //如果用户查出来没有配置场馆,就设置一个不能够查询的场馆用户用户查询 + if (list.size() == 0) { + YwScene scene = new YwScene(); + scene.setId(-1L); + scene.setVenueName("该用户没有场馆"); + list.add(scene); + } + } + } + + return list; + } + + + @Override + public List getVenueByUser(SysUser user, Long sceneBigId) { + List list = new ArrayList(); + + //如果大场景是空的,则获取status为2的默认大场景 + if (ObjectUtils.isEmpty(sceneBigId)) { + sceneBigId = ywSceneMapper.getCurrentSceneBigId(); + } + + if (user.isAdmin(user)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YwScene::getSceneBigId, sceneBigId); + wrapper.orderByAsc(YwScene::getId); + list = ywSceneMapper.selectList(wrapper); + } else { + //是否领导角色 + boolean isLeader = user.isLeader(user); + if (isLeader) { + list = ywSceneMapper.getVenueByUserId(user.getUserId()); + + if (list.size() == 0) { + if (StringUtils.isNotEmpty(user.getCounty())) { + list = ywSceneMapper.getVenueByArea(user.getCounty()); + + } else if (StringUtils.isNotEmpty(user.getCity())) { + list = ywSceneMapper.getVenueByArea(user.getCity()); + } else { + list = ywSceneMapper.getVenueByUserId(null); + } + } + } + if (!isLeader) { + //中心库显示全部 + boolean isCenterRole = user.isCenter(user); + if (isCenterRole) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YwScene::getSceneBigId, sceneBigId); + wrapper.orderByAsc(YwScene::getId); + list = ywSceneMapper.selectList(wrapper); + } + if (!isCenterRole) { + list = ywSceneMapper.getVenueByUserIdAndBigId(user.getUserId(), sceneBigId); + } + } + //如果用户查出来没有配置场馆,就设置一个不能够查询的场馆用户用户查询 + if (list.size() == 0) { + YwScene scene = new YwScene(); + scene.setId(-1L); + scene.setVenueName("该用户没有场馆"); + } + } + return list; + } + + @Override + public List getSysUserByVenueAndOther(YwDataDTO ywDataDTO) { + List list = ywSceneMapper.getSysUserByVenueAndOther(ywDataDTO); + return list; + } + + @Override + public List msgList(YwSceneParam param) { + PageUtils.startPage(param, YwSceneParam.class); + return ywSceneMapper.getList(param); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(YwSceneDTO dto) { + validate(dto); + if (dto.getSceneBigId() == null) { + dto.setSceneBigId(ywSceneMapper.getCurrentSceneBigId()); + } + ywSceneMapper.insertSelective(dto); + List files = dto.getFiles(); + if (CollectionUtil.isNotEmpty(files)) { + for (YwSceneFile file : files) { + file.setSceneId(dto.getId()); + ywSceneMapper.insertFileSelective(file); + } + + this.loadingVenueCache(); + + } + } + + @Override + @Transactional + public void updateByPrimaryKeySelective(YwSceneDTO dto) { + validate(dto); + List files = dto.getFiles(); + if (files.size() > 0) { + List ids = files.stream().filter(file -> file.getSceneId() != null).map(file -> file.getSceneId()).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(ids)) { + delUselessSourceFile(dto.getId(), ids); + ywSceneMapper.delUselessFile(dto.getId(), ids); + } else { + delUselessSourceFile(dto.getId(), null); + ywSceneMapper.delUselessFile(dto.getId(), null); + } + for (YwSceneFile file : files) { + if (file.getSceneId() == null) { + file.setSceneId(dto.getId()); + ywSceneMapper.insertFileSelective(file); + } + } + } else { + delUselessSourceFile(dto.getId(), null); + ywSceneMapper.delUselessFile(dto.getId(), null); + } + ywSceneMapper.updateByPrimaryKeySelective(dto); + //20230814同步当前场馆的网元 + ywSceneNetelementDh.syncBySceneId(dto.getId()); + ywSceneNetelementCs.syncBySceneId(dto.getId()); + ywSceneNetelementAgis.syncBySceneId(dto.getId()); + ywSceneNetelementWx.syncBySceneId(dto.getId()); + this.loadingVenueCache(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delByIds(List ids) { + ywSceneMapper.deleteBatchIds(ids); + ywSceneUserService.delBySceneIds(ids); + ywSceneAlarmService.delBySceneIds(ids); + ywSceneCalendarService.delBySceneIds(ids); + //这个删除网元的代码有问题,没有用到这个表 + ywSceneNetelementService.delBySceneIds(ids); + if (CollectionUtil.isNotEmpty(ids)) { + for (Long id : ids) { + delUselessSourceFile(id, null); + ywSceneMapper.delUselessFile(id, null); + } + } + this.loadingVenueCache(); + } + + @Override + public void export(YwSceneParam param, HttpServletRequest request, HttpServletResponse response) { + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + List list = msgList(param); + ExcelUtil util = new ExcelUtil<>(YwSceneVo.class); + util.exportExcel(response, list, "场馆信息"); +// EasyPoiExcelUtil.exportExcel(null, YwSceneVo.class, list, request, response); + } + + @Override + public void bigSceneExport(Long sceneBigId, HttpServletRequest request, HttpServletResponse response) { + List> list = Lists.newArrayList(); + //场景 + List sceneBigList = ywSceneMapper.getSceneBigById(sceneBigId); + + list.add(getMap("场景", sceneBigList, YwSceneBigConfig.class)); + //场馆 + List sceneList = ywSceneMapper.getSceneBySceneBigId(sceneBigId); + list.add(getMap("场馆", sceneList, YwSceneVo.class)); + //场馆告警 + List sceneAlarmList = ywSceneAlarmService.getListBySceneBigId(sceneBigId); + list.add(getMap("场馆告警", sceneAlarmList, YwSceneAlarmVo.class)); + //场馆人员 + List sceneUserList = ywSceneUserService.getListBySceneBigId(sceneBigId); + list.add(getMap("场馆人员", sceneUserList, YwSceneUserVo.class)); + //场馆网元 + List sceneNetelementList = ywSceneNetelementService.getListBySceneBigId(sceneBigId); + list.add(getMap("场馆网元", sceneNetelementList, YwSceneNetelement.class)); + //场馆赛事 + List sceneCalendarList = ywSceneCalendarService.getListBySceneBigId(sceneBigId); + list.add(getMap("场馆赛事", sceneCalendarList, YwSceneCalendarVo.class)); + EasyPoiExcelUtil.exportMultiSheetExcel(list, null, request, response); + } + + @Override + public void exportTemplate(HttpServletRequest request, HttpServletResponse response) { + List> list = Lists.newArrayList(); + //场景 + List sceneBigList = Lists.newArrayList(); + list.add(getMap("场景", sceneBigList, YwSceneBigConfig.class)); + //场馆 + List sceneList = Lists.newArrayList(); + list.add(getMap("场馆", sceneList, YwSceneVo.class)); + //场馆告警 + List sceneAlarmList = Lists.newArrayList(); + list.add(getMap("场馆告警", sceneAlarmList, YwSceneAlarmVo.class)); + //场馆人员 + List sceneUserList = Lists.newArrayList(); + list.add(getMap("场馆人员", sceneUserList, YwSceneUser.class)); + //场馆网元 + List sceneNetelementList = Lists.newArrayList(); + list.add(getMap("场馆网元", sceneNetelementList, YwSceneNetelement.class)); + //场馆赛事 + List sceneCalendarList = Lists.newArrayList(); + list.add(getMap("场馆赛事", sceneCalendarList, YwSceneCalendarVo.class)); + + //获取下拉框数据 + List selectorList = getExcelSelectorData(); + EasyPoiExcelUtil.exportMultiSheetExcel(list, selectorList, request, response); + } + + @Override + public void importSceneBigConfig(MultipartFile file) throws Exception { + ImportParams params = new ImportParams(); + params.setTitleRows(2); + //场景 + params.setStartSheetIndex(0); + List sceneBigList = ExcelImportUtil.importExcel(file.getInputStream(), YwSceneBigConfig.class, params); + //场馆 + params.setStartSheetIndex(1); + List sceneList = ExcelImportUtil.importExcel(file.getInputStream(), YwSceneVo.class, params); + this.loadingVenueCache(); + //场馆告警 + params.setStartSheetIndex(2); + List sceneAlarmList = ExcelImportUtil.importExcel(file.getInputStream(), YwSceneAlarmVo.class, params); + //场馆人员 + params.setStartSheetIndex(3); + List sceneUserList = ExcelImportUtil.importExcel(file.getInputStream(), YwSceneUser.class, params); + //场馆网元 + params.setStartSheetIndex(4); + List sceneNetelementList = ExcelImportUtil.importExcel(file.getInputStream(), YwSceneUser.class, params); + //场馆赛事 + params.setStartSheetIndex(5); + List sceneCalendarList = ExcelImportUtil.importExcel(file.getInputStream(), YwSceneCalendarVo.class, params); + } + + private List getExcelSelectorData() { + List list = Lists.newArrayList(); + + //地市 + List city = dictDataService.selectDictLabelByValues("yw_city", null); + encapsulationData(1, "city", YwSceneVo.class, city, list); + //区县 + List county = dictDataService.selectDictLabelByValues("yw_county", null); + encapsulationData(1, "county", YwSceneVo.class, county, list); + //场馆属性 + List sceneType = dictDataService.selectDictLabelByValues("yw_scene_type", null); + encapsulationData(1, "venueTypeName", YwSceneVo.class, sceneType, list); + //场馆级别 + List sceneLevel = dictDataService.selectDictLabelByValues("yw_scene_level", null); + encapsulationData(1, "venueLevelName", YwSceneVo.class, sceneLevel, list); + //场馆维护类型 + List sceneMaintainType = dictDataService.selectDictLabelByValues("yw_scene_maintain_type", null); + encapsulationData(1, "maintainTypeName", YwSceneVo.class, sceneMaintainType, list); + //专业 + List specialty = dictDataService.selectDictLabelByValues("yw_specialty", null); + encapsulationData(2, "specialtyName", YwSceneAlarmVo.class, specialty, list); + encapsulationData(4, "specialty", YwSceneNetelement.class, specialty, list); + //网元状态 + List netelementStatus = dictDataService.selectDictLabelByValues("ye_netelement_status", null); + encapsulationData(4, "statusName", YwSceneNetelement.class, netelementStatus, list); + //赛事类型 + List matchType = dictDataService.selectDictLabelByValues("yw_match_type", null); + encapsulationData(5, "matchTypeName", YwSceneCalendarVo.class, matchType, list); + //开关状态 + List status = dictDataService.selectDictLabelByValues("sys_normal_disable", null); + encapsulationData(0, "statusName", YwSceneBigConfig.class, status, list); + + return list; + } + + private void encapsulationData(int sheetIndex, String attributeName, Class cla, + List dictList, List list) { + ExcelSelector excelSelector = new ExcelSelector(); + try { + int firstCol = Integer.parseInt(cla.getDeclaredField(attributeName).getAnnotation(Excel.class).orderNum()); + excelSelector.setSheetIndex(sheetIndex); + excelSelector.setFirstCol(firstCol); + excelSelector.setLastCol(firstCol); + List collect = dictList.stream().map(dict -> dict.getDictLabel()).collect(Collectors.toList()); + excelSelector.setDatas(collect.toArray(new String[collect.size()])); + list.add(excelSelector); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + System.out.println(e.getMessage()); + } + } + + private Map getMap(String title, List dataList, Class cls) { + Map map = Maps.newHashMap(); + map.put("title", new ExportParams(title, title)); + map.put(NormalExcelConstants.DATA_LIST, dataList); + map.put(NormalExcelConstants.CLASS, cls); + return map; + } + + private void validate(YwSceneDTO dto) { + //根据场馆名称去重 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StrUtil.isNotBlank(dto.getVenueName()), YwScene::getVenueName, dto.getVenueName()); + wrapper.eq(null != dto.getSceneBigId(), YwScene::getSceneBigId, dto.getSceneBigId()); + wrapper.ne(dto.getId() != null, YwScene::getId, dto.getId()); + List list = ywSceneMapper.selectList(wrapper); + if (CollectionUtil.isNotEmpty(list)) { + throw new ServiceException("场馆重复"); + } + } + + private void delUselessSourceFile(Long id, List ids) { + List files = ywSceneMapper.getFileByCondition(id, ids); + if (CollectionUtil.isNotEmpty(files)) { + for (YwSceneFile file : files) { + String fileUrl = file.getFileUrl(); + int dirLastIndex = Constants.RESOURCE_PREFIX.length() + 1; + fileUrl = StringUtils.substring(fileUrl, dirLastIndex); + fileUrl = RuoYiConfig.getProfile() + fileUrl; + FileUtils.deleteFile(fileUrl); + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importYWScene(List list, Long sceneBigId, String importType) throws Exception { + ImporterBase importer = new ImporterScene(ywSceneMapper, ywSceneUserMapper); + AjaxResult ajaxResult = importer.doAdd(list, sceneBigId, importType); + if (HttpStatus.SUCCESS == (int) ajaxResult.get(AjaxResult.CODE_TAG)) { + this.loadingVenueCache(); + } + return ajaxResult; + } + + @Override + public void exportReal(YwSceneParam param, HttpServletRequest request, HttpServletResponse response) { + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + List list = msgList(param); + List list1 = new ArrayList<>(); + for (YwSceneVo vo : list) { + YwSceneExportVo yw = new YwSceneExportVo(); + BeanUtils.copyBeanProp(yw, vo); + list1.add(yw); + } + ExcelUtil util = new ExcelUtil<>(YwSceneExportVo.class); + util.exportExcel(response, list1, "场馆导出"); +// EasyPoiExcelUtil.exportExcel(null,YwSceneVo.class,list,request,response); + } + + @Override + public void importStationByScene(MultipartFile multipartFile, Long sceneBigId, Long sceneId) { + String fileName = sceneId + ".json"; + String zipFileName = sceneId + ".zip"; + File file = new File(sceneJsonPath + fileName); +// File file = new File("D:/home/" + fileName); + String[] files = {file.getAbsolutePath()}; + File zipFile = new File(sceneJsonPath + zipFileName); +// File zipFile = new File("D:/home/" + zipFileName); + if (!file.exists()) { + try { + multipartFile.transferTo(file); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + try { + file.delete(); + multipartFile.transferTo(file); + } catch (IOException e) { + e.printStackTrace(); + } + } + + if (!zipFile.exists()) { + try { + zipFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + try { + zipFile.delete(); + zipFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + ZipUtils.zip(files, zipFile); + + } + + @Override + public void getJsonBySceneId(Long sceneId,HttpServletResponse response) throws Exception{ + String fileName = sceneId + ".zip"; + File file = FileUtil.file(sceneJsonPath + fileName); +// File file = FileUtil.file("D:/home/" + fileName); + ServletOutputStream outputStream = response.getOutputStream(); + outputStream.write(FileUtil.readBytes(file));//hutool 工具类 FileUtil + //强制将缓存区的数据进行输出 + outputStream.flush(); + //关流 + outputStream.close(); + + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneTestDataServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneTestDataServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..86fff3dd27b6f3ad840ca953019be16a3c298047 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneTestDataServiceImpl.java @@ -0,0 +1,186 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.http.HttpUtils; +import com.ruoyi.eastcom_yw.domain.YwSceneTestData; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneTestDataInterface; +import com.ruoyi.eastcom_yw.mapper.YwSceneTestDataInterfaceMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneTestDataMapper; +import com.ruoyi.eastcom_yw.service.YwSceneTestDataService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +@Service +@Slf4j +@RequiredArgsConstructor +public class YwSceneTestDataServiceImpl implements YwSceneTestDataService { + + private final YwSceneTestDataMapper ywSceneTestDataMapper; + + private final YwSceneTestDataInterfaceMapper ywSceneTestDataInterfaceMapper; + + public List getList() { + List jsonObjects = new ArrayList<>(); + + List list = ywSceneTestDataMapper.selectList(new QueryWrapper<>()); + + for (YwSceneTestData ywSceneTestData : list) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name", ywSceneTestData.getScenename()); + jsonObject.put("type", ywSceneTestData.getNettype()); + jsonObject.put("GPS", ywSceneTestData.getLat() + "," + ywSceneTestData.getLng()); + jsonObject.put("ConnectDelay", String.valueOf(ywSceneTestData.getConnectdelay())); + jsonObject.put("DLSpeed", String.valueOf(ywSceneTestData.getDlspeed())); + jsonObject.put("PageComplete", String.valueOf(ywSceneTestData.getPagecomplete())); + jsonObject.put("ULSpeed", String.valueOf(ywSceneTestData.getUlspeed())); + jsonObject.put("UpdateTime", null == ywSceneTestData.getUpdateTime() ? "" : DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", ywSceneTestData.getUpdateTime())); + jsonObjects.add(jsonObject); + } + + return jsonObjects; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void insertTestData() { + + List ywSceneTestDatas = new ArrayList<>(); + + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YwSceneTestDataInterface::getEnable, "1"); + List ywSceneTestDataInterfaces = ywSceneTestDataInterfaceMapper.selectList(wrapper); + + for (YwSceneTestDataInterface ywSceneTestDataInterface : ywSceneTestDataInterfaces) { + apply(ywSceneTestDataInterface, ywSceneTestDatas); + } + + List sceneIdList = new ArrayList<>(); + for (YwSceneTestData ywSceneTestData : ywSceneTestDatas) { + sceneIdList.add(ywSceneTestData.getSceneId()); + } + if (ywSceneTestDatas.size() > 0) { + ywSceneTestDataMapper.deleteBySceneIdIn(sceneIdList); + ywSceneTestDataMapper.insertBatch(ywSceneTestDatas); + } + + } + + private void apply(YwSceneTestDataInterface ywSceneTestDataInterface, List ywSceneTestDatas) { + String s = HttpUtils.sendGet(ywSceneTestDataInterface.getUrl(), "", "UTF-8"); + log.info(s); + if (StringUtils.isNotEmpty(s)) { + parseJsonArr(s, ywSceneTestDatas, ywSceneTestDataInterface); + } else { + log.error("请求接口失败。"); + } + } + + private void parseJsonArr(String s, List ywSceneTestDatas, YwSceneTestDataInterface ywSceneTestDataInterface) { + String net = ""; + if (ywSceneTestDataInterface.getUrl().contains("4g")) { + net = "4G"; + } else if (ywSceneTestDataInterface.getUrl().contains("5g")) { + net = "5G"; + } + List objects; + try { + objects = JSON.parseArray(s, HashMap.class); + } catch (Exception e) { + log.error("json转Map失败"); + return; + } + for (HashMap object : objects) { + try { + YwSceneTestData ywSceneTestData = new YwSceneTestData(); + String bZName = (String) object.get("BZName"); + String connectDelay = (String) object.get("ConnectDelay"); + String dLSpeed = (String) object.get("DLSpeed"); + String deviceID = (String) object.get("DeviceID"); + Float lat = ((BigDecimal) object.get("Lat")).floatValue(); + Float lng = ((BigDecimal) object.get("Lng")).floatValue(); + String pageComplete = (String) object.get("PageComplete"); + String sceneName = (String) object.get("SceneName"); + String uLSpeed = (String) object.get("ULSpeed"); + String updateTime = (String) object.get("UpdateTime"); + + ywSceneTestData.setBzname(bZName); + ywSceneTestData.setConnectdelay(StringUtils.isNotEmpty(connectDelay.replace("ms", "").trim()) ? Float.parseFloat(connectDelay.replace("ms", "").trim()) : null); + ywSceneTestData.setDlspeed(StringUtils.isNotEmpty(dLSpeed.replace("Mbps", "").trim()) ? Float.parseFloat(dLSpeed.replace("Mbps", "").trim()) : null); + ywSceneTestData.setDeviceoid(deviceID); + ywSceneTestData.setLat(lat); + ywSceneTestData.setLng(lng); + ywSceneTestData.setPagecomplete(StringUtils.isNotEmpty(pageComplete.replace("%", "").trim()) ? Float.parseFloat(pageComplete.replace("%", "").trim()) : null); + ywSceneTestData.setScenename(sceneName); + ywSceneTestData.setUlspeed(StringUtils.isNotEmpty(uLSpeed.replace("Mbps", "").trim()) ? Float.parseFloat(uLSpeed.replace("Mbps", "").trim()) : null); + ywSceneTestData.setUpdateTime(StringUtils.isNotEmpty(updateTime.replace("T", "").trim()) ? DateUtils.parseDate(updateTime.replace("T", " "), "yyyy-MM-dd HH:mm:ss") : null); + ywSceneTestData.setSceneId(ywSceneTestDataInterface.getSceneId()); + ywSceneTestData.setNettype(net); + ywSceneTestDatas.add(ywSceneTestData); + } catch (Exception e) { + log.error("xml转实体失败。"); + } + } + } + + /*private void parseXml(String s, List ywSceneTestDatas, String url) { + String net = ""; + if (url.contains("4g")) { + net = "4G"; + } else if (url.contains("5g")) { + net = "5G"; + } + + try { + Document document = DocumentHelper.parseText(s); + Element rootElement = document.getRootElement(); + + Iterator tzDeviceInfo2 = rootElement.elementIterator("TZDeviceInfo2"); + while (tzDeviceInfo2.hasNext()) { + Element next1 = (Element) tzDeviceInfo2.next(); + YwSceneTestData ywSceneTestData = new YwSceneTestData(); + String bZName = next1.elementTextTrim("BZName"); + String connectDelay = next1.elementTextTrim("ConnectDelay"); + String dLSpeed = next1.elementTextTrim("DLSpeed"); + String deviceID = next1.elementTextTrim("DeviceID"); + String lat = next1.elementTextTrim("Lat"); + String lng = next1.elementTextTrim("Lng"); + String pageComplete = next1.elementTextTrim("PageComplete"); + String sceneName = next1.elementTextTrim("SceneName"); + String uLSpeed = next1.elementTextTrim("ULSpeed"); + String updateTime = next1.elementTextTrim("UpdateTime"); + try { + ywSceneTestData.setBzname(bZName); + ywSceneTestData.setConnectdelay(StringUtils.isNotEmpty(connectDelay.replace("ms", "").trim()) ? Float.parseFloat(connectDelay.replace("ms", "").trim()) : null); + ywSceneTestData.setDlspeed(StringUtils.isNotEmpty(dLSpeed.replace("Mbps", "").trim()) ? Float.parseFloat(dLSpeed.replace("Mbps", "").trim()) : null); + ywSceneTestData.setDeviceoid(deviceID); + ywSceneTestData.setLat(StringUtils.isNotEmpty(lat) ? Float.parseFloat(lat) : null); + ywSceneTestData.setLng(StringUtils.isNotEmpty(lng) ? Float.parseFloat(lng) : null); + ywSceneTestData.setPagecomplete(pageComplete); + ywSceneTestData.setScenename(sceneName); + ywSceneTestData.setUlspeed(StringUtils.isNotEmpty(uLSpeed.replace("Mbps", "").trim()) ? Float.parseFloat(uLSpeed.replace("Mbps", "").trim()) : null); + ywSceneTestData.setUpdateTime(StringUtils.isNotEmpty(updateTime.replace("T", "").trim()) ? DateUtils.parseDate(updateTime.replace("T", " "), "yyyy-MM-dd HH:mm:ss") : null); + ywSceneTestData.setSceneId(2); + ywSceneTestData.setNettype(net); + ywSceneTestDatas.add(ywSceneTestData); + } catch (Exception e) { + log.error("xml转实体失败。"); + } + } + } catch (Exception e) { + log.error("解析xml失败。"); + } + }*/ + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneUserServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneUserServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..69910dff255f928e40bb04c6adf98eb67917dd51 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSceneUserServiceImpl.java @@ -0,0 +1,208 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.SysUserImp; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.domain.param.SysUserParam; +import com.ruoyi.eastcom_yw.domain.param.YwSceneUserParam; +import com.ruoyi.eastcom_yw.domain.vo.SysUserVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneUserVo; +import com.ruoyi.eastcom_yw.importer.ImporterSceneUser; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneUserMapper; +import com.ruoyi.eastcom_yw.service.YwSceneUserService; +import com.ruoyi.system.mapper.SysRoleMapper; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.mapper.SysUserRoleMapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author huamile + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class YwSceneUserServiceImpl extends ServiceImpl implements YwSceneUserService { + + private final YwSceneUserMapper ywSceneUserMapper; + + private final SysUserMapper sysUserMapper; + + private final SysRoleMapper sysRoleMapper; + + private final SysUserRoleMapper sysUserRoleMapper; + + private final YwSceneMapper ywSceneMapper; + + @Override + public List getList(YwSceneUserParam param) { + PageUtils.startPage(param, YwSceneUserParam.class); + return ywSceneUserMapper.getList(param); + } + + @Override + public List getVenuesByUserId(Long userId) { + return ywSceneUserMapper.getVenuesByUserId(userId); + } + + @Override + public List getVenuesByUserIds(List userIds) { + return ywSceneUserMapper.getVenuesByUserIds(userIds); + } + + @Override + public List getListBySceneBigId(Long sceneBigId) { + return ywSceneUserMapper.getListBySceneBigId(sceneBigId); + } + + @Override + public void create(YwSceneUser ywSceneUser) { + if(ObjectUtils.isEmpty(ywSceneUser.getSceneId())) + { + throw new ServiceException("场馆ID不允许为空"); + } + //validate(ywSceneUser); + List userIds = ywSceneUser.getUserIds(); + if (CollectionUtil.isNotEmpty(userIds)) { + for (Long userId : userIds) { + ywSceneUser.setUserId(userId); + ywSceneUserMapper.insertSelective(ywSceneUser); + } + } + } + + //用于用户的修改,增加了删除用户关联的场馆的方法 + @Override + public void delete(Long userId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YwSceneUser::getUserId, userId); + ywSceneUserMapper.delete(wrapper); + } + + @Override + public void updateByPrimaryKeySelective(YwSceneUser ywSceneUser) { + //validate(ywSceneUser); + ywSceneUserMapper.updateByPrimaryKeySelective(ywSceneUser); + } + + @Override + public Integer delBySceneIds(List ids) { + if (CollectionUtil.isNotEmpty(ids)) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(YwSceneUser::getSceneId, ids); + return ywSceneUserMapper.delete(wrapper); + } + return null; + } + + @Override + public void export(YwSceneUserParam param, HttpServletRequest request, HttpServletResponse response) { + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + List list = getList(param); + list.forEach(x -> x.setNeedSign("0".equals(x.getNeedSign()) ? "否" : "是")); + + ExcelUtil util = new ExcelUtil<>(YwSceneUserVo.class); + util.exportExcel(response, list, "场馆人员配置"); +// EasyPoiExcelUtil.exportExcel("场馆人员配置", YwSceneUserVo.class, list, request, response); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importSysUser(List imps, Long sceneBigId, String importType) throws Exception { + + List roles = sysRoleMapper.selectRoleAll(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwScene::getSceneBigId, sceneBigId); + List ywScenes = ywSceneMapper.selectList(queryWrapper); + List ywSceneUsers = ywSceneUserMapper.selectList(null); + + ImporterBase importer = new ImporterSceneUser(sysUserMapper, sysUserRoleMapper, ywSceneUserMapper); + return importer.doAdd(imps, sceneBigId, importType, roles, ywScenes, ywSceneUsers); + + } + + @Override + public List listSysUser(SysUserParam para) { + + PageUtils.startPage(para, SysUserParam.class); + + List sysUserVos = ywSceneUserMapper.listSysUser(para.getSceneBigId()); + + return sysUserVos; + } + + @Override + public void exportForImport(SysUserParam para, HttpServletRequest request, HttpServletResponse response) { + para.setPageNum(1); + para.setPageSize(Integer.MAX_VALUE); + + List sysUserVos = listSysUser(para); + + for (SysUserVo vo : sysUserVos) { + vo.setStatus(StringUtils.isNotEmpty(vo.getStatus()) ? DictUtils.getDictLabel("sys_user_status", vo.getStatus()) : null); + vo.setUserType(StringUtils.isNotEmpty(vo.getUserType()) ? DictUtils.getDictLabel("yw_specialty", vo.getUserType()) : null); + vo.setCity(StringUtils.isNotEmpty(vo.getCity()) ? DictUtils.getDictLabel("yw_city", vo.getCity()) : null); + vo.setCounty(StringUtils.isNotEmpty(vo.getCounty()) ? DictUtils.getDictLabel("yw_county", vo.getCounty()) : null); + if (StringUtils.isEmpty(vo.getDistinctArea())) { + + } else if (!vo.getDistinctArea().contains("|")) { + vo.setDistinctArea(StringUtils.isNotEmpty(vo.getDistinctArea()) ? DictUtils.getDictLabel("yw_belong_area", vo.getDistinctArea()) : null); + } else { + StringBuilder sb = new StringBuilder(); + String[] dis = vo.getDistinctArea().split("\\|"); + for (String s : dis) { + sb.append(StringUtils.isNotEmpty(s) ? (DictUtils.getDictLabel("yw_belong_area", s) + "|") : "|"); + } + sb.deleteCharAt(sb.length() - 1); + vo.setDistinctArea(sb.toString()); + } + if (StringUtils.isEmpty(vo.getNeedSign())) { + + } else if (!vo.getNeedSign().contains("|")) { + if ("1".equals(vo.getNeedSign())) { + vo.setNeedSign("是"); + } else if ("0".equals(vo.getNeedSign())) { + vo.setNeedSign("否"); + } + } else { + StringBuilder sb = new StringBuilder(); + String[] dis = vo.getNeedSign().split("\\|"); + for (String s : dis) { + if ("1".equals(s)) { + sb.append("是|"); + } else if ("0".equals(s)) { + sb.append("否|"); + } else { + sb.append("|"); + } + } + sb.deleteCharAt(sb.length() - 1); + vo.setNeedSign(sb.toString()); + } + } + + ExcelUtil util = new ExcelUtil<>(SysUserVo.class); + util.exportExcel(response, sysUserVos, "人员导出"); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSignLogServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSignLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..dad560dbff7e1b837c1d10fa2e09621b20d431e2 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSignLogServiceImpl.java @@ -0,0 +1,284 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.CoordinateConversionUtils; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSignLog; +import com.ruoyi.eastcom_yw.domain.YwSignPlanView; +import com.ruoyi.eastcom_yw.domain.dto.YwSignDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignInDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignVo; +import com.ruoyi.eastcom_yw.mapper.YwSignLogMapper; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.YwSignLogService; +import com.ruoyi.eastcom_yw.service.YwSignPlanService; +import org.gavaghan.geodesy.Ellipsoid; +import org.gavaghan.geodesy.GlobalCoordinates; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.List; + +import static com.ruoyi.common.utils.GeoUtils.getDistanceMeter; + +@Service +public class YwSignLogServiceImpl extends ServiceImpl implements YwSignLogService { + + @Autowired + YwSignLogMapper ywSignLogMapper; + @Autowired + YwSignPlanService ywSignPlanService; + @Autowired + YwSceneService ywSceneService; + + @Override + public void SignIn(YwSignInDTO ywSignInDTO) { + + String signDate = ywSignInDTO.getSignTime().split(" ")[0]; + + //20230316手动打卡前端没限制,签到时间必须签到时间的前4小时到后5分钟的时间范围 + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + if (ObjectUtils.isEmpty(ywSignInDTO.getSignPlanId())) { + lambdaQueryWrapper.eq(YwSignPlanView::getSceneId, ywSignInDTO.getVenueId()); + lambdaQueryWrapper.eq(YwSignPlanView::getSignDate, DateUtils.parseDate(signDate)); + lambdaQueryWrapper.eq(YwSignPlanView::getIsOpen, "1"); + } + + if (ObjectUtils.isNotEmpty(ywSignInDTO.getSignPlanId())) { + lambdaQueryWrapper.eq(YwSignPlanView::getId, ywSignInDTO.getSignPlanId()); + } + + //先找场馆的签到计划 + List lstYwSignPlan = ywSignPlanService.list(lambdaQueryWrapper); + + if (lstYwSignPlan.isEmpty()) { + if (ywSignInDTO.getSignType() == 0) { + throw new ServiceException("打卡的签到计划不存在"); + } + } + + if (lstYwSignPlan.size() > 1) { + throw new ServiceException("打卡的签到计划存在重复"); + } + + LocalDateTime signTime = LocalDateTimeUtil.of(DateUtils.parseDate(ywSignInDTO.getSignTime())); + + if (ywSignInDTO.getSignType() == 0) { + //配置时间前4小时可打卡 + LocalDateTime beginTime = LocalDateTimeUtil.of(lstYwSignPlan.get(0).getBeginTime()); + + if (signTime.isAfter(beginTime.plusMinutes(5)) || signTime.isBefore(beginTime.minusHours(lstYwSignPlan.get(0).getRepSignInterval()))) { + throw new ServiceException("超过限定时间,不允许打卡"); + } + } + + if (ywSignInDTO.getSignType() == 1) { + LocalDateTime end = LocalDateTimeUtil.of(lstYwSignPlan.get(0).getEndTime()); + if (signTime.isBefore(end)) { + throw new ServiceException("签退时间必须大于晚签到时间"); + } + } + + ywSignInDTO.setUserId(SecurityUtils.getUserId()); + //ywSignInDTO.setUserId(1L); + ywSignLogMapper.SingIn(ywSignInDTO); + + } + + @Override + public YwSignVo couldSign(YwSignDTO ywSignDTO) { + + if (StrUtil.isBlank(ywSignDTO.getLatitude()) || StrUtil.isBlank(ywSignDTO.getLongitude())) { + throw new ServiceException("未取得经纬度"); + } + + //查询当前登录人员场馆配置 + Long userId = SecurityUtils.getUserId(); + SysUser sysUser = new SysUser(); + sysUser.setUserId(userId); + sysUser.setRoles(SecurityUtils.getLoginUser().getUser().getRoles()); + List ywSceneList = ywSceneService.getVenueByUser(sysUser); + if (CollUtil.isEmpty(ywSceneList)) { + throw new ServiceException("当前用户未配置场馆"); + } + + // Date date = new Date(); +// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); +// String today = dateFormat.format(date); + YwSignPlanView one = null; + //获取签到计划 + if (ObjectUtils.isEmpty(ywSignDTO.getSignPlanId())) { + + if (ywSignDTO.getVenueId() == null) { + throw new ServiceException("未传场馆id"); + } + + one = ywSignPlanService.getOne(new LambdaQueryWrapper() + .eq(YwSignPlanView::getSceneId, ywSignDTO.getVenueId()) + .eq(YwSignPlanView::getSignDate, DateUtils.getNowDate()) + .eq(YwSignPlanView::getIsOpen, "1")); + + } + if (ObjectUtils.isNotEmpty(ywSignDTO.getSignPlanId())) { + one = ywSignPlanService.getOne(new LambdaQueryWrapper() + .eq(YwSignPlanView::getId, ywSignDTO.getSignPlanId())); + } + + if (one == null) { + throw new ServiceException("签到计划不存在"); + } + + YwScene ywScene = ywSceneService.getById(one.getSceneId()); + if (ywScene == null) { + throw new ServiceException("场馆不存在"); + } + + if (ObjectUtils.isEmpty(ywScene.getSignScope())) { + ywScene.setSignScope(400); + } + + + int flag = 0; + StringBuilder stringBuilder = new StringBuilder(); + //判断当前时间是否可打卡 如果signType为空,则只校验距离 + if (ywSignDTO.getSignType() != null) { + LocalDateTime now = LocalDateTime.now(); + if (ywSignDTO.getSignType() == 0) { + //配置时间前4小时可打卡 + LocalDateTime beginTime = LocalDateTimeUtil.of(one.getBeginTime()); + if (now.isAfter(beginTime)) { + flag = 1; + stringBuilder.append("超过签到打卡时间将无法打卡,请于您的场馆经理联系,申请手工打卡;"); + } else if (now.isBefore(beginTime.minusHours(one.getRepSignInterval()))) { + flag = 1; + stringBuilder.append("未到打卡时间,最早为:").append(beginTime.minusHours(one.getRepSignInterval()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))); + } + } else { + LocalDateTime endTime = LocalDateTimeUtil.of(one.getEndTime()); + if (now.isBefore(endTime)) { + flag = 1; + stringBuilder.append("下班时间未到,无法打卡;"); + } else if (!now.toLocalDate().isEqual(endTime.toLocalDate())) { + flag = 1; + stringBuilder.append("无法跨天打卡"); + } + } + } + double lng = Double.parseDouble(ywSignDTO.getLongitude()); + double lat = Double.parseDouble(ywSignDTO.getLatitude()); +// WGS84转GCj02 + String s = CoordinateConversionUtils.wgs84togcj02(lng, lat); + double lng02 = Double.parseDouble(s.split(",")[0]); + double lat02 = Double.parseDouble(s.split(",")[1]); + //比较经纬度 + if (ywScene.getLatitudeGcj02() == null || ywScene.getLongitudeGcj02() == null) { + throw new ServiceException("场馆未配置经纬度"); + } + GlobalCoordinates source = new GlobalCoordinates(ywScene.getLatitudeGcj02(), ywScene.getLongitudeGcj02()); + GlobalCoordinates target = new GlobalCoordinates(lat02, lng02); + //GPS 使用 WGS84 + double geoCurve = getDistanceMeter(source, target, Ellipsoid.WGS84); + if (geoCurve > ywScene.getSignScope()) { + if (flag == 1) { + flag = 3; + } else { + flag = 2; + } + stringBuilder.append("您未进入打卡范围;"); + } + if (stringBuilder.length() > 0) { + return YwSignVo.builder().couldSign(false).failType(flag).failMsg(stringBuilder.toString()).build(); + } + return YwSignVo.builder().couldSign(true).build(); + } + + + public static void main(String[] args) { + double a=120.155; + double b=30.27607641627596; + double v = new BigDecimal(a).setScale(6, RoundingMode.HALF_UP).doubleValue(); + System.out.println(v); + } + + @Override + public Boolean sign(YwSignDTO ywSignDTO) { + YwSignVo ywSignVo = couldSign(ywSignDTO); + if (!ywSignVo.getCouldSign()) { + throw new ServiceException(ywSignVo.getFailMsg()); + } + YwSignLog signLog = ywSignLogMapper.selectOne(new LambdaQueryWrapper() + .eq(YwSignLog::getUserId, SecurityUtils.getUserId()) + .eq(YwSignLog::getSignType, ywSignDTO.getSignType()) + .eq(YwSignLog::getSignPlanId, ywSignDTO.getSignPlanId())); + if (signLog == null) { + throw new ServiceException("签到记录未生成"); + } + if (signLog.getSignTime() != null) { + throw new ServiceException("您已完成打卡,请勿重新打卡"); + } + YwSignLog ywSignLog = new YwSignLog(); + ywSignLog.setSignPlanId(ywSignDTO.getSignPlanId()); + ywSignLog.setUserId(SecurityUtils.getUserId()); + ywSignLog.setSignTime(new Date()); + Double j = new BigDecimal(ywSignDTO.getLongitude()).setScale(6, RoundingMode.HALF_UP).doubleValue(); + ywSignLog.setSignJ(j); + Double w = new BigDecimal(ywSignDTO.getLatitude()).setScale(6, RoundingMode.HALF_UP).doubleValue(); + ywSignLog.setSignW(w); +// ywSignLog.setIsDaiSign(false); + ywSignLog.setSignType(ywSignDTO.getSignType().toString()); + SysUser sysUser = new SysUser(); + sysUser.setUserId(SecurityUtils.getUserId()); + sysUser.setRoles(SecurityUtils.getLoginUser().getUser().getRoles()); +// List ywSceneList = ywSceneService.getVenueByUser(sysUser); +// Long sceneId = ywSceneList.get(0).getId(); + ywSignLogMapper.sign(ywSignLog, ywSignDTO.getVenueId()); + return true; + } + + @Override + public Boolean signTest(YwSignDTO ywSignDTO) { + YwSignVo ywSignVo = couldSign(ywSignDTO); + if (!ywSignVo.getCouldSign()) { + throw new ServiceException(ywSignVo.getFailMsg()); + } + YwSignLog signLog = ywSignLogMapper.selectOne(new LambdaQueryWrapper() + .eq(YwSignLog::getUserId, SecurityUtils.getUserId()) + .eq(YwSignLog::getSignType, ywSignDTO.getSignType()) + .eq(YwSignLog::getSignPlanId, ywSignDTO.getSignPlanId())); + if (signLog == null) { + throw new ServiceException("签到记录未生成"); + } + YwSignLog ywSignLog = new YwSignLog(); + ywSignLog.setSignPlanId(ywSignDTO.getSignPlanId()); + ywSignLog.setUserId(SecurityUtils.getUserId()); + ywSignLog.setSignTime(new Date()); + Double j = new BigDecimal(ywSignDTO.getLongitude()).setScale(6, RoundingMode.HALF_UP).doubleValue(); + ywSignLog.setSignJ(j); + Double w = new BigDecimal(ywSignDTO.getLatitude()).setScale(6, RoundingMode.HALF_UP).doubleValue(); + ywSignLog.setSignW(w); +// ywSignLog.setIsDaiSign(false); + ywSignLog.setSignType(ywSignDTO.getSignType().toString()); + SysUser sysUser = new SysUser(); + sysUser.setUserId(SecurityUtils.getUserId()); + sysUser.setRoles(SecurityUtils.getLoginUser().getUser().getRoles()); +// List ywSceneList = ywSceneService.getVenueByUser(sysUser); +// Long sceneId = ywSceneList.get(0).getId(); + ywSignLogMapper.sign(ywSignLog, ywSignDTO.getVenueId()); + return true; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSignLogViewServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSignLogViewServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..194876ae9f9faa9a0f496409021be9077f8d217d --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSignLogViewServiceImpl.java @@ -0,0 +1,257 @@ +package com.ruoyi.eastcom_yw.service.impl; + + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.domain.YwSignLogView; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogStaticVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogVo; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneUserMapper; +import com.ruoyi.eastcom_yw.mapper.YwSignLogViewMapper; +import com.ruoyi.eastcom_yw.service.YwSignLogViewService; +import com.ruoyi.system.mapper.SysRoleMapper; +import com.ruoyi.system.mapper.SysUserRoleMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Service +public class YwSignLogViewServiceImpl extends ServiceImpl implements YwSignLogViewService { + + + @Autowired + YwSignLogViewMapper ywSignLogViewMapper; + + @Autowired + private YwSceneMapper ywSceneMapper; + + @Autowired + private YwSceneUserMapper ywSceneUserMapper; + + @Autowired + private SysRoleMapper sysRoleMapper; + + + @Override + public TableDataInfo getSignLog(YwSignLogDTO ywSignLogDTO) { + + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.like(StringUtils.isNotEmpty(ywSignLogDTO.getCity()),YwSignLogView::getAreaCountyId,ywSignLogDTO.getCity()); + + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywSignLogDTO.getCounty()),YwSignLogView::getAreaCountyId,ywSignLogDTO.getCounty()); + + lambdaQueryWrapper.like(StringUtils.isNotEmpty(ywSignLogDTO.getNickName()),YwSignLogView::getNickName,ywSignLogDTO.getNickName()); + + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywSignLogDTO.getSignStatus()),YwSignLogView::getSignStatus,ywSignLogDTO.getSignStatus()); + + if(ObjectUtils.isNotEmpty(ywSignLogDTO.getVenueIds())) + { + lambdaQueryWrapper.in(ywSignLogDTO.getVenueIds().length>0,YwSignLogView::getSceneId,ywSignLogDTO.getVenueIds()); + } + + boolean needDate = true; + + if(ObjectUtils.isNotEmpty(ywSignLogDTO.getGenTime())) { + if (StringUtils.isNotEmpty(ywSignLogDTO.getStartDate()) && StringUtils.isNotEmpty(ywSignLogDTO.getEndDate())) { + if (ywSignLogDTO.getStartDate().substring(0, 10).equals(ywSignLogDTO.getEndDate().substring(0, 10))) { + LocalDateTime now = LocalDateTime.now(); + String time = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + if (ywSignLogDTO.getStartDate().substring(0, 10).equals(time)) { + if (ywSignLogDTO.getGenTime()) { + lambdaQueryWrapper.lt(YwSignLogView::getGenTime, now); + } + if (!ywSignLogDTO.getGenTime()) { + lambdaQueryWrapper.lt(YwSignLogView::getBeginTime, now); + + lambdaQueryWrapper.between( + YwSignLogView::getBeginTime, DateUtils.parseDate(ywSignLogDTO.getStartDate()), now); + needDate = false; + + } + + } + } + } + } + + if(needDate) { + if (StringUtils.isNotEmpty(ywSignLogDTO.getStartDate()) && StringUtils.isNotEmpty(ywSignLogDTO.getEndDate())) { + try { + lambdaQueryWrapper.between( + YwSignLogView::getBeginTime, DateUtils.parseDate(ywSignLogDTO.getStartDate()), DateUtils.parseDate(ywSignLogDTO.getEndDate(), "yyyy-MM-dd HH:mm:ss")); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + } + + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywSignLogDTO.getUserType()),YwSignLogView::getUserType,ywSignLogDTO.getUserType()); + + +// lambdaQueryWrapper.orderByAsc(YwSignLogView::getSceneId); + lambdaQueryWrapper.orderByDesc(YwSignLogView::getSignDate); + lambdaQueryWrapper.orderByDesc(YwSignLogView::getBeginTime); + lambdaQueryWrapper.orderByAsc(YwSignLogView::getUserId); + List list=null; + + TableDataInfo rspData = new TableDataInfo(); + + if(ObjectUtils.isNotEmpty(ywSignLogDTO.getPageSize())) + { + //传入-1为全部数据 + if(ywSignLogDTO.getPageSize()==-1) + { + list = ywSignLogViewMapper.selectList(lambdaQueryWrapper); + rspData.setTotal(list.size()); + } + else + { + if(ObjectUtils.isEmpty(ywSignLogDTO.getPageNum())) + { + ywSignLogDTO.setPageNum(1); + } + + Page page=ywSignLogViewMapper.selectPage(new Page<>(ywSignLogDTO.getPageNum(), ywSignLogDTO.getPageSize()),lambdaQueryWrapper); + list = page.getRecords(); + rspData.setTotal(page.getTotal()); + } + + if(list.size()>0) { + + List list_signlogvo = new ArrayList<>(); + + list.forEach( + ywSignLogView -> { + YwSignLogVo ywSignLogVo = new YwSignLogVo(); + + //设置角色 + Long userId = ywSignLogView.getUserId(); + List sysRoles = sysRoleMapper.selectRolePermissionByUserId(userId); + ywSignLogVo.setRoleNames(sysRoles.stream().map(SysRole::getRoleName).toArray(String[]::new)); + + //设置区域 +// List venuesByUserId = ywSceneUserMapper.getVenuesByUserId(userId); +// ywSignLogVo.setSceneUser(venuesByUserId); + + BeanUtils.copyBeanProp(ywSignLogVo, ywSignLogView); + + //导出时对时间的处理 + if (ObjectUtils.isNotEmpty(ywSignLogView.getBeginTime())) { + ywSignLogVo.setStrBeginTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", ywSignLogView.getBeginTime())); + } + + if (ObjectUtils.isNotEmpty(ywSignLogView.getEndTime())) { + ywSignLogVo.setStrEndTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", ywSignLogView.getEndTime())); + } + + if (ObjectUtils.isNotEmpty(ywSignLogView.getSignInTime())) { + ywSignLogVo.setStrSignInTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", ywSignLogView.getSignInTime())); + } + + if (ObjectUtils.isNotEmpty(ywSignLogView.getSignOutTime())) { + ywSignLogVo.setStrSignOutTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", ywSignLogView.getSignOutTime())); + } + + list_signlogvo.add(ywSignLogVo); + } + ); + + rspData.setRows(list_signlogvo); + + } + } + + + return rspData; + + } + + + + @Override + public List getSignLogStatic(YwSignLogDTO ywSignLogDTO) { + + if(ObjectUtils.isNotEmpty(ywSignLogDTO.getGenTime())) + { + //当天的签到统计数据,当前时间大于签到计划生成时间,设置变量TODAY,用于SQL过滤 + if(StringUtils.isNotEmpty(ywSignLogDTO.getStartDate())&&StringUtils.isNotEmpty(ywSignLogDTO.getEndDate())) + { + if(ywSignLogDTO.getStartDate().substring(0,10).equals(ywSignLogDTO.getEndDate().substring(0,10))) + { + LocalDateTime now = LocalDateTime.now(); + String time = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + if(ywSignLogDTO.getStartDate().substring(0,10).equals(time)) + { + ywSignLogDTO.setToday(true); + } + } + } + } + else + { + if(StringUtils.isNotEmpty(ywSignLogDTO.getEndDate())) + { + LocalDateTime now = LocalDateTime.now(); + LocalDateTime endTime = LocalDateTimeUtil.parse(ywSignLogDTO.getEndDate(),DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + if(now.isBefore(endTime)) + { + return ywSignLogViewMapper.getSignLogStatic(ywSignLogDTO); + } + } + } + return ywSignLogViewMapper.getSignLogStatic20231012(ywSignLogDTO); + } + + @Override + public List getSignLogAndPlan(Long venueId) { + Long userId = SecurityUtils.getUserId(); +// Date date = new Date(); +// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); +// String today = dateFormat.format(date); + List ywScenes = ywSceneMapper.getVenueByUserId(userId); + if(CollUtil.isEmpty(ywScenes)){ + throw new ServiceException("用户未绑定场馆"); + } + return ywSignLogViewMapper.selectList(new LambdaQueryWrapper() + .eq(YwSignLogView::getSignDate, DateUtils.getNowDate()) + .eq(YwSignLogView::getUserId, userId) + .eq(YwSignLogView::getSceneId, venueId)); + + } + + @Override + public List getSignLogByPlanId(Long signPlanId) { + Long userId = SecurityUtils.getUserId(); + List ywScenes = ywSceneMapper.getVenueByUserId(userId); + if(CollUtil.isEmpty(ywScenes)){ + throw new ServiceException("用户未绑定场馆"); + } + return ywSignLogViewMapper.selectList(new LambdaQueryWrapper() + .eq(YwSignLogView::getUserId, userId) + .eq(YwSignLogView::getSignPlanId, signPlanId)); + + } +} \ No newline at end of file diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSignPlanServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSignPlanServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c880ec41dbc081183cce4ce39b9780a97dc1ec76 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSignPlanServiceImpl.java @@ -0,0 +1,769 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.util.StringUtil; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.domain.YwSignPlanView; +import com.ruoyi.eastcom_yw.domain.dto.YwSignPlanDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignPlanVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSignUserVo; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.YwSignPlanService; +import com.ruoyi.system.mapper.SysUserMapper; +import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +@Service +public class YwSignPlanServiceImpl extends ServiceImpl implements YwSignPlanService { + + @Autowired + private YwSignPlanMapper ywSignPlanMapper; + + @Autowired + private YwSignLogMapper ywSignLogMapper; + + @Autowired + private YwSceneMapper ywSceneMapper; + + @Autowired + private YwSceneViewMapper ywSceneViewMapper; + + @Autowired + private SysUserMapper sysUserMapper; + + @Autowired + private YwSceneUserMapper ywSceneUserMapper; + + @Override + public TableDataInfo getSignPlan(YwSignPlanDTO ywSignPlanDTO) { + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + if (ObjectUtils.isNotEmpty(ywSignPlanDTO.getVenueIds())) { + lambdaQueryWrapper.in(ywSignPlanDTO.getVenueIds().length > 0, YwSignPlanView::getSceneId, ywSignPlanDTO.getVenueIds()); + } + + //20230621获取用户自己的签到计划 + if (StringUtils.isNotEmpty(ywSignPlanDTO.getSignUsers())) { + lambdaQueryWrapper.apply("id in (select sign_plan_id from v_yw_sign_log where user_id = {0}::numeric)", ywSignPlanDTO.getSignUsers()); + } + + //20230629场馆类别的筛选 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywSignPlanDTO.getVenueType()), YwSignPlanView::getVenueType, ywSignPlanDTO.getVenueType()); + + //20230629维护类型的筛选 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywSignPlanDTO.getMaintainType()), YwSignPlanView::getMaintainType, ywSignPlanDTO.getMaintainType()); + + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywSignPlanDTO.getSignDate()), YwSignPlanView::getSignDate, + DateUtils.parseDate(ywSignPlanDTO.getSignDate())); + + lambdaQueryWrapper.between(ObjectUtils.isNotEmpty(ywSignPlanDTO.getStartDate()) && ObjectUtils.isNotEmpty(ywSignPlanDTO.getEndDate()), + YwSignPlanView::getSignDate, DateUtils.parseDate(ywSignPlanDTO.getStartDate()), DateUtils.parseDate(ywSignPlanDTO.getEndDate())); + + lambdaQueryWrapper.orderByDesc(YwSignPlanView::getSignDate, YwSignPlanView::getBeginTime); + + List list = null; + + TableDataInfo rspData = new TableDataInfo(); + + if (ObjectUtils.isNotEmpty(ywSignPlanDTO.getPageSize())) { + if (ywSignPlanDTO.getPageSize() == -1) { + list = ywSignPlanMapper.selectList(lambdaQueryWrapper); + rspData.setTotal(list.size()); + } else { + Page page = ywSignPlanMapper.selectPage(new Page<>(ywSignPlanDTO.getPageNum(), ywSignPlanDTO.getPageSize()), lambdaQueryWrapper); + list = page.getRecords(); + rspData.setTotal(page.getTotal()); + } + + if (list.size() > 0) { + List listSignPlanVo = new ArrayList<>(); + + list.forEach( + ywSignPlanView -> { + + YwSignPlanVo ywSignPlanVo = handleYwSignPlan(ywSignPlanView); + //应签到用户的人数 +// if(ObjectUtils.isNotEmpty(ywSignPlanVo.getSignUsers())&&ywSignPlanVo.getSignUsers().size()>0) { +// ywSignPlanVo.setSignUsersNum(ywSignPlanVo.getSignUsers().size()); +// } +// else +// { +// ywSignPlanVo.setSignUsersNum(0); +// } + if (ywSignPlanDTO.getIsExport()) { + if (ObjectUtils.isNotEmpty(ywSignPlanView.getSignDate())) { + ywSignPlanVo.setStrSignDate("'" + DateUtils.parseDateToStr("yyyy-MM-dd", ywSignPlanView.getSignDate()) + "'"); + } + + if (ObjectUtils.isNotEmpty(ywSignPlanView.getBeginTime())) { + ywSignPlanVo.setStrBeginTime("'" + DateUtils.parseDateToStr("HH:mm:ss", ywSignPlanView.getBeginTime()) + "'"); + } + + if (ObjectUtils.isNotEmpty(ywSignPlanView.getEndTime())) { + ywSignPlanVo.setStrEndTime("'" + DateUtils.parseDateToStr("HH:mm:ss", ywSignPlanView.getEndTime()) + "'"); + } + } + + if (!ywSignPlanDTO.getIsExport()) { + if (ObjectUtils.isNotEmpty(ywSignPlanView.getSignDate())) { + ywSignPlanVo.setStrSignDate(DateUtils.parseDateToStr("yyyy-MM-dd", ywSignPlanView.getSignDate())); + } + + if (ObjectUtils.isNotEmpty(ywSignPlanView.getBeginTime())) { + ywSignPlanVo.setStrBeginTime(DateUtils.parseDateToStr("HH:mm:ss", ywSignPlanView.getBeginTime())); + } + + if (ObjectUtils.isNotEmpty(ywSignPlanView.getEndTime())) { + ywSignPlanVo.setStrEndTime(DateUtils.parseDateToStr("HH:mm:ss", ywSignPlanView.getEndTime())); + } + } + + listSignPlanVo.add(ywSignPlanVo); + } + ); + + rspData.setRows(listSignPlanVo); + } + + } + + return rspData; + } + + + public YwSignPlanVo handleYwSignPlan(YwSignPlanView ywSignPlanView) { + YwSignPlanVo ywSignPlanVo = new YwSignPlanVo(); + + BeanUtils.copyBeanProp(ywSignPlanVo, ywSignPlanView); + + if (StringUtils.isNotEmpty(ywSignPlanView.getSignUsers())) { + String[] arrUserId = ywSignPlanView.getSignUsers().split(","); + + List lstUserId = new ArrayList<>(); + + for (String strUserId : arrUserId) { + if (NumberUtils.isCreatable(strUserId)) { + + Long userId = Long.parseLong(strUserId); + //验证用户是否在当前场馆下 + YwSceneUser sceneUser = new YwSceneUser(); + sceneUser.setUserId(userId); + sceneUser.setSceneId(ywSignPlanView.getSceneId()); + List lstSceneUser = ywSceneUserMapper.getListByUserIdAndSceneId(sceneUser); + if (!lstSceneUser.isEmpty()) { + lstUserId.add(userId); + } + } + } + + if (lstUserId.size() > 0) { + + List lstUser = sysUserMapper.selectUserByIds(lstUserId); + + if (!lstUser.isEmpty()) { + List lstSignUser = new ArrayList<>(); + for (SysUser user : lstUser) { + //不要显示冻结的 + if ("2".equals(user.getStatus())) { + continue; + } + YwSignUserVo signUser = new YwSignUserVo(); + signUser.setUserId(user.getUserId()); + signUser.setUserName(user.getNickName()); + lstSignUser.add(signUser); + } + ywSignPlanVo.setSignUsers(lstSignUser); + } + + } + + } + + return ywSignPlanVo; + } + + @Override + public List getSignPlan(Long venueId, String signDate) { + + Long user_id = SecurityUtils.getUserId(); + + return ywSignPlanMapper.getSignPlanList(user_id, venueId, signDate); + + } + + private boolean checkData(List signPlanList, Long sceneBigId) throws ParseException { + boolean checkFlag = true; + for (YwSignPlanDTO plan : signPlanList) { + StringBuilder reason = new StringBuilder(); + + if (ObjectUtils.isNotEmpty(plan.getRepSignInterval())) { + if (!(plan.getRepSignInterval().equals(1) || plan.getRepSignInterval().equals(2) || plan.getRepSignInterval().equals(4))) { + checkFlag = false; + reason.append("【签到时间量】只允许1,2,4,不填默认为4"); + } + } + + if (StringUtil.isEmpty(plan.getVenueName())) { + checkFlag = false; + reason.append("【场馆】场馆不能为空。"); + } + List venues = new ArrayList<>(); + //需要当前操作用户的ID +// Long user_id = SecurityUtils.getUserId(); + + SysUser user = SecurityUtils.getLoginUser().getUser(); + + //用户能否操作处理的场馆 + //sysadmin和admin的可以操作所有场馆,不是管理员需要验证场馆 + if (!user.isAdmin(user)) { +// if (!SecurityUtils.isAdmin(user_id)) { + venues = ywSceneMapper.getVenueByQuery(user.getUserId(), plan.getVenueName(), sceneBigId); + if (venues.isEmpty()) { + checkFlag = false; + reason.append("【场馆】当前用户没有操作【" + plan.getVenueName() + "】场馆的权限。"); + } + } + + //todo:这里应该不管是不是管理员都要验证场馆是否存在 + //todo:如果这个场馆不存在,是不是肯定不会有这个场馆的权限 +// if(!user.isAdmin(user)) { +//// if (SecurityUtils.isAdmin(user_id)) { +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("venue_name", plan.getVenueName()); +// queryWrapper.eq("scene_big_id", sceneBigId); +// venues = ywSceneMapper.selectList(queryWrapper); +// if (venues.isEmpty()) { +// checkFlag = false; +// reason.append("【场馆】系统中没有该场馆。"); +// } +// } + + String strSignDate = plan.getSignDate().replace("'", ""); + Date signDate = null; + if (StringUtil.isEmpty(strSignDate)) { + checkFlag = false; + reason.append("【签到日期】签到日期不能为空。"); + } else if (!StringUtils.isDate(strSignDate, "yyyy-MM-dd")) { + checkFlag = false; + reason.append("【签到日期】签到日期格式不正确。"); + } else { + signDate = DateUtils.parseDate(strSignDate, "yyyy-MM-dd"); + if (signDate.before(DateUtils.dateTime("yyyy-MM-dd", DateUtils.getDate()))) { + checkFlag = false; + reason.append("【签到日期】签到日期不能早于当前日期。"); + } + } + + String strTime = plan.getBeginTime().replace("'", ""); + Date signBeginTime = null; + if (StringUtil.isEmpty(strTime)) { + checkFlag = false; + reason.append("【早签到时间】早签到时间不能为空。"); + } else if (!StringUtils.isDate(strTime, "HH:mm:ss")) { + checkFlag = false; + reason.append("【早签到时间】早签到时间格式不正确。"); + } else if (!StringUtil.isEmpty(strSignDate) && StringUtils.isDate(strSignDate, "yyyy-MM-dd")) { + String beginTime = strSignDate + " " + strTime; + signBeginTime = DateUtils.parseDate(beginTime, "yyyy-MM-dd HH:mm:ss"); + if (signBeginTime.before(DateUtils.getNowDate())) { + checkFlag = false; + reason.append("【早签到时间】签到时间不能早于当前时间。"); + } + } + + strTime = plan.getEndTime().replace("'", ""); + Date signEndTime; + if (StringUtil.isEmpty(strTime)) { + checkFlag = false; + reason.append("【晚签到时间】晚签到时间不能为空。"); + } else if (!StringUtils.isDate(strTime, "HH:mm:ss")) { + checkFlag = false; + reason.append("【晚签到时间】晚签到时间格式不正确。"); + } else if (!StringUtil.isEmpty(strSignDate) && StringUtils.isDate(strSignDate, "yyyy-MM-dd")) { + String endTime = strSignDate + " " + strTime; + signEndTime = DateUtils.parseDate(endTime, "yyyy-MM-dd HH:mm:ss"); + if (signBeginTime != null && signEndTime.before(signBeginTime)) { + checkFlag = false; + reason.append("【晚签到时间】晚签到时间必须大于早签到时间。"); + } + } + + //20230406 未对“提前通知量”进行校验 + if (!StringUtil.isEmpty(plan.getRepWarnInterval())) { + String[] arrIntervals = plan.getRepWarnInterval().split(","); + + for (String strInterval : arrIntervals) { + if (!StringUtils.isNumeric(strInterval)) { + checkFlag = false; + reason.append("【通知时间量】通知时间量必须是数字,多个用英文逗号隔开"); + } + + Integer interval = Integer.parseInt(strInterval); + + if (interval <= 0) { + checkFlag = false; + reason.append("【通知时间量】通知时间量必须大于0"); + } +//先不判断是否是5的倍数 +// if( interval % 5 != 0 ) +// { +// checkFlag = false; +// reason.append("【提醒时间量】提醒时间量必须是5的倍数"); +// } + + + } + + } + + if (StringUtil.isEmpty(plan.getNoticeType())) { + checkFlag = false; + reason.append("【通知方式】通知方式不能为空。"); + } else { + //TODO:通知方式可能是通知或者公告,不知道要不要判断 + + /*String noticeVal = DictUtils.getDictValue("sys_notice_type", plan.getNoticeType()); + if (StringUtils.isEmpty(noticeVal)) { + checkFlag = false; + reason.append("【通知方式】通知方式不正确。"); + }*/ + if (!"短信".equals(plan.getNoticeType()) && !"微信".equals(plan.getNoticeType()) && !"移动办公".equals(plan.getNoticeType()) && + !"邮件".equals(plan.getNoticeType()) && !"IVR".equals(plan.getNoticeType())) { + checkFlag = false; + reason.append("【通知方式】通知方式不正确。"); + } + } + +// if (CollectionUtil.isNotEmpty(venues) && signDate != null) { +// Long venueId = venues.get(0).getId(); +// LambdaQueryWrapper lambdaQueryWrapper2 = new LambdaQueryWrapper<>(); +// lambdaQueryWrapper2.eq(YwSignPlan::getSceneId, venueId); +// lambdaQueryWrapper2.eq(YwSignPlan::getSignDate, signDate); +// // 验证是否存在这个场馆的签到日期 +// List venuePlan = ywSignPlanMapper.selectList(lambdaQueryWrapper2); +// if (!venuePlan.isEmpty()) { +// checkFlag = false; +// reason.append("【" + DateUtils.dateTime(signDate) + "】,场馆【" + plan.getVenueName() + "】的签到计划已经存在"); +// } +// } + + plan.setReason(reason.toString()); + } + return checkFlag; + } + + @Override + public boolean insertSignPlan(YwSignPlanDTO ywSignPlanDTO) { + + ValidateSignPlan(ywSignPlanDTO); + + try { + if (ywSignPlanMapper.insertSignPlan(ywSignPlanDTO) > 0) { + return true; + } + } catch (Exception ex) { + System.out.println(ex.getMessage()); + } + + return false; + + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importSignPlan(List signPlanList, Boolean isUpdateSupport, Long sceneBigId) throws ParseException { + if (StringUtils.isNull(signPlanList) || signPlanList.size() == 0) { + throw new ServiceException("导入数据不能为空!"); + } + + // 核查数据 + boolean checkFlag; + checkFlag = checkData(signPlanList, sceneBigId); + if (!checkFlag) { + ExcelUtil util = new ExcelUtil<>(YwSignPlanDTO.class); + String fileName = (String) util.exportExcel(signPlanList, "签到导入结果").get(AjaxResult.MSG_TAG); + return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + } + + /*int successNum = 0; + int failureNum = 0; + int planNum=1; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder();*/ + + for (YwSignPlanDTO plan : signPlanList) { +// try +// { +// if ( StringUtil.isEmpty(plan.getVenueName()) ) { +// throw new ServiceException("场馆不能为空"); +// } + +// LambdaQueryWrapper lambdaQueryWrapper1=new LambdaQueryWrapper<>(); +// lambdaQueryWrapper1.eq(YwSceneView::getVenueName,plan.getVenueName()); +// //验证这个场馆是否是数据库可以用的场馆 +// List venues = ywSceneViewMapper.selectList(lambdaQueryWrapper1); + List venues; + +// Long user_id =1L; +// Long user_id = SecurityUtils.getUserId(); + +// if(!SecurityUtils.isAdmin(user_id)) { +// venues = ywSceneMapper.getVenueByQuery(user_id, plan.getVenueName(),sceneBigId); +// if (venues.isEmpty()) { +// throw new ServiceException("当前用户没有操作【"+plan.getVenueName()+"】场馆的权限"); +// } +// } + +// if(SecurityUtils.isAdmin(user_id)) +// { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("venue_name", plan.getVenueName()); + queryWrapper.eq("scene_big_id", sceneBigId); + venues = ywSceneMapper.selectList(queryWrapper); +// if (venues.isEmpty()) { +// throw new ServiceException("系统中没有该场馆"); +// } +// } + + Long venueId = venues.get(0).getId(); + + plan.setVenueIds(new Long[]{venueId}); + + + String strSignDate = plan.getSignDate().replace("'", ""); + +// if ( StringUtil.isEmpty(strSignDate) ) { +// throw new ServiceException("签到日期不能为空"); +// } +// + Date signDate = DateUtils.parseDate(strSignDate); +// +// if(ObjectUtils.isEmpty(signDate)) +// { +// throw new ServiceException("签到日期格式不正确"); +// } + + strSignDate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, signDate); + + plan.setSignDates(new String[]{strSignDate}); + +// String strTime = plan.getBeginTime().replace("'",""); + +// if ( StringUtil.isEmpty(strTime) ) { +// throw new ServiceException("早签到时间不能为空"); +// } + +// String beginTime = strSignDate +" "+strTime; + +// Date signBeginTime = DateUtils.parseDate(beginTime); + +// if(ObjectUtils.isEmpty(signBeginTime)) +// { +// throw new ServiceException("早签到时间格式不正确"); +// } + +// strTime = plan.getEndTime().replace("'",""); + +// if ( StringUtil.isEmpty(strTime) ) { +// throw new ServiceException("晚签到时间不能为空"); +// } + +// String endTime = strSignDate +" "+strTime; +// +// Date signEndTime = DateUtils.parseDate(endTime); + +// if(ObjectUtils.isEmpty(signEndTime)) +// { +// throw new ServiceException("晚签到时间格式不正确"); +// } +// +// if(signEndTime.before(signBeginTime)) +// { +// throw new ServiceException("晚签到时间必须大于早签到时间"); +// } +// +// if (StringUtil.isEmpty(plan.getNoticeType()) ) { +// throw new ServiceException("提醒方式不能为空"); +// } + + //TODO:通知方式可能是通知或者公告,不知道要不要判断 + + String noticeVal = DictUtils.getDictValue("sys_notice_type", plan.getNoticeType()); +// if(StringUtils.isEmpty(noticeVal)) +// { +// throw new ServiceException("提醒方式不正确"); +// } + + plan.setNoticeType(noticeVal); + +// LambdaQueryWrapper lambdaQueryWrapper2=new LambdaQueryWrapper<>(); +// lambdaQueryWrapper2.eq(YwSignPlan::getSceneId,venueId); +// lambdaQueryWrapper2.eq(YwSignPlan::getSignDate,DateUtils.dateTime(signDate)); +// +// // 验证是否存在这个场馆的签到日期 +// List venuePlan = ywSignPlanMapper.selectList(lambdaQueryWrapper2); +// +// if(!venuePlan.isEmpty()) +// { +// throw new ServiceException("【"+DateUtils.dateTime(signDate)+"】,场馆【"+plan.getVenueName()+"】的相同场馆存在时间重叠"); +// } + + //获取场馆的人员为签到用户 +// QueryWrapper queryUserWrapper=new QueryWrapper<>(); +// queryUserWrapper.eq("scene_id",venueId); +// +// List lstSceneUser = ywSceneUserMapper.selectList(queryUserWrapper); +// +// List lstUserId = lstSceneUser.stream().map(x->x.getUserId()).collect(Collectors.toList()); +// +// plan.setSignUsers(StringUtils.join(lstUserId,",")); + + plan.setCreateBy(SecurityUtils.getUsername()); + + int res = ywSignPlanMapper.insertSignPlan(plan); + + if (res == 0) { + // 需要获取到字典标签,不然导入结果显示有问题 + plan.setNoticeType(DictUtils.getDictLabel("sys_notice_type", plan.getNoticeType())); + plan.setReason(plan.getSignDates()[0] + " " + plan.getBeginTime() + " " + plan.getEndTime() + "相同场馆存在时间重叠"); + ExcelUtil util = new ExcelUtil<>(YwSignPlanDTO.class); + String fileName = (String) util.exportExcel(signPlanList, "签到导入结果").get(AjaxResult.MSG_TAG); + return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + } + + if (res > 0) { + plan.setReason("导入成功"); + } + + /*if(!this.insertSignPlan(plan)) + { + throw new ServiceException("签到计划生成失败了,数据存在异常"); + }*/ +// } +// catch (Exception e) +// { +// /*failureNum++; +// String msg = "
" + failureNum + "、第 " + planNum + "列 导入失败:"; +// failureMsg.append(msg + e.getMessage());*/ +//// log.error(msg, e); +// } +// finally { +//// planNum++; +// } + } + /*if (failureNum > 0) + { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + }*/ + return AjaxResult.success(); + } + + @Override + @Transactional + public boolean updateSignPlan(YwSignPlanDTO ywSignPlanDTO) { + + ValidateSignPlan(ywSignPlanDTO); + + //删除这个签到计划已经生成的签到记录,重新出一份新的这个签到计划的签到记录出来 + //定时器去处理,这边就不需要再修改删除 + //ywSignLogMapper.deleteSignLogByPlan(ywSignPlanDTO.getId()); + + if (ywSignPlanMapper.updateSignPlan(ywSignPlanDTO) > 0) { + return true; + } + + return false; + } + + private void ValidateSignPlan(YwSignPlanDTO ywSignPlanDTO) { + + if (ywSignPlanDTO.getVenueIds().length == 0) { + throw new ServiceException("请选择一个场馆"); + } + + SysUser user = SecurityUtils.getLoginUser().getUser(); + + //用户能否操作处理的场馆 + //sysadmin和admin的可以操作所有场馆,不是管理员需要验证场馆 + if (!user.isAdmin(user)) { + +// 可以处理场馆数 + Integer handleVenueNum = 0; + + List venues = ywSceneMapper.getVenueByUserId(user.getUserId()); + + for (Long venueId : ywSignPlanDTO.getVenueIds()) { + + boolean canHandle = false; + + for (YwScene venue : venues) { + if (venue.getId().equals(venueId)) { + canHandle = true; + break; + } + } + + if (canHandle) { + handleVenueNum++; + } + + } + + //全部场馆都可以处理才算有权限 + if (!handleVenueNum.equals(ywSignPlanDTO.getVenueIds().length)) { + throw new ServiceException("当前用户没有操作其中一个场馆的权限"); + } + } + + + String strSignDate = ywSignPlanDTO.getSignDate().replace("'", ""); + + if (StringUtil.isEmpty(strSignDate)) { + throw new ServiceException("签到日期不能为空"); + } + + Date signDate = DateUtils.parseDate(strSignDate); + + if (ObjectUtils.isEmpty(signDate)) { + throw new ServiceException("签到日期格式不正确"); + } + + strSignDate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, signDate); + + String strTime = ywSignPlanDTO.getBeginTime().replace("'", ""); + + if (StringUtil.isEmpty(strTime)) { + throw new ServiceException("早签到时间不能为空"); + } + + String beginTime = strSignDate + " " + strTime; + + Date signBeginTime = DateUtils.parseDate(beginTime); + + if (ObjectUtils.isEmpty(signBeginTime)) { + throw new ServiceException("早签到时间格式不正确"); + } + + if (signBeginTime.before(DateUtils.getNowDate())) { + throw new ServiceException("早签到时间不能早于当前时间"); + } + + strTime = ywSignPlanDTO.getEndTime().replace("'", ""); + + String endTime = strSignDate + " " + strTime; + + Date signEndTime = DateUtils.parseDate(endTime); + + if (ObjectUtils.isEmpty(signBeginTime)) { + throw new ServiceException("晚签到时间格式不正确"); + } + + if (signEndTime.before(signBeginTime)) { + throw new ServiceException("晚签到时间必须大于早签到时间"); + } + + if (ObjectUtils.isNotEmpty(ywSignPlanDTO.getId())) { + + //验证时间是否重叠 + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.ne(YwSignPlanView::getId, ywSignPlanDTO.getId()); + + lambdaQueryWrapper.in(YwSignPlanView::getSceneId, ywSignPlanDTO.getVenueIds()); + + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywSignPlanDTO.getSignDate()), YwSignPlanView::getSignDate, + DateUtils.parseDate(ywSignPlanDTO.getSignDate())); + + lambdaQueryWrapper.and( + wrapper -> wrapper + .apply("{0} between begin_time and end_time", signBeginTime).or() + .apply("{0} between begin_time and end_time", signEndTime).or() + .between(YwSignPlanView::getBeginTime, signBeginTime, signEndTime).or() + .between(YwSignPlanView::getEndTime, signBeginTime, signEndTime) + ); + + List list = ywSignPlanMapper.selectList(lambdaQueryWrapper); + + if (!list.isEmpty()) { + throw new ServiceException(ywSignPlanDTO.getSignDates()[0] + " " + ywSignPlanDTO.getBeginTime() + " " + ywSignPlanDTO.getEndTime() + "相同场馆存在时间重叠"); + } + } + + if (!StringUtil.isEmpty(ywSignPlanDTO.getRepWarnInterval())) { + String[] arrIntervals = ywSignPlanDTO.getRepWarnInterval().split(","); + + for (String strInterval : arrIntervals) { + + if (!StringUtils.isNumeric(strInterval)) { + throw new ServiceException("提醒时间量必须是数字,多个用英文逗号隔开"); + } + + Integer interval = Integer.parseInt(strInterval); + + if (interval <= 0) { + throw new ServiceException("提醒时间量必须大于0"); + } + + } + } +// 验证签到用户的ID是否是数字 +// if(StringUtils.isNotEmpty(ywSignPlanDTO.getSignUsers())) +// { +// String [] arrUsers = ywSignPlanDTO.getSignUsers().split(","); +// +// for (String strUser : arrUsers) +// { +// if(!StringUtils.isNum(strUser)) +// { +// throw new ServiceException("签到用户异常"); +// } +// } +// +// } + + } + + + @Override + @Transactional + public boolean deleteSignPlan(Long id) { + //删除已经生成的签到记录 + ywSignLogMapper.deleteSignLogByPlan(id); + //删除签到计划 + if (ywSignPlanMapper.deleteSignPlan(id) > 0) { + return true; + } + return false; + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSparePartsServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSparePartsServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4bf65424efd5270948dd735194b21816e973e80c --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwSparePartsServiceImpl.java @@ -0,0 +1,162 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.importer.ImporterBase; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwSpareParts; +import com.ruoyi.eastcom_yw.domain.dto.YwSparePartsDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwSparePartsQO; +import com.ruoyi.eastcom_yw.domain.vo.YwSparePartsVO; +import com.ruoyi.eastcom_yw.importer.ImportSpareParts; +import com.ruoyi.eastcom_yw.mapper.YwSparePartsMapper; +import com.ruoyi.eastcom_yw.service.YwSparePartsService; +import com.ruoyi.eastcom_yw.service.convert.YwSparePartsConvert; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 亚运备件表 服务实现类 + *

+ * + * @author yqf + * @since 2023-08-31 + */ +@Service +public class YwSparePartsServiceImpl extends ServiceImpl implements YwSparePartsService { + + @Resource + private YwSparePartsMapper ywSparePartsMapper; + + /** + * 亚运备件表列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List getData(YwSparePartsQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 场馆名称 + .like(StrUtil.isNotBlank(qo.getVenueName()), YwSpareParts::getVenueName, qo.getVenueName()) + // 场馆类型 + .eq(StrUtil.isNotBlank(qo.getVenueType()), YwSpareParts::getVenueType, qo.getVenueType()) + // 设备类型 + .eq(StrUtil.isNotBlank(qo.getDeviceType()), YwSpareParts::getDeviceType, qo.getDeviceType()) + // 专业 + .eq(StrUtil.isNotBlank(qo.getMajor()), YwSpareParts::getMajor, qo.getMajor()) + // 联系人 + .like(StrUtil.isNotBlank(qo.getContacts()), YwSpareParts::getContacts, qo.getContacts()) + // 联系电话 + .like(StrUtil.isNotBlank(qo.getTelephone()), YwSpareParts::getTelephone, qo.getTelephone()) + ; + if(StrUtil.isNotBlank(qo.getQueryType())){ + queryWrapper.and(c -> c.like(YwSpareParts::getDeviceType, qo.getQueryType()) + .or().like(YwSpareParts::getBoardModel, qo.getQueryType()) + .or().like(YwSpareParts::getPartModel, qo.getQueryType()) + .or().like(YwSpareParts::getMajor, qo.getQueryType()) + ); + } + List list = ywSparePartsMapper.selectList(queryWrapper); + return YwSparePartsConvert.INSTANCE.entityToVoList(list); + } + + /** + * 亚运备件表分页列表 + * + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage getDataByPage(YwSparePartsQO qo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + // 场馆名称 + .like(StrUtil.isNotBlank(qo.getVenueName()), YwSpareParts::getVenueName, qo.getVenueName()) + // 场馆类型 + .eq(StrUtil.isNotBlank(qo.getVenueType()), YwSpareParts::getVenueType, qo.getVenueType()) + // 设备类型 + .eq(StrUtil.isNotBlank(qo.getDeviceType()), YwSpareParts::getDeviceType, qo.getDeviceType()) + // 专业 + .eq(StrUtil.isNotBlank(qo.getMajor()), YwSpareParts::getMajor, qo.getMajor()) + // 联系人 + .like(StrUtil.isNotBlank(qo.getContacts()), YwSpareParts::getContacts, qo.getContacts()) + // 联系电话 + .like(StrUtil.isNotBlank(qo.getTelephone()), YwSpareParts::getTelephone, qo.getTelephone()) + ; + if(StrUtil.isNotBlank(qo.getQueryType())){ + queryWrapper.and(c -> c.like(YwSpareParts::getDeviceType, qo.getQueryType()) + .or().like(YwSpareParts::getBoardModel, qo.getQueryType()) + .or().like(YwSpareParts::getPartModel, qo.getQueryType()) + .or().like(YwSpareParts::getMajor, qo.getQueryType()) + ); + } + + Page page = page(new Page<>(qo.getPageNum(), qo.getPageSize()), queryWrapper); + IPage voPage = page.convert(YwSparePartsConvert.INSTANCE::entityToVo); + return voPage; + } + + @Override + public YwSparePartsVO fetchById(Long id) { + YwSpareParts entity = ywSparePartsMapper.selectById(id); + return YwSparePartsConvert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(YwSparePartsDTO dto) { + YwSpareParts entity = YwSparePartsConvert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(ywSparePartsMapper.deleteBatchIds(ids)); + } + + @Override + public void export(YwSparePartsQO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List data = this.getData(qo); + ExcelUtil util = new ExcelUtil<>(YwSparePartsVO.class); + try { + util.exportExcel(response, data, "亚运备件表信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult importData(List list) throws Exception { + ImporterBase importer = new ImportSpareParts(ywSparePartsMapper); + AjaxResult ajaxResult = importer.doAdd(list, null, null); + return ajaxResult; + } +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwWireTaskLogServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwWireTaskLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..682a75caea0c39405f638051737197750e5f5f14 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/YwWireTaskLogServiceImpl.java @@ -0,0 +1,533 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.dto.TaskDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.eastcom_yw.domain.YwAlarmView; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSignLogView; +import com.ruoyi.eastcom_yw.domain.YwWireTaskLog; +import com.ruoyi.eastcom_yw.domain.dto.YwWireTaskLogDTO; +import com.ruoyi.eastcom_yw.domain.enums.WireTaskStatus; +import com.ruoyi.eastcom_yw.domain.vo.FlowContentVo; +import com.ruoyi.eastcom_yw.domain.vo.YwConstrucTeamVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogVo; +import com.ruoyi.eastcom_yw.domain.vo.YwWireTaskLogVo; +import com.ruoyi.eastcom_yw.mapper.YwConstrucTeamMapper; +import com.ruoyi.eastcom_yw.mapper.YwWireTaskLogMapper; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.YwWireTaskLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Service +public class YwWireTaskLogServiceImpl extends ServiceImpl implements YwWireTaskLogService { + + + @Autowired + private YwWireTaskLogMapper ywWireTaskLogMapper; + + @Autowired + private YwSceneService yw_sceneService; + + @Autowired + private CommonService commonService; + + @Autowired + private YwConstrucTeamMapper construcTeamMapper; + + @Autowired + private RedisCache redisCache; + + private final String JOBNOPREFIX = "BX"; + + + @Override + public Boolean insertWireTaskLog(YwWireTaskLogDTO ywWireTaskLogDTO) { + + if(ywWireTaskLogMapper.insertWireTask(ywWireTaskLogDTO)>0) + { + return true; + } + + return false; + + } + + private String getJobNo() { + String date = new SimpleDateFormat("yyyyMMdd").format(new Date()); + String key = JOBNOPREFIX + date; + + if (redisCache.hasKey(key)) { + String value = redisCache.getCacheObject(key).toString(); + String[] split = value.split("-"); + if (split.length == 3) { + int i = Integer.parseInt(split[2]) + 1; + String num = String.format("%04d", i); + String v = split[0] + "-" + split[1] + "-" + num; + redisCache.setCacheObject(key,v,1, TimeUnit.DAYS); + return v; + } + } + String value = JOBNOPREFIX + "-" + date + "-" + "0001"; + redisCache.setCacheObject(key,value,1, TimeUnit.DAYS); + return value; + } + + @Override + public String insertWireTaskLogReWireTaskId(YwWireTaskLogDTO ywWireTaskLogDTO) { + + if(StringUtils.isEmpty(ywWireTaskLogDTO.getWireTaskName())) + { + throw new ServiceException("任务名称不能为空"); + } + + //只有布线和布线拆除才需要通过场馆ID找施工队 + if(ywWireTaskLogDTO.getTaskType()==1||ywWireTaskLogDTO.getTaskType()==2) + { + if(ywWireTaskLogDTO.getTaskType()==1) + { + //新增布线任务的时候自动生成布线任务Id + //taskType=1,不管是否有WireTaskId,都是系统新增一条 +// if(StringUtils.isEmpty(ywWireTaskLogDTO.getWireTaskId())) +// { + //通过数据库表生成,因为异常原因可能导致重复的任务ID,需要修改成其它方案 +// String wireTaskId=ywWireTaskLogMapper.getWireTaskId(); + String wireTaskId=getJobNo(); + ywWireTaskLogDTO.setWireTaskId(wireTaskId); +// } + } + + if(ObjectUtils.isEmpty(ywWireTaskLogDTO.getVenueId())) + { + throw new ServiceException("没有场馆数据,无法新增任务"); + } + + //布线和拆线根据布线任务的场馆ID自动生成相应施工单位 + if(ObjectUtils.isNotEmpty(ywWireTaskLogDTO.getVenueId())) + { + List lstYct = construcTeamMapper.getConstrucTeamByVenueId(ywWireTaskLogDTO.getVenueId()); + + if(lstYct.size()==0) + { + throw new ServiceException("没有找到该场馆的施工队,请先配置施工队"); + } + + if(lstYct.size()>0) + { + ywWireTaskLogDTO.setConstrucUnit(lstYct.get(0).getVenderName()); + } + } + } + + if(StringUtils.isEmpty(ywWireTaskLogDTO.getWireTaskId())) + { + throw new ServiceException("没有任务ID,无法新增任务"); + } + + if(ywWireTaskLogDTO.getTaskType()==3||ywWireTaskLogDTO.getTaskType()==4) + { + String [] strWireTaskIds = ywWireTaskLogDTO.getWireTaskId().split("-"); + + if(strWireTaskIds.length!=4) + { + throw new ServiceException("任务ID号存在异常,无法新增任务"); + } + +// 取前三个 + String faterWireTaskId = StringUtils.join(ArrayUtil.remove(strWireTaskIds,3),"-"); + + //查找相应的任务类型的施工单位 + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.eq(YwWireTaskLog::getWireTaskId,faterWireTaskId); + + if(ywWireTaskLogDTO.getTaskType()==3) + { + lambdaQueryWrapper.eq(YwWireTaskLog::getTaskType,1); + } + if(ywWireTaskLogDTO.getTaskType()==4) + { + lambdaQueryWrapper.eq(YwWireTaskLog::getTaskType,2); + } + + YwWireTaskLog taskLog = ywWireTaskLogMapper.selectOne(lambdaQueryWrapper); + + if(taskLog==null) + { + throw new ServiceException("未找到相关任务,数据有错误,无法结算"); + } + + if(taskLog!=null) + { + ywWireTaskLogDTO.setVenueId(taskLog.getVenueId()); + ywWireTaskLogDTO.setConstrucUnit(taskLog.getConstrucUnit()); + } + + } + + if(ywWireTaskLogMapper.insertWireTask(ywWireTaskLogDTO)>0) + { + return ywWireTaskLogDTO.getWireTaskId(); + } + + return ""; + } + + @Override + public Boolean updateWireTaskLog(YwWireTaskLogDTO ywWireTaskLogDTO) { + + if(StringUtils.isEmpty(ywWireTaskLogDTO.getWireTaskId())) + { + throw new ServiceException("请求的任务ID不能为空"); + } + + if(StringUtils.isEmpty(ywWireTaskLogDTO.getFlwProcessid())) + { + throw new ServiceException("请求的流程ID不能为空"); + } + + if(ObjectUtils.isEmpty(ywWireTaskLogDTO.getTaskType())) + { + throw new ServiceException("请求的任务类型不能为空"); + } + + if(ywWireTaskLogMapper.updateWireTask(ywWireTaskLogDTO)>0) + { + return true; + } + + return false; + + } + + @Override + public Boolean deleteWireTaskLog(YwWireTaskLogDTO ywWireTaskLogDTO) { + + if(StringUtils.isEmpty(ywWireTaskLogDTO.getWireTaskId())) + { + throw new ServiceException("请求的任务ID不能为空"); + } + + if(ObjectUtils.isEmpty(ywWireTaskLogDTO.getTaskType())) + { + throw new ServiceException("请求的任务类型不能为空"); + } + + if(ywWireTaskLogMapper.deleteWireTask(ywWireTaskLogDTO)>0) + { + return true; + } + + return false; + + } + + + @Override + public TableDataInfo getWireTaskLog(YwWireTaskLogDTO ywWireTaskLogDTO) { + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + //20230314增加任务号 +// lambdaQueryWrapper.like(StringUtils.isNotEmpty(ywWireTaskLogDTO.getWireTaskId()),YwWireTaskLog::getWireTaskId,ywWireTaskLogDTO.getWireTaskId()); + //20230314增加任务号和任务名称的一起筛选 + if(StringUtils.isNotEmpty(ywWireTaskLogDTO.getWireTaskId())) { + lambdaQueryWrapper.and(i -> i.like(YwWireTaskLog::getWireTaskId, ywWireTaskLogDTO.getWireTaskId()) + .or().like(YwWireTaskLog::getWireTaskName, ywWireTaskLogDTO.getWireTaskId())); + } + //20230314增加创建人 + lambdaQueryWrapper.like(StringUtils.isNotEmpty(ywWireTaskLogDTO.getCreater()),YwWireTaskLog::getCreateName,ywWireTaskLogDTO.getCreater()); + + lambdaQueryWrapper.like(StringUtils.isNotEmpty(ywWireTaskLogDTO.getCurrentUser()),YwWireTaskLog::getDealUser,ywWireTaskLogDTO.getCurrentUser()); + + lambdaQueryWrapper.like(StringUtils.isNotEmpty(ywWireTaskLogDTO.getSgdw()),YwWireTaskLog::getConstrucUnit,ywWireTaskLogDTO.getSgdw()); + + //20230303区县改为AreaCountyId查询 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywWireTaskLogDTO.getCounty()),YwWireTaskLog::getAreaCountyId,ywWireTaskLogDTO.getCounty()); + + //20230809,APP端增加地市的查询 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywWireTaskLogDTO.getCity()),YwWireTaskLog::getCity,ywWireTaskLogDTO.getCity()); + + //20230313 jkj 增加场馆ID筛选 + if(ObjectUtils.isNotEmpty(ywWireTaskLogDTO.getVenueIds())) { + lambdaQueryWrapper.in(ywWireTaskLogDTO.getVenueIds().length > 0, YwWireTaskLog::getVenueId, ywWireTaskLogDTO.getVenueIds()); + } + //20230303任务名称模糊查询 + lambdaQueryWrapper.like(StringUtils.isNotEmpty(ywWireTaskLogDTO.getWireTaskName()), YwWireTaskLog::getWireTaskName, ywWireTaskLogDTO.getWireTaskName()); + + if(ObjectUtils.isNotEmpty(ywWireTaskLogDTO.getTaskTypes())) + { + lambdaQueryWrapper.in(ywWireTaskLogDTO.getTaskTypes().length>0,YwWireTaskLog::getTaskType,ywWireTaskLogDTO.getTaskTypes()); + } + + //20230310 增加新的筛选 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywWireTaskLogDTO.getStatus()),YwWireTaskLog::getDealStatus,ywWireTaskLogDTO.getStatus()); + //20230310 增加按当前环节筛选 + lambdaQueryWrapper.like(StringUtils.isNotEmpty(ywWireTaskLogDTO.getCurStep()),YwWireTaskLog::getCurStep,ywWireTaskLogDTO.getCurStep()); + + //告警的时间 + lambdaQueryWrapper.between(StrUtil.isNotBlank(ywWireTaskLogDTO.getStartTime()) && StrUtil.isNotBlank(ywWireTaskLogDTO.getEndTime()), YwWireTaskLog::getCreateTime,DateUtils.parseDate(ywWireTaskLogDTO.getStartTime()) , DateUtils.parseDate(ywWireTaskLogDTO.getEndTime())); + + //20230703增加场馆类型和维护类型的筛选 + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywWireTaskLogDTO.getVenueType()),YwWireTaskLog::getVenueType,ywWireTaskLogDTO.getVenueType()); + + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywWireTaskLogDTO.getMaintainType()),YwWireTaskLog::getMaintainType,ywWireTaskLogDTO.getMaintainType()); + + TableDataInfo rspData = new TableDataInfo(); + List list = null; + if (ObjectUtils.isNotEmpty(ywWireTaskLogDTO.getPageSize())) { + + + if (ywWireTaskLogDTO.getPageSize() == -1) { + list = ywWireTaskLogMapper.selectList(lambdaQueryWrapper); + rspData.setTotal(list.size()); + } else { + + if(ObjectUtils.isEmpty(ywWireTaskLogDTO.getPageNum())) + { + ywWireTaskLogDTO.setPageNum(1); + } + + Page page = ywWireTaskLogMapper.selectPage(new Page<>(ywWireTaskLogDTO.getPageNum(), ywWireTaskLogDTO.getPageSize()), lambdaQueryWrapper); + list = page.getRecords(); + rspData.setTotal(page.getTotal()); + } + + // 没有加这个导致前端返回的rows为null + // rspData.setRows(list); + + if (list.size() > 0) { + + List list_wireTaskLogVo = new ArrayList<>(); + + + //导出加字段 + if(ywWireTaskLogDTO.getIsExport()) + { + List lstFC = ywWireTaskLogMapper.getWireTaskFlowContent(); + + for (YwWireTaskLog ywWireTaskLog : list) { + YwWireTaskLogVo ywWireTaskLogVo = new YwWireTaskLogVo(); + BeanUtils.copyBeanProp(ywWireTaskLogVo, ywWireTaskLog); + list_wireTaskLogVo.add(ywWireTaskLogVo); + + if (ObjectUtils.isNotEmpty(ywWireTaskLog.getCreateTime())) { + ywWireTaskLogVo.setStrCreateTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", ywWireTaskLog.getCreateTime())); + } + + if (ObjectUtils.isNotEmpty(ywWireTaskLog.getEndTime())) { + ywWireTaskLogVo.setStrEndTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", ywWireTaskLog.getEndTime())); + } + + List lstFC2 = lstFC.stream().filter(x->x.getFlwId().equals(ywWireTaskLog.getFlwProcessid())).collect(Collectors.toList()); + + //任务子类 + List lstTaskSubType = lstFC2.stream().filter(x->x.getName().equals("select_tasksubtype")).map(FlowContentVo::getText).collect(Collectors.toList()); + + if(!lstTaskSubType.isEmpty()) + { + ywWireTaskLogVo.setTaskSubType(lstTaskSubType.get(0)); + } + + //比赛名称 + List lstScxx = lstFC2.stream().filter(x->x.getName().equals("select_scxx")).map(FlowContentVo::getMatchName).collect(Collectors.toList()); + + if(!lstScxx.isEmpty()) + { + ywWireTaskLogVo.setScxx(lstScxx.get(0)); + } + + //任务描述 + List lstRwms = lstFC2.stream().filter(x->x.getName().equals("textarea_rwms")).map(FlowContentVo::getText).collect(Collectors.toList()); + + if(!lstRwms.isEmpty()) + { + ywWireTaskLogVo.setRwms(lstRwms.get(0)); + } + + if(StringUtils.isEmpty(ywWireTaskLog.getCurStep())) + { + continue; + } + + int taskCode = WireTaskStatus.getCodeByLabel(ywWireTaskLog.getCurStep()); + + if(ywWireTaskLog.getCurStep().contains(",")) + { + taskCode = WireTaskStatus.sgjs.getCode(); + } + +// if(("任务审核").equals(ywWireTaskLog.getCurStep())) +// { +// continue; +// } + + if(taskCode == WireTaskStatus.rwsh.getCode()) + { + continue; + } + + //任务审核结果 + List lstShjg = lstFC2.stream().filter(x->x.getName().equals("radio_shjg2")).map(FlowContentVo::getText).collect(Collectors.toList()); + + if(!lstShjg.isEmpty()) + { + if(lstShjg.get(0).equals("ok")) + { + if(taskCode>WireTaskStatus.rwsh.getCode()) { + ywWireTaskLogVo.setShjg(1); + } + } + else + { + ywWireTaskLogVo.setShjg(0); + } + } + + + //任务审核说明 + List lstShsm = lstFC2.stream().filter(x -> x.getName().equals("textarea_sm3")).map(FlowContentVo::getText).collect(Collectors.toList()); + + if (!lstShsm.isEmpty()) { + ywWireTaskLogVo.setShsm(lstShsm.get(0)); + } + + //图纸说明 + List lstTzsm = lstFC2.stream().filter(x -> x.getName().equals("textarea_tzsm")).map(FlowContentVo::getText).collect(Collectors.toList()); + + if (!lstTzsm.isEmpty()) { + ywWireTaskLogVo.setTzsm(lstTzsm.get(0)); + } + + if(taskCode == WireTaskStatus.tzqr.getCode()) + { + continue; + } + + //图纸确认结果 + List lstTzjg = lstFC2.stream().filter(x -> x.getName().equals("radio_shjg")).map(FlowContentVo::getText).collect(Collectors.toList()); + + if (!lstTzjg.isEmpty()) { + if (lstTzjg.get(0).equals("ok")) { + if(taskCode>WireTaskStatus.tzqr.getCode()) { + ywWireTaskLogVo.setTzjg(1); + } + } else { + ywWireTaskLogVo.setTzjg(0); + } + + + //图纸确认说明 + List lstTzqrsm = lstFC2.stream().filter(x -> x.getName().equals("textarea_sm1")).map(FlowContentVo::getText).collect(Collectors.toList()); + + if (!lstTzqrsm.isEmpty()) { + + ywWireTaskLogVo.setTzqrsm(lstTzqrsm.get(0)); + } + } + + if(taskCode == WireTaskStatus.xcys.getCode()) + { + continue; + } + + //现场验收结果 + List lstYsjg = lstFC2.stream().filter(x -> x.getName().equals("radio_qrjg")).map(FlowContentVo::getText).collect(Collectors.toList()); + + if (!lstYsjg.isEmpty()) { + if (lstYsjg.get(0).equals("ok")) { + if(taskCode == WireTaskStatus.lcjs.getCode()) { + ywWireTaskLogVo.setYsjg(1); + } + } else { + ywWireTaskLogVo.setYsjg(0); + } + } + + //现场验收说明 + List lstYssm = lstFC2.stream().filter(x -> x.getName().equals("textarea_sm2")).map(FlowContentVo::getText).collect(Collectors.toList()); + + if (!lstYssm.isEmpty()) { + ywWireTaskLogVo.setYssm(lstYssm.get(0)); + } + + + } + + } + else { + for (YwWireTaskLog ywWireTaskLog : list) { + YwWireTaskLogVo ywWireTaskLogVo = new YwWireTaskLogVo(); + BeanUtils.copyBeanProp(ywWireTaskLogVo, ywWireTaskLog); + list_wireTaskLogVo.add(ywWireTaskLogVo); + + if (ObjectUtils.isNotEmpty(ywWireTaskLog.getCreateTime())) { + ywWireTaskLogVo.setStrCreateTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", ywWireTaskLog.getCreateTime())); + } + + if (ObjectUtils.isNotEmpty(ywWireTaskLog.getEndTime())) { + ywWireTaskLogVo.setStrEndTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", ywWireTaskLog.getEndTime())); + } + } + } + + if(ywWireTaskLogDTO.getIsApp()) { + //查询工作流,比较是否是当前登录用户的待办 + List processIds = commonService.selectCurrenUserTodoProcessId(null); + if (CollUtil.isNotEmpty(processIds)) { + for (String processId : processIds) { + list_wireTaskLogVo.stream().filter(l -> processId.equals(l.getFlwProcessid())).findAny().ifPresent(a -> { + a.setIsTodo(1); + }); + } + } + } + + + rspData.setRows(list_wireTaskLogVo); + + } + + + } + + return rspData; + } + + + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/yw_alarm_deal_logServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/yw_alarm_deal_logServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..30832184b3524a7430e00117ed3d65b0b1ce5a7a --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/yw_alarm_deal_logServiceImpl.java @@ -0,0 +1,63 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.eastcom_yw.domain.yw_alarm_deal_log; +import com.ruoyi.eastcom_yw.mapper.yw_alarm_deal_logMapper; +import com.ruoyi.eastcom_yw.mapper.yw_alarm_deal_resMapper; +import com.ruoyi.eastcom_yw.service.yw_alarm_deal_logService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Service +public class yw_alarm_deal_logServiceImpl extends ServiceImpl implements yw_alarm_deal_logService { + + + @Autowired + private yw_alarm_deal_resMapper alarm_deal_resMapper; + + @Autowired + private yw_alarm_deal_logMapper alarm_deal_logMapper; + + @Deprecated + private void update_yw_alarm_deal_schedule() { + + //弃用,原来需要做定时器同步工作流的操作用户和状态,现在直接通过关联 + //数据库关联都用v_yw_alarm_deal_log的视图,yw_alarm_deal_log表不再更新deal_user,deal_status,end_time + int res =alarm_deal_resMapper.selectList(null).size(); + + alarm_deal_resMapper.selectList(null).forEach( + + alarm_deal->{ + + yw_alarm_deal_log yw_alarm_deal_log=new yw_alarm_deal_log(); + + yw_alarm_deal_log.setId(alarm_deal.getId()); + + yw_alarm_deal_log.setDealUser(alarm_deal.getAssignee()); + + yw_alarm_deal_log.setDealStatus(alarm_deal.getProcessstatus()); + + yw_alarm_deal_log.setEndTime(alarm_deal.getEndTime()); + + alarm_deal_logMapper.updateById(yw_alarm_deal_log); + + } + ); + } + + @Override + public void updateEndTime() + { + alarm_deal_logMapper.updateEndTime(); + } + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/yw_alarm_deal_resServiceImpl.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/yw_alarm_deal_resServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..60dce5b9d38daa5089db5f3f79dd34bb55894f24 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/impl/yw_alarm_deal_resServiceImpl.java @@ -0,0 +1,20 @@ +package com.ruoyi.eastcom_yw.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.eastcom_yw.domain.yw_alarm_deal_res; +import com.ruoyi.eastcom_yw.mapper.yw_alarm_deal_resMapper; +import com.ruoyi.eastcom_yw.service.yw_alarm_deal_resService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +@Service +public class yw_alarm_deal_resServiceImpl extends ServiceImpl implements yw_alarm_deal_resService { + +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/yw_alarm_deal_logService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/yw_alarm_deal_logService.java new file mode 100644 index 0000000000000000000000000000000000000000..a34a6f6c8c592b4906c9b38408941266c236848b --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/yw_alarm_deal_logService.java @@ -0,0 +1,17 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.yw_alarm_deal_log; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +public interface yw_alarm_deal_logService extends IService { + + public void updateEndTime(); +} diff --git a/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/yw_alarm_deal_resService.java b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/yw_alarm_deal_resService.java new file mode 100644 index 0000000000000000000000000000000000000000..d9415d38d89c4a23a535c1dd04c6224e5aa34416 --- /dev/null +++ b/eastcom_yw/src/main/java/com/ruoyi/eastcom_yw/service/yw_alarm_deal_resService.java @@ -0,0 +1,16 @@ +package com.ruoyi.eastcom_yw.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.eastcom_yw.domain.yw_alarm_deal_res; + +/** + *

+ * 服务类 + *

+ * + * @author jkj + * @since 2023-01-06 + */ +public interface yw_alarm_deal_resService extends IService { + +} diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2AgisLink5miMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2AgisLink5miMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..dcb264712890b6c8bdeffefa838644ba131247a3 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2AgisLink5miMapper.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2MmlListMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2MmlListMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..39995df32c76f0c7f0b79c7c141b3be0e6adef60 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2MmlListMapper.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2PnNetVenue5miMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2PnNetVenue5miMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..61816040d468da29c6dce18183ac2cd026e53be9 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2PnNetVenue5miMapper.xml @@ -0,0 +1,35 @@ + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2SpotCellMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2SpotCellMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..8186585374ad87b0091456099c4e060842197414 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2SpotCellMapper.xml @@ -0,0 +1,16 @@ + + + + + delete from dp_2_spot_cell + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2SpotConfigMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2SpotConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..aeb88d133ed64799fc40c112140c1e176ff59f1d --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2SpotConfigMapper.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2ViewPowerAlarmMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2ViewPowerAlarmMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..eb6bebf7aefdb5fbd36072a0b8ee95d2a8518dd1 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2ViewPowerAlarmMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2ViewWirelessAlarmMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2ViewWirelessAlarmMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..7a771abea5c8e94f7e2af753c3cb21c7cdb8f7b2 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/Dp2ViewWirelessAlarmMapper.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/DpSceneConfigMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/DpSceneConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..d547a4db0386790f0e31d77c22a1d45eaaf496b0 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/DpSceneConfigMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/LargeScreenMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/LargeScreenMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..45a569e9b70bf7142c91004343bd93ced86070c8 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/LargeScreenMapper.xml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi4gCellMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi4gCellMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..dfbed083a4a1bf116a52164c40f2df9198f3638a --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi4gCellMapper.xml @@ -0,0 +1,421 @@ + + + + + + + + + + + + + + update dp_scene_control set mintype = #{mintype},nettype=#{nettype},kpiname = #{kpiname} where id = 1 + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi4gMinMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi4gMinMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..f30bb46c3026b6468835ba263ddf79d2e36e8a1f --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi4gMinMapper.xml @@ -0,0 +1,184 @@ + + + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi4gVenueMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi4gVenueMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..9dbb117b079b73ccbd5528beeedcfc7e5e1b252d --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi4gVenueMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi5gCellMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi5gCellMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..d06216f8cddc101180a4860c231cf282231ccea1 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi5gCellMapper.xml @@ -0,0 +1,397 @@ + + + + + + + + + + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi5gMinMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi5gMinMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..a36e485080f8db84ce06c578dcaabfef33d4a6e8 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi5gMinMapper.xml @@ -0,0 +1,178 @@ + + + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi5gVenueMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi5gVenueMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..02b5c04d77a4e13691714cbc50a53bbd59bb177f --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/PmKpi5gVenueMapper.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/SysNoticeMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/SysNoticeMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..cb9cafd255f3df62be50b3f546fa263d56adb9c7 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/SysNoticeMapper.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + update sys_notice set status='1' + where notice_id in + + #{noticeId} + + + + + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmHangupLogMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmHangupLogMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..b8fe33af1550528fc84046c194c69b8dc907113a --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmHangupLogMapper.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..8bb80835ac5376e3d1af5eeb9f407f4dad38db5a --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmMapper.xml @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + update hm_trans_alarm set 恢复时间 = now()::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where id = #{alarmId} and 恢复时间 is null + + + update hm_dyn_ring_alarm set 恢复时间 = now()::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where id = #{alarmId} and 恢复时间 is null + + + update hm_wireless_alarm set 恢复时间 = now()::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where id = #{alarmId} and 恢复时间 is null + + + update hm_alarm_derive set 恢复时间 = now()::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where id = #{alarmId} and 恢复时间 is null + + + + update hm_agis_alarm set 恢复时间 = now()::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where id = #{alarmId} and 恢复时间 is null + + + + + + + + + + update hm_trans_alarm set 恢复时间 = now() ::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where groupid = #{groupId} and 恢复时间 is null + + + update hm_dyn_ring_alarm set 恢复时间 = now()::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where 关联组号 = #{groupId} and 恢复时间 is null + + + update hm_wireless_alarm set 恢复时间 = now()::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where 关联组号 = #{groupId} and 恢复时间 is null + + + update hm_alarm_derive set 恢复时间 = now()::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where groupid = #{groupId} and 恢复时间 is null + + + + update hm_agis_alarm set 恢复时间 = now()::timestamp(0) without time zone , 修改时间 = now()::timestamp(0) without time zone + where groupid = #{groupId} and 恢复时间 is null + + + + + + + + + + update dx_ag_transmition set closed=1 + where groupid = #{groupId} + + + + update dx_ag_power set closed=1 + where 关联组号 = #{groupId} + + + + update dx_ag_wireless set closed=1 + where 关联组号= #{groupId} + + + + + + + + + update dx_ag_agis set closed=1 + where groupid = #{groupId} + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmStatisticsMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmStatisticsMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..5ad65fcd9cd1c0f992c4b97ed3419a71ef45a231 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmStatisticsMapper.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + insert into public.yw_alarm_statistics(profession, create_time, scene_id, num) + values + + (#{entity.profession}, #{entity.createTime}, #{entity.sceneId}, #{entity.num}) + + + + delete from yw_alarm_statistics + + AND create_time now() + '-2 hour' + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmViewMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmViewMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..3363e7abb849a1855e89ec7440f0ecbb663cf787 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwAlarmViewMapper.xml @@ -0,0 +1,510 @@ + + + + + + + + + and area_county_id like CONCAT('%',cast(#{city} as varchar),'%') + + + + + + + + + + + + + + + + and t_status.alarm_status = #{alarmStatus} and (t_deal.assignee_ != '2' or t_deal.assignee_ is null) + + + + + + + + + and case when t_status is not null then t_status.alarm_status else case when t1.end_time is null then '0' else '1' end end = #{alarmStatus} + and (t_deal.assignee_ != '2' or t_deal.assignee_ is null) + + + + + + + and t1.site_type=#{siteType} + + + + and t2.alarm_level in + + #{alarmLevel} + + + + + and t1.is_red=#{inRedLine} + + + + and sc.area_county_id = #{county} + + + + + and t_status.text_ = #{dealStatus} + + + + + + and (t_status.text_ in ('1','4','5') or t_status.text_ is null) + + + + + + + + and t1.scene_id in + + #{venueId} + + + + + and t1.scene_id in (select scene_id from yw_scene_user where user_id= #{userId}) + + + + + + and t2.start between #{startTime}::TIMESTAMP and #{endTime}::TIMESTAMP + + + + AND concat(t2.name,',',t2.net_name,',',t2.site_name,',',t2.site_id,',',su.nick_name) LIKE CONCAT('%',#{searchBox} :: text,'%') + + + + and sc.venue_type = #{venueType} + + + and sc.maintain_type = #{maintainType} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwConstrucTeamMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwConstrucTeamMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..aeaf6f3f846d401fa433a20e43a913697fa3ed5b --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwConstrucTeamMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwDrsConfigMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwDrsConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..062d37eb35ad4495bc1d4556e652991b3bec58ca --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwDrsConfigMapper.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwDrsTempTaskMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwDrsTempTaskMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..f92ef12f7d64e472b89fb7d4653e6a3a7927e1a4 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwDrsTempTaskMapper.xml @@ -0,0 +1,31 @@ + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwKpiConfigMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwKpiConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..7448cb4530376bde8f0212608dd1f1793b49f085 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwKpiConfigMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeBriefingMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeBriefingMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..2872926879a482cf818b96464c28b0be90cf8e3d --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeBriefingMapper.xml @@ -0,0 +1,41 @@ + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeHandworkMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeHandworkMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..3a8d8e331fdbf1963e42c9249074d02d4c42905e --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeHandworkMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeModelMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeModelMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..cc316ec44744e4f697c141d73d0c3b22b8f3fe45 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeModelMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeObjectMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeObjectMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..4667d6229319d5017565f5beb344a749f8c6a9f3 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeObjectMapper.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeUserMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeUserMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..87e9bb80d9a40f87fbf9c44c39962b6d35356faa --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwNoticeUserMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectConfigMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..24eb1c6dc080fc1baa58dc2c0462e24d78e802b0 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectConfigMapper.xml @@ -0,0 +1,102 @@ + + + + + + + + + SELECT currval(pg_get_serial_sequence('yw_rout_inspect_config','id')) + + insert into yw_rout_inspect_config + + + scene_id, + + + specialty, + + + check_num, + + + check_type, + + + check_desc, + + + circle, + + + stop_time_option, + + + interval_time, + + + scene_big_id, + + + inspect_user_id, + + + rep_warn_interval, + + + notice_type, + + + + + #{sceneId}, + + + #{specialty}, + + + #{checkNum}, + + + #{checkType}, + + + #{checkDesc}, + + + #{circle}, + + + #{stopTimeOption}, + + + #{intervalTime}, + + + #{sceneBigId}, + + + #{inspectUserId}, + + + #{repWarnInterval}, + + + #{noticeType}, + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectLogMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectLogMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..14e84468ded6a1a00de4d90e41929a3a8460c0c2 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectLogMapper.xml @@ -0,0 +1,90 @@ + + + + + + + SELECT currval(pg_get_serial_sequence('yw_rout_inspect_log','id')) + + insert into yw_rout_inspect_log + + + rout_inspect_id, + + + flw_processid, + + + check_num, + + + question_num, + + + question_desc, + + + feed_back_user, + + + feed_back_time, + + + + + #{routInspectId}, + + + #{flwProcessid}, + + + #{checkNum}, + + + #{questionNum}, + + + #{{questionDesc}}, + + + #{feedBackUser}, + + + #{feedBackTime}, + + + + + update yw_rout_inspect_log + + + check_num = #{checkNum}, + + + question_num = #{questionNum}, + + + question_desc = #{questionDesc}, + + + feed_back_user = #{feedBackUser}::numeric, + + + feed_back_time = #{feedBackTime}, + + + where flw_processid = #{flwProcessid} and feed_back_time is null + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectPlanMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectPlanMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..0b6a37a8c0fe48f3983c9c3a8c5affc59bff65b0 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectPlanMapper.xml @@ -0,0 +1,574 @@ + + + + + + + AND POSITION((#{city}) IN (area_county_id)) > 0 + + + AND area_county_id = #{county} + + + AND scene_id IN #{venueId} + + + AND inspect_specialty = #{specialty} + + + AND begin_time between #{beginDate}::TIMESTAMP and #{endDate}::TIMESTAMP + + + and venue_type = #{venueType} + + + and maintain_type = #{maintainType} + + + and scene_id in (SELECT id FROM yw_scene t where t.venue_type='比赛场馆' and match_type is not null and area_county_id like '0571%') + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DELETE FROM yw_rout_inspect_config WHERE scene_id = #{sceneId} AND specialty = #{specialty} + AND id NOT IN #{configId} + + + + delete from yw_rout_inspect_plan where job_no = #{jobNo} + and inspect_specialty not in #{specialty} + + + + + SELECT currval(pg_get_serial_sequence('yw_rout_inspect_plan','id')) + + insert into yw_rout_inspect_plan + + + scene_id, + + + inspect_date, + + + inspect_specialty, + + + begin_time, + + + plan_fin_time, + + + scene_big_id, + + + type, + + + inspect_name, + + + check_num, + + + check_type, + + + check_desc, + + + circle, + + + stop_time_option, + + + interval_time, + + + inspect_user_id, + + + rep_warn_interval, + + + notice_type, + + + job_no, + + + city, + + + county, + + + description, + + + + + #{sceneId}, + + + #{inspectDate, jdbcType=DATE}, + + + #{inspectSpecialty}, + + + #{beginTime}::timestamp, + + + #{planFinTime}::timestamp, + + + #{sceneBigId}, + + + #{type}, + + + #{inspectName}, + + + #{checkNum}, + + + #{checkType}, + + + #{checkDesc}, + + + #{circle}, + + + #{stopTimeOption}, + + + #{intervalTime}, + + + #{inspectUserId}, + + + #{repWarnInterval}, + + + #{noticeType}, + + + #{jobNo}, + + + #{city}, + + + #{county}, + + + #{description}, + + + + + + update yw_rout_inspect_plan + + + scene_id = #{sceneId}, + + + inspect_date = #{inspectDate, jdbcType=DATE}, + + + inspect_specialty = #{inspectSpecialty}, + + + begin_time = #{beginTime}::TIMESTAMP, + + + plan_fin_time = #{planFinTime}::TIMESTAMP, + + + scene_big_id = #{sceneBigId}, + + + type = #{type}, + + + inspect_name = #{inspectName}, + + + check_num = #{checkNum}, + + + check_type = #{checkType}, + + + check_desc = #{checkDesc}, + + + circle = #{circle}, + + + stop_time_option = #{stopTimeOption}, + + + interval_time = #{intervalTime}, + + + inspect_user_id = #{inspectUserId}, + + + rep_warn_interval = #{repWarnInterval}, + + + notice_type = #{noticeType}, + + + description = #{description}, + + + where job_no = #{jobNo} + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectQuestionConfigMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectQuestionConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..651465246cd5b3f0ba23372fd8ccfe673b8d1262 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwRoutInspectQuestionConfigMapper.xml @@ -0,0 +1,77 @@ + + + + + + + + + SELECT currval(pg_get_serial_sequence('yw_rout_inspect_question_config','id')) + + insert into yw_rout_inspect_question_config + + + question_type, + + + question_son_type, + + + scene_big_id, + + + specialty_id, + + + + + #{questionType}, + + + #{questionSonType}, + + + #{sceneBigId}, + + + #{specialtyId}, + + + + + + update yw_rout_inspect_question_config + + + question_type = #{questionType}, + + + question_son_type = #{questionSonType}, + + + scene_big_id = #{sceneBigId}, + + + specialty_id = #{specialtyId}, + + + where id = #{id} + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneAlarmMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneAlarmMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..1d7b5813f90daef7a7e8dfa5422d09ffc1a90f27 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneAlarmMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + SELECT currval(pg_get_serial_sequence('yw_scene_alarm','id')) + + insert into yw_scene_alarm + + + scene_id, + + + alarm_code, + + + alarm_name, + + + blackorwhite, + + + alarm_specity_id, + + + status, + + + + + #{sceneId}, + + + #{alarmCode}, + + + #{alarmName}, + + + #{blackorwhite}, + + + #{alarmSpecityId}, + + + #{status}, + + + + + + update yw_scene_alarm + + + scene_id = #{sceneId}, + + + alarm_code = #{alarmCode}, + + + alarm_name = #{alarmName}, + + + blackorwhite = #{blackorwhite}, + + + alarm_specity_id = #{alarmSpecityId}, + + + status = #{status}, + + + where id = #{id} + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneBigConfigMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneBigConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..b3b83dec6aea11efe6e0eefb0ccb5013b321b5c7 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneBigConfigMapper.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneCalendarMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneCalendarMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..b813662e6f3af0bffc2c3d296fc6a3ee8db7405b --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneCalendarMapper.xml @@ -0,0 +1,194 @@ + + + + + + delete + from yw_scene_calendar + where scene_id in (select id from yw_scene a where a.scene_big_id = #{sceneBigId}) + + + + + + + + + + SELECT currval(pg_get_serial_sequence('yw_scene_calendar','id')) + + insert into yw_scene_calendar + + + scene_id, + + + match_type, + + + match_name, + + + match_remark, + + + begin_time, + + + end_time, + + + match_date, + + + status, + + + + + #{sceneId}, + + + #{matchType}, + + + #{matchName}, + + + #{matchRemark}, + + + #{beginTime}, + + + #{endTime}, + + + #{matchDate}, + + + #{status}, + + + + + insert into yw_scene_calendar (scene_id, match_type, match_name, match_remark, begin_time, end_time, match_date, + status, create_time, create_by) values + + + (#{item.sceneId}, #{item.matchType}, #{item.matchName}, #{item.matchRemark}, #{item.beginTime}::TIME, + #{item.endTime}::TIME, #{item.matchDate}::DATE, #{item.status}, #{item.createTime}::TIMESTAMP, + #{item.createBy}) + + + + + update yw_scene_calendar + + + scene_id = #{sceneId}, + + + match_type = #{matchType}, + + + match_name = #{matchName}, + + + match_remark = #{matchRemark}, + + + begin_time = #{beginTime}, + + + end_time = #{endTime}, + + + match_date = #{matchDate}, + + + status = #{status}, + + + where id = #{id} + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..a18d0165c0dc7892a34f8d9c6790d9361944cfa6 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneMapper.xml @@ -0,0 +1,748 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into yw_scene + + + venue_name, + + + venue_desc, + + + venue_address, + + + area_county_id, + + + latitude, + + + longitude, + + + venue_type, + + + venue_level, + + + acc_person, + + + scene_big_id, + + + sign_scope, + + + status, + + + create_by, + + + create_time, + + + update_by, + + + update_time, + + + venue_shortname, + + + city_id, + + + english_name, + + + english_shortname, + + + maintain_type, + + + longitude_gcj02, + + + latitude_gcj02, + + + match_type, + + + venue_category, + + + + + #{venueName}, + + + #{venueDesc}, + + + #{venueAddress}, + + + #{areaCountyId}, + + + #{latitude}, + + + #{longitude}, + + + #{venueType}, + + + #{venueLevel}, + + + #{accPerson}, + + + #{sceneBigId}, + + + #{signScope}, + + + #{status}, + + + #{createBy}, + + + #{createTime}::TIMESTAMP, + + + #{updateBy}, + + + #{updateTime}::TIMESTAMP, + + + #{venueShortname}, + + + #{cityId}, + + + #{englishName}, + + + #{englishShortname}, + + + #{maintainType}, + + + #{longitudeGcj02}, + + + #{latitudeGcj02}, + + + #{matchType}, + + + #{venueCategory}, + + + + + + update yw_scene + + + venue_name = #{venueName}, + + + venue_desc = #{venueDesc}, + + + venue_address = #{venueAddress}, + + + area_county_id = #{areaCountyId}, + + + latitude = #{latitude}, + + + longitude = #{longitude}, + + + venue_type = #{venueType}, + + + venue_level = #{venueLevel}, + + + acc_person = #{accPerson}, + + + scene_big_id = #{sceneBigId}, + + + sign_scope = #{signScope}, + + + status = #{status}, + + + create_by = #{createBy}, + + + create_time = #{createTime}::TIMESTAMP, + + + update_by = #{updateBy}, + + + update_time = #{updateTime}::TIMESTAMP, + + + venue_shortname = #{venueShortname}, + + + city_id = #{cityId}, + + + english_name = #{englishName}, + + + english_shortname = #{englishShortname}, + + + maintain_type = #{maintainType}, + + + longitude_gcj02 = #{longitudeGcj02}, + + + latitude_gcj02 = #{latitudeGcj02}, + + + match_type = #{matchType}, + + + venue_category = #{venueCategory}, + + + where id = #{id} + + + + + + + + + + + insert into yw_scene_file + + + scene_id, + + + remark, + + + create_by, + + + create_time, + + + update_by, + + + update_time, + + + file_name, + + + file_size, + + + file_url, + + + file_type, + + + file_resolution, + + + + + #{sceneId}, + + + #{remark}, + + + #{createBy}, + + + #{createTime}, + + + #{updateBy}, + + + #{updateTime}, + + + #{fileName}, + + + #{fileSize}, + + + #{fileUrl}, + + + #{fileType}, + + + #{fileResolution}, + + + + + + insert into yw_scene (venue_name, venue_shortname, english_shortname, maintain_type, venue_type, venue_level, + longitude, latitude, longitude_gcj02, latitude_gcj02, city_id, area_county_id, match_type, venue_address, + venue_desc, scene_big_id, create_time, create_by) values + + (#{item.venueName}, #{item.venueShortname}, #{item.englishShortname}, #{item.maintainType}, + #{item.venueType}, #{item.venueLevel}, + #{item.longitude}, #{item.latitude}, #{item.longitudeGcj02}, #{item.latitudeGcj02}, #{item.cityId}, + #{item.areaCountyId}, #{item.matchType}, #{item.venueAddress}, #{item.venueDesc}, #{item.sceneBigId}, now(), + #{item.createBy}) + + + + + update yw_scene_file + + + scene_id = #{sceneId}, + + + remark = #{remark}, + + + create_by = #{createBy}, + + + create_time = #{createTime}, + + + update_by = #{updateBy}, + + + update_time = #{updateTime}, + + + file_name = #{fileName}, + + + file_size = #{fileSize}, + + + file_url = #{fileUrl}, + + + file_type = #{fileType}, + + + file_resolution = #{fileResolution}, + + + where id = #{id} + + + + update yw_scene + + + venue_desc = #{venueDesc}, + + + venue_address = #{venueAddress}, + + + area_county_id = #{areaCountyId}, + + + latitude = #{latitude}, + + + longitude = #{longitude}, + + + venue_type = #{venueType}, + + + venue_level = #{venueLevel}, + + + acc_person = #{accPerson}, + + + scene_big_id = #{sceneBigId}, + + + sign_scope = #{signScope}, + + + status = #{status}, + + + create_by = #{createBy}, + + + create_time = #{createTime}, + + + update_by = #{updateBy}, + + + update_time = #{updateTime}, + + + venue_shortname = #{venueShortname}, + + + city_id = #{cityId}, + + + english_name = #{englishName}, + + + english_shortname = #{englishShortname}, + + + maintain_type = #{maintainType}, + + + longitude_gcj02 = #{longitudeGcj02}, + + + latitude_gcj02 = #{latitudeGcj02}, + + + match_type = #{matchType}, + + + venue_category = #{venueCategory}, + + + where venue_name = #{venueName} + + + + delete from yw_scene_file + where scene_id = #{sceneId} + + and id not in + #{id} + + + + + delete + from yw_scene + where scene_big_id = #{sceneBigId} + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneMatchMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneMatchMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..c5bf01cefa59bf2418d1b8efd34ce9815b0e685e --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneMatchMapper.xml @@ -0,0 +1,30 @@ + + + + + + insert into yw_scene_match (scene_id, task_name, task_status, begin_time, end_time, create_time, create_by, + task_type) values + + (#{it.sceneId}, #{it.taskName}, #{it.taskStatus}, #{it.beginTime}::TIMESTAMP, #{it.endTime}::TIMESTAMP, + #{it.createTime}::TIMESTAMP, #{it.createBy}, #{it.taskType}) + + + + delete + from yw_scene_match + where scene_id in (select id from yw_scene where scene_big_id = #{sceneBigId}) + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementAgisMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementAgisMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..187a8465ff3ead4a6e4c3ff3d9c614cdad82d23f --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementAgisMapper.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + insert into yw_scene_netelement_agis (scene_id, alarm_specity_id, net_element_name, "port_A", "net_element_B", + "port_B", "desc", update_time, update_by,equipment_type,"equipment_type_B") values + + (#{item.sceneId}, #{item.alarmSpecityId}, #{item.netElementName}, #{item.portA}, #{item.netElementB}, + #{item.portB}, #{item.desc}, #{item.updateTime}, #{item.updateBy}, #{item.equipmentType}, #{item.equipmentTypeB}) + + + + + delete + from yw_scene_netelement_agis + where scene_id in (select id from yw_scene a where a.scene_big_id = #{sceneBigId}) + + + + + delete from yw_scene_netelement_agis + + + and scene_id = #{sceneId,jdbcType=NUMERIC} + + + + + update yw_scene_netelement_agis set update_time = now() + where scene_id = #{sceneId} + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementCsMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementCsMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..a0f43c04c6fc1ee600c866da174de5ad2dc9a554 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementCsMapper.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + SELECT currval(pg_get_serial_sequence('yw_scene_netelement_cs','id')) + + insert into yw_scene_netelement_cs + + + scene_id, + + + equipment_type, + + + "net_element_name_A", + + + "port_A", + + + "attribute_A", + + + networking_type, + + + "net_element_Z", + + + "port_Z", + + + "attribute_Z", + + + + + #{sceneId}, + + + #{equipmentType}, + + + #{netElementNameA}, + + + #{portA}, + + + #{attributeA}, + + + #{networkingType}, + + + #{netElementZ}, + + + #{portZ}, + + + #{attributeZ}, + + + + + insert into yw_scene_netelement_cs (scene_id, equipment_type, "net_element_name_A", "port_A", "attribute_A", + networking_type, "net_element_Z", "port_Z", "attribute_Z", update_time, update_by) values + + (#{item.sceneId}, #{item.equipmentType}, #{item.netElementNameA}, #{item.portA}, #{item.attributeA}, + #{item.networkingType}, #{item.netElementZ}, #{item.portZ}, #{item.attributeZ}, #{item.updateTime}, #{item.updateBy}) + + + + update yw_scene_netelement_cs + + equipment_type = #{equipmentType}, + "net_element_name_A" = #{netElementNameA}, + "port_A" = #{portA}, + "attribute_A" = #{attributeA}, + networking_type = #{networkingType}, + "net_element_Z" = #{netElementZ}, + "port_Z" = #{portZ}, + "attribute_Z" = #{attributeZ}, + + where scene_id = #{sceneId} + + + + delete + from yw_scene_netelement_cs + where scene_id in (select id from yw_scene a where a.scene_big_id = #{sceneBigId}) + + + + + + delete from yw_scene_netelement_cs + + + and scene_id = #{sceneId,jdbcType=NUMERIC} + + + + + update yw_scene_netelement_cs set update_time = now() + where scene_id = #{sceneId} + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementDhMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementDhMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..d73e971dd0d35b418795dea195bc6ae75e029013 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementDhMapper.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + SELECT currval(pg_get_serial_sequence('yw_scene_netelement_dh','id')) + + insert into yw_scene_netelement_dh + + + scene_id, + + + in_redline, + + + city, + + + county, + + + net_element_phyname, + + + room_type, + + + + + #{sceneId}, + + + #{inRedline}, + + + #{city}, + + + #{county}, + + + #{netElementPhyname}, + + + #{roomType}, + + + + + insert into yw_scene_netelement_dh (scene_id, in_redline, city, county, net_element_phyname, room_type, update_time, update_by) values + + (#{item.sceneId}, #{item.inRedline}, #{item.city}, #{item.county}, #{item.netElementPhyname}, + #{item.roomType}, #{item.updateTime}, #{item.updateBy}) + + + + update yw_scene_netelement_dh + + + in_redline = #{inRedline}, + + + city = #{city}, + + + county = #{county}, + + + net_element_phyname = #{netElementPhyname}, + + + room_type = #{roomType}, + + + where scene_id = #{sceneId} + + + + delete + from yw_scene_netelement_dh + where scene_id in (select id from yw_scene a where a.scene_big_id = #{sceneBigId}) + + + + + + delete from yw_scene_netelement_dh + + + and scene_id = #{sceneId,jdbcType=NUMERIC} + + + + + update yw_scene_netelement_dh set update_time = now() + where scene_id = #{sceneId} + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..6316813a40d41b98516d9778f06fd08f56e9dac2 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementMapper.xml @@ -0,0 +1,222 @@ + + + + + + + + + + + SELECT currval(pg_get_serial_sequence('yw_scene_netelement','id')) + + insert into yw_scene_netelement + + + scene_id, + + + net_element_name, + + + alarm_specity_id, + + + net_element_code, + + + net_element_lat, + + + net_element_lon, + + + type, + + + status, + + + net_element_phyname, + + + in_redline, + + + blackorwhite, + + + room, + + + port, + + + net_element_cname, + + + ci, + + + + + #{sceneId}, + + + #{netElementName}, + + + #{alarmSpecityId}, + + + #{netElementCode}, + + + #{netElementLat}, + + + #{netElementLon}, + + + #{type}, + + + #{status}, + + + #{netElementPhyname}, + + + #{inRedline}, + + + #{blackorwhite}, + + + #{room}, + + + #{port}, + + + #{netElementCname}, + + + #{ci}, + + + + + + update yw_scene_netelement + + + scene_id = #{sceneId}, + + + net_element_name = #{netElementName}, + + + alarm_specity_id = #{alarmSpecityId}, + + + net_element_code = #{netElementCode}, + + + net_element_lat = #{netElementLat}, + + + net_element_lon = #{netElementLon}, + + + type = #{type}, + + + status = #{status}, + + + net_element_phyname = #{netElementPhyname}, + + + in_redline = #{inRedline}, + + + blackorwhite = #{blackorwhite}, + + + room = #{room}, + + + port = #{port}, + + + net_element_cname = #{netElementCname}, + + + ci = #{ci}, + + + where id = #{id} + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementWxMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementWxMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..f203f91c6ea075c1ed488567c906a8e88c34a06c --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNetelementWxMapper.xml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + SELECT currval(pg_get_serial_sequence('yw_scene_netelement_wx','id')) + + insert into yw_scene_netelement_wx + + + scene_id, + + + in_redline, + + + ci, + + + + + #{sceneId}, + + + #{inRedline}, + + + #{ci}, + + + + + + update yw_scene_netelement_wx + + + in_redline = #{inRedline}, + + + ci = #{ci}, + + + where scene_id = #{sceneId} + + + + delete + from yw_scene_netelement_wx + where scene_id in (select id from yw_scene a where a.scene_big_id = #{sceneBigId}) + + + + + + + + + + + delete from yw_scene_netelement_wx + + + and scene_id = #{sceneId,jdbcType=NUMERIC} + + + + + + insert into yw_scene_netelement_wx(scene_id, + omc, + 县市,enodebid,本地小区标识, + 小区标识,站号,基站全称,场景名称, + en名称,小区名称,小区别名,ci, + in_redline,小区频段,纬度, + 经度,纬度gcj,经度gcj, + 室内室外,网络,现网状态, + cgi,频点,pci, + tac,一级场景,二级场景, + 设备类型,带宽,方位角, + 扇区id,坐席编号,update_by, + update_time,地市,scene_type_code,scene_type,sub_scene_type_code,sub_scene_type,scene_code,cover_sub_scene_code,cover_sub_scene) + values + + (#{item.sceneId,jdbcType=NUMERIC}::bigint, + #{item.omc,jdbcType=VARCHAR}, + #{item.县市,jdbcType=VARCHAR},#{item.enodebid,jdbcType=INTEGER}::bigint,#{item.本地小区标识,jdbcType=INTEGER}::bigint, + #{item.小区标识,jdbcType=INTEGER}::bigint,#{item.站号,jdbcType=INTEGER}::bigint,#{item.基站全称,jdbcType=VARCHAR},#{item.场景名称,jdbcType=VARCHAR}, + #{item.en名称,jdbcType=VARCHAR},#{item.小区名称,jdbcType=VARCHAR},#{item.小区别名,jdbcType=VARCHAR},#{item.ci,jdbcType=VARCHAR}, + #{item.inRedline,jdbcType=VARCHAR},#{item.小区频段,jdbcType=VARCHAR},round(#{item.纬度,jdbcType=DOUBLE}::numeric, + 6), + round(#{item.经度,jdbcType=DOUBLE}::numeric, 6),round(wgs84togcj02(#{item.经度,jdbcType=VARCHAR}::numeric, + #{item.纬度,jdbcType=VARCHAR}::numeric, + 'lat')::numeric, 6),round(wgs84togcj02(#{item.经度,jdbcType=VARCHAR}::numeric, + #{item.纬度,jdbcType=VARCHAR}::numeric, + 'lng')::numeric, 6), + #{item.室内室外,jdbcType=VARCHAR},#{item.网络,jdbcType=VARCHAR},#{item.现网状态,jdbcType=VARCHAR}, + #{item.cgi,jdbcType=VARCHAR},#{item.频点,jdbcType=INTEGER}::bigint,#{item.pci,jdbcType=INTEGER}::bigint, + #{item.tac,jdbcType=INTEGER}::bigint,#{item.一级场景,jdbcType=VARCHAR},#{item.二级场景,jdbcType=VARCHAR}, + #{item.设备类型,jdbcType=VARCHAR},#{item.带宽,jdbcType=INTEGER}::bigint,#{item.方位角,jdbcType=FLOAT}::float, + #{item.扇区id,jdbcType=VARCHAR},#{item.坐席编号,jdbcType=VARCHAR},#{item.updateBy,jdbcType=VARCHAR}, + NOW(),#{item.地市,jdbcType=VARCHAR},#{item.sceneTypeCode,jdbcType=VARCHAR},#{item.sceneType,jdbcType=VARCHAR},#{item.subSceneTypeCode,jdbcType=VARCHAR}, + #{item.subSceneType,jdbcType=VARCHAR},#{item.sceneCode,jdbcType=VARCHAR},#{item.coverSubSceneCode,jdbcType=VARCHAR},#{item.coverSubScene,jdbcType=VARCHAR}) + + + + + update yw_scene_netelement_wx + set update_time = now() + where scene_id = #{sceneId} + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNoticeinfoMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNoticeinfoMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..a87c1b5fa1cf10e0ae5a7260bdab0aaa5b25e27e --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneNoticeinfoMapper.xml @@ -0,0 +1,175 @@ + + + + + + + insert into public.yw_scene_noticeinfo(scene_id, frontuser, backuser, emergencycar, county, public_net_num, + transport_equip_num, interface_ring_num, net_total_num,public_transport_equip_num,public_interface_ring_num, + private_transport_equip_num,private_interface_ring_num,emergency_communication_car,emergency_electric_car, + emergency_repair_car,wifi_spare,dredge_spare,trans_spare, + emergency_warehouse,wx_net_num,agis_net_num,internet_net_num,supportcar,dict_equip_num) + values + + (#{entity.sceneId}, #{entity.frontuser}, #{entity.backuser}, #{entity.emergencycar}, #{entity.county}, + #{entity.publicNetNum}, #{entity.transportEquipNum}, #{entity.interfaceRingNum}, #{entity.netTotalNum}, + #{entity.publicTransportEquipNum}, #{entity.publicInterfaceRingNum}, + #{entity.privateTransportEquipNum}, #{entity.privateInterfaceRingNum}, + #{entity.emergencyCommunicationCar},#{entity.emergencyElectricCar}, + #{entity.emergencyRepairCar},#{entity.wifiSpare},#{entity.dredgeSpare},#{entity.transSpare}, + #{entity.emergencyWarehouse}, + #{entity.wxNetNum},#{entity.agisNetNum},#{entity.internetNetNum},#{entity.supportcar},#{entity.dictEquipNum}) + + + + + delete + from yw_scene_noticeinfo + + + + + + + + insert into yw_scene_noticeinfo + + scene_id, + frontuser, + backuser, + emergencycar, + county, + public_net_num, + transport_equip_num, + interface_ring_num, + net_total_num, + emergency_warehouse, + wx_net_num, + dh_net_num, + agis_net_num, + internet_net_num, + public_transport_equip_num, + public_interface_ring_num, + private_transport_equip_num, + private_interface_ring_num, + supportcar, + dict_equip_num, + emergency_communication_car, + emergency_electric_car, + emergency_repair_car, + wifi_spare, + dredge_spare, + trans_spare, + public_power_equip, + private_power_equip + + values + + #{sceneId,jdbcType=NUMERIC}, + #{frontuser,jdbcType=NUMERIC}, + #{backuser,jdbcType=NUMERIC}, + #{emergencycar,jdbcType=NUMERIC}, + #{county,jdbcType=VARCHAR}, + #{publicNetNum,jdbcType=NUMERIC}, + #{transportEquipNum,jdbcType=NUMERIC}, + #{interfaceRingNum,jdbcType=NUMERIC}, + #{netTotalNum,jdbcType=NUMERIC}, + #{emergencyWarehouse,jdbcType=NUMERIC}, + #{wxNetNum,jdbcType=NUMERIC}, + #{dhNetNum,jdbcType=NUMERIC}, + #{agisNetNum,jdbcType=NUMERIC}, + #{internetNetNum,jdbcType=NUMERIC}, + #{publicTransportEquipNum,jdbcType=NUMERIC}, + #{publicInterfaceRingNum,jdbcType=NUMERIC}, + #{privateTransportEquipNum,jdbcType=NUMERIC}, + #{privateInterfaceRingNum,jdbcType=NUMERIC}, + #{supportcar,jdbcType=NUMERIC}, + #{dictEquipNum,jdbcType=NUMERIC}, + #{emergencyCommunicationCar,jdbcType=NUMERIC}, + #{emergencyElectricCar,jdbcType=NUMERIC}, + #{emergencyRepairCar,jdbcType=NUMERIC}, + #{wifiSpare,jdbcType=NUMERIC}, + #{dredgeSpare,jdbcType=NUMERIC}, + #{transSpare,jdbcType=NUMERIC}, + #{publicPowerEquip,jdbcType=NUMERIC}, + #{privatePowerEquip,jdbcType=NUMERIC} + + + + + update yw_scene_noticeinfo + set frontuser = #{frontuser,jdbcType=NUMERIC}, + backuser = #{backuser,jdbcType=NUMERIC}, + emergencycar = #{emergencycar,jdbcType=NUMERIC}, + county = #{county,jdbcType=VARCHAR}, + public_net_num = #{publicNetNum,jdbcType=NUMERIC}, + transport_equip_num = #{transportEquipNum,jdbcType=NUMERIC}, + interface_ring_num = #{interfaceRingNum,jdbcType=NUMERIC}, + net_total_num = #{netTotalNum,jdbcType=NUMERIC}, + emergency_warehouse = #{emergencyWarehouse,jdbcType=NUMERIC}, + wx_net_num = #{wxNetNum,jdbcType=NUMERIC}, + dh_net_num = #{dhNetNum,jdbcType=NUMERIC}, + agis_net_num = #{agisNetNum,jdbcType=NUMERIC}, + internet_net_num = #{internetNetNum,jdbcType=NUMERIC}, + public_transport_equip_num = #{publicTransportEquipNum,jdbcType=NUMERIC}, + + public_interface_ring_num = #{publicInterfaceRingNum,jdbcType=NUMERIC}, + + private_transport_equip_num = #{privateTransportEquipNum,jdbcType=NUMERIC}, + + private_interface_ring_num = #{privateInterfaceRingNum,jdbcType=NUMERIC}, + + supportcar = #{supportcar,jdbcType=NUMERIC}, + + dict_equip_num = #{dictEquipNum,jdbcType=NUMERIC}, + + emergency_communication_car = #{emergencyCommunicationCar,jdbcType=NUMERIC}, + emergency_electric_car = #{emergencyElectricCar,jdbcType=NUMERIC}, + emergency_repair_car = #{emergencyRepairCar,jdbcType=NUMERIC}, + wifi_spare = #{wifiSpare,jdbcType=NUMERIC}, + dredge_spare = #{dredgeSpare,jdbcType=NUMERIC}, + trans_spare = #{transSpare,jdbcType=NUMERIC}, + public_power_equip = #{publicPowerEquip,jdbcType=NUMERIC}, + private_power_equip = #{privatePowerEquip,jdbcType=NUMERIC} + + where scene_id = #{sceneId,jdbcType=NUMERIC} + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwScenePictureMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwScenePictureMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..97da30b642a0a4fff3aa1ed16482788c855a9098 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwScenePictureMapper.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneTestDataInterfaceMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneTestDataInterfaceMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..f408440f05542491c233d092c4a07d1410d25bf5 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneTestDataInterfaceMapper.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneTestDataMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneTestDataMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..540ee7a869189f161384330ffe6c68b9180a7833 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneTestDataMapper.xml @@ -0,0 +1,32 @@ + + + + + + + insert into public.yw_scene_test_data(bzname, scenename, deviceoid, connectdelay, dlspeed, lat, lng, + pagecomplete, ulspeed, update_time, nettype, scene_id) + values + + (#{entity.bzname}, #{entity.scenename}, #{entity.deviceoid}, #{entity.connectdelay}, #{entity.dlspeed}, + #{entity.lat}, #{entity.lng}, #{entity.pagecomplete}, #{entity.ulspeed}, #{entity.updateTime}, + #{entity.nettype}, #{entity.sceneId}) + + + + + delete + from yw_scene_test_data + where 1 = 1 + + + + delete from yw_scene_test_data where scene_id in ( + + #{entity} + + ) + + + + diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneUserMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneUserMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..55164cbef06ba26c927f49910c90b66d2cb7cefd --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSceneUserMapper.xml @@ -0,0 +1,225 @@ + + + + + + delete + from yw_scene_user + where scene_id in (select id from yw_scene where scene_big_id = #{sceneBigId}) + + + + delete + from yw_scene_user + where user_id = #{userId,jdbcType=NUMERIC} + and scene_id in (select id from yw_scene where scene_big_id = #{sceneBigId,jdbcType=NUMERIC}) + + + + + + + + + SELECT currval(pg_get_serial_sequence('yw_scene_user','id')) + + insert into yw_scene_user + + + scene_id, + + + user_id, + + update_time, + update_by, + create_time, + create_by, + + + + #{sceneId}, + + + #{userId}, + + #{updateTime}, + #{updateBy}, + #{createTime}, + #{createBy}, + + on conflict (scene_id, user_id) do nothing + + + insert into yw_scene_user (scene_id, user_id, create_time, create_by) values + + (#{item.sceneId}, #{item.userId}, #{item.createTime}::TIMESTAMP, + #{item.createBy}) + + + + + update yw_scene_user + + + scene_id = #{sceneId}, + + + user_id = #{userId}, + + + belong_area = #{belongArea}, + + + need_sign = #{needSign}, + + + where id = #{id} + + + + update yw_scene_user + + update_time = #{updateTime}, + update_by = #{updateBy}, + + where user_id = #{userId} and scene_id = #{sceneId} + + + + + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSignLogMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSignLogMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..f62d41aeaeb47f1b90bac20739910ed253fd79af --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSignLogMapper.xml @@ -0,0 +1,89 @@ + + + + + + update yw_sign_log set is_dai_sign=#{userId}, sign_time=to_timestamp(#{signTime}, 'yyyy-mm-dd HH24:mi:ss') + where sign_time is null and sign_type=#{signType} + and user_id in + ( + + + + #{user} + + + + select user_id from yw_scene_user t1 + where t1.scene_id=#{venueId} and exists (select 1 from sys_user t2 where t1.user_id=t2.user_id + + and user_type in + + #{userType} + + + ) + + + ) + + + and sign_plan_id = #{signPlanId} + + + and sign_plan_id in (select id from yw_sign_plan where sign_date=#{signTime} and scene_id=#{venueId}) + + + + + + update yw_sign_log set sign_time=to_timestamp(#{ywSignLog.signTime}, 'yyyy-mm-dd HH24:mi:ss'), + sign_j = cast(#{ywSignLog.signJ} as float8), + sign_w = cast(#{ywSignLog.signW} as float8) + where sign_time is null and sign_type =cast( #{ywSignLog.signType} as int2 ) + and user_id =#{ywSignLog.userId} + + + and sign_plan_id = #{ywSignLog.signPlanId} + + + and sign_plan_id in (select id from yw_sign_plan where sign_date=#{ywSignLog.signTime} and scene_id=#{sceneId}) + + + + + + insert into yw_sign_log(sign_plan_id,user_id,belong_area,sign_type) + select sign_plan_id,user_id,belong_area,0 from v_yw_sign_log_handle t1 + where sign_date=CURRENT_DATE + and begin_time is not null and user_id is not null and now() >= gen_time + union + select sign_plan_id,user_id,belong_area,1 from v_yw_sign_log_handle t1 + where sign_date=CURRENT_DATE + and end_time is not null and user_id is not null and now() >= gen_time + + + + delete from yw_sign_log where sign_plan_id=#{id} + + + + delete from yw_sign_log t3 where + not exists (select 1 + from yw_sign_plan t1 left join yw_scene_user t2 on t1.scene_id = t2.scene_id + where t3.sign_plan_id=t1.id and t3.user_id=t2.user_id) and sign_plan_id=#{id} + + + + delete from yw_sign_log t3 where + not exists (select 1 + from yw_sign_plan t1 left join yw_scene_user t2 on t1.scene_id = t2.scene_id + where t3.sign_plan_id=t1.id and t3.user_id=t2.user_id) + and sign_plan_id in (select id from yw_sign_plan ysp where ysp.sign_date = CURRENT_DATE) + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSignLogViewMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSignLogViewMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..2c1fcb8f2497c2cf5f5f7887c13336f1c74f6202 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSignLogViewMapper.xml @@ -0,0 +1,286 @@ + + + + + + + + + and area_county_id like CONCAT('%',cast(#{city} as varchar),'%') + + + and area_county_id = #{county} + + + and scene_id in + + #{venueId} + + + + and user_type = #{userType} + + + and sign_status = #{signStatus} + + + + and venue_type = #{venueType} + + + + and maintain_type = #{maintainType} + + + + and begin_time between #{startDate}::TIMESTAMP and #{endDate}::TIMESTAMP + + + + and scene_id in (SELECT id FROM yw_scene t where t.venue_type='比赛场馆' and match_type is not null and area_county_id like '0571%') + + + + + + + + and now()>gen_time + + + and now()>begin_time + + + + + + + + + + and now()>begin_time + concat('-', rep_sign_interval::text, ' hour')::interval + + + and now()>begin_time + + + + + + + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSignPlanMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSignPlanMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..6984676dbab0efdbb4d1cf1d5d4d6db06143953a --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSignPlanMapper.xml @@ -0,0 +1,115 @@ + + + + + + + + + + and t1.id in + + #{venueId} + + + + + and scene_id in + + #{venueId} + + + + + and sign_date in + + to_date(#{arrSignDate}, 'yyyy-mm-dd') + + + + + insert into yw_sign_plan(scene_id,sign_date, + begin_time, + end_time, + rep_warn_interval, + notice_type, + create_by, + sign_num, + + rep_sign_interval, + create_time, + update_time, + is_open, + sign_users + ) + + select id,to_date(#{arrSignDate}, 'yyyy-mm-dd'), + to_timestamp(#{arrSignDate}||' '||#{beginTime}, 'yyyy-mm-dd HH24:mi:ss'), + to_timestamp(#{arrSignDate}||' '||#{endTime}, 'yyyy-mm-dd HH24:mi:ss'), + #{repWarnInterval}, + #{noticeType}, + #{createBy}, + #{signNum}, + + #{repSignInterval}, + now(), + now(), + '1', + + + #{signUsers} + + + ysu.sign_users + + + from yw_scene t1 + LEFT JOIN ( SELECT yw_scene_user.scene_id, + string_agg(yw_scene_user.user_id::character varying::text, ','::text) AS sign_users + FROM yw_scene_user + GROUP BY yw_scene_user.scene_id) ysu ON ysu.scene_id = t1.id + where not exists (select 1 from yw_sign_plan t2 where t1.id=t2.scene_id and t2.sign_date=to_date(#{arrSignDate}, 'yyyy-mm-dd') + and (to_timestamp(#{arrSignDate}||' '||#{beginTime}, 'yyyy-mm-dd HH24:mi:ss') between begin_time and end_time or begin_time between to_timestamp(#{arrSignDate}||' '||#{beginTime}, 'yyyy-mm-dd HH24:mi:ss') and to_timestamp(#{arrSignDate}||' '||#{endTime}, 'yyyy-mm-dd HH24:mi:ss') + or to_timestamp(#{arrSignDate}||' '||#{endTime}, 'yyyy-mm-dd HH24:mi:ss') between begin_time and end_time)) + + + + + + update yw_sign_plan + + sign_date = #{signDate}::DATE, + begin_time=to_timestamp(to_char(sign_date,'yyyy-mm-dd')||' '||#{beginTime}::text, 'yyyy-mm-dd HH24:mi:ss'), + end_time=to_timestamp(to_char(sign_date,'yyyy-mm-dd')||' '||#{endTime}::text, 'yyyy-mm-dd HH24:mi:ss'), + rep_warn_interval=#{repWarnInterval}, + notice_type=#{noticeType}, + is_open=#{isOpen}, + sign_num=#{signNum} + sign_users=#{signUsers}, + rep_sign_interval=#{repSignInterval}, + update_by = #{updateBy}, + update_time = now() + + where id = #{id} + + + + delete from yw_sign_plan where id=#{id} + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSparePartsMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSparePartsMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..6309aa282623c5781b0aef3928d66b993ac4212e --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwSparePartsMapper.xml @@ -0,0 +1,21 @@ + + + + + insert into yw_spare_parts (venue_name, venue_type, device_type, board_model, current_num, board_num, + part_model, need_num, configure_num, gap_num, major, comment, contacts, telephone, + create_by, create_time) values + + (#{item.venueName}, #{item.venueType}, #{item.deviceType}, #{item.boardModel}, + #{item.currentNum}, #{item.boardNum}, + #{item.partModel}, #{item.needNum}, #{item.configureNum}, #{item.gapNum}, #{item.major}, + #{item.comment}, #{item.contacts}, #{item.telephone}, #{item.createBy}, #{item.createTime}) + + + + truncate table yw_spare_parts + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwWireTaskLogMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwWireTaskLogMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..7af6472163a47d6d40dd9ea615008f205f7d50db --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/YwWireTaskLogMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + insert into yw_wire_task_log( + + flw_processid, + + + wire_task_name, + + + construc_unit, + + create_by,create_time,wire_task_id,task_type,venue_id) + values( + + #{flwProcessid}, + + + #{wireTaskName}, + + + #{construcUnit}, + + #{createBy}, + + + to_timestamp(#{createTime}, 'yyyy-mm-dd HH24:mi:ss'), + + + now(), + + + #{wireTaskId},#{taskType},#{venueId}) + + + + update yw_wire_task_log set flw_processid=#{flwProcessid} + where wire_task_id=#{wireTaskId} and task_type=#{taskType} + + + + update yw_wire_task_log set report=#{report} + where wire_task_id=#{wireTaskId} and task_type=#{taskType} + + + + delete from yw_wire_task_log + where wire_task_id=#{wireTaskId} + + and task_type=#{taskType} + + + + + + \ No newline at end of file diff --git a/eastcom_yw/src/main/resources/mapper/eastcom_yw/yw_alarm_deal_logMapper.xml b/eastcom_yw/src/main/resources/mapper/eastcom_yw/yw_alarm_deal_logMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..82e4f78a3e8762af17aa506774c21c4c76798970 --- /dev/null +++ b/eastcom_yw/src/main/resources/mapper/eastcom_yw/yw_alarm_deal_logMapper.xml @@ -0,0 +1,18 @@ + + + + + + + update yw_alarm_deal_log set hangup_timespan=COALESCE(hangup_timespan,0) + #{minute} where flw_processid = #{processId} + + + + + update yw_alarm_deal_log set end_time = getalarmclear(group_id,alarm_type) + where end_time is null + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..617e54d6bb24b361c186934507dd795fb6e44fc4 --- /dev/null +++ b/pom.xml @@ -0,0 +1,339 @@ + + + 4.0.0 + + com.ruoyi + ruoyi + 3.8.4 + + ruoyi + http://www.ruoyi.vip + 若依管理系统 + + + 3.8.4 + UTF-8 + UTF-8 + 1.8 + true + 3.1.1 + 1.2.15 + 1.21 + 3.0.0 + 2.3.3 + + 1.4.5 + 2.0.20 + 6.3.2 + 2.11.0 + 1.4 + 3.2.2 + 1.6 + 4.1.2 + 2.3 + 0.9.1 + 1.18.20 + 3.5.1 + 3.3.1 + 5.8.0 + 1.1.3 + 1.3.1.Final + 3.1.2 + 3.21.3 + + + + + + + + + org.springframework.boot + spring-boot-dependencies + 2.5.14 + pom + import + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + eu.bitwalker + UserAgentUtils + ${bitwalker.version} + + + + + + + + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatis-plus.vesion} + + + + com.baomidou + mybatis-plus-generator + ${mybatis-plus.vesion} + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + ${pagehelper.boot.version} + + + + + com.github.oshi + oshi-core + ${oshi.version} + + + + + io.springfox + springfox-boot-starter + ${swagger.version} + + + io.swagger + swagger-models + + + + + + + + + org.projectlombok + lombok + ${lombok.version} + + + + + commons-io + commons-io + ${commons.io.version} + + + + + commons-fileupload + commons-fileupload + ${commons.fileupload.version} + + + + + org.apache.poi + poi-ooxml + ${poi.version} + + + + + + + org.apache.velocity + velocity-engine-core + ${velocity.version} + + + + + commons-collections + commons-collections + ${commons.collections.version} + + + + + + + com.alibaba.fastjson2 + fastjson2 + ${fastjson.version} + + + + + io.jsonwebtoken + jjwt + ${jwt.version} + + + + + pro.fessional + kaptcha + ${kaptcha.version} + + + + + com.ruoyi + ruoyi-quartz + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-generator + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-framework + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-system + ${ruoyi.version} + + + + + + com.ruoyi + ruoyi-common + ${ruoyi.version} + + + + + com.ruoyi + eastcom_yw + ${ruoyi.version} + + + + com.ruoyi + ruoyi-sunlm + ${ruoyi.version} + + + + com.ruoyi + cmcc_gm + ${ruoyi.version} + + + + cn.hutool + hutool-all + ${hutool-all.version} + + + + + org.gavaghan + geodesy + ${geodesy.version} + + + + org.apache.commons + commons-text + ${commons-text.version} + + + + + org.springframework.boot + spring-boot-starter-actuator + ${actuator.version} + + + + org.redisson + redisson + ${redisson.version} + + + + + + + ruoyi-admin + ruoyi-app + ruoyi-framework + ruoyi-system + ruoyi-quartz + ruoyi-generator + eastcom_yw + ruoyi-sunlm + ruoyi-common + cmcc_gm + + pom + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + ${java.version} + ${java.version} + ${project.build.sourceEncoding} + + + + + + + + public + aliyun nexus + https://maven.aliyun.com/repository/public + + true + + + + + + + public + aliyun nexus + https://maven.aliyun.com/repository/public + + true + + + false + + + + + \ No newline at end of file diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..5d57404ee0892542307a03307698ec1251c75a8d --- /dev/null +++ b/ruoyi-admin/pom.xml @@ -0,0 +1,140 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + 4.0.0 + jar + ruoyi-admin + + + web服务入口 + + + + + + + org.springframework.boot + spring-boot-devtools + true + + + + + io.springfox + springfox-boot-starter + + + + + io.swagger + swagger-models + 1.6.2 + + + + + + + + + + org.postgresql + postgresql + + + + com.ruoyi + ruoyi-framework + + + + + com.ruoyi + ruoyi-quartz + + + + com.ruoyi + eastcom_yw + + + + + com.ruoyi + ruoyi-generator + + + + junit + junit + 4.13.2 + test + + + org.springframework + spring-test + 5.3.23 + test + + + org.springframework.boot + spring-boot-test + 2.7.5 + test + + + com.ruoyi + ruoyi-sunlm + + + + com.ruoyi + cmcc_gm + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.1.1.RELEASE + + true + + + + + repackage + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + false + ${project.artifactId} + + + + + + ${project.artifactId} + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..b7dc11b815ead26af748d51be51b0413072a3224 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -0,0 +1,42 @@ +package com.ruoyi; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.web.client.RestTemplate; + +/** + * 启动程序 + * + * @author ruoyi + */ +@EnableTransactionManagement +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) +public class RuoYiApplication +{ + + @Bean + public RestTemplate restTemplate(RestTemplateBuilder builder) { + return builder.build(); + } + + public static void main(String[] args) + { + // System.setProperty("spring.devtools.restart.enabled", "false"); + SpringApplication.run(RuoYiApplication.class, args); + System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + + " .-------. ____ __ \n" + + " | _ _ \\ \\ \\ / / \n" + + " | ( ' ) | \\ _. / ' \n" + + " |(_ o _) / _( )_ .' \n" + + " | (_,_).' __ ___(_ o _)' \n" + + " | |\\ \\ | || |(_,_)' \n" + + " | | \\ `' /| `-' / \n" + + " | | \\ / \\ / \n" + + " ''-' `'-' `-..-' "); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java new file mode 100644 index 0000000000000000000000000000000000000000..6de67dc76ba298f6754543d61cc16735d5bef29a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiServletInitializer.java @@ -0,0 +1,18 @@ +package com.ruoyi; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * web容器中进行部署 + * + * @author ruoyi + */ +public class RuoYiServletInitializer extends SpringBootServletInitializer +{ + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) + { + return application.sources(RuoYiApplication.class); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsClassesController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsClassesController.java new file mode 100644 index 0000000000000000000000000000000000000000..0199461bc861f047efc521ef8e2d749369d4f086 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsClassesController.java @@ -0,0 +1,197 @@ +package com.ruoyi.web.controller.cmcc_gm; + + +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.domain.YwMaterialsClasses; +import com.ruoyi.cmcc_gm.domain.dto.YmMaterialsClassesParam; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsStockImportDTO; +import com.ruoyi.cmcc_gm.service.YwMaterialsClassesService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.reflect.ReflectUtils; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignPlanDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.Serializable; +import java.util.List; + +/** + * (YwMaterialsClasses)表控制层 + * + * @author lee + * @since 2023-04-19 10:15:59 + */ +@Api(tags = "物资类别") +@RestController +@RequestMapping("/eastcom_yw/ywMaterialsClasses") +public class YwMaterialsClassesController extends BaseController { + + /** + * 服务对象 + */ + @Resource + private YwMaterialsClassesService ywMaterialsClassesService; + + /** + * 分页查询所有数据 + * + * @param ywMaterialsClasses 查询实体 + * @return 所有数据 + */ + @ApiOperation(value = "分页查询", notes = "分页查询") + @PostMapping("/list") + public TableDataInfo selectAll(@RequestBody YmMaterialsClassesParam ywMaterialsClasses) { + PageUtils.startPage(ywMaterialsClasses, YmMaterialsClassesParam.class); + return getDataTable(ywMaterialsClassesService.getMaterialsBySearch(ywMaterialsClasses)); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @ApiOperation(value = "根据id查询", notes = "根据id查询") + @GetMapping("{id}") + public AjaxResult selectOne(@PathVariable Serializable id) { + return AjaxResult.success(this.ywMaterialsClassesService.getById(id)); + } + + /** + * 新增数据 + * + * @param ywMaterialsClasses 实体对象 + * @return 新增结果 + */ + @Log(title = "新增物资的大小类", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增", notes = "新增") + @PostMapping + public AjaxResult insert(@RequestBody YwMaterialsClasses ywMaterialsClasses) { + // 校验 + if (StringUtils.isEmpty(ywMaterialsClasses.getBigClass()) || + StringUtils.isEmpty(ywMaterialsClasses.getSmallClass())) { + throw new ServiceException("参数校验不通过"); + } + YmMaterialsClassesParam ymMaterialsClassesParam = new YmMaterialsClassesParam(); + List materialsBySearch = ywMaterialsClassesService.getMaterialsBySearch(ymMaterialsClassesParam); + for (YwMaterialsClasses bySearch : materialsBySearch) { + if (ywMaterialsClasses.getBigClass().equals(bySearch.getBigClass()) && + ywMaterialsClasses.getSmallClass().equals(bySearch.getSmallClass())) { + throw new ServiceException("大类+小类组合已存在"); + } + } + boolean res = this.ywMaterialsClassesService.save(ywMaterialsClasses); + if (res) { + ywMaterialsClassesService.loadingMaterialsClassesCache(); + } + return AjaxResult.success(res); + } + + /** + * 修改数据 + * + * @param ywMaterialsClasses 实体对象 + * @return 修改结果 + */ + @Log(title = "修改物资的大小类", businessType = BusinessType.UPDATE) + @ApiOperation(value = "修改", notes = "修改") + @PutMapping + public AjaxResult update(@RequestBody YwMaterialsClasses ywMaterialsClasses) { + + // 校验 + if (StringUtils.isEmpty(ywMaterialsClasses.getBigClass()) || + StringUtils.isEmpty(ywMaterialsClasses.getSmallClass())) { + throw new ServiceException("参数校验不通过"); + } + YwMaterialsClasses byId = ywMaterialsClassesService.getById(ywMaterialsClasses.getId()); + if (ObjectUtils.isEmpty(byId)) { + throw new ServiceException("id不存在"); + } + YmMaterialsClassesParam ymMaterialsClassesParam = new YmMaterialsClassesParam(); + List materialsBySearch = ywMaterialsClassesService.getMaterialsBySearch(ymMaterialsClassesParam); + for (YwMaterialsClasses bySearch : materialsBySearch) { + if (ywMaterialsClasses.getBigClass().equals(bySearch.getBigClass()) && + ywMaterialsClasses.getSmallClass().equals(bySearch.getSmallClass()) && + !byId.getBigClass().equals(bySearch.getBigClass()) && + !byId.getSmallClass().equals(bySearch.getSmallClass())) { + throw new ServiceException("大类+小类组合已存在"); + } + } + + boolean b = ywMaterialsClassesService.checkClassesInUse(byId); + if (b) { + throw new ServiceException("不允许修改已在使用中的大类+小类组合"); + } + + boolean res = this.ywMaterialsClassesService.updateById(ywMaterialsClasses); + if (res) { + ywMaterialsClassesService.loadingMaterialsClassesCache(); + } + return AjaxResult.success(res); + + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @Log(title = "删除物资的大小类", businessType = BusinessType.DELETE) + @ApiOperation(value = "删除", notes = "删除") + @DeleteMapping + public AjaxResult delete(@RequestParam("idList") List idList) { + for (Long aLong : idList) { + YwMaterialsClasses byId = ywMaterialsClassesService.getById(aLong); + if (ObjectUtils.isEmpty(byId)) { + throw new ServiceException("id不存在"); + } else { + boolean b = ywMaterialsClassesService.checkClassesInUse(byId); + if (b) { + throw new ServiceException("不允许删除已在使用中的大类+小类组合"); + } + } + } + boolean res = this.ywMaterialsClassesService.removeByIds(idList); + if (res) { + ywMaterialsClassesService.loadingMaterialsClassesCache(); + } + return AjaxResult.success(this.ywMaterialsClassesService.removeByIds(idList)); + } + + + @Log(title = "物资大小类导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, YmMaterialsClassesParam ywMaterialsClasses) throws IllegalAccessException { + List list= ywMaterialsClassesService.getMaterialsBySearch(ywMaterialsClasses); + ExcelUtil util = new ExcelUtil(YwMaterialsClasses.class); + util.hideColumn("reason"); + util.exportExcel(response, list, "物资大小类数据"); + } + + @Log(title = "物资大小类导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, Boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(YwMaterialsClasses.class); + List lstClasses = util.importExcel(file.getInputStream()); + return ywMaterialsClassesService.importMaterialsClasses(lstClasses,updateSupport); + + } + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsController.java new file mode 100644 index 0000000000000000000000000000000000000000..20f790b2fe46aa761c50bd01077a09ff094123f8 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsController.java @@ -0,0 +1,967 @@ +package com.ruoyi.web.controller.cmcc_gm; + + +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.common.enums.OrderStatus; +import com.ruoyi.cmcc_gm.common.enums.OrderType; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.ruoyi.cmcc_gm.domain.dto.*; +import com.ruoyi.cmcc_gm.domain.qo.YwMaterialsSnListQO; +import com.ruoyi.cmcc_gm.domain.vo.MaterialsXlsToJsonArrayVo; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsExportVo; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformRedisVo; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsVo; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsBatchMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsOrderLogMapper; +import com.ruoyi.cmcc_gm.service.*; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.dto.HandleDataDTO; +import com.ruoyi.common.core.domain.dto.StartProcessInstanceDTO; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.service.CommonService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 物资工单日志表 前端控制器 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@RestController +@RequestMapping("/cmcc_gm/ywMaterials") +public class YwMaterialsController extends BaseController { + + @Autowired + private YwMaterialsStockService ywMaterialsStockService; + + @Autowired + private YwMaterialsInformService ywMaterialsInformService; + + @Autowired + private YwMaterialsOrderLogService ywMaterialsOrderLogService; + + @Autowired + private YwMaterialsClassesService ywMaterialsClassesService; + + @Autowired + private YwMaterialsBatchService ywMaterialsBatchService; + + @Autowired + private YwMaterialsBatchMapper ywMaterialsBatchMapper; + + @Autowired + private YwMaterialsOrderLogMapper ywMaterialsOrderLogMapper; + + @Autowired + private YwMaterialsSnListService ywMaterialsSnListService; + + @Autowired + private CommonService commonService; + + + @ApiOperation("根据条件查询仓库的物资库存数据") + @PostMapping("/stock/list") + public TableDataInfo list(@RequestBody YwMaterialsSearchDTO ywMaterialsSearchDTO) throws Exception { + String pageNum = ServletUtils.getParameter("pageNum"); + String pageSize = ServletUtils.getParameter("pageSize"); + if (!StringUtils.isEmpty(pageNum) && !StringUtils.isEmpty(pageSize)) { + startPage(); + } + return getDataTable(ywMaterialsStockService.getMaterialsStock(ywMaterialsSearchDTO)); + } + + @ApiOperation("根据条件查询仓库的物资出入库明细记录数据") + @PostMapping("/stock/detail") + public TableDataInfo materialNumlist(@RequestBody YwMaterialsSearchDTO ywMaterialsSearchDTO) throws Exception { + if (ObjectUtils.isEmpty(ywMaterialsSearchDTO.getStoreId())) { + throw new ServiceException("请选择仓库名称"); + } + + if (ObjectUtils.isEmpty(ywMaterialsSearchDTO.getMaterialCode())) { + throw new ServiceException("请选择物资编码"); + } + + String pageNum = ServletUtils.getParameter("pageNum"); + String pageSize = ServletUtils.getParameter("pageSize"); + if (!StringUtils.isEmpty(pageNum) && !StringUtils.isEmpty(pageSize)) { + startPage(); + } + + return getDataTable(ywMaterialsOrderLogMapper.selectOrderMaterialsNumLog(ywMaterialsSearchDTO.getStoreId(),ywMaterialsSearchDTO.getMaterialCode())); + } + + /** + * 导出 + * + * @param ywMaterialsSearchDTO 查询参数 + * @param httpServletResponse response + * @throws Exception 异常 + */ + @ApiOperation("根据条件导出仓库的物资库存数据") + @PostMapping("/stock/export") + public void export(@RequestBody YwMaterialsSearchDTO ywMaterialsSearchDTO, HttpServletResponse httpServletResponse) throws Exception { +// if (ObjectUtils.isEmpty(ywMaterialsSearchDTO.getStoreId())) { +// throw new ServiceException("请选择仓库名称"); +// } + ywMaterialsSearchDTO.setPageNum(1); + ywMaterialsSearchDTO.setPageSize(Integer.MAX_VALUE); + List materialsStock = ywMaterialsStockService.getMaterialsStock(ywMaterialsSearchDTO); + List list = new ArrayList<>(); + for (YwMaterialsVo ywMaterialsVo : materialsStock) { + YwMaterialsExportVo vo = new YwMaterialsExportVo(); + BeanUtils.copyBeanProp(vo, ywMaterialsVo); + vo.setStoreSum(vo.getAvailSum() + vo.getOutWaySum() + vo.getInWaySum()); + list.add(vo); + } + ExcelUtil util = new ExcelUtil<>(YwMaterialsExportVo.class); + util.exportExcel(httpServletResponse, list, "数据"); + } + + @Log(title = "更新物资库存信息数据", businessType = BusinessType.UPDATE) + @ApiOperation("更新物资库存信息数据") + @PostMapping("/stock/update") + @Transactional + public AjaxResult updateStock(@RequestBody YwMaterialsDTO ywMaterialsDTO) throws Exception { + + + Boolean res = true; + + if (ObjectUtils.isEmpty(ywMaterialsDTO.getOpType())) { + throw new ServiceException("操作类型不能为空"); + } + + if (ObjectUtils.isEmpty(ywMaterialsDTO.getOrderType())) { + throw new ServiceException("物资工单类型不能为空"); + } + +// 验证当前用户的角色是否具有操作权限 + List roles = SecurityUtils.getLoginUser().getUser().getRoles(); + + List filterRoles = null; + + boolean needCheck = false; + + if (ywMaterialsDTO.getOpType().equals("提交申请")) { + + if (ywMaterialsDTO.getOrderType().equals(OrderType.ZXK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragechecker")).collect(Collectors.toList()); + } + + if (ywMaterialsDTO.getOrderType().equals(OrderType.SL.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.TK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragechecker") || e.getRoleKey().equals("venuemanager")).collect(Collectors.toList()); + } + + if (ywMaterialsDTO.getOrderType().equals(OrderType.CK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.RK.getCode())) { + + filterRoles = new ArrayList<>(); + } + + if (ywMaterialsDTO.getOrderType().equals(OrderType.DB.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragemaster")).collect(Collectors.toList()); + } + + //管理员可以提交申请 + if(filterRoles!=null) { + if (filterRoles.isEmpty()) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("admin")).collect(Collectors.toList()); + } + } + + //20230815 出入库不需要验证角色 + if (ywMaterialsDTO.getOrderType().equals(OrderType.CK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.RK.getCode())) { +// filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("builder")).collect(Collectors.toList()); + + } + else + { + needCheck = true; + } + + } + + if (ywMaterialsDTO.getOpType().equals("审核任务")) { + + if (ywMaterialsDTO.getOrderType().equals(OrderType.ZXK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.SL.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.TK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragemaster")).collect(Collectors.toList()); + } + + + if (ywMaterialsDTO.getOrderType().equals(OrderType.CK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.RK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.DB.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragemaster")).collect(Collectors.toList()); + } + needCheck = true; + } + + if (ywMaterialsDTO.getOpType().equals("出库确认") || ywMaterialsDTO.getOpType().equals("入库确认")) { + + if (!ywMaterialsDTO.getOrderType().equals(OrderType.ZXK.getCode())) { +// 默认都是场馆物资仓库管理员出入库确认 + //物资退库,是中心库物资维护员角色提交入库 + if (ywMaterialsDTO.getOpType().equals("入库确认")) { + if (ywMaterialsDTO.getOrderType().equals(OrderType.TK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragechecker")).collect(Collectors.toList()); + } else { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragekeeper")).collect(Collectors.toList()); + } + } else { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragekeeper")).collect(Collectors.toList()); + } + } + needCheck = true; + } + + if (needCheck) { + if(filterRoles!=null) { + if (filterRoles.isEmpty()) { + throw new ServiceException("当前用户没有操作的权限"); + } + } + } + + //创建时如果不是中心库,折旧入库 的需要冻结库存 + if (ywMaterialsDTO.getOpType().equals("创建")) { + + + YwMaterialsOrderLog ywMaterialsOrderLog = ywMaterialsStockService.Validate(ywMaterialsDTO); + + //待申请的才可以创建 + if (!OrderStatus.DSQ.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前物资订单状态不允许该操作"); + } + + if (!(ywMaterialsDTO.getOrderType() == OrderType.ZXK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.RK.getCode())) { + +// //正向,冻结操作放在了批量表的插入 +// if(StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) +// { +// res = ywMaterialsStockService.freezeOutWayMaterialsStock(ywMaterialsDTO, ywMaterialsOrderLog); +// } + + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + res = ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsDTO, ywMaterialsOrderLog); + } + } + } + + } + + if (ywMaterialsDTO.getOpType().equals("撤销")) { + + YwMaterialsOrderLog ywMaterialsOrderLog = ywMaterialsStockService.Validate(ywMaterialsDTO); + + if (!OrderStatus.DSQ.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前物资订单状态不允许该操作"); + } + + res = ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsDTO, ywMaterialsOrderLog); + + if (res) { + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsOrderLog.getOrderId()); + orderDto.setOrderType(ywMaterialsOrderLog.getOrderType()); + orderDto.setTaskStatus(OrderStatus.CX.getCode()); + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + + } + + if (res) { + return AjaxResult.success("撤销物资订单成功"); + } + + return AjaxResult.error("撤销物资订单失败"); + + } + + if (ywMaterialsDTO.getOpType().equals("驳回") || ywMaterialsDTO.getOpType().equals("提交申请")) { + + YwMaterialsOrderLog ywMaterialsOrderLog = ywMaterialsStockService.Validate(ywMaterialsDTO); + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + + orderDto.setOrderId(ywMaterialsOrderLog.getOrderId()); + orderDto.setOrderType(ywMaterialsOrderLog.getOrderType()); + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + + if (ywMaterialsDTO.getOpType().equals("驳回")) { + + if (!OrderStatus.DSH.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前物资订单不是待审核状态,无法驳回"); + } + + //驳回后释放库存 + boolean resBack = ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsDTO, ywMaterialsOrderLog); + + if (!resBack) { + throw new ServiceException("释放库存异常,驳回失败了,不用走工作流"); + } + + orderDto.setTaskStatus(OrderStatus.DSQ.getCode()); + } + + if (ywMaterialsDTO.getOpType().equals("提交申请")) { + + if (!OrderStatus.DSQ.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前物资订单不是待申请状态,无法提交申请"); + } + + orderDto.setTaskStatus(OrderStatus.DSH.getCode()); + } + + } + + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + + if (ywMaterialsDTO.getIsBack().equals("是")) { + + if (ywMaterialsDTO.getOpType().equals("驳回")) { + + if (!OrderStatus.DSQ.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前物资订单不是待申请状态,无法回滚到待审核"); + } + + //工作流驳回失败了,重新冻结上去 + boolean resBack = ywMaterialsStockService.freezeOutWayMaterialsStock(ywMaterialsDTO, ywMaterialsOrderLog); + + if (!resBack) { + throw new ServiceException("回滚驳回库存异常,需要人工处理"); + } + + if (ywMaterialsDTO.getIsBack().equals("是")) { + orderDto.setTaskStatus(OrderStatus.DSH.getCode()); + } + } + + if (ywMaterialsDTO.getOpType().equals("提交申请")) { + + if (!OrderStatus.DSH.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前物资订单不是待审核状态,无法回滚到待申请"); + } + + if (ywMaterialsDTO.getIsBack().equals("是")) { + orderDto.setTaskStatus(OrderStatus.DSQ.getCode()); + } + + } + + } + + + + } + + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + +// if(!res) +// { +// //回滚释放库存的操作 +// throw new ServiceException("修改为待审核异常,驳回失败了"); +// } + + } + + //中心库审核任务通过就入库确认 + if (ywMaterialsDTO.getOpType().equals("审核任务")) { + if (ywMaterialsDTO.getOrderType() == OrderType.ZXK.getCode()) { + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + res = ywMaterialsStockService.updateMaterialsStockBack(ywMaterialsDTO); + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + res = ywMaterialsStockService.updateMaterialsStock(ywMaterialsDTO); + } + } else { + + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + if(ywMaterialsDTO.getOrderType() == OrderType.SL.getCode() || ywMaterialsDTO.getOrderType() == OrderType.RK.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStockBack(ywMaterialsDTO); + } + + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsDTO.getOrderId()); + orderDto.setOrderType(ywMaterialsDTO.getOrderType()); + orderDto.setTaskStatus(OrderStatus.DSH.getCode()); + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + } + + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { +// 申领和入库在审核环节释放库存 + if(ywMaterialsDTO.getOrderType() == OrderType.SL.getCode() || ywMaterialsDTO.getOrderType() == OrderType.RK.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStock(ywMaterialsDTO); + } + + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + + orderDto.setOrderId(ywMaterialsDTO.getOrderId()); + orderDto.setOrderType(ywMaterialsDTO.getOrderType()); + orderDto.setTaskStatus(OrderStatus.YSH.getCode()); + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + } + + + + + } + + } + } + + if (ywMaterialsDTO.getOpType().equals("出库确认")) { + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStockBack(ywMaterialsDTO); + } + else + { + return AjaxResult.error("当前步骤和任务状态不同步"); + } + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + // 退库,出库和调拨在出库确认环节释放库存 + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStock(ywMaterialsDTO); + } + else + { + return AjaxResult.error("当前步骤和任务状态不同步"); + } + } + + } + + if (ywMaterialsDTO.getOpType().equals("入库确认")) { + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + res = ywMaterialsStockService.updateMaterialsStockBack(ywMaterialsDTO); + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + res = ywMaterialsStockService.updateMaterialsStock(ywMaterialsDTO); + } + } + + if (res) { + return AjaxResult.success("更新物资库存成功"); + } + + return AjaxResult.error("更新物资库存失败"); + + } + + + @Log(title = "更新物资库存信息数据", businessType = BusinessType.UPDATE) + @ApiOperation("更新物资库存信息数据,未完成") + @PostMapping("/stock/updateNew") + @Transactional + public AjaxResult updateStockNew(@RequestBody YwMaterialsDTO ywMaterialsDTO, YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) throws Exception { + + + Boolean res = true; + + if (ObjectUtils.isEmpty(ywMaterialsDTO.getOpType())) { + throw new ServiceException("操作类型不能为空"); + } + + if (ObjectUtils.isEmpty(ywMaterialsDTO.getOrderType())) { + throw new ServiceException("物资工单类型不能为空"); + } + + //1.验证请求用户的权限 +// 验证当前用户的角色是否具有操作权限 + List roles = SecurityUtils.getLoginUser().getUser().getRoles(); + + List filterRoles = null; + + boolean needCheck = false; + + if (ywMaterialsDTO.getOpType().equals("创建") || ywMaterialsDTO.getOpType().equals("提交申请")) { + + if (ywMaterialsDTO.getOrderType().equals(OrderType.ZXK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragechecker")).collect(Collectors.toList()); + } + + if (ywMaterialsDTO.getOrderType().equals(OrderType.SL.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.TK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragechecker") || e.getRoleKey().equals("venuemanager")).collect(Collectors.toList()); + } + + if (ywMaterialsDTO.getOrderType().equals(OrderType.CK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.RK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("builder")).collect(Collectors.toList()); + } + + if (ywMaterialsDTO.getOrderType().equals(OrderType.DB.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragemaster")).collect(Collectors.toList()); + } + needCheck = true; + + } + + if (ywMaterialsDTO.getOpType().equals("审核任务")) { + + if (ywMaterialsDTO.getOrderType().equals(OrderType.ZXK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.SL.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.TK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragemaster")).collect(Collectors.toList()); + } + + + if (ywMaterialsDTO.getOrderType().equals(OrderType.CK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.RK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.DB.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragemaster")).collect(Collectors.toList()); + } + needCheck = true; + } + + if (ywMaterialsDTO.getOpType().equals("出库确认") || ywMaterialsDTO.getOpType().equals("入库确认")) { + + if (!ywMaterialsDTO.getOrderType().equals(OrderType.ZXK.getCode())) { +// 默认都是场馆物资仓库管理员出入库确认 + //物资退库,是中心库物资维护员角色提交入库 + if (ywMaterialsDTO.getOpType().equals("入库确认")) { + if (ywMaterialsDTO.getOrderType().equals(OrderType.TK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragechecker")).collect(Collectors.toList()); + } else { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragekeeper")).collect(Collectors.toList()); + } + } else { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragekeeper")).collect(Collectors.toList()); + } + } + needCheck = true; + } + + + if (needCheck) { + if(filterRoles!=null) { + if (filterRoles.isEmpty()) { + throw new ServiceException("当前用户没有操作的权限"); + } + } + } + + //2.物资订单表的操作 + //创建时如果不是中心库,折旧入库 的需要冻结库存 + if (ywMaterialsDTO.getOpType().equals("创建")) { + + try { + + //新增物资订单,返回orderID + //根据这个ID,回填工作流的ID + String orderId = ywMaterialsOrderLogService.insertMaterialsOrderLog(ywMaterialsOrderLogDTO); + + ywMaterialsOrderLogDTO.setOrderId(orderId); + + StartProcessInstanceDTO dto = new StartProcessInstanceDTO(); + //返回工作流ID + String flwId = commonService.StartProcess(dto); + + ywMaterialsOrderLogDTO.setFlwProcessid(flwId); + + //回填工作流ID + ywMaterialsOrderLogService.updateMaterialsOrderLog(ywMaterialsOrderLogDTO); + + } catch (Exception ex) { + throw new ServiceException(ex.getMessage()); + } + + } + + if (ywMaterialsDTO.getOpType().equals("撤销")) { + + YwMaterialsOrderLog ywMaterialsOrderLog = ywMaterialsStockService.Validate(ywMaterialsDTO); + + if (!OrderStatus.DSQ.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前物资订单状态不允许该操作"); + } + + res = ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsDTO, ywMaterialsOrderLog); + + if (res) { + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsOrderLog.getOrderId()); + orderDto.setOrderType(ywMaterialsOrderLog.getOrderType()); + orderDto.setTaskStatus(OrderStatus.CX.getCode()); + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + + } + + if (res) { + return AjaxResult.success("撤销物资订单成功"); + } + + return AjaxResult.error("撤销物资订单失败"); + + } + + if (ywMaterialsDTO.getOpType().equals("驳回") || ywMaterialsDTO.getOpType().equals("提交申请")) { + + YwMaterialsOrderLog ywMaterialsOrderLog = ywMaterialsStockService.Validate(ywMaterialsDTO); + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + + orderDto.setOrderId(ywMaterialsOrderLog.getOrderId()); + orderDto.setOrderType(ywMaterialsOrderLog.getOrderType()); + + if (ywMaterialsDTO.getOpType().equals("驳回")) { + + if (!OrderStatus.DSH.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前物资订单不是待审核状态,无法驳回"); + } + + //驳回后释放库存 + boolean resBack = ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsDTO, ywMaterialsOrderLog); + + if (!resBack) { + throw new ServiceException("释放库存异常,驳回失败了,不用走工作流"); + } + + orderDto.setTaskStatus(OrderStatus.DSQ.getCode()); + } + + if (ywMaterialsDTO.getOpType().equals("提交申请")) { + + if (!OrderStatus.DSQ.getCode().equals(ywMaterialsOrderLog.getTaskStatus())) { + throw new ServiceException("当前物资订单不是待申请状态,无法提交申请"); + } + + orderDto.setTaskStatus(OrderStatus.DSH.getCode()); + } + + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + + + } + + //中心库审核任务通过就入库确认 + if (ywMaterialsDTO.getOpType().equals("审核任务")) { + if (ywMaterialsDTO.getOrderType() == OrderType.ZXK.getCode()) { + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + res = ywMaterialsStockService.updateMaterialsStockBack(ywMaterialsDTO); + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + res = ywMaterialsStockService.updateMaterialsStock(ywMaterialsDTO); + } + } else { + + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + if(ywMaterialsDTO.getOrderType() == OrderType.SL.getCode() || ywMaterialsDTO.getOrderType() == OrderType.RK.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStockBack(ywMaterialsDTO); + } + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { +// 申领和入库在审核环节释放库存 + if(ywMaterialsDTO.getOrderType() == OrderType.SL.getCode() || ywMaterialsDTO.getOrderType() == OrderType.RK.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStock(ywMaterialsDTO); + } + + } + + } + } + + if (ywMaterialsDTO.getOpType().equals("出库确认")) { + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStock(ywMaterialsDTO); + } + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + res = ywMaterialsStockService.updateInWayMaterialsStock(ywMaterialsDTO); + // 退库,出库和调拨在出库确认环节释放库存 + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStock(ywMaterialsDTO); + } + } + + } + + if (ywMaterialsDTO.getOpType().equals("入库确认")) { + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + res = ywMaterialsStockService.updateMaterialsStockBack(ywMaterialsDTO); + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + res = ywMaterialsStockService.updateMaterialsStock(ywMaterialsDTO); + } + } + + if (ywMaterialsDTO.getOpType().equals("驳回")) { + + try { + + HandleDataDTO dto = new HandleDataDTO(); + } catch (Exception ex) { + throw new ServiceException(ex.getMessage()); + } + + } else { + try { + + HandleDataDTO dto = new HandleDataDTO(); + res = commonService.agreeTask(dto); + if (!res) { + throw new Exception("workspace/process/start请求返回错误"); + } + } catch (Exception ex) { + throw new ServiceException(ex.getMessage()); + } + + } + + + if (res) { + return AjaxResult.success("更新物资库存成功"); + } + + return AjaxResult.error("更新物资库存失败"); + + } + + + @ApiOperation("根据条件查询仓库的物资信息数据") + @PostMapping("/info/list") + public TableDataInfo info(@RequestBody YwMaterialsSearchDTO ywMaterialsSearchDTO) throws Exception { + String pageNum = ServletUtils.getParameter("pageNum"); + String pageSize = ServletUtils.getParameter("pageSize"); + if (!StringUtils.isEmpty(pageNum) && !StringUtils.isEmpty(pageSize)) { + startPage(); + } + return getDataTable(ywMaterialsInformService.selectMaterials(ywMaterialsSearchDTO)); + } + + @ApiOperation("获取所有物资信息数据") + @GetMapping("/info/list") + public AjaxResult InfoAll() throws Exception { + List list = ywMaterialsInformService.getMaterials(); + if (ObjectUtils.isNotEmpty(list)) { + return AjaxResult.success("获取物资信息数据成功", list); + } + return AjaxResult.error("获取物资信息数据失败"); + } + + + @Log(title = "新增物资信息数据", businessType = BusinessType.INSERT) + @ApiOperation("新增物资信息数据") + @PostMapping("/info/insert") + public AjaxResult insertInfo(@RequestBody YwMaterialsInformDTO ywMaterialsInformDTO) { + + Boolean res = ywMaterialsInformService.insertMaterials(ywMaterialsInformDTO); + if (res) { + return AjaxResult.success("新增物资信息数据成功"); + } + return AjaxResult.error("新增物资信息数据失败"); + + } + + @Log(title = "修改物资信息数据", businessType = BusinessType.UPDATE) + @ApiOperation("修改物资信息数据") + @PostMapping("/info/update") + public AjaxResult updateInfo(@RequestBody YwMaterialsInformDTO ywMaterialsInformDTO) { + Boolean res = ywMaterialsInformService.updateMaterials(ywMaterialsInformDTO); + if (res) { + return AjaxResult.success("修改物资信息数据成功"); + } + return AjaxResult.error("修改物资信息数据失败"); + + } + + + @ApiOperation("查询所有大小类") + @GetMapping("/classes/list") + public AjaxResult list() throws Exception { + + Map map = ywMaterialsClassesService.GetMaterialsClasses(); + if (ObjectUtils.isNotEmpty(map)) { + return AjaxResult.success("获取大小类数据成功", map); + } + + return AjaxResult.error("获取大小类数据失败"); + } + + @Log(title = "新增申领数据", businessType = BusinessType.INSERT) + @ApiOperation("新增申领数据") + @PostMapping("/batch/insert") + public AjaxResult insertBatch(@RequestBody YwMaterialsBatchDTO ywMaterialsBatchDTO) { + + boolean res = ywMaterialsBatchService.insertBatch(ywMaterialsBatchDTO); + + if (res) { + return AjaxResult.success("新增申领数据成功"); + } + return AjaxResult.error("新增申领数据失败"); + + } + + @Log(title = "修改申领数据", businessType = BusinessType.UPDATE) + @ApiOperation("修改申领数据") + @PostMapping("/batch/update") + public AjaxResult updateBatch(@RequestBody YwMaterialsBatch ywMaterialsBatch) { + + boolean res = ywMaterialsBatchService.updateBatch(ywMaterialsBatch); + + if (res) { + return AjaxResult.success("修改申领数据成功"); + } + + return AjaxResult.error("修改申领数据失败"); + + } + + @Log(title = "删除申领数据", businessType = BusinessType.DELETE) + @ApiOperation("删除申领数据") + @PostMapping("/batch/delete") + public AjaxResult deleteBatch(@RequestBody YwMaterialsBatchDTO ywMaterialsBatchDTO) { + + boolean res = ywMaterialsBatchService.deleteBatch(ywMaterialsBatchDTO); + + if (res) { + return AjaxResult.success("删除申领数据成功"); + } + + return AjaxResult.error("删除申领数据失败"); + } + + @ApiOperation("查询物资申领数据") + @PostMapping("/batch/list") + public TableDataInfo getBatch(@RequestBody YwMaterialsBatchDTO ywMaterialsBatchDTO) { + String pageNum = ServletUtils.getParameter("pageNum"); + String pageSize = ServletUtils.getParameter("pageSize"); + if (!StringUtils.isEmpty(pageNum) && !StringUtils.isEmpty(pageSize)) { + startPage(); + } + return getDataTable(ywMaterialsBatchMapper.selectBatch(ywMaterialsBatchDTO.getOrderId())); + } + + @Log(title = "新增物资串码数据", businessType = BusinessType.INSERT) + @ApiOperation("新增物资串码数据") + @PostMapping("/snList/insert") + public AjaxResult insertBatch(@RequestBody YwMaterialsSnListDTO ywMaterialsSnListDTO) { + + + List roles = SecurityUtils.getLoginUser().getUser().getRoles(); + + List filterRoles = roles.stream().filter(e -> "venuestoragekeeper".equals(e.getRoleKey()) || "centerstoragechecker".equals(e.getRoleKey())).collect(Collectors.toList()); + + if(filterRoles!=null) { + if (filterRoles.isEmpty()) { + return AjaxResult.error("当前用户没有操作的权限"); + } + } + + boolean res = ywMaterialsSnListService.insertSnList(ywMaterialsSnListDTO); + + if (res) { + return AjaxResult.success("新增串码数据成功"); + } + return AjaxResult.error("新增串码数据失败"); + + + } + + @ApiOperation("查询物资串码数据") + @PostMapping("/snList/list") + public TableDataInfo getSnList(@RequestBody YwMaterialsSnListQO ywMaterialsSnListQO) { + String pageNum = ServletUtils.getParameter("pageNum"); + String pageSize = ServletUtils.getParameter("pageSize"); + if (!StringUtils.isEmpty(pageNum) && !StringUtils.isEmpty(pageSize)) { + startPage(); + } + return getDataTable(ywMaterialsSnListService.selectSnList(ywMaterialsSnListQO)); + } + + @ApiOperation("excel转JSON数组") + @PostMapping("/transformMaterialsXlsToJsonArray") + public AjaxResult transformMaterialsXlsToJsonArray(@RequestPart("file") MultipartFile file, @RequestParam("materialStoreId") Long material_store_id) throws Exception { + ExcelUtil util = new ExcelUtil<>(MaterialsXlsToJsonArrayVo.class); + List xls = util.importExcel(file.getInputStream()); + return ywMaterialsStockService.importXlsReturnList(xls, material_store_id); + } + + @ApiOperation("JSON数组转excel") + @PostMapping("/transformJsonArrayToMaterialsXls") + public void transformJsonArrayToMaterialsXls(@RequestBody TransformJsonArrayToMaterialsXlsDTO arrayVos, HttpServletResponse response) { + if (ObjectUtils.isEmpty(arrayVos)) { + throw new ServiceException("参数校验不通过"); + } + ExcelUtil util = new ExcelUtil<>(MaterialsXlsToJsonArrayVo.class); + if (5 == arrayVos.getTaskType() || 3 == arrayVos.getTaskType()) { + util.hideColumn("id", "reason", "outSum", "inSum", "operation", "availSum"); + } else { + util.hideColumn("id", "reason", "outSum", "inSum", "operation"); + } + List data = arrayVos.getData(); + util.exportExcel(response, data, "数据"); + } + + + + + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsInformController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsInformController.java new file mode 100644 index 0000000000000000000000000000000000000000..15976f69ec6dbd96626a2b7c4903ec21f1a30e4f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsInformController.java @@ -0,0 +1,234 @@ +package com.ruoyi.web.controller.cmcc_gm; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.service.YwMaterialsInformService; +import com.ruoyi.cmcc_gm.service.YwMaterialsStockService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.Serializable; +import java.util.List; + +/** + * 物资信息表(YwMaterialsInform)表控制层 + * + * @author lee + * @since 2023-04-14 16:35:17 + */ +@Api("物料信息") +@RestController +@RequestMapping("/eastcom_yw/ywMaterialsInform") +public class YwMaterialsInformController extends BaseController { + + /** + * 服务对象 + */ + @Resource + private YwMaterialsInformService ywMaterialsInformService; + + @Resource + private YwMaterialsStockService ywMaterialsStockService; + + + /** + * 分页查询所有数据 + * + * @param ywMaterialsInform 查询实体 + * @return 所有数据 + */ + @ApiOperation("分页查询") + @PostMapping("/list") + public TableDataInfo selectAll(@RequestBody YwMaterialsSearchDTO ywMaterialsInform) { + PageUtils.startPage(ywMaterialsInform, YwMaterialsSearchDTO.class); + return getDataTable(ywMaterialsInformService.getMaterialsBySearch(ywMaterialsInform)); + } + + /** + * 导出 + * + * @param ywMaterialsInform + */ + @ApiOperation("导出") + @PostMapping("/export") + public void exportRd(@RequestBody YwMaterialsSearchDTO ywMaterialsInform, HttpServletResponse response) { + ywMaterialsInform.setPageNum(1); + ywMaterialsInform.setPageSize(Integer.MAX_VALUE); + List list = ywMaterialsInformService.getMaterialsBySearch(ywMaterialsInform); + ExcelUtil util = new ExcelUtil<>(YwMaterialsInform.class); + util.hideColumn("sum", "reason", "rowId", "special", "detail"); + util.exportExcel(response, list, "物资配置信息"); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @ApiOperation("根据id查询") + @GetMapping("{id}") + public AjaxResult selectOne(@PathVariable Serializable id) { + return AjaxResult.success(this.ywMaterialsInformService.getById(id)); + } + + /** + * 新增数据 + * + * @param ywMaterialsInform 实体对象 + * @return 新增结果 + */ + @Log(title = "新增物资信息", businessType = BusinessType.INSERT) + @ApiOperation("插入") + @PostMapping + public AjaxResult insert(@RequestBody YwMaterialsInform ywMaterialsInform) { + //检查物资编号是否已经存在 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(YwMaterialsInform::getMaterialCode, ywMaterialsInform.getMaterialCode()); + + YwMaterialsInform inform = ywMaterialsInformService.getOne(query); + + if (ObjectUtils.isNotEmpty(inform)) { + throw new ServiceException("物资编号已存在"); + } + + //检查物资名称+规格型号是否存在 + query = new LambdaQueryWrapper<>(); + query.eq(YwMaterialsInform::getMaterialName, ywMaterialsInform.getMaterialName()) + .eq(YwMaterialsInform::getMaterialStand, ywMaterialsInform.getMaterialStand()); + YwMaterialsInform one = ywMaterialsInformService.getOne(query); + if (ObjectUtils.isNotEmpty(one)) { + throw new ServiceException("物资名称+规格型号已存在"); + } + + boolean res = this.ywMaterialsInformService.save(ywMaterialsInform); + if (res) { + ywMaterialsInformService.loadingMaterialsInfoCache(); + } + return AjaxResult.success(res); + } + + /** + * 修改数据 + * + * @param ywMaterialsInform 实体对象 + * @return 修改结果 + */ + @Log(title = "修改物资信息", businessType = BusinessType.UPDATE) + @ApiOperation("更新") + @PutMapping + public AjaxResult update(@RequestBody YwMaterialsInform ywMaterialsInform) { + + if (ObjectUtils.isEmpty(ywMaterialsInform.getMaterialCode()) || + ObjectUtils.isEmpty(ywMaterialsInform.getMaterialName()) || + ObjectUtils.isEmpty(ywMaterialsInform.getMaterialStand()) || + ObjectUtils.isEmpty(ywMaterialsInform.getMaterialBigClass()) || + ObjectUtils.isEmpty(ywMaterialsInform.getMaterialSmallClass()) || + ObjectUtils.isEmpty(ywMaterialsInform.getSnCode()) || + ObjectUtils.isEmpty(ywMaterialsInform.getMaterialUnit())) { + throw new ServiceException("参数校验不通过"); + } + + YwMaterialsSearchDTO searchDTO = new YwMaterialsSearchDTO(); + searchDTO.setMaterialName(ywMaterialsInform.getMaterialName()); + searchDTO.setMaterialStand(ywMaterialsInform.getMaterialStand()); + List materialsBySearch = ywMaterialsInformService.getMaterialsBySearch(searchDTO); + if (CollectionUtils.isNotEmpty(materialsBySearch)) { + for (YwMaterialsInform bySearch : materialsBySearch) { + if (!bySearch.getMaterialCode().equals(ywMaterialsInform.getMaterialCode())) { + throw new ServiceException("“物资名称+规格型号”已存在"); + } + } + } + + boolean res = this.ywMaterialsInformService.updateById(ywMaterialsInform); + if (res) { + ywMaterialsInformService.loadingMaterialsInfoCache(); + } + return AjaxResult.success(); + + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @Log(title = "删除物资信息", businessType = BusinessType.DELETE) + @ApiOperation("删除") + @DeleteMapping + public AjaxResult delete(@RequestParam("idList") List idList) { + if (ObjectUtils.isEmpty(idList) || idList.size() == 0) { + throw new ServiceException("参数校验不通过"); + } + YwMaterialsInform byId = ywMaterialsInformService.getById(idList.get(0)); + if (ObjectUtils.isEmpty(byId)) { + throw new ServiceException("id不存在"); + } + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwMaterialsStock::getMaterialCode, byId.getMaterialCode()); + YwMaterialsStock one = ywMaterialsStockService.getOne(queryWrapper, false); + if (ObjectUtils.isNotEmpty(one)) { + throw new ServiceException("无法删除已存在于物资库中的物资"); + } + + boolean res = this.ywMaterialsInformService.removeById(idList.get(0)); + if (res) { + ywMaterialsInformService.loadingMaterialsInfoCache(); + } + return AjaxResult.success(); + } + + /** + * 导入 + * + * @param file excel + * @return + * @throws Exception + */ + @Log(title = "导入物资信息", businessType = BusinessType.IMPORT) + @ApiOperation("导入") + @PostMapping("/import") + + public AjaxResult doImport(@RequestPart(name = "file") MultipartFile file,String importType) throws Exception { + + boolean delNoUse = false; + //20230808增加覆盖导入,原来是只有追加 + //覆盖导入先把物资信息中库存表不存在的物资删除掉 + if(StringUtils.isNotEmpty(importType)) + { + if("0".equals(importType)) + { + //删除多余的物资数据 +// ywMaterialsInformService.deleteNotExistsMaterials(); + delNoUse = true; + } + } + ExcelUtil util = new ExcelUtil<>(YwMaterialsInform.class); + util.hideColumn("sum"); + List informs = util.importExcel(file.getInputStream()); + return ywMaterialsInformService.doImport(informs,delNoUse); + } + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsOrderLogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsOrderLogController.java new file mode 100644 index 0000000000000000000000000000000000000000..839b995149bd1f35d07ba8cd123b1a700fd46109 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsOrderLogController.java @@ -0,0 +1,238 @@ +package com.ruoyi.web.controller.cmcc_gm; + + +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.common.enums.OrderType; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsOrderLogDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsOrderLogVo; +import com.ruoyi.cmcc_gm.service.YwMaterialsOrderLogService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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; + +import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 物资工单日志表 前端控制器 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@RestController +@RequestMapping("/cmcc_gm/ywMaterialsOrderLog") +public class YwMaterialsOrderLogController extends BaseController { + + @Autowired + private YwMaterialsOrderLogService ywMaterialsOrderLogService; + + @Autowired + private YwSceneMapper ywSceneMapper; + + + @Log(title = "新增物资日志记录", businessType = BusinessType.INSERT) + @ApiOperation("新增物资日志记录") + @PostMapping("/insert") + public AjaxResult insert(@RequestBody YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) { + try { + String res = ywMaterialsOrderLogService.insertMaterialsOrderLog(ywMaterialsOrderLogDTO); + + if (StringUtils.isNotEmpty(res)) { + return AjaxResult.success("新增物资工单日志成功", res); + } + + return AjaxResult.error("新增物资工单日志失败"); + + } catch (Exception ex) { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "修改物资日志记录", businessType = BusinessType.UPDATE) + @ApiOperation("修改物资日志记录") + @PostMapping("/update") + public AjaxResult update(@RequestBody YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) { + try { + boolean res = ywMaterialsOrderLogService.updateMaterialsOrderLog(ywMaterialsOrderLogDTO); + if (res) { + return AjaxResult.success("修改物资日志记录成功"); + } + + return AjaxResult.error("修改物资日志记录失败"); + + } catch (Exception ex) { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "删除物资日志记录", businessType = BusinessType.DELETE) + @ApiOperation("删除物资日志记录") + @PostMapping("/delete") + public AjaxResult remove(@RequestBody YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) { + try { + boolean res = ywMaterialsOrderLogService.deleteMaterialsOrderLog(ywMaterialsOrderLogDTO); + if (res) { + return AjaxResult.success("删除物资日志记录成功"); + } + + return AjaxResult.error("删除物资日志记录失败"); + + } catch (Exception ex) { + return AjaxResult.error(ex.getMessage()); + } + } + + + @ApiOperation("获取物资日志记录") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwMaterialsSearchDTO ywMaterialsSearchDTO) throws Exception { +// TableDataInfo resData = ywMaterialsOrderLogService.getMaterialsOrderLog(ywMaterialsSearchDTO); +// return getDataTable(resData.getRows(), resData.getTotal()); + + if (ObjectUtils.isEmpty(ywMaterialsSearchDTO.getOrderType())) { + throw new ServiceException("工单类型不能为空"); + } + +// if(ObjectUtils.isEmpty(ywMaterialsSearchDTO.getInStoreId()) || ObjectUtils.isEmpty(ywMaterialsSearchDTO.getOutStoreId())) +// { +// throw new ServiceException("入库ID和出库ID不允许为空"); +// } + + if (!(ywMaterialsSearchDTO.getOrderType() == OrderType.ZXK.getCode() || ywMaterialsSearchDTO.getOrderType() == OrderType.DB.getCode())) { + if (ObjectUtils.isNotEmpty(ywMaterialsSearchDTO.getInStoreId()) && ObjectUtils.isNotEmpty(ywMaterialsSearchDTO.getOutStoreId())) { + if (ywMaterialsSearchDTO.getInStoreId() == -2 || ywMaterialsSearchDTO.getOutStoreId() == -2) { + SysUser user = getLoginUser().getUser(); + if (!(user.isAdmin(user) || user.isCenter(user))) { + List list = ywSceneMapper.getVenueByUserId(user.getUserId()); + if (list.size() > 0) { + List lstIds = list.stream().map(x -> x.getId()).collect(Collectors.toList()); + Long[] arr_ids = lstIds.toArray(new Long[lstIds.size()]); + if (ywMaterialsSearchDTO.getInStoreId() == -2) { + ywMaterialsSearchDTO.setInStoreIds(arr_ids); + ywMaterialsSearchDTO.setInStoreId(null); + } + if (ywMaterialsSearchDTO.getOutStoreId() == -2) { + ywMaterialsSearchDTO.setOutStoreIds(arr_ids); + ywMaterialsSearchDTO.setOutStoreId(null); + } + } + } else { + if (ywMaterialsSearchDTO.getInStoreId() == -2) { + ywMaterialsSearchDTO.setInStoreId(null); + } + if (ywMaterialsSearchDTO.getOutStoreId() == -2) { + ywMaterialsSearchDTO.setOutStoreId(null); + } + } + } + } + } + + startPage(); + return getDataTable(ywMaterialsOrderLogService.selectMaterialsOrderLog(ywMaterialsSearchDTO)); + + } + + @ApiOperation("导出物资日志记录") + @PostMapping("/export") + public void export(@RequestBody YwMaterialsSearchDTO ywMaterialsSearchDTO, HttpServletResponse response) throws Exception { + Map orderTypeMap = new HashMap<>(); + Map taskStatusMap = new HashMap<>(); + taskStatusMap.put("0", "待申请"); + taskStatusMap.put("1", "待审核"); + taskStatusMap.put("2", "已审核"); + taskStatusMap.put("3", "已出库"); + taskStatusMap.put("4", "已入库"); + orderTypeMap.put(1, "中心库物资更新"); + orderTypeMap.put(2, "物资申领"); + orderTypeMap.put(3, "物资退库"); + orderTypeMap.put(4, "工程出库"); + orderTypeMap.put(5, "折旧入库"); + orderTypeMap.put(6, "物资调拨"); + ywMaterialsSearchDTO.setPageNum(1); + ywMaterialsSearchDTO.setPageSize(Integer.MAX_VALUE); + if (ObjectUtils.isEmpty(ywMaterialsSearchDTO.getOrderType())) { + throw new ServiceException("工单类型不能为空"); + } + if (!(ywMaterialsSearchDTO.getOrderType() == OrderType.ZXK.getCode() || ywMaterialsSearchDTO.getOrderType() == OrderType.DB.getCode())) { + if (ObjectUtils.isNotEmpty(ywMaterialsSearchDTO.getInStoreId()) && ObjectUtils.isNotEmpty(ywMaterialsSearchDTO.getOutStoreId())) { + if (ywMaterialsSearchDTO.getInStoreId() == -2 || ywMaterialsSearchDTO.getOutStoreId() == -2) { + SysUser user = getLoginUser().getUser(); + if (!(user.isAdmin(user) || user.isCenter(user))) { + List list = ywSceneMapper.getVenueByUserId(user.getUserId()); + if (list.size() > 0) { + List lstIds = list.stream().map(x -> x.getId()).collect(Collectors.toList()); + Long[] arr_ids = lstIds.toArray(new Long[lstIds.size()]); + if (ywMaterialsSearchDTO.getInStoreId() == -2) { + ywMaterialsSearchDTO.setInStoreIds(arr_ids); + ywMaterialsSearchDTO.setInStoreId(null); + } + if (ywMaterialsSearchDTO.getOutStoreId() == -2) { + ywMaterialsSearchDTO.setOutStoreIds(arr_ids); + ywMaterialsSearchDTO.setOutStoreId(null); + } + } + } else { + if (ywMaterialsSearchDTO.getInStoreId() == -2) { + ywMaterialsSearchDTO.setInStoreId(null); + } + if (ywMaterialsSearchDTO.getOutStoreId() == -2) { + ywMaterialsSearchDTO.setOutStoreId(null); + } + } + } + } + } + List ywMaterialsOrderLogVos = ywMaterialsOrderLogService.selectMaterialsOrderLog(ywMaterialsSearchDTO); + for (YwMaterialsOrderLogVo ywMaterialsOrderLogVo : ywMaterialsOrderLogVos) { + ywMaterialsOrderLogVo.setOutStoreName(ywMaterialsOrderLogVo.getInStoreName()); + ywMaterialsOrderLogVo.setOutVenue2Name(ywMaterialsOrderLogVo.getOutVenueName()); + ywMaterialsOrderLogVo.setInVenue2Name(ywMaterialsOrderLogVo.getInVenueName()); + if (StringUtils.isNotNull(ywMaterialsOrderLogVo.getOrderType())) { + ywMaterialsOrderLogVo.setOrderTypeName(orderTypeMap.get(ywMaterialsOrderLogVo.getOrderType())); + } + if (StringUtils.isNotEmpty(ywMaterialsOrderLogVo.getTaskStatus())) { + ywMaterialsOrderLogVo.setTaskStatus(taskStatusMap.get(ywMaterialsOrderLogVo.getTaskStatus())); + } + } + ExcelUtil util = new ExcelUtil<>(YwMaterialsOrderLogVo.class); + if (ywMaterialsSearchDTO.getOrderType() == 1) { + util.hideColumn("inVenueName", "outVenueName", "wireTaskId", "outStoreName", "inStoreName", "inVenue2Name", "outVenue2Name"); + } else if (ywMaterialsSearchDTO.getOrderType() == 2) { + util.hideColumn("wireTaskId", "outStoreName", "outVenueName", "inVenue2Name", "outVenue2Name"); + } else if (ywMaterialsSearchDTO.getOrderType() == 3) { + util.hideColumn("wireTaskId", "inStoreName", "inVenueName", "inVenue2Name", "outVenue2Name"); + } else if (ywMaterialsSearchDTO.getOrderType() == 4) { + util.hideColumn("inStoreName", "inVenueName", "inVenue2Name", "outVenue2Name"); + } else if (ywMaterialsSearchDTO.getOrderType() == 5) { + util.hideColumn("outStoreName", "outVenueName", "inVenue2Name", "outVenue2Name"); + } else if (ywMaterialsSearchDTO.getOrderType() == 6) { + util.hideColumn("wireTaskId", "inVenueName", "outVenueName", "inStoreName", "outStoreName", "checkName"); + } + util.exportExcel(response, ywMaterialsOrderLogVos, "数据"); + } + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsStockController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsStockController.java new file mode 100644 index 0000000000000000000000000000000000000000..fa54038f3312183485add1e98d4add2e764212e4 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/cmcc_gm/YwMaterialsStockController.java @@ -0,0 +1,124 @@ +package com.ruoyi.web.controller.cmcc_gm; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsStockImportDTO; +import com.ruoyi.cmcc_gm.service.YwMaterialsStockService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.util.List; + +/** + * 物资库存表(YwMaterialsStock)表控制层 + * + * @author lee + * @since 2023-04-24 09:48:06 + */ +@Api(tags = "场馆物资") +@RestController +@RequestMapping("/eastcom_yw/ywMaterialsStock") +public class YwMaterialsStockController extends BaseController { + + /** + * 服务对象 + */ + @Resource + private YwMaterialsStockService ywMaterialsStockService; + + /** + * 分页查询所有数据 + * + * @param page 分页对象 + * @param ywMaterialsStock 查询实体 + * @return 所有数据 + */ + @ApiOperation("分页查询") + @GetMapping + public AjaxResult selectAll(Page page, YwMaterialsStock ywMaterialsStock) { + return AjaxResult.success(this.ywMaterialsStockService.page(page, new QueryWrapper<>(ywMaterialsStock))); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @ApiOperation("根据id查") + @GetMapping("{id}") + public AjaxResult selectOne(@PathVariable Serializable id) { + return AjaxResult.success(this.ywMaterialsStockService.getById(id)); + } + + /** + * 新增数据 + * + * @param ywMaterialsStock 实体对象 + * @return 新增结果 + */ + @Log(title = "新增物资库存", businessType = BusinessType.INSERT) + @ApiOperation("新增") + @PostMapping + public AjaxResult insert(@RequestBody YwMaterialsStock ywMaterialsStock) { + return AjaxResult.success(this.ywMaterialsStockService.save(ywMaterialsStock)); + } + + /** + * 修改数据 + * + * @param ywMaterialsStock 实体对象 + * @return 修改结果 + */ + @Log(title = "修改物资库存", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult update(@RequestBody YwMaterialsStock ywMaterialsStock) { + return AjaxResult.success(this.ywMaterialsStockService.updateById(ywMaterialsStock)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @Log(title = "删除物资库存", businessType = BusinessType.DELETE) + @ApiOperation("删除") + @DeleteMapping + public AjaxResult delete(@RequestParam("idList") List idList) { + return AjaxResult.success(this.ywMaterialsStockService.removeByIds(idList)); + } + + /** + * 场馆物资导入 + * + * @param file + * @param sceneBigId + * @param materialStoreId + * @return + */ + @Log(title = "导入物资库存", businessType = BusinessType.IMPORT) + @ApiOperation("导入") + @RequestMapping(method = RequestMethod.POST, value = "/import") + public AjaxResult importXls(@RequestPart("file") MultipartFile file, + @RequestParam(value = "sceneBigId", defaultValue = "1") Long sceneBigId, + @RequestParam("materialStoreId") Long materialStoreId, + @RequestParam("importType") String importType) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwMaterialsStockImportDTO.class); + List beans = util.importExcel(file.getInputStream()); + return ywMaterialsStockService.importXls(beans, sceneBigId, importType, materialStoreId); + } + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java new file mode 100644 index 0000000000000000000000000000000000000000..d2d6e8c47a07c7dc94b600dfe891d0bea9c9bd0f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -0,0 +1,94 @@ +package com.ruoyi.web.controller.common; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.FastByteArrayOutputStream; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import com.google.code.kaptcha.Producer; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.sign.Base64; +import com.ruoyi.common.utils.uuid.IdUtils; +import com.ruoyi.system.service.ISysConfigService; + +/** + * 验证码操作处理 + * + * @author ruoyi + */ +@RestController +public class CaptchaController +{ + @Resource(name = "captchaProducer") + private Producer captchaProducer; + + @Resource(name = "captchaProducerMath") + private Producer captchaProducerMath; + + @Autowired + private RedisCache redisCache; + + @Autowired + private ISysConfigService configService; + /** + * 生成验证码 + */ + @GetMapping("/captchaImage") + public AjaxResult getCode(HttpServletResponse response) throws IOException + { + AjaxResult ajax = AjaxResult.success(); + boolean captchaEnabled = configService.selectCaptchaEnabled(); + ajax.put("captchaEnabled", captchaEnabled); + if (!captchaEnabled) + { + return ajax; + } + + // 保存验证码信息 + String uuid = IdUtils.simpleUUID(); + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; + + String capStr = null, code = null; + BufferedImage image = null; + + // 生成验证码 + String captchaType = RuoYiConfig.getCaptchaType(); + if ("math".equals(captchaType)) + { + String capText = captchaProducerMath.createText(); + capStr = capText.substring(0, capText.lastIndexOf("@")); + code = capText.substring(capText.lastIndexOf("@") + 1); + image = captchaProducerMath.createImage(capStr); + } + else if ("char".equals(captchaType)) + { + capStr = code = captchaProducer.createText(); + image = captchaProducer.createImage(capStr); + } + + redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + // 转换流信息写出 + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); + try + { + ImageIO.write(image, "jpg", os); + } + catch (IOException e) + { + return AjaxResult.error(e.getMessage()); + } + + ajax.put("uuid", uuid); + ajax.put("img", Base64.encode(os.toByteArray())); + return ajax; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java new file mode 100644 index 0000000000000000000000000000000000000000..3b40d3bd88f70904b3e7b5188e813bd1be56957d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -0,0 +1,262 @@ +package com.ruoyi.web.controller.common; + +import java.util.ArrayList; +import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.alibaba.fastjson2.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.common.config.MinioConfig; +import com.ruoyi.common.utils.file.MimeTypeUtils; +import com.ruoyi.framework.web.domain.dto.MobileOfficesDTO; +import com.ruoyi.framework.web.service.sms.MessageService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.framework.config.ServerConfig; + +/** + * 通用请求处理 + * + * @author ruoyi + */ +@Api("通用请求处理") +@RestController +@RequestMapping("/common") +public class CommonController +{ + private static final Logger log = LoggerFactory.getLogger(CommonController.class); + + @Autowired + private ServerConfig serverConfig; + + @Autowired + private MessageService messageService; + + private static final String FILE_DELIMETER = ","; + + /** + * 通用下载请求 + * + * @param fileName 文件名称 + * @param delete 是否删除 + */ + @ApiOperation("通用下载请求") + @GetMapping("/download") + public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) + { + try + { + if (!FileUtils.checkAllowDownload(fileName)) + { + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); + } + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); + String filePath = RuoYiConfig.getDownloadPath() + fileName; + + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, realFileName); + FileUtils.writeBytes(filePath, response.getOutputStream()); + if (delete) + { + FileUtils.deleteFile(filePath); + } + } + catch (Exception e) + { + log.error("下载文件失败", e); + } + } + + /** + * 通用上传请求(单个) + */ + @ApiOperation("通用上传请求(单个)") + @PostMapping("/upload") + public AjaxResult uploadFile(MultipartFile file) throws Exception + { + try + { + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", url); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + ajax.put("fileSize",file.getSize()); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + + @ApiOperation("minio上传请求(单个)") + @PostMapping("/uploadMinio") + public AjaxResult uploadFileMinio(MultipartFile file) { + try { + // 上传并返回新文件名称 + String fileName = FileUploadUtils.uploadMinio(file); + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", fileName.replace(MinioConfig.getUrl(),serverConfig.getUrl()+"/profile/")); + ajax.put("fileName", fileName.replace(MinioConfig.getUrl(),"/profile/")); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } + catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 图片上传 + */ + @ApiOperation("通用上传图片请求(单个)") + @PostMapping("/upload/image") + public AjaxResult uploadImageFile(@RequestParam("imagefile") MultipartFile file) throws Exception + { + if (!file.isEmpty()) + { + try + { + + String imageurl = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), file, MimeTypeUtils.IMAGE_EXTENSION); + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", imageurl); + return ajax; + + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + return AjaxResult.error("没有上传图片文件"); + } + + @ApiOperation("minio上传请求(单个)") + @PostMapping("/upload/imageMinio") + public AjaxResult uploadImageFileMinio(MultipartFile file) { + if (!file.isEmpty()) + { + try + { + + String imageurl = FileUploadUtils.uploadMinio(file, MimeTypeUtils.IMAGE_EXTENSION); + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", imageurl); + return ajax; + + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + return AjaxResult.error("没有上传图片文件"); + } + + /** + * 通用上传请求(多个) + */ + @ApiOperation("通用上传请求(多个)") + @PostMapping("/uploads") + public AjaxResult uploadFiles(List files) throws Exception + { + try + { + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + List urls = new ArrayList(); + List fileNames = new ArrayList(); + List newFileNames = new ArrayList(); + List originalFilenames = new ArrayList(); + for (MultipartFile file : files) + { + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + urls.add(url); + fileNames.add(fileName); + newFileNames.add(FileUtils.getName(fileName)); + originalFilenames.add(file.getOriginalFilename()); + } + AjaxResult ajax = AjaxResult.success(); + ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); + ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); + ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); + ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 本地资源通用下载 + */ + @ApiOperation("本地资源通用下载") + @GetMapping("/download/resource") + public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) + throws Exception + { + try + { + if (!FileUtils.checkAllowDownload(resource)) + { + throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); + } + // 本地资源路径 + String localPath = RuoYiConfig.getProfile(); + // 数据库资源地址 + String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); + // 下载名称 + String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, downloadName); + FileUtils.writeBytes(downloadPath, response.getOutputStream()); + } + catch (Exception e) + { + log.error("下载文件失败", e); + } + } + + @ApiOperation("测试发送移动办公群") + @PostMapping("/testSendMobileOffice") + public JSONObject testSendMobileOffice(@RequestBody MobileOfficesDTO dto){ + return messageService.sendMobileOffice(dto); + } + + @ApiOperation("测试发送短信") + @GetMapping("/testSendSMS") + public JSONObject testSendSMS(@RequestParam String content,@RequestParam String mobile){ + return messageService.sendSMS(content, mobile); + } + + @ApiOperation("测试发送IVR") + @GetMapping("/testSendIVR") + public JSONObject testSendIVR(@RequestParam String content,@RequestParam String mobile){ + return messageService.sendIvr(content, mobile); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2MmlListController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2MmlListController.java new file mode 100644 index 0000000000000000000000000000000000000000..01887b3b3ee5de2c126a9ca5f39f708cef8a994d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2MmlListController.java @@ -0,0 +1,116 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.Dp2MmlList; +import com.ruoyi.eastcom_yw.domain.qo.Dp2MmlListQO; +import com.ruoyi.eastcom_yw.service.Dp2MmlListService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 前端控制器 + *

+ * + * @author ck + * @since 2023-09-12 + */ +@Api(tags = "") +@RestController +@RequestMapping("/eastcom_yw/dp2MmlList") +@Slf4j +@RequiredArgsConstructor +public class Dp2MmlListController extends BaseController { + + private final Dp2MmlListService dp2MmlListService; + + /** + * 列表 + */ + @ApiOperation(value = "列表", notes = "列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody Dp2MmlListQO qo) { + List list = dp2MmlListService.getData(qo); + return getDataTable(list); + } + + + /** + * 分页列表 + */ + @ApiOperation(value = "分页列表", notes = "分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody Dp2MmlListQO qo) { + PageInfo page = dp2MmlListService.getDataByPage(qo); + return getDataTable(page.getList(), page.getTotal()); + } + +// /** +// * 获取详情 +// */ +// @ApiOperation(value = "详情", notes = "详情") +// @GetMapping(value = "/fetchById/{id}") +// public AjaxResult fetchById(@PathVariable Long id) { +// return AjaxResult.success(dp2MmlListService.fetchById(id)); +// } +// +// /** +// * 新增或修改 +// */ +// @Log(title = "新增或修改", businessType = BusinessType.INSERT) +// @ApiOperation(value = "新增或修改", notes = "新增或修改") +// @PostMapping(value = "/saveOrUpdate") +// public AjaxResult saveOrUpdate(@RequestBody @Validated Dp2MmlList dto) { +// dp2MmlListService.saveOrUpdate(dto); +// return AjaxResult.success(); +// } +// +// /** +// * 根据id删除 +// */ +// @Log(title = "根据id删除", businessType = BusinessType.DELETE) +// @ApiOperation(value = "根据id删除", notes = "根据id删除") +// @GetMapping(value = "/deleteById/{id}") +// public AjaxResult deleteById(@PathVariable Long id) { +// dp2MmlListService.deleteById(id); +// return AjaxResult.success(); +// } +// +// /** +// * 根据id批量删除 +// */ +// @Log(title = "根据id批量删除", businessType = BusinessType.DELETE) +// @ApiOperation(value = "根据id批量删除", notes = "根据id批量删除") +// @PostMapping(value = "/deleteByIdBatch") +// public AjaxResult deleteByIdBatch(@RequestBody List ids) { +// dp2MmlListService.deleteByIdBatch(ids); +// return AjaxResult.success(); +// } + +// @Log(title = "导入", businessType = BusinessType.IMPORT) +// @PostMapping("/import") +// public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { +// ExcelUtil util = new ExcelUtil<>(Dp2MmlList.class); +// List list = util.importExcel(file.getInputStream()); +// dp2MmlListService.importData(list, updateSupport); +// return AjaxResult.success(); +// } + + + /** + * 导出 + */ + @ApiOperation(value = "导出") + @PostMapping(value = "/export") + public void export(@RequestBody Dp2MmlListQO qo) { + dp2MmlListService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2SpotCellController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2SpotCellController.java new file mode 100644 index 0000000000000000000000000000000000000000..7405e011a6b3cea57494015e6ba89e1c6c2334a3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2SpotCellController.java @@ -0,0 +1,117 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2SpotCell; +import com.ruoyi.eastcom_yw.domain.qo.Dp2SpotCellQO; +import com.ruoyi.eastcom_yw.service.Dp2SpotCellService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * @author ck + * @since 2023-08-10 + */ +@Api(tags = "") +@RestController +@RequestMapping("/eastcom_yw/dp2SpotCell") +@Slf4j +@RequiredArgsConstructor +public class Dp2SpotCellController extends BaseController { + + private final Dp2SpotCellService dp2SpotCellService; + + /** + * 列表 + */ + @ApiOperation(value = "列表", notes = "列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody Dp2SpotCellQO qo) { + List list = dp2SpotCellService.getData(qo); + return getDataTable(list); + } + + + /** + * 分页列表 + */ + @ApiOperation(value = "分页列表", notes = "分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody Dp2SpotCellQO qo) { + PageInfo page = dp2SpotCellService.getDataByPage(qo); + return getDataTable(page.getList(), page.getTotal()); + } + + /** + * 获取详情 + */ + @ApiOperation(value = "详情", notes = "详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(dp2SpotCellService.fetchById(id)); + } + + /** + * 新增或修改 + */ + @Log(title = "新增或修改", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改", notes = "新增或修改") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated Dp2SpotCell entity) { + dp2SpotCellService.saveOrUpdated(entity); + return AjaxResult.success(); + } + + /** + * 根据id删除 + */ + @Log(title = "根据id删除", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除", notes = "根据id删除") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + dp2SpotCellService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除 + */ + @Log(title = "根据id批量删除", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除", notes = "根据id批量删除") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + dp2SpotCellService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(Dp2SpotCell.class); + List list = util.importExcel(file.getInputStream()); + return dp2SpotCellService.importData(list, updateSupport); + } + + + /** + * 导出 + */ + @ApiOperation(value = "导出") + @PostMapping(value = "/export") + public void export(@RequestBody Dp2SpotCellQO qo) { + dp2SpotCellService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2SpotConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2SpotConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..fa69152f85c4dade87f3847e487e491b983ed090 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2SpotConfigController.java @@ -0,0 +1,120 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2SpotConfig; +import com.ruoyi.eastcom_yw.domain.dto.Dp2SpotConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2SpotConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2SpotConfigVO; +import com.ruoyi.eastcom_yw.service.Dp2SpotConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * @author ck + * @since 2023-08-09 + */ +@Api(tags = "景区配置") +@RestController +@RequestMapping("/eastcom_yw/dp2SpotConfig") +@Slf4j +@RequiredArgsConstructor +public class Dp2SpotConfigController extends BaseController { + + private final Dp2SpotConfigService dp2SpotConfigService; + + /** + * 列表 + */ + @ApiOperation(value = "列表", notes = "列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody Dp2SpotConfigQO qo) { + List list = dp2SpotConfigService.getData(qo); + return getDataTable(list); + } + + + /** + * 分页列表 + */ + @ApiOperation(value = "分页列表", notes = "分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody Dp2SpotConfigQO qo) { + PageInfo page = dp2SpotConfigService.getDataByPage(qo); + return getDataTable(page.getList(), page.getTotal()); + } + + /** + * 获取详情 + */ + @ApiOperation(value = "详情", notes = "详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(dp2SpotConfigService.fetchById(id)); + } + + /** + * 新增或修改 + */ + @Log(title = "新增或修改", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改", notes = "新增或修改") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated Dp2SpotConfigDTO dto) { + dp2SpotConfigService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除 + */ + @Log(title = "根据id删除", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除", notes = "根据id删除") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + dp2SpotConfigService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除 + */ + @Log(title = "根据id批量删除", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除", notes = "根据id批量删除") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + dp2SpotConfigService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(Dp2SpotConfig.class); + List list = util.importExcel(file.getInputStream()); + dp2SpotConfigService.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * 导出 + */ + @ApiOperation(value = "导出") + @PostMapping(value = "/export") + public void export(@RequestBody Dp2SpotConfigQO qo) { + dp2SpotConfigService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2ViewPowerAlarmController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2ViewPowerAlarmController.java new file mode 100644 index 0000000000000000000000000000000000000000..81568e530ae847b7e4565bf070e7b9b35c3e5136 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2ViewPowerAlarmController.java @@ -0,0 +1,81 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2ViewPowerAlarm; +import com.ruoyi.eastcom_yw.domain.dto.Dp2ViewPowerAlarmDTO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewPowerAlarmQO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewWirelessAlarmQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewPowerAlarmVO; +import com.ruoyi.eastcom_yw.service.Dp2ViewPowerAlarmService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import java.util.List; + +/** +*

+ * 前端控制器 + *

+* +* @author wqx +* @since 2023-08-31 +*/ +@Api(tags = "城市侧动环") +@RestController +@RequestMapping("/eastcom_yw/dp2ViewPowerAlarm") +@Slf4j +@RequiredArgsConstructor +public class Dp2ViewPowerAlarmController extends BaseController { + + private final Dp2ViewPowerAlarmService dp2ViewPowerAlarmService; + + /** + * 列表 + */ + @ApiOperation(value = "列表", notes = "列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody Dp2ViewPowerAlarmQO qo) { + List list = dp2ViewPowerAlarmService.getData(qo); + return getDataTable(list); + } + + + /** + * 分页列表 + */ + @ApiOperation(value = "分页列表", notes = "分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody Dp2ViewPowerAlarmQO qo) { + PageInfo page = dp2ViewPowerAlarmService.getDataByPage(qo); + return getDataTable(page.getList(),page.getTotal()); + } + + + + + /** + * 导出 + */ + @ApiOperation(value = "导出") + @PostMapping(value = "/export") + public void export(@RequestBody Dp2ViewPowerAlarmQO qo){ + dp2ViewPowerAlarmService.export(qo); + } + + + + + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2ViewWirelessAlarmController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2ViewWirelessAlarmController.java new file mode 100644 index 0000000000000000000000000000000000000000..6e48dd83f9864693607fa9739aa7b8b0dd50f078 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/Dp2ViewWirelessAlarmController.java @@ -0,0 +1,84 @@ +package com.ruoyi.web.controller.eastcom_yw; +; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.Dp2ViewWirelessAlarm; +import com.ruoyi.eastcom_yw.domain.dto.Dp2ViewWirelessAlarmDTO; +import com.ruoyi.eastcom_yw.domain.qo.Dp2ViewWirelessAlarmQO; +import com.ruoyi.eastcom_yw.domain.vo.Dp2ViewWirelessAlarmVO; +import com.ruoyi.eastcom_yw.service.Dp2ViewWirelessAlarmService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + + import org.springframework.stereotype.Controller; +import org.springframework.web.multipart.MultipartFile; + + +import javax.validation.Valid; +import java.util.List; + +/** +*

+ * 前端控制器 + *

+* +* @author wqx +* @since 2023-09-01 +*/ +@Api(tags = "城市侧无线") +@RestController +@RequestMapping("/eastcom_yw/dp2ViewWirelessAlarm") +@Slf4j +@RequiredArgsConstructor +public class Dp2ViewWirelessAlarmController extends BaseController { + + private final Dp2ViewWirelessAlarmService dp2ViewWirelessAlarmService; + + /** + * 列表 + */ + @ApiOperation(value = "列表", notes = "列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody Dp2ViewWirelessAlarmQO qo) { + + List list = dp2ViewWirelessAlarmService.getData(qo); + return getDataTable(list); + } + + + /** + * 分页列表 + */ + @ApiOperation(value = "分页列表", notes = "分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody Dp2ViewWirelessAlarmQO qo) { + PageInfo page = dp2ViewWirelessAlarmService.getDataByPage(qo); + return getDataTable(page.getList(),page.getTotal()); + } + + + + /** + * 导出 + */ + @ApiOperation(value = "导出") + @PostMapping(value = "/export") + public void export(@RequestBody Dp2ViewWirelessAlarmQO qo){ + dp2ViewWirelessAlarmService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/DpSceneConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/DpSceneConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..faa78c7526e3237fa6b2529c6aa3b5c77e1a450a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/DpSceneConfigController.java @@ -0,0 +1,154 @@ +package com.ruoyi.web.controller.eastcom_yw; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.DpSceneConfig; +import com.ruoyi.eastcom_yw.domain.dto.DpSceneConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.DpSceneConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.DpSceneConfigVO; +import com.ruoyi.eastcom_yw.service.DpSceneConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + + import org.springframework.stereotype.Controller; +import org.springframework.web.multipart.MultipartFile; + + +import javax.validation.Valid; +import java.util.List; + +/** +*

+ * 前端控制器 + *

+* +* @author yqf +* @since 2023-04-12 +*/ +@Api(tags = "阈值管理") +@RestController +@RequestMapping("/eastcom_yw/dpSceneConfig") +@Slf4j +@RequiredArgsConstructor +public class DpSceneConfigController extends BaseController { + + private final DpSceneConfigService dpSceneConfigService; + + /** + * 列表 + */ + @ApiOperation(value = "列表", notes = "列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody DpSceneConfigQO qo) { + List list = dpSceneConfigService.getData(qo); + return getDataTable(list); + } + + + /** + * 分页列表 + */ + @ApiOperation(value = "分页列表", notes = "分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody DpSceneConfigQO qo) { + IPage page = dpSceneConfigService.getDataByPage(qo); + return getDataTable(page.getRecords(),page.getTotal()); + } + + /** + * 获取详情 + */ + @ApiOperation(value = "详情", notes = "详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(dpSceneConfigService.fetchById(id)); + } + + /** + * 新增或修改 + */ + @Log(title = "新增或修改", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改", notes = "新增或修改") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated DpSceneConfigDTO dto) { + dpSceneConfigService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除 + */ + @Log(title = "根据id删除", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除", notes = "根据id删除") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + dpSceneConfigService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除 + */ + @Log(title = "根据id批量删除", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除", notes = "根据id批量删除") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + dpSceneConfigService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(DpSceneConfig.class); + List list = util.importExcel(file.getInputStream()); + dpSceneConfigService.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * 导出 + */ + @ApiOperation(value = "导出") + @PostMapping(value = "/export") + public void export(@RequestBody DpSceneConfigQO qo){ + dpSceneConfigService.export(qo); + } + + + /** + * 颜色下拉框 + */ + @ApiOperation(value = "颜色下拉框", notes = "颜色下拉框") + @GetMapping(value = "/listColor") + public AjaxResult listColor() { + List list = dpSceneConfigService.listColor(); + return AjaxResult.success(list); + } + + /** + * 指标名下拉框 + */ + @ApiOperation(value = "指标名下拉框", notes = "指标名下拉框") + @GetMapping(value = "/listKpiName") + public AjaxResult listKpiName() { + List list = dpSceneConfigService.listKpiName(); + return AjaxResult.success(list); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/LargeScreenController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/LargeScreenController.java new file mode 100644 index 0000000000000000000000000000000000000000..0fee89e2a351b7d1456aa190cd6e6550cb511851 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/LargeScreenController.java @@ -0,0 +1,101 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.eastcom_yw.domain.model.AppEntity; +import com.ruoyi.eastcom_yw.service.LargeScreenService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +/** + * @author los + */ +@Api("大屏信息列表查询接口") +@RestController +@RequestMapping("/eastcom_yw/largeScreen") +@RequiredArgsConstructor +@Anonymous +public class LargeScreenController extends BaseController { + + private final LargeScreenService largeScreenService; + + @ApiOperation("任务管理列表查询") + @PostMapping("/taskMange/list") + public AjaxResult getTaskMangeList(HttpServletRequest request, AppEntity appEntity) { + String ipAddr = IpUtils.getIpAddr(request); + if (!largeScreenService.validate(ipAddr, appEntity)) { + return new AjaxResult(HttpStatus.UNAUTHORIZED, "not authorized.", null); + } + return AjaxResult.success(largeScreenService.getTaskManageList()); + } + + @ApiOperation("赛事列表查询") + @PostMapping("/match/list") + public AjaxResult getMatchList(HttpServletRequest request, AppEntity appEntity) { + String ipAddr = IpUtils.getIpAddr(request); + if (!largeScreenService.validate(ipAddr, appEntity)) { + return new AjaxResult(HttpStatus.UNAUTHORIZED, "not authorized.", null); + } + return AjaxResult.success(largeScreenService.getMatchList()); + } + + @ApiOperation("赛事赛程列表查询") + @PostMapping("/raceSchedule/list") + public AjaxResult getRaceScheduleList(HttpServletRequest request, AppEntity appEntity) { + String ipAddr = IpUtils.getIpAddr(request); + if (!largeScreenService.validate(ipAddr, appEntity)) { + return new AjaxResult(HttpStatus.UNAUTHORIZED, "not authorized.", null); + } + return AjaxResult.success(largeScreenService.getRaceScheduleList()); + } + + @ApiOperation("奖牌榜列表查询") + @PostMapping("/medal/list") + public AjaxResult getMedalList(HttpServletRequest request, AppEntity appEntity) { + String ipAddr = IpUtils.getIpAddr(request); + if (!largeScreenService.validate(ipAddr, appEntity)) { + return new AjaxResult(HttpStatus.UNAUTHORIZED, "not authorized.", null); + } + return AjaxResult.success(largeScreenService.getMedalList()); + } + + @ApiOperation("新闻信息列表查询") + @PostMapping("/news/list") + public AjaxResult getNewsList(HttpServletRequest request, AppEntity appEntity) { + String ipAddr = IpUtils.getIpAddr(request); + if (!largeScreenService.validate(ipAddr, appEntity)) { + return new AjaxResult(HttpStatus.UNAUTHORIZED, "not authorized.", null); + } + return AjaxResult.success(largeScreenService.getNewsList()); + } + + @ApiOperation("告警TOP明细列表查询") + @PostMapping("/alarmTop/list") + public AjaxResult getAlarmTopList(HttpServletRequest request, AppEntity appEntity) { + String ipAddr = IpUtils.getIpAddr(request); + if (!largeScreenService.validate(ipAddr, appEntity)) { + return new AjaxResult(HttpStatus.UNAUTHORIZED, "not authorized.", null); + } + return AjaxResult.success(largeScreenService.getAlarmTopList()); + } + + @ApiOperation("告警统计列表查询") + @PostMapping("/alarmStatistics/list") + public AjaxResult getAlarmStatisticsList(HttpServletRequest request, AppEntity appEntity) { + String ipAddr = IpUtils.getIpAddr(request); + if (!largeScreenService.validate(ipAddr, appEntity)) { + return new AjaxResult(HttpStatus.UNAUTHORIZED, "not authorized.", null); + } + return AjaxResult.success(largeScreenService.getAlarmStatisticsList()); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/WeatherController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/WeatherController.java new file mode 100644 index 0000000000000000000000000000000000000000..0ffb07ef49061bcb4633053d35d36db7c7c7800d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/WeatherController.java @@ -0,0 +1,29 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.service.WeatherService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api("爬取天气数据") +@RestController +@RequestMapping("/eastcom_yw/weather") +public class WeatherController { + + @Autowired + private WeatherService weatherService; + + /** + * 获取场馆天气详情 + */ + @ApiOperation(value = "获取场馆天气详情", notes = "获取场馆天气详情") + @GetMapping(value = "/fetchById/{venueId}") + public AjaxResult fetchById(@PathVariable Long venueId) { + return AjaxResult.success(weatherService.fetchById(venueId)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwAlarmController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwAlarmController.java new file mode 100644 index 0000000000000000000000000000000000000000..99fca1e2b4ab686ac7d49ec75e1e3f884103a0f6 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwAlarmController.java @@ -0,0 +1,1068 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.ArrayUtil; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; + +import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.dto.HandleDataDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; + +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.common.constant.AlarmConstants; +import com.ruoyi.eastcom_yw.common.constant.CacheConstants; +import com.ruoyi.eastcom_yw.domain.HmAlarmDerive; +import com.ruoyi.eastcom_yw.domain.YwAlarmOprateLog; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTONoPage; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmHangupLogDTO; + +import com.ruoyi.eastcom_yw.domain.model.StepInfo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmNewNumVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmViewVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmVo; +import com.ruoyi.eastcom_yw.mapper.YwAlarmMapper; +import com.ruoyi.eastcom_yw.domain.yw_alarm_deal_log; +import com.ruoyi.eastcom_yw.mapper.yw_alarm_deal_logMapper; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.generator.util.GenUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import javafx.scene.Scene; +import org.springframework.beans.factory.annotation.Autowired; + +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletResponse; +import java.time.Duration; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * + * @author jkj + * @since 2023-01-12 + */ + +@Api("告警信息管理") +@RestController +@RequestMapping("/eastcom_yw/alarm") +public class YwAlarmController extends BaseController { + + @Autowired + private YwAlarmViewService ywAlarmViewService; + + @Autowired + private YwAlarmDHService ywAlarmDHService; + + @Autowired + private YwAlarmCSService ywAlarmCSService; + + @Autowired + private YwAlarmWXService ywAlarmWXService; + + @Autowired + private YwSceneService yw_sceneService; + + @Autowired + private YwAlarmService ywAlarmService; + + @Autowired + private YwAlarmHangupLogService ywAlarmHangupLogService; + + @Autowired + private YwAlarmOprateLogService ywAlarmOprateLogService; + + @Autowired + private RedisCache redisCache; + + @Autowired + private yw_alarm_deal_logMapper alarm_deal_logMapper; + + @Autowired + private CommonService commonService; + + @Autowired + private YwAlarmMapper ywAlarmMapper; + + @Autowired + private HmAlarmDeriveService hmAlarmDeriveService; + + //列表和告警数量组合的查询太慢,弃用 + @ApiOperation("根据条件获取告警") + @PostMapping("/newlist2") + public TableDataInfo newlist1(@RequestBody YwAlarmDTO alarmDTO) + { + SysUser user = getLoginUser().getUser(); + alarmDTO.setUserId(user.getUserId()); + if(ObjectUtils.isNotEmpty(alarmDTO.getIsRefresh())) + { + //1自动刷新,0是手动刷新 + if(0==alarmDTO.getIsRefresh()) { + //如果是用户点击的查询,保存当前用户查询的场馆,便于用户重新登录后自动勾选场馆查询 + redisCache.setCacheObject(CacheConstants.YW_ALARM_LAST_VENUES + getUserId(), alarmDTO.getVenues(), 3, TimeUnit.DAYS); + } + } + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (alarmDTO.getVenues().size()==0) { +// boolean isAll = user.isAdmin(user); +// alarmDTO.setIsAll(isAll); +// //管理员不需要设置场馆 +// if(!isAll) { +// List venueList = new ArrayList(); +// yw_sceneService.getVenueByUser(user).forEach( +// venue -> { +// venueList.add(venue.getId()); +// } +// ); +// alarmDTO.setVenues(venueList); +// } + List lstScene = yw_sceneService.getVenueByUserCanNoData(user,false); + + if(lstScene.isEmpty()) + { + alarmDTO.setIsAll(true); + } + + if(!lstScene.isEmpty()) + { + List venueList = new ArrayList(); + for(YwScene ywScene : lstScene) { + venueList.add(ywScene.getId()); + } + alarmDTO.setVenues(venueList); + } + } + TableDataInfo resData = null; + + if(!alarmDTO.getAlarmType().isEmpty()) + { + if("tel".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setAlarmType("voip"); + } + if(GenUtils.arraysContains(AlarmConstants.ALARMS,alarmDTO.getAlarmType())) + { + if(alarmDTO.getPageNum()<=0) + { + alarmDTO.setPageNum(1); + } + if(alarmDTO.getPageSize()<=0) + { + alarmDTO.setPageSize(10); + } + String siteType = alarmDTO.getSiteType(); + + if(!"wx".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setSiteType(null); + } + + List list = null; + try { + list = ywAlarmViewService.getYwAlarmByDto(alarmDTO); + } + catch (Exception ex) + { + throw new ServiceException("告警查询异常"); + } + resData = getDataTable(list); + HashMap alarmNewNum =new HashMap<>(); + //20230329 JKJ 全量告警 不需要去获取当前用户没点击过的告警数量,提高查询效率 + //实时告警 + if("0".equals(alarmDTO.getAlarmStatus())) { + + YwAlarmDTONoPage alarmNoPage = new YwAlarmDTONoPage(); + BeanUtils.copyBeanProp(alarmNoPage, alarmDTO); + alarmNoPage.setSiteType(siteType); + alarmNoPage.setAlarmType("wx"); + alarmNewNum.put("wx",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + //其它类型没有网络类型 + alarmNoPage.setSiteType(null); + alarmNoPage.setAlarmType("cs"); + alarmNewNum.put("cs",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("dh"); + alarmNewNum.put("dh",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("agis"); + alarmNewNum.put("agis",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("wifi"); + alarmNewNum.put("wifi",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("voip"); + Long voipNum = ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage); + alarmNewNum.put("voip",voipNum); + //前端用的是tel + alarmNewNum.put("tel",voipNum); + } + else + { + alarmNewNum.put("cs", 0L); + alarmDTO.setAlarmType("dh"); + alarmNewNum.put("dh", 0L); + alarmDTO.setAlarmType("wx"); + alarmNewNum.put("wx", 0L); + alarmDTO.setAlarmType("agis"); + alarmNewNum.put("agis", 0L); + alarmDTO.setAlarmType("wifi"); + alarmNewNum.put("wifi", 0L); + alarmDTO.setAlarmType("voip"); + alarmNewNum.put("voip", 0L); + } + resData.setMaps(alarmNewNum); + return resData; + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + + @ApiOperation("根据条件获取告警") + @PostMapping("/newlist3") + public TableDataInfo newlist3(@RequestBody YwAlarmDTO alarmDTO) + { + SysUser user = getLoginUser().getUser(); + alarmDTO.setUserId(user.getUserId()); + if(ObjectUtils.isNotEmpty(alarmDTO.getIsRefresh())) + { + //1自动刷新,0是手动刷新 + if(0==alarmDTO.getIsRefresh()) { + //如果是用户点击的查询,保存当前用户查询的场馆,便于用户重新登录后自动勾选场馆查询 + redisCache.setCacheObject(CacheConstants.YW_ALARM_LAST_VENUES + getUserId(), alarmDTO.getVenues(), 3, TimeUnit.DAYS); + } + } + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (alarmDTO.getVenues().size()==0) { +// boolean isAll = user.isAdmin(user); +// alarmDTO.setIsAll(isAll); +// //管理员不需要设置场馆 +// if(!isAll) { +// List venueList = new ArrayList(); +// yw_sceneService.getVenueByUser(user).forEach( +// venue -> { +// venueList.add(venue.getId()); +// } +// ); +// alarmDTO.setVenues(venueList); +// } + List lstScene = yw_sceneService.getVenueByUserCanNoData(user,false); + + if(lstScene.isEmpty()) + { + alarmDTO.setIsAll(true); + } + + if(!lstScene.isEmpty()) + { + List venueList = new ArrayList(); + for(YwScene ywScene : lstScene) { + venueList.add(ywScene.getId()); + } + alarmDTO.setVenues(venueList); + } + } + TableDataInfo resData = null; + + if(!alarmDTO.getAlarmType().isEmpty()) + { + if("tel".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setAlarmType("voip"); + } + if(GenUtils.arraysContains(AlarmConstants.ALARMS,alarmDTO.getAlarmType())) + { + if(alarmDTO.getPageNum()<=0) + { + alarmDTO.setPageNum(1); + } + if(alarmDTO.getPageSize()<=0) + { + alarmDTO.setPageSize(10); + } +// if(StringUtils.isEmpty(alarmDTO.getOrderBy())) +// { +// alarmDTO.setOrderBy(" t1.alarm_time desc"); +// } + + String siteType = alarmDTO.getSiteType(); + + if(!"wx".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setSiteType(null); + } + + List list = null; + try { + list = ywAlarmViewService.getYwAlarmByDto(alarmDTO); + } + catch (Exception ex) + { + throw new ServiceException("告警查询异常"); + } + resData = getDataTable(list); +// HashMap alarmNewNum =new HashMap<>(); + //20230329 JKJ 全量告警 不需要去获取当前用户没点击过的告警数量,提高查询效率 + //实时告警 +// if("0".equals(alarmDTO.getAlarmStatus())) { + +// YwAlarmDTONoPage alarmNoPage = new YwAlarmDTONoPage(); +// BeanUtils.copyBeanProp(alarmNoPage, alarmDTO); +// alarmNoPage.setSiteType(siteType); +// alarmNoPage.setAlarmType("wx"); +// alarmNewNum.put("wx",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); +// //其它类型没有网络类型 +// alarmNoPage.setSiteType(null); +// alarmNoPage.setAlarmType("cs"); +// alarmNewNum.put("cs",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); +// alarmNoPage.setAlarmType("dh"); +// alarmNewNum.put("dh",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); +// alarmNoPage.setAlarmType("agis"); +// alarmNewNum.put("agis",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); +// alarmNoPage.setAlarmType("wifi"); +// alarmNewNum.put("wifi",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); +// alarmNoPage.setAlarmType("voip"); +// Long voipNum = ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage); +// alarmNewNum.put("voip",voipNum); +// //前端用的是tel +// alarmNewNum.put("tel",voipNum); +// } +// else +// { +// alarmNewNum.put("cs", 0L); +// alarmDTO.setAlarmType("dh"); +// alarmNewNum.put("dh", 0L); +// alarmDTO.setAlarmType("wx"); +// alarmNewNum.put("wx", 0L); +// alarmDTO.setAlarmType("agis"); +// alarmNewNum.put("agis", 0L); +// alarmDTO.setAlarmType("wifi"); +// alarmNewNum.put("wifi", 0L); +// alarmDTO.setAlarmType("voip"); +// alarmNewNum.put("voip", 0L); +// } +// resData.setMaps(alarmNewNum); + return resData; + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + @ApiOperation("根据条件未恢复告警数量") + @PostMapping("/num") + public HashMap newlistNum(@RequestBody YwAlarmDTO alarmDTO) { + SysUser user = getLoginUser().getUser(); + alarmDTO.setUserId(user.getUserId()); + + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (alarmDTO.getVenues().size() == 0) { +// boolean isAll = user.isAdmin(user); +// alarmDTO.setIsAll(isAll); +// //管理员不需要设置场馆 +// if (!isAll) { +// List venueList = new ArrayList(); +// yw_sceneService.getVenueByUser(user).forEach( +// venue -> { +// venueList.add(venue.getId()); +// } +// ); +// alarmDTO.setVenues(venueList); +// } + List lstScene = yw_sceneService.getVenueByUserCanNoData(user,false); + + if(lstScene.isEmpty()) + { + alarmDTO.setIsAll(true); + } + + if(!lstScene.isEmpty()) + { + List venueList = new ArrayList(); + for(YwScene ywScene : lstScene) { + venueList.add(ywScene.getId()); + } + alarmDTO.setVenues(venueList); + } + } + if (!alarmDTO.getAlarmType().isEmpty()) { + if ("tel".equals(alarmDTO.getAlarmType())) { + alarmDTO.setAlarmType("voip"); + } + if (GenUtils.arraysContains(AlarmConstants.ALARMS, alarmDTO.getAlarmType())) { + + String siteType = alarmDTO.getSiteType(); + + if(!"wx".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setSiteType(null); + } + + HashMap alarmNewNum = new HashMap<>(); + if ("0".equals(alarmDTO.getAlarmStatus())) { + + YwAlarmDTONoPage alarmNoPage = new YwAlarmDTONoPage(); + BeanUtils.copyBeanProp(alarmNoPage, alarmDTO); + alarmNoPage.setSiteType(siteType); + alarmNoPage.setAlarmType("wx"); + alarmNewNum.put("wx", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + //其它类型没有网络类型 + alarmNoPage.setSiteType(null); + alarmNoPage.setAlarmType("cs"); + alarmNewNum.put("cs", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("dh"); + alarmNewNum.put("dh", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("agis"); + alarmNewNum.put("agis", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("wifi"); + alarmNewNum.put("wifi", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("voip"); + Long voipNum = ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage); + alarmNewNum.put("voip", voipNum); + //前端用的是tel + alarmNewNum.put("tel", voipNum); + } else { + alarmNewNum.put("cs", 0L); + alarmDTO.setAlarmType("dh"); + alarmNewNum.put("dh", 0L); + alarmDTO.setAlarmType("wx"); + alarmNewNum.put("wx", 0L); + alarmDTO.setAlarmType("agis"); + alarmNewNum.put("agis", 0L); + alarmDTO.setAlarmType("wifi"); + alarmNewNum.put("wifi", 0L); + alarmDTO.setAlarmType("voip"); + alarmNewNum.put("voip", 0L); + } + return alarmNewNum; + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + @ApiOperation("根据条件获取告警") + @PostMapping("/list") + public TableDataInfo newlist2(@RequestBody YwAlarmDTO alarmDTO) + { + alarmDTO.setIsAPP(false); + + SysUser user = getLoginUser().getUser(); + + if(ObjectUtils.isNotEmpty(alarmDTO.getIsRefresh())) + { + //1自动刷新,0是手动刷新 + if(0==alarmDTO.getIsRefresh()) { + //如果是用户点击的查询,保存当前用户查询的场馆,便于用户重新登录后自动勾选场馆查询 + redisCache.setCacheObject(CacheConstants.YW_ALARM_LAST_VENUES + getUserId(), alarmDTO.getVenues(), 3, TimeUnit.DAYS); + } + } + + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (alarmDTO.getVenues().size()==0) { + boolean isAll= user.isAdmin(user); + alarmDTO.setIsAll(isAll); + if(!isAll) { + List venueList = new ArrayList(); + yw_sceneService.getVenueByUser(user).forEach( + venue -> { + venueList.add(venue.getId()); + } + ); + alarmDTO.setVenues(venueList); + } + + } + + alarmDTO.setUserId(user.getUserId()); + + TableDataInfo resData = null; + //获取告警数据 + if("wx".equals(alarmDTO.getAlarmType())) + { + resData = ywAlarmWXService.GetAlarmList(alarmDTO); + } + + if("cs".equals(alarmDTO.getAlarmType())) + { + resData = ywAlarmCSService.GetAlarmList(alarmDTO); + } + + if("dh".equals(alarmDTO.getAlarmType())) + { + resData = ywAlarmDHService.GetAlarmList(alarmDTO);; + } + + if(ObjectUtils.isEmpty(resData)) + { + throw new ServiceException("数据未接入"); + } + + alarmDTO.setPageNum(1); + HashMap alarmNewNum =new HashMap<>(); + alarmDTO.setAlarmType("cs"); + alarmNewNum.put("cs",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + alarmDTO.setAlarmType("dh"); + alarmNewNum.put("dh",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + alarmDTO.setAlarmType("wx"); + alarmNewNum.put("wx",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + resData.setMaps(alarmNewNum); + + return resData; + } + + + @ApiOperation("根据用户ID获取最新的告警数量") + @PostMapping("/newAlarmNum") + public AjaxResult newAlarmNum(@RequestBody YwAlarmDTO alarmDTO) + { + //20230316 jkj 管理员类的不加判断场馆的条件,所有场馆的数据 + SysUser user = getLoginUser().getUser(); + + //获取告警数据 + List ywAlarmNewNumVos= ywAlarmViewService.GetNewAlarmNum(user.getUserId(),user.isAdmin(user)); + + return AjaxResult.success("操作成功",JSONObject.toJSONString(ywAlarmNewNumVos)); + + + } + + @ApiOperation("根据用户ID获取最新的告警数量") + @GetMapping("/newAlarmNum/{userId}") + public AjaxResult newAlarmNum(@PathVariable String userId) + { + +// Long longUserId=Long.parseLong(userId); + //20230316 jkj 管理员类的不加判断场馆的条件,所有场馆的数据 + SysUser user = getLoginUser().getUser(); + + //获取告警数据 + List ywAlarmNewNumVos= ywAlarmViewService.GetNewAlarmNum(user.getUserId(),user.isAdmin(user)); + + return AjaxResult.success("操作成功",JSONObject.toJSONString(ywAlarmNewNumVos)); + + + } + + @Log(title = "导出告警列表数据", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(@RequestBody YwAlarmDTO alarmDTO) throws IllegalAccessException { + + alarmDTO.setPageNum(1); + alarmDTO.setPageSize(Integer.MAX_VALUE); + + //非APP端 + alarmDTO.setIsAPP(false); + + alarmDTO.setIsExport(true); + + SysUser user = getLoginUser().getUser(); + + alarmDTO.setUserId(user.getUserId()); + + if(ObjectUtils.isEmpty(alarmDTO.getVenues())) + { + boolean isAll = user.isAdmin(user); + alarmDTO.setIsAll(isAll); + if (!isAll) { + List venueList = new ArrayList(); + yw_sceneService.getVenueByUser(user).forEach( + venue -> { + venueList.add(venue.getId()); + } + ); + alarmDTO.setVenues(venueList); + } + } + + if(ObjectUtils.isNotEmpty(alarmDTO.getVenues())) { + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (alarmDTO.getVenues().size() == 0) { + boolean isAll = user.isAdmin(user); + alarmDTO.setIsAll(isAll); + if (!isAll) { + List venueList = new ArrayList(); + yw_sceneService.getVenueByUser(user).forEach( + venue -> { + venueList.add(venue.getId()); + } + ); + alarmDTO.setVenues(venueList); + } + } + } + + if(!alarmDTO.getAlarmType().isEmpty()) { + + if("tel".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setAlarmType("voip"); + } + + String alarmlabel = DictUtils.getDictLabel("yw_alarm_specialty", alarmDTO.getAlarmType()); + + if (GenUtils.arraysContains(AlarmConstants.ALARMS, alarmDTO.getAlarmType())) { + + List list = ywAlarmViewService.getYwAlarmByDto(alarmDTO); + + if(!"wx".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setSiteType(null); + } + + //序号 + int i= 1; + + for (YwAlarmViewVo vo : list) + { + + vo.setId(i); + vo.setSiteNameExport(vo.getSite_name()); + vo.setNetNameExport(vo.getNet_name()); + + LocalDateTime start = LocalDateTimeUtil.parse(vo.getStart(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + + LocalDateTime clear = LocalDateTimeUtil.now(); + + if(StringUtils.isNotEmpty(vo.getEnd())) + { + clear = LocalDateTimeUtil.parse(vo.getEnd(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } + + Duration between = LocalDateTimeUtil.between(start, clear); + + vo.setDuration(between.toHours()+"小时"+ between.toMinutes()%60+"分钟"); + + if(StringUtils.isNotEmpty(vo.getRecord())) + { + String rec = ""; + JSONArray jsonArray = JSONArray.parseArray(vo.getRecord()); + for (int j = 0; j< jsonArray.size(); j++) { + JSONObject jsonObject = jsonArray.getJSONObject(j); + if(StringUtils.isNotEmpty(jsonObject.getString("title"))&&StringUtils.isNotEmpty( jsonObject.getString("info"))) + { + String title = jsonObject.getString("title"); + String info = jsonObject.getString("info"); + rec += title + "\r\n" + info + "\r\n"; + } + } + vo.setRecordExport(rec); + } + i++; + } + + ExcelUtil util = new ExcelUtil(YwAlarmViewVo.class); + //改EXCEL的字段名,无法穿透父类字段 + util.hideColumn("site_name","net_name"); + switch (alarmDTO.getAlarmType()) + { + case "wx": + util.setExcelAnnotationValue("siteNameExport","name","基站名称",YwAlarmViewVo.class); + util.setExcelAnnotationValue("netNameExport","name","网元名称",YwAlarmViewVo.class); + break; + case "cs": + util.setExcelAnnotationValue("siteNameExport","name","设备名称",YwAlarmViewVo.class); + util.setExcelAnnotationValue("netNameExport","name","端口号",YwAlarmViewVo.class); + break; + case "dh": + util.setExcelAnnotationValue("siteNameExport","name","基站名称",YwAlarmViewVo.class); + util.setExcelAnnotationValue("netNameExport","name","设备名称",YwAlarmViewVo.class); + break; + case "agis": + case "wifi": + case "voip": + util.setExcelAnnotationValue("siteNameExport","name","网元名称",YwAlarmViewVo.class); + util.setExcelAnnotationValue("netNameExport","name","端口",YwAlarmViewVo.class); + break; + } + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + + util.exportExcel(response, list, alarmlabel+"主告警数据"); + + return; + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + @Log(title = "告警列表数据", businessType = BusinessType.EXPORT) + @PostMapping("/exportDetail") + public void exportDetail(@RequestBody YwAlarmDTO alarmDTO) throws IllegalAccessException { + + alarmDTO.setPageNum(1); + alarmDTO.setPageSize(Integer.MAX_VALUE); + + //非APP端 + alarmDTO.setIsAPP(false); + + alarmDTO.setIsExport(true); + + SysUser user = getLoginUser().getUser(); + + alarmDTO.setUserId(user.getUserId()); + + if(ObjectUtils.isEmpty(alarmDTO.getVenues())) + { + boolean isAll = user.isAdmin(user); + alarmDTO.setIsAll(isAll); + if (!isAll) { + List venueList = new ArrayList(); + yw_sceneService.getVenueByUser(user).forEach( + venue -> { + venueList.add(venue.getId()); + } + ); + alarmDTO.setVenues(venueList); + } + } + + if(ObjectUtils.isNotEmpty(alarmDTO.getVenues())) { + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (alarmDTO.getVenues().size() == 0) { + boolean isAll = user.isAdmin(user); + alarmDTO.setIsAll(isAll); + if (!isAll) { + List venueList = new ArrayList(); + yw_sceneService.getVenueByUser(user).forEach( + venue -> { + venueList.add(venue.getId()); + } + ); + alarmDTO.setVenues(venueList); + } + } + } + + if(!alarmDTO.getAlarmType().isEmpty()) { + + if("tel".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setAlarmType("voip"); + } + + String alarmlabel = DictUtils.getDictLabel("yw_alarm_specialty", alarmDTO.getAlarmType()); + + if (GenUtils.arraysContains(AlarmConstants.ALARMS, alarmDTO.getAlarmType())) { + + if(!"wx".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setSiteType(null); + } + + List list = ywAlarmViewService.getYwAlarmByDto(alarmDTO); + + List newList = new ArrayList<>(); + + for (YwAlarmViewVo vo : list) + { + int i=1; + for(YwAlarmVo chird : vo.getAlarmchildren()) + { + chird.setId(i); + i++; + } + + newList.addAll(vo.getAlarmchildren()); + } + + for (YwAlarmVo vo : newList) + { + + LocalDateTime start = LocalDateTimeUtil.parse(vo.getStart(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + + LocalDateTime clear = LocalDateTimeUtil.now(); + + if(StringUtils.isNotEmpty(vo.getEnd())) + { + clear = LocalDateTimeUtil.parse(vo.getEnd(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } + + Duration between = LocalDateTimeUtil.between(start, clear); + + vo.setDuration(between.toHours()+"小时"+ between.toMinutes()%60+"分钟"); + + } + + + ExcelUtil util = new ExcelUtil(YwAlarmVo.class); + + switch (alarmDTO.getAlarmType()) + { + case "wx": + util.setExcelAnnotationValue("site_name","name","基站名称",YwAlarmVo.class); + util.setExcelAnnotationValue("net_name","name","网元名称",YwAlarmVo.class); + break; + case "cs": + util.setExcelAnnotationValue("site_name","name","设备名称",YwAlarmVo.class); + util.setExcelAnnotationValue("net_name","name","端口号",YwAlarmVo.class); + break; + case "dh": + util.setExcelAnnotationValue("site_name","name","基站名称",YwAlarmVo.class); + util.setExcelAnnotationValue("net_name","name","设备名称",YwAlarmVo.class); + break; + case "agis": + case "wifi": + case "voip": + util.setExcelAnnotationValue("site_name","name","网元名称",YwAlarmVo.class); + util.setExcelAnnotationValue("net_name","name","端口",YwAlarmVo.class); + break; + } + + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + + util.exportExcel(response, newList, alarmlabel+"告警明细数据"); + + return; + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + + @ApiOperation("根据processId获取告警详情") + @GetMapping("/info/{processId}") + public TableDataInfo info(@PathVariable String processId) + { + return getDataTable(ywAlarmViewService.GetAlarmInfoList(processId,false)); + } + + @ApiOperation("根据GroupId获取告警详情") + @GetMapping("/info/group/{groupId}") + public TableDataInfo infoByGroup(@PathVariable String groupId) + { + return getDataTable(ywAlarmViewService.getYwAlarmInfoListByGroup(groupId,false)); + } + + @Log(title = "告警挂起记录", businessType = BusinessType.INSERT) + @ApiOperation("根据条件新增告警挂起的记录") + @PostMapping("/insert/hanguplog") + public AjaxResult list(@RequestBody YwAlarmHangupLogDTO ywAlarmHangupLogDTO) throws Exception + { + try + { + if(ObjectUtils.isEmpty(ywAlarmHangupLogDTO.getHangupUserId())) + { + SysUser user = getLoginUser().getUser(); + ywAlarmHangupLogDTO.setHangupUserId(user.getUserId()); + } + if(ywAlarmHangupLogService.insertYwAlarmHangupLog(ywAlarmHangupLogDTO)) + { + return AjaxResult.success(); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + return AjaxResult.error(); + } + + @ApiOperation("获取告警问题") + @GetMapping("/question") + public TableDataInfo getAlarmQuestion(String spec) + { + return getDataTable(ywAlarmService.getYwAlarmQuestionList(spec)); + } + + @Log(title = "用户查询告警记录", businessType = BusinessType.INSERT) + @ApiOperation("告警操作") + @PostMapping("/operate") + public AjaxResult add(@RequestBody YwAlarmOprateLog ywAlarmOprateLog) + { + if(ywAlarmOprateLogService.saveOrUpdate(ywAlarmOprateLog)){ + return success(); + } + return error(); + } + + @Log(title = "用户回填告警", businessType = BusinessType.UPDATE) + @ApiOperation("告警回填反馈人和反馈时间") + @PostMapping("/feedback") + public AjaxResult feedback(@RequestBody YwAlarmDTO ywAlarmDTO) + { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + yw_alarm_deal_log yw_alarm_deal_log =new yw_alarm_deal_log(); + yw_alarm_deal_log.setDealUser(ywAlarmDTO.getDealUser()); + yw_alarm_deal_log.setDealStatus(ywAlarmDTO.getDealStatus()); + updateWrapper.eq("flw_processid", ywAlarmDTO.getProcessId()); + if(alarm_deal_logMapper.update(yw_alarm_deal_log,updateWrapper)>0){ + return success(); + } + return error(); + } + + @Log(title = "用户手工恢复告警", businessType = BusinessType.INSERT) + @ApiOperation("告警恢复时间") + @PostMapping("/alarmClear") + public AjaxResult alarmClear(@RequestBody YwAlarmDTO alarmDTO) + { + boolean res = ywAlarmService.YwAlarmClear(alarmDTO); + if(res) + { + return success(); + } + return error(); + } + + @Log(title = "源告警关闭", businessType = BusinessType.UPDATE) + @ApiOperation("源告警关闭") + @PostMapping("/alarmClose") + public AjaxResult originAlarmClose(@RequestBody YwAlarmDTO alarmDTO) + { + boolean res = ywAlarmService.YwAlarmClose(alarmDTO); + if(res) + { + return success(); + } + return error(); + } + + @Log(title = "用户手工恢复告警批量关闭", businessType = BusinessType.UPDATE) + @ApiOperation("用户手工恢复告警批量关闭") + @PostMapping("/alarmClearBatch") + @Transactional + public AjaxResult alarmClearBatch(@RequestBody List lstAlarmDTO) + { + for (YwAlarmDTO ywAlarmDTO : lstAlarmDTO) + { + boolean res = ywAlarmService.YwAlarmClear(ywAlarmDTO); + if(!res) + { + return error(); + } + } + return success(); + } + + + @Log(title = "告警记录", businessType = BusinessType.UPDATE) + @ApiOperation("告警记录") + @PostMapping("/record") + public AjaxResult record(@RequestBody YwAlarmDTO ywAlarmDTO) + { + if(ObjectUtils.isEmpty(ywAlarmDTO.getRecord())) + { + return AjaxResult.error("记录内容不允许为空"); + } + // String text_record = ywAlarmDTO.getRecords().stream().collect(Collectors.joining("##@##")); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + yw_alarm_deal_log yw_alarm_deal_log =new yw_alarm_deal_log(); + yw_alarm_deal_log.setRecord(ywAlarmDTO.getRecord()); + updateWrapper.eq("group_id", ywAlarmDTO.getAlarmId()); + updateWrapper.eq("is_new","0"); + if(alarm_deal_logMapper.update(yw_alarm_deal_log,updateWrapper)>0){ + return success(); + } + return error(); + } + + @Log(title = "批量告警记录阶段处理", businessType = BusinessType.UPDATE) + @ApiOperation("批量告警记录阶段处理") + @PostMapping("/recordBatch") + public AjaxResult recordBatch(@RequestBody YwAlarmDTO ywAlarmDTO) + { + if(ObjectUtils.isEmpty(ywAlarmDTO.getAlarmIds()) || ObjectUtils.isEmpty(ywAlarmDTO.getStepInfo())) + { + return AjaxResult.error("缺少处理的参数"); + } + + if(ywAlarmDTO.getAlarmIds().length == 0) + { + return AjaxResult.error("alarmIds没有值"); + } + + if(StringUtils.isEmpty(ywAlarmDTO.getStepInfo().getTitle())||StringUtils.isEmpty(ywAlarmDTO.getStepInfo().getInfo())) + { + return AjaxResult.error("stepInfo没有值"); + } + + for(Long alarmId : ywAlarmDTO.getAlarmIds()) + { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("group_id", alarmId); + queryWrapper.eq("is_new","0"); + List lstAlarm = alarm_deal_logMapper.selectList(queryWrapper); + if(lstAlarm.isEmpty()) + { + continue; + } + String record = lstAlarm.get(0).getRecord(); + JSONArray arrayRecord = new JSONArray(); + if(StringUtils.isNotEmpty(record)) + { + arrayRecord = JSONArray.parseArray(record); + } + JSONObject jsonRecord = new JSONObject(); + jsonRecord.put("title",ywAlarmDTO.getStepInfo().getTitle()); + jsonRecord.put("info",ywAlarmDTO.getStepInfo().getInfo()); + arrayRecord.add(jsonRecord); + record = JSONArray.toJSONString(arrayRecord); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + yw_alarm_deal_log yw_alarm_deal_log =new yw_alarm_deal_log(); + yw_alarm_deal_log.setRecord(record); + updateWrapper.eq("group_id", alarmId); + updateWrapper.eq("is_new","0"); + alarm_deal_logMapper.update(yw_alarm_deal_log,updateWrapper); + } + return success(); + } + + @ApiOperation("告警回填反馈人和反馈时间") + @GetMapping("/alarmBriefing") + public AjaxResult alarmBriefing() + { + ywAlarmService.eastcomYwSendAlarmBriefingSchedule(); + return AjaxResult.success(); + } + + @ApiOperation("查询亚运衍生告警") + @PostMapping("/hmAlarmDerive/list") + public TableDataInfo derivelist(@RequestBody YwAlarmDTO alarmDTO) { + startPage(); + return getDataTable(hmAlarmDeriveService.getAlarmDerive(alarmDTO)); + } + + + @ApiOperation("查询亚运衍生告警") + @PostMapping("/hmAlarmDerive/export") + public void deriveExport(@RequestBody YwAlarmDTO alarmDTO) throws IllegalAccessException { + alarmDTO.setPageNum(1); + alarmDTO.setPageSize(Integer.MAX_VALUE); + List list = hmAlarmDeriveService.getAlarmDerive(alarmDTO); + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + ExcelUtil util = new ExcelUtil(HmAlarmDerive.class); + util.exportExcel(response, list, "亚运事件告警"); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwDrsConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwDrsConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..ea3b4d74c7a82d8e2593fd92f56f0d42eb87ed42 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwDrsConfigController.java @@ -0,0 +1,124 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwDrsConfig; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwDrsConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsConfigVO; +import com.ruoyi.eastcom_yw.service.YwDrsConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * DRS配置表 前端控制器 + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Api(tags = "DRS配置表") +@RestController +@RequestMapping("/eastcom_yw/ywDrsConfig") +@Slf4j +@RequiredArgsConstructor +public class YwDrsConfigController extends BaseController { + + private final YwDrsConfigService ywDrsConfigService; + + /** + * DRS配置表列表 + */ + @ApiOperation(value = "DRS配置表列表", notes = "DRS配置表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwDrsConfigQO qo) { + List list = ywDrsConfigService.getData(qo); + return getDataTable(list); + } + + + /** + * DRS配置表分页列表 + */ + @ApiOperation(value = "DRS配置表分页列表", notes = "DRS配置表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwDrsConfigQO qo) { + PageInfo page = ywDrsConfigService.getDataByPage(qo); + return getDataTable(page.getList(), page.getTotal()); + } + + /** + * 获取DRS配置表详情 + */ + @ApiOperation(value = "DRS配置表详情", notes = "DRS配置表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywDrsConfigService.fetchById(id)); + } + + /** + * 新增或修改DRS配置表 + */ + @Log(title = "新增或修改DRS配置表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改DRS配置表", notes = "新增或修改DRS配置表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwDrsConfigDTO dto) { + ywDrsConfigService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除DRS配置表 + */ + @Log(title = "根据id删除DRS配置表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除DRS配置表", notes = "根据id删除DRS配置表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywDrsConfigService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除DRS配置表 + */ + @Log(title = "根据id批量删除DRS配置表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除DRS配置表", notes = "根据id批量删除DRS配置表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywDrsConfigService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "DRS配置表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwDrsConfig.class); + List list = util.importExcel(file.getInputStream()); + ywDrsConfigService.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * DRS配置表导出 + */ + @ApiOperation(value = "DRS配置表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwDrsConfigQO qo) { + ywDrsConfigService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwDrsTempTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwDrsTempTaskController.java new file mode 100644 index 0000000000000000000000000000000000000000..f26545f0697d6ca9427046b16d6e01c03e7d8e02 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwDrsTempTaskController.java @@ -0,0 +1,142 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsTempTaskDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwDrsTempTaskQO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsTempTaskVO; +import com.ruoyi.eastcom_yw.service.YwDrsTempTaskService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.time.LocalDate; +import java.util.List; + +/** + *

+ * DRS临时任务表 前端控制器 + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Api(tags = "DRS临时任务表") +@RestController +@RequestMapping("/eastcom_yw/ywDrsTempTask") +@Slf4j +@RequiredArgsConstructor +public class YwDrsTempTaskController extends BaseController { + + private final YwDrsTempTaskService ywDrsTempTaskService; + + /** + * DRS临时任务表列表 + */ + @ApiOperation(value = "DRS临时任务表列表", notes = "DRS临时任务表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwDrsTempTaskQO qo) { + List list = ywDrsTempTaskService.getData(qo); + return getDataTable(list); + } + + + /** + * DRS临时任务表分页列表 + */ + @ApiOperation(value = "DRS临时任务表分页列表", notes = "DRS临时任务表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwDrsTempTaskQO qo) { + PageInfo page = ywDrsTempTaskService.getDataByPage(qo); + return getDataTable(page.getList(), page.getTotal()); + } + + /** + * 获取DRS临时任务表详情 + */ + @ApiOperation(value = "DRS临时任务表详情", notes = "DRS临时任务表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywDrsTempTaskService.fetchById(id)); + } + + + @GetMapping(value = "/test") + public String test() { + return "5555"; + } + + /** + * 新增或修改DRS临时任务表 + */ + @Log(title = "新增或修改DRS临时任务表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改DRS临时任务表", notes = "新增或修改DRS临时任务表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwDrsTempTaskDTO dto) { + ywDrsTempTaskService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除DRS临时任务表 + */ + @Log(title = "根据id删除DRS临时任务表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除DRS临时任务表", notes = "根据id删除DRS临时任务表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywDrsTempTaskService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除DRS临时任务表 + */ + @Log(title = "根据id批量删除DRS临时任务表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除DRS临时任务表", notes = "根据id批量删除DRS临时任务表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywDrsTempTaskService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @ApiOperation(value = "DRS临时任务表导入") + @Log(title = "DRS临时任务表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwDrsTempTaskVO.class); + List list = util.importExcel(file.getInputStream()); + return ywDrsTempTaskService.importData(list, updateSupport); + } + + + /** + * DRS临时任务表导出 + */ + @ApiOperation(value = "DRS临时任务表导出") + @Log(title = "DRS临时任务表导出", businessType = BusinessType.EXPORT) + @PostMapping(value = "/export") + public void export(@RequestBody YwDrsTempTaskQO qo) { + ywDrsTempTaskService.export(qo); + } + + + /** + * DRS预览 + */ + @ApiOperation(value = "DRS预览", notes = "DRS预览") + @GetMapping(value = "/drsPreview/{venueId}/{date}") + public TableDataInfo drsPreview(@PathVariable("venueId") Long venueId, @PathVariable("date") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate date) { + return getDataTable(ywDrsTempTaskService.drsPreview(venueId,date)); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwKpiConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwKpiConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..a12b7360ac23d6b8d17e924a288ea6eaf2a9bdf1 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwKpiConfigController.java @@ -0,0 +1,135 @@ +package com.ruoyi.web.controller.eastcom_yw; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwKpiConfig; +import com.ruoyi.eastcom_yw.domain.dto.YwKpiConfigDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwKpiConfigQO; +import com.ruoyi.eastcom_yw.domain.vo.YwKpiConfigVO; +import com.ruoyi.eastcom_yw.service.YwKpiConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + + import org.springframework.stereotype.Controller; +import org.springframework.web.multipart.MultipartFile; + + +import javax.validation.Valid; +import java.util.List; + +/** +*

+ * 指标字段阈值配置表 前端控制器 + *

+* +* @author yqf +* @since 2023-04-11 +*/ +@Api(tags = "指标字段阈值配置表") +@RestController +@RequestMapping("/eastcom_yw/ywKpiConfig") +@Slf4j +@RequiredArgsConstructor +public class YwKpiConfigController extends BaseController { + + private final YwKpiConfigService ywKpiConfigService; + + /** + * 指标字段阈值配置表列表 + */ + @ApiOperation(value = "指标字段阈值配置表列表", notes = "指标字段阈值配置表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwKpiConfigQO qo) { + List list = ywKpiConfigService.getData(qo); + return getDataTable(list); + } + + + /** + * 指标字段阈值配置表分页列表 + */ + @ApiOperation(value = "指标字段阈值配置表分页列表", notes = "指标字段阈值配置表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwKpiConfigQO qo) { + IPage page = ywKpiConfigService.getDataByPage(qo); + return getDataTable(page.getRecords(),page.getTotal()); + } + + /** + * 获取指标字段阈值配置表详情 + */ + @ApiOperation(value = "指标字段阈值配置表详情", notes = "指标字段阈值配置表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywKpiConfigService.fetchById(id)); + } + + /** + * 新增或修改指标字段阈值配置表 + */ + @Log(title = "新增或修改指标字段阈值配置表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改指标字段阈值配置表", notes = "新增或修改指标字段阈值配置表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwKpiConfigDTO dto) { + ywKpiConfigService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除指标字段阈值配置表 + */ + @Log(title = "根据id删除指标字段阈值配置表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除指标字段阈值配置表", notes = "根据id删除指标字段阈值配置表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywKpiConfigService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除指标字段阈值配置表 + */ + @Log(title = "根据id批量删除指标字段阈值配置表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除指标字段阈值配置表", notes = "根据id批量删除指标字段阈值配置表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywKpiConfigService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "指标字段阈值配置表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwKpiConfig.class); + List list = util.importExcel(file.getInputStream()); + ywKpiConfigService.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * 指标字段阈值配置表导出 + */ + @ApiOperation(value = "指标字段阈值配置表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwKpiConfigQO qo){ + ywKpiConfigService.export(qo); + } + + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwKpiController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwKpiController.java new file mode 100644 index 0000000000000000000000000000000000000000..430a2a70015b1c4d6c5ac067fb7c6f02d0c06abe --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwKpiController.java @@ -0,0 +1,366 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.fastjson2.JSONWriter; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.pagehelper.PageInfo; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.qo.DpKpiMonitorQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellMonitorQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiMinQO; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.sunlm.domain.class_dp_scene_control; +import com.ruoyi.sunlm.domain.class_dp_scene_seat_info; +import com.ruoyi.sunlm.mapper.DpApiMapper; +import com.ruoyi.sunlm.mapper.dpYayunMapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.text.StringEscapeUtils; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Api(tags = "性能指标") +@RestController +@RequestMapping("/eastcom_yw") +@Slf4j +@RequiredArgsConstructor +public class YwKpiController extends BaseController { + + + private final PmKpi4gCellService pmKpi4gCellService; + + private final PmKpi5gCellService pmKpi5gCellService; + + + private final PmKpi4gMinService pmKpi4gMinService; + + private final PmKpi5gMinService pmKpi5gMinService; + + private final PmKpiMonitorCellService pmKpiMonitorCellService; + + private final YwSceneService ywSceneService; + + @Resource + DpApiMapper dpApiMapper; + + /** + * 场馆小区级15分钟指标分页列表 + */ + @ApiOperation(value = "场馆小区级15分钟指标分页列表", notes = "场馆小区级15分钟指标分页列表") + @RequestMapping(value = "/kpi/getFifteenList", method = RequestMethod.POST) + public TableDataInfo getFifteenList(@Validated @RequestBody PmKpiCellQO qo) { + if(null == qo.getVenueid()){ + SysUser user = SecurityUtils.getLoginUser().getUser(); +// //场馆集合 +// if (!user.isAdmin(user)) { +// List ywScenes = ywSceneService.getVenueByUser(user); +// Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); +// Integer[] sceneIds = new Integer[venueIds.length]; +// for (int i = 0; i < venueIds.length; i++) { +// sceneIds[i] = venueIds[i].intValue(); +// } +// qo.setVenueIds(sceneIds); +// } + List lstScene = ywSceneService.getVenueByUserCanNoData(user,false); + if(!lstScene.isEmpty()) + { + Long[] venueIds = lstScene.stream().map(YwScene::getId).toArray(Long[]::new); + Integer[] sceneIds = new Integer[venueIds.length]; + for (int i = 0; i < venueIds.length; i++) { + sceneIds[i] = venueIds[i].intValue(); + } + qo.setVenueIds(sceneIds); + } + } + if (qo.getNetType().equals(KpiConstants.YW_NETTYPE_4G)) { + IPage page = pmKpi4gCellService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } else { + IPage page = pmKpi5gCellService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + } + + + /** + * 场馆小区级15分钟指标导出 + */ + @ApiOperation(value = "场馆小区级15分钟指标导出") + @PostMapping(value = "/kpi/exportFifteenList") + public void exportFifteenList(@Validated @RequestBody PmKpiCellQO qo) { + if(null == qo.getVenueid()){ + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!user.isAdmin(user)) { + List ywScenes = ywSceneService.getVenueByUser(user); + Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + Integer[] sceneIds = new Integer[venueIds.length]; + for (int i = 0; i < venueIds.length; i++) { + sceneIds[i] = venueIds[i].intValue(); + } + qo.setVenueIds(sceneIds); + } + } + if (qo.getNetType().equals(KpiConstants.YW_NETTYPE_4G)) { + pmKpi4gCellService.export(qo); + } else { + pmKpi5gCellService.export(qo); + } + + } + + + /** + * 场馆小区级1分钟指标分页列表 + */ + @ApiOperation(value = "场馆小区级1分钟指标分页列表", notes = "场馆小区级1分钟指标分页列表") + @RequestMapping(value = "/kpi/getOneMinList", method = RequestMethod.POST) + public TableDataInfo getOneMinList(@Validated @RequestBody PmKpiMinQO qo) { + if(null == qo.getVenueid()){ + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!user.isAdmin(user)) { + List ywScenes = ywSceneService.getVenueByUser(user); + Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + Integer[] sceneIds = new Integer[venueIds.length]; + for (int i = 0; i < venueIds.length; i++) { + sceneIds[i] = venueIds[i].intValue(); + } + qo.setVenueIds(sceneIds); + } + } + if (qo.getNetType().equals(KpiConstants.YW_NETTYPE_4G)) { + IPage page = pmKpi4gMinService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } else { + IPage page = pmKpi5gMinService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + } + + + /** + * 场馆小区级1分钟指标导出 + */ + @ApiOperation(value = "场馆小区级1分钟指标导出") + @PostMapping(value = "/kpi/exportOneList") + public void exportOneList(@Validated @RequestBody PmKpiMinQO qo) { + if(null == qo.getVenueid()){ + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!user.isAdmin(user)) { + List ywScenes = ywSceneService.getVenueByUser(user); + Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + Integer[] sceneIds = new Integer[venueIds.length]; + for (int i = 0; i < venueIds.length; i++) { + sceneIds[i] = venueIds[i].intValue(); + } + qo.setVenueIds(sceneIds); + } + } + + if (qo.getNetType().equals(KpiConstants.YW_NETTYPE_4G)) { + pmKpi4gMinService.export(qo); + } else { + pmKpi5gMinService.export(qo); + } + + } + + @ApiOperation(value = "指标监控分页查询") + @PostMapping(value = "/kpi/getMonitorCellList") + public TableDataInfo getMonitorCellList(@Validated @RequestBody PmKpiCellMonitorQO qo) { + if(null == qo.getSceneid()){ + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!user.isAdmin(user)) { + List ywScenes = ywSceneService.getVenueByUser(user); + Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + Integer[] sceneIds = new Integer[venueIds.length]; + for (int i = 0; i < venueIds.length; i++) { + sceneIds[i] = venueIds[i].intValue(); + } + qo.setSceneids(sceneIds); + } + } + PageInfo page = pmKpiMonitorCellService.getMonitorCellList(qo); + return getDataTable(page.getList(), page.getTotal()); + + + } + + + @ApiOperation(value = "场内坐席数据接口") + @GetMapping(value = "/daping/get_seat_data") + @Anonymous + public TableDataInfo getSeatData(@RequestParam(required = false) Integer sceneid, + @RequestParam(required = false) String nettype, + @RequestParam(required = false) String datatype, + @RequestParam(required = false) String kpiname, + HttpServletRequest request) { + DpKpiMonitorQO qo = new DpKpiMonitorQO(); + class_dp_scene_control dpData = dpApiMapper.get_scene_control(); + if (null != sceneid) { + qo.setSceneid(sceneid); + } + if (null != nettype && !nettype.equals("")) { + qo.setNettype(nettype); + } else { + qo.setNettype(dpData.getNettype()); + } + if (null != datatype && !datatype.equals("")) { + qo.setDatatype(datatype); + } else { + qo.setDatatype(dpData.getMintype() + "分钟"); + } + if (null != kpiname && !kpiname.equals("")) { + qo.setKpiname(kpiname); + } else { + qo.setKpiname(dpData.getKpiname()); + } + + //用于演示版本控制 + Integer getsceneruntype = dpApiMapper.getsceneruntype(); + if(getsceneruntype == 0){ + //取特定时间表数据 + LocalDateTime maxtime = dpApiMapper.getmaxtime(); + qo.setSceneruntype(KpiConstants.YW_SCENE_RUNTYPE); + qo.setDatatype(KpiConstants.YW_DATATYPE_15); + qo.setMaxtime(maxtime); + } + + PageInfo page = pmKpiMonitorCellService.getDpMonitorCellList(qo); + return getDataTable(page.getList(), page.getTotal()); + + } + + + @ApiOperation(value = "场外点数据接口") + @GetMapping(value = "/daping/get_point_data") + @Anonymous + public TableDataInfo getPointData(@RequestParam(required = false) Integer sceneid, + @RequestParam(required = false) String nettype, + @RequestParam(required = false) String datatype, + @RequestParam(required = false) String kpiname, + HttpServletRequest request) { + DpKpiMonitorQO qo = new DpKpiMonitorQO(); + class_dp_scene_control dpData = dpApiMapper.get_scene_control(); + if (null != sceneid) { + qo.setSceneid(sceneid); + } + if (null != nettype && !nettype.equals("")) { + qo.setNettype(nettype); + } else { + qo.setNettype(dpData.getNettype()); + } + if (null != datatype && !datatype.equals("")) { + qo.setDatatype(datatype); + } else { + qo.setDatatype(dpData.getMintype() + "分钟"); + } + if (null != kpiname && !kpiname.equals("")) { + qo.setKpiname(kpiname); + } else { + qo.setKpiname(dpData.getKpiname()); + } + qo.setSeatno(KpiConstants.QUERYSEAT); + + //用于演示版本控制 + Integer getsceneruntype = dpApiMapper.getsceneruntype(); + if(getsceneruntype == 0){ + //取特定时间表数据 + LocalDateTime maxtime = dpApiMapper.getmaxtime(); + qo.setSceneruntype(KpiConstants.YW_SCENE_RUNTYPE); + qo.setDatatype(KpiConstants.YW_DATATYPE_15); + qo.setMaxtime(maxtime); + } + + PageInfo page = pmKpiMonitorCellService.getDpMonitorCellList(qo); + return getDataTable(page.getList(), page.getTotal()); + + } + + /** + * 修改大屏控制查询接口 + * + * @param dpcSeneControlVo 实体对象 + * @return 修改结果 + */ + @PutMapping(value = "/kpi/updateDpcSeneControl") + public AjaxResult updateDpcSeneControl(@Validated @RequestBody DpcSeneControlVo dpcSeneControlVo) { + return AjaxResult.success(pmKpiMonitorCellService.updateDpcSeneControl(dpcSeneControlVo)); + } + + + /** + * 获取4G最新有数据的时间 + * + * @return + */ + @GetMapping(value = "/kpi/getLastTime") + @RepeatSubmit(enable = false,interval = 1000) + public Map getLastTime(){ + + Long[] venueIds = null; + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!user.isAdmin(user)) { + List ywScenes = ywSceneService.getVenueByUser(user); + venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + } + + return pmKpi4gCellService.getLastTime(venueIds); + } + + /** + * 简报打印数据 + * + * @return + */ + @PostMapping(value = "/kpi/getReportKpi") + public AjaxResult getReportKpi(@RequestBody PmKpiCellMonitorQO qo) { + KpiVenueReportVo reportKpi = pmKpiMonitorCellService.getReportKpi(qo.getSceneid(), qo.getStarttime(), qo.getEndtime(),60); + return AjaxResult.success(reportKpi); + } + + + /** + * 简报打印json数据 + * + * @return + */ + @PostMapping(value = "/kpi/getReportKpiByJson") + public AjaxResult getReportKpiByJson(@RequestBody PmKpiCellMonitorQO qo) { + JSONObject reportKpi = pmKpiMonitorCellService.getReportKpiByJson(qo.getSceneid(), qo.getStarttime(), qo.getEndtime(),15); + return AjaxResult.success(reportKpi); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwMaterialsBatchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwMaterialsBatchController.java new file mode 100644 index 0000000000000000000000000000000000000000..2530f2cced5a47008ea978c057f372963dad959a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwMaterialsBatchController.java @@ -0,0 +1,142 @@ +package com.ruoyi.web.controller.eastcom_yw; + + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.service.YwMaterialsBatchService; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * 物资批次表(YwMaterialsBatch)表控制层 + * + * @author makejava + * @since 2023-04-10 15:37:55 + */ +@RestController +@RequestMapping("/eastcom_yw/ywMaterialsBatch") +public class YwMaterialsBatchController extends BaseController { + /** + * 服务对象 + */ + @Resource + private YwMaterialsBatchService ywMaterialsBatchService; + + /** + * 分页查询所有数据 + * + * @param page 分页对象 + * @param ywMaterialsBatch 查询实体 + * @return 所有数据 + */ + @GetMapping + public AjaxResult selectAll(Page page, YwMaterialsBatch ywMaterialsBatch) { + return AjaxResult.success(this.ywMaterialsBatchService.page(page, new QueryWrapper<>(ywMaterialsBatch))); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public AjaxResult selectOne(@PathVariable Serializable id) { + return AjaxResult.success(this.ywMaterialsBatchService.getById(id)); + } + + /** + * 新增数据 + * + * @param ywMaterialsBatch 实体对象 + * @return 新增结果 + */ + @PostMapping + public AjaxResult insert(@RequestBody YwMaterialsBatch ywMaterialsBatch) { + return AjaxResult.success(this.ywMaterialsBatchService.save(ywMaterialsBatch)); + } + + /** + * 修改数据 + * + * @param ywMaterialsBatch 实体对象 + * @return 修改结果 + */ + @PutMapping + public AjaxResult update(@RequestBody YwMaterialsBatch ywMaterialsBatch) { + return AjaxResult.success(this.ywMaterialsBatchService.updateById(ywMaterialsBatch)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @DeleteMapping + public AjaxResult delete(@RequestParam("idList") List idList) { + return AjaxResult.success(this.ywMaterialsBatchService.removeByIds(idList)); + } + + @PostMapping("/import") + public AjaxResult importXls(@RequestBody Map map) throws Exception { + + String path; + String orderId; + + try { + path = map.get("path"); + orderId = map.get("orderid"); + } catch (Exception e) { + return AjaxResult.error("参数不一致"); + } + + if (StringUtils.isEmpty(path)) { + return AjaxResult.error("参数校验不通过"); + } + + String realPath = RuoYiConfig.getProfile() + path.replaceFirst("/profile", ""); + File file = new File(realPath); + if (file.isDirectory()) { + return AjaxResult.error("只能传文件类型"); + } + if (!file.exists()) { + return AjaxResult.error("文件不存在"); + } + FileInputStream fileInputStream = null; + List y; + try { + fileInputStream = new FileInputStream(file); + ExcelUtil util = new ExcelUtil<>(YwMaterialsInform.class); + y = util.importExcel(fileInputStream); + } catch (Exception e) { + e.printStackTrace(); + return AjaxResult.error(); + } finally { + if (fileInputStream != null) { + try { + fileInputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return ywMaterialsBatchService.importExcel(orderId, y, file); + } + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeBriefingController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeBriefingController.java new file mode 100644 index 0000000000000000000000000000000000000000..583707cf78b3ec913a7dae2f0f9c6dd342f39558 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeBriefingController.java @@ -0,0 +1,189 @@ +package com.ruoyi.web.controller.eastcom_yw; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeBriefing; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeBriefingDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeBriefingQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeBriefingVO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; +import com.ruoyi.eastcom_yw.service.YwNoticeBriefingService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知通告简报计划表 前端控制器 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Api(tags = "通知通告简报计划表") +@RestController +@RequestMapping("/eastcom_yw/ywNoticeBriefing") +@Slf4j +@RequiredArgsConstructor +public class YwNoticeBriefingController extends BaseController { + + private final YwNoticeBriefingService ywNoticeBriefingService; + + /** + * 通知通告简报计划表列表 + */ + @ApiOperation(value = "通知通告简报计划表列表", notes = "通知通告简报计划表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwNoticeBriefingQO qo) { + List list = ywNoticeBriefingService.getData(qo); + return getDataTable(list); + } + + + /** + * 通知通告简报计划表分页列表 + */ + @ApiOperation(value = "通知通告简报计划表分页列表", notes = "通知通告简报计划表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwNoticeBriefingQO qo) { + IPage page = ywNoticeBriefingService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 获取通知通告简报计划表详情 + */ + @ApiOperation(value = "通知通告简报计划表详情", notes = "通知通告简报计划表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywNoticeBriefingService.fetchById(id)); + } + + /** + * 新增或修改通知通告简报计划表 + */ + @Log(title = "新增或修改通知通告简报计划表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改通知通告简报计划表", notes = "新增或修改通知通告简报计划表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwNoticeBriefingDTO dto) { + ywNoticeBriefingService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 启用停用简报 + */ + @Log(title = "启用停用简报", businessType = BusinessType.INSERT) + @ApiOperation(value = "启用停用简报", notes = "启用停用简报") + @PostMapping(value = "/onOrOff") + public AjaxResult onOrOff(@RequestBody @Validated YwNoticeBriefingDTO dto) { + YwNoticeBriefing ywNoticeBriefing = new YwNoticeBriefing(); + ywNoticeBriefing.setId(dto.getId()); + ywNoticeBriefing.setSysNormalDisable(dto.getSysNormalDisable()); + ywNoticeBriefingService.updateById(ywNoticeBriefing); + return AjaxResult.success(); + } + + /** + * 根据id删除通知通告简报计划表 + */ + @Log(title = "根据id删除通知通告简报计划表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除通知通告简报计划表", notes = "根据id删除通知通告简报计划表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywNoticeBriefingService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除通知通告简报计划表 + */ + @Log(title = "根据id批量删除通知通告简报计划表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除通知通告简报计划表", notes = "根据id批量删除通知通告简报计划表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywNoticeBriefingService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "通知通告简报计划表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwNoticeBriefingVO.class); + List list = util.importExcel(file.getInputStream()); + return ywNoticeBriefingService.importData(list, updateSupport); + } + + + /** + * 通知通告简报计划表导出 + */ + @ApiOperation(value = "通知通告简报计划表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwNoticeBriefingQO qo) { + ywNoticeBriefingService.export(qo); + } + + /** + * 返回新增简报定制时可选模板 + */ + @Log(title = "返回新增简报定制时可选模板", businessType = BusinessType.OTHER) + @ApiOperation(value = "返回新增简报定制时可选模板", notes = "返回新增简报定制时可选模板") + @GetMapping(value = "/getModel") + public AjaxResult getModel(@RequestParam(required = false) Long venueId,@RequestParam(required = false) String modelSuitType) { + List model = ywNoticeBriefingService.getModel(venueId,modelSuitType); + return AjaxResult.success(model); + } + + + /** + * 当前时间段场馆级简报 + */ + @ApiOperation(value = "当前时间段场馆级简报") + @GetMapping(value = "/getData/{venueId}") + public AjaxResult getData(@PathVariable Long venueId) { + String s = ywNoticeBriefingService.getJson(venueId, 15).toJSONString(); + return AjaxResult.success(s); + } + + /** + * 当前时间段场馆级简报 + */ + @ApiOperation(value = "当前时间段场馆级简报") + @GetMapping(value = "/assemblyVenueBriefing/{venueId}/{time}/{modelId}") + public String assemblyVenueBriefing(@PathVariable Long venueId,@PathVariable String time,@PathVariable Long modelId) { + return ywNoticeBriefingService.assemblyVenueBriefing(LocalDateTime.parse(time),venueId,60,modelId); + } + + /** + * 当前时间段场馆级简报JSON + */ + @ApiOperation(value = "当前时间段场馆级简报JSON") + @GetMapping(value = "/assemblyVenueBriefingJSON/{venueId}/{time}") + public String assemblyVenueBriefingJSON(@PathVariable Long venueId,@PathVariable String time) { + return ywNoticeBriefingService.assemblyVenueJsonToGetURL(LocalDateTime.parse(time),venueId,60); + } + + /** + * 当前时间段地市级简报 + */ + @ApiOperation(value = "当前时间段地市级简报") + @GetMapping(value = "/assemblyCityBriefing/{city}/{time}") + public String assemblyCityBriefing(@PathVariable String city,@PathVariable String time) { + return ywNoticeBriefingService.assemblyCityBriefing(LocalDateTime.parse(time),city,60,1L); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeHandworkController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeHandworkController.java new file mode 100644 index 0000000000000000000000000000000000000000..1a8f10439a559653599deb4ba317151da9f50246 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeHandworkController.java @@ -0,0 +1,124 @@ +package com.ruoyi.web.controller.eastcom_yw; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeHandwork; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeHandworkDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeHandworkQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeHandworkVO; +import com.ruoyi.eastcom_yw.service.YwNoticeHandworkService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * 通知通告手工通知计划表 前端控制器 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Api(tags = "通知通告手工通知计划表") +@RestController +@RequestMapping("/eastcom_yw/ywNoticeHandwork") +@Slf4j +@RequiredArgsConstructor +public class YwNoticeHandworkController extends BaseController { + + private final YwNoticeHandworkService ywNoticeHandworkService; + + /** + * 通知通告手工通知计划表列表 + */ + @ApiOperation(value = "通知通告手工通知计划表列表", notes = "通知通告手工通知计划表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwNoticeHandworkQO qo) { + List list = ywNoticeHandworkService.getData(qo); + return getDataTable(list); + } + + + /** + * 通知通告手工通知计划表分页列表 + */ + @ApiOperation(value = "通知通告手工通知计划表分页列表", notes = "通知通告手工通知计划表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwNoticeHandworkQO qo) { + IPage page = ywNoticeHandworkService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 获取通知通告手工通知计划表详情 + */ + @ApiOperation(value = "通知通告手工通知计划表详情", notes = "通知通告手工通知计划表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywNoticeHandworkService.fetchById(id)); + } + + /** + * 新增或修改通知通告手工通知计划表 + */ + @Log(title = "新增或修改通知通告手工通知计划表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改通知通告手工通知计划表", notes = "新增或修改通知通告手工通知计划表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwNoticeHandworkDTO dto) { + Long id = ywNoticeHandworkService.saveOrUpdate(dto); + return AjaxResult.success(id); + } + + /** + * 根据id删除通知通告手工通知计划表 + */ + @Log(title = "根据id删除通知通告手工通知计划表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除通知通告手工通知计划表", notes = "根据id删除通知通告手工通知计划表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywNoticeHandworkService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除通知通告手工通知计划表 + */ + @Log(title = "根据id批量删除通知通告手工通知计划表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除通知通告手工通知计划表", notes = "根据id批量删除通知通告手工通知计划表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywNoticeHandworkService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "通知通告手工通知计划表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwNoticeHandwork.class); + List list = util.importExcel(file.getInputStream()); + return ywNoticeHandworkService.importData(list, updateSupport); + } + + + /** + * 通知通告手工通知计划表导出 + */ + @ApiOperation(value = "通知通告手工通知计划表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwNoticeHandworkQO qo) { + ywNoticeHandworkService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeHandworkdetailController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeHandworkdetailController.java new file mode 100644 index 0000000000000000000000000000000000000000..f6e5746cbc7096b92da19332e475d7a0e6954cfa --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeHandworkdetailController.java @@ -0,0 +1,124 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeHandworkdetail; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeHandworkdetailDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeHandworkdetailQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeHandworkdetailVO; +import com.ruoyi.eastcom_yw.service.YwNoticeHandworkdetailService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * 通知通告手工通知审核表 前端控制器 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Api(tags = "通知通告手工通知审核表") +@RestController +@RequestMapping("/eastcom_yw/ywNoticeHandworkdetail") +@Slf4j +@RequiredArgsConstructor +public class YwNoticeHandworkdetailController extends BaseController { + + private final YwNoticeHandworkdetailService ywNoticeHandworkdetailService; + + /** + * 通知通告手工通知审核表列表 + */ + @ApiOperation(value = "通知通告手工通知审核表列表", notes = "通知通告手工通知审核表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwNoticeHandworkdetailQO qo) { + List list = ywNoticeHandworkdetailService.getData(qo); + return getDataTable(list); + } + + + /** + * 通知通告手工通知审核表分页列表 + */ + @ApiOperation(value = "通知通告手工通知审核表分页列表", notes = "通知通告手工通知审核表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwNoticeHandworkdetailQO qo) { + IPage page = ywNoticeHandworkdetailService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 获取通知通告手工通知审核表详情 + */ + @ApiOperation(value = "通知通告手工通知审核表详情", notes = "通知通告手工通知审核表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywNoticeHandworkdetailService.fetchById(id)); + } + + /** + * 新增或修改通知通告手工通知审核表 + */ + @Log(title = "新增或修改通知通告手工通知审核表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改通知通告手工通知审核表", notes = "新增或修改通知通告手工通知审核表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwNoticeHandworkdetailDTO dto) { + ywNoticeHandworkdetailService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除通知通告手工通知审核表 + */ + @Log(title = "根据id删除通知通告手工通知审核表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除通知通告手工通知审核表", notes = "根据id删除通知通告手工通知审核表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywNoticeHandworkdetailService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除通知通告手工通知审核表 + */ + @Log(title = "根据id批量删除通知通告手工通知审核表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除通知通告手工通知审核表", notes = "根据id批量删除通知通告手工通知审核表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywNoticeHandworkdetailService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "通知通告手工通知审核表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwNoticeHandworkdetail.class); + List list = util.importExcel(file.getInputStream()); + ywNoticeHandworkdetailService.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * 通知通告手工通知审核表导出 + */ + @ApiOperation(value = "通知通告手工通知审核表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwNoticeHandworkdetailQO qo) { + ywNoticeHandworkdetailService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeListController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeListController.java new file mode 100644 index 0000000000000000000000000000000000000000..cf8209d82685939e152f0448cf1d854aa4fbe85c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeListController.java @@ -0,0 +1,124 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeList; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeListDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeListQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeListVO; +import com.ruoyi.eastcom_yw.service.YwNoticeListService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * 通知通告记录表 前端控制器 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Api(tags = "通知通告记录表") +@RestController +@RequestMapping("/eastcom_yw/ywNoticeList") +@Slf4j +@RequiredArgsConstructor +public class YwNoticeListController extends BaseController { + + private final YwNoticeListService ywNoticeListService; + + /** + * 通知通告记录表列表 + */ + @ApiOperation(value = "通知通告记录表列表", notes = "通知通告记录表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwNoticeListQO qo) { + List list = ywNoticeListService.getData(qo); + return getDataTable(list); + } + + + /** + * 通知通告记录表分页列表 + */ + @ApiOperation(value = "通知通告记录表分页列表", notes = "通知通告记录表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwNoticeListQO qo) { + IPage page = ywNoticeListService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 获取通知通告记录表详情 + */ + @ApiOperation(value = "通知通告记录表详情", notes = "通知通告记录表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywNoticeListService.fetchById(id)); + } + + /** + * 新增或修改通知通告记录表 + */ + @Log(title = "新增或修改通知通告记录表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改通知通告记录表", notes = "新增或修改通知通告记录表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwNoticeListDTO dto) { + ywNoticeListService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除通知通告记录表 + */ + @Log(title = "根据id删除通知通告记录表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除通知通告记录表", notes = "根据id删除通知通告记录表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywNoticeListService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除通知通告记录表 + */ + @Log(title = "根据id批量删除通知通告记录表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除通知通告记录表", notes = "根据id批量删除通知通告记录表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywNoticeListService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "通知通告记录表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwNoticeList.class); + List list = util.importExcel(file.getInputStream()); + ywNoticeListService.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * 通知通告记录表导出 + */ + @ApiOperation(value = "通知通告记录表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwNoticeListQO qo) { + ywNoticeListService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeModelController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeModelController.java new file mode 100644 index 0000000000000000000000000000000000000000..9b0379cd8efe6054bb1d704588b75c95c18c1746 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeModelController.java @@ -0,0 +1,192 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeModel; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeModelDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeModelQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; +import com.ruoyi.eastcom_yw.service.YwNoticeModelService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * 通知通告模板表 前端控制器 + *

+ * + * @author ck + * @since 2023-04-07 + */ +@Api(tags = "通知通告模板表") +@RestController +@RequestMapping("/eastcom_yw/ywNoticeModel") +@Slf4j +@RequiredArgsConstructor +public class YwNoticeModelController extends BaseController { + + private final YwNoticeModelService ywNoticeModelService; + + /** + * 通知通告模板表列表 + *

+ * showdoc + * + * @param + * @return {"code":"0","message":"操作成功","data": {}} + * @catalog 通知通告模板表/通知通告模板表管理 + * @title 通知通告模板表列表 + * @description 通知通告模板表列表 + * @method POST + * @url /api/happyCanteen/list + * @return_param + */ + @ApiOperation(value = "通知通告模板表列表", notes = "通知通告模板表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwNoticeModelQO qo) { + List list = ywNoticeModelService.getData(qo); + return getDataTable(list); + } + + + /** + * 通知通告模板表分页列表 + *

+ * showdoc + * + * @param + * @return {"code":"0","message":"操作成功","data": {}} + * @catalog 通知通告模板表/通知通告模板表管理 + * @title 通知通告模板表分页列表 + * @description 通知通告模板表分页列表 + * @method POST + * @url /api/happyCanteen/pageList + * @return_param + */ + @ApiOperation(value = "通知通告模板表分页列表", notes = "通知通告模板表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwNoticeModelQO qo) { + IPage page = ywNoticeModelService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 获取通知通告模板表详情 + *

+ * showdoc + * + * @param + * @return {"code":"0","message":"操作成功","data": {}} + * @catalog 通知通告模板表/通知通告模板表管理 + * @title 获取通知通告模板表详情 + * @description 获取通知通告模板表详情 + * @method Get + * @url /api/happyCanteen/fetchById/{id} + * @return_param + */ + @ApiOperation(value = "通知通告模板表详情", notes = "通知通告模板表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywNoticeModelService.fetchById(id)); + } + + /** + * 新增或修改通知通告模板表 + *

+ * showdoc + * + * @param + * @return {"code":"0","message":"操作成功","data": {}} + * @catalog 通知通告模板表/通知通告模板表管理 + * @title 新增或修改通知通告模板表 + * @description 新增或修改通知通告模板表 + * @method POST + * @url /api/happyCanteen/saveOrUpdate + * @return_param + */ + @Log(title = "新增或修改通知通告模板表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改通知通告模板表", notes = "新增或修改通知通告模板表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwNoticeModelDTO dto) { + ywNoticeModelService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除通知通告模板表 + *

+ * showdoc + * + * @param + * @return {"code":"0","message":"操作成功","data": {}} + */ + @Log(title = "根据id删除通知通告模板表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除通知通告模板表", notes = "根据id删除通知通告模板表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywNoticeModelService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除通知通告模板表 + *

+ * showdoc + * + * @param + * @return {"code":"0","message":"操作成功","data": {}} + * @catalog 通知通告模板表/通知通告模板表管理 + * @title 根据id批量删除通知通告模板表 + * @description 根据id批量删除通知通告模板表 + * @method POST + * @url /api/happyCanteen/deleteByIdBatch + * @return_param + */ + @Log(title = "根据id批量删除通知通告模板表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除通知通告模板表", notes = "根据id批量删除通知通告模板表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywNoticeModelService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "通知通告模板表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwNoticeModel.class); + List list = util.importExcel(file.getInputStream()); + return ywNoticeModelService.importData(list, updateSupport); + } + + /** + * 通知通告模板表导出 + *

+ * showdoc + * + * @param + * @catalog 通知通告模板表/通知通告模板表管理 + * @title 通知通告模板表导出 + * @description 通知通告模板表导出 + * @method POST + * @url /api/happyCanteen/export + * @return_param + */ + @ApiOperation(value = "通知通告模板表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwNoticeModelQO qo) { + ywNoticeModelService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeObjectController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeObjectController.java new file mode 100644 index 0000000000000000000000000000000000000000..72acdfa303e8dbf5afcf206bb2d99680220909e7 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeObjectController.java @@ -0,0 +1,138 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwNoticeObject; +import com.ruoyi.eastcom_yw.domain.dto.YwNoticeObjectDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeObjectQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeObjectVO; +import com.ruoyi.eastcom_yw.service.YwNoticeObjectService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * 通知通告对象表 前端控制器 + *

+ * + * @author ck + * @since 2023-04-11 + */ +@Api(tags = "通知通告对象表") +@RestController +@RequestMapping("/eastcom_yw/ywNoticeObject") +@Slf4j +@RequiredArgsConstructor +public class YwNoticeObjectController extends BaseController { + + private final YwNoticeObjectService ywNoticeObjectService; + + /** + * 通知通告对象表列表 + */ + @ApiOperation(value = "通知通告对象表列表", notes = "通知通告对象表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwNoticeObjectQO qo) { + List list = ywNoticeObjectService.getData(qo); + return getDataTable(list); + } + + + /** + * 通知通告对象表分页列表 + */ + @ApiOperation(value = "通知通告对象表分页列表", notes = "通知通告对象表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwNoticeObjectQO qo) { + IPage page = ywNoticeObjectService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 返回前端所需对象列表 + */ + @ApiOperation(value = "返回前端所需对象列表", notes = "返回前端所需对象列表") + @RequestMapping(value = "allObject", method = RequestMethod.GET) + public TableDataInfo allObject() { + Map map = ywNoticeObjectService.allObject(); + TableDataInfo tableDataInfo = new TableDataInfo(); + tableDataInfo.setMaps((HashMap)map); + return tableDataInfo; + } + + /** + * 获取通知通告对象表详情 + */ + @ApiOperation(value = "通知通告对象表详情", notes = "通知通告对象表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywNoticeObjectService.fetchById(id)); + } + + /** + * 新增或修改通知通告对象表 + */ + @Log(title = "新增或修改通知通告对象表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改通知通告对象表", notes = "新增或修改通知通告对象表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwNoticeObjectDTO dto) { + ywNoticeObjectService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除通知通告对象表 + */ + @Log(title = "根据id删除通知通告对象表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除通知通告对象表", notes = "根据id删除通知通告对象表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywNoticeObjectService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除通知通告对象表 + */ + @Log(title = "根据id批量删除通知通告对象表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除通知通告对象表", notes = "根据id批量删除通知通告对象表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywNoticeObjectService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "通知通告对象表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwNoticeObjectVO.class); + List list = util.importExcel(file.getInputStream()); + return ywNoticeObjectService.importData(list, updateSupport); + } + + + /** + * 通知通告对象表导出 + */ + @ApiOperation(value = "通知通告对象表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwNoticeObjectQO qo) { + ywNoticeObjectService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeUserController.java new file mode 100644 index 0000000000000000000000000000000000000000..2bb3f893dc65f5969da60c850b7ecbf81cf65a39 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwNoticeUserController.java @@ -0,0 +1,272 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import cn.hutool.core.date.LocalDateTimeUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.common.enums.OrderStatus; +import com.ruoyi.cmcc_gm.common.enums.OrderType; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsOrderLogVo; +import com.ruoyi.cmcc_gm.service.YwMaterialsOrderLogService; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.constant.TaskConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.common.enums.FlowDealStatus; +import com.ruoyi.eastcom_yw.common.enums.WireTaskType; +import com.ruoyi.eastcom_yw.domain.YwWireTaskLog; +import com.ruoyi.eastcom_yw.domain.dto.YwDataDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeModelQO; +import com.ruoyi.eastcom_yw.domain.vo.YwNoticeModelVO; +import com.ruoyi.eastcom_yw.mapper.YwNoticeUserMapper; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.eastcom_yw.domain.SysNotice; + +import com.ruoyi.system.service.ISysUserService; +import com.ruoyi.eastcom_yw.service.SysNoticeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.text.StringSubstitutor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * + * @author jkj + * @since 2023-01-12 + */ + +@Api("告警信息管理") +@RestController +@RequestMapping("/eastcom_yw") +public class YwNoticeUserController extends BaseController { + + @Autowired + private YwNoticeUserMapper ywNoticeUserMapper; + + @Autowired + private YwMaterialsOrderLogService ywMaterialsOrderLogService; + + @Autowired + private YwWireTaskLogService ywWireTaskLogService; + + @Autowired + private SysNoticeService sysNoticeService; + + @Autowired + private YwNoticeModelService ywNoticeModelService; + + @Autowired + private ISysUserService userService; + + +// @Log(title = "工作流站内提醒", businessType = BusinessType.INSERT) + //这里加日志会因为没有登录用户导致报错 + @ApiOperation("根据流程ID发送当前需要提醒的用户") + @GetMapping("/notice") + @Anonymous + public AjaxResult notice(String flwId,String taskId,String groupId,String type) + { + Map valuesMap = new HashMap(); + SysNotice notice=new SysNotice(); + + Long userId = 0L; + + if(type.contains(TaskConstants.WIRE)) + { + //获取布线的任务信息 + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper(); + lambdaQueryWrapper.eq(YwWireTaskLog::getFlwProcessid,flwId); + + List wires = ywWireTaskLogService.list(lambdaQueryWrapper); + + if(wires.isEmpty()) + { + logger.error(flwId+"没有查询到相关的布线任务"); + return AjaxResult.error(flwId+"没有查询到相关的布线任务"); + } + + YwWireTaskLog wire = wires.get(0); + + String wireLabel = WireTaskType.getLabelByCode(wire.getTaskType()); + + notice.setNoticeTitle("场馆" + wireLabel + "任务下发通知"); + String noticeContent = "提醒:${场馆名称}${任务类型}任务${布线工单号}已流转到你处,请及时处理"; + + //获取布线需要提醒的内容 + YwNoticeModelQO ywNoticeModelQO = new YwNoticeModelQO(); + ywNoticeModelQO.setModelScene("-1"); + if(wire.getTaskType() == 1) { + ywNoticeModelQO.setModelScene("9"); + } + if(wire.getTaskType() == 2) { + ywNoticeModelQO.setModelScene("10"); + } + List noticeModelVOList = ywNoticeModelService.getData(ywNoticeModelQO); + + if(!noticeModelVOList.isEmpty()) + { + notice.setNoticeTitle(noticeModelVOList.get(0).getModelName()); + noticeContent = noticeModelVOList.get(0).getModelContent(); + } + + if(wire.getDealStatus().equals(FlowDealStatus.BUSINESS_STATUS_3.getCode())) + { + //找到被驳回的处理人 + String [] roles = wire.getRoleKey().split(","); + Long venueId = wire.getVenueId(); + for(String role : roles) + { + groupId = venueId+"|"+role; + } + + noticeContent = "提醒:${场馆名称}${任务类型}任务${布线工单号}已驳回,请及时处理"; + } + + + valuesMap.put("场馆名称", wire.getVenueName()); + valuesMap.put("布线工单号", wire.getWireTaskId()); + + + valuesMap.put("任务类型", wireLabel); + + + StringSubstitutor sub = new StringSubstitutor(valuesMap); + String content= sub.replace(noticeContent); + notice.setNoticeContent(content); + notice.setNoticeType("3"); + + } + else if(type.contains(TaskConstants.MATERIAL)) + { + + YwMaterialsSearchDTO dto =new YwMaterialsSearchDTO(); + dto.setFlwId(flwId); + List orders = ywMaterialsOrderLogService.selectMaterialsOrderLog(dto); + + if(orders.isEmpty()) + { + logger.error(flwId+"没有查询到相关的物资工单"); + return AjaxResult.error(flwId+"没有查询到相关的物资工单"); + } + + YwMaterialsOrderLogVo order = orders.get(0); + + String orderTypelabel = OrderType.getLabelByCode(order.getOrderType()); + +// TOdo:物资的通知模板内容不够准确,暂不用 + notice.setNoticeTitle(orderTypelabel + "提醒"); + //获取布线需要提醒的内容 +// YwNoticeModelQO ywNoticeModelQO = new YwNoticeModelQO(); +// List noticeModelVOList = ywNoticeModelService.getData(ywNoticeModelQO); + + String noticeContent = ""; + + valuesMap.put("场馆名称", order.getInVenueName()); + + if (order.getOrderType() == OrderType.TK.getCode() || order.getOrderType() == OrderType.CK.getCode()) { + valuesMap.put("场馆名称", order.getOutVenueName()); + } + + valuesMap.put("工单类型",orderTypelabel); + valuesMap.put("工单号", order.getOrderId()); + + if(order.getDealStatus().equals(FlowDealStatus.BUSINESS_STATUS_3.getCode())) + { + userId = order.getApplyId(); + noticeContent = "提醒:${场馆名称}提交的${工单类型}申请${工单号}被驳回,请修改后重新提交申请"; + } + + if(!order.getDealStatus().equals(FlowDealStatus.BUSINESS_STATUS_3.getCode())) { + + if(order.getTaskStatus().equals(OrderStatus.DSH.getCode())) + { + userId = order.getCheckId(); + noticeContent = "提醒:${场馆名称}已提交${工单类型}申请${工单号},你有新的审核任务"; + } + + if(order.getTaskStatus().equals(OrderStatus.YSH.getCode())) + { + if (order.getOrderType() == OrderType.TK.getCode() || order.getOrderType() == OrderType.CK.getCode()|| order.getOrderType() == OrderType.DB.getCode()) { + noticeContent = "提醒:${工单号}已流转到你处,你有新的${工单类型}的出库任务"; + } + + if (order.getOrderType() == OrderType.SL.getCode() || order.getOrderType() == OrderType.RK.getCode()) { + noticeContent = "提醒:${工单号}已流转到你处,你有新的${工单类型}的入库任务"; + } + } + + if(order.getTaskStatus().equals(OrderStatus.YCK.getCode())) + { + noticeContent = "提醒:${工单号}已流转到你处,你有新的${工单类型}的入库任务"; + } + + + } + + StringSubstitutor sub = new StringSubstitutor(valuesMap); + String content= sub.replace(noticeContent); + notice.setNoticeContent(content); + notice.setNoticeType("3"); + } + + notice.setCreateTime(LocalDateTimeUtil.now()); + notice.setStatus("0"); + notice.setCreateBy("sys"); + + if(notice.getNoticeType().equals("3")) { + + String phoneNumber = ""; + + if(!groupId.contains("|")) + { + try { + SysUser user = userService.selectUserById(userId); + if(ObjectUtils.isNotEmpty(user)) { + phoneNumber = user.getPhonenumber(); + } + } + catch(Exception ex) { + logger.error(flwId+"出错了,groupId不正确"); + return AjaxResult.error(flwId+"出错了,groupId不正确"); + } + } + else + { + //中心库相关的人员,特殊处理,取全部的用户 + if(groupId.contains("centerstorage")) + { + groupId = groupId.split("\\|")[1]; + } + phoneNumber = ywNoticeUserMapper.getPhoneByGroupId(groupId); + } + + if (StringUtils.isEmpty(phoneNumber)) { + logger.error(flwId + "没有相关提醒人员,无法发送短信"); + return AjaxResult.error(flwId + "没有相关提醒人员,无法发送短信"); + } + + if (StringUtils.isNotEmpty(phoneNumber)) { + notice.setExpSendTime(LocalDateTimeUtil.now()); + notice.setReciveUserPhone(phoneNumber); + sysNoticeService.save(notice); + } + } + + return AjaxResult.success(); + } + + @PostMapping("/isRead") + public AjaxResult isRead(@RequestBody YwDataDTO ywDataDTO) + { + return toAjax(sysNoticeService.isReadNotice(ywDataDTO.getIds())); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwRoutInspectLogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwRoutInspectLogController.java new file mode 100644 index 0000000000000000000000000000000000000000..baa081a69afd6f7184c5878ad911ade88ab77ff8 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwRoutInspectLogController.java @@ -0,0 +1,39 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectLog; +import com.ruoyi.eastcom_yw.service.YwRoutInspectLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author los + */ +@Api("巡检计划反馈接口") +@RestController +@RequestMapping("/eastcom_yw/routInspectLog") +@RequiredArgsConstructor +public class YwRoutInspectLogController extends BaseController { + + private final YwRoutInspectLogService ywRoutInspectLogService; + + @ApiOperation("修改") + @PutMapping("") + public AjaxResult update(@RequestBody YwRoutInspectLog log) { + try { + ywRoutInspectLogService.updateLog(log); + + return AjaxResult.success(); + } catch (Exception e) { + e.printStackTrace(); + return AjaxResult.error(e.getMessage()); + } + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwRoutInspectPlanController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwRoutInspectPlanController.java new file mode 100644 index 0000000000000000000000000000000000000000..776d44b24d9eb45ed888e1d8700d6a4f39890c25 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwRoutInspectPlanController.java @@ -0,0 +1,297 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.EasyPoiExcelUtil; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectConfig; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectPlan; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectPlanExportDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectStatDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectTaskDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectConfigParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectPlanParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectStatParam; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectLogVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneVo; +import com.ruoyi.eastcom_yw.service.YwRoutInspectConfigService; +import com.ruoyi.eastcom_yw.service.YwRoutInspectPlanService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.apache.commons.collections.MapUtils; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.rmi.ServerException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @author huamile + */ +@Api("巡检计划管理") +@RestController +@RequestMapping("/eastcom_yw/routInspectPlan") +@RequiredArgsConstructor +public class YwRoutInspectPlanController extends BaseController { + + private final YwRoutInspectPlanService ywRoutInspectPlanService; + private final YwRoutInspectConfigService ywRoutInspectConfigService; + + private final YwSceneService yw_sceneService; + + @ApiOperation("获取巡检计划列表") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwRoutInspectConfigParam param) { + param = (YwRoutInspectConfigParam) yw_sceneService.validateUserVenues(param,YwRoutInspectConfigParam.class,"venueIds"); + try { + List list = ywRoutInspectPlanService.getList(param); + return getDataTable(list); + } + catch(Exception ex) + { + throw new ServiceException("查询异常,请稍后再试"); + } + } + + @ApiOperation("获取巡检记录列表") + @PostMapping("/plan/list") + public TableDataInfo planList(@RequestBody YwRoutInspectPlanParam param) { + try { + param = (YwRoutInspectPlanParam) yw_sceneService.validateUserVenues(param, YwRoutInspectPlanParam.class, "venueIds"); + return ywRoutInspectPlanService.getPlanList(param); + } + catch(Exception ex) + { + throw new ServiceException("查询异常,请稍后再试"); + } + } + + @ApiOperation("根据条件获取巡检任务统计汇总") + @PostMapping("/stat") + public AjaxResult stat(@RequestBody YwRoutInspectStatParam param) { + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + try { + Map data = ywRoutInspectPlanService.getStatData(param); + return AjaxResult.success(data); + } + catch(Exception ex) + { + return AjaxResult.error("查询异常,请稍后再试"); + } + } + + @ApiOperation("根据条件获取巡检任务统计列表") + @PostMapping("/stat/list") + public AjaxResult statList(@RequestBody YwRoutInspectStatParam param) { + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + try { + Map map = ywRoutInspectPlanService.getStatListData(param); + return AjaxResult.success(map); + } + catch(Exception ex) + { + return AjaxResult.error("查询异常,请稍后再试"); + } + } + + @ApiOperation("根据条件获取巡检结果统计汇总") + @PostMapping("/resultStat") + public AjaxResult resultStat(@RequestBody YwRoutInspectStatParam param) { + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + try { + Map data = ywRoutInspectPlanService.getResultStatData(param); + return AjaxResult.success(data); + } + catch(Exception ex) + { + return AjaxResult.error("查询异常,请稍后再试"); + } + } + + @ApiOperation("根据条件获取巡检结果统计列表") + @PostMapping("/resultStat/list") + public AjaxResult resultStatList(@RequestBody YwRoutInspectStatParam param) { + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + try { + Map map = ywRoutInspectPlanService.getResultStatListData(param); + return AjaxResult.success(map); + } + catch(Exception ex) + { + return AjaxResult.error("查询异常,请稍后再试"); + } + } + + @ApiOperation("根据processId获取巡检详情") + @GetMapping("/info/{processId}") + public TableDataInfo info(@PathVariable String processId) { + try { + return getDataTable(ywRoutInspectPlanService.getRoutInspectInfoList(processId)); + } + catch(Exception ex) + { + throw new ServiceException("查询异常,请稍后再试"); + } + } + + @ApiOperation("查巡检配置参数") + @PostMapping("/inspectConfigList") + public TableDataInfo inspectConfigList(@RequestBody YwRoutInspectConfigParam param) { + try { + List list = ywRoutInspectConfigService.getInspectConfigList(param); + return getDataTable(list); + } + catch(Exception ex) + { + throw new ServiceException("查询异常,请稍后再试"); + } + } + + @Log(title = "巡检计划", businessType = BusinessType.INSERT) + @ApiOperation("新增巡检计划") + @PostMapping + public AjaxResult create(@RequestBody YwInspectTaskDTO dto) { + try { + return ywRoutInspectPlanService.create(dto); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("根据jobNo查询巡检记录状态") + @GetMapping("/checkIfEdit") + public AjaxResult checkIfEdit(@RequestParam(name = "jobNo") String jobNo) { + try { + if (ywRoutInspectPlanService.checkPlanStatus(jobNo)) { + return AjaxResult.error("任务处理中,无法修改。"); + } else { + return AjaxResult.success(); + } + } catch (Exception e) { + e.printStackTrace(); + return AjaxResult.error(e.getMessage()); + } + } + + @Log(title = "巡检计划", businessType = BusinessType.UPDATE) + @ApiOperation("编辑巡检计划") + @PutMapping + public AjaxResult update(@RequestBody YwInspectTaskDTO dto) { + try { + if (ywRoutInspectPlanService.checkPlanStatus(dto.getYwRoutInspectPlan().getJobNo())) { + return AjaxResult.error("巡检记录已生成,无法修改。"); + } + ywRoutInspectPlanService.updatePlan(dto); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "巡检计划", businessType = BusinessType.DELETE) + @ApiOperation("删除巡检计划") + @DeleteMapping("/{ids}") + public AjaxResult delete(@PathVariable String[] ids) { + try { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(YwRoutInspectPlan::getJobNo, ids); + ywRoutInspectPlanService.remove(wrapper); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("导出巡检任务列表") + @PostMapping("/export") + public void export(YwRoutInspectConfigParam param, HttpServletRequest request, HttpServletResponse response) { + param = (YwRoutInspectConfigParam) yw_sceneService.validateUserVenues(param,YwRoutInspectConfigParam.class,"venueIds"); + ywRoutInspectPlanService.export(param, request, response); + } + + @ApiOperation("导出巡检计划列表") + @PostMapping("/plan/export") + public void planExport(YwRoutInspectPlanParam param, HttpServletRequest request, HttpServletResponse response) { + param = (YwRoutInspectPlanParam) yw_sceneService.validateUserVenues(param,YwRoutInspectPlanParam.class,"venueIds"); + ywRoutInspectPlanService.planExport(param, request, response); + } + + @ApiOperation("根据条件获取巡检任务统计汇总") + @PostMapping("/stat/export") + public void statExport(YwRoutInspectStatParam param, HttpServletRequest request, HttpServletResponse response) { + + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + + param.setPageNum(1); + param.setPageSize(Integer.MAX_VALUE); + param.setExport(true); + List list = new ArrayList<>(); + Map dataAll = ywRoutInspectPlanService.getStatData(param); + YwInspectStatDTO all = new YwInspectStatDTO(); + all.setVenueName("全部"); + all.setAllNum(MapUtils.getInteger(dataAll, "numOfAllPlan")); + all.setCompletedNum(MapUtils.getInteger(dataAll, "numOfCompletedPlan")); + all.setRate(MapUtils.getDouble(dataAll, "rate")); + + Map resultDataAll = ywRoutInspectPlanService.getResultStatData(param); + all.setResultAllNum(MapUtils.getInteger(resultDataAll, "numOfAllPlan")); + all.setResulNormalNum(MapUtils.getInteger(resultDataAll, "numOfNoQuPlan")); + all.setResulRate(MapUtils.getDouble(resultDataAll, "rate")); + + list.add(all); + + Map dataList = ywRoutInspectPlanService.getStatListData(param); + + Map resultDataList = ywRoutInspectPlanService.getResultStatListData(param); + + List listStat = (List) dataList.get("list"); + + List resultListStat = (List) resultDataList.get("list"); + + + if (!listStat.isEmpty()) { + for (YwInspectStatDTO ywInspectStatDTO : listStat) { + ywInspectStatDTO.setRate(ywInspectStatDTO.getRate() * 100); + } + if (resultListStat.isEmpty()) { + for (YwInspectStatDTO statDTO : listStat) { + list.add(statDTO); + } + } + + if (!resultListStat.isEmpty()) { + for (YwInspectStatDTO statDTO : listStat) { + for (YwInspectStatDTO resultStatDTO : resultListStat) { + if (statDTO.getVenueName().equals(resultStatDTO.getVenueName())) { + statDTO.setResultAllNum(resultStatDTO.getAllNum()); + statDTO.setResulRate(resultStatDTO.getRate() * 100); + statDTO.setResulNormalNum(resultStatDTO.getCompletedNum()); + } + } + list.add(statDTO); + } + } + } + + ExcelUtil util = new ExcelUtil<>(YwInspectStatDTO.class); + util.exportExcel(response, list, "巡检任务统计"); + +// EasyPoiExcelUtil.exportExcel("巡检统计", YwInspectStatDTO.class, list, request, response); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwRoutInspectQuestionConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwRoutInspectQuestionConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..afdb3973d5cfe89c43f2cc99726894df8c12e154 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwRoutInspectQuestionConfigController.java @@ -0,0 +1,86 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectQuestionConfig; +import com.ruoyi.eastcom_yw.domain.param.YwInspectQuestionConfigParam; +import com.ruoyi.eastcom_yw.service.YwRoutInspectQuestionConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.Arrays; +import java.util.List; + +/** + * @author huamile + */ +@Api("巡检问题类型管理") +@RestController +@RequestMapping("/eastcom_yw/routInspectQuestionConfig") +@RequiredArgsConstructor +public class YwRoutInspectQuestionConfigController extends BaseController { + + private final YwRoutInspectQuestionConfigService ywRoutInspectQuestionConfigService; + + @ApiOperation("获取巡检问题类型列表") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwInspectQuestionConfigParam param) { + List list = ywRoutInspectQuestionConfigService.getlist(param); + return getDataTable(list); + } + + @Log(title = "巡检问题类型", businessType = BusinessType.INSERT) + @ApiOperation("新增巡检问题类型") + @PostMapping + public AjaxResult create(@Valid @RequestBody YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig) { + try { + ywRoutInspectQuestionConfigService.create(ywRoutInspectQuestionConfig); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "巡检问题类型", businessType = BusinessType.UPDATE) + @ApiOperation("编辑巡检问题类型") + @PutMapping + public AjaxResult update(@Valid @RequestBody YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig) { + try { + ywRoutInspectQuestionConfigService.updateByPrimaryKeySelective(ywRoutInspectQuestionConfig); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "巡检问题类型", businessType = BusinessType.DELETE) + @ApiOperation("删除巡检问题类型") + @DeleteMapping("/{ids}") + public AjaxResult delete(@PathVariable Long[] ids) { + try { + ywRoutInspectQuestionConfigService.removeByIds(Arrays.asList(ids)); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "巡检问题类型", businessType = BusinessType.EXPORT) + @ApiOperation("导出巡检问题类型列表") + @PostMapping("/export") + public void export(YwInspectQuestionConfigParam param, HttpServletRequest request, HttpServletResponse response) { + ywRoutInspectQuestionConfigService.export(param, request, response); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneAlarmController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneAlarmController.java new file mode 100644 index 0000000000000000000000000000000000000000..74198d02144a859d8ea6ec6d9f94fe72ef2da868 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneAlarmController.java @@ -0,0 +1,80 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.YwSceneAlarm; +import com.ruoyi.eastcom_yw.domain.param.YwSceneAlarmParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneAlarmVo; +import com.ruoyi.eastcom_yw.service.YwSceneAlarmService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; + +/** + * @author huamile + */ +@Api("场馆告警配置管理") +@RestController +@RequestMapping("/eastcom_yw/sceneAlarm") +@RequiredArgsConstructor +public class YwSceneAlarmController extends BaseController { + + private final YwSceneAlarmService ywSceneAlarmService; + + @ApiOperation("获取场馆告警配置列表") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSceneAlarmParam param) { + List list = ywSceneAlarmService.getList(param); + return getDataTable(list); + } + + @ApiOperation("新增场馆告警配置") + @PostMapping + public AjaxResult create(@RequestBody YwSceneAlarm ywSceneAlarm) { + try { + ywSceneAlarmService.create(ywSceneAlarm); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("编辑场馆告警配置") + @PutMapping + public AjaxResult update(@RequestBody YwSceneAlarm ywSceneAlarm) { + try { + ywSceneAlarmService.updateByPrimaryKeySelective(ywSceneAlarm); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("删除场馆告警配置") + @DeleteMapping("/{ids}") + public AjaxResult delete(@PathVariable Long[] ids) { + try { + ywSceneAlarmService.removeByIds(Arrays.asList(ids)); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("导出场馆告警配置列表") + @PostMapping("/export") + public void export(YwSceneAlarmParam param, HttpServletRequest request, HttpServletResponse response) { + ywSceneAlarmService.export(param,request,response); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneCalendarController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneCalendarController.java new file mode 100644 index 0000000000000000000000000000000000000000..2b758799c4d8cc66673d19805e6452c060bedfb1 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneCalendarController.java @@ -0,0 +1,93 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneCalendarDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneCalendarParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendar2Vo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneCalendarVo; +import com.ruoyi.eastcom_yw.service.YwSceneCalendarService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; + +/** + * @author huamile + */ +@Api("场馆赛事配置管理") +@RestController +@RequestMapping("/eastcom_yw/sceneCalendar") +@RequiredArgsConstructor +public class YwSceneCalendarController extends BaseController { + + private final YwSceneCalendarService ywSceneCalendarService; + + @ApiOperation("获取场馆赛事配置列表") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSceneCalendarParam param) { + List list = ywSceneCalendarService.getList(param); + return getDataTable(list); + } + + @ApiOperation("新增场馆赛事配置") + @PostMapping + public AjaxResult create(@RequestBody YwSceneCalendarDTO dto) { + try { + ywSceneCalendarService.create(dto); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("编辑场馆赛事配置") + @PutMapping + public AjaxResult update(@RequestBody YwSceneCalendarDTO dto) { + try { + ywSceneCalendarService.updateByPrimaryKeySelective(dto); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("删除场馆赛事配置") + @DeleteMapping("/{ids}") + public AjaxResult delete(@PathVariable Long[] ids) { + try { + ywSceneCalendarService.removeByIds(Arrays.asList(ids)); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @RequestMapping(method = RequestMethod.POST, path = "/import") + @ApiOperation("导入赛事配置") + public AjaxResult importSceneCalendar(@RequestPart("file") MultipartFile file, @RequestParam("sceneBigId") Long sceneBigId, @RequestParam("importType") String importType) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwSceneCalendar2Vo.class); + + List vos = util.importExcel(file.getInputStream()); + return ywSceneCalendarService.importSceneCalendar(vos, sceneBigId, importType); + + } + + @ApiOperation("导出场馆赛事配置列表") + @PostMapping("/export") + public void export(YwSceneCalendarParam param, HttpServletRequest request, HttpServletResponse response) { + ywSceneCalendarService.export(param, request, response); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneController.java new file mode 100644 index 0000000000000000000000000000000000000000..839cc9eae4cd804ec116310dd1208c04a5adfc96 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneController.java @@ -0,0 +1,254 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import cn.hutool.core.collection.ListUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsVo; +import com.ruoyi.cmcc_gm.service.YwMaterialsStockService; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwWireTaskLog; +import com.ruoyi.eastcom_yw.domain.dto.YwDataDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneParam; +import com.ruoyi.eastcom_yw.domain.vo.SceneBaseStation; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementAgis; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneVo; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.YwWireTaskLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @author jkj + * @since 2023-01-12 + */ +@Api("场馆信息管理") +@RestController +@RequestMapping("/eastcom_yw/venue") +public class YwSceneController extends BaseController { + + @Autowired + private YwSceneService yw_sceneService; + + @Autowired + private YwMaterialsStockService ywMaterialsStockService; + + @Autowired + private YwWireTaskLogService ywWireTaskLogService; + + @ApiOperation("获取场馆数据") + @GetMapping("/list/redis") + public AjaxResult listAll() throws Exception { + return AjaxResult.success(yw_sceneService.selectVenues()); + } + + @ApiOperation("获取当前登录用户关联的场馆数据") + @GetMapping("/list/all") + public TableDataInfo listAll(Long sceneBigId) throws Exception { + if (ObjectUtils.isEmpty(sceneBigId)) { + throw new Exception("场景号不能为空"); + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwScene::getSceneBigId, sceneBigId); + return getDataTable(yw_sceneService.list(queryWrapper)); + } + + @ApiOperation("获取当前登录用户关联的场馆数据") + @GetMapping("/list") + @RepeatSubmit(enable = false, interval = 1000) + public TableDataInfo list(Long sceneBigId) throws Exception { + SysUser user = getLoginUser().getUser(); + if (ObjectUtils.isNotEmpty(user)) { + List list = yw_sceneService.getVenueByUser(user, sceneBigId); + return getDataTable(list); + } else { + throw new Exception("获取当前用户失败"); + } + } + + @ApiOperation("根据场馆和角色获取相关的用户") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwDataDTO ywDataDTO) { + List list = yw_sceneService.getSysUserByVenueAndOther(ywDataDTO); + return getDataTable(list); + } + + @ApiOperation("根据场馆ID获取场馆") + @GetMapping(value = {"/", "/{venueId}"}) + public TableDataInfo listByVenue(@PathVariable(value = "venueId", required = false) Long venueId) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(YwScene::getId, venueId); + List list = yw_sceneService.list(lambdaQueryWrapper); + + return getDataTable(list); + } + + @ApiOperation("获取场馆信息列表") + @PostMapping("/msgList") + public TableDataInfo msgList(@RequestBody YwSceneParam param) { + param = (YwSceneParam) yw_sceneService.validateUserVenues(param,YwSceneParam.class,"venueIds"); + List list = yw_sceneService.msgList(param); + return getDataTable(list); + } + + @ApiOperation("新增场馆") + @PostMapping + public AjaxResult create(@RequestBody YwSceneDTO dto) { + try { + yw_sceneService.create(dto); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("编辑场馆信息") + @PutMapping + public AjaxResult update(@RequestBody YwSceneDTO dto) { + try { + yw_sceneService.updateByPrimaryKeySelective(dto); + + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("删除场馆") + @DeleteMapping("/{ids}") + @Transactional + public AjaxResult delete(@PathVariable Long[] ids) { + try { + + //是否存在布线 + LambdaQueryWrapper queryWire = new LambdaQueryWrapper<>(); + queryWire.in(YwWireTaskLog::getVenueId,ids); + List lstWire = ywWireTaskLogService.list(queryWire); + if (lstWire.size() > 0) { + return AjaxResult.error("场馆已存在布线数据,无法删除"); + } + //20230515 + //判断场馆是否存在物资,有物资则不让删除 + YwMaterialsSearchDTO dto = new YwMaterialsSearchDTO(); + dto.setStoreIds(ids); + List list = ywMaterialsStockService.getMaterialsStock(dto); + if (list.size() > 0) { + for(YwMaterialsVo stock : list) + { + if(stock.getAvailSum()!=null) + { + if(stock.getAvailSum()>0) { + return AjaxResult.error("场馆已存在物资数据,无法删除"); + } + } + + if(stock.getInWaySum()!=null) + { + if(stock.getInWaySum()>0) { + return AjaxResult.error("场馆已存在物资数据,无法删除"); + } + } + + if(stock.getOutWaySum()!=null) + { + if(stock.getOutWaySum()>0) { + return AjaxResult.error("场馆已存在物资数据,无法删除"); + } + } + } + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.in(YwMaterialsStock::getMaterialStoreId,ids); + ywMaterialsStockService.remove(query); + } + yw_sceneService.delByIds(Arrays.asList(ids)); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("导出场馆信息列表") + @PostMapping("/export") + public void export(YwSceneParam param, HttpServletRequest request, HttpServletResponse response) { + param = (YwSceneParam) yw_sceneService.validateUserVenues(param,YwSceneParam.class,"venueIds"); + yw_sceneService.exportReal(param, request, response); + } + + @ApiOperation("导出场馆信息列表,可供导入") + @PostMapping("/exportReal") + public void exportReal(YwSceneParam param, HttpServletRequest request, HttpServletResponse response) { + param = (YwSceneParam) yw_sceneService.validateUserVenues(param,YwSceneParam.class,"venueIds"); + yw_sceneService.exportReal(param, request, response); + } + + @ApiOperation("导出场景相关配置") + @PostMapping("/export/{sceneBigId}") + public void bigSceneExport(@PathVariable Long sceneBigId, HttpServletRequest request, HttpServletResponse response) { + yw_sceneService.bigSceneExport(sceneBigId, request, response); + } + + @ApiOperation("导出场景相关配置新增模板") + @PostMapping("/export/template") + public void exportTemplate(HttpServletRequest request, HttpServletResponse response) { + yw_sceneService.exportTemplate(request, response); + } + + @ApiOperation("导入场景相关配置") + @PostMapping("/import") + public void importSceneBigConfig(@RequestPart("file") MultipartFile file) throws Exception { + yw_sceneService.importSceneBigConfig(file); + } + + @ApiOperation("场馆导入") + @PostMapping("/importScene") + public AjaxResult importYWScene(@RequestPart("file") MultipartFile file, @RequestParam Long sceneBigId, @RequestParam String importType) throws Exception { + + // 解析上传的文件 + ExcelUtil util = new ExcelUtil<>(YwSceneDTO.class); + List sceneList = util.importExcel(file.getInputStream()); + + return yw_sceneService.importYWScene(sceneList, sceneBigId, importType); + + } + + @ApiOperation("导入场馆静态数据") + @PostMapping("/importStationByScene") + public AjaxResult importStationByScene(@RequestPart("file") MultipartFile file, + @RequestParam(name = "sceneBigId") Long sceneBigId, + @RequestParam(name = "sceneId") Long sceneId) throws Exception { + try { + yw_sceneService.importStationByScene(file, sceneBigId, sceneId); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + + } + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneMatchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneMatchController.java new file mode 100644 index 0000000000000000000000000000000000000000..d9da8a013037244c544809c5e53f15cf63b76369 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneMatchController.java @@ -0,0 +1,40 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.param.YwSceneMatchParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneMatchVo; +import com.ruoyi.eastcom_yw.service.YwSceneMatchService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@Api("赛程") +@RestController +@RequiredArgsConstructor +@RequestMapping("/eastcom_yw/sceneMatch") +public class YwSceneMatchController extends BaseController { + + private final YwSceneMatchService ywSceneMatchService; + + @PostMapping("/import") + @ApiOperation("导入") + public AjaxResult importMatch(@RequestPart("file") MultipartFile file, Long sceneBigId, String importType) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwSceneMatchVo.class); + List vos = util.importExcel(file.getInputStream()); + return ywSceneMatchService.importMatch(vos, sceneBigId, importType); + } + + @ApiOperation("查询") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSceneMatchParam param) { + return getDataTable(ywSceneMatchService.list(param)); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementAgisController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementAgisController.java new file mode 100644 index 0000000000000000000000000000000000000000..beacbad6fe381b8b6f49785d34876772074d1eb9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementAgisController.java @@ -0,0 +1,93 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementAgisParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementAgis; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementAgisService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * @author los + */ +@Api(tags = "网元-AGIS") +@RestController +@RequestMapping("/eastcom_yw/sceneNetelementAgis") +@RequiredArgsConstructor +public class YwSceneNetelementAgisController extends BaseController { + + private final YwSceneNetelementAgisService ywSceneNetelementAgisService; + + private final YwSceneService ywSceneService; + + @ApiOperation("查询") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSceneNetelementAgisParam para) { + List list = ywSceneNetelementAgisService.list(para); + + return getDataTable(list); + } + + @ApiOperation("导出") + @PostMapping("/export") + public void export(YwSceneNetelementAgisParam para, HttpServletResponse response) { + + para.setPageNum(1); + para.setPageSize(Integer.MAX_VALUE); + + List list = ywSceneNetelementAgisService.list(para); + + ExcelUtil util = new ExcelUtil<>(YwSceneNetelementAgis.class); + util.hideColumn("reason"); + util.exportExcel(response, list, "专网网元导出"); + } + + @Log(title = "导入agis的网元清单", businessType = BusinessType.INSERT) + @ApiOperation("导入") + @PostMapping("/importAgis") + public AjaxResult importAgis(@RequestPart("file") MultipartFile file, + @RequestParam(name = "sceneBigId") Long sceneBigId, + @RequestParam(name = "opType", defaultValue = "2") String opType, + @RequestParam(name = "sceneId", required = false) Long sceneId) throws Exception { + + String sceneName = null; + + if ("1".equals(opType) && ObjectUtils.isEmpty(sceneId)) { + throw new ServiceException("单场馆导入,场馆ID不能为空"); + } + + if (ObjectUtils.isNotEmpty(sceneId)) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwScene::getSceneBigId, sceneBigId).eq(YwScene::getId, sceneId); + YwScene one = ywSceneService.getOne(queryWrapper, false); + if (ObjectUtils.isEmpty(one)) { + throw new ServiceException("该场景下不存在该场馆"); + } else { + sceneName = one.getVenueName(); + } + } + + ExcelUtil util = new ExcelUtil<>(YwSceneNetelementAgis.class); + List cs = util.importExcel(file.getInputStream()); + + return ywSceneNetelementAgisService.importAgis(cs, sceneBigId, opType, sceneName); + + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementController.java new file mode 100644 index 0000000000000000000000000000000000000000..b35056f30cf6d7784823bb54b0edadd17c471b12 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementController.java @@ -0,0 +1,84 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.eastcom_yw.domain.YwSceneNetelement; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementParam; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; + +/** + * @author huamile + */ +@Api("场馆网元配置管理") +@RestController +@RequestMapping("/eastcom_yw/sceneNetelement") +@RequiredArgsConstructor +public class YwSceneNetelementController extends BaseController { + + private final YwSceneNetelementService ywSceneNetelementService; + + @ApiOperation("获取场馆网元配置列表") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSceneNetelementParam param) { + List list = ywSceneNetelementService.getList(param); + return getDataTable(list); + } + + @Log(title = "新增场馆网元配置", businessType = BusinessType.INSERT) + @ApiOperation("新增场馆网元配置") + @PostMapping + public AjaxResult create(@RequestBody YwSceneNetelement ywSceneNetelement) { + try { + ywSceneNetelementService.create(ywSceneNetelement); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "编辑场馆网元配置", businessType = BusinessType.UPDATE) + @ApiOperation("编辑场馆网元配置") + @PutMapping + public AjaxResult update(@RequestBody YwSceneNetelement ywSceneNetelement) { + try { + ywSceneNetelementService.updateByPrimaryKeySelective(ywSceneNetelement); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "删除场馆网元配置", businessType = BusinessType.DELETE) + @ApiOperation("删除场馆网元配置") + @DeleteMapping("/{ids}") + public AjaxResult delete(@PathVariable Long[] ids) { + try { + ywSceneNetelementService.removeByIds(Arrays.asList(ids)); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("导出场馆网元配置列表") + @PostMapping("/export") + public void export(YwSceneNetelementParam param, HttpServletRequest request, HttpServletResponse response) { + ywSceneNetelementService.export(param,request,response); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementCsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementCsController.java new file mode 100644 index 0000000000000000000000000000000000000000..859744248f51cf33313a10a0f79f2f034992ee65 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementCsController.java @@ -0,0 +1,88 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementCsParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementCs; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementCsService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api(tags = "亚运-传输SPN-OYN-PTN") +@RestController +@RequestMapping("/eastcom_yw/sceneNetelementCs") +@RequiredArgsConstructor +public class YwSceneNetelementCsController extends BaseController { + + private final YwSceneNetelementCsService ywSceneNetelementCsService; + + private final YwSceneService ywSceneService; + + @ApiOperation("查询") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSceneNetelementCsParam param) { + List list = ywSceneNetelementCsService.list(param); + return getDataTable(list); + } + + @ApiOperation("导出") + @PostMapping("/export") + public void export(YwSceneNetelementCsParam para, HttpServletResponse response) { + + para.setPageNum(1); + para.setPageSize(Integer.MAX_VALUE); + List list = ywSceneNetelementCsService.list(para); + + ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + util.hideColumn("reason"); + util.exportExcel(response, list, "传输网元导出"); + } + + @Log(title = "导入传输的网元清单", businessType = BusinessType.INSERT) + @ApiOperation("导入") + @PostMapping("/importCS") + public AjaxResult importCs(@RequestPart("file") MultipartFile file, + @RequestParam(name = "sceneBigId") Long sceneBigId, + @RequestParam(name = "opType", defaultValue = "2") String opType, + @RequestParam(name = "sceneId", required = false) Long sceneId) throws Exception { + + String sceneName = null; + + if ("1".equals(opType) && ObjectUtils.isEmpty(sceneId)) { + throw new ServiceException("单场馆导入,场馆ID不能为空"); + } + + if (ObjectUtils.isNotEmpty(sceneId)) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwScene::getSceneBigId, sceneBigId).eq(YwScene::getId, sceneId); + YwScene one = ywSceneService.getOne(queryWrapper, false); + if (ObjectUtils.isEmpty(one)) { + throw new ServiceException("该场景下不存在该场馆"); + } else { + sceneName = one.getVenueName(); + } + } + + ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + List cs = util.importExcel(file.getInputStream()); + + return ywSceneNetelementCsService.importCs(cs, sceneBigId, opType, sceneName); + + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementDhController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementDhController.java new file mode 100644 index 0000000000000000000000000000000000000000..496bb72c12a1f8a347b233043a1417eac9d55c1f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementDhController.java @@ -0,0 +1,89 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementDhParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementDh; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementDhService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api(tags = "网元-动环") +@RestController +@RequestMapping("/eastcom_yw/sceneNetelementDh") +@RequiredArgsConstructor +public class YwSceneNetelementDhController extends BaseController { + + private final YwSceneNetelementDhService ywSceneNetelementDhService; + + private final YwSceneService ywSceneService; + + @ApiOperation("查询") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSceneNetelementDhParam para) { + List list = ywSceneNetelementDhService.list(para); + + return getDataTable(list); + } + + @ApiOperation("导出") + @PostMapping("/export") + public void export(YwSceneNetelementDhParam para, HttpServletResponse response) { + + para.setPageNum(1); + para.setPageSize(Integer.MAX_VALUE); + List list = ywSceneNetelementDhService.list(para); + + ExcelUtil util = new ExcelUtil<>(YwSceneNetelementDh.class); + util.hideColumn("reason"); + util.exportExcel(response, list, "动环网元导出"); + } + + @Log(title = "导入动环的网元清单", businessType = BusinessType.INSERT) + @ApiOperation("导入") + @PostMapping("/importDh") + public AjaxResult importDh(@RequestPart("file") MultipartFile file, + @RequestParam(name = "sceneBigId") Long sceneBigId, + @RequestParam(name = "opType", defaultValue = "2") String opType, + @RequestParam(name = "sceneId", required = false) Long sceneId) throws Exception { + + String sceneName = null; + + if ("1".equals(opType) && ObjectUtils.isEmpty(sceneId)) { + throw new ServiceException("单场馆导入,场馆ID不能为空"); + } + + if (ObjectUtils.isNotEmpty(sceneId)) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwScene::getSceneBigId, sceneBigId).eq(YwScene::getId, sceneId); + YwScene one = ywSceneService.getOne(queryWrapper, false); + if (ObjectUtils.isEmpty(one)) { + throw new ServiceException("该场景下不存在该场馆"); + } else { + sceneName = one.getVenueName(); + } + } + + ExcelUtil util = new ExcelUtil<>(YwSceneNetelementDh.class); + List cs = util.importExcel(file.getInputStream()); + + return ywSceneNetelementDhService.importDh(cs, sceneBigId, opType, sceneName); + + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementWxController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementWxController.java new file mode 100644 index 0000000000000000000000000000000000000000..c074634c904b35c6d65df3f95749871b0b5924f5 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNetelementWxController.java @@ -0,0 +1,140 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.param.YwSceneNetelementWxParam; +import com.ruoyi.eastcom_yw.domain.vo.WholeAreaAssureCellSheet; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNetelementWx; +import com.ruoyi.eastcom_yw.service.YwSceneNetelementWxService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + +@Api(tags = "网元-无线") +@RestController +@RequestMapping("/eastcom_yw/sceneNetelementWx") +@RequiredArgsConstructor +public class YwSceneNetelementWxController extends BaseController { + + private final YwSceneNetelementWxService ywSceneNetelementWxService; + + private final YwSceneService ywSceneService; + + @ApiOperation("查询") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSceneNetelementWxParam para) { + List list = ywSceneNetelementWxService.list(para); + + return getDataTable(list); + } + + @ApiOperation("查询") + @PostMapping("/list2") + @Anonymous + public TableDataInfo list2(@RequestBody YwSceneNetelementWxParam para) { + if (para.getPageNum() == null || para.getPageSize() == null) { + para.setPageNum(1); + para.setPageSize(Integer.MAX_VALUE); + } + List list = ywSceneNetelementWxService.list2(para); + return getDataTable(list); + } + + @ApiOperation("导出") + @PostMapping("/export") + public void export(YwSceneNetelementWxParam para, HttpServletResponse response) { + + para.setPageNum(1); + para.setPageSize(Integer.MAX_VALUE); + List list = ywSceneNetelementWxService.list(para); + + ExcelUtil util = new ExcelUtil<>(YwSceneNetelementWx.class); + util.hideColumn("reason"); + util.exportExcel(response, list, "无线网元导出"); + } + + @Log(title = "导入无线的网元清单", businessType = BusinessType.INSERT) + @ApiOperation("导入") + @PostMapping("/importWx") + public AjaxResult importWx(@RequestPart("file") MultipartFile file, + @RequestParam(name = "sceneBigId") Long sceneBigId, + @RequestParam(name = "opType", defaultValue = "2") String opType, + @RequestParam(name = "sceneId", required = false) Long sceneId) throws Exception { + + String sceneName = null; + + if ("1".equals(opType) && ObjectUtils.isEmpty(sceneId)) { + throw new ServiceException("单场馆导入,场馆ID不能为空"); + } + + if (ObjectUtils.isNotEmpty(sceneId)) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwScene::getSceneBigId, sceneBigId).eq(YwScene::getId, sceneId); + YwScene one = ywSceneService.getOne(queryWrapper, false); + if (ObjectUtils.isEmpty(one)) { + throw new ServiceException("该场景下不存在该场馆"); + } else { + sceneName = one.getVenueName(); + } + } + + ExcelUtil util = new ExcelUtil<>(YwSceneNetelementWx.class); + List cs = util.importExcel(file.getInputStream()); + + return ywSceneNetelementWxService.importWx(cs, sceneBigId, opType, sceneName); + + } + + + @ApiOperation("查询小区") + @GetMapping("/listCell") + public TableDataInfo listCell(Long sceneId) { + YwSceneNetelementWxParam param = new YwSceneNetelementWxParam(); + if (null != sceneId) { + param.setSceneId(sceneId); + } else { + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!user.isAdmin(user)) { + List ywScenes = ywSceneService.getVenueByUser(user); + Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + param.setSceneIds(venueIds); + } + } + + List list = ywSceneNetelementWxService.listCell(param); + return getDataTable(list); + } + + @ApiOperation("查询坐席") + @GetMapping("/listSeat") + public TableDataInfo listSeat(Long sceneId) { + if (null == sceneId) { + throw new ServiceException("请先选择场馆id!"); + } + List list = ywSceneNetelementWxService.listSeat(sceneId); + return getDataTable(list); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNoticeinfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNoticeinfoController.java new file mode 100644 index 0000000000000000000000000000000000000000..50b13d74820a8815a9358e771263116bbffbfe77 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneNoticeinfoController.java @@ -0,0 +1,190 @@ +package com.ruoyi.web.controller.eastcom_yw; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneNoticeinfoSearchDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneNoticeinfo; +import com.ruoyi.eastcom_yw.service.YwSceneNoticeinfoService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * (YwSceneNoticeinfo)表控制层 + * + * @author lee + * @since 2023-05-23 10:10:05 + */ +@RestController +@RequestMapping("/eastcom_yw/ywSceneNoticeinfo") +public class YwSceneNoticeinfoController extends BaseController { + + /** + * 服务对象 + */ + @Resource + private YwSceneNoticeinfoService ywSceneNoticeinfoService; + + @Resource + private YwSceneService ywSceneService; + + /** + * 分页查询所有数据 + * + * @param ywSceneNoticeinfo 查询实体 + * @return 所有数据 + */ + @PostMapping("/list") + public TableDataInfo selectAll(@RequestBody YwSceneNoticeinfoSearchDTO ywSceneNoticeinfo) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (!user.isAdmin(user)) { + ywSceneNoticeinfo.setUserId(user.getUserId()); + } + PageUtils.startPage(ywSceneNoticeinfo, YwSceneNoticeinfoSearchDTO.class); + return getDataTable(ywSceneNoticeinfoService.getNoticeinfoBySearch(ywSceneNoticeinfo)); + } + + /** + * 重置总和 + */ + @GetMapping("/reset") + public AjaxResult reset() { + ywSceneNoticeinfoService.reset(false); + return AjaxResult.success(); + } + + /** + * 重新统计实际网元数后保存,并重置总和 + */ + @GetMapping("/statisticsNetNum") + public AjaxResult statisticsNetNum() { + ywSceneNoticeinfoService.statisticsNetNum(); + return AjaxResult.success(); + } + + /** + * 按条件导出数据 + * + * @param ywSceneNoticeinfo 查询实体 + */ + @PostMapping("/export") + public void export(YwSceneNoticeinfoSearchDTO ywSceneNoticeinfo, HttpServletResponse response) { + ywSceneNoticeinfo.setPageNum(1); + ywSceneNoticeinfo.setPageSize(Integer.MAX_VALUE); + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (!user.isAdmin(user)) { + ywSceneNoticeinfo.setUserId(user.getUserId()); + } + List noticeinfoBySearch = ywSceneNoticeinfoService.getNoticeinfoBySearch(ywSceneNoticeinfo); + for (YwSceneNoticeinfo bySearch : noticeinfoBySearch) { + bySearch.setFrontuserStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getFrontuser())) ? String.valueOf(bySearch.getFrontuser()) : ""); + bySearch.setBackuserStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getBackuser())) ? String.valueOf(bySearch.getBackuser()) : ""); + bySearch.setEmergencycarStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getEmergencycar())) ? String.valueOf(bySearch.getEmergencycar()) : ""); + bySearch.setEmergencyWarehouseStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getEmergencyWarehouse())) ? String.valueOf(bySearch.getEmergencyWarehouse()) : ""); + bySearch.setAgisNetNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getAgisNetNum())) ? String.valueOf(bySearch.getAgisNetNum()) : ""); + bySearch.setWxNetNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getWxNetNum())) ? String.valueOf(bySearch.getWxNetNum()) : ""); + bySearch.setDhNetNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getDhNetNum())) ? String.valueOf(bySearch.getDhNetNum()) : ""); + bySearch.setAgisNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getAgisNum())) ? String.valueOf(bySearch.getAgisNum()) : ""); + bySearch.setWifiNetNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getWifiNetNum())) ? String.valueOf(bySearch.getWifiNetNum()) : ""); + bySearch.setVoipNetNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getVoipNetNum())) ? String.valueOf(bySearch.getVoipNetNum()) : ""); + bySearch.setInternetNetNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getInternetNetNum())) ? String.valueOf(bySearch.getInternetNetNum()) : ""); + bySearch.setPublicTransportEquipNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getPublicTransportEquipNum())) ? String.valueOf(bySearch.getPublicTransportEquipNum()) : ""); + bySearch.setPublicInterfaceRingNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getPublicInterfaceRingNum())) ? String.valueOf(bySearch.getPublicInterfaceRingNum()) : ""); + bySearch.setPrivateTransportEquipNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getPrivateTransportEquipNum())) ? String.valueOf(bySearch.getPrivateTransportEquipNum()) : ""); + bySearch.setPrivateInterfaceRingNumStr(!"null".equalsIgnoreCase(String.valueOf(bySearch.getPrivateInterfaceRingNum())) ? String.valueOf(bySearch.getPrivateInterfaceRingNum()) : ""); + bySearch.setSupportcarStr(StringUtils.nonNullString(bySearch.getSupportcar())); + bySearch.setDictEquipNumStr(StringUtils.nonNullString(bySearch.getDictEquipNum())); + bySearch.setEmergencyCommunicationCarStr(StringUtils.nonNullString(bySearch.getEmergencyCommunicationCar())); + bySearch.setEmergencyElectricCarStr(StringUtils.nonNullString(bySearch.getEmergencyElectricCar())); + bySearch.setEmergencyRepairCarStr(StringUtils.nonNullString(bySearch.getEmergencyRepairCar())); + bySearch.setWifiSpareStr(StringUtils.nonNullString(bySearch.getWifiSpare())); + bySearch.setDredgeSpareStr(StringUtils.nonNullString(bySearch.getDredgeSpare())); + bySearch.setTransSpareStr(StringUtils.nonNullString(bySearch.getTransSpare())); + bySearch.setPublicPowerEquipStr(StringUtils.nonNullString(bySearch.getPublicPowerEquip())); + bySearch.setPrivatePowerEquipStr(StringUtils.nonNullString(bySearch.getPrivatePowerEquip())); + } + ExcelUtil util = new ExcelUtil<>(YwSceneNoticeinfo.class); + util.hideColumn("reason"); + util.exportExcel(response, noticeinfoBySearch, "数据"); + } + + /** + * 新增数据 + * + * @param ywSceneNoticeinfo 实体对象 + * @return 新增结果 + */ + @PostMapping + public AjaxResult insert(@RequestBody YwSceneNoticeinfo ywSceneNoticeinfo) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(YwScene::getVenueName, ywSceneNoticeinfo.getSceneName()).eq(YwScene::getSceneBigId, 1); + YwScene one = ywSceneService.getOne(queryWrapper, false); + if (ObjectUtils.isEmpty(one)) { + throw new ServiceException("场馆不存在。"); + } else { + ywSceneNoticeinfo.setSceneId(one.getId()); + } + + YwSceneNoticeinfoSearchDTO ywSceneNoticeinfoSearchDTO = new YwSceneNoticeinfoSearchDTO(); + ywSceneNoticeinfoSearchDTO.setSceneName(ywSceneNoticeinfo.getSceneName()); + List noticeinfoBySearch = ywSceneNoticeinfoService.getNoticeinfoBySearch(ywSceneNoticeinfoSearchDTO); + if (CollectionUtils.isNotEmpty(noticeinfoBySearch)) { + throw new ServiceException("场馆重复。"); + } + + return AjaxResult.success(this.ywSceneNoticeinfoService.save(ywSceneNoticeinfo)); + } + + /** + * 修改数据 + * + * @param ywSceneNoticeinfo 实体对象 + * @return 修改结果 + */ + @PutMapping + public AjaxResult update(@RequestBody YwSceneNoticeinfo ywSceneNoticeinfo) { + return AjaxResult.success(this.ywSceneNoticeinfoService.updateById(ywSceneNoticeinfo)); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @DeleteMapping + public AjaxResult delete(@RequestParam("idList") List idList) { + return AjaxResult.success(this.ywSceneNoticeinfoService.removeByIds(idList)); + } + + /** + * 批量导入 + * + * @param file 文件 + * @return 导入结果 + */ + @PostMapping("/import") + public AjaxResult batchImport(@RequestPart(name = "file") MultipartFile file, @RequestParam(name = "importType") String importType) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwSceneNoticeinfo.class); + List ywSceneNoticeinfos = util.importExcel(file.getInputStream()); + return ywSceneNoticeinfoService.batchImport(ywSceneNoticeinfos, importType); + } + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwScenePictureController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwScenePictureController.java new file mode 100644 index 0000000000000000000000000000000000000000..e876620ca8f01bf4cd8b1f459d7ebf196d3cf223 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwScenePictureController.java @@ -0,0 +1,118 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.service.YwScenePictureService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author los + */ +@Api(tags = "场馆画像") +@RestController +@RequestMapping("/eastcom_yw/scenePicture") +@RequiredArgsConstructor +public class YwScenePictureController extends BaseController { + + private final YwScenePictureService service; + + /** + * 任务管理统计 + * + * @param id 场馆id + * @return 返回数据 + */ + @ApiOperation(value = "任务管理统计", notes = "任务管理统计") + @PostMapping("/listTaskManage") + public AjaxResult listTaskManage(@RequestParam("sceneId") Long id) { + return AjaxResult.success(service.listTaskManage2(id,false)); + } + + /** + * 人员签到统计 + * + * @param id 场馆id + * @return 返回数据 + */ + @ApiOperation(value = "人员签到统计", tags = "人员签到统计") + @PostMapping("/listSign") + public AjaxResult listSign(@RequestParam("sceneId") Long id) { + return AjaxResult.success(service.listSign(id)); + } + + /** + * 场馆基本信息 + * + * @param id 场馆id + * @return 返回数据 + */ + @ApiOperation(value = "场馆基本信息", tags = "场馆基本信息") + @PostMapping("/baseInfo") + public AjaxResult listMatchTop3(@RequestParam("sceneId") Long id) { + return AjaxResult.success(service.listMatchTop3(id)); + } + + /** + * 场馆告警 + * + * @param id 场馆id + * @return 返回数据 + */ + @ApiOperation(value = "场馆告警", tags = "场馆告警") + @PostMapping("/alarm") + public AjaxResult listAlarm(@RequestParam("sceneId") Long id) { + return AjaxResult.success(service.listAlarm(id)); + } + + /** + * 场馆Kpi指标 + * + * @param id 场馆id + * @param typeId 网络类型 1 --> 4g 2 --> 5g + * @return 数据 + */ + @ApiOperation(value = "场馆性能(15分粒度)", tags = "场馆性能(15分粒度)") + @PostMapping("/kpi") + public AjaxResult listKPI(@RequestParam("sceneId") Long id, @RequestParam("typeId") String typeId) { + return AjaxResult.success(service.listKPI(id, typeId)); + } + + @ApiOperation(value = "场馆性能(15分粒度)", tags = "场馆性能(15分粒度)") + @PostMapping("/kpi2") + public AjaxResult listKPIALL(@RequestParam("sceneId") Long id) { + return AjaxResult.success(service.listKPIALL(id)); + } + + + /** + * + * @param id 场馆id + * @param type 1-AGIS 2-互联网 3-固话 + * @return + */ + @ApiOperation(value = "场馆性能-专网", tags = "场馆性能-专网") + @PostMapping("/listNetKpi") + public AjaxResult listNetKpi(@RequestParam("sceneId") Long id,@RequestParam("type") Integer type) { + return service.listNetKpi(id,type); + } + + + /** + * + * @param id 场馆id + * @param type 1-环路浏量 2-光功率 + * @return + */ + @ApiOperation(value = "场馆性能-传输", tags = "场馆性能-传输") + @PostMapping("/listTransKpi") + public AjaxResult listTransKpi(@RequestParam("sceneId") Long id,@RequestParam("type") Integer type) { + return service.listTransKpi(id,type); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneTestDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneTestDataController.java new file mode 100644 index 0000000000000000000000000000000000000000..000b3c12b7ec1328722fae16590a41c036adfcca --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneTestDataController.java @@ -0,0 +1,40 @@ +package com.ruoyi.web.controller.eastcom_yw; + + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.service.YwSceneTestDataService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * (YwSceneTestData)表控制层 + * + * @author lee + * @since 2023-04-26 18:41:32 + */ +@RestController +@RequestMapping("/eastcom_yw/daping") +public class YwSceneTestDataController extends BaseController { + + /** + * 服务对象 + */ + @Resource + private YwSceneTestDataService ywSceneTestDataService; + + /** + * 分页查询所有数据 + * + * @return 所有数据 + */ + @GetMapping("/get_test_data") + public AjaxResult selectAll() { + return AjaxResult.success(ywSceneTestDataService.getList()); + } + +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneUserController.java new file mode 100644 index 0000000000000000000000000000000000000000..888fa623cbf5b116da5c1d9beb9ce2bdeca17f30 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSceneUserController.java @@ -0,0 +1,135 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.SysUserImp; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.domain.param.SysUserParam; +import com.ruoyi.eastcom_yw.domain.vo.SysUserVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneUserVo; +import com.ruoyi.eastcom_yw.domain.param.YwSceneUserParam; +import com.ruoyi.eastcom_yw.service.YwSceneUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * @author huamile + */ +@Api("场馆人员配置管理") +@RestController +@RequestMapping("/eastcom_yw/sceneUser") +@RequiredArgsConstructor +public class YwSceneUserController extends BaseController { + + private final YwSceneUserService ywSceneUserService; + + @ApiOperation("获取场馆人员配置列表") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSceneUserParam param) { + List list = ywSceneUserService.getList(param); + return getDataTable(list); + } + + @ApiOperation("新增场馆人员配置") + @PostMapping + public AjaxResult create(@RequestBody YwSceneUser ywSceneUser) { + try { + ywSceneUserService.create(ywSceneUser); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("编辑场馆人员配置") + @PutMapping + public AjaxResult update(@RequestBody YwSceneUser ywSceneUser) { + try { + ywSceneUserService.updateByPrimaryKeySelective(ywSceneUser); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("删除场馆人员配置") + @DeleteMapping("/{ids}") + public AjaxResult delete(@PathVariable Long[] ids) { + try { + ywSceneUserService.removeByIds(Arrays.asList(ids)); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("导出场馆人员配置列表") + @PostMapping("/export") + public void export(YwSceneUserParam param, HttpServletRequest request, HttpServletResponse response) { + ywSceneUserService.export(param, request, response); + } + + @ApiOperation("查询标准人员列表") + @PostMapping("/listSysUserAppendScene") + public TableDataInfo list(@RequestBody SysUserParam para) { + List list = ywSceneUserService.listSysUser(para); + for (SysUserVo sysUser : list) { + String[] venueIds = new String[0]; + String[] venueNames = new String[0]; + String[] roless = new String[0]; + if (StringUtils.isNotEmpty(sysUser.getStrVenueIds())) { + venueIds = sysUser.getStrVenueIds().split("\\|"); + } + if (StringUtils.isNotEmpty(sysUser.getStrVenueNames())) { + venueNames = sysUser.getStrVenueNames().split("\\|"); + } + if (StringUtils.isNotEmpty(sysUser.getStrRoles())) { + roless = sysUser.getStrRoles().split("\\|"); + } + sysUser.setVenueNames(venueNames); + + sysUser.setVenueIds(venueIds); + sysUser.setRoleNames(roless); + } + + return getDataTable(list); + } + + @ApiOperation("导入标准人员列表") + @PostMapping("/importSysUserAppendScene") + public AjaxResult importSysUser(@RequestPart("file") MultipartFile file, + @RequestParam("sceneBigId") Long sceneBigId, + @RequestParam("importType") String importType) throws Exception { + + ExcelUtil util = new ExcelUtil<>(SysUserImp.class); + List imps = util.importExcel(file.getInputStream()); + + return ywSceneUserService.importSysUser(imps, sceneBigId, importType); + + } + + @ApiOperation("导出场馆人员配置列表,可供导入") + @PostMapping("/exportForImport") + public void exportForImport(SysUserParam para, HttpServletRequest request, HttpServletResponse response) { + ywSceneUserService.exportForImport(para, request, response); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSignController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSignController.java new file mode 100644 index 0000000000000000000000000000000000000000..6e1e0a3e657a5f1c3f1a61d02c5fd813fb63e22c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSignController.java @@ -0,0 +1,312 @@ +package com.ruoyi.web.controller.eastcom_yw; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.reflect.ReflectUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSignLog; +import com.ruoyi.eastcom_yw.domain.dto.YwSignInDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignPlanDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignPlanUserDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSignPlanParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogStaticVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSignPlanVo; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.YwSignLogService; +import com.ruoyi.eastcom_yw.service.YwSignLogViewService; +import com.ruoyi.eastcom_yw.service.YwSignPlanService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + + +/** + * + * @author jkj + * @since 2023-01-14 + */ +@Api("签到信息管理") +@RestController +@RequestMapping("/eastcom_yw/sign") +public class YwSignController extends BaseController { + + @Autowired + private YwSignLogService ywSignLogService; + + @Autowired + private YwSignPlanService ywSignPlanService; + + + @Autowired + private YwSignLogViewService ywSignLogViewService; + + @Autowired + private YwSceneService yw_sceneService; + + @ApiOperation("获取签到") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSignLogDTO ywSignLogDTO) + { + ywSignLogDTO = (YwSignLogDTO) yw_sceneService.validateUserVenues(ywSignLogDTO,YwSignLogDTO.class,"venueIds"); + TableDataInfo resData=ywSignLogViewService.getSignLog(ywSignLogDTO); + return getDataTable(resData.getRows(),resData.getTotal()); + } + + @ApiOperation("获取签到统计") + @PostMapping("/static/list") + public TableDataInfo static_list(@RequestBody YwSignLogDTO ywSignLogDTO) + { + ywSignLogDTO.setIsExport(false); + ywSignLogDTO = (YwSignLogDTO) yw_sceneService.validateUserVenues(ywSignLogDTO,YwSignLogDTO.class,"venueIds"); + List list=ywSignLogViewService.getSignLogStatic(ywSignLogDTO); + return getDataTable(list); + } + + @ApiOperation("获取签到计划") + @PostMapping("/plan/list") + public TableDataInfo plan_list(@RequestBody YwSignPlanDTO ywSignPlanDTO) + { + ywSignPlanDTO.setIsExport(false); + ywSignPlanDTO = (YwSignPlanDTO) yw_sceneService.validateUserVenues(ywSignPlanDTO,YwSignPlanDTO.class,"venueIds"); + TableDataInfo resData= ywSignPlanService.getSignPlan(ywSignPlanDTO); + return getDataTable(resData.getRows(),resData.getTotal()); + } + + @Log(title = "签到计划", businessType = BusinessType.INSERT) + @ApiOperation("新增签到计划") + @PostMapping("/plan/insert") + public AjaxResult palnInsert(@RequestBody YwSignPlanParam ywSignPlanParam) + { + + Boolean res = false; + + String strError = ""; + + try + { + if(ObjectUtils.isEmpty(ywSignPlanParam.getTimePeriods())) + { + YwSignPlanDTO ywSignPlanDTO =new YwSignPlanDTO(); + + BeanUtils.copyBeanProp(ywSignPlanDTO,ywSignPlanParam); + + res = ywSignPlanService.insertSignPlan(ywSignPlanDTO); + + if(!res) + { + strError = ywSignPlanDTO.getSignDates()[0]+" "+ywSignPlanDTO.getBeginTime()+" "+ywSignPlanDTO.getEndTime()+"相同场馆存在时间重叠"; + } + } + + + if(ObjectUtils.isNotEmpty(ywSignPlanParam.getTimePeriods())) + { + + for(YwSignPlanUserDTO ywSignPlanUserDTO : ywSignPlanParam.getTimePeriods()) + { + YwSignPlanDTO ywSignPlanDTO =new YwSignPlanDTO(); + + BeanUtils.copyBeanProp(ywSignPlanDTO,ywSignPlanParam); + + ywSignPlanDTO.setBeginTime(ywSignPlanUserDTO.getBeginTime()); + + ywSignPlanDTO.setEndTime(ywSignPlanUserDTO.getEndTime()); + + ywSignPlanDTO.setSignUsers(StringUtils.join(ywSignPlanUserDTO.getSignUsers(),",")); + + res = ywSignPlanService.insertSignPlan(ywSignPlanDTO); + + if(!res) + { + strError = ywSignPlanDTO.getSignDates()[0]+" "+ywSignPlanDTO.getBeginTime()+" "+ywSignPlanDTO.getEndTime()+"相同场馆存在时间重叠"; + break; + } + } + } + + if(res) + { + return AjaxResult.success(); + } + else + { + return AjaxResult.error(strError); + } + + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "签到计划", businessType = BusinessType.UPDATE) + @ApiOperation("修改签到计划") + @PostMapping("/plan/update") + public AjaxResult palnUpdate(@RequestBody YwSignPlanParam ywSignPlanParam) + { + try + { + if(ObjectUtils.isEmpty(ywSignPlanParam.getTimePeriods())) + { + YwSignPlanDTO ywSignPlanDTO =new YwSignPlanDTO(); + BeanUtils.copyBeanProp(ywSignPlanDTO,ywSignPlanParam); + ywSignPlanService.updateSignPlan(ywSignPlanDTO); + return AjaxResult.success(); + } + + if(ObjectUtils.isNotEmpty(ywSignPlanParam.getTimePeriods())) + { + + for(YwSignPlanUserDTO ywSignPlanUserDTO : ywSignPlanParam.getTimePeriods()) + { + + YwSignPlanDTO ywSignPlanDTO =new YwSignPlanDTO(); + + BeanUtils.copyBeanProp(ywSignPlanDTO,ywSignPlanParam); + + ywSignPlanDTO.setBeginTime(ywSignPlanUserDTO.getBeginTime()); + + ywSignPlanDTO.setEndTime(ywSignPlanUserDTO.getEndTime()); + + ywSignPlanDTO.setSignUsers(StringUtils.join(ywSignPlanUserDTO.getSignUsers(),",")); + + ywSignPlanService.updateSignPlan(ywSignPlanDTO); + + } + } + + return AjaxResult.success(); + + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "签到计划", businessType = BusinessType.DELETE) + @ApiOperation("删除签到计划") + @DeleteMapping("/plan/{id}") + public AjaxResult palnDelete(@PathVariable Long id) + { + try + { + ywSignPlanService.deleteSignPlan(id); + return AjaxResult.success(); + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @ApiOperation("根据用户ID获取该用户的签到") + @GetMapping(value = { "/", "/{userId}" }) + public TableDataInfo list(@PathVariable(value = "userId", required = false) Long userId) + { + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(YwSignLog::getUserId,userId); + List list = ywSignLogService.list(lambdaQueryWrapper); + return getDataTable(list); + } + + @Log(title = "批量签到", businessType = BusinessType.UPDATE) + @ApiOperation("后端批量签到") + @PostMapping("/signIn") + public AjaxResult signIn(@RequestBody YwSignInDTO ywSignInDTO) + { + try + { +// SysUser user = getLoginUser().getUser(); +// ywSignInDTO.setUserId(user.getUserId()); + ywSignLogService.SignIn(ywSignInDTO); + return AjaxResult.success(); + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "签到计划导入", businessType = BusinessType.IMPORT) + @PostMapping("/plan/import") + public AjaxResult importData(MultipartFile file, Boolean updateSupport,Long sceneBigId) throws Exception + { + ExcelUtil util = new ExcelUtil(YwSignPlanDTO.class); + List signPlanList = util.importExcel(file.getInputStream()); + return ywSignPlanService.importSignPlan(signPlanList,updateSupport,sceneBigId); +// return success(message); + } + + @Log(title = "签到记录导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response,YwSignLogDTO ywSignLogDTO) throws IllegalAccessException { + ywSignLogDTO.setIsExport(true); + ywSignLogDTO = (YwSignLogDTO) yw_sceneService.validateUserVenues(ywSignLogDTO,YwSignLogDTO.class,"venueIds"); + TableDataInfo resData=ywSignLogViewService.getSignLog(ywSignLogDTO); + List list = ReflectUtils.toList(resData.getRows(),YwSignLogVo.class); + ExcelUtil util = new ExcelUtil(YwSignLogVo.class); + util.exportExcel(response, list, "签到数据"); + } + + @Log(title = "签到计划导出", businessType = BusinessType.EXPORT) + @PostMapping("/plan/export") + public void exportPlan(YwSignPlanDTO ywSignPlanDTO,HttpServletResponse response) throws IllegalAccessException { + ywSignPlanDTO.setIsExport(true); + ywSignPlanDTO = (YwSignPlanDTO) yw_sceneService.validateUserVenues(ywSignPlanDTO,YwSignPlanDTO.class,"venueIds"); + TableDataInfo resData=ywSignPlanService.getSignPlan(ywSignPlanDTO); + List list = ReflectUtils.toList(resData.getRows(), YwSignPlanVo.class); + ExcelUtil util = new ExcelUtil(YwSignPlanVo.class); + util.exportExcel(response, list, "签到计划数据"); + } + + @Log(title = "签到统计导出", businessType = BusinessType.EXPORT) + @PostMapping("/static/export") + public void exportStatic(HttpServletResponse response,YwSignLogDTO ywSignLogDTO) throws IllegalAccessException { + ywSignLogDTO.setIsExport(true); + ywSignLogDTO = (YwSignLogDTO) yw_sceneService.validateUserVenues(ywSignLogDTO,YwSignLogDTO.class,"venueIds"); + List list=ywSignLogViewService.getSignLogStatic(ywSignLogDTO); + ExcelUtil util = new ExcelUtil(YwSignLogStaticVo.class); + util.exportExcel(response, list, "签到统计数据"); + } + + @Log(title = "签到统计/签到记录导出", businessType = BusinessType.EXPORT) + @PostMapping("/static/exportSign") + public void exportSign(HttpServletResponse response,YwSignLogDTO ywSignLogDTO) throws IllegalAccessException { + ywSignLogDTO.setIsExport(true); + ywSignLogDTO = (YwSignLogDTO) yw_sceneService.validateUserVenues(ywSignLogDTO,YwSignLogDTO.class,"venueIds"); + TableDataInfo resData=ywSignLogViewService.getSignLog(ywSignLogDTO); + List list = ReflectUtils.toList(resData.getRows(),YwSignLogVo.class); + ExcelUtil util = new ExcelUtil(YwSignLogVo.class); + util.exportExcel(response, list, "签到数据"); + } + + + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSparePartsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSparePartsController.java new file mode 100644 index 0000000000000000000000000000000000000000..b4e20f41e017880a8975b0b6dd80cfeb5a56ef52 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwSparePartsController.java @@ -0,0 +1,125 @@ +package com.ruoyi.web.controller.eastcom_yw; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwSpareParts; +import com.ruoyi.eastcom_yw.domain.dto.YwSparePartsDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwSparePartsQO; +import com.ruoyi.eastcom_yw.domain.vo.YwSparePartsVO; +import com.ruoyi.eastcom_yw.service.YwSparePartsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * 亚运备件表 前端控制器 + *

+ * + * @author yqf + * @since 2023-08-31 + */ +@Api(tags = "亚运备件管理") +@RestController +@RequestMapping("/eastcom_yw/ywSpareParts") +@Slf4j +@RequiredArgsConstructor +public class YwSparePartsController extends BaseController { + + private final YwSparePartsService ywSparePartsService; + + /** + * 亚运备件表列表 + */ + @ApiOperation(value = "亚运备件表列表", notes = "亚运备件表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwSparePartsQO qo) { + List list = ywSparePartsService.getData(qo); + return getDataTable(list); + } + + + /** + * 亚运备件表分页列表 + */ + @ApiOperation(value = "亚运备件表分页列表", notes = "亚运备件表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwSparePartsQO qo) { + IPage page = ywSparePartsService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 获取亚运备件表详情 + */ + @ApiOperation(value = "亚运备件表详情", notes = "亚运备件表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywSparePartsService.fetchById(id)); + } + + /** + * 新增或修改亚运备件表 + */ + @Log(title = "新增或修改亚运备件表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改亚运备件表", notes = "新增或修改亚运备件表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwSparePartsDTO dto) { + ywSparePartsService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除亚运备件表 + */ + @Log(title = "根据id删除亚运备件表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除亚运备件表", notes = "根据id删除亚运备件表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywSparePartsService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除亚运备件表 + */ + @Log(title = "根据id批量删除亚运备件表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除亚运备件表", notes = "根据id批量删除亚运备件表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywSparePartsService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "亚运备件表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwSparePartsDTO.class); + List list = util.importExcel(file.getInputStream()); + ywSparePartsService.importData(list); + return AjaxResult.success(); + } + + + /** + * 亚运备件表导出 + */ + @ApiOperation(value = "亚运备件表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwSparePartsQO qo) { + ywSparePartsService.export(qo); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwWireTaskLogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwWireTaskLogController.java new file mode 100644 index 0000000000000000000000000000000000000000..990b208324c8cf5db806ecee0965b50c55969d1c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/eastcom_yw/YwWireTaskLogController.java @@ -0,0 +1,418 @@ +package com.ruoyi.web.controller.eastcom_yw; + +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.common.enums.OrderType; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformRedisVo; +import com.ruoyi.cmcc_gm.service.YwMaterialsBatchService; +import com.ruoyi.cmcc_gm.service.YwMaterialsInformService; +import com.ruoyi.cmcc_gm.service.YwMaterialsOrderLogService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.XmlDocToDocxUtil; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.poi.WordUtil; +import com.ruoyi.common.utils.reflect.ReflectUtils; +import com.ruoyi.eastcom_yw.common.enums.WireTaskSubType; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwWireTaskLog; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwWireTaskLogDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogVo; +import com.ruoyi.eastcom_yw.domain.vo.YwWireTaskLogVo; +import com.ruoyi.eastcom_yw.mapper.YwWireTaskLogMapper; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.YwWireTaskLogService; +import com.ruoyi.sunlm.domain.class_scene_match; +import com.ruoyi.sunlm.mapper.dpConfigMapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.docx4j.Docx4J; +import org.docx4j.openpackaging.packages.WordprocessingMLPackage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.*; +import java.util.stream.Collectors; + + +/** + * + * @author jkj + * @since 2023-01-12 + */ + +@Api("综合布线") +@RestController +@RequestMapping("/eastcom_yw/wireTask") +public class YwWireTaskLogController extends BaseController { + + @Autowired + private YwWireTaskLogService ywWireTaskLogService; + + @Autowired + private YwWireTaskLogMapper ywWireTaskLogMapper; + + @Autowired + private YwMaterialsOrderLogService ywMaterialsOrderLogService; + + @Autowired + private YwMaterialsBatchService ywMaterialsBatchService; + + @Autowired + private YwMaterialsInformService ywMaterialsInformService; + + @Resource + dpConfigMapper MydpConfigMapper; + + @Autowired + private YwSceneService yw_sceneService; + + @Log(title = "布线记录", businessType = BusinessType.INSERT) + @ApiOperation("布线记录") + @PostMapping("/insert") + public AjaxResult insert(@RequestBody YwWireTaskLogDTO ywWireTaskLogDTO) + { + try + { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywWireTaskLogDTO.getWireTaskName()), YwWireTaskLog::getWireTaskName, ywWireTaskLogDTO.getWireTaskName()); + + if(ywWireTaskLogService.list(lambdaQueryWrapper).size()>0) + { + return AjaxResult.error("任务名称在该场馆或其他场馆已存在"); + } + + String res = ywWireTaskLogService.insertWireTaskLogReWireTaskId(ywWireTaskLogDTO); + if(StringUtils.isNotEmpty(res)) + { + return AjaxResult.success("新增布线日志成功",res); + } + else + { + return AjaxResult.error("新增布线日志失败"); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "布线记录", businessType = BusinessType.UPDATE) + @ApiOperation("布线记录") + @PostMapping("/update") + public AjaxResult update(@RequestBody YwWireTaskLogDTO ywWireTaskLogDTO) + { + try + { + boolean res = ywWireTaskLogService.updateWireTaskLog(ywWireTaskLogDTO); + if(res) + { + return AjaxResult.success(); + } + else + { + return AjaxResult.error("修改布线日志失败"); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "布线记录", businessType = BusinessType.DELETE) + @PostMapping("/delete") + public AjaxResult remove(@RequestBody YwWireTaskLogDTO ywWireTaskLogDTO) + { + try + { + boolean res = ywWireTaskLogService.deleteWireTaskLog(ywWireTaskLogDTO); + if(res) + { + return AjaxResult.success(); + } + else + { + return AjaxResult.error("删除布线日志失败"); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + } + + //预留。后期删除 + @Log(title = "布线记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{wireTaskId}") + public AjaxResult remove(@PathVariable String wireTaskId) + { + try + { + YwWireTaskLogDTO ywWireTaskLogDTO=new YwWireTaskLogDTO(); + ywWireTaskLogDTO.setWireTaskId(wireTaskId); + + boolean res = ywWireTaskLogService.deleteWireTaskLog(ywWireTaskLogDTO); + if(res) + { + return AjaxResult.success(); + } + else + { + return AjaxResult.error("删除布线日志失败"); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + } + + + @ApiOperation("获取场馆布线记录") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwWireTaskLogDTO ywWireTaskLogDTO) throws Exception { + ywWireTaskLogDTO = (YwWireTaskLogDTO) yw_sceneService.validateUserVenues(ywWireTaskLogDTO,YwWireTaskLogDTO.class,"venueIds"); + TableDataInfo resData = ywWireTaskLogService.getWireTaskLog(ywWireTaskLogDTO); + return getDataTable(resData.getRows(), resData.getTotal()); + } + + @Log(title = "导出场馆布线记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, YwWireTaskLogDTO ywWireTaskLogDTO) throws IllegalAccessException { + ywWireTaskLogDTO.setIsExport(true); + // ywWireTaskLogDTO.setPageNum(1); + ywWireTaskLogDTO.setPageSize(-1); + ywWireTaskLogDTO = (YwWireTaskLogDTO) yw_sceneService.validateUserVenues(ywWireTaskLogDTO,YwWireTaskLogDTO.class,"venueIds"); + TableDataInfo resData = ywWireTaskLogService.getWireTaskLog(ywWireTaskLogDTO); + List list = ReflectUtils.toList(resData.getRows(), YwWireTaskLogVo.class); + ExcelUtil util = new ExcelUtil(YwWireTaskLogVo.class); + util.exportExcel(response, list, "场馆布线数据"); + } + + + + + @ApiOperation("生成报告") + @PostMapping("/report") + public AjaxResult report(@RequestBody YwWireTaskLogDTO ywWireTaskLogDTO) throws Exception { + + if(StringUtils.isEmpty(ywWireTaskLogDTO.getWireTaskId())) + { + return AjaxResult.error("布线任务号不允许为空"); + } + + ywWireTaskLogDTO.setTaskType(2); + + //查询找布线,更新文件地址是拆线 + LambdaQueryWrapper wireTaskQuery = new LambdaQueryWrapper<>(); + wireTaskQuery.eq(YwWireTaskLog::getWireTaskId,ywWireTaskLogDTO.getWireTaskId()); +// wireTaskQuery.eq(YwWireTaskLog::getTaskType,1); + List wireTaskLogList = ywWireTaskLogService.list(wireTaskQuery); + + if(wireTaskLogList.isEmpty()) + { + return AjaxResult.error("没有找到这个布线任务"); + } + + if(wireTaskLogList.size() != 2) + { + return AjaxResult.error("布线任务未拆线"); + } + + Optional ywWireTaskLogCX = wireTaskLogList.stream().filter(x -> x.getTaskType() == 2 && "4".equals(x.getDealStatus())).findFirst(); + + if(!ywWireTaskLogCX.isPresent()) + { + return AjaxResult.error("拆线的流程还没结束"); + } + + Optional ywWireTaskLog = wireTaskLogList.stream().filter(x -> x.getTaskType() == 1 && "4".equals(x.getDealStatus())).findFirst(); + + Map dataMap = new HashMap<>(16); + dataMap.put("name", "\r \r"); + dataMap.put("beginTime", "\r \r"); + dataMap.put("endTime", "\r \r"); + dataMap.put("type", "\r \r"); + dataMap.put("taskSub", "\r \r"); + dataMap.put("venueName", "\r \r"); + + if(StringUtils.isNotEmpty(ywWireTaskLog.get().getMatchId())) + { + // int matchId = Integer.parseInt(ywWireTaskLog.get().getMatchId()); + //获取赛程信息 + class_scene_match match = MydpConfigMapper.getscenematch2(ywWireTaskLog.get().getMatchId(),ywWireTaskLog.get().getVenueId()); + + if(ObjectUtils.isNotEmpty(match)) + { + dataMap.put("name", match.taskName); + dataMap.put("beginTime",DateUtils.parseDateToStr("MM月dd日",match.getBeginTime())); + dataMap.put("endTime", DateUtils.parseDateToStr("MM月dd日",match.getEndTime())); + dataMap.put("type", DictUtils.getDictLabel("yw_match_type", match.getTaskType())); + } + } + + if(ObjectUtils.isNotEmpty(ywWireTaskLog.get().getTaskSubType())) + { + String strTaskSub = WireTaskSubType.getLabelByCode(ywWireTaskLog.get().getTaskSubType()); + if(StringUtils.isNotEmpty(strTaskSub)) + { + dataMap.put("taskSub",strTaskSub); + } + } + + if(StringUtils.isNotEmpty(ywWireTaskLog.get().getVenueName())) + { + dataMap.put("venueName", ywWireTaskLog.get().getVenueName()); + } + + List> noList = new ArrayList<>(); + int size = 7; + for (int i = 0; i < size; i++) { + Map map = new HashMap<>(16); + map.put("id", ""); + map.put("materialName", ""); + map.put("materialSmallClass", ""); + map.put("materialStand", ""); + map.put("materialUnit", ""); + map.put("sum", ""); + noList.add(map); + } + + dataMap.put("agisList", noList); + dataMap.put("wifiList", noList); + dataMap.put("voipList", noList); + +// 获取物资信息 + LambdaQueryWrapper materialOrderQuery = new LambdaQueryWrapper<>(); + materialOrderQuery.eq(YwMaterialsOrderLog::getWireTaskId, ywWireTaskLogDTO.getWireTaskId()); + +//必须场馆一致 + materialOrderQuery.eq(YwMaterialsOrderLog::getOutStoreVenue, ywWireTaskLog.get().getVenueId()); + + + //限制必须是工程出库数据 + materialOrderQuery.eq(YwMaterialsOrderLog::getOrderType, OrderType.CK.getCode()); + + List ywMaterialsOrderLogs = ywMaterialsOrderLogService.list(materialOrderQuery); + + if(!ywMaterialsOrderLogs.isEmpty()) + { + List> taskList = new ArrayList<>(); + + String[] arrOrderId = ywMaterialsOrderLogs.stream().map(YwMaterialsOrderLog::getOrderId).toArray(String[]::new); + + //获取物资批量数据 + System.out.println(JSONObject.toJSONString(arrOrderId)); + + QueryWrapper wrapper = new QueryWrapper() + .select("material_code,sum(sum) as sum") + .in("orderid",arrOrderId) + .groupBy("material_code"); + +// List> materialsBatchList = ywMaterialsBatchService.listMaps(wrapper); + List materialsBatchList = ywMaterialsBatchService.list(wrapper); + + //从缓存取物资信息 + List materialInfos = ywMaterialsInformService.getMaterials(); + + int i=1; + +// for (Map ywMaterialsBatch : materialsBatchList) { + for (YwMaterialsBatch ywMaterialsBatch : materialsBatchList) { + Optional materialInfoFilter = materialInfos.stream().filter(x -> ywMaterialsBatch.getMaterialCode().equals(x.getWzbh())).findFirst(); + + if(!materialInfoFilter.isPresent()) + { + continue; + } + + Map map = new HashMap<>(16); + map.put("id", i); + map.put("materialName", materialInfoFilter.get().getWzmc() ); + map.put("materialSmallClass",materialInfoFilter.get().getXl()); + map.put("materialStand",materialInfoFilter.get().getGgxh()); + map.put("materialUnit", materialInfoFilter.get().getWzdw()); + map.put("sum", ywMaterialsBatch.getSum()); + taskList.add(map); + i++; + + } + + if(WireTaskSubType.AGIS.getCode().equals(ywWireTaskLog.get().getTaskSubType())) { + dataMap.put("agisList", taskList); + } + + if(WireTaskSubType.INTERNET.getCode().equals(ywWireTaskLog.get().getTaskSubType())) { + dataMap.put("wifiList", taskList); + } + + if(WireTaskSubType.VOIP.getCode().equals(ywWireTaskLog.get().getTaskSubType())) { + dataMap.put("voipList", taskList); + } + + } + + WordUtil word = new WordUtil(); + + String fileName = ywWireTaskLogDTO.getWireTaskId() + "_布线任务报告_" + DateUtils.dateTime(); + +// String xmlFileName = fileName + ".xml"; + String wordFileName = fileName + ".docx"; +// String genPath = RuoYiConfig.getDownloadPath() + xmlFileName; + String wordPath = RuoYiConfig.getDownloadPath() + wordFileName; + String savePath = wordPath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX); +// logger.info(wordPath); + try { + + boolean res = word.createWord(dataMap, "wireReportTemplate.ftl", wordPath); + + if(res){ + + res = XmlDocToDocxUtil.invoke(wordPath); + + if(res) + { + ywWireTaskLogDTO.setReport(savePath); + + //回填地址到表 + ywWireTaskLogMapper.updateWireTaskReport(ywWireTaskLogDTO); + + return AjaxResult.success(savePath); + } + + } + } + catch (Exception ex){ + return AjaxResult.error(ex.getMessage()); + } + + return AjaxResult.error(); + + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java new file mode 100644 index 0000000000000000000000000000000000000000..12391c50d84488453bc5158008dc807574c0855f --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java @@ -0,0 +1,122 @@ +package com.ruoyi.web.controller.monitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysCache; + +/** + * 缓存监控 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/cache") +public class CacheController +{ + @Autowired + private RedisTemplate redisTemplate; + + private final static List caches = new ArrayList(); + { + caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息")); + caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息")); + caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典")); + caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码")); + caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交")); + caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); + caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); + caches.add(new SysCache(CacheConstants.SMS_ERR_CNT_KEY, "短信错误次数")); + caches.add(new SysCache(CacheConstants.DP_DATA, "大屏数据")); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping() + public AjaxResult getInfo() throws Exception + { + Properties info = (Properties) redisTemplate.execute((RedisCallback) connection -> connection.info()); + Properties commandStats = (Properties) redisTemplate.execute((RedisCallback) connection -> connection.info("commandstats")); + Object dbSize = redisTemplate.execute((RedisCallback) connection -> connection.dbSize()); + + Map result = new HashMap<>(3); + result.put("info", info); + result.put("dbSize", dbSize); + + List> pieList = new ArrayList<>(); + commandStats.stringPropertyNames().forEach(key -> { + Map data = new HashMap<>(2); + String property = commandStats.getProperty(key); + data.put("name", StringUtils.removeStart(key, "cmdstat_")); + data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); + pieList.add(data); + }); + result.put("commandStats", pieList); + return AjaxResult.success(result); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping("/getNames") + public AjaxResult cache() + { + return AjaxResult.success(caches); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping("/getKeys/{cacheName}") + public AjaxResult getCacheKeys(@PathVariable String cacheName) + { + Set cacheKeys = redisTemplate.keys(cacheName + "*"); + return AjaxResult.success(cacheKeys); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping("/getValue/{cacheName}/{cacheKey}") + public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) + { + String cacheValue = redisTemplate.opsForValue().get(cacheKey); + SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); + return AjaxResult.success(sysCache); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @DeleteMapping("/clearCacheName/{cacheName}") + public AjaxResult clearCacheName(@PathVariable String cacheName) + { + Collection cacheKeys = redisTemplate.keys(cacheName + "*"); + redisTemplate.delete(cacheKeys); + return AjaxResult.success(); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @DeleteMapping("/clearCacheKey/{cacheKey}") + public AjaxResult clearCacheKey(@PathVariable String cacheKey) + { + redisTemplate.delete(cacheKey); + return AjaxResult.success(); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @DeleteMapping("/clearCacheAll") + public AjaxResult clearCacheAll() + { + Collection cacheKeys = redisTemplate.keys("*"); + redisTemplate.delete(cacheKeys); + return AjaxResult.success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java new file mode 100644 index 0000000000000000000000000000000000000000..cc805ad89da5deb3b6f7830a66e653823c2aab14 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java @@ -0,0 +1,27 @@ +package com.ruoyi.web.controller.monitor; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.framework.web.domain.Server; + +/** + * 服务器监控 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/server") +public class ServerController +{ + @PreAuthorize("@ss.hasPermi('monitor:server:list')") + @GetMapping() + public AjaxResult getInfo() throws Exception + { + Server server = new Server(); + server.copyTo(); + return AjaxResult.success(server); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java new file mode 100644 index 0000000000000000000000000000000000000000..e0175f490e942cf59bbd88bbff4a19af428af407 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -0,0 +1,82 @@ +package com.ruoyi.web.controller.monitor; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.service.SysPasswordService; +import com.ruoyi.system.domain.SysLogininfor; +import com.ruoyi.system.service.ISysLogininforService; + +/** + * 系统访问记录 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/logininfor") +public class SysLogininforController extends BaseController +{ + @Autowired + private ISysLogininforService logininforService; + + @Autowired + private SysPasswordService passwordService; + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") + @GetMapping("/list") + public TableDataInfo list(SysLogininfor logininfor) + { + startPage(); + List list = logininforService.selectLogininforList(logininfor); + return getDataTable(list); + } + + @Log(title = "登录日志", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysLogininfor logininfor) + { + List list = logininforService.selectLogininforList(logininfor); + ExcelUtil util = new ExcelUtil(SysLogininfor.class); + util.exportExcel(response, list, "登录日志"); + } + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") + @Log(title = "登录日志", businessType = BusinessType.DELETE) + @DeleteMapping("/{infoIds}") + public AjaxResult remove(@PathVariable Long[] infoIds) + { + return toAjax(logininforService.deleteLogininforByIds(infoIds)); + } + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") + @Log(title = "登录日志", businessType = BusinessType.CLEAN) + @DeleteMapping("/clean") + public AjaxResult clean() + { + logininforService.cleanLogininfor(); + return success(); + } + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") + @Log(title = "账户解锁", businessType = BusinessType.OTHER) + @GetMapping("/unlock/{userName}") + public AjaxResult unlock(@PathVariable("userName") String userName) + { + passwordService.clearLoginRecordCache(userName); + return success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java new file mode 100644 index 0000000000000000000000000000000000000000..6ca78cf7c70583cf4e1a4248094401db4f83dfc0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -0,0 +1,69 @@ +package com.ruoyi.web.controller.monitor; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.SysOperLog; +import com.ruoyi.system.service.ISysOperLogService; + +/** + * 操作日志记录 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/operlog") +public class SysOperlogController extends BaseController +{ + @Autowired + private ISysOperLogService operLogService; + + @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") + @GetMapping("/list") + public TableDataInfo list(SysOperLog operLog) + { + startPage(); + List list = operLogService.selectOperLogList(operLog); + return getDataTable(list); + } + + @Log(title = "操作日志", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysOperLog operLog) + { + List list = operLogService.selectOperLogList(operLog); + ExcelUtil util = new ExcelUtil(SysOperLog.class); + util.exportExcel(response, list, "操作日志"); + } + + @Log(title = "操作日志", businessType = BusinessType.DELETE) + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") + @DeleteMapping("/{operIds}") + public AjaxResult remove(@PathVariable Long[] operIds) + { + return toAjax(operLogService.deleteOperLogByIds(operIds)); + } + + @Log(title = "操作日志", businessType = BusinessType.CLEAN) + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") + @DeleteMapping("/clean") + public AjaxResult clean() + { + operLogService.cleanOperLog(); + return success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java new file mode 100644 index 0000000000000000000000000000000000000000..1128b69ba5c3126ce89ab07722c4e60607c7c2c0 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -0,0 +1,145 @@ +package com.ruoyi.web.controller.monitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.constant.HttpStatus; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysUserOnline; +import com.ruoyi.system.service.ISysUserOnlineService; + +/** + * 在线用户监控 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/online") +public class SysUserOnlineController extends BaseController +{ + @Autowired + private ISysUserOnlineService userOnlineService; + + @Autowired + private RedisCache redisCache; + + @GetMapping("/listNum") + public TableDataInfo listNum() + { + Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); + List userOnlineList = new ArrayList(); + for (String key : keys) + { + LoginUser user = redisCache.getCacheObject(key); + + if(ObjectUtils.isEmpty(user)) + { + continue; + } + + if(ObjectUtils.isEmpty(user.getUserId())) + { + continue; + } + + //去除重复用户 + if(!userOnlineList.isEmpty()) + { + Long userNum = userOnlineList.stream().filter(x->x.getUserId().equals(user.getUserId())).count(); + if(userNum>0) + { + continue; + } + } + userOnlineList.add(user); + } + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + rspData.setTotal(userOnlineList.size()); + return rspData; + } + +// @PreAuthorize("@ss.hasPermi('monitor:online:list')") + @GetMapping("/list") + public TableDataInfo list(String ipaddr, String userName) + { + Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); + List userOnlineList = new ArrayList(); + for (String key : keys) + { + LoginUser user = redisCache.getCacheObject(key); + +// //去除重复用户 +// if(!userOnlineList.isEmpty()) +// { +// Long userNum = userOnlineList.stream().filter(x->x.getUserId().equals(user.getUserId())).count(); +// if(userNum>0) +// { +// continue; +// } +// } + + if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) + { + if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) + { + userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); + } + } + else if (StringUtils.isNotEmpty(ipaddr)) + { + if (StringUtils.equals(ipaddr, user.getIpaddr())) + { + userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); + } + } + else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) + { + if (StringUtils.equals(userName, user.getUsername())) + { + userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); + } + } + else + { + userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); + } + } + Collections.reverse(userOnlineList); + userOnlineList.removeAll(Collections.singleton(null)); + return getDataTable(userOnlineList); + } + + /** + * 强退用户 + */ + @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") + @Log(title = "在线用户", businessType = BusinessType.FORCE) + @DeleteMapping("/{tokenId}") + public AjaxResult forceLogout(@PathVariable String tokenId) + { + redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); + return success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/DpApiController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/DpApiController.java new file mode 100644 index 0000000000000000000000000000000000000000..ba5b2d1b2f6da9d77a6aa27c358690b06f2c0efd --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/DpApiController.java @@ -0,0 +1,53 @@ +package com.ruoyi.web.controller.sunlm; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.sunlm.domain.class_dp_scene_seat_detail; +import com.ruoyi.sunlm.domain.class_dp_scene_seat_info; +import com.ruoyi.sunlm.mapper.DpApiMapper; +import com.ruoyi.sunlm.mapper.dpYayunMapper; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + +/** + * @author yqf + * @date 2023/4/18 + */ +@RestController +@CrossOrigin +@RequestMapping("/eastcom_yw/daping") +public class DpApiController extends BaseController { + + @Resource + DpApiMapper dpApiMapper; //直接在这里引用数据库操作层(MAPPER),就不用写Service层了! + + + //region --------------------------------------------------------------------------------------------获取dp_scene_seat_info数据 + //-------------------------------------------- + @ApiOperation("获取get_seat_info表信息 sceneid:场馆ID") + @GetMapping(value = "/get_seat_info") + public AjaxResult get_scene_seat_info(@NotNull(message = "sceneid不饿能为空") @RequestParam int sceneid) + { + class_dp_scene_seat_info dpData=new class_dp_scene_seat_info(); + dpData = dpApiMapper.get_scene_seat_info(sceneid); + return success(dpData); + } + //endregion + + //region --------------------------------------------------------------------------------------------获取dp_scene_seat_detail数据 + //-------------------------------------------- + @ApiOperation("获取get_seat_info表信息 sceneid:场馆ID") + @GetMapping(value = "/get_seat_detail") + public AjaxResult get_seat_detail(@NotNull(message = "sceneid不饿能为空") @RequestParam int sceneid) + { + List dpData=new ArrayList<>(); + dpData = dpApiMapper.get_seat_detail(sceneid); + return success(dpData); + } + //endregion +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/dpConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/dpConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..abc08ef72ceb9b01538d25ee85f56157def920ed --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/dpConfigController.java @@ -0,0 +1,983 @@ +package com.ruoyi.web.controller.sunlm; + +import java.util.ArrayList; +import java.util.List; + +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.sunlm.domain.*; +import com.ruoyi.sunlm.entity.*; +import com.ruoyi.sunlm.mapper.dpConfigMapper; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.page.TableDataInfo; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +/** + * 参数配置 信息操作处理 + * + * @author ruoyi + * Spring Security提供了Spring EL表达式,允许我们在定义接口访问的方法上面添加注解,来控制访问权限 + * + * 方法 参数 描述 + * hasPermi String 验证用户是否具备某权限 + * lacksPermi String 验证用户是否不具备某权限,与hasPermi逻辑相反 + * hasAnyPermi String 验证用户是否具有以下任意一个权限 + * hasRole String 判断用户是否拥有某个权限 + * lacksRole String 验证用户是否不具备某个权限,与hasRole逻辑相反 + * hasAnyRoles String 验证用户是否具有以下任意一个角色,多个逗号分隔 + + */ + +@RestController +@CrossOrigin +@RequestMapping("/eastcom_yw/config") + +public class dpConfigController extends BaseController +{ + @Resource + dpConfigMapper MydpConfigMapper; //直接在这里引用数据库操作层(MAPPER),就不用写Service层了! + + @Resource + YwSceneService ywSceneService; + + //region --------------------------------------------------------------------------------------------场景增删改查接口 + //--------------------------------------------获取大场馆列表 + @ApiOperation("根据场景ID获取场景") + @GetMapping(value = "/getscenebig/{sceneid}") + public AjaxResult getscenebig(@PathVariable int sceneid, HttpServletRequest request) + { + class_scene_big_config scenebig=new class_scene_big_config(); + scenebig = MydpConfigMapper.getscenebig(sceneid); + return success(scenebig); + } + + @ApiOperation("根据查询条件获取场景") + @GetMapping(value = "/getscenebiglist") + @RepeatSubmit(enable = false,interval = 1000) + public TableDataInfo getscenebiglists(scene_big_entity_list jsonObject, HttpServletRequest request) + { + List scenebig=new ArrayList(); + String name=jsonObject.name==null?"":jsonObject.name; + List status=jsonObject.status==null?new ArrayList():jsonObject.status; + String remark=jsonObject.remark==null?"":jsonObject.remark; + int pagenumber=jsonObject.pageNum; + int pagesize=jsonObject.pageSize; + scenebig = MydpConfigMapper.getscenebiglists(name,status,remark,pagenumber,pagesize); + Long total=MydpConfigMapper.getscenebiglistscnt(name,status,remark); + return getDataTable(scenebig,total); + } + + @ApiOperation("根据查询条件导出场景") + @PostMapping("/exportscenebiglist") + public void exportscenebiglist(HttpServletResponse response, scene_big_entity_list jsonObject) + { + List scenebig=new ArrayList(); + String name=jsonObject.name==null?"":jsonObject.name; + List status=jsonObject.status==null?new ArrayList():jsonObject.status; + String remark=jsonObject.remark==null?"":jsonObject.remark; + int pagenumber=1; //jsonObject.pageNum==0?1:jsonObject.pageNum; + int pagesize=100000; //jsonObject.pageSize==0?100000:jsonObject.pageSize; + + scenebig = MydpConfigMapper.getscenebiglists(name,status,remark,pagenumber,pagesize); + ExcelUtil util = new ExcelUtil(class_scene_big_config.class); + util.exportExcel(response, scenebig, "场景数据"); + } + + //----------------------------------------------新增大场馆 + public int getscenebigbyName(String name) + { + int counts= MydpConfigMapper.getscenebigbyName(name); + return counts; + } + + @ApiOperation("新建场景") + @PostMapping(value = "/newscenebig") + public AjaxResult newscenebig(@RequestBody scene_big_entity_new jsonObject, HttpServletRequest request) + { + String sRet=""; + String name=jsonObject.name==null?"":jsonObject.name; + String status=jsonObject.status==null?"":jsonObject.status; + String username=jsonObject.createBy==null?"":jsonObject.createBy; + String remark=jsonObject.remark==null?"":jsonObject.remark; + //--------------需要判断是否已经存在同名的记录 + if (getscenebigbyName(name)>0) + { + return AjaxResult.error("场景"+name+"已存在!"); + } + //-------------- + try { + MydpConfigMapper.NewSceneBig(name,status,username,remark); + sRet = "新增成功"; + } catch (Exception e) { + sRet = "新增失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("新增成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------修改大场馆 + public int getscenebigbyNameForUpdate(String name,int id) + { + int counts= MydpConfigMapper.getscenebigbyNameForUpdate(name,id); + return counts; + } + + @ApiOperation("修改场景") + @PutMapping(value = "/updatescenebig") + public AjaxResult updatescenebig(@RequestBody scene_big_entity_upt jsonObject, HttpServletRequest request) + { + String sRet=""; + int id=jsonObject.id; + String status=jsonObject.status==null?"":jsonObject.status; + String name=jsonObject.name==null?"":jsonObject.name; + String remark=jsonObject.remark==null?"":jsonObject.remark; + String username=jsonObject.updateBy==null?"":jsonObject.updateBy; + //--------------需要判断是否已经存在同名的记录 + if (getscenebigbyNameForUpdate(name,id)>0) + { + return AjaxResult.error("场景"+name+"已存在!"); + } + try { + MydpConfigMapper.UpdateSceneBig(id,name,status,username,remark); + //修改成功后,缓存更新一下 + ywSceneService.loadingVenueCache(); + sRet = "修改成功"; + } catch (Exception e) { + sRet = "修改失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("修改成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------删除大场馆 + @ApiOperation("删除场景") + @DeleteMapping(value = "/deletescenebig/{sceneid}") + public AjaxResult deletescenebig(@PathVariable int[] sceneid,HttpServletRequest request) + { + String sRet=""; + try { + for (int i=0;i scenecalendar=new ArrayList(); + + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + List sceneid=jsonObject.sceneIds==null?new ArrayList():jsonObject.sceneIds; + String matchtype=jsonObject.matchType==null?"":jsonObject.matchType; + String matchname=jsonObject.matchName==null?"":jsonObject.matchName; + String status=jsonObject.status==null?"":jsonObject.status; + String matchremark=jsonObject.matchRemark==null?"":jsonObject.matchRemark; + String matchdate=jsonObject.matchDate==null?"":jsonObject.matchDate; + String goldpoint=jsonObject.goldPoint==null?"":jsonObject.goldPoint; + + int pagenumber=jsonObject.pageNum; + int pagesize=jsonObject.pageSize; + scenecalendar= MydpConfigMapper.getscenecalendarlists(scenebigid,sceneid,matchtype,matchname,status,matchremark,pagenumber,pagesize,matchdate,goldpoint); + Long total=MydpConfigMapper.getscenecalendarlistscnt(scenebigid,sceneid,matchtype,matchname,status,matchremark,matchdate,goldpoint); + return getDataTable(scenecalendar,total); + } + + @ApiOperation("根据查询条件导出赛事") + @PostMapping("/exportscenecalendarlist") + public void exportscenecalendarlist(HttpServletResponse response, scene_calendar_entity_list jsonObject) + { + List scenecalendar=new ArrayList(); + + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + List sceneid=jsonObject.sceneIds==null?new ArrayList():jsonObject.sceneIds; + String matchtype=jsonObject.matchType==null?"":jsonObject.matchType; + String matchname=jsonObject.matchName==null?"":jsonObject.matchName; + String status=jsonObject.status==null?"":jsonObject.status; + String matchremark=jsonObject.matchRemark==null?"":jsonObject.matchRemark; + String matchdate=jsonObject.matchDate==null?"":jsonObject.matchDate; + String goldpoint=jsonObject.goldPoint==null?"":jsonObject.goldPoint; + + int pagenumber=1;//jsonObject.pageNum==0?1:jsonObject.pageNum; + int pagesize=100000;//jsonObject.pageSize==0?100000:jsonObject.pageSize; + + scenecalendar = MydpConfigMapper.getscenecalendarlists(scenebigid,sceneid,matchtype,matchname,status,matchremark,pagenumber,pagesize,matchdate,goldpoint); + scenecalendar.forEach((x)->{ + x.setMatchType(DictUtils.getDictLabel("yw_match_type", x.getMatchType())); + if ("1".equals(x.getStatus())) { + x.setStatus("停用"); + } else if ("0".equals(x.getStatus())) { + x.setStatus("启用"); + } + }); + ExcelUtil util = new ExcelUtil(class_scene_calendar.class); + util.exportExcel(response, scenecalendar, "赛事数据"); + } + + //----------------------------------------------新增赛事 + public int getscenecalendarbyName(int sceneId,String name) + { + int counts= MydpConfigMapper.getscenecalendarbyName(sceneId,name); + return counts; + } + + @ApiOperation("新建赛事") + @PostMapping(value = "/newscenecalendar") + public AjaxResult newscenecalendar(@RequestBody scene_calendar_entity_new jsonObject, HttpServletRequest request) + { + String sRet=""; + + int sceneid=jsonObject.sceneId; + String matchtype=jsonObject.matchType==null?"":jsonObject.matchType; + String matchname=jsonObject.matchName==null?"":jsonObject.matchName; + String status=jsonObject.status==null?"":jsonObject.status; + String matchremark=jsonObject.matchRemark==null?"":jsonObject.matchRemark; + + String beginTime=jsonObject.beginTime==null?"00:00":jsonObject.beginTime; + String endTime=jsonObject.endTime==null?"00:00":jsonObject.endTime; + String matchDate=jsonObject.matchDate==null?"2000-01-01":jsonObject.matchDate; + String goldpoint=jsonObject.goldPoint==null?"":jsonObject.goldPoint; + + //--------------需要判断是否已经存在同名的记录 + /*if (getscenecalendarbyName(sceneid,matchname)>0) + { + return AjaxResult.error("赛事"+matchname+"已存在!"); + }*/ + //-------------- + try { + MydpConfigMapper.NewScenecalendar(sceneid,matchtype,matchname,status,matchremark,beginTime,endTime,matchDate,goldpoint); + sRet = "新增成功"; + } catch (Exception e) { + sRet = "新增失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("新增成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------修改赛事信息 + public int getscenecalendarbyNameForUpdate(int sceneId,String name,int id) + { + int counts= MydpConfigMapper.getscenecalendarbyNameForUpdate(sceneId,name,id); + return counts; + } + + @ApiOperation("修改赛事") + @PutMapping(value = "/updatescenecalendar") + public AjaxResult updatescenecalendar(@RequestBody scene_calendar_entity_upt jsonObject, HttpServletRequest request) + { + String sRet=""; + int id=jsonObject.id; + int sceneid=jsonObject.sceneId; + String matchtype=jsonObject.matchType==null?"":jsonObject.matchType; + String matchname=jsonObject.matchName==null?"":jsonObject.matchName; + String status=jsonObject.status==null?"":jsonObject.status; + String matchremark=jsonObject.matchRemark==null?"":jsonObject.matchRemark; + + String beginTime=jsonObject.beginTime==null?"00:00":jsonObject.beginTime; + String endTime=jsonObject.endTime==null?"00:00":jsonObject.endTime; + String matchDate=jsonObject.matchDate==null?"2000-01-01":jsonObject.matchDate; + String goldpoint=jsonObject.goldPoint==null?"":jsonObject.goldPoint; + + //--------------需要判断是否已经存在同名的记录 + /*if (getscenecalendarbyNameForUpdate(sceneid,matchname,id)>0) + { + return AjaxResult.error("赛事"+matchname+"已存在!"); + }*/ + + try { + MydpConfigMapper.UpdateScenecalendar(id,sceneid,matchtype,matchname,status,matchremark,beginTime,endTime,matchDate,goldpoint); + sRet = "修改成功"; + } catch (Exception e) { + sRet = "修改失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("修改成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------删除赛事 + @ApiOperation("删除赛事") + @DeleteMapping(value = "/deletescenecalendar/{matchid}") + public AjaxResult deletescenecalendar(@PathVariable int[] matchid,HttpServletRequest request) + { + String sRet=""; + try { + for (int i=0;i(); + sceneteam.dutyScene=new ArrayList(); + sceneteam = MydpConfigMapper.getsceneteam(teamid); + //---------------------- + sceneteam.user=MydpConfigMapper.getsceneteam_user(teamid); + sceneteam.dutyScene=MydpConfigMapper.getsceneteam_dutyscene(teamid); + //---------------------- + return success(sceneteam); + } + + //----------------------------获取当前场景ID + public String getSceneStatusIs2() + { + return MydpConfigMapper.getSceneBigIs2(); + } + + @ApiOperation("根据查询条件获取施工单位") + @PostMapping(value = "/getsceneteamlist") + public TableDataInfo getsceneteamlists(@RequestBody class_scene_team_list jsonObject, HttpServletRequest request) + { + List sceneteam=new ArrayList(); + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + + String specialty=jsonObject.specialty==null?"":jsonObject.specialty; + String venderName=jsonObject.venderName==null?"":jsonObject.venderName; + String status=jsonObject.status==null?"":jsonObject.status; + String county=jsonObject.county==null?"":jsonObject.county; + String city=jsonObject.county==null?"":jsonObject.city; + List sceneIds=jsonObject.sceneIds==null?new ArrayList():jsonObject.sceneIds; + + int pagenumber=jsonObject.pageNum; + int pagesize=jsonObject.pageSize; + sceneteam= MydpConfigMapper.getsceneteamlists(scenebigid,specialty,venderName,status,county,city,sceneIds,pagenumber,pagesize); + Long total=MydpConfigMapper.getsceneteamlistscnt(scenebigid,specialty,venderName,status,county,city,sceneIds); + //---------------------- + for (int i=0;i(); + sceneteam.get(i).dutyScene=new ArrayList(); + //---------------------- + sceneteam.get(i).user=MydpConfigMapper.getsceneteam_user(sceneteam.get(i).id); + sceneteam.get(i).dutyScene=MydpConfigMapper.getsceneteam_dutyscene(sceneteam.get(i).id); + //----------------------- + String sNames=""; + for (int m=0;m0) && (sNames.substring(sNames.length() - 1).equals(","))) + { + sNames = sNames.substring(0, sNames.length() - 1) ; // 去掉最后一个逗号 + sceneteam.get(i).dutySceneNames = sNames; + } + } + //----------------------- + return getDataTable(sceneteam,total); + } + + @ApiOperation("根据查询条件导出施工单位") + @PostMapping("/exportsceneteamlist") + public void exportsceneteamlist(HttpServletResponse response,class_scene_team_list jsonObject) + { + + List sceneteam=new ArrayList(); + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + + String specialty=jsonObject.specialty==null?"":jsonObject.specialty; + String venderName=jsonObject.venderName==null?"":jsonObject.venderName; + String status=jsonObject.status==null?"":jsonObject.status; + String county=jsonObject.county==null?"":jsonObject.county; + String city=jsonObject.county==null?"":jsonObject.city; + List sceneIds=jsonObject.sceneIds==null?new ArrayList():jsonObject.sceneIds; + + int pagenumber=1; //jsonObject.pageNum==0?1:jsonObject.pageNum; + int pagesize=100000; //jsonObject.pageSize==0?100000:jsonObject.pageSize; + + sceneteam = MydpConfigMapper.getsceneteamlists(scenebigid,specialty,venderName,status,county,city,sceneIds,pagenumber,pagesize); + //----------------------- + for (int i=0;i(); + sceneteam.get(i).dutyScene=new ArrayList(); + //---------------------- + sceneteam.get(i).user=MydpConfigMapper.getsceneteam_user(sceneteam.get(i).id); + sceneteam.get(i).dutyScene=MydpConfigMapper.getsceneteam_dutyscene(sceneteam.get(i).id); + //----------------------- + String sNames=""; + for (int m=0;m0) && (sNames.substring(sNames.length() - 1).equals(","))) + { + sNames = sNames.substring(0, sNames.length() - 1) ; // 去掉最后一个逗号 + sceneteam.get(i).dutySceneNames = sNames; + } + } + + ExcelUtil util = new ExcelUtil(class_scene_team.class); + util.exportExcel(response, sceneteam, "施工单位数据"); + } + + + //----------------------------------------------新增施工单位 + public int getsceneteambyName(String vendername) + { + int counts= MydpConfigMapper.getsceneteambyName(vendername); + return counts; + } + + @ApiOperation("新建施工单位") + @PostMapping(value = "/newsceneteam") + public AjaxResult newsceneteam(@RequestBody class_scene_team_new jsonObject, HttpServletRequest request) + { + String sRet=""; + + int sceneBigId=jsonObject.sceneBigId==0?Integer.parseInt(getSceneStatusIs2()):jsonObject.sceneBigId; + + String specialty=jsonObject.specialty==null?"":jsonObject.specialty; + String venderName=jsonObject.venderName==null?"":jsonObject.venderName; + String status=jsonObject.status==null?"":jsonObject.status; + String county=jsonObject.county==null?"":jsonObject.county; + String city=jsonObject.county==null?"":jsonObject.city; + String remark=jsonObject.remark==null?"":jsonObject.remark; + + List dutySceneIds=jsonObject.dutySceneIds==null?new ArrayList():jsonObject.dutySceneIds; + // List userIds=jsonObject.userIds; + + //--------------需要判断是否已经存在同名的记录 + if (getsceneteambyName(venderName)>0) + { + return AjaxResult.error("施工单位"+venderName+"已存在!"); + } + //-------------- + try { + MydpConfigMapper.NewSceneteam(sceneBigId,specialty,venderName,status,county,city,remark,dutySceneIds); + sRet = "新增成功"; + } catch (Exception e) { + sRet = "新增失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("新增成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //--------------------------修改施工单位信息 + public int getsceneteambyNameForUpdate(String vendername,int id) + { + int counts= MydpConfigMapper.getsceneteambyNameForUpdate(vendername,id); + return counts; + } + + @ApiOperation("修改施工单位") + @PutMapping(value = "/updatesceneteam") + public AjaxResult updatesceneteam(@RequestBody class_scene_team_upt jsonObject, HttpServletRequest request) + { + String sRet=""; + int id=jsonObject.id; + int sceneBigId=jsonObject.sceneBigId==0?Integer.parseInt(getSceneStatusIs2()):jsonObject.sceneBigId; + + String specialty=jsonObject.specialty==null?"":jsonObject.specialty; + String venderName=jsonObject.venderName==null?"":jsonObject.venderName; + String status=jsonObject.status==null?"":jsonObject.status; + String county=jsonObject.county==null?"":jsonObject.county; + String city=jsonObject.county==null?"":jsonObject.city; + String remark=jsonObject.remark==null?"":jsonObject.remark; + + List dutySceneIds=jsonObject.dutySceneIds==null?new ArrayList():jsonObject.dutySceneIds; + // List userIds=jsonObject.userIds; + //--------------需要判断是否已经存在同名的记录 + if (getsceneteambyNameForUpdate(venderName,id)>0) + { + return AjaxResult.error("施工单位"+venderName+"已存在!"); + } + + try { + MydpConfigMapper.UpdateSceneteam(id,sceneBigId,specialty,venderName,status,county,city,remark,dutySceneIds); + sRet = "修改成功"; + } catch (Exception e) { + sRet = "修改失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("修改成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------删除施工单位 + @ApiOperation("删除施工单位") + @DeleteMapping(value = "/deletesceneteam/{teamid}") + public AjaxResult deletesceneteam(@PathVariable int[] teamid,HttpServletRequest request) + { + String sRet=""; + try { + for (int i=0;i publicnews=new ArrayList(); + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + String title=jsonObject.title==null?"":jsonObject.title; + + String content=jsonObject.content==null?"":jsonObject.content; + int pagenumber=jsonObject.pageNum; + int pagesize=jsonObject.pageSize; + + publicnews = MydpConfigMapper.getpublicnewslists(scenebigid,title,content,pagenumber,pagesize); + Long total=MydpConfigMapper.getpublicnewslistscnt(scenebigid,title,content); + return getDataTable(publicnews,total); + } + + @ApiOperation("根据查询条件导出公众新闻") + @PostMapping("/exportpublicnewslist") + public void exportpublicnewslist(HttpServletResponse response, class_public_news_list jsonObject) + { + List publicnews=new ArrayList(); + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + String title=jsonObject.title==null?"":jsonObject.title; + + String content=jsonObject.content==null?"":jsonObject.content; + + int pagenumber=1; //jsonObject.pageNum==0?1:jsonObject.pageNum; + int pagesize=100000; //jsonObject.pageSize==0?100000:jsonObject.pageSize; + + publicnews = MydpConfigMapper.getpublicnewslists(scenebigid,title,content,pagenumber,pagesize); + ExcelUtil util = new ExcelUtil(class_public_news.class); + util.exportExcel(response, publicnews, "公众新闻数据"); + } + + //----------------------------------------------新增公众新闻 + public int getpublicnewsbyName(String sceneBigId,String title) + { + int counts= MydpConfigMapper.getpublicnewsbyName(Integer.parseInt(sceneBigId),title); + return counts; + } + + @ApiOperation("新建公众新闻") + @PostMapping(value = "/newpublicnews") + public AjaxResult newpublicnews(@RequestBody class_public_news_new jsonObject, HttpServletRequest request) + { + String sRet=""; + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + String title=jsonObject.title==null?"":jsonObject.title; + String url=jsonObject.contentUrl==null?"":jsonObject.contentUrl; + String content=jsonObject.content==null?"":jsonObject.content; + String username=jsonObject.updateBy==null?"":jsonObject.updateBy; + //--------------需要判断是否已经存在同名的记录 + if (getpublicnewsbyName(scenebigid,title)>0) + { + return AjaxResult.error("新闻标题"+title+"已存在!"); + } + //-------------- + try { + MydpConfigMapper.Newpublicnews(Integer.parseInt(scenebigid),title,url,content,username); + sRet = "新增成功"; + } catch (Exception e) { + sRet = "新增失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("新增成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------修改 + public int getpublicnewsbyNameForUpdate(String sceneBigId,String title,int id) + { + int counts= MydpConfigMapper.getpublicnewsbyNameForUpdate(Integer.parseInt(sceneBigId),title,id); + return counts; + } + + @ApiOperation("修改公众新闻") + @PutMapping(value = "/updatepublicnews") + public AjaxResult updatepublicnews(@RequestBody class_public_news_upt jsonObject, HttpServletRequest request) + { + String sRet=""; + int id=jsonObject.id; + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + String title=jsonObject.title==null?"":jsonObject.title; + String url=jsonObject.contentUrl==null?"":jsonObject.contentUrl; + String content=jsonObject.content==null?"":jsonObject.content; + String username=jsonObject.updateBy==null?"":jsonObject.updateBy; + //----------------------------------------- + if (getpublicnewsbyNameForUpdate(scenebigid,title,id)>0) + { + return AjaxResult.error("新闻标题"+title+"已存在!"); + } + try { + MydpConfigMapper.UpdatePublicNews(id,Integer.parseInt(scenebigid),title,url,content,username); + sRet = "修改成功"; + } catch (Exception e) { + sRet = "修改失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("修改成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------删除 + @ApiOperation("删除公众新闻") + @DeleteMapping(value = "/deletepublicnews/{newsid}") + public AjaxResult deletepublicnews(@PathVariable int[] newsid,HttpServletRequest request) + { + String sRet=""; + try { + for (int i=0;i medalstand=new ArrayList(); + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + String areaName=jsonObject.areaName==null?"":jsonObject.areaName; + + int pagenumber=jsonObject.pageNum; + int pagesize=jsonObject.pageSize; + + medalstand = MydpConfigMapper.getmedalstandlists(scenebigid,areaName,pagenumber,pagesize); + Long total=MydpConfigMapper.getmedalstandlistscnt(scenebigid,areaName); + return getDataTable(medalstand,total); + } + + @ApiOperation("根据查询条件导出奖牌榜") + @PostMapping("/exportmedalstandlist") + public void exportmedalstandlist(HttpServletResponse response, class_medal_stand_list jsonObject) + { + List medalstand=new ArrayList(); + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + String areaName=jsonObject.areaName==null?"":jsonObject.areaName; + + int pagenumber=1; //jsonObject.pageNum==0?1:jsonObject.pageNum; + int pagesize=100000; //jsonObject.pageSize==0?100000:jsonObject.pageSize; + + medalstand = MydpConfigMapper.getmedalstandlists(scenebigid,areaName,pagenumber,pagesize); + ExcelUtil util = new ExcelUtil(class_medal_stand.class); + util.exportExcel(response, medalstand, "奖牌榜数据"); + } + + //----------------------------------------------新增 + public int getmedalstandbyName(String sceneBigId,String areaName) + { + int scenebigid=Integer.parseInt(sceneBigId); + int counts= MydpConfigMapper.getmedalstandbyName(scenebigid,areaName); + return counts; + } + + ////TEST : {"areaName":"CHAOXIAN","goldCount":10,"silverCount":1,"bronzeCount":10,"medalsCount":21,"updateBy":"ME"} + @ApiOperation("新建奖牌榜") + @PostMapping(value = "/newmedalstand") + public AjaxResult newmedalstand(@RequestBody class_medal_stand_new jsonObject, HttpServletRequest request) + { + String sRet=""; + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + String areaName=jsonObject.areaName==null?"":jsonObject.areaName; + String goldCount=jsonObject.goldCount==null?"0":jsonObject.goldCount; + String silverCount=jsonObject.silverCount==null?"0":jsonObject.silverCount; + String medalsCount=jsonObject.medalsCount==null?"0":jsonObject.medalsCount; + String bronzeCount=jsonObject.bronzeCount==null?"0":jsonObject.bronzeCount; + String username=jsonObject.updateBy==null?"":jsonObject.updateBy; + //--------------需要判断是否已经存在同名的记录 + if (getmedalstandbyName(scenebigid,areaName)>0) + { + return AjaxResult.error("国家或地区"+areaName+"已存在!"); + } + //-------------- + try { + MydpConfigMapper.Newmedalstand(Integer.parseInt(scenebigid),areaName,Integer.parseInt(goldCount), + Integer.parseInt(silverCount),Integer.parseInt(bronzeCount),Integer.parseInt(medalsCount),username); + sRet = "新增成功"; + } catch (Exception e) { + sRet = "新增失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("新增成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------修改 + //TEST : {"id":3,"areaName":"中国","goldCount":20,"silverCount":1,"bronzeCount":10,"medalsCount":31,"updateBy":"ME"} + + public int getmedalstandbyNameForUpdate(String sceneBigId,String areaName,int id) + { + int scenebigid=Integer.parseInt(sceneBigId); + int counts= MydpConfigMapper.getmedalstandbyNameForUpdate(scenebigid,areaName,id); + return counts; + } + + @ApiOperation("修改奖牌榜") + @PutMapping(value = "/updatemedalstand") + public AjaxResult updatemedalstand(@RequestBody class_medal_stand_upt jsonObject, HttpServletRequest request) + { + String sRet=""; + int id=jsonObject.id; + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + String areaName=jsonObject.areaName==null?"":jsonObject.areaName; + String goldCount=jsonObject.goldCount==null?"0":jsonObject.goldCount; + String silverCount=jsonObject.silverCount==null?"0":jsonObject.silverCount; + String medalsCount=jsonObject.medalsCount==null?"0":jsonObject.medalsCount; + String bronzeCount=jsonObject.bronzeCount==null?"0":jsonObject.bronzeCount; + String username=jsonObject.updateBy==null?"":jsonObject.updateBy; + //--------------需要判断是否已经存在同名的记录 + if (getmedalstandbyNameForUpdate(scenebigid,areaName,id)>0) + { + return AjaxResult.error("国家或地区"+areaName+"已存在!"); + } + try { + MydpConfigMapper.Updatemedalstand(id,Integer.parseInt(scenebigid),areaName,Integer.parseInt(goldCount), + Integer.parseInt(silverCount),Integer.parseInt(bronzeCount),Integer.parseInt(medalsCount),username); + sRet = "修改成功"; + } catch (Exception e) { + sRet = "修改失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("修改成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------删除 + @ApiOperation("删除奖牌榜") + @DeleteMapping(value = "/deletemedalstand/{medalid}") + public AjaxResult deletemedalstand(@PathVariable int[] medalid,HttpServletRequest request) + { + String sRet=""; + try { + for (int i=0;i scenematch=new ArrayList(); + + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + List sceneid=jsonObject.sceneIds==null?new ArrayList():jsonObject.sceneIds; + String taskName=jsonObject.taskName==null?"":jsonObject.taskName; + String taskStatus=jsonObject.taskStatus==null?"":jsonObject.taskStatus; + String taskdate=jsonObject.taskDate==null?"":jsonObject.taskDate; + + String tasktype=jsonObject.taskType==null?"":jsonObject.taskType; + + int pagenumber=jsonObject.pageNum; + int pagesize=jsonObject.pageSize; + scenematch= MydpConfigMapper.getscenematchlists(scenebigid,sceneid,taskName,taskStatus,taskdate,tasktype,pagenumber,pagesize); + + Long total=MydpConfigMapper.getscenematchlistscnt(scenebigid,sceneid,taskName,taskStatus,taskdate,tasktype); + return getDataTable(scenematch,total); + } + + @ApiOperation("根据查询条件导出赛程") + @PostMapping("/exportscenematchlist") + public void exportscenematchlist(HttpServletResponse response, scene_match_entity_list jsonObject) + { + List scenematch=new ArrayList(); + + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + List sceneid=jsonObject.sceneIds==null?new ArrayList():jsonObject.sceneIds; + String taskName=jsonObject.taskName==null?"":jsonObject.taskName; + String taskStatus=jsonObject.taskStatus==null?"":jsonObject.taskStatus; + String taskdate=jsonObject.taskDate==null?"":jsonObject.taskDate; + + String tasktype=jsonObject.taskType==null?"":jsonObject.taskType; + + int pagenumber=1;//jsonObject.pageNum==0?1:jsonObject.pageNum; + int pagesize=100000;//jsonObject.pageSize==0?100000:jsonObject.pageSize; + + scenematch = MydpConfigMapper.getscenematchlists(scenebigid,sceneid,taskName,taskStatus,taskdate,tasktype,pagenumber,pagesize); + scenematch.forEach((x)->{ + x.setTaskType(DictUtils.getDictLabel("yw_match_type", x.getTaskType()));}); + ExcelUtil util = new ExcelUtil(class_scene_match.class); + util.exportExcel(response, scenematch, "赛程数据"); + } + + //----------------------------------------------新增 + public int getscenematchbyName(int sceneId,String name) + { + int counts= MydpConfigMapper.getscenematchbyName(sceneId,name); + return counts; + } + + @ApiOperation("新建赛程") + @PostMapping(value = "/newscenematch") + public AjaxResult newscenematch(@RequestBody scene_match_entity_new jsonObject, HttpServletRequest request) + { + String sRet=""; + + int sceneid=jsonObject.sceneId; + String taskName=jsonObject.taskName==null?"":jsonObject.taskName; + String taskStatus=jsonObject.taskStatus==null?"":jsonObject.taskStatus; + + String taskType=jsonObject.taskType==null?"":jsonObject.taskType; + + String beginTime=jsonObject.beginTime==null?"00:00":jsonObject.beginTime; + String endTime=jsonObject.endTime==null?"00:00":jsonObject.endTime; + String createBy=jsonObject.createBy==null?"":jsonObject.createBy; + + //--------------需要判断是否已经存在同名的记录 + if (getscenematchbyName(sceneid,taskName)>0) + { + return AjaxResult.error("赛程"+taskName+"已存在!"); + } + //-------------- + try { + MydpConfigMapper.NewScenematch(sceneid,taskName,taskStatus,taskType,beginTime,endTime,createBy); + sRet = "新增成功"; + } catch (Exception e) { + sRet = "新增失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("新增成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------修改信息 + public int getscenematchbyNameForUpdate(int sceneId,String name,int id) + { + int counts= MydpConfigMapper.getscenematchbyNameForUpdate(sceneId,name,id); + return counts; + } + + @ApiOperation("修改赛程") + @PutMapping(value = "/updatescenematch") + public AjaxResult updatescenematch(@RequestBody scene_match_entity_upt jsonObject, HttpServletRequest request) + { + String sRet=""; + int id=jsonObject.id; + int sceneid=jsonObject.sceneId; + + String taskName=jsonObject.taskName==null?"":jsonObject.taskName; + String taskStatus=jsonObject.taskStatus==null?"":jsonObject.taskStatus; + + String taskType=jsonObject.taskType==null?"":jsonObject.taskType; + + String beginTime=jsonObject.beginTime==null?"00:00":jsonObject.beginTime; + String endTime=jsonObject.endTime==null?"00:00":jsonObject.endTime; + String updateBy=jsonObject.updateBy==null?"":jsonObject.updateBy; + + //--------------需要判断是否已经存在同名的记录 + if (getscenematchbyNameForUpdate(sceneid,taskName,id)>0) + { + return AjaxResult.error("赛程"+taskName+"已存在!"); + } + try { + MydpConfigMapper.UpdateScenematch(id,sceneid,taskName,taskStatus,taskType,beginTime,endTime,updateBy); + sRet = "修改成功"; + } catch (Exception e) { + sRet = "修改失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("修改成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + + //----------------------------------------------删除 + @ApiOperation("删除赛程") + @DeleteMapping(value = "/deletescenematch/{matchid}") + public AjaxResult deletescenematch(@PathVariable int[] matchid,HttpServletRequest request) + { + String sRet=""; + try { + for (int i=0;i alarmlist = new ArrayList<>(); + String key = CacheConstants.YW_TRANS_ALARM; + if (redisCache.hasKey(key)) { + alarmlist = redisCache.getCacheObject(key); + } else { + alarmlist = dpNewYayunChuanDongMapper.get_trans_alarms_list(level, sceneid, alarmtype); + } + alarmlist = alarmlist.stream().filter(e -> e.getAlarmtype().equals(alarmtype)).collect(Collectors.toList()); + alarmlist = alarmlist.stream().limit(20).collect(Collectors.toList()); + return success(alarmlist); + } + //endregion + + + //region --------------------------------------------------------------------------------------------传动:机房环境告警 + @ApiOperation("传动:机房环境告警清单,level:1 全域,2 城区,3 场馆;sceneid:场馆id(根据需要传)") + @GetMapping(value = "/get_machineroom_alarms_list") + public AjaxResult get_machineroom_alarms_list( + @RequestParam int level, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + HttpServletRequest request) { + List alarmlist = new ArrayList(); //结构通用 + String key = CacheConstants.YW_MACHINEROOM_ALARM; + if (redisCache.hasKey(key)) { + alarmlist = redisCache.getCacheObject(key); + } else { + alarmlist = dpNewYayunChuanDongMapper.get_machineroom_alarms_all_list(); + } + return success(alarmlist); + } + //endregion + + + //region -------------------------------------------------------------------------------------------传动:环路流量TOP5 + @ApiOperation("传动:环路流量TOP5统计,level:1 全域,2 城区,3 场馆;sceneid:场馆id(根据需要传)") + @GetMapping(value = "/get_huanlu_top5") + public AjaxResult get_huanlu_top5(@RequestParam int level, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + HttpServletRequest request) { + List alarmlist = new ArrayList<>(); //结构通用 + String key = CacheConstants.YW_GB_TOP5; + if (redisCache.hasKey(key)) { + alarmlist = redisCache.getCacheObject(key); + } else { + alarmlist = dpNewYayunChuanDongMapper.get_huanlu_top5_all(); + } + return success(alarmlist); + } + //endregion + + + //region --------------------------------------------------------------------------------------------传动:光功率清单 + @ApiOperation("传动:光功率清单清单,level:1 全域,2 城区,3 场馆;sceneid:场馆id(根据需要传)") + @GetMapping(value = "/get_opticalpower_list") + public AjaxResult get_opticalpower_list( + @RequestParam int level, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + HttpServletRequest request) { + List list = new ArrayList(); + String key = CacheConstants.YW_OPTICALPOWER; + if (redisCache.hasKey(key)) { + list = redisCache.getCacheObject(key); + } else { + list = dpNewYayunChuanDongMapper.get_opticalpower_all_list(); + } + return success(list); + } + //endregion + + + //region --------------------------------------------------------------------------------------------传动:中间地图告警显示接口 + @ApiOperation("传动:中间地图告警显示接口: level:0: 全部,1 全域,2 城区 ") + @GetMapping(value = "/get_maps_all_trans_alarms") + public AjaxResult get_maps_all_trans_alarms(@RequestParam int level, HttpServletRequest request) { + List dpdata = new ArrayList(); + String key = CacheConstants.YW_TRANS_MAP; + if (redisCache.hasKey(key)) { + dpdata = redisCache.getCacheObject(key); + } else { + dpdata = dpNewYayunChuanDongMapper.get_maps_all_alarms(); + List alarmsList = dpNewYayunChuanDongMapper.get_maps_alarms_all_alarms(); + List poweralarmlist = dpNewYayunChuanDongMapper.get_machineroom_alarms_all_list(); + Map> map = new HashMap<>(); + Map> powermap = new HashMap<>(); + if (CollectionUtil.isNotEmpty(alarmsList)) { + map = alarmsList.stream().collect(Collectors.groupingBy(class_dp_map_alarms::getSceneid)); + } + + if (CollectionUtil.isNotEmpty(poweralarmlist)) { + powermap = poweralarmlist.stream().collect(Collectors.groupingBy(class_dp_2_power_alarm::get场馆id)); + } + + for (class_dp_4_maps_alarms dpdatum : dpdata) { + List alarms = new ArrayList<>(); + if (dpdatum.getAlarmcount() > 0) { + List sceneList = map.get(Long.valueOf(dpdatum.getVenueid())); + alarms.addAll(sceneList); + } + + if (CollectionUtil.isNotEmpty(powermap)) { + List powerlist = powermap.get(dpdatum.getVenueid() + ""); + if (CollectionUtil.isNotEmpty(powerlist)) { + for (class_dp_2_power_alarm powerAlarm : powerlist) { + class_dp_map_alarms alarm = new class_dp_map_alarms(); + BeanUtil.copyProperties(powerAlarm, alarm); + alarm.setMajor("动环"); + alarm.setHandlepeople(powerAlarm.get故障处理人()); + alarm.setSceneid(Long.valueOf(powerAlarm.get场馆id())); + alarm.setNetname(powerAlarm.getSiteName()); + alarms.add(alarm); + + } + dpdatum.setAlarmcount(dpdatum.getAlarmcount() + powerlist.size()); + dpdatum.setPowercount(powerlist.size()); + } + + } + dpdatum.setLists(alarms); + } + } + return success(dpdata); + } + //endregion + + + // 大屏的第三屏:专网 + + //region --------------------------------------------------------------------------------------------专网:传输告警清单 + @ApiOperation("专网:传输告警清单,level:1 全域,2 城区,3 场馆;sceneid:场馆id(根据需要传),alarmtype:告警类型:AGIS/WIFI/VOIP") + @GetMapping(value = "/get_net_alarms_list") + public AjaxResult get_net_alarms_list(@RequestParam int level, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") Long sceneid, + @RequestParam String alarmtype, + HttpServletRequest request) { + List alarmlist = new ArrayList<>(); + String key = CacheConstants.YW_NET_ALARM; + if (redisCache.hasKey(key)) { + alarmlist = redisCache.getCacheObject(key); + } else { + alarmlist = dpNewYayunZhuanWangMapper.get_net_alarms_all_list(); + } + alarmlist = alarmlist.stream().filter(e -> e.getAlarmtype().equals(alarmtype)).collect(Collectors.toList()); + if (level == 1 || level == 2) { + alarmlist = alarmlist.stream().limit(20).collect(Collectors.toList()); + } else { + alarmlist = alarmlist.stream().filter(e -> e.getSceneid().equals(sceneid)).limit(20).collect(Collectors.toList()); + } + return success(alarmlist); + } + //endregion + + + //region --------------------------------------------------------------------------------------------专网:中间地图告警显示接口 + @ApiOperation("专网:中间地图告警显示接口: level:0: 全部,1 全域,2 城区 ") + @GetMapping(value = "/get_maps_all_net_alarms") + public AjaxResult get_maps_all_net_alarms(@RequestParam int level, HttpServletRequest request) { + List dpdata = new ArrayList<>(); + String key = CacheConstants.YW_NET_MAP; + if (redisCache.hasKey(key)) { + dpdata = redisCache.getCacheObject(key); + } else { + dpdata = dpNewYayunZhuanWangMapper.get_maps_all_alarms(); + List alarmsList = dpNewYayunZhuanWangMapper.get_map_alarms_all_list(); + List linkAllList = dpNewYayunZhuanWangMapper.get_map_agis_link_all_list(); + List devAllList = dpNewYayunZhuanWangMapper.get_map_agis_dev_all_list(); + Map> map = new HashMap<>(); + Map> linkmap = new HashMap<>(); + Map> devmap = new HashMap<>(); + if (CollectionUtil.isNotEmpty(alarmsList)) { + map = alarmsList.stream().collect(Collectors.groupingBy(class_dp_map_alarms::getSceneid)); + } + if (CollectionUtil.isNotEmpty(linkAllList)) { + linkmap = linkAllList.stream().collect(Collectors.groupingBy(class_dp_map_agis_link_5mi::getVenueid)); + } + if (CollectionUtil.isNotEmpty(devAllList)) { + devmap = devAllList.stream().collect(Collectors.groupingBy(class_dp_map_agis_dev_15mi::getVenueid)); + } + for (class_dp_3_maps_alarms dpdatum : dpdata) { + if (dpdatum.getAlarmcount() > 0) { + List sceneList = map.get(Long.valueOf(dpdatum.getVenueid())); + dpdatum.setLists(sceneList); + } + if (CollectionUtil.isNotEmpty(linkmap)) { + dpdatum.setLinklists(linkmap.get(Long.valueOf(dpdatum.getVenueid()))); + } + if (CollectionUtil.isNotEmpty(devmap)) { + dpdatum.setDevlists(devmap.get(Long.valueOf(dpdatum.getVenueid()))); + } + } + } + return success(dpdata); + } + //endregion + + + //region--------------------------------------------------------------------------------------专网:大屏内外场坐席告警接口 + @ApiOperation(value = "专网:功能区的告警和性能输出") + @GetMapping("/get_code_net_alarms") + @Anonymous + public AjaxResult get_code_net_alarms( + @RequestParam int level, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + HttpServletRequest request) { + List codeList = new ArrayList<>(); + String key = CacheConstants.YW_NET_CODE_AGIS; + if (redisCache.hasKey(key)) { + codeList = redisCache.getCacheObject(key); + } else { + codeList = dpNewYayunZhuanWangMapper.get_code_all_list(); + List alarmList = dpNewYayunZhuanWangMapper.get_code_alarms_all_list(); + List devAllList = dpNewYayunZhuanWangMapper.get_code_agis_dev_all_list(); + Map> map = new HashMap<>(); + Map> devmap = new HashMap<>(); + + if (CollectionUtil.isNotEmpty(alarmList)) { + map = alarmList.stream().collect(Collectors.groupingBy(class_dp_map_alarms::getCode)); + } + + if (CollectionUtil.isNotEmpty(devAllList)) { + devmap = devAllList.stream().collect(Collectors.groupingBy(class_dp_map_agis_dev_15mi::getCode)); + } + + for (class_dp_2_code_net_alarms codeNetAlarm : codeList) { + if (CollectionUtil.isNotEmpty(map)) { + codeNetAlarm.setLists(map.get(codeNetAlarm.getCode())); + if (CollectionUtil.isNotEmpty(map.get(codeNetAlarm.getCode()))) { + codeNetAlarm.setAlarmcount(map.get(codeNetAlarm.getCode()).size()); + } + } + if (CollectionUtil.isNotEmpty(devmap)) { + codeNetAlarm.setKpilist(devmap.get(codeNetAlarm.getCode())); + } + } + } + return success(codeList); + } + //endregion + + + //region -------------------------------------------------------------------------------------专网:AGIS交换机利用率 + + @ApiOperation("专网:AGIS交换机利用率TOP5接口,level:1. 全域, 2:城区,3:场馆;sceneid:场馆id;typeid:1:cpu,2:ram") + @GetMapping(value = "/get_agis_switch") + public AjaxResult get_agis_switch( + @RequestParam int level, + @RequestParam int typeid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid) { + String keyname = "dp_2_agis_switch_" + String.valueOf(level) + "_" + String.valueOf(typeid) + "_" + String.valueOf(sceneid); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //--------------------------------------------------------------------读数据库 + List dpData = new ArrayList(); + dpData = dpNewYayunZhuanWangMapper.get_agis_switch(level, typeid, sceneid); + //---------------------- + //int cachesecond=getcachesecond(); + redisCache.setCacheObject(keyname, dpData, 58, TimeUnit.SECONDS); //数据放缓存 + return success(dpData); + } + //endregion + + //region -------------------------------------------------------------------------------------专网:AGIS链路带宽利用率 + + @ApiOperation("专网:AGIS链路带宽利用率TOP5接口,level:1. 全域, 2:城区,3:场馆;sceneid:场馆id;typeid:1:上行,2:下行") + @GetMapping(value = "/get_agis_bandwidth") + public AjaxResult get_agis_bandwidth( + @RequestParam int level, + @RequestParam int typeid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid) { + String keyname = "dp_2_agis_bandwidth_" + String.valueOf(level) + "_" + String.valueOf(typeid) + "_" + String.valueOf(sceneid); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //--------------------------------------------------------------------读数据库 + List dpData = new ArrayList(); + dpData = dpNewYayunZhuanWangMapper.get_agis_bandwidth(level, typeid, sceneid); + //---------------------- + //int cachesecond=getcachesecond(); + redisCache.setCacheObject(keyname, dpData, 58, TimeUnit.SECONDS); //数据放缓存 + return success(dpData); + } + //endregion + + //region -------------------------------------------------------------------------------------专网:AGIS链路利用率 + + @ApiOperation("专网:AGIS链路利用率TOP5接口,level:1. 全域, 2:城区,3:场馆;sceneid:场馆id;typeid:1:上行,2:下行") + @GetMapping(value = "/get_agis_link") + public AjaxResult get_agis_link( + @RequestParam int level, + @RequestParam int typeid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid) { + String keyname = "dp_2_agis_link_" + String.valueOf(level) + "_" + String.valueOf(typeid) + "_" + String.valueOf(sceneid); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //--------------------------------------------------------------------读数据库 + List dpData = new ArrayList(); + dpData = dpNewYayunZhuanWangMapper.get_agis_link(level, typeid, sceneid); + //---------------------- + //int cachesecond=getcachesecond(); + redisCache.setCacheObject(keyname, dpData, 58, TimeUnit.SECONDS); //数据放缓存 + return success(dpData); + } + //endregion + + //region -------------------------------------------------------------------------------------专网:互联网用户数 + + @ApiOperation("专网:互联网用户数TOP5接口,level:1. 全域, 2:城区") + @GetMapping(value = "/get_internet_usercount") + public AjaxResult get_internet_usercount( + @RequestParam int level) { + String keyname = "dp_2_internet_usercount_" + String.valueOf(level); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //--------------------------------------------------------------------读数据库 + List dpData = new ArrayList(); + dpData = dpNewYayunZhuanWangMapper.get_internet_usercount(level); + //---------------------- + //int cachesecond=getcachesecond(); + redisCache.setCacheObject(keyname, dpData, 58, TimeUnit.SECONDS); //数据放缓存 + return success(dpData); + } + //endregion + + + // 大屏的第六屏:综合管理 + //region --------------------------------------------------------------------------------------------综合管理:(场馆页面) + + /** + * 场馆级统计数据 + * + * @param sceneid 场馆id + * @return 返回数据 + */ + @ApiOperation(value = "场馆级统计数据", notes = "场馆级统计数据") + @GetMapping("/getMsgByScene") + public AjaxResult getMsgByScene(@RequestParam("sceneid") Long sceneid) { + Map result = new HashMap<>(); + Long[] ids = new Long[]{2L, 25L, 42L}; + if (Arrays.asList(ids).contains(sceneid)) { + String key = CacheConstants.YW_COM_MANAGE_SCENE; + if (redisCache.hasKey(key)) { + Map map = redisCache.getCacheObject(key); + result = (Map) map.get("scene_" + sceneid); + } else { + result = getMassage(sceneid); + } + } else { + result = getMassage(sceneid); + } + return AjaxResult.success(result); + } + + private Map getMassage(Long sceneid) { + Map result = new HashMap<>(); + //场馆基本信息 + JSONObject baseinfo = ywScenePictureService.listMatchTop3(sceneid); + result.put("baseinfo", baseinfo); + //任务管理统计 + JSONObject task = ywScenePictureService.listTaskManage2(sceneid,true); + result.put("task", task); + //人员签到统计 + JSONObject sign = ywScenePictureService.listSign(sceneid); + result.put("sign", sign); + //drs管理 + LocalDate date = LocalDate.now(); + List drs = ywDrsTempTaskService.drsPreview(sceneid, date); + result.put("drs", drs); + return result; + } + //endregion + + + //region --------------------------------------------------------------------------------------------综合管理:场馆统计信息(全域和城区) + + @ApiOperation(value = "场馆统计信息", notes = "场馆统计信息") + @GetMapping("/get_statistics") + public AjaxResult getStatistics(@RequestParam int level, HttpServletRequest request) { + class_dp_5_scenesta result = new class_dp_5_scenesta(); + String key = CacheConstants.YW_COM_MANAGE_ALL; + if (redisCache.hasKey(key)) { + Map map = redisCache.getCacheObject(key); + result = (class_dp_5_scenesta) map.get("scenesta"); + } else { + result = dpNewYayunZongHeMapper.get_scene_sta(); + } + return AjaxResult.success(result); + } + //endregion + + //region --------------------------------------------------------------------------------------------综合管理:签到率top5(全域和城区) + + @ApiOperation(value = "签到率top5", notes = "签到率top5") + @GetMapping("/get_sign_top5") + public AjaxResult getSignTop5(@RequestParam int level, HttpServletRequest request) { + List result = new ArrayList<>(); + String key = CacheConstants.YW_COM_MANAGE_ALL; + if (redisCache.hasKey(key)) { + Map map = redisCache.getCacheObject(key); + result = (List) map.get("signrateTop5"); + } else { + result = dpNewYayunZongHeMapper.get_sign_top5(); + } + return AjaxResult.success(result); + } + //endregion + + //region --------------------------------------------------------------------------------------------综合管理:巡检率top5(全域和城区) + + @ApiOperation(value = "巡检率top5", notes = "巡检率top5") + @GetMapping("/get_routInspect_top5") + public AjaxResult getRoutInspectTop5(@RequestParam int level, HttpServletRequest request) { + List result = new ArrayList<>(); + String key = CacheConstants.YW_COM_MANAGE_ALL; + if (redisCache.hasKey(key)) { + Map map = redisCache.getCacheObject(key); + result = (List) map.get("inspectrateTop5"); + } else { + result = dpNewYayunZongHeMapper.get_inspect_top5(); + } + return AjaxResult.success(result); + } + //endregion + + //region --------------------------------------------------------------------------------------------综合管理:场馆联系人(全域和城区) + + @ApiOperation(value = "场馆联系人", notes = "场馆联系人") + @GetMapping("/get_contacts_list") + public AjaxResult getContactsList(@RequestParam int level, HttpServletRequest request) { + List result = new ArrayList<>(); + String key = CacheConstants.YW_COM_MANAGE_ALL; + if (redisCache.hasKey(key)) { + Map map = redisCache.getCacheObject(key); + result = (List) map.get("contacts"); + } else { + result = dpNewYayunZongHeMapper.get_scene_contacts_list(); + } + return AjaxResult.success(result); + } + //endregion + + + @PostMapping(value = "/updateTransAlarmsData") + public AjaxResult updateTransAlarmsData() { + try { + ywDpNewYayunService.eastcomUpdateTransAlarmsSchedule(); + } catch (Exception e) { + return AjaxResult.error(); + } + return AjaxResult.success(); + } + + + @PostMapping(value = "/updateNetAlarmsData") + public AjaxResult updateNetAlarmsData() { + try { + ywDpNewYayunService.eastcomUpdateNetAlarmsSchedule(); + } catch (Exception e) { + return AjaxResult.error(); + } + return AjaxResult.success(); + } + + + @PostMapping(value = "/UpdateComprehensiveManage") + public AjaxResult UpdateComprehensiveManage() { + try { + ywDpNewYayunService.eastcomUpdateComprehensiveManageSchedule(); + } catch (Exception e) { + return AjaxResult.error(); + } + return AjaxResult.success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/dpNewYayunController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/dpNewYayunController.java new file mode 100644 index 0000000000000000000000000000000000000000..b2fc1e850aec714ad723bb210b4b765e21dd4b60 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/dpNewYayunController.java @@ -0,0 +1,1909 @@ +package com.ruoyi.web.controller.sunlm; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateTime; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.sunlm.domain.class_dp_btsinfo; +import com.ruoyi.sunlm.entity.class_public_news_new; +import com.ruoyi.sunlm.mapper.dpNewYayun_ChuanDong_Mapper; +import com.ruoyi.sunlm.service.NewPmKpiMonitorCellService; +import com.ruoyi.sunlm.daping.class_dp_2_scene_seat_detail; +import com.ruoyi.sunlm.daping.class_dp_2_scene_seat_info; +import com.ruoyi.sunlm.daping.dp3d.*; +import com.ruoyi.sunlm.daping.*; +import com.ruoyi.sunlm.daping.dp3d.NewDpKpiMonitorQO; +import com.ruoyi.sunlm.mapper.dpNewYayun_Gailan_Mapper; +import com.ruoyi.sunlm.mapper.dpNewYayun_Wuxian_Mapper; +import com.ruoyi.sunlm.mapper.dpNewYayun_Dict_Mapper; + + +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import com.ruoyi.sunlm.mapper.NewDpApiMapper; + +@RestController +@CrossOrigin +@RequestMapping("/eastcom_yw/daping/new/") //2023。5.10,新版大屏的接口 +@RequiredArgsConstructor +public class dpNewYayunController extends BaseController +{ + + private final NewPmKpiMonitorCellService pmKpiMonitorCellService; + + @Resource + dpNewYayun_Gailan_Mapper MydpNewYayun_Gailan_Mapper; //直接在这里引用数据库操作层(MAPPER),就不用写Service层了! + + @Resource + dpNewYayun_Wuxian_Mapper MydpNewYayun_Wuxian_Mapper; //直接在这里引用数据库操作层(MAPPER),就不用写Service层了! + + @Resource + dpNewYayun_Dict_Mapper MydpNewYayun_Dict_Mapper; //直接在这里引用数据库操作层(MAPPER),就不用写Service层了! + + + @Resource + NewDpApiMapper dpNewApiMapper; + + + @Autowired + private RedisCache redisCache; + + @Autowired + private RedisTemplate redisTemplate; + + //@Value("${daping}") + //public String jobtype; //DEBUG //WORK , 发布到正式服务器改成 WORK, 连接公司服务器数据库时用 DEBUG, 在配置文件中配置 + + //region---------------------------------------------公共方法 + private String getDateTimeString(int day) + { + Calendar calendar = Calendar.getInstance(); //创建Calendar 的实例 + calendar.add(Calendar.DAY_OF_MONTH, day); //当前时间增减天数 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日"); + String string = simpleDateFormat.format(calendar.getTime()); + return string; + } + + public int getmincontroltype(@RequestParam int areaid, + @RequestParam int sceneid) + { + return MydpNewYayun_Wuxian_Mapper.getmincontroltype(areaid,sceneid); + } + + public int getcachesecond() + { + String keyname="dp_1_cache_config"; + if (redisCache.hasKey(keyname)) { + int iret=1; + try + { + iret= redisCache.getCacheObject(keyname); + } + catch(Exception ee) { + } + return iret; + } + else { + class_dp_1_cache_config cache=MydpNewYayun_Gailan_Mapper.get_cache_config(); + int iret=1; + try + { + iret=cache.cachesecond; + } + catch(Exception ee) + { + } + redisCache.setCacheObject(keyname, iret,58, TimeUnit.SECONDS); //缓存 + return iret; + } + } + //endregion-------------------------------------------- + + + //region --------------------------------------------------------------------------------------------获得大屏缓存列表 + @ApiOperation("获得大屏缓存列表接口") + @GetMapping(value = "/getcachelist") + public AjaxResult getcachelist(HttpServletRequest request) + { + //-------------------------------------------------------------------读缓存 + Set keys = redisTemplate.keys("dp_*"); + List list=new ArrayList<>(); + for (String key : keys) { + String time=String.valueOf(redisTemplate.getExpire(key)); + list.add(key+" : 时效 "+time+" 秒"); + } + return success(list); + } + //endregion + + //region --------------------------------------------------------------------------------------------强制删除缓存 + @ApiOperation("强制删除缓存接口") + @GetMapping(value = "/deletecache") + public AjaxResult deletecache(@RequestParam String keyname,HttpServletRequest request) + { + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + redisCache.deleteObject(keyname); + return success("已清空缓存:"+keyname); + } + else + return success("不存在该缓存:"+keyname); + } + //endregion + + // 大屏的第一屏:概览 + + //region --------------------------------------------------------------------------------------------概览:无线退服统计 + @ApiOperation("概览:无线退服统计接口") + @GetMapping(value = "/get_wireless_outservice") + public AjaxResult get_wireless_outservice(HttpServletRequest request) + { + //-------------------------------------------------------------------读缓存 + String keyname="dp_1_wireless_outservice"; + if (redisCache.hasKey(keyname)) { + class_dp_1_outservice_wireless cacheData=redisCache.getCacheObject(keyname); + return success(cacheData); + } + //-------------------------------------------------------------------读数据库 + List dpdata=new ArrayList(); + //---------------------------- + String keyname2="dp_1_wireless_outservice_list"; + if (redisCache.hasKey(keyname2)) { + dpdata=redisCache.getCacheObject(keyname2); + } + else { + dpdata = MydpNewYayun_Gailan_Mapper.get_wireless_outservice(); + } + //--------------------------- + class_dp_1_outservice_wireless retdata=new class_dp_1_outservice_wireless(); + retdata.退服数2G= dpdata.get(0).退服数2G; + retdata.退服数4G= dpdata.get(0).退服数4G; + retdata.退服数5G= dpdata.get(0).退服数5G; + retdata.基站总数= dpdata.get(0).基站总数; + redisCache.setCacheObject(keyname, retdata,getcachesecond(), TimeUnit.SECONDS); //缓存 + return success(retdata); + } + //endregion + + //region --------------------------------------------------------------------------------------------概览:4/5G无线流量 + @ApiOperation("概览:4/5G无线流量接口,typeid:1:4G,2:5G") + @GetMapping(value = "/get_gbflow_wireless") + public AjaxResult get_gbflow_wireless( + @RequestParam int typeid, + HttpServletRequest request) + { + //-------------------------------------------------------------------读缓存 + + String keyname="dp_1_gbflow_wireless_"+String.valueOf(typeid); + if (redisCache.hasKey(keyname)) { + List cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + List dpData=new ArrayList(); + //------------------------------ + String keyname2="dp_1_gbflow_wireless_list_"+String.valueOf(typeid); + if (redisCache.hasKey(keyname2)) { + dpData = redisCache.getCacheObject(keyname2); + } + else { //-------------------------------------------------------------------读数据库 + dpData = MydpNewYayun_Gailan_Mapper.get_gbflow_wireless(typeid); + } + //----------------------------- + class_dp_1_gbflow_wireless myData=new class_dp_1_gbflow_wireless(); + myData.label=new ArrayList(); + myData.xaxis=new ArrayList(); + myData.value=new ArrayList(); + myData.value2=new ArrayList(); + //---------------------- + myData.label.add("今天(" + getDateTimeString(0) + ")"); + myData.label.add("昨天(" + getDateTimeString(-1) + ")"); + + float vlst1=0; + float vlst2=0; + for (int i=0;i0) vlst1=dpData.get(i).gb; + if ((dpData.get(i).gb==-1) && (i>0)) + myData.value.add(vlst1); + else if ((dpData.get(i).gb==-1) && (i==0)) + myData.value.add((float)0.00); + else + myData.value.add(dpData.get(i).gb); + } + else //前日 + { + myData.xaxis.add(dpData.get(i).adate); + if (dpData.get(i).gb>0) vlst2=dpData.get(i).gb; + if ((dpData.get(i).gb==-1) && (i>0)) + myData.value2.add(vlst2); + else if ((dpData.get(i).gb==-1) && (i==0)) + myData.value2.add((float)0.00); + else + myData.value2.add(dpData.get(i).gb); + } + } + //---------------------- + List lstData=new ArrayList(); + lstData.add(myData); + redisCache.setCacheObject(keyname, lstData,58, TimeUnit.SECONDS); //缓存 + return success(lstData); + } + //endregion + + //region --------------------------------------------------------------------------------------------概览:综合管理类统计 + @ApiOperation("概览:综合管理类统计接口") + @GetMapping(value = "/get_manage_counts") + public AjaxResult get_manage_counts(HttpServletRequest request) + { + + String keyname="dp_1_manage_counts"; + if (redisCache.hasKey(keyname)) { + class_dp_1_manage_counts cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + //--------------------------------------------------- + List dpdata=new ArrayList(); + String keyname2="dp_1_manage_counts_list"; + if (redisCache.hasKey(keyname2)) { + dpdata=redisCache.getCacheObject(keyname2); + } + else + { + dpdata = MydpNewYayun_Gailan_Mapper.get_manage_counts(); + } + //--------------------------------------------------- + class_dp_1_manage_counts retdata=new class_dp_1_manage_counts(); + if (retdata!=null) { + retdata.应签到数量 = dpdata.get(0).应签到数量; + retdata.实际签到数 = dpdata.get(0).实际签到数; + retdata.人员签到率 = dpdata.get(0).人员签到率; + retdata.巡检任务数 = dpdata.get(0).巡检任务数; + retdata.已巡检任务 = dpdata.get(0).已巡检任务; + retdata.巡检完成率 = dpdata.get(0).巡检完成率; + } + redisCache.setCacheObject(keyname, retdata,58, TimeUnit.SECONDS); //缓存 + return success(retdata); + } + //endregion + + //region --------------------------------------------------------------------------------------------概览:DICT设备和告警统计 + @ApiOperation("概览:DICT设备和告警统计接口") + @GetMapping(value = "/get_dict_counts") + public AjaxResult get_dict_counts(HttpServletRequest request) + { + + String keyname="dp_1_dict_counts"; + if (redisCache.hasKey(keyname)) { + class_dp_1_device_alarm_counts cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + //------------------------------------- + List dpdata=new ArrayList(); + String keyname2="dp_1_dict_counts_list"; + if (redisCache.hasKey(keyname2)) { + dpdata=redisCache.getCacheObject(keyname2); + } + else { + dpdata = MydpNewYayun_Gailan_Mapper.get_dict_counts(); + } + //------------------------------------ + class_dp_1_device_alarm_counts retdata=new class_dp_1_device_alarm_counts(); + retdata.设备数= dpdata.get(0).设备数; + retdata.告警总数= dpdata.get(0).告警总数; + redisCache.setCacheObject(keyname, retdata,58, TimeUnit.SECONDS); //缓存 + return success(retdata); + } + //endregion + + //region --------------------------------------------------------------------------------------------概览:动力传输类统计 + @ApiOperation("概览:动力传输类统计接口") + @GetMapping(value = "/get_trans_counts") + public AjaxResult get_trans_counts(HttpServletRequest request) + { + List dpdata = new ArrayList(); + + String keyname="dp_1_trans_counts"; + String keyname2="dp_1_trans_counts_list"; + //-----------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + dpdata = redisCache.getCacheObject(keyname); + } + else if (redisCache.hasKey(keyname2)) { + dpdata = redisCache.getCacheObject(keyname2); + } + else { //读数据库 + dpdata = MydpNewYayun_Gailan_Mapper.get_trans_counts(); + redisCache.setCacheObject(keyname, dpdata,58, TimeUnit.SECONDS); //缓存保留分钟 + } + //------------------------- + return success(dpdata); + } + //endregion + + //region --------------------------------------------------------------------------------------------概览:全网保障流量 + @ApiOperation("概览:全网保障传输环路流量接口") + @GetMapping(value = "/get_gbflow_huanlu") + public AjaxResult get_gbflow_huanlu(HttpServletRequest request) + { + + String keyname="dp_1_gbflow_huanlu"; + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List cacheData=redisCache.getCacheObject(keyname); + return success(cacheData); + } + //-------------------------------------------------------------------读数据库 + List dpData=new ArrayList(); + String keyname2="dp_1_gbflow_huanlu_list"; + if (redisCache.hasKey(keyname2)) { + dpData=redisCache.getCacheObject(keyname2); + } + else { + dpData = MydpNewYayun_Gailan_Mapper.get_gbflow_huanlu(); + } + //---------------------------------- + class_dp_1_gbflow_wireless myData=new class_dp_1_gbflow_wireless(); + myData.label=new ArrayList(); + myData.xaxis=new ArrayList(); + myData.value=new ArrayList(); + myData.value2=new ArrayList(); + //---------------------- + myData.label.add("今天(" + getDateTimeString(0) + ")"); + myData.label.add("昨天(" + getDateTimeString(-1) + ")"); + + float vlst1=0; + float vlst2=0; + for (int i=0;i0) vlst1=dpData.get(i).gb; + if ((dpData.get(i).gb==-1) && (i>0)) + myData.value.add(vlst1); + else if ((dpData.get(i).gb==-1) && (i==0)) + myData.value.add((float)0.00); + else + myData.value.add(dpData.get(i).gb); + } + else //前日 + { + myData.xaxis.add(dpData.get(i).adate); + if (dpData.get(i).gb>0) vlst2=dpData.get(i).gb; + if ((dpData.get(i).gb==-1) && (i>0)) + myData.value2.add(vlst2); + else if ((dpData.get(i).gb==-1) && (i==0)) + myData.value2.add((float)0.00); + else + myData.value2.add(dpData.get(i).gb); + } + } + //---------------------- + List lstData=new ArrayList(); + lstData.add(myData); + redisCache.setCacheObject(keyname, lstData,58, TimeUnit.SECONDS); //缓存保留 + return success(lstData); + } + //endregion + + //region--------------------------------------------------------------------------------------------概览:AGIS和互联网统计接口 + @ApiOperation("概览:AGIS和互联网统计接口") + @GetMapping(value = "/get_agis_internet_counts") + public AjaxResult get_agis_internet_counts(HttpServletRequest request) + { + List dpdata = new ArrayList(); + + String keyname="dp_1_agis_internet_counts"; + String keyname2="dp_1_agis_internet_counts_list"; + //-----------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + dpdata = redisCache.getCacheObject(keyname); + } + else if (redisCache.hasKey(keyname2)) { + dpdata = redisCache.getCacheObject(keyname2); + } + else { //读数据库 + dpdata = MydpNewYayun_Gailan_Mapper.get_agis_internet_counts(); + redisCache.setCacheObject(keyname, dpdata,58, TimeUnit.SECONDS); //缓存保留分钟 + } + return success(dpdata); + } + //endregion + + //region --------------------------------------------------------------------------------------------概览:中间地图告警显示接口 + @ApiOperation("概览:中间地图告警显示接口: level:0: 全部,1 全域,2 城区 ") + @GetMapping(value = "/get_maps_all_alarms") + public AjaxResult get_maps_all_alarms( + @RequestParam int level, + HttpServletRequest request) + { + + String keyname="dp_1_maps_all_alarms_"+String.valueOf(level); + if (redisCache.hasKey(keyname)) { + List cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + List dpdata=new ArrayList(); + //-------------------------------- + String keyname2="dp_1_maps_all_alarms_list_"+String.valueOf(level); ///"dp_1_maps_all_alarms_"+String.valueOf(level);??? + if (redisCache.hasKey(keyname2)) { + dpdata=redisCache.getCacheObject(keyname2); + } + else { + dpdata = MydpNewYayun_Gailan_Mapper.get_maps_all_alarms(level); + } + //-----------------------------------先把告警弹出列表取到缓存 + List alllists=new ArrayList(); + String keyname3="dp_1_maps_all_alarms_popup_list"; + if (redisCache.hasKey(keyname3)) { + alllists=redisCache.getCacheObject(keyname3); + } + else { + alllists = MydpNewYayun_Gailan_Mapper.get_maps_all_alarms_popup(); + } + //----------------------------------- + if (alllists.size()>0) { + for (int i = 0; i < dpdata.size(); i++) { + if (dpdata.get(i).alarmcount > 0) { + int venueid = Integer.parseInt(dpdata.get(i).venueid); + try { + List lists = alllists.stream().filter(x -> x.getSceneid() == venueid).collect(Collectors.toList()); + dpdata.get(i).lists = lists; + } + catch(Exception e) + { + dpdata.get(i).lists=new ArrayList(); + } + + } + } + } + //-------------------------------- + redisCache.setCacheObject(keyname, dpdata,getcachesecond(), TimeUnit.SECONDS); //缓存保留分钟 + return success(dpdata); + } + //endregion + + + // 大屏的第二屏:无线, 包括全域, 城区, 场馆 + + //region --------------------------------------------------------------------------------------------获取坐席中文名列表 + public List get_seat_chinesename(HttpServletRequest request) + { + return MydpNewYayun_Wuxian_Mapper.get_seat_chinesename(); + } + //endregion + + //region --------------------------------------------------------------------------------------------获取场馆列表 + @ApiOperation("获取场馆列表") + @GetMapping(value = "/getvenuelist") + public AjaxResult getvenuelist(HttpServletRequest request) + { + List dpvenue=new ArrayList(); + dpvenue = MydpNewYayun_Wuxian_Mapper.getvenuelists(); + return success(dpvenue); + } + //endregion + + //region --------------------------------------------------------------------------------------------获取景区列表,作废 + @ApiOperation("获取景区列表,和景区告警列表,spottypeid:景区大类ID ") + @GetMapping(value = "/getspotlist") + public AjaxResult getspotlist( + @RequestParam(value = "spottypeid", required = false, defaultValue = "0") int spottypeid, + HttpServletRequest request) + { + /* //---先分类 + List dpspottype=MydpNewYayun_Wuxian_Mapper.getspottypes(); ///获取大类 + List dpspots=new ArrayList(); + for (String spottype:dpspottype) + { + List dpspotdetail = MydpNewYayun_Wuxian_Mapper.getspotlist(spottype); + class_dp_2_spotlist spot=new class_dp_2_spotlist(); + spot.spottype=spottype; + spot.spotlist=dpspotdetail; + dpspots.add(spot); + } + return success(dpspots); */ + + //---------------不需要分类了 + List allalarmlist=new ArrayList(); + String keyname="dp_2_spot_wirelessalarms_popup_list"; + if (redisCache.hasKey(keyname)) { + allalarmlist=redisCache.getCacheObject(keyname); + } + else { + allalarmlist = MydpNewYayun_Wuxian_Mapper.get_spot_wirelessalarms_popup(); //景区的告警 + } + //--------------------------------------------------- + List dpspotdetail = MydpNewYayun_Wuxian_Mapper.getspotlist(spottypeid); + for (int i=0;i0) { + int spotid=dpspotdetail.get(i).spotId; + try { + List alarmlist = allalarmlist.stream().filter(x -> x.getSceneid() == spotid).collect(Collectors.toList()); //景区的告警 + dpspotdetail.get(i).lists = alarmlist; + } + catch(Exception e) + { + dpspotdetail.get(i).lists = new ArrayList(); + } + } + } + return success(dpspotdetail); + } + //endregion + + + //region --------------------------------------------------------------------------------------------无线:逻辑站退服清单 + @ApiOperation("无线:逻辑站退服清单,level:1 全域,2 城区,3 场馆; areaid:城区id(根据需要传);sceneid:场馆id(根据需要传)") + @GetMapping(value = "/get_wireless_alarms_list") + public AjaxResult get_wireless_alarms_list( + @RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + HttpServletRequest request) + { + String keyname="dp_2_wireless_alarms_list_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+String.valueOf(sceneid); + if (redisCache.hasKey(keyname)) { + List cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + List alarmlist=new ArrayList(); + alarmlist= MydpNewYayun_Wuxian_Mapper.get_wireless_alarms_list(level,areaid,sceneid); + redisCache.setCacheObject(keyname, alarmlist,getcachesecond(), TimeUnit.SECONDS); //缓存保留分钟 + return success(alarmlist); + } + //endregion + + //region --------------------------------------------------------------------------------------------无线:铁塔动环清单 + @ApiOperation("无线:铁塔动环清单,level:1 全域,2 城区,3 场馆; areaid:城区id(根据需要传);sceneid:场馆id(根据需要传)") + @GetMapping(value = "/get_power_alarms_list") + public AjaxResult get_power_alarms_list( + @RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + HttpServletRequest request) + { + String keyname="dp_2_power_alarms_list_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+String.valueOf(sceneid); + if (redisCache.hasKey(keyname)) { + List cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + List alarmlist=new ArrayList(); + alarmlist= MydpNewYayun_Wuxian_Mapper.get_power_alarms_list(level,areaid,sceneid); + redisCache.setCacheObject(keyname, alarmlist,getcachesecond(), TimeUnit.SECONDS); //缓存保留分钟 + return success(alarmlist); + } + //endregion + + //region -------------------------------------------------------------------------------------------无线:国际漫入漫出统计 + @ApiOperation("无线:国际漫入漫出统计,typeid=1 :国际漫入;typeid=2:国际漫出") + @GetMapping(value = "/get_roam_national") + public AjaxResult get_roam_national(@RequestParam int typeid, + HttpServletRequest request) + { + String keyname="dp_2_roam_national_"+String.valueOf(typeid); + if (redisCache.hasKey(keyname)) { + List cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + List dpData=new ArrayList(); + dpData = MydpNewYayun_Wuxian_Mapper.get_roam_national(typeid); + redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存保留分钟 + return success(dpData); + } + //endregion + + //region -------------------------------------------------------------------------------------------无线:省内漫入漫出统计 + @ApiOperation("无线:省内漫入漫出统计,typeid=1 :省内漫入;typeid=2:省内漫出") + @GetMapping(value = "/get_roam_inner") + public AjaxResult get_roam_inner(@RequestParam int typeid, + HttpServletRequest request) + { + String keyname="dp_2_roam_inner_"+String.valueOf(typeid); + if (redisCache.hasKey(keyname)) { + List cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + + List dpData=new ArrayList(); + dpData = MydpNewYayun_Wuxian_Mapper.get_roam_inner(typeid); + redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存保留分钟 + return success(dpData); + } + //endregion + + //region ---------------------------------------------------------------------------------------无线:区域用户数 + @ApiOperation("无线:区域用户数图表接口,typeid:1: 4G ,2: 5G,level:1 全域,2 城区,3 场馆; areaid:城区id(根据需要传);sceneid:场馆id(根据需要传)") + @GetMapping(value = "/get_area_usercounts") + public AjaxResult get_area_usercounts( + @RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + @RequestParam int typeid, + HttpServletRequest request) + { + //-------------------------------------------------------------------如果查询条件变了,需要清空缓存, 重新取数 + //-------------------------------------------------------------------读缓存 + String keyname="dp_2_area_usercounts_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+String.valueOf(sceneid)+"_"+String.valueOf(typeid); + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //--------------------------------------------------------------------读数据库 + List dpData=new ArrayList(); + dpData = MydpNewYayun_Wuxian_Mapper.get_area_usercounts(level,areaid,sceneid,typeid); + //------------------ + class_dp_2_usercounts myData=new class_dp_2_usercounts(); + myData.label=new ArrayList(); + myData.xaxis=new ArrayList(); + myData.value=new ArrayList(); + myData.value2=new ArrayList(); + //---------------------- + myData.label.add("今天(" + getDateTimeString(0) + ")"); + myData.label.add("昨天(" + getDateTimeString(-1) + ")"); + float vlst1=0; + float vlst2=0; + for (int i=0;i0) vlst1=dpData.get(i).value; + if ((dpData.get(i).value==-1) && (i>0)) + myData.value.add(vlst1); + else if ((dpData.get(i).value==-1) && (i==0)) + myData.value.add((float)0.00); + else + myData.value.add(dpData.get(i).value); + } + else //昨天数据 + { + if (dpData.get(i).value>0) vlst2=dpData.get(i).value; + myData.xaxis.add(dpData.get(i).datetime); + if ((dpData.get(i).value==-1) && (i>0)) + myData.value2.add(vlst2); + else if ((dpData.get(i).value==-1) && (i==0)) + myData.value2.add((float)0.00); + else + myData.value2.add(dpData.get(i).value); + } + } + //---------------------- + List lstData=new ArrayList(); + lstData.add(myData); + redisCache.setCacheObject(keyname, lstData, 58, TimeUnit.SECONDS); //数据放缓存 + return success(lstData); + } + //endregion + + //region --------------------------------------------------------------------------------------------无线:区域流量 + //-------------------------------------------- + @ApiOperation("无线:区域流量接口,typeid:1: 4G ,2: 5G,level:1 全域,2 城区,3 场馆; areaid:城区id(根据需要传);sceneid:场馆id(根据需要传)") + @GetMapping(value = "/get_area_gbflow") + public AjaxResult get_area_gbflow( + @RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + @RequestParam int typeid, + HttpServletRequest request) + { + String keyname="dp_2_area_gbflow_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+String.valueOf(sceneid)+"_"+String.valueOf(typeid); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //--------------------------------------------------------------------读数据库 + List dpData=new ArrayList(); //这个类通用,不在新定义了 + //----------------------- + dpData = MydpNewYayun_Wuxian_Mapper.get_area_gbflow(level,areaid,sceneid,typeid); + //------------------ + class_dp_2_usercounts myData=new class_dp_2_usercounts(); + myData.label=new ArrayList(); + myData.xaxis=new ArrayList(); + myData.value=new ArrayList(); + myData.value2=new ArrayList(); + //---------------------- + myData.label.add("今天(" + getDateTimeString(0) + ")"); + myData.label.add("昨天(" + getDateTimeString(-1) + ")"); + float vlst1=0; + float vlst2=0; + for (int i=0;i0) vlst1=dpData.get(i).value; + if ((dpData.get(i).value==-1) && (i>0)) + myData.value.add(vlst1); + else if ((dpData.get(i).value==-1) && (i==0)) + myData.value.add((float)0.00); + else + myData.value.add(dpData.get(i).value); + } + else //昨天数据 + { + if (dpData.get(i).value>0) vlst2=dpData.get(i).value; + myData.xaxis.add(dpData.get(i).datetime); + if ((dpData.get(i).value==-1) && (i>0)) + myData.value2.add(vlst2); + else if ((dpData.get(i).value==-1) && (i==0)) + myData.value2.add((float)0.00); + else + myData.value2.add(dpData.get(i).value); + } + } + //---------------------- + List lstData=new ArrayList(); + lstData.add(myData); + redisCache.setCacheObject(keyname, lstData,58, TimeUnit.SECONDS); //数据放缓存 + return success(lstData); + } + //endregion + + //region -------------------------------------------------------------------------------------无线:上行Prb利用率TOP5 + //-------------------------------------------- + + @ApiOperation("无线:上行利用率TOP5接口,level:2:城区,3:场馆;typeid:1: 4G ,2: 5G, areaid:区域id ;sceneid:场馆id,inorout:0:全部,1:场内,2:场外,3:功能区") + @GetMapping(value = "/get_prb_uplink") + public AjaxResult get_prb_uplink( + @RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + @RequestParam int typeid, + @RequestParam(value = "inorout", required = false, defaultValue = "0") int inorout, + HttpServletRequest request) + { + int mintype=getmincontroltype(areaid,sceneid); //1分钟 ,15分钟 + String keyname="dp_2_prb_uplink_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+String.valueOf(sceneid)+"_" + +String.valueOf(typeid)+"_"+String.valueOf(inorout)+String.valueOf(mintype); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //--------------------------------------------------------------------读数据库 + List dpData=new ArrayList(); + dpData=MydpNewYayun_Wuxian_Mapper.get_prb_uplink(level,areaid,sceneid,typeid,mintype,inorout); + //---------------------- + redisCache.setCacheObject(keyname, dpData,getcachesecond(), TimeUnit.SECONDS); //数据放缓存 + return success(dpData); + } + //endregion + + //region -----------------------------------------------------------------------------------------无线:下行Prb利用率TOP5 + //-------------------------------------------- + @ApiOperation("无线:下行Prb利用率TOP5接口,level:2:城区,3:场馆;typeid:1: 4G ,2: 5G, sceneid:场馆id,inorout:0:全部,1:场内,2:场外,3:功能区") + @GetMapping(value = "/get_prb_downlink") + public AjaxResult get_prb_downlink(@RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + @RequestParam int typeid, + @RequestParam(value = "inorout", required = false, defaultValue = "0") int inorout, + HttpServletRequest request) + { + int mintype=getmincontroltype(areaid,sceneid); //1分钟 ,15分钟 + String keyname="dp_2_prb_downlink_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+String.valueOf(sceneid)+"_" + +String.valueOf(typeid)+"_"+String.valueOf(inorout)+String.valueOf(mintype); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + + List dpData=new ArrayList(); + //--------------------------- + dpData=MydpNewYayun_Wuxian_Mapper.get_prb_downlink(level,areaid,sceneid,typeid,mintype,inorout); + //---------------------- + redisCache.setCacheObject(keyname, dpData,getcachesecond(), TimeUnit.SECONDS); //数据放缓存 + return success(dpData); + } + //endregion + + //region -------------------------------------------------------------------------------------无线:用户数TOP5 + @ApiOperation("无线:用户数TOP5接口,level:2:城区,3:场馆;typeid:1: 4G ,2: 5G, sceneid:场馆id,inorout:0:全部,1:场内,2:场外,3:功能区") + @GetMapping(value = "/get_user_data") + public AjaxResult get_user_data(@RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + @RequestParam int typeid, + @RequestParam(value = "inorout", required = false, defaultValue = "0") int inorout, + HttpServletRequest request) + { + int mintype=getmincontroltype(areaid,sceneid); //1分钟 ,15分钟 + String keyname="dp_2_user_data_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+String.valueOf(sceneid)+"_" + +String.valueOf(typeid)+"_"+String.valueOf(inorout)+String.valueOf(mintype); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + + List dpData=new ArrayList(); + //----------------------- + dpData=MydpNewYayun_Wuxian_Mapper.get_user_data(level,areaid,sceneid,typeid,mintype,inorout); + //---------------------- + redisCache.setCacheObject(keyname, dpData,getcachesecond(), TimeUnit.SECONDS); //数据放缓存 + return success(dpData); + } + //endregion + + //region ----------------------------------------------------------------------------------------无线:平均干扰TOP5 + @ApiOperation("无线:平均干扰TOP5接口, level:2:城区,3:场馆;typeid:1: 4G ,2: 5G, sceneid:场馆id,inorout:0:全部,1:场内,2:场外,3:功能区") + @GetMapping(value = "/get_avg_disturb") + public AjaxResult get_avg_disturb(@RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + @RequestParam int typeid, + @RequestParam(value = "inorout", required = false, defaultValue = "0") int inorout, + HttpServletRequest requestt) + { + int mintype=getmincontroltype(areaid,sceneid); //1分钟 ,15分钟 + String keyname="dp_2_avg_disturb_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+String.valueOf(sceneid)+"_" + +String.valueOf(typeid)+"_"+String.valueOf(inorout)+String.valueOf(mintype); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + + List dpData=new ArrayList(); + //--------------------------- + dpData=MydpNewYayun_Wuxian_Mapper.get_avg_disturb(level,areaid,sceneid,typeid,mintype,inorout); + redisCache.setCacheObject(keyname, dpData,getcachesecond(), TimeUnit.SECONDS); //数据放缓存 + return success(dpData); + } + //endregion + + //region --------------------------------------------------------------------------------------------无线:中间地图无线告警和性能显示接口 + @ApiOperation("无线:中间地图无线告警和性能显示接口: level:0: 全部,1 全域,2 城区;areaid:区域id:1:景区,2:交通枢纽,3:亚运村,4:功能中心,....,不填为默认城区 ") + @GetMapping(value = "/get_maps_wireless_alarms") + public AjaxResult get_maps_wireless_alarms( + @RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "nettype", required = false, defaultValue = "5G") String nettype, + @RequestParam(value = "kpiname", required = false, defaultValue = "综合算法") String kpiname, + HttpServletRequest request) + { + String keyname="dp_2_maps_wireless_alarms_kpi_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+nettype+"_"+kpiname; + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + List dpdata = new ArrayList(); + dpdata = MydpNewYayun_Wuxian_Mapper.get_maps_wireless_alarms(level,areaid); + //----------------------------------------------------------需要将所有告警先取来放在缓存里。 + String keyname2_1="dp_2_spot_wireless_alarms_popup_list"; //所有景区的告警 + String keyname2_2="dp_2_maps_wireless_alarms_popup_list"; //所有场馆的告警 + List alllists = new ArrayList(); + if ((level==2) && (areaid>0)) { + if (redisCache.hasKey(keyname2_1)) { + alllists=redisCache.getCacheObject(keyname2_1); + } + else { + alllists = MydpNewYayun_Wuxian_Mapper.get_spot_wirelessalarms_popup(); //景区的告警 + } + } + else if (((level==2) && (areaid==0)) || (level==1)) { + if (redisCache.hasKey(keyname2_2)) { + alllists=redisCache.getCacheObject(keyname2_2); + } + else { + alllists = MydpNewYayun_Wuxian_Mapper.get_maps_wireless_alarms_popup(); //场馆的告警 + } + } + //-------------------------------------------将KPI列表取到缓存 + List cellsall=new ArrayList(); + int mintype=15; + if ((level==2) && (areaid>0)) { + mintype=getmincontroltype(areaid,0); //1分钟 ,15分钟 + String keyname2="dp_2_maps_wireless_kpicells_list_"+nettype+"_"+String.valueOf(mintype); //dp_2_maps_wireless_kpicells_list_4G_1,.... + //------------------------ + if (redisCache.hasKey(keyname2)) + cellsall = redisCache.getCacheObject(keyname2); + else { + cellsall = MydpNewYayun_Wuxian_Mapper.get_maps_wireless_kpi_cells(nettype, mintype); + redisCache.setCacheObject(keyname2, cellsall,getcachesecond(), TimeUnit.SECONDS); + } + } + //---------------------------------------------------------- + for (int i=0;i0) { + List lists = new ArrayList(); + if ((level==2) && (areaid>0)) { + int spotid=Integer.parseInt(dpdata.get(i).venueid); + try { + lists = alllists.stream().filter(x -> x.getSceneid() == spotid).collect(Collectors.toList()); //景区 + } + catch(Exception e) + { + } + } + else { + int venueid=Integer.parseInt(dpdata.get(i).venueid); + try { + lists = alllists.stream().filter(x -> x.getSceneid() == venueid).collect(Collectors.toList()); //场馆 + } + catch(Exception e) + { + } + } + dpdata.get(i).lists = lists; + } + //----------------------------------------------取基站和小区数量 + String strsitecell=""; + List sitecellinfos=new ArrayList(); + String keyname_5="dp_2_site_cell_info_list"; + if (redisCache.hasKey(keyname_5)) + sitecellinfos=redisCache.getCacheObject(keyname_5); + else { + sitecellinfos = MydpNewYayun_Wuxian_Mapper.getsitecellinfo(); + redisCache.setCacheObject(keyname_5, sitecellinfos,getcachesecond(), TimeUnit.SECONDS); + } + if ((level==2) && (areaid>0)) { + int spotid = Integer.parseInt(dpdata.get(i).venueid); + if (sitecellinfos.size()>0) { + try { + sitecellinfos = sitecellinfos.stream().filter(x -> x.get类型().equals("场景")).filter(x -> x.get编号() == spotid).collect(Collectors.toList()); + } + catch(Exception e) + { + } + if (sitecellinfos.size()>0) + strsitecell = "2G基站数:" + String.valueOf(sitecellinfos.get(0).基站数2g) + " 个,2G小区数:" + String.valueOf(sitecellinfos.get(0).小区数2g) + + " 个,4G基站数:" + String.valueOf(sitecellinfos.get(0).基站数4g) + " 个,4G小区数:" + String.valueOf(sitecellinfos.get(0).小区数4g) + + " 个,5G基站数:" + String.valueOf(sitecellinfos.get(0).基站数5g) + " 个,5G小区数:" + String.valueOf(sitecellinfos.get(0).小区数5g)+" 个"; + } + } + else { + int sceneid = Integer.parseInt(dpdata.get(i).venueid); + if (sitecellinfos.size() > 0) { + try { + sitecellinfos = sitecellinfos.stream().filter(x -> x.get类型().equals("场馆")).filter(x -> x.get编号() == sceneid).collect(Collectors.toList()); + } + catch(Exception e) + { + } + if (sitecellinfos.size()>0) + strsitecell = "2G基站数:" + String.valueOf(sitecellinfos.get(0).基站数2g) + " 个,2G小区数:" + String.valueOf(sitecellinfos.get(0).小区数2g) + + " 个,4G基站数:" + String.valueOf(sitecellinfos.get(0).基站数4g) + " 个,4G小区数:" + String.valueOf(sitecellinfos.get(0).小区数4g) + + " 个,5G基站数:" + String.valueOf(sitecellinfos.get(0).基站数5g) + " 个,5G小区数:" + String.valueOf(sitecellinfos.get(0).小区数5g)+" 个"; + } + } + dpdata.get(i).sitecellinto=strsitecell; + //------------------------------------------取KPI + if ((level==2) && (areaid>0)) //展示景点 + { + class_dp_2_kpi_spot kpispot=new class_dp_2_kpi_spot(); + List kpi_spot_cells=new ArrayList(); + int spotid=Integer.parseInt(dpdata.get(i).venueid); + List cellspot=new ArrayList(); + try { + cellspot = cellsall.stream().filter(x -> x.get景区id() == spotid).collect(Collectors.toList()); + } + catch(Exception e) + { + } + //--------------------------------------根据指标进行排序,SCORE大的排在最前面 + if (kpiname.equals("综合算法")) + cellspot=cellspot.stream().sorted(Comparator.comparing(class_dp_2_kpi_spot_celldetail::getKpiZhsf,Comparator.reverseOrder())).collect(Collectors.toList()); + else if (kpiname.equals("上行Prb利用率")) + cellspot=cellspot.stream().sorted(Comparator.comparing(class_dp_2_kpi_spot_celldetail::getPrbUp,Comparator.reverseOrder())).collect(Collectors.toList()); + else if (kpiname.equals("下行Prb利用率")) + cellspot=cellspot.stream().sorted(Comparator.comparing(class_dp_2_kpi_spot_celldetail::getPrbDown,Comparator.reverseOrder())).collect(Collectors.toList()); + else if (kpiname.equals("最大用户数")) + cellspot=cellspot.stream().sorted(Comparator.comparing(class_dp_2_kpi_spot_celldetail::getMaxUser,Comparator.reverseOrder())).collect(Collectors.toList()); + else if (kpiname.equals("平均干扰值")) + cellspot=cellspot.stream().sorted(Comparator.comparing(class_dp_2_kpi_spot_celldetail::getAvgDisturb,Comparator.reverseOrder())).collect(Collectors.toList()); + //-------------------------------------- + int score=0; + String color=""; + //---------------------------------------------整个景区取最差小区的得分为其得分 + int icnt=cellspot.size(); //列表不能有太多的数据,20231003 + if (icnt>20) icnt=20; + //------------------------ + for (int m=0;m dpData=new ArrayList(); + dpData = dpNewApiMapper.get_seat_detail(sceneid); + return success(dpData); + } + //endregion + + //region--------------------------------------------------------------------------------------无线:3D大屏场内坐席接口 + @ApiOperation(value = "无线:3D场内坐席数据接口;sceneid:场馆ID;inorout:1,场内,2:场外,3:功能区,nettype:4G,5G,datatype:15分钟,1分钟;kpiname:指标名称") + @GetMapping(value = "/get_seat_data") + @Anonymous + public TableDataInfo getSeatData(@RequestParam Integer sceneid, //场馆id + @RequestParam String nettype, //4G ,5G + @RequestParam(value = "inorout", required = false, defaultValue = "0") String inorout, //场内场外,0: 全部, 1,场内,2:场外。3:功能区 + @RequestParam(required = false) String datatype, //由系统表控制 + @RequestParam(required = false) String kpiname, + HttpServletRequest request) { + NewDpKpiMonitorQO qo = new NewDpKpiMonitorQO(); + //class_dp_2_scene_control dpData = dpNewApiMapper.get_scene_control(); + //---------------------------------------------------------------------------update by sunlm , 指定场馆展示1分钟或15分钟指标 + class_dp_2_scene_control dpData = dpNewApiMapper.get_scene_control(sceneid); + String str_data_type=""; + //--------------------------------------------------------------------------- + if (null != sceneid) { + qo.setSceneid(sceneid); + } + if (null != nettype && !nettype.equals("")) { + qo.setNettype(nettype); + } else { + qo.setNettype(dpData.getNettype()); + } + + if (null != datatype && !datatype.equals("")) { + qo.setDatatype(datatype); + } else { + qo.setDatatype(dpData.getMintype() + "分钟"); + } + //---------------------------------------- + str_data_type=qo.getDatatype(); + str_data_type=str_data_type.replace("分钟",""); + //---------------------------------------- + + if (null != kpiname && !kpiname.equals("")) { + qo.setKpiname(kpiname); + } else { + qo.setKpiname(dpData.getKpiname()); + } + + qo.setInorout(inorout); //add by sunlm 2023-07-18 + + //------------------------------------------------- + + String keyname="dp_2_seat_data_"+String.valueOf(qo.getSceneid())+"_"+qo.getNettype()+"_"+str_data_type+"_"+qo.getKpiname()+"_"+String.valueOf(inorout); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + PageInfo page = redisCache.getCacheObject(keyname); + return getDataTable(page.getList(), page.getTotal()); + } + //------------------------------------------------------------------------ + PageInfo page = pmKpiMonitorCellService.getDpMonitorCellList(qo); + redisCache.setCacheObject(keyname, page,getcachesecond(), TimeUnit.SECONDS); //数据放缓存 + return getDataTable(page.getList(), page.getTotal()); + + } + //endregion + + //region--------------------------------------------------------------------------------------无线:3D大屏场外点接口 + @ApiOperation(value = "无线:3D大屏场外点接口;sceneid:场馆ID;nettype:4G,5G,datatype:15分钟,1分钟;kpiname:指标名称") + @GetMapping(value = "/get_point_data") + @Anonymous + public TableDataInfo getPointData(@RequestParam Integer sceneid, + @RequestParam String nettype, + @RequestParam(required = false) String datatype, + @RequestParam(required = false) String kpiname, + HttpServletRequest request) { + NewDpKpiMonitorQO qo = new NewDpKpiMonitorQO(); + //class_dp_2_scene_control dpData = dpNewApiMapper.get_scene_control(); + //---------------------------------------------------------------------------update by sunlm , 指定场馆展示1分钟或15分钟指标 + class_dp_2_scene_control dpData = dpNewApiMapper.get_scene_control(sceneid); + String str_data_type=""; + //--------------------------------------------------------------------------- + if (null != sceneid) { + qo.setSceneid(sceneid); + } + if (null != nettype && !nettype.equals("")) { + qo.setNettype(nettype); + } else { + qo.setNettype(dpData.getNettype()); + } + if (null != datatype && !datatype.equals("")) { + qo.setDatatype(datatype); + } else { + qo.setDatatype(dpData.getMintype() + "分钟"); + } + //---------------------------------------- + str_data_type=qo.getDatatype(); + str_data_type=str_data_type.replace("分钟",""); + //---------------------------------------- + + if (null != kpiname && !kpiname.equals("")) { + qo.setKpiname(kpiname); + } else { + qo.setKpiname(dpData.getKpiname()); + } + qo.setSeatno(com.ruoyi.eastcom_yw.common.constant.KpiConstants.QUERYSEAT); + + qo.setInorout("4"); //场外点接口,P, add by sunlm 2023-07-18 + + //---------------------------------------- + String keyname="dp_2_point_data_"+String.valueOf(qo.getSceneid())+"_"+qo.getNettype()+"_"+str_data_type+"_"+qo.getKpiname(); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + PageInfo page = redisCache.getCacheObject(keyname); + return getDataTable(page.getList(), page.getTotal()); + } + //----------------------------------------------------------------------- + PageInfo page = pmKpiMonitorCellService.getDpMonitorCellList(qo); + redisCache.setCacheObject(keyname, page,58, TimeUnit.SECONDS); //数据放缓存 + return getDataTable(page.getList(), page.getTotal()); + + } + //endregion + + //region--------------------------------------------------------------------------------------无线:3D大屏外场保障(牌子显示) + @ApiOperation(value = "无线:3D大屏外场保障(牌子显示),sceneid:场馆ID,typeid: 1: 4G,2: 5G ") + @GetMapping("/get_test_data") + @Anonymous + public AjaxResult get_test_data(@RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + @RequestParam(value = "typeid", required = false, defaultValue = "0") int typeid) { + String keyname="dp_2_test_data_"+String.valueOf(sceneid)+"_"+String.valueOf(typeid); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //----------------------------------------------------------------------- + List jsonObjects = new ArrayList<>(); + List list = MydpNewYayun_Wuxian_Mapper.get_test_data(sceneid,typeid); + for (class_dp_2_scene_test_data SceneTestData : list) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name", SceneTestData.getScenename()); + jsonObject.put("type", SceneTestData.getNettype()); + jsonObject.put("GPS", SceneTestData.getLat() + "," + SceneTestData.getLng()); + jsonObject.put("ConnectDelay", String.valueOf(SceneTestData.getConnectdelay())); + jsonObject.put("DLSpeed", String.valueOf(SceneTestData.getDlspeed())); + jsonObject.put("PageComplete", String.valueOf(SceneTestData.getPagecomplete())); + jsonObject.put("ULSpeed", String.valueOf(SceneTestData.getUlspeed())); + jsonObject.put("UpdateTime", null == SceneTestData.getUpdateTime() ? "" : DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", SceneTestData.getUpdateTime())); + jsonObjects.add(jsonObject); + } + redisCache.setCacheObject(keyname, jsonObjects,getcachesecond(), TimeUnit.SECONDS); //数据放缓存 + return AjaxResult.success(jsonObjects); + } + //endregion + + //region--------------------------------------------------------------------------------------无线:大屏外场告警接口 + @ApiOperation(value = "无线:大屏外场基站告警接口,sceneid:场馆ID") + @GetMapping("/get_bts_wireless_alarms") + @Anonymous + public AjaxResult get_bts_wireless_alarms( + @RequestParam int sceneid + ) + { + String keyname="dp_2_bts_wireless_alarms_"+String.valueOf(sceneid); + if (redisCache.hasKey(keyname)) { + List cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + List btslist=new ArrayList(); + btslist= MydpNewYayun_Wuxian_Mapper.get_bts_wireless_alarms_list(sceneid); + //---------------------------------------- + List allalarmlist=MydpNewYayun_Wuxian_Mapper.get_wireless_alarms_by_site(sceneid); + //---------------------------------------- + for (int i=0;i alarmlist=new ArrayList(); + try { + alarmlist=allalarmlist.stream().filter(x -> x.getReserved().equals(sitename)).collect(Collectors.toList()); + } + catch(Exception e) + { + } + btslist.get(i).lists=alarmlist; + } + redisCache.setCacheObject(keyname, btslist,getcachesecond(), TimeUnit.SECONDS); //缓存保留分钟 + return success(btslist); + } + //endregion + + //region--------------------------------------------------------------------------------------无线:大屏内外场坐席告警接口 + @ApiOperation(value = "无线:大屏内外场坐席告警接口,sceneid:场馆ID,inorout: 1:内场;2:外场;3:功能区") + @GetMapping("/get_seat_wireless_alarms") + @Anonymous + public AjaxResult get_seat_wireless_alarms( + @RequestParam int sceneid, + @RequestParam(value = "inorout", required = false, defaultValue = "0") int inorout + ) + { + String keyname="dp_2_seat_wireless_alarms_"+String.valueOf(sceneid)+"_"+String.valueOf(inorout); + if (redisCache.hasKey(keyname)) { + List cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + List seatlist=new ArrayList(); + seatlist= MydpNewYayun_Wuxian_Mapper.get_seat_wireless_alarms_list(sceneid,inorout); + //----------------------------------------- + List allalarmlist=MydpNewYayun_Wuxian_Mapper.get_wireless_alarms_by_seat(sceneid); + //------------------------------------------- + for (int i=0;i0) { + String seatid = seatlist.get(i).seatid; + List alarmlist = new ArrayList(); + try { + alarmlist=allalarmlist.stream().filter(x -> x.getReserved().equals(seatid)).collect(Collectors.toList()); + } + catch(Exception e) + { + } + seatlist.get(i).lists = alarmlist; + } + } + //------------------------------------- + redisCache.setCacheObject(keyname, seatlist,getcachesecond(), TimeUnit.SECONDS); //缓存保留分钟 + return success(seatlist); + } + //endregion + + //region ----------------------------------------------------------------------------------------无线:右小屏景点接口 + @ApiOperation("无线:右小屏景点接口,spottypeid: 景区大类: 1:景区,4:功能中心;typeid:1: 4G ,2: 5G") + @GetMapping(value = "/get_all_spot_top5") + public AjaxResult get_all_spot_top5(@RequestParam(value = "spottypeid", required = false, defaultValue = "0") int spottypeid,//景区大类 + @RequestParam int typeid, + HttpServletRequest request) + { + int mintype=getmincontroltype(spottypeid,0); //1分钟 ,15分钟 + + String keyname="dp_2_all_spot_top5_"+String.valueOf(spottypeid)+"_"+String.valueOf(typeid); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //----------------------------------------------------------------------- + List dpAllData=new ArrayList(); + //--------------------------- + List dpspotdetail = MydpNewYayun_Wuxian_Mapper.getspotlist(spottypeid); //获得大类的细项 + for (class_dp_2_spotdetail spots:dpspotdetail) { + List lists=new ArrayList(); + //----------------------------------------------算出每个指标的TOP5 + class_dp_2_top5_spot spot=new class_dp_2_top5_spot(); + List top5=new ArrayList(); + top5 = MydpNewYayun_Wuxian_Mapper.get_all_spot_top5(spots.spotId,"上行Prb利用率", typeid, mintype); + spot.kpiname="上行Prb利用率"; + spot.top5=top5; + lists.add(spot); + //-------------- + spot=new class_dp_2_top5_spot(); + top5=new ArrayList(); + top5 = MydpNewYayun_Wuxian_Mapper.get_all_spot_top5(spots.spotId,"下行Prb利用率", typeid, mintype); + spot.kpiname="下行Prb利用率"; + spot.top5=top5; + lists.add(spot); + //--------------- + spot=new class_dp_2_top5_spot(); + top5=new ArrayList(); + top5 = MydpNewYayun_Wuxian_Mapper.get_all_spot_top5(spots.spotId,"最大用户数", typeid, mintype); + spot.kpiname="最大用户数"; + spot.top5=top5; + lists.add(spot); + //-------------- + spot=new class_dp_2_top5_spot(); + top5=new ArrayList(); + top5 = MydpNewYayun_Wuxian_Mapper.get_all_spot_top5(spots.spotId,"平均干扰值", typeid, mintype); + spot.kpiname="平均干扰值"; + spot.top5=top5; + lists.add(spot); + //-------------------------------------------------- + class_dp_2_top5_allspot allspot=new class_dp_2_top5_allspot(); + allspot.spotname=spots.spotName; + allspot.lists=lists; + dpAllData.add(allspot); + } + redisCache.setCacheObject(keyname, dpAllData,58, TimeUnit.SECONDS); //数据放缓存 + return success(dpAllData); + } + //endregion + + //region-------------------------------------------------------------------------------无线:保存MML指令 + /*{ + "orderid": 1, + "datatype": "1分钟", + "nettype": "5G", + "venueid": 2, + "venuename": "杭州奥体中心体育场", + "seatid": "B22", + "seatname": "", + "onekey": 0, + "color": "#00af57", + "score": 0.0, + "kpiname": "综合算法", + "celltype": null, + "stationno": 11544392, + "pointname": "H11544392-杭州滨江奥体主体育场中看台E1至L1-H5W-lampsite", + "pointid": "B22/B23/B24", + "longitude": 120.222995, + "latitude": 30.231595, + "celllist": [ + { + "nettype": "5G", + "venueid": 2, + "venuename": "杭州奥体中心体育场", + "坐席编号": "B22", + "cellcodeci": "47285829762", + "starttime": "2023-09-11 15:18:00", + "小区名称": "H11544392-杭州滨江奥体主体育场中看台E1至L1-H5W-lampsite-49610-中看台M5SF-130", + "最大用户数": { + "value": 0, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "上行prb利用率": { + "value": 3.38, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "下行prb利用率": { + "value": 7.41, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "上行平均干扰": { + "value": -115.00, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "endtime": "2023-09-11 15:18:00", + "综合得分": { + "value": 0, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "stationno": 11544392, + "pointname": "H11544392-杭州滨江奥体主体育场中看台E1至L1-H5W-lampsite", + "pointid": "B22/B23/B24", + "longitude": 120.222995, + "latitude": 30.231595, + "小区频段": "NR-C", + "设备类型": "4T", + "带宽": 80, + "方位角": 360 + }, + { + "nettype": "5G", + "venueid": 2, + "venuename": "杭州奥体中心体育场", + "坐席编号": "B22", + "cellcodeci": "47285825668", + "starttime": "2023-09-11 15:18:00", + "小区名称": "H11544391-杭州滨江奥体主体育场中看台B2至L1-H5W-lampsite-26622-中看台M5SF-132", + "最大用户数": { + "value": 0, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "上行prb利用率": { + "value": 4.03, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "下行prb利用率": { + "value": 5.98, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "上行平均干扰": { + "value": -114.00, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "endtime": "2023-09-11 15:18:00", + "综合得分": { + "value": 0, + "maxvalue": null, + "color": "#00af57", + "score": 0.0, + "data": null + }, + "stationno": 11544391, + "pointname": "H11544391-杭州滨江奥体主体育场中看台B2至L1-H5W-lampsite", + "pointid": "B22/B23/B24", + "longitude": 120.223123, + "latitude": 30.232123, + "小区频段": "NR-D", + "设备类型": "4T", + "带宽": 100, + "方位角": 360 + } + ] + } + * */ + @ApiOperation("无线:保存MML指令 ") + @PostMapping(value = "/insert_mml_info") + public AjaxResult insert_mml_info(@RequestBody JSONObject jsonObject, HttpServletRequest request) + { + String sRet="保存成功"; + //------------------------------------- + List list=(List)jsonObject.get("celllist"); + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("MMddHHmm"); + String dateString = formatter.format(currentTime); + int batchno=Integer.parseInt(dateString); //批次 + for (int i=0;i0 的,保存 + if (zhvalue>0) + sRet=MydpNewYayun_Wuxian_Mapper.insert_mml_info(cellname,prbup,prbdown,maxuser,zhvalue, + avgdisturb,batchno,sceneid,stattime,seatid,nettype); + } + //------------------------------------- + return sRet.equals("保存成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + //endregion + + //region -------------------------------------------------------------------------------------无线:高负荷小区TOP5 + //-------------------------------------------- + + @ApiOperation("无线:高负荷小区TOP5接口,typeid:1: 4G ,2: 5G") + @GetMapping(value = "/get_wireless_highload") + public AjaxResult get_wireless_highload( + @RequestParam int typeid, + HttpServletRequest request) + { + String keyname="dp_2_wireless_highload_"+String.valueOf(typeid); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + //--------------------------------------------------------------------读数据库 + List dpData=new ArrayList(); + dpData=MydpNewYayun_Wuxian_Mapper.get_wireless_highload(typeid); + //---------------------- + redisCache.setCacheObject(keyname, dpData,getcachesecond(), TimeUnit.SECONDS); //数据放缓存 + return success(dpData); + } + //endregion + + //region --------------------------------------------------------------------------------------------小区频段统计 + @ApiOperation("小区频段统计") + @GetMapping(value = "/get_freq_cnt") + public AjaxResult get_freq_cnt(@RequestParam int level, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + @RequestParam(value = "sceneid", required = false, defaultValue = "0") int sceneid, + @RequestParam int typeid, + HttpServletRequest request) + { + int mintype=getmincontroltype(areaid,sceneid); //1分钟 ,15分钟 + String keyname="dp_2_freq_cnt_"+String.valueOf(level)+"_"+String.valueOf(areaid)+"_"+String.valueOf(sceneid)+"_" + +String.valueOf(typeid)+"_"+String.valueOf(mintype); + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List lstData = redisCache.getCacheObject(keyname); + return success(lstData); + } + List dplist=new ArrayList(); + dplist = MydpNewYayun_Wuxian_Mapper.get_freq_cnt(level,areaid,sceneid,typeid,mintype); + redisCache.setCacheObject(keyname, dplist,getcachesecond(), TimeUnit.SECONDS); //数据放缓存 + return success(dplist); + } + //endregion + + //--------------------第六屏 DICT,包括全域/城区 + + //region ------------------------------------------------------------------------------------DICT:地图显示接口 + @ApiOperation("DICT:地图显示接口 ") + @GetMapping(value = "/get_maps_dict") + public AjaxResult get_maps_dict() + { + List dpData= MydpNewYayun_Dict_Mapper.get_dict_list(); + String keyname="dp_6_dict_map_alarm_list"; + List dpAlarm=new ArrayList(); + if (redisCache.hasKey(keyname)) { + dpAlarm = redisCache.getCacheObject(keyname); + } + else { + dpAlarm = MydpNewYayun_Dict_Mapper.get_map_alarm_list(); + redisCache.setCacheObject(keyname, dpAlarm,58, TimeUnit.SECONDS); //缓存保留分钟 + } + //-------------------------------------- + for (int i=0;i dpAlarm1=new ArrayList(); + try { + dpAlarm1=dpAlarm.stream().filter(x -> x.getCode().equals(areaname)).collect(Collectors.toList()); + } + catch(Exception e) + { + } + dpData.get(i).lists=dpAlarm1; + dpData.get(i).alarmcount=dpAlarm1.size(); + } + //--------------------------------------------------------- + return success(dpData); + } + //endregion + + //region --------------------------------------------------------------------------------------------DICT:监控类项目在线率 + @ApiOperation("DICT:监控类项目在线率") + @GetMapping(value = "/get_dict_monitor_project") + public AjaxResult get_dict_monitor_project(HttpServletRequest request) + { + String keyname="dp_6_dict_monitor_project_list"; + List projectlist=new ArrayList(); + if (redisCache.hasKey(keyname)) { + projectlist = redisCache.getCacheObject(keyname); + } + else { + projectlist= MydpNewYayun_Dict_Mapper.get_dict_monitor_project_list(); + redisCache.setCacheObject(keyname, projectlist,58, TimeUnit.SECONDS); //缓存保留分钟 + } + + class_dp_6_dict_project_statis dictstat=MydpNewYayun_Dict_Mapper.get_dict_monitor_project_stat(); + + class_dp_6_dict_kpi_monitor kpiproject=new class_dp_6_dict_kpi_monitor(); + kpiproject.lists=projectlist; + kpiproject.projecttotal=dictstat==null?0:dictstat.projectnum ;//projectlist.size(); + kpiproject.pointtotal=dictstat==null?0:dictstat.pointnumber ;//0; + kpiproject.guzhangtotal=dictstat==null?0:dictstat.guzhangshuliang;//0; + /* + for (int i=0;i alarmlist=new ArrayList(); + if (redisCache.hasKey(keyname)) { + alarmlist = redisCache.getCacheObject(keyname); + } + else { + alarmlist= MydpNewYayun_Dict_Mapper.get_dict_monitor_alarm_list(); + redisCache.setCacheObject(keyname, alarmlist,58, TimeUnit.SECONDS); //缓存保留分钟 + } + class_dp_6_dict_alarm_monitor alarmproject=new class_dp_6_dict_alarm_monitor(); + alarmproject.lists=alarmlist; + alarmproject.total=alarmlist.size(); + //----------------- + return success(alarmproject); + } + //endregion + + //region --------------------------------------------------------------------------------------------DICT:链路类项目告警 + @ApiOperation("DICT:链路类项目告警") + @GetMapping(value = "/get_dict_link_alarm") + public AjaxResult get_dict_link_alarm(HttpServletRequest request) + { + String keyname="dp_dict_link_alarm_list"; + List alarmlist=new ArrayList(); + if (redisCache.hasKey(keyname)) { + alarmlist = redisCache.getCacheObject(keyname); + } + else { + alarmlist= MydpNewYayun_Dict_Mapper.get_dict_link_alarm_list(); + redisCache.setCacheObject(keyname, alarmlist,58, TimeUnit.SECONDS); //缓存保留分钟 + } + //--------------------------------- + List zzalarmlist=new ArrayList(); + List tqalarmlist=new ArrayList(); + try + { + zzalarmlist = alarmlist.stream().filter(x -> x.get项目类型().equals("制证验证")).collect(Collectors.toList()); + } + catch (Exception ee) { + } + try + { + tqalarmlist = alarmlist.stream().filter(x -> x.get项目类型().equals("TQ安保")).collect(Collectors.toList()); + } + catch (Exception ee) { + } + //--------------------------------- + class_dp_6_dict_links links=new class_dp_6_dict_links(); + links.zhizhenglists=zzalarmlist; + links.teqinglists=tqalarmlist; + links.zhizhengtotal=zzalarmlist==null?0:zzalarmlist.size(); + links.teqingtotal=tqalarmlist==null?0:tqalarmlist.size(); + //----------------- + return success(links); + } + //endregion + + //region --------------------------------------------------------------------------------------------DICT:终端接入 + @ApiOperation("DICT:终端接入统计接口") + @GetMapping(value = "/get_dict_clientcount") + public AjaxResult get_dict_clientcount(HttpServletRequest request) + { + + String keyname="dp_6_dict_clientcount"; + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List cacheData=redisCache.getCacheObject(keyname); //相同的类结构 + return success(cacheData); + } + //-------------------------------------------------------------------读数据库 + List dpData= MydpNewYayun_Dict_Mapper.get_dict_clientcount(); + //---------------------------------- + class_dp_1_gbflow_wireless myData=new class_dp_1_gbflow_wireless(); + myData.label=new ArrayList(); + myData.xaxis=new ArrayList(); + myData.value=new ArrayList(); + myData.value2=new ArrayList(); + //---------------------- + myData.label.add("今天(" + getDateTimeString(0) + ")"); + myData.label.add("昨天(" + getDateTimeString(-1) + ")"); + + float vlst1=0; + float vlst2=0; + for (int i=0;i0) vlst1=dpData.get(i).gb; + if ((dpData.get(i).gb==-1) && (i>0)) + myData.value.add(vlst1); + else if ((dpData.get(i).gb==-1) && (i==0)) + myData.value.add((float)0.00); + else + myData.value.add(dpData.get(i).gb); + } + else //前日 + { + myData.xaxis.add(dpData.get(i).adate); + if (dpData.get(i).gb>0) vlst2=dpData.get(i).gb; + if ((dpData.get(i).gb==-1) && (i>0)) + myData.value2.add(vlst2); + else if ((dpData.get(i).gb==-1) && (i==0)) + myData.value2.add((float)0.00); + else + myData.value2.add(dpData.get(i).gb); + } + } + //---------------------- + List lstData=new ArrayList(); + lstData.add(myData); + redisCache.setCacheObject(keyname, lstData,58, TimeUnit.SECONDS); //缓存保留 + return success(lstData); + } + //endregion + + //region --------------------------------------------------------------------------------------------DICT:终端流量 + @ApiOperation("DICT:终端流量统计接口") + @GetMapping(value = "/get_dict_clientstream") + public AjaxResult get_dict_clientstream(HttpServletRequest request) + { + + String keyname="dp_6_dict_clientstream"; + //-------------------------------------------------------------------读缓存 + if (redisCache.hasKey(keyname)) { + List cacheData=redisCache.getCacheObject(keyname); //相同的类结构 + return success(cacheData); + } + //-------------------------------------------------------------------读数据库 + List dpData= MydpNewYayun_Dict_Mapper.get_dict_clientstream(); + //---------------------------------- + class_dp_1_gbflow_wireless myData=new class_dp_1_gbflow_wireless(); + myData.label=new ArrayList(); + myData.xaxis=new ArrayList(); + myData.value=new ArrayList(); + myData.value2=new ArrayList(); + //---------------------- + myData.label.add("今天(" + getDateTimeString(0) + ")"); + myData.label.add("昨天(" + getDateTimeString(-1) + ")"); + + float vlst1=0; + float vlst2=0; + for (int i=0;i0) vlst1=dpData.get(i).gb; + if ((dpData.get(i).gb==-1) && (i>0)) + myData.value.add(vlst1); + else if ((dpData.get(i).gb==-1) && (i==0)) + myData.value.add((float)0.00); + else + myData.value.add(dpData.get(i).gb); + } + else //前日 + { + myData.xaxis.add(dpData.get(i).adate); + if (dpData.get(i).gb>0) vlst2=dpData.get(i).gb; + if ((dpData.get(i).gb==-1) && (i>0)) + myData.value2.add(vlst2); + else if ((dpData.get(i).gb==-1) && (i==0)) + myData.value2.add((float)0.00); + else + myData.value2.add(dpData.get(i).gb); + } + } + //---------------------- + List lstData=new ArrayList(); + lstData.add(myData); + redisCache.setCacheObject(keyname, lstData,58, TimeUnit.SECONDS); //缓存保留 + return success(lstData); + } + //endregion + + //region --------------------------------------------------------------------------------------------DICT:AP设备数统计 + @ApiOperation("DICT:AP设备数统计") + @GetMapping(value = "/get_dict_ap_count") + public AjaxResult get_dict_ap_count(HttpServletRequest request) + { + + String keyname="dp_6_dict_ap_count"; + if (redisCache.hasKey(keyname)) { + class_dp_1_device_alarms_counts_ext cacheData = redisCache.getCacheObject(keyname); + return success(cacheData); + } + //------------------------------------- + List dpdata= MydpNewYayun_Dict_Mapper.get_dict_ap_count(); + //------------------------------------ + class_dp_1_device_alarms_counts_ext retdata=new class_dp_1_device_alarms_counts_ext(); + retdata.设备数1= dpdata.get(0).设备数1; + retdata.设备数2= dpdata.get(0).设备数2; + redisCache.setCacheObject(keyname, retdata,58, TimeUnit.SECONDS); //缓存 + return success(retdata); + } + //endregion + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/dpYayunController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/dpYayunController.java new file mode 100644 index 0000000000000000000000000000000000000000..afed511f380bdf3fc6dd15de606286b5978e9fea --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/sunlm/dpYayunController.java @@ -0,0 +1,422 @@ +package com.ruoyi.web.controller.sunlm; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.sunlm.domain.*; +import com.ruoyi.sunlm.mapper.dpYayunMapper; +import com.ruoyi.sunlm.mapper.dpYayunReplayMapper; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.validation.constraints.NotNull; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +@RestController +@CrossOrigin +@RequestMapping("/eastcom_yw/daping") + +public class dpYayunController extends BaseController +{ + @Resource + dpYayunMapper MydpYayunMapper; //直接在这里引用数据库操作层(MAPPER),就不用写Service层了! + + @Resource + dpYayunReplayMapper MydpYayunReplayMapper; //0428演示用 + + @Value("${daping}") + public String jobtype; //DEBUG //WORK , 发布到正式服务器改成 WORK, 连接公司服务器数据库时用 DEBUG, 在配置文件中配置 + + //-------------------------------------------- + public int getruntype() + { + return MydpYayunMapper.getruntype(); + } + + //region --------------------------------------------------------------------------------------------调用存储过程测试 + @GetMapping(value = "/calldbfunction") + public AjaxResult calldbfunction(HttpServletRequest request) + { + String sret = MydpYayunMapper.calldbfunction(); + List srets=new ArrayList(); + srets.add(sret); + return success(srets); + } + //endregion + + //region --------------------------------------------------------------------------------------------回放复位控制 + @ApiOperation("回放复位控制") + @PutMapping(value = "/resetreplay") + public AjaxResult resetreplay(HttpServletRequest request) + { + String sRet=""; + try { + MydpYayunReplayMapper.resetreplay(); + sRet = "复位成功"; + } catch (Exception e) { + sRet = "复位失败:"+e.getMessage(); + } + //--------------------------------- + return sRet.equals("复位成功")?AjaxResult.success(sRet):AjaxResult.error(sRet); + } + //endregion + + //region --------------------------------------------------------------------------------------------获取场馆列表 + @ApiOperation("获取场馆列表") + @GetMapping(value = "/getvenuelist") + public AjaxResult getvenuelist(HttpServletRequest request) + { + List dpvenue=new ArrayList(); + dpvenue = MydpYayunMapper.getvenuelists(); + return success(dpvenue); + } + //endregion + + //region --------------------------------------------------------------------------------------------左侧1图表 + private String getDateTimeString(int day) + { + Calendar calendar = Calendar.getInstance(); //创建Calendar 的实例 + calendar.add(Calendar.DAY_OF_MONTH, day); //当前时间增减天数 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日"); + String string = simpleDateFormat.format(calendar.getTime()); + return string; + } + + + + //-------------------------------------------- + @ApiOperation("左侧1图表接口,typeid:1: 4G ,2: 5G, sceneid:场馆ID") + @GetMapping(value = "/get_left_1_data") + public AjaxResult get_left_1_data(@RequestParam int sceneid, @RequestParam int typeid,HttpServletRequest request) + { + List dpData=new ArrayList(); + logger.info(jobtype); + //---------------------------1:正式,0:演示 + int runtype=getruntype(); + if (runtype==1) + dpData = MydpYayunMapper.get_left_1_data(sceneid,typeid,jobtype); + else if (runtype==0) + dpData = MydpYayunReplayMapper.get_left_1_data(sceneid,typeid,jobtype); + //------------------ + class_dp_left_1 myData=new class_dp_left_1(); + myData.label=new ArrayList(); + myData.xaxis=new ArrayList(); + myData.value=new ArrayList(); + myData.value2=new ArrayList(); + //---------------------- + if (runtype==1) { + myData.label.add("今天(" + getDateTimeString(0) + ")"); + myData.label.add("昨天(" + getDateTimeString(-1) + ")"); + } + else + { + myData.label.add("当日"); + myData.label.add("前日"); + } + for (int i=0;i0)) + myData.value.add(dpData.get(i-1).value); + else if ((dpData.get(i).value==-1) && (i==0)) + myData.value.add((float)0.00); + else + myData.value.add(dpData.get(i).value); + } + else //昨天数据 + { + myData.xaxis.add(dpData.get(i).datetime); + if ((dpData.get(i).value==-1) && (i>0)) + myData.value2.add(dpData.get(i-1).value); + else if ((dpData.get(i).value==-1) && (i==0)) + myData.value2.add((float)0.00); + else + myData.value2.add(dpData.get(i).value); + } + } + //---------------------- + List lstData=new ArrayList(); + lstData.add(myData); + return success(lstData); + } + //endregion + + //region --------------------------------------------------------------------------------------------左侧2图表 + //-------------------------------------------- + @ApiOperation("左侧2图表接口,typeid:1: 4G ,2: 5G, sceneid:场馆ID") + @GetMapping(value = "/get_left_2_data") + public AjaxResult get_left_2_data(@RequestParam int sceneid, @RequestParam int typeid,HttpServletRequest request) + { + List dpData=new ArrayList(); + //----------------------- + int runtype=getruntype(); + if (runtype==1) + dpData = MydpYayunMapper.get_left_2_data(sceneid,typeid,jobtype); + else + dpData = MydpYayunReplayMapper.get_left_2_data(sceneid,typeid,jobtype); + //------------------ + class_dp_left_2 myData=new class_dp_left_2(); + myData.label=new ArrayList(); + myData.xaxis=new ArrayList(); + myData.value=new ArrayList(); + myData.value2=new ArrayList(); + //---------------------- + if (runtype==1) { + myData.label.add("今天(" + getDateTimeString(0) + ")"); + myData.label.add("昨天(" + getDateTimeString(-1) + ")"); + } + else + { + myData.label.add("当日"); + myData.label.add("前日"); + } + for (int i=0;i0)) + myData.value.add(dpData.get(i-1).value); + else if ((dpData.get(i).value==-1) && (i==0)) + myData.value.add((float)0.00); + else + myData.value.add(dpData.get(i).value); + } + else //昨天数据 + { + myData.xaxis.add(dpData.get(i).datetime); + if ((dpData.get(i).value==-1) && (i>0)) + myData.value2.add(dpData.get(i-1).value); + else if ((dpData.get(i).value==-1) && (i==0)) + myData.value2.add((float)0.00); + else + myData.value2.add(dpData.get(i).value); + } + } + //---------------------- + List lstData=new ArrayList(); + lstData.add(myData); + return success(lstData); + } + //endregion + + //region --------------------------------------------------------------------------------------------左侧3TOP5图表 + //-------------------------------------------- + public int getmincontroltype() + { + return MydpYayunMapper.getmincontroltype(); + } + + @ApiOperation("左侧3图表接口,typeid:1: 4G ,2: 5G, sceneid:场馆ID,areaid:0:全部小区,1:场内小区,2:场外小区") + @GetMapping(value = "/get_left_3_data") + public AjaxResult get_left_3_data(@RequestParam int sceneid, @RequestParam int typeid, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + HttpServletRequest request) + { + int mintype=getmincontroltype(); + List dpData=new ArrayList(); + //----------------------- + int runtype=getruntype(); + if (runtype==1) + dpData=MydpYayunMapper.get_left_3_data(sceneid,typeid,mintype,areaid,jobtype); + else + dpData=MydpYayunReplayMapper.get_left_3_data(sceneid,typeid,mintype,areaid,jobtype); + //---------------------- + return success(dpData); + } + //endregion + + //region --------------------------------------------------------------------------------------------右侧TOP5图表1 + //-------------------------------------------- + @ApiOperation("右侧TOP5图表1接口,typeid:1: 4G ,2: 5G, sceneid:场馆ID,areaid:0:全部小区,1:场内小区,2:场外小区") + @GetMapping(value = "/get_right_1_data") + public AjaxResult get_right_1_data(@RequestParam int sceneid, @RequestParam int typeid, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + HttpServletRequest request) + { + int mintype=getmincontroltype(); + List dpData=new ArrayList(); + int runtype=getruntype(); + if (runtype==1) + dpData=MydpYayunMapper.get_right_1_data(sceneid,typeid,mintype,areaid,jobtype); + else + dpData=MydpYayunReplayMapper.get_right_1_data(sceneid,typeid,mintype,areaid,jobtype); + //---------------------- + return success(dpData); + } + //endregion + + //region --------------------------------------------------------------------------------------------右侧TOP5图表2 + //-------------------------------------------- + @ApiOperation("右侧TOP5图表2接口,typeid:1: 4G ,2: 5G, sceneid:场馆ID,areaid:0:全部小区,1:场内小区,2:场外小区") + @GetMapping(value = "/get_right_2_data") + public AjaxResult get_right_2_data(@RequestParam int sceneid, @RequestParam int typeid, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + HttpServletRequest request) + { + int mintype=getmincontroltype(); + List dpData=new ArrayList(); + //--------------------------- + int runtype=getruntype(); + if (runtype==1) + dpData=MydpYayunMapper.get_right_2_data(sceneid,typeid,mintype,areaid,jobtype); + else + dpData=MydpYayunReplayMapper.get_right_2_data(sceneid,typeid,mintype,areaid,jobtype); + //---------------------- + return success(dpData); + } + //endregion + + //region --------------------------------------------------------------------------------------------右侧TOP5图表3 + //-------------------------------------------- + @ApiOperation("右侧TOP5图表3接口,typeid:1: 4G ,2: 5G, sceneid:场馆ID,areaid:0:全部小区,1:场内小区,2:场外小区") + @GetMapping(value = "/get_right_3_data") + public AjaxResult get_right_3_data(@RequestParam int sceneid, @RequestParam int typeid, + @RequestParam(value = "areaid", required = false, defaultValue = "0") int areaid, + HttpServletRequest request) + { + int mintype=getmincontroltype(); + List dpData=new ArrayList(); + //--------------------------- + int runtype=getruntype(); + if (runtype==1) + dpData=MydpYayunMapper.get_right_3_data(sceneid,typeid,mintype,areaid,jobtype); + else + dpData=MydpYayunReplayMapper.get_right_3_data(sceneid,typeid,mintype,areaid,jobtype); + //---------------------- + return success(dpData); + } + //endregion + + //region --------------------------------------------------------------------------------------------地图基站, 用新接口替换! + //-------------------------------------------- + @ApiOperation("地图基站接口, 用新接口替换!typeid:1: 4G ,2: 5G, sceneid:场馆ID") + @GetMapping(value = "/get_maps_data") + public AjaxResult get_maps_data(@RequestParam int sceneid, @RequestParam int typeid , @RequestParam String kpiname, HttpServletRequest request) + { + int mintype=getmincontroltype(); + class_dp_maps dpData=new class_dp_maps(); + //--------------------------- + int runtype=getruntype(); + if (runtype==1) + dpData = MydpYayunMapper.get_maps_data(sceneid,typeid); + else + dpData = MydpYayunReplayMapper.get_maps_data(sceneid,typeid); + //---------------------- + List dpBtss=new ArrayList(); + if (runtype==1) + dpBtss=MydpYayunMapper.get_bts_data(sceneid,typeid,kpiname,mintype,jobtype); + else + dpBtss=MydpYayunReplayMapper.get_bts_data(sceneid,typeid,kpiname,mintype,jobtype); + dpData.data=dpBtss; + //---------------------- + List lstData=new ArrayList(); + lstData.add(dpData); + return success(lstData); + } + //endregion + + //region --------------------------------------------------------------------------------------------顶部统计值,用新接口替换! + //--------------------------------------------去重 + /* + public static List removeDupliByName(List lists) { + Set pSet = new TreeSet<>((o1, o2) -> o1.compareTo(o2)); + pSet.addAll(lists); + return new ArrayList<>(pSet); + }*/ + + + public static List removeDupliByName(List list) { + HashSet h = new HashSet(list); + list.clear(); + list.addAll(h); + return list; + } + //---------------------------------------------- + + @ApiOperation("顶部统计值接口,用新接口替换!typeid:1: 4G ,2: 5G, sceneid:场馆ID, kpiname: 指标名(综合算法/最大用户数/上行Prb利用率/下行Prb利用率)") + @GetMapping(value = "/get_top_data") + public AjaxResult get_top_data(@RequestParam int sceneid, @RequestParam int typeid, @RequestParam String kpiname, HttpServletRequest request) + { + int mintype=getmincontroltype(); + List dpData; + //--------------------------- + int runtype=getruntype(); + if (runtype==1) + dpData = MydpYayunMapper.get_top_data(sceneid,typeid,kpiname,mintype,jobtype); + else + dpData = MydpYayunReplayMapper.get_top_data(sceneid,typeid,kpiname,mintype,jobtype); + + List red = dpData.stream().filter(x->"1".equals(x.getLevel())).map(class_dp_btsinfo::getName2).collect(Collectors.toList()); + List orange = dpData.stream().filter(x->"2".equals(x.getLevel())).map(class_dp_btsinfo::getName2).collect(Collectors.toList()); + List yellow = dpData.stream().filter(x->"3".equals(x.getLevel())).map(class_dp_btsinfo::getName2).collect(Collectors.toList()); + List green = dpData.stream().filter(x->"4".equals(x.getLevel())).map(class_dp_btsinfo::getName2).collect(Collectors.toList()); + + red=removeDupliByName(red); + orange=removeDupliByName(orange); + yellow=removeDupliByName(yellow); + green=removeDupliByName(green); + //---------------------------------------------- + class_dp_topinfo myData=new class_dp_topinfo(); + myData.red=red.size(); + myData.orange=orange.size(); + myData.yellow=yellow.size(); + myData.green=green.size(); + List lstData= new ArrayList<>(); + lstData.add(myData); + return success(lstData); + } + //endregion + + //region --------------------------------------------------------------------------------------------地图基站和统计值接口,合二为一 + //-------------------------------------------- + @ApiOperation("地图基站和统计值接口,合二为一,调用一次即可取得两个数据。typeid:1: 4G ,2: 5G, sceneid:场馆ID") + @GetMapping(value = "/get_maps_top_data") + public AjaxResult get_maps_top_data(@RequestParam int sceneid, @RequestParam int typeid , @RequestParam String kpiname, HttpServletRequest request) + { + int mintype=getmincontroltype(); + class_dp_maps_topinfo dpData=new class_dp_maps_topinfo(); + //--------------------------- + int runtype=getruntype(); + if (runtype==1) + dpData = MydpYayunMapper.get_maps_top_data(sceneid,typeid); + else + dpData = MydpYayunReplayMapper.get_maps_top_data(sceneid,typeid); + //---------------------- + List dpBtss=new ArrayList(); + if (runtype==1) + dpBtss=MydpYayunMapper.get_bts_1to2_data(sceneid,typeid,kpiname,mintype,jobtype); + else + dpBtss=MydpYayunReplayMapper.get_bts_1to2_data(sceneid,typeid,kpiname,mintype,jobtype); + + List red = dpBtss.stream().filter(x->"1".equals(x.getLevel())).map(class_dp_btsinfo::getName2).collect(Collectors.toList()); + List orange = dpBtss.stream().filter(x->"2".equals(x.getLevel())).map(class_dp_btsinfo::getName2).collect(Collectors.toList()); + List yellow = dpBtss.stream().filter(x->"3".equals(x.getLevel())).map(class_dp_btsinfo::getName2).collect(Collectors.toList()); + List green = dpBtss.stream().filter(x->"4".equals(x.getLevel())).map(class_dp_btsinfo::getName2).collect(Collectors.toList()); + + red=removeDupliByName(red); + orange=removeDupliByName(orange); + yellow=removeDupliByName(yellow); + green=removeDupliByName(green); + + dpData.total=new class_dp_topinfo(); + + dpData.total.red=red.size(); + dpData.total.orange=orange.size(); + dpData.total.yellow=yellow.size(); + dpData.total.green=green.size(); + + dpData.data=dpBtss; + //---------------------- + List lstData=new ArrayList(); + lstData.add(dpData); + return success(lstData); + } + //endregion + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysAppMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysAppMenuController.java new file mode 100644 index 0000000000000000000000000000000000000000..bf921d088ad2169d9ba20928f250bcf27c702326 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysAppMenuController.java @@ -0,0 +1,118 @@ +package com.ruoyi.web.controller.system; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysAppMenu; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysAppMenuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 菜单信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/appMenu") +public class SysAppMenuController extends BaseController { + @Autowired + private ISysAppMenuService appMenuService; + + /** + * 获取菜单列表 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:list')") + @GetMapping("/list") + public AjaxResult list(SysAppMenu menu) { + List menus = appMenuService.selectMenuList(menu, getUserId()); + return success(menus); + } + + /** + * 根据菜单编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:query')") + @GetMapping(value = "/{menuId}") + public AjaxResult getInfo(@PathVariable Long menuId) { + return success(appMenuService.selectMenuById(menuId)); + } + + /** + * 获取菜单下拉树列表 + */ + @GetMapping("/treeselect") + public AjaxResult treeselect(SysAppMenu menu) { + List menus = appMenuService.selectMenuList(menu, getUserId()); + return success(appMenuService.buildMenuTreeSelect(menus)); + } + + /** + * 加载对应角色菜单列表树 + */ + @GetMapping(value = "/roleMenuTreeselect/{roleId}/{menuCheckStrictly}") + public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId,@PathVariable("menuCheckStrictly")Boolean menuCheckStrictly) { + List menus = appMenuService.selectMenuList(getUserId()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", appMenuService.selectMenuListByRoleId(roleId,menuCheckStrictly)); + ajax.put("menus", appMenuService.buildMenuTreeSelect(menus)); + return ajax; + } + + /** + * 新增菜单 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:add')") + @Log(title = "菜单管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysAppMenu menu) { + if (UserConstants.NOT_UNIQUE.equals(appMenuService.checkMenuNameUnique(menu))) { + return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { + return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + menu.setCreateBy(getUsername()); + return toAjax(appMenuService.insertMenu(menu)); + } + + /** + * 修改菜单 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:edit')") + @Log(title = "菜单管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysAppMenu menu) { + if (UserConstants.NOT_UNIQUE.equals(appMenuService.checkMenuNameUnique(menu))) { + return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { + return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } else if (menu.getMenuId().equals(menu.getParentId())) { + return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); + } + menu.setUpdateBy(getUsername()); + return toAjax(appMenuService.updateMenu(menu)); + } + + /** + * 删除菜单 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:remove')") + @Log(title = "菜单管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{menuId}") + public AjaxResult remove(@PathVariable("menuId") Long menuId) { + if (appMenuService.hasChildByMenuId(menuId)) { + return warn("存在子菜单,不允许删除"); + } + if (appMenuService.checkMenuExistRole(menuId)) { + return warn("菜单已分配,不允许删除"); + } + return toAjax(appMenuService.deleteMenuById(menuId)); + } +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..d4f7c7a9fc0fda8d4990f1bd65505f7f5f8c2e61 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -0,0 +1,136 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.SysConfig; +import com.ruoyi.system.service.ISysConfigService; + +/** + * 参数配置 信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/config") +public class SysConfigController extends BaseController +{ + @Autowired + private ISysConfigService configService; + + /** + * 获取参数配置列表 + */ + @PreAuthorize("@ss.hasPermi('system:config:list')") + @GetMapping("/list") + public TableDataInfo list(SysConfig config) + { + startPage(); + List list = configService.selectConfigList(config); + return getDataTable(list); + } + + @Log(title = "参数管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:config:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysConfig config) + { + List list = configService.selectConfigList(config); + ExcelUtil util = new ExcelUtil(SysConfig.class); + util.exportExcel(response, list, "参数数据"); + } + + /** + * 根据参数编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:config:query')") + @GetMapping(value = "/{configId}") + public AjaxResult getInfo(@PathVariable Long configId) + { + return success(configService.selectConfigById(configId)); + } + + /** + * 根据参数键名查询参数值 + */ + @GetMapping(value = "/configKey/{configKey}") + public AjaxResult getConfigKey(@PathVariable String configKey) + { + return success(configService.selectConfigByKey(configKey)); + } + + /** + * 新增参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:add')") + @Log(title = "参数管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysConfig config) + { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) + { + return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setCreateBy(getUsername()); + return toAjax(configService.insertConfig(config)); + } + + /** + * 修改参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:edit')") + @Log(title = "参数管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysConfig config) + { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) + { + return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setUpdateBy(getUsername()); + return toAjax(configService.updateConfig(config)); + } + + /** + * 删除参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:remove')") + @Log(title = "参数管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{configIds}") + public AjaxResult remove(@PathVariable Long[] configIds) + { + configService.deleteConfigByIds(configIds); + return success(); + } + + /** + * 刷新参数缓存 + */ + @PreAuthorize("@ss.hasPermi('system:config:remove')") + @Log(title = "参数管理", businessType = BusinessType.CLEAN) + @DeleteMapping("/refreshCache") + public AjaxResult refreshCache() + { + configService.resetConfigCache(); + return success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java new file mode 100644 index 0000000000000000000000000000000000000000..a320da73fbe3666d0d86911db6ffc6a0b69eb7d6 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -0,0 +1,132 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import org.apache.commons.lang3.ArrayUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +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.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysDeptService; + +/** + * 部门信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/dept") +public class SysDeptController extends BaseController +{ + @Autowired + private ISysDeptService deptService; + + /** + * 获取部门列表 + */ + @PreAuthorize("@ss.hasPermi('system:dept:list')") + @GetMapping("/list") + public AjaxResult list(SysDept dept) + { + List depts = deptService.selectDeptList(dept); + return success(depts); + } + + /** + * 查询部门列表(排除节点) + */ + @PreAuthorize("@ss.hasPermi('system:dept:list')") + @GetMapping("/list/exclude/{deptId}") + public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) + { + List depts = deptService.selectDeptList(new SysDept()); + depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); + return success(depts); + } + + /** + * 根据部门编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:dept:query')") + @GetMapping(value = "/{deptId}") + public AjaxResult getInfo(@PathVariable Long deptId) + { + deptService.checkDeptDataScope(deptId); + return success(deptService.selectDeptById(deptId)); + } + + /** + * 新增部门 + */ + @PreAuthorize("@ss.hasPermi('system:dept:add')") + @Log(title = "部门管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDept dept) + { + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) + { + return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + dept.setCreateBy(getUsername()); + return toAjax(deptService.insertDept(dept)); + } + + /** + * 修改部门 + */ + @PreAuthorize("@ss.hasPermi('system:dept:edit')") + @Log(title = "部门管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDept dept) + { + Long deptId = dept.getDeptId(); + deptService.checkDeptDataScope(deptId); + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) + { + return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + else if (dept.getParentId().equals(deptId)) + { + return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); + } + else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) + { + return error("该部门包含未停用的子部门!"); + } + dept.setUpdateBy(getUsername()); + return toAjax(deptService.updateDept(dept)); + } + + /** + * 删除部门 + */ + @PreAuthorize("@ss.hasPermi('system:dept:remove')") + @Log(title = "部门管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{deptId}") + public AjaxResult remove(@PathVariable Long deptId) + { + if (deptService.hasChildByDeptId(deptId)) + { + return warn("存在下级部门,不允许删除"); + } + if (deptService.checkDeptExistUser(deptId)) + { + return warn("部门存在用户,不允许删除"); + } + deptService.checkDeptDataScope(deptId); + return toAjax(deptService.deleteDeptById(deptId)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java new file mode 100644 index 0000000000000000000000000000000000000000..6794948573316a7757a59b57f200bbd839b33a60 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -0,0 +1,124 @@ +package com.ruoyi.web.controller.system; + +import java.util.ArrayList; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.annotation.RepeatSubmit; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.service.ISysDictDataService; +import com.ruoyi.system.service.ISysDictTypeService; + +/** + * 数据字典信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/dict/data") +public class SysDictDataController extends BaseController +{ + @Autowired + private ISysDictDataService dictDataService; + + @Autowired + private ISysDictTypeService dictTypeService; + + @PreAuthorize("@ss.hasPermi('system:dict:list')") + @GetMapping("/list") + public TableDataInfo list(SysDictData dictData) + { + startPage(); + List list = dictDataService.selectDictDataList(dictData); + return getDataTable(list); + } + + @Log(title = "字典数据", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:dict:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysDictData dictData) + { + List list = dictDataService.selectDictDataList(dictData); + ExcelUtil util = new ExcelUtil(SysDictData.class); + util.exportExcel(response, list, "字典数据"); + } + + /** + * 查询字典数据详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictCode}") + public AjaxResult getInfo(@PathVariable Long dictCode) + { + return success(dictDataService.selectDictDataById(dictCode)); + } + + /** + * 根据字典类型查询字典数据信息 + */ + @GetMapping(value = "/type/{dictType}") + @RepeatSubmit(enable = false,interval = 1000) + public AjaxResult dictType(@PathVariable String dictType) + { + List data = dictTypeService.selectDictDataByType(dictType); + if (StringUtils.isNull(data)) + { + data = new ArrayList(); + } + return success(data); + } + + /** + * 新增字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:add')") + @Log(title = "字典数据", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDictData dict) + { + dict.setCreateBy(getUsername()); + return toAjax(dictDataService.insertDictData(dict)); + } + + /** + * 修改保存字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:edit')") + @Log(title = "字典数据", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDictData dict) + { + dict.setUpdateBy(getUsername()); + return toAjax(dictDataService.updateDictData(dict)); + } + + /** + * 删除字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{dictCodes}") + public AjaxResult remove(@PathVariable Long[] dictCodes) + { + dictDataService.deleteDictDataByIds(dictCodes); + return success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java new file mode 100644 index 0000000000000000000000000000000000000000..d5ead57beec00498644671b77ef7ff0745c8f899 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -0,0 +1,132 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictType; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.service.ISysDictTypeService; + +/** + * 数据字典信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/dict/type") +public class SysDictTypeController extends BaseController +{ + @Autowired + private ISysDictTypeService dictTypeService; + + @PreAuthorize("@ss.hasPermi('system:dict:list')") + @GetMapping("/list") + public TableDataInfo list(SysDictType dictType) + { + startPage(); + List list = dictTypeService.selectDictTypeList(dictType); + return getDataTable(list); + } + + @Log(title = "字典类型", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:dict:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysDictType dictType) + { + List list = dictTypeService.selectDictTypeList(dictType); + ExcelUtil util = new ExcelUtil(SysDictType.class); + util.exportExcel(response, list, "字典类型"); + } + + /** + * 查询字典类型详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictId}") + public AjaxResult getInfo(@PathVariable Long dictId) + { + return success(dictTypeService.selectDictTypeById(dictId)); + } + + /** + * 新增字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:add')") + @Log(title = "字典类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDictType dict) + { + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) + { + return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setCreateBy(getUsername()); + return toAjax(dictTypeService.insertDictType(dict)); + } + + /** + * 修改字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:edit')") + @Log(title = "字典类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDictType dict) + { + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) + { + return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setUpdateBy(getUsername()); + return toAjax(dictTypeService.updateDictType(dict)); + } + + /** + * 删除字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{dictIds}") + public AjaxResult remove(@PathVariable Long[] dictIds) + { + dictTypeService.deleteDictTypeByIds(dictIds); + return success(); + } + + /** + * 刷新字典缓存 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.CLEAN) + @DeleteMapping("/refreshCache") + public AjaxResult refreshCache() + { + dictTypeService.resetDictCache(); + return success(); + } + + /** + * 获取字典选择框列表 + */ + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + List dictTypes = dictTypeService.selectDictTypeAll(); + return success(dictTypes); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java new file mode 100644 index 0000000000000000000000000000000000000000..13007eb18d2bbead6ca4f77fd8d6fd329fce5df3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java @@ -0,0 +1,29 @@ +package com.ruoyi.web.controller.system; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.utils.StringUtils; + +/** + * 首页 + * + * @author ruoyi + */ +@RestController +public class SysIndexController +{ + /** 系统基础配置 */ + @Autowired + private RuoYiConfig ruoyiConfig; + + /** + * 访问首页,提示语 + */ + @RequestMapping("/") + public String index() + { + return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java new file mode 100644 index 0000000000000000000000000000000000000000..b50c2b2b9bd16a72f76a40afd14bf07df01f455d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -0,0 +1,226 @@ +package com.ruoyi.web.controller.system; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RateLimiter; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysMenu; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginBody; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.enums.LimitType; +import com.ruoyi.common.enums.OperatorType; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.common.constant.CacheConstants; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.framework.web.service.SysLoginService; +import com.ruoyi.framework.web.service.SysPermissionService; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.domain.vo.SysUserInfoVo; +import com.ruoyi.system.service.ISysMenuService; +import com.ruoyi.system.service.ISysUserService; +import io.jsonwebtoken.Claims; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +/** + * 登录验证 + * + * @author ruoyi + */ +@RestController +public class SysLoginController +{ + @Autowired + private SysLoginService loginService; + + @Autowired + private ISysMenuService menuService; + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private YwSceneService ywSceneService; + + @Autowired + private ISysUserService userService; + + @Autowired + private TokenService tokenService; + + @Autowired + private RedisCache redisCache; + + @Autowired + private CommonService commonService; + + + private String key = com.ruoyi.common.constant.CacheConstants.ZXP_TOKEN; + + + /** + * 发送登录短信验证码 + * + * @param + * @return + */ + @PostMapping("/getLoginCode") + @ApiOperation(value = "发送登录短信验证码") + @RateLimiter(time = 3,count = 1,limitType= LimitType.IP) + @RepeatSubmit(interval = 60000,message = "1分钟内请勿重复提交") + @Log(title = "发送登录短信验证码日志", businessType = BusinessType.OTHER,operatorType= OperatorType.MANAGE) + public AjaxResult getCode(@RequestBody LoginBody loginBody) throws Exception { + return loginService.getCode(loginBody); + } + + /** + * 登录方法 + * + * @param loginBody 登录信息 + * @return 结果 + */ + @PostMapping("/login") + @RateLimiter(time = 3,count = 1,limitType= LimitType.IP) + @Log(title = "发送登录日志", businessType = BusinessType.OTHER,operatorType= OperatorType.MANAGE) + public AjaxResult login(@RequestBody LoginBody loginBody) + { + AjaxResult ajax = AjaxResult.success(); + + String token =""; + + // 生成令牌 + if("1".equals(loginBody.getLoginType())) + { + token = loginService.loginByPhone(loginBody.getPhone(),loginBody.getCode(), + loginBody.getUuid(), UserConstants.PC); + } + else + { + token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), + loginBody.getUuid()); + } + + ajax.put(Constants.TOKEN, token); + + + return ajax; + } + + + + /** + * 自动登录方法 + * + */ + @GetMapping("/autoLogin") + public AjaxResult autoLogin() + { + String token = redisCache.getCacheObject(key); + + if (ObjectUtils.isEmpty(token)) { + SysUser user = userService.selectUserByUserName("bigscreen"); + LoginUser loginUser = new LoginUser(); + loginUser.setUserId(user.getUserId()); + loginUser.setUser(user); +// token = commonService.getToken("bigscreen", "Supp0rt.zjnmc"); + token = tokenService.createToken(loginUser); + //不过期 + redisCache.setCacheObject(key, token); + return AjaxResult.success("获取成功", token); + } + + if (StringUtils.isNotEmpty(token)) { + try { + if (tokenService.isLogin(token)) { + return AjaxResult.success("获取成功", token); + } + else + { + SysUser user = userService.selectUserByUserName("bigscreen"); + LoginUser loginUser = new LoginUser(); + loginUser.setUserId(user.getUserId()); + loginUser.setUser(user); + //不过期 + token = tokenService.createToken(loginUser); + redisCache.setCacheObject(key, token); + return AjaxResult.success("获取成功", token); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + return AjaxResult.error("获取失败"); + } + + /** + * 获取用户信息 + * + * @return 用户信息 + */ + @GetMapping("getInfo") + @RepeatSubmit(enable = false,interval = 1000) + public AjaxResult getInfo() + { + SysUser user = SecurityUtils.getLoginUser().getUser(); + // 角色集合 + Set roles = permissionService.getRolePermission(user); + // 权限集合 + Set permissions = permissionService.getMenuPermission(user); + + SysUserInfoVo userInfo = userService.getUserInfo(user.getUserName()); + + List last_search_venues = new ArrayList(); + + if(redisCache.hasKey(CacheConstants.YW_ALARM_LAST_VENUES + user.getUserId())) { + last_search_venues = redisCache.getCacheObject(CacheConstants.YW_ALARM_LAST_VENUES + user.getUserId()); + } + + AjaxResult ajax = AjaxResult.success(); + ajax.put("user", user); + ajax.put("roles", roles); + ajax.put("permissions", permissions); + //20230116新增获取获取用户的场馆 + List lstScene =ywSceneService.getVenueByUserCanNoData(user,false); + ajax.put("venues",lstScene); + ajax.put("searchvenues", last_search_venues); + ajax.put("userInfo", userInfo); + return ajax; + } + + /** + * 获取路由信息 + * + * @return 路由信息 + */ + @GetMapping("getRouters") + public AjaxResult getRouters() + { + Long userId = SecurityUtils.getUserId(); + List menus = menuService.selectMenuTreeByUserId(userId); + return AjaxResult.success(menuService.buildMenus(menus)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java new file mode 100644 index 0000000000000000000000000000000000000000..4e5c06467c96affdedbaaa0345daf2949d63c995 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -0,0 +1,142 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysMenu; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysMenuService; + +/** + * 菜单信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/menu") +public class SysMenuController extends BaseController +{ + @Autowired + private ISysMenuService menuService; + + /** + * 获取菜单列表 + */ + @PreAuthorize("@ss.hasPermi('system:menu:list')") + @GetMapping("/list") + public AjaxResult list(SysMenu menu) + { + List menus = menuService.selectMenuList(menu, getUserId()); + return success(menus); + } + + /** + * 根据菜单编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:menu:query')") + @GetMapping(value = "/{menuId}") + public AjaxResult getInfo(@PathVariable Long menuId) + { + return success(menuService.selectMenuById(menuId)); + } + + /** + * 获取菜单下拉树列表 + */ + @GetMapping("/treeselect") + public AjaxResult treeselect(SysMenu menu) + { + List menus = menuService.selectMenuList(menu, getUserId()); + return success(menuService.buildMenuTreeSelect(menus)); + } + + /** + * 加载对应角色菜单列表树 + */ + @GetMapping(value = "/roleMenuTreeselect/{roleId}/{menuCheckStrictly}") + public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId,@PathVariable("menuCheckStrictly") Boolean menuCheckStrictly) + { + List menus = menuService.selectMenuList(getUserId()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId,menuCheckStrictly)); + ajax.put("menus", menuService.buildMenuTreeSelect(menus)); + return ajax; + } + + /** + * 新增菜单 + */ + @PreAuthorize("@ss.hasPermi('system:menu:add')") + @Log(title = "菜单管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysMenu menu) + { + if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) + { + return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) + { + return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + menu.setCreateBy(getUsername()); + return toAjax(menuService.insertMenu(menu)); + } + + /** + * 修改菜单 + */ + @PreAuthorize("@ss.hasPermi('system:menu:edit')") + @Log(title = "菜单管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysMenu menu) + { + if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) + { + return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) + { + return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + else if (menu.getMenuId().equals(menu.getParentId())) + { + return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); + } + menu.setUpdateBy(getUsername()); + return toAjax(menuService.updateMenu(menu)); + } + + /** + * 删除菜单 + */ + @PreAuthorize("@ss.hasPermi('system:menu:remove')") + @Log(title = "菜单管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{menuId}") + public AjaxResult remove(@PathVariable("menuId") Long menuId) + { + if (menuService.hasChildByMenuId(menuId)) + { + return warn("存在子菜单,不允许删除"); + } + if (menuService.checkMenuExistRole(menuId)) + { + return warn("菜单已分配,不允许删除"); + } + return toAjax(menuService.deleteMenuById(menuId)); + } +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java new file mode 100644 index 0000000000000000000000000000000000000000..48c7b503a35aa604f2dcbb275a5dfc2a9c6c862b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -0,0 +1,140 @@ +package com.ruoyi.web.controller.system; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.domain.dto.SysNoticeDTO; +import com.ruoyi.eastcom_yw.domain.qo.SysNoticeQO; +import com.ruoyi.eastcom_yw.domain.vo.SysNoticeVO; +import com.ruoyi.eastcom_yw.service.SysNoticeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * 通知公告表 前端控制器 + *

+ * + * @author ck + * @since 2023-04-14 + */ +@Api(tags = "通知公告表") +@RestController +@RequestMapping("/eastcom_yw/sysNotice") +@Slf4j +@RequiredArgsConstructor +public class SysNoticeController extends BaseController { + + private final SysNoticeService sysNoticeService; + + /** + * 通知公告表列表 + */ + @ApiOperation(value = "通知公告表列表", notes = "通知公告表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody SysNoticeQO qo) { + List list = sysNoticeService.getData(qo); + return getDataTable(list); + } + + + /** + * 通知公告表分页列表 + */ + @ApiOperation(value = "通知公告表分页列表", notes = "通知公告表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody SysNoticeQO qo) { + IPage page = sysNoticeService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 获取通知公告表详情 + */ + @ApiOperation(value = "通知公告表详情", notes = "通知公告表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(sysNoticeService.fetchById(id)); + } + + /** + * 新增或修改通知公告表 + */ + @Log(title = "新增或修改通知公告表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改通知公告表", notes = "新增或修改通知公告表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated SysNoticeDTO dto) { + sysNoticeService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除通知公告表 + */ + @Log(title = "根据id删除通知公告表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除通知公告表", notes = "根据id删除通知公告表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + sysNoticeService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除通知公告表 + */ + @Log(title = "根据id批量删除通知公告表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除通知公告表", notes = "根据id批量删除通知公告表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + sysNoticeService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "通知公告表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(SysNotice.class); + List list = util.importExcel(file.getInputStream()); + sysNoticeService.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * 通知公告表导出 + */ + @ApiOperation(value = "通知公告表导出") + @PostMapping(value = "/export") + public void export(@RequestBody SysNoticeQO qo) { + sysNoticeService.export(qo); + } + + @GetMapping("/listByUser/{reciveUserId}") + public TableDataInfo listByUser(@PathVariable("reciveUserId") Long reciveUserId) + { + List list = sysNoticeService.selectNoticeListByUser(reciveUserId); + return getDataTable(list); + } + + /** + * 立刻发送手工通知简报 + */ + @ApiOperation(value = "立刻发送手工通知简报") + @PostMapping(value = "/saveAndSendBriefing") + public AjaxResult saveAndSendBriefing(@RequestBody @Validated SysNoticeDTO dto) { + sysNoticeService.saveAndSendBriefing(dto); + return AjaxResult.success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java new file mode 100644 index 0000000000000000000000000000000000000000..12235241b485eaf9dd21dad5b3449afea3217e6a --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java @@ -0,0 +1,130 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.SysPost; +import com.ruoyi.system.service.ISysPostService; + +/** + * 岗位信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/post") +public class SysPostController extends BaseController +{ + @Autowired + private ISysPostService postService; + + /** + * 获取岗位列表 + */ + @PreAuthorize("@ss.hasPermi('system:post:list')") + @GetMapping("/list") + public TableDataInfo list(SysPost post) + { + startPage(); + List list = postService.selectPostList(post); + return getDataTable(list); + } + + @Log(title = "岗位管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:post:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysPost post) + { + List list = postService.selectPostList(post); + ExcelUtil util = new ExcelUtil(SysPost.class); + util.exportExcel(response, list, "岗位数据"); + } + + /** + * 根据岗位编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:post:query')") + @GetMapping(value = "/{postId}") + public AjaxResult getInfo(@PathVariable Long postId) + { + return success(postService.selectPostById(postId)); + } + + /** + * 新增岗位 + */ + @PreAuthorize("@ss.hasPermi('system:post:add')") + @Log(title = "岗位管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysPost post) + { + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) + { + return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setCreateBy(getUsername()); + return toAjax(postService.insertPost(post)); + } + + /** + * 修改岗位 + */ + @PreAuthorize("@ss.hasPermi('system:post:edit')") + @Log(title = "岗位管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysPost post) + { + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) + { + return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setUpdateBy(getUsername()); + return toAjax(postService.updatePost(post)); + } + + /** + * 删除岗位 + */ + @PreAuthorize("@ss.hasPermi('system:post:remove')") + @Log(title = "岗位管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{postIds}") + public AjaxResult remove(@PathVariable Long[] postIds) + { + return toAjax(postService.deletePostByIds(postIds)); + } + + /** + * 获取岗位选择框列表 + */ + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + List posts = postService.selectPostAll(); + return success(posts); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java new file mode 100644 index 0000000000000000000000000000000000000000..ae7259f65f55fc64a202f46060a0732901fd4c76 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -0,0 +1,183 @@ +package com.ruoyi.web.controller.system; + +import com.ruoyi.common.config.MinioConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +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.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.MimeTypeUtils; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.service.ISysUserService; + +/** + * 个人信息 业务处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/user/profile") +public class SysProfileController extends BaseController +{ + @Autowired + private ISysUserService userService; + + @Autowired + private TokenService tokenService; + + /** + * 个人信息 + */ + @GetMapping + public AjaxResult profile() + { + LoginUser loginUser = getLoginUser(); + SysUser user = loginUser.getUser(); + AjaxResult ajax = AjaxResult.success(user); + ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); + ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); + return ajax; + } + + /** + * 修改用户 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult updateProfile(@RequestBody SysUser user) + { + LoginUser loginUser = getLoginUser(); + SysUser sysUser = loginUser.getUser(); +// //20230327 防止越权修改账号的姓名,手机号码,需要验证修改的用户是否当前用户 +// if(!user.getPhonenumber().equals(sysUser.getPhonenumber())) +// { +// return error("只能修改当前登录用户的用户信息"); +// } + //用户名和手机号码不允许改 + user.setUserName(null); + user.setPhonenumber(null); + user.setNickName(null); + user.setUserType(null); + user.setEmail(null); + user.setSex(null); + user.setStatus(null); + user.setLoginIp(null); + user.setLoginDate(null); + user.setCreateBy(null); + user.setRemark(null); + user.setCity(null); + user.setCounty(null); + user.setDistinctArea(null); +// if (StringUtils.isNotEmpty(user.getPhonenumber()) +// && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) +// { +// return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); +// } +// if (StringUtils.isNotEmpty(user.getEmail()) +// && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) +// { +// return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); +// } + user.setUserId(sysUser.getUserId()); + user.setPassword(null); + user.setDeptId(null); + if (userService.updateUserProfile(user) > 0) + { + sysUser.setFirstPage(user.getFirstPage()); + tokenService.setLoginUser(loginUser); + return success(); + } + return error("修改个人信息异常,请联系管理员"); + } + + /** + * 重置密码 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PutMapping("/updatePwd") + public AjaxResult updatePwd(String oldPassword, String newPassword) + { + LoginUser loginUser = getLoginUser(); + String userName = loginUser.getUsername(); + String password = loginUser.getPassword(); + if (!SecurityUtils.matchesPassword(oldPassword, password)) + { + return error("修改密码失败,旧密码错误"); + } + if (SecurityUtils.matchesPassword(newPassword, password)) + { + return error("新密码不能与旧密码相同"); + } + if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) + { + // 更新缓存用户密码 + loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); + tokenService.setLoginUser(loginUser); + return success(); + } + return error("修改密码异常,请联系管理员"); + } + + /** + * 头像上传 + */ + @Log(title = "用户头像", businessType = BusinessType.UPDATE) + @PostMapping("/avatar") + public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception + { + if (!file.isEmpty()) + { + LoginUser loginUser = getLoginUser(); + String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); + if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) + { + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", avatar); + // 更新缓存用户头像 + loginUser.getUser().setAvatar(avatar); + tokenService.setLoginUser(loginUser); + return ajax; + } + } + return error("上传图片异常,请联系管理员"); + } + + @Log(title = "用户头像", businessType = BusinessType.UPDATE) + @PostMapping("/avatarMinio") + public AjaxResult avatarMinio(@RequestParam("avatarfile") MultipartFile file) throws Exception + { + if (!file.isEmpty()) + { + LoginUser loginUser = getLoginUser(); + String avatar = FileUploadUtils.uploadMinio("avatar", file, MimeTypeUtils.IMAGE_EXTENSION); + avatar = avatar.replace(MinioConfig.getUrl(),"/profile/"); + if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) + { + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", avatar); + // 更新缓存用户头像 + loginUser.getUser().setAvatar(avatar); + tokenService.setLoginUser(loginUser); + return ajax; + } + } + return error("上传图片异常,请联系管理员"); + } + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java new file mode 100644 index 0000000000000000000000000000000000000000..fe192492f28d534380a59f2faca35835b7b0aca9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java @@ -0,0 +1,38 @@ +package com.ruoyi.web.controller.system; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.RegisterBody; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.web.service.SysRegisterService; +import com.ruoyi.system.service.ISysConfigService; + +/** + * 注册验证 + * + * @author ruoyi + */ +@RestController +public class SysRegisterController extends BaseController +{ + @Autowired + private SysRegisterService registerService; + + @Autowired + private ISysConfigService configService; + + @PostMapping("/register") + public AjaxResult register(@RequestBody RegisterBody user) + { + if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) + { + return error("当前系统没有开启注册功能!"); + } + String msg = registerService.register(user); + return StringUtils.isEmpty(msg) ? success() : error(msg); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java new file mode 100644 index 0000000000000000000000000000000000000000..2d37d8fe3ec1abe3fb2922d824f59c784eb106c3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -0,0 +1,282 @@ +package com.ruoyi.web.controller.system; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +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.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.service.SysPermissionService; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.service.ISysDeptService; +import com.ruoyi.system.service.ISysMenuService; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.system.service.ISysUserService; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 角色信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/role") +public class SysRoleController extends BaseController +{ + @Autowired + private ISysRoleService roleService; + + @Autowired + private TokenService tokenService; + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private ISysUserService userService; + + @Autowired + private ISysDeptService deptService; + + @Autowired + private ISysMenuService menuService; + +// @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/list") + public TableDataInfo list(SysRole role) + { + startPage(); + List list = roleService.selectRoleList(role); + return getDataTable(list); + } + + @Log(title = "角色管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:role:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysRole role) + { + List list = roleService.selectRoleList(role); + + list.forEach( + role1 -> + { + List menus = menuService.selectMenuNameListByRoleId(role1.getRoleId()); + role1.setStrMenuNames(StringUtils.join(menus,",")); + } + ); + + ExcelUtil util = new ExcelUtil(SysRole.class); + util.exportExcel(response, list, "角色数据"); + } + + /** + * 根据角色编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping(value = "/{roleId}") + public AjaxResult getInfo(@PathVariable Long roleId) + { + roleService.checkRoleDataScope(roleId); + return success(roleService.selectRoleById(roleId)); + } + + /** + * 新增角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:add')") + @Log(title = "角色管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysRole role) + { + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) + { + return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setCreateBy(getUsername()); + return toAjax(roleService.insertRole(role)); + + } + + /** + * 修改保存角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping + @Transactional + public AjaxResult edit(@Validated @RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) + { + return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + + role.setUpdateBy(getUsername()); + //删除所有用户,再重新绑定 + roleService.deleteAuthUsers(role.getRoleId(), null); + if(ObjectUtils.isNotEmpty(role.getUserIds())) { + if (role.getUserIds().length > 0) { + roleService.insertAuthUsers(role.getRoleId(), role.getUserIds()); + } + } + + if (roleService.updateRole(role) > 0) + { + // 更新缓存用户权限 + LoginUser loginUser = getLoginUser(); + if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) + { + loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); + loginUser.setAppPermissions(permissionService.getAppMenuPermission(loginUser.getUser())); + loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); + tokenService.setLoginUser(loginUser); + } + return success(); + } + return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); + } + + /** + * 修改保存数据权限 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping("/dataScope") + public AjaxResult dataScope(@RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + return toAjax(roleService.authDataScope(role)); + } + + /** + * 状态修改 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + role.setUpdateBy(getUsername()); + return toAjax(roleService.updateRoleStatus(role)); + } + + /** + * 删除角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:remove')") + @Log(title = "角色管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{roleIds}") + public AjaxResult remove(@PathVariable Long[] roleIds) + { + return toAjax(roleService.deleteRoleByIds(roleIds)); + } + + /** + * 获取角色选择框列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + return success(roleService.selectRoleAll()); + } + + /** + * 查询已分配用户角色列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/authUser/allocatedList") + public TableDataInfo allocatedList(SysUser user) + { + startPage(); + List list = userService.selectAllocatedList(user); + return getDataTable(list); + } + + /** + * 查询未分配用户角色列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/authUser/unallocatedList") + public TableDataInfo unallocatedList(SysUser user) + { + startPage(); + List list = userService.selectUnallocatedList(user); + return getDataTable(list); + } + + /** + * 取消授权用户 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/cancel") + public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) + { + return toAjax(roleService.deleteAuthUser(userRole)); + } + + /** + * 批量取消授权用户 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/cancelAll") + public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) + { + return toAjax(roleService.deleteAuthUsers(roleId, userIds)); + } + + /** + * 批量选择用户授权 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/selectAll") + public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) + { + roleService.checkRoleDataScope(roleId); + return toAjax(roleService.insertAuthUsers(roleId, userIds)); + } + + /** + * 获取对应角色部门树列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping(value = "/deptTree/{roleId}") + public AjaxResult deptTree(@PathVariable("roleId") Long roleId) + { + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); + ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); + return ajax; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java new file mode 100644 index 0000000000000000000000000000000000000000..5eed51943e6e4e27a1c3745cc4d38ce3fa78ef83 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -0,0 +1,542 @@ +package com.ruoyi.web.controller.system; + +import cn.hutool.core.util.StrUtil; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.*; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.YwSceneUserService; +import com.ruoyi.framework.web.service.SysPermissionService; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.*; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 用户信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/user") +@Transactional +public class SysUserController extends BaseController { + @Autowired + private ISysUserService userService; + + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysDeptService deptService; + + @Autowired + private ISysPostService postService; + + @Autowired + private YwSceneUserService ywSceneUserService; + + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private TokenService tokenService; + + @Autowired + private RedisCache redisCache; + + @Autowired + private RedisTemplate redisTemplate; + + @Autowired + private ISysDictDataService dictDataService; + + @Autowired + private YwSceneService ywSceneService; + + @Autowired + private SysUserMapper sysUserMapper; + + + /** + * 获取用户列表 + */ +// @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/list") + public TableDataInfo list(SysUser user) { + startPage(); + List list = userService.selectUserList(user); + + if(list.size()>0) + { + + List lstUserId = list.stream().map(SysUser::getUserId).collect(Collectors.toList()); + + // List listScene = ywSceneUserService.getVenuesByUserIds(lstUserId); + + List listRole = roleService.selectRolesByUserIds(lstUserId); + + for(SysUser sysUser:list) { + + if(StringUtils.isNotEmpty(sysUser.getUserVenueId())) + { + String[] arrNames = sysUser.getUserVenue().split(","); + + Long[] arr_ids = ArrayUtils.toObject(Arrays.stream(sysUser.getUserVenueId().split(",")).mapToLong(a->Long.parseLong(a)).toArray()); + + List venueNames = new ArrayList<>(); + for(String venueName : arrNames) + { + venueNames.add(venueName); + } + + sysUser.setVenueNames(venueNames); + sysUser.setVenueIds(arr_ids); + } + +// List lstSceneId = listScene.stream().filter(r -> r.getUserId().equals(sysUser.getUserId())).map(YwSceneUser::getSceneId).collect(Collectors.toList()); +// int userSceneNum = lstSceneId.size(); +// if(userSceneNum>0) +// { +// Long[] arr_ids = new Long[userSceneNum]; +// lstSceneId.toArray(arr_ids); +// List venueNames = listScene.stream().filter(r -> r.getUserId().equals(sysUser.getUserId())).map(YwSceneUser::getVenueName).collect(Collectors.toList()); +//// String[] arrNames = new String[venueNames.size()]; +// sysUser.setVenueIds(arr_ids); +// sysUser.setVenueNames(venueNames); +// } + else + { + sysUser.setVenueIds(new Long[0]); + sysUser.setVenueNames(new ArrayList()); + } + + List roleNames = listRole.stream().filter(r -> r.getUserId().equals(sysUser.getUserId())).map(SysUserRole::getRoleName).collect(Collectors.toList()); + if(roleNames.size()>0) { +// String[] arrRoleNames = new String[roleNames.size()]; + sysUser.setRoleNames(roleNames); + } + else + { + sysUser.setRoleNames(new ArrayList()); + } + if (StringUtils.isNotEmpty(sysUser.getBelongArea())) { + sysUser.setBelongArea(DictUtils.getDictLabel("yw_belong_area", sysUser.getBelongArea())); + } + + } + } + + return getDataTable(list); + } + + @PostMapping("/listAll") + public TableDataInfo listALL(@RequestBody SysUser user) { + List list = userService.selectUserListALL(user); + return getDataTable(list); + } + + + @GetMapping("/specList") + public AjaxResult specList(SysUser user) { + HashMap> map = userService.selectUserSpecList(user); + return success(map); + } + + + @Log(title = "用户管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:user:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysUser user) { + List list = userService.selectUserList(user); + + list.forEach( + sysUser -> { + List listScene = ywSceneUserService.getVenuesByUserId(sysUser.getUserId()); + List venueNames = new ArrayList<>(); + List venueBelong = new ArrayList<>(); + listScene.forEach( + ywSceneUserVo -> { + venueNames.add(ywSceneUserVo.getVenueName()); + if (StringUtils.isNotEmpty(ywSceneUserVo.getBelongArea())) { + String label = DictUtils.getDictLabel("yw_belong_area", ywSceneUserVo.getBelongArea()); + venueBelong.add(label); + } + } + ); + sysUser.setStrVenueNames(StringUtils.join(venueNames, ",")); + sysUser.setStrBelongArea(StringUtils.join(venueBelong, ",")); + List listRole = roleService.selectRolesByUserId2(sysUser.getUserId()); + List roleNames = new ArrayList<>(); + listRole.forEach( + role -> { + roleNames.add(role.getRoleName()); + } + ); + //设置角色 + sysUser.setStrRoles(StringUtils.join(roleNames, ",")); + + if (StringUtils.isNotEmpty(sysUser.getUserType())) { + //设置用户专业 + String label = DictUtils.getDictLabel("yw_specialty", sysUser.getUserType()); + sysUser.setUserType(label); + } + + //对city和county进行转中文 + if (StringUtils.isNotEmpty(sysUser.getCity())) { + String label = DictUtils.getDictLabel("yw_city", sysUser.getCity()); + sysUser.setCity(label); + } + if (StringUtils.isNotEmpty(sysUser.getCounty())) { + String label = DictUtils.getDictLabel("yw_county", sysUser.getCounty()); + sysUser.setCounty(label); + } + //场馆分区转 + if (StringUtils.isNotEmpty(sysUser.getDistinctArea())) { + String label = DictUtils.getDictLabel("yw_belong_area", sysUser.getDistinctArea()); + sysUser.setDistinctArea(label); + } + //所属公司转 + if (StringUtils.isNotEmpty(sysUser.getYwUserBelong())) { + String label = DictUtils.getDictLabel("yw_user_belong", sysUser.getYwUserBelong()); + sysUser.setYwUserBelong(label); + } + + } + ); + + ExcelUtil util = new ExcelUtil(SysUser.class); + util.exportExcel(response, list, "用户数据"); + } + + @Log(title = "用户管理", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('system:user:import')") + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil(SysUser.class); + List userList = util.importExcel(file.getInputStream()); + String operName = getUsername(); + String message = userService.importUser(userList, updateSupport, operName); + return success(message); + } + + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) { + ExcelUtil util = new ExcelUtil(SysUser.class); + util.importTemplateExcel(response, "用户数据"); + } + + /** + * 根据用户编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping(value = {"/", "/{userId}"}) + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { + userService.checkUserDataScope(userId); + AjaxResult ajax = AjaxResult.success(); + List roles = roleService.selectRoleAll(); + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); + ajax.put("posts", postService.selectPostAll()); + if (StringUtils.isNotNull(userId)) { + SysUser sysUser = userService.selectUserById(userId); + ajax.put(AjaxResult.DATA_TAG, sysUser); + ajax.put("postIds", postService.selectPostListByUserId(userId)); + ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); + } + return ajax; + } + + /** + * 新增用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:add')") + @Log(title = "用户管理", businessType = BusinessType.INSERT) + @PostMapping + @Transactional + public AjaxResult add(@Validated @RequestBody SysUser user) { + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { + return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); + } else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { + return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setCreateBy(getUsername()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + + //假定是可以看到所有场馆的角色,那么就不需要设置区县 +// if(user.isAdmin()) +// { +// user.setCounty(""); +// } + + int num = userService.insertUser(user); + //新增用户的场馆 + //20230303更新用户的场馆Ids + if (num > 0) { + if (ObjectUtils.isNotEmpty(user.getVenueIds())) { + if (user.getVenueIds().length > 0) { + for (Long venueId : user.getVenueIds()) { + YwSceneUser ywSceneUser = new YwSceneUser(); + //由于没有返回用户的ID,所有这边需要去查询一次 + SysUser thisUser = userService.selectUserByPhone(user.getPhonenumber()); + List userIds = new ArrayList<>(); + userIds.add(thisUser.getUserId()); + ywSceneUser.setUserIds(userIds); + ywSceneUser.setSceneId(venueId); + //设置默认值,需签到,红区 + ywSceneUser.setNeedSign("1"); + //20230330 jkj 如果用户有设置区域,就用这个区域作为默认值,否则的话就用红区做默认值 + if (StringUtils.isNotEmpty(user.getDistinctArea())) { + ywSceneUser.setBelongArea(user.getDistinctArea()); + } + if (StringUtils.isEmpty(user.getDistinctArea())) { + ywSceneUser.setBelongArea("red"); + } + ywSceneUserService.create(ywSceneUser); + } + } + } + } + return toAjax(num); + } + + /** + * 修改用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping + @Transactional + public AjaxResult edit(@Validated @RequestBody SysUser user) { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { + return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { + return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setUpdateBy(getUsername()); + + //20230303更新用户的场馆Ids + //删除之前的场馆,重新绑定新的 + ywSceneUserService.delete(user.getUserId()); + if (ObjectUtils.isNotEmpty(user.getVenueIds())) { + for (Long venueId : user.getVenueIds()) { + YwSceneUser ywSceneUser = new YwSceneUser(); + ywSceneUser.setUserId(user.getUserId()); + ywSceneUser.setSceneId(venueId); + //设置默认值,需签到,红区 + ywSceneUser.setNeedSign("1"); + //20230330 jkj 如果用户有设置区域,就用这个区域作为默认值,否则的话就用红区做默认值 + if (StringUtils.isNotEmpty(user.getDistinctArea())) { + ywSceneUser.setBelongArea(user.getDistinctArea()); + } + if (StringUtils.isEmpty(user.getDistinctArea())) { + ywSceneUser.setBelongArea("red"); + } + ywSceneUserService.save(ywSceneUser); + } + } + int res = userService.updateUser(user); + if (res > 0) { + //删除用户短信验证码错误的次数的缓存 + if (UserStatus.OK.getCode().equals(user.getStatus())) { + String key = CacheConstants.SMS_ERR_CNT_KEY + user.getPhonenumber(); + if (redisCache.hasKey(key)) { + redisCache.deleteObject(key); + } + } + + //删除处理用户登录的缓存 + //客户反映不够人性化 + //更新用户的缓存 + Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); + for (String key : keys) { + LoginUser redisUser = redisCache.getCacheObject(key); + if(ObjectUtils.isNotEmpty(redisUser.getUserId())) { + if (redisUser.getUserId().equals(user.getUserId())) { + + if(!redisUser.getUser().getPhonenumber().equals(user.getPhonenumber())) + { + //说明更换了手机号码,踢掉用户 + redisCache.deleteObject(key); + continue; + } + SysUser updateUser = userService.selectUserByUserName(user.getPhonenumber()); + redisUser.setVenueIds(updateUser.getVenueIds()); + redisUser.setPermissions(permissionService.getMenuPermission(updateUser)); + redisUser.setAppPermissions(permissionService.getAppMenuPermission(updateUser)); + redisUser.setUser(updateUser); + //删除冻结账号的缓存 + if (UserStatus.SLEEP.getCode().equals(updateUser.getStatus())) { + redisCache.deleteObject(key); + } else { + tokenService.refreshToken(redisUser); + } + } + } + } + +// +// for (String key : keys) { +// LoginUser redisUser = redisCache.getCacheObject(key); +// //找到登录用户 +// if (redisUser.getUserId().equals(user.getUserId())) { +// redisCache.deleteObject(key); +// } +// } + + } + return toAjax(res); + } + + /** + * 删除用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:remove')") + @Log(title = "用户管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{userIds}") + public AjaxResult remove(@PathVariable Long[] userIds) { + //判断当前用户有没有进行中的物资审核任务 + List lstCheckUserId = sysUserMapper.selectCheckUserIdList(); + + for (Long checkUserId : lstCheckUserId) { + if (ArrayUtils.contains(userIds, checkUserId)) { +// return error("当前用户存在进行中的物资审核任务,请在任务完结或者驳回后重新选择其它审核人后再删除该用户"); + return error("当前用户存在进行中的物资审核任务"); + } + } + + if (ArrayUtils.contains(userIds, getUserId())) { + return error("当前用户不能删除"); + } + + return toAjax(userService.deleteUserByIds(userIds)); + } + + /** + * 重置密码 + */ + @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/resetPwd") + public AjaxResult resetPwd(@RequestBody SysUser user) { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + user.setUpdateBy(getUsername()); + return toAjax(userService.resetPwd(user)); + } + + /** + * 状态修改 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysUser user) { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + user.setUpdateBy(getUsername()); + return toAjax(userService.updateUserStatus(user)); + } + + /** + * 根据用户编号获取授权角色 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping("/authRole/{userId}") + public AjaxResult authRole(@PathVariable("userId") Long userId) { + AjaxResult ajax = AjaxResult.success(); + SysUser user = userService.selectUserById(userId); + List roles = roleService.selectRolesByUserId(userId); + ajax.put("user", user); + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); + return ajax; + } + + /** + * 用户授权角色 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.GRANT) + @PutMapping("/authRole") + public AjaxResult insertAuthRole(Long userId, Long[] roleIds) { + userService.checkUserDataScope(userId); + userService.insertUserAuth(userId, roleIds); + return success(); + } + + /** + * 获取部门树列表 + */ + @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/deptTree") + public AjaxResult deptTree(SysDept dept) { + return success(deptService.selectDeptTreeList(dept)); + } + + + /** + * 获取当前用户关联的场馆所在区县 + */ + @GetMapping("/getCounty") + public AjaxResult getCounty(String cityId) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (SecurityUtils.isAdmin(user.getUserId())) { + List countyList = dictDataService.selectDictLabelByValues("yw_county", null); + countyList = countyList.stream().filter(l -> cityId.equals(l.getDictValue().substring(0, 4))).collect(Collectors.toList()); + return success(countyList); + } + //场馆集合 + List ywScenes = ywSceneService.getVenueByUser(user); + //区县集合 + List countyIds = ywScenes.stream().map(YwScene::getAreaCountyId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); + List countyList = dictDataService.selectDictLabelByValues("yw_county", countyIds); + + if (StrUtil.isNotBlank(cityId)) { + countyList = countyList.stream().filter(l -> cityId.equals(l.getDictValue().substring(0, 4))).collect(Collectors.toList()); + } + return success(countyList); + } + + /** + * 根据专业查询专业下人数 + */ + @GetMapping("/selectUserByUserType") + public TableDataInfo selectUserByUserType() { + return getDataTable(userService.selectUserByUserType()); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java new file mode 100644 index 0000000000000000000000000000000000000000..b4f6bac74b7fe06d798b218b621cbba220138e42 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java @@ -0,0 +1,183 @@ +package com.ruoyi.web.controller.tool; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; + +/** + * swagger 用户测试方法 + * + * @author ruoyi + */ +@Api("用户信息管理") +@RestController +@RequestMapping("/test/user") +public class TestController extends BaseController +{ + private final static Map users = new LinkedHashMap(); + { + users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); + users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); + } + + @ApiOperation("获取用户列表") + @GetMapping("/list") + public R> userList() + { + List userList = new ArrayList(users.values()); + return R.ok(userList); + } + + @ApiOperation("获取用户详细") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) + @GetMapping("/{userId}") + public R getUser(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + return R.ok(users.get(userId)); + } + else + { + return R.fail("用户不存在"); + } + } + + @ApiOperation("新增用户") + @ApiImplicitParams({ + @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class), + @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class), + @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class), + @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class) + }) + @PostMapping("/save") + public R save(UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return R.fail("用户ID不能为空"); + } + users.put(user.getUserId(), user); + return R.ok(); + } + + @ApiOperation("更新用户") + @PutMapping("/update") + public R update(@RequestBody UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return R.fail("用户ID不能为空"); + } + if (users.isEmpty() || !users.containsKey(user.getUserId())) + { + return R.fail("用户不存在"); + } + users.remove(user.getUserId()); + users.put(user.getUserId(), user); + return R.ok(); + } + + @ApiOperation("删除用户信息") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) + @DeleteMapping("/{userId}") + public R delete(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + users.remove(userId); + return R.ok(); + } + else + { + return R.fail("用户不存在"); + } + } +} + +@ApiModel(value = "UserEntity", description = "用户实体") +class UserEntity +{ + @ApiModelProperty("用户ID") + private Integer userId; + + @ApiModelProperty("用户名称") + private String username; + + @ApiModelProperty("用户密码") + private String password; + + @ApiModelProperty("用户手机") + private String mobile; + + public UserEntity() + { + + } + + public UserEntity(Integer userId, String username, String password, String mobile) + { + this.userId = userId; + this.username = username; + this.password = password; + this.mobile = mobile; + } + + public Integer getUserId() + { + return userId; + } + + public void setUserId(Integer userId) + { + this.userId = userId; + } + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getMobile() + { + return mobile; + } + + public void setMobile(String mobile) + { + this.mobile = mobile; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..c93a378073e901b645c437a7a37e71fabfaff66c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -0,0 +1,127 @@ +package com.ruoyi.web.core.config; + +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.ruoyi.common.config.RuoYiConfig; +import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; +import org.springframework.context.annotation.Profile; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.service.AuthorizationScope; +import springfox.documentation.service.Contact; +import springfox.documentation.service.SecurityReference; +import springfox.documentation.service.SecurityScheme; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; + +/** + * Swagger2的接口配置 + * + * @author ruoyi + */ +@Configuration +@Profile("test") +public class SwaggerConfig +{ + /** 系统基础配置 */ + @Autowired + private RuoYiConfig ruoyiConfig; + + /** 是否开启swagger */ + @Value("${swagger.enabled}") + private boolean enabled; + + /** 设置请求的统一前缀 */ + @Value("${swagger.pathMapping}") + private String pathMapping; + + /** + * 创建API + */ + @Bean + public Docket createRestApi() + { + return new Docket(DocumentationType.OAS_30) + // 是否启用Swagger + .enable(enabled) + // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) + .apiInfo(apiInfo()) + // 设置哪些接口暴露给Swagger展示 + .select() + // 扫描所有有注解的api,用这种方式更灵活 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + // 扫描指定包中的swagger注解 + // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) + // 扫描所有 .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build() + /* 设置安全模式,swagger可以设置访问token */ + .securitySchemes(securitySchemes()) + .securityContexts(securityContexts()) + .pathMapping(pathMapping); + } + + /** + * 安全模式,这里指定token通过Authorization头请求头传递 + */ + private List securitySchemes() + { + List apiKeyList = new ArrayList(); + apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); + return apiKeyList; + } + + /** + * 安全上下文 + */ + private List securityContexts() + { + List securityContexts = new ArrayList<>(); + securityContexts.add( + SecurityContext.builder() + .securityReferences(defaultAuth()) + .operationSelector(o -> o.requestMappingPattern().matches("/.*")) + .build()); + return securityContexts; + } + + /** + * 默认的安全上引用 + */ + private List defaultAuth() + { + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + List securityReferences = new ArrayList<>(); + securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); + return securityReferences; + } + + /** + * 添加摘要信息 + */ + private ApiInfo apiInfo() + { + // 用ApiInfoBuilder进行定制 + return new ApiInfoBuilder() + // 设置标题 + .title("亚运中小屏幕_接口文档") + // 描述 + .description("亚运中小屏幕的接口文档") + // 作者信息 + .contact(new Contact(ruoyiConfig.getName(), null, null)) + // 版本 + .version("版本号:" + ruoyiConfig.getVersion()) + .build(); + } +} diff --git a/ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties b/ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties new file mode 100644 index 0000000000000000000000000000000000000000..2b23f85a3d4877a1d3e7aee610ce1c9cffdd159b --- /dev/null +++ b/ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties @@ -0,0 +1 @@ +restart.include.json=/com.alibaba.fastjson.*.jar \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-bak1.yml b/ruoyi-admin/src/main/resources/application-bak1.yml new file mode 100644 index 0000000000000000000000000000000000000000..8ceae45d4263f5dbb08f0f637a06be11115840c1 --- /dev/null +++ b/ruoyi-admin/src/main/resources/application-bak1.yml @@ -0,0 +1,154 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: /home/hzdx/data/java/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + # driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: + # url: jdbc:mysql://183.247.163.49:7940/ry_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:postgresql://10.71.80.241:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# url: jdbc:postgresql://127.0.0.1:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + # url: jdbc:postgresql://183.247.163.49:8099/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + username: pms + password: Ea$tcyd2023 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 + host: 10.71.80.241 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: YyunRedis@Zxp01 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms +#简报配置 +file: + #文件访问地址前缀 + visitpath: http://183.247.163.49:8093/profile/upload/ + #json本地保存路径 + briefingJsonPath: /home/hzdx/data/java/uploadPath/briefingJson + #json上传路径 + briefingShortUrl: http://10.71.80.185:31994/uploadfile/asiagame + #场馆配置中ppru拓扑图存放路径 + sceneJsonPath: /home/hzdx/data/java/uploadPath/shorturl + + +# 短信发送配置 +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + #企业编号 + applicationid: 1087 + #企业名 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + +#工作流的地址 +workFlowUrl: http://10.71.80.231:8080 + +# minio 文件存储配置信息 +minio: + url: http://192.168.97.212:9000/ + endpoint: + accesskey: minioadmin + secretKey: minioadmin + bucketName: yyzxp + prefix: + + +#大屏数据环境 +daping: WORK + + +#quartz定时器开关 +job: + enabled: false + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: false + +logging: + level: + com.ruoyi: info + org.springframework: warn \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-bak2.yml b/ruoyi-admin/src/main/resources/application-bak2.yml new file mode 100644 index 0000000000000000000000000000000000000000..437c18d0a43cf2ef043e4b1148dd7ed7c03aff72 --- /dev/null +++ b/ruoyi-admin/src/main/resources/application-bak2.yml @@ -0,0 +1,151 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: /home/hzdx/data/java/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + # driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: + url: jdbc:postgresql://10.71.80.231:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + username: pms + password: Ea$tcyd2023 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 + host: 10.71.80.231 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: YyunRedis@Zxp01 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms +#简报配置 +file: + #文件访问地址前缀 + visitpath: http://183.247.163.49:8093/profile/upload/ + #json本地保存路径 + briefingJsonPath: /home/hzdx/data/java/uploadPath/briefingJson + #json上传路径 + briefingShortUrl: http://10.71.80.185:31994/uploadfile/asiagame + #场馆配置中ppru拓扑图存放路径 + sceneJsonPath: /home/hzdx/data/java/uploadPath/shorturl + + +# 短信发送配置 +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + #企业编号 + applicationid: 1087 + #企业名 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + +#工作流的地址 +workFlowUrl: http://10.71.80.231:8080 + +# minio 文件存储配置信息 +minio: + url: http://192.168.97.212:9000/ + endpoint: + accesskey: minioadmin + secretKey: minioadmin + bucketName: yyzxp + prefix: + + +#大屏数据环境 +daping: WORK + + +#quartz定时器开关 +job: + enabled: true + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: false + +logging: + level: + com.ruoyi: info + org.springframework: warn \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml new file mode 100644 index 0000000000000000000000000000000000000000..c2c74fadc2a65452669b0a229567fcb9819b146d --- /dev/null +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -0,0 +1,152 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: C:/ruoyi/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + # driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: + # url: jdbc:mysql://183.247.163.49:7940/ry_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&stringtype=unspecified + url: jdbc:postgresql://192.168.97.156:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# url: jdbc:postgresql://183.247.163.49:8099/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + username: postgres + password: eastcom + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 + host: 192.168.97.212 +# host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: YyunRedis@Zxp01 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +redisson: + addr: + singleAddr: + host: redis://192.168.97.212:6379 + password: YyunRedis@Zxp01 + database: 0 + + + +# 短信发送配置 +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + applicationid: 1087 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + +#工作流地址 +workFlowUrl: http://192.168.97.212:8080 + +#简报配置 +file: + #文件访问地址前缀 + visitpath: http://183.247.163.49:8093/profile/upload/ + #json本地保存路径 + briefingJsonPath: C:\json\ + #json上传路径 + briefingShortUrl: http://192.168.97.142:80/uploadfile/test + #场馆配置中ppru拓扑图存放路径 + sceneJsonPath: C:\home\data\java\uploadPath\upload\json\ + +# minio 文件存储配置信息 +minio: + url: http://127.0.0.1:9090/ + endpoint: + accesskey: Q8QW6SKTKXIQT631ES3K + secretKey: 55Keq+9CM7elYjINdN3qqW7QBH5cvn8LHoaP5LnT + bucketName: upload + prefix: + +daping: DEBUG + +job: + enabled: false + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: true \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-local.yml b/ruoyi-admin/src/main/resources/application-local.yml new file mode 100644 index 0000000000000000000000000000000000000000..9129658d7f1068ea7cd8c3cc2e5c7cfb71521c7d --- /dev/null +++ b/ruoyi-admin/src/main/resources/application-local.yml @@ -0,0 +1,156 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: C:/ruoyi/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +server: + # 服务器的HTTP端口,默认为8080 + port: 9080 + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + # driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: + # url: jdbc:mysql://183.247.163.49:7940/ry_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&stringtype=unspecified +# url: jdbc:postgresql://192.168.97.156:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# username: postgres +# password: eastcom + url: jdbc:postgresql://127.0.0.1:5433/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + username: pms + password: Ea$tcyd2023 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 +# host: 192.168.97.212 + host: 127.0.0.1 + # 端口,默认为6379 +# port: 6379 + port: 6380 + # 数据库索引 + database: 0 + # 密码 + password: YyunRedis@Zxp01 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +redisson: + addr: + singleAddr: + host: redis://127.0.0.1:6380 + password: YyunRedis@Zxp01 + database: 0 + + +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + applicationid: 1087 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + +workFlowUrl: http://127.0.0.1:8080 + +file: + visitpath: http://183.247.163.49:8093/profile/upload/ + briefingJsonPath: C:\json\ + briefingShortUrl: http://192.168.97.142:80/uploadfile/test + sceneJsonPath: C:\home\data\java\uploadPath\upload\json\ + +# minio 文件存储配置信息 +minio: + url: http://127.0.0.1:9090/ + endpoint: + accesskey: Q8QW6SKTKXIQT631ES3K + secretKey: 55Keq+9CM7elYjINdN3qqW7QBH5cvn8LHoaP5LnT + bucketName: upload + prefix: + +daping: DEBUG + +job: + enabled: false + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: false + +logging: + level: + com.ruoyi: debug + org.springframework: warn \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-ser.yml b/ruoyi-admin/src/main/resources/application-ser.yml new file mode 100644 index 0000000000000000000000000000000000000000..a0e60a8b7d3264e14e36a06a581e17df7b431ef5 --- /dev/null +++ b/ruoyi-admin/src/main/resources/application-ser.yml @@ -0,0 +1,137 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: /home/data/java/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + # driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: + # url: jdbc:mysql://183.247.163.49:7940/ry_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&stringtype=unspecified + url: jdbc:postgresql://127.0.0.1:5433/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + # url: jdbc:postgresql://183.247.163.49:8099/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true&stringtype=unspecified + username: pms + password: Ea$tcyd2023 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 +# host: 192.168.97.212 + host: 127.0.0.1 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + applicationid: 1087 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + + +workFlowUrl: http://192.168.97.212:8080 + +file: + visitpath: http://183.247.163.49:8093/profile/upload/ + briefingJsonPath: C:\json\ + briefingShortUrl: http://192.168.97.142:80/uploadfile/test + sceneJsonPath: C:\home\data\java\uploadPath\upload\json\ + +# minio 文件存储配置信息 +minio: + url: http://192.168.97.212:9000/ + endpoint: + accesskey: minioadmin + secretKey: minioadmin + bucketName: yyzxp + prefix: + +daping: WORK + +job: + enabled: false + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: false \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-test.yml b/ruoyi-admin/src/main/resources/application-test.yml new file mode 100644 index 0000000000000000000000000000000000000000..cf67ec223e8b2cacd3056b13238d082fb6366c53 --- /dev/null +++ b/ruoyi-admin/src/main/resources/application-test.yml @@ -0,0 +1,154 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: /home/data/java/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + # driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: + # url: jdbc:mysql://183.247.163.49:7940/ry_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# url: jdbc:postgresql://10.71.80.241:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + url: jdbc:postgresql://127.0.0.1:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + # url: jdbc:postgresql://183.247.163.49:8099/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + username: pms + password: Ea$tcyd2023 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 + host: localhost + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: YyunRedis@Zxp01 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms +#简报配置 +file: + #文件访问地址前缀 + visitpath: http://183.247.163.49:8093/profile/upload/ + #json本地保存路径 + briefingJsonPath: /home/data/java/uploadPath/briefingJson + #json上传路径 + briefingShortUrl: http://10.71.80.185:31994/uploadfile/asiagame + #场馆配置中ppru拓扑图存放路径 + sceneJsonPath: /home/data/java/uploadPath/shorturl + + +# 短信发送配置 +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + #企业编号 + applicationid: 1087 + #企业名 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + +#工作流的地址 +workFlowUrl: http://10.71.80.241:8080 + +# minio 文件存储配置信息 +minio: + url: http://192.168.97.212:9000/ + endpoint: + accesskey: minioadmin + secretKey: minioadmin + bucketName: yyzxp + prefix: + + +#大屏数据环境 +daping: WORK + + +#quartz定时器开关 +job: + enabled: true + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: false + +logging: + level: + com.ruoyi: info + org.springframework: warn \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application.properties b/ruoyi-admin/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..16046493c2963407b0f4016e061428fca9df650f --- /dev/null +++ b/ruoyi-admin/src/main/resources/application.properties @@ -0,0 +1,5 @@ +pagehelper.reasonable=false +pagehelper.supportMethodsArguments=true +pagehelper.params.count=countSql +pagehelper.auto-dialect=true +pagehelper.auto-runtime-dialect=true \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..e539acb0622fe253ce4d6aece732dcf8618781e1 --- /dev/null +++ b/ruoyi-admin/src/main/resources/application.yml @@ -0,0 +1,151 @@ +# 滑块验证码 +aj: + captcha: + # blockPuzzle滑块 clickWord文字点选 default默认两者都实例化 + type: blockPuzzle + # 右下角显示字 + water-mark: ruoyi.vip + # 校验滑动拼图允许误差偏移量(默认5像素) + slip-offset: 5 + # aes加密坐标开启或者禁用(true|false) + aes-status: true + # 滑动干扰项(0/1/2) + interference-options: 2 +# 开发环境配置 +server: + # 服务器的HTTP端口,默认为8080 + port: 9010 + servlet: + # 应用的访问路径 + context-path: / + tomcat: + # tomcat的URI编码 + uri-encoding: UTF-8 + # 连接数满后的排队数,默认为100 + accept-count: 1000 + threads: + # tomcat最大线程数,默认为200 + max: 800 + # Tomcat启动初始化的线程数,默认值10 + min-spare: 100 + +# 安全停机 调用curl -X POST http://localhost:9010/monitor/shutdown +management: + endpoint: + shutdown: + enabled: false + endpoints: + web: + exposure: + include: "shutdown" + base-path: /monitor + +# 日志配置 +logging: + level: + com.ruoyi: debug + org.springframework: warn + +# 用户配置 +user: + password: + # 密码最大错误次数 + maxRetryCount: 5 + # 密码锁定时间(默认10分钟) + lockTime: 10 + sms: + # 密码最大错误次数 + maxRetryCount: 3 + # 密码锁定时间(默认10分钟) + lockTime: 15 + defaultCode: false +# Spring配置 +spring: + # 资源信息 + messages: + # 国际化资源文件路径 + basename: i18n/messages + profiles: + active: druid + # 文件上传 + servlet: + multipart: + # 单个文件大小 + max-file-size: 10MB + # 设置总上传的文件大小 + max-request-size: 20MB + # 服务模块 + devtools: + restart: + # 热部署开关 + enabled: false + jackson: + #日期格式化 + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + # redis 配置 +# redis: +# # 地址 +# host: localhost +# # 端口,默认为6379 +# port: 6379 +# # 数据库索引 +# database: 0 +# # 密码 +# password: +# # 连接超时时间 +# timeout: 10s +# lettuce: +# pool: +# # 连接池中的最小空闲连接 +# min-idle: 0 +# # 连接池中的最大空闲连接 +# max-idle: 8 +# # 连接池的最大数据库连接数 +# max-active: 8 +# # #连接池最大阻塞等待时间(使用负值表示没有限制) +# max-wait: -1ms + +# token配置 +token: + # 令牌自定义标识 + header: Authorization + # 令牌密钥 + secret: abcdefghijklmnopqrstuvwxyz + # 令牌有效期(默认30分钟) + expireTime: 4320 + +# MyBatis配置 +mybatis-plus: + type-aliases-package: com.ruoyi.**.domain + mapper-locations: classpath*:mapper/**/*Mapper.xml + config-location: classpath:mybatis/mybatis-config.xml + + +# PageHelper分页插件 +pagehelper: + helperDialect: postgresql + supportMethodsArguments: true + params: count=countSql + page-size-zero: true + +# Swagger配置 +swagger: + # 是否开启swagger + enabled: true + # 请求前缀 + pathMapping: /dev-api + +# 防止XSS攻击 +xss: + # 过滤开关 + enabled: true + # 排除链接(多个用逗号分隔) + excludes: /system/notice + # 匹配链接 + urlPatterns: /system/*,/monitor/*,/tool/* + +# 登录文本加密公私钥 +login: + publicKey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCqjPHyVJ5u9E+d0CMYyc3mMdQ/ac9UZdF9oz2Bxr6UDKNax+Zhn/OARKozMAzH2cpYsb4kGPYTHPzmrbgegbACC7bTFSFFBSkotvvfDHd+YbfgxfNf/VbwczMl/E3OMHzRFbrLO8v3ozA+2w2Gyg0UAV6AGliVrQHCuKIDYV0EwIDAQAB + privateKey: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMKqM8fJUnm70T53QIxjJzeYx1D9pz1Rl0X2jPYHGvpQMo1rH5mGf84BEqjMwDMfZylixviQY9hMc/OatuB6BsAILttMVIUUFKSi2+98Md35ht+DF81/9VvBzMyX8Tc4wfNEVuss7y/ejMD7bDYbKDRQBXoAaWJWtAcK4ogNhXQTAgMBAAECgYBAzlzytClK8aYVf6nzksbpkWk5o1hb55/O4OfIuFDY6H4L6o/YkphVwrGtlIyf+GJlusa21YsH5Vvsy6L6VGWOT/T1Q924zxwhPHFP8fzWrWJ60IT5jGDChJ1jls8GRWHgCnriQRMHU36eqENC5VZiYdfuulGN2bUNgMzUgmv9UQJBAOZio3CAQ+mwOsdRWixaput636qXoryleXiYrzGOulTzdYrRnJCIF3fE6H9uX5i2MwA3HtgTkN3qS4mtyBHvWP0CQQDYTt4KlkVJN3hsfV3qMk48zYE68lUg0umRaYXlQ0moLPO2P3wLFLLOq0jhWIwWz7ApIQXsR7x0RZOK2NadFFZPAkEA30Nh7klvBw2wuK3+/BLRxkxqavDOVZDq+dLFnPobWu4gz+m4l1w7mebqBWxaGi0fmarRKkcz0csXbxJJXBAepQJAKJtNpbEmGqOWMM+sJL4C3/k4TGeXwYy2mjy0DSD/n9moessaLz5YfuG60cr8qX+ds2rmoL+qyi0RkJw6VcyukwJAS5sxmn0YKbXw7GxDm7HmMcGuRYTo6ai+Olzk1GLwddTj56pfOgex+FF4FFyO33zzpEPeZbEzkbxkLC7Z8m0lWg== diff --git a/ruoyi-admin/src/main/resources/banner.txt b/ruoyi-admin/src/main/resources/banner.txt new file mode 100644 index 0000000000000000000000000000000000000000..0931cb84428b04a15f637865d9c9c00f5a408419 --- /dev/null +++ b/ruoyi-admin/src/main/resources/banner.txt @@ -0,0 +1,24 @@ +Application Version: ${ruoyi.version} +Spring Boot Version: ${spring-boot.version} +//////////////////////////////////////////////////////////////////// +// _ooOoo_ // +// o8888888o // +// 88" . "88 // +// (| ^_^ |) // +// O\ = /O // +// ____/`---'\____ // +// .' \\| |// `. // +// / \\||| : |||// \ // +// / _||||| -:- |||||- \ // +// | | \\\ - /// | | // +// | \_| ''\---/'' | | // +// \ .-\__ `-` ___/-. / // +// ___`. .' /--.--\ `. . ___ // +// ."" '< `.___\_<|>_/___.' >'"". // +// | | : `- \`.;`\ _ /`;.`/ - ` : | | // +// \ \ `-. \_ __\ /__ _/ .-` / / // +// ========`-.____`-.___\_____/___.-`____.-'======== // +// `=---=' // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// 佛祖保佑 永不宕机 永无BUG // +//////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/i18n/messages.properties b/ruoyi-admin/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000000000000000000000000000000000000..4cbdadc41fdaa472303a4c66c8d3fc7f81ba6033 --- /dev/null +++ b/ruoyi-admin/src/main/resources/i18n/messages.properties @@ -0,0 +1,41 @@ +#错误消息 +not.null=* 必须填写 +user.jcaptcha.error=验证码错误 +user.jcaptcha.expire=验证码已失效 +user.sms.expire=短信验证码已失效 +user.not.exists=用户不存在/密码错误 +user.password.not.match=用户不存在/密码错误 +user.password.retry.limit.count=密码输入错误{0}次 +user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟 +user.sms.not.match=短信验证码输入错误,还剩{0}次 +user.sms.retry.limit.count=短信验证码输入错误{0}次 +user.sms.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{1}分钟 +user.password.delete=对不起,您的账号已被删除 +user.blocked=用户已封禁,请联系管理员 +role.blocked=角色已封禁,请联系管理员 +user.logout.success=退出成功 + +length.not.valid=长度必须在{min}到{max}个字符之间 + +user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 +user.password.not.valid=* 5-50个字符 + +user.email.not.valid=邮箱格式错误 +user.mobile.phone.number.not.valid=手机号格式错误 +user.login.success=登录成功 +user.register.success=注册成功 +user.notfound=请重新登录 +user.forcelogout=管理员强制退出,请重新登录 +user.unknown.error=未知错误,请重新登录 + +##文件上传消息 +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!
允许的文件最大大小是:{0}MB! +upload.filename.exceed.length=上传的文件名最长{0}个字符 + +##权限 +no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] +no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] +no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] +no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] +no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] +no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml new file mode 100644 index 0000000000000000000000000000000000000000..a360583fa4424fe5b8b88b39eca0a5aa203e7064 --- /dev/null +++ b/ruoyi-admin/src/main/resources/logback.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/sys-info.log + + + + ${log.path}/sys-info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/sys-error.log + + + + ${log.path}/sys-error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + ${log.path}/sys-user.log + + + ${log.path}/sys-user.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..10cf6b0b2eb92848f09f27365c8f4b8e2e9522b8 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-admin/src/main/resources/rebel-remote.xml b/ruoyi-admin/src/main/resources/rebel-remote.xml new file mode 100644 index 0000000000000000000000000000000000000000..1b662ec00760c6890f874c4442df8c2709e23b30 --- /dev/null +++ b/ruoyi-admin/src/main/resources/rebel-remote.xml @@ -0,0 +1,4 @@ + + + com.ruoyi.ruoyi-admin + diff --git a/ruoyi-admin/src/main/resources/templates/wireReportTemplate.ftl b/ruoyi-admin/src/main/resources/templates/wireReportTemplate.ftl new file mode 100644 index 0000000000000000000000000000000000000000..be7dd50d051eebdd69ffd4ac7fe391e43f831054 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/wireReportTemplate.ftl @@ -0,0 +1,3 @@ + + +杭州2022年第19届亚运会${name}测试赛通信产品和服务使用证明2023${beginTime}${endTime}杭州2022年第19届亚运会${name}测试赛在${venueName}举行。在该项目比赛中,使用了官方通信服务合作伙伴中国移动提供的${taskSub}通信产品和服务。所提供的产品和服务符合杭州亚运会${type}项目比赛规则要求,设备性能稳定、运行正常,人员保障到位,满足测试赛要求。官方通信服务合作伙伴所提供的通信产品和服务清单详见附件。场馆信息技术主任(VTM):2023年 月 日附件1:AGIS专网临时布线清单(示例)序号设备属性规格单位数量<#list agisList as item>${item.id}${item.materialName}${item.materialSmallClass}${item.materialStand}${item.materialUnit}${item.sum}场馆网络与通信支持主管(VCM):2023年 月 日亚组委通信网络监理单位:2023年 月 日附件2:互联网(WiFi)专网临时布线清单(示例)序号设备属性规格单位数量<#list wifiList as item>${item.id}${item.materialName}${item.materialSmallClass}${item.materialStand}${item.materialUnit}${item.sum}场馆网络与通信支持主管(VCM):2023年 月 日亚组委通信网络监理单位:2023年 月 日附件3固话VOIP)专网临时布线清单(示例)序号设备属性规格单位数量<#list voipList as item>${item.id}${item.materialName}${item.materialSmallClass}${item.materialStand}${item.materialUnit}${item.sum}场馆网络与通信支持主管(VCM):2023年 月 日亚组委通信网络监理单位:2023年 月 日4402815001falsefalse871WPS Office_11.1.0.14309_F1E327BC-269C-435d-A152-05C5408002CA02023-06-01T01:30:00ZAdministratornbjkj2023-09-11T07:07:21Z2052-11.1.0.14309E4C53410A85F4514A9A76E10A50E260A_13 \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/wireReportTemplate1.ftl b/ruoyi-admin/src/main/resources/templates/wireReportTemplate1.ftl new file mode 100644 index 0000000000000000000000000000000000000000..ccc20c9c22a7e867e8e717c2c54a52c50abe125f --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/wireReportTemplate1.ftl @@ -0,0 +1,3 @@ + + +杭州2022年第19届亚运会${name}测试赛通信产品和服务使用证明2023${beginTime}${endTime}杭州2022年第19届亚运会${name}测试赛在${venueName}举行。在该项目比赛中,使用了官方通信服务合作伙伴中国移动提供的${taskSub}通信产品和服务。所提供的产品和服务符合杭州亚运会${type}项目比赛规则要求,设备性能稳定、运行正常,人员保障到位,满足测试赛要求。官方通信服务合作伙伴所提供的通信产品和服务清单详见附件。场馆信息技术主任(VTM):2023年 月 日附件1:AGIS专网临时布线清单(示例)序号设备属性规格单位数量<#list agisList as item>${item.id}${item.materialName}${item.materialSmallClass}${item.materialStand}${item.materialUnit}${item.sum}场馆网络与通信支持主管(VCM):2023年 月 日亚组委通信网络监理单位:2023年 月 日附件2:互联网(WiFi)专网临时布线清单(示例)序号设备属性规格单位数量<#list wifiList as item>${item.id}${item.materialName}${item.materialSmallClass}${item.materialStand}${item.materialUnit}${item.sum}场馆网络与通信支持主管(VCM):2023年 月 日亚组委通信网络监理单位:2023年 月 日33616610034falsefalse701WPS Office_11.1.0.14309_F1E327BC-269C-435d-A152-05C5408002CA02023-06-01T01:30:00ZAdministratorAdministrator2023-06-05T06:31:11Z2052-11.1.0.14309CAEDF833D7D749E38CA1C0FF33A0A3F1_13 \ No newline at end of file diff --git a/ruoyi-admin/src/test/java/com/ruoyi/wl_test.java b/ruoyi-admin/src/test/java/com/ruoyi/wl_test.java new file mode 100644 index 0000000000000000000000000000000000000000..683759680c207d3ff50ee2a2ec8b5f6565e9a35e --- /dev/null +++ b/ruoyi-admin/src/test/java/com/ruoyi/wl_test.java @@ -0,0 +1,1000 @@ +package com.ruoyi; + +import cn.hutool.core.date.LocalDateTimeUtil; + +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsClasses; +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsBatchDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsOrderLogDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsClassesVo; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformRedisVo; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsBatchMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsClassesMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsOrderLogMapper; +import com.ruoyi.cmcc_gm.service.*; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.AlarmConstants; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.TaskConstants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.dto.HandleDataDTO; +import com.ruoyi.common.core.domain.dto.StartProcessInstanceDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.*; +import com.ruoyi.common.utils.file.XmlDocToDocxUtil; +import com.ruoyi.common.utils.poi.WordUtil; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.dto.*; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeModelQO; +import com.ruoyi.eastcom_yw.domain.qo.YwNoticeObjectQO; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.mapper.*; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.eastcom_yw.service.impl.yw_alarm_deal_logServiceImpl; +import com.ruoyi.framework.web.service.SysLoginService; + +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.sunlm.mapper.dpConfigMapper; +import com.ruoyi.sunlm.service.dpAllMyServices; +import com.ruoyi.system.mapper.SysDictDataMapper; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.system.service.ISysUserService; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.text.StringSubstitutor; +import org.docx4j.Docx4J; +import org.docx4j.openpackaging.packages.WordprocessingMLPackage; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.http.*; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {RuoYiApplication.class }, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)//配置启动类 +public class wl_test { + + @Autowired + private YwAlarmViewService ywAlarmViewService; + + @Autowired + private YwSignLogService ywSignLogService; + + @Autowired + private ISysUserService userService; + + @Autowired + private yw_alarm_deal_logService alarm_deal_logService; + + @Autowired + private SysLoginService loginService; + + @Autowired + private YwSceneService ywSceneService; + + @Autowired + private YwSignPlanService ywSignPlanService; + + @Autowired + private CommonService commonService; + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private YwSignLogViewService ywSignLogViewService; + + @Autowired + private YwWireTaskLogService ywWireTaskLogService; + + @Autowired + private YwNoticeUserService ywNoticeUserService; + + @Autowired + private YwNoticeUserMapper ywNoticeUserMapper; + + @Autowired + private SysLoginService sysLoginService; + + @Autowired + private YwAlarmDHService ywAlarmDHService; + + @Autowired + private YwAlarmCSService ywAlarmCSService; + + @Autowired + private YwAlarmWXService ywAlarmWXService; + + @Test + public void test1() throws Exception { + + String token = commonService.getToken("13100000000","123456"); + + HttpHeaders headers2 = new HttpHeaders(); + headers2.add("Authorization","Bearer "+token); + headers2.setContentType(MediaType.APPLICATION_JSON); + + HttpEntity> formEntity = new HttpEntity>(headers2); + +// url = "http://192.168.97.212:9010/eastcom_yw/alarm/list"; + String url ="http://localhost:8080/eastcom_yw/alarm/list"; + + YwAlarmDTO dto=new YwAlarmDTO(); + dto.setPageSize(10); + dto.setPageNum(1); + dto.setAlarmType("cs"); + dto.setCounty("0571_4"); + dto.setAlarmStatus("0"); + +// String url ="http://localhost:8080/eastcom_yw/alarm/newAlarmNum/7"; +//// +// YwAlarmDTO dto=new YwAlarmDTO(); +//// +// dto.setAlarmStatus("0"); +// +// dto.setUserId(8L); +// ArrayList venues=new ArrayList<>(); +// +//// venues.add(1000L); +//// +// dto.setVenues(venues); +// +// dto.setPageNum(1); +// dto.setPageSize(10); +//// + HttpHeaders headers = new HttpHeaders(); + +//// + HttpEntity request = new HttpEntity(JSONObject.toJSONString(dto),headers); +// + ResponseEntity responseEntity2 = restTemplate.postForEntity(url,request,String.class); + +// List SceneIds=new ArrayList<>(); +// SceneIds.add(1000L); +// + // String url = "http://192.168.5.132:8081/eastcom_yw/config/exportscenecalendarlist?pageSize=10&pageNum=1"; +// +// HashMap map = new HashMap<>(); +// map.put("venues",SceneIds); +// map.put("roles","gz_wx"); +// +// HttpEntity request2 = new HttpEntity(headers2); +// ResponseEntity responseEntity2 = restTemplate.exchange(url,HttpMethod.GET,request2,String.class); +// ResponseEntity responseEntity2 = restTemplate.postForEntity(url,HttpMethod.POST,formEntity,String.class); + + System.out.println(responseEntity2.getBody()); + + } + + @Test + public void test2() throws Exception { + + YwWireTaskLogDTO dto =new YwWireTaskLogDTO(); + dto.setPageNum(1); + dto.setPageSize(10); + dto.setTaskTypes(new Integer[]{1,2}); + + String token = commonService.getToken("admin","123456"); + String url ="http://127.0.0.1:8088/dev-api/eastcom_yw/wireTask/list"; + HttpHeaders headers = new HttpHeaders(); + headers.add("Authorization","Bearer "+token); +//// + HttpEntity request = new HttpEntity(JSONObject.toJSONString(dto),headers); +// + ResponseEntity responseEntity = restTemplate.postForEntity(url,request,String.class); + + System.out.println(responseEntity.getBody()); + } + + @Autowired + private ISysRoleService roleService; + + @Test + public void test6() throws Exception + { + + String token = commonService.getToken("gz_wx1","123456"); + +// LoginBody loginBody=new LoginBody(); +// loginBody.setPhone("15288888999"); +// sysLoginService.getCode(loginBody); +// System.out.println(sysLoginService.loginByPhone("15288888999","123456","")); + +// HttpHeaders headers2 = new HttpHeaders(); +// headers2.add("Authorization","Bearer "+token); +// headers2.setContentType(MediaType.APPLICATION_JSON); +// HttpEntity> formEntity = new HttpEntity>(headers2); + + +// String url ="http://192.168.97.212:9010/autoLogin"; +// String url ="http://localhost:8080/getInfo"; +// YwSignLogDTO ywSignLogDTO=new YwSignLogDTO(); + + // HttpEntity> formEntity2 = new HttpEntity>(headers2); +// HttpEntity request2 = new HttpEntity(JSONObject.toJSONString(ywSignLogDTO),headers2); +// ResponseEntity responseEntity2 = restTemplate.postForEntity(url,request2,String.class); +// ResponseEntity responseEntity2 = restTemplate.exchange(url,HttpMethod.GET,formEntity2,String.class); + +// ResponseEntity responseEntity2 = restTemplate.exchange(url,HttpMethod.GET,formEntity,String.class); +// System.out.println(responseEntity2.getBody()); + } + + @Test + public void test3() throws Exception { + + + String url_detail = "http://localhost:8080/eastcom_yw/notice?flwId=" + "1625014388736045056"; + + ResponseEntity responseEntity = null; + + try { + responseEntity = restTemplate.getForEntity(url_detail, String.class); + System.out.println(responseEntity.getBody()); + } catch (Exception ex) { + System.out.println("ProcessInstanceId:1625021022858293248 通知接口请求错误"); + } + + } + + @Test + public void test4() throws Exception + { + + + } + + + + @Test + public void test5() throws Exception + { + +// String token = loginService.loginByPhone("","123456", null); +// System.out.println(JSONObject.toJSONString(ywAlarmViewService.GetNewAlarmNum(1L))); +// UserInfo user = new UserInfo(); +// user.setId("2"); +// user.setName("系统"); +// user.setType("user"); +// user.setSex("1"); +// user.setSelected(true); +// +// StartProcessInstanceDTO startDTO = new StartProcessInstanceDTO(); +// startDTO.setStartUserInfo(user); +// startDTO.setProcessDefinitionId("Flowable1610829800288088064:28:1630745311905550336"); +// +// JSONObject json = new JSONObject(); +// json.put("input_cg_zy_id", MessageFormat.format("{0}|{1}|gz", 1000, "wx")); +// +// startDTO.setFormData(json); +// +// String res_flwprocessid= commonService.StartProcess(startDTO); + + + +// YwSignLogDTO ywSignLogDTO=new YwSignLogDTO(); +//// ywSignLogDTO.setUserType("wx"); +//// ywSignLogDTO.setCounty("0571_6"); +//// ywSignLogDTO.setCity("0571"); +// ywSignLogDTO.setPageSize(10); +// ywSignLogDTO.setPageNum(1); +//// Long[] venueId=new Long[]{1000L}; +// System.out.println(JSONObject.toJSONString(ywSignLogViewService.getSignLog(ywSignLogDTO))); +// ywSignLogDTO.setVenueIds(venueId); +// ywSignLogDTO.setStartDate("2023-02-08"); +// ywSignLogDTO.setEndDate("2023-02-11"); +// ywSignLogDTO.setPageNum(1); +// ywSignLogDTO.setPageSize(10); +// List list = ywSignLogViewService.getSignLogStatic(ywSignLogDTO); +//// +// System.out.println(JSONObject.toJSONString(list)); +// +// List list_signlogvo=new ArrayList<>(); +// +// page.getRecords().forEach( +// ywSignLogView -> { +// YwSignLogVo ywSignLogVo=new YwSignLogVo(); +// BeanUtils.copyBeanProp(ywSignLogVo,ywSignLogView); +// list_signlogvo.add(ywSignLogVo); +// } +// ); +// YwSignInDTO ywSignInDTO=new YwSignInDTO(); +// ywSignInDTO.setSignTime("2023-03-19 03:36:55"); +// ywSignInDTO.setVenueId(158L); +// ywSignInDTO.setSignType(1); +// ywSignInDTO.setUsers(new Long[]{8L}); +// ywSignInDTO.setUserTypes(new String[]{"dh"}); +// ywSignLogService.SignIn(ywSignInDTO); + + // System.out.println(JSONObject.toJSONString(page)); + +// String temp_id="1610829800288088064"; +//// +// System.out.println( commonService.GetProcessDefinitionId(temp_id)); + +// JSONObject object = JSONObject.parseObject(responseEntity.getBody()); +// JSONObject res = object.getJSONObject("result"); +// System.out.println(res.getString("processDefinitionId")); + +// System.out.println(ywAlarmViewService.getTemplateId()); + YwSignPlanDTO ywSignPlanDTO=new YwSignPlanDTO(); +// ywSignPlanDTO.setId(160L); +// ywSignPlanDTO.setVenueIds(new Long[]{9231L}); + ywSignPlanDTO.setSignDate(""); + ywSignPlanDTO.setStartDate("2023-05-02"); + ywSignPlanDTO.setEndDate("2023-05-25"); + ywSignPlanDTO.setPageSize(10); + ywSignPlanDTO.setPageNum(1); +// ywSignPlanDTO.setSignDates(new String[]{"2023-03-03"}); +// ywSignPlanDTO.setRepWarnInterval("5"); +// ywSignPlanDTO.setSignScope(111); +//// ywSignPlanDTO.setNoticeType("3"); +// ywSignPlanDTO.setBeginTime("13:41:00"); +// ywSignPlanDTO.setEndTime("19:00:00"); +// ywSignPlanDTO.setIsOpen("1"); +// ywSignPlanService.updateSignPlan(ywSignPlanDTO); + + System.out.println(JSONObject.toJSONString(ywSignPlanService.getSignPlan(ywSignPlanDTO))); + + } + + + @Autowired + private YwAlarmHangupLogService ywAlarmHangupLogService; + + @Autowired + private YwAlarmHangupLogMapper ywAlarmHangupLogMapper; + + @Autowired + private SysUserMapper userMapper; + + @Autowired + private SysDictDataMapper dictData; + + @Autowired + private YwWireTaskLogMapper ywWireTaskLogMapper; + + @Autowired + private YwSignPlanMapper ywSignPlanMapper; + + @Autowired + private YwAlarmService ywAlarmService; + + + @Autowired + private YwSceneUserService ywSceneUserService; + + @Autowired + private YwAlarmOprateLogService ywAlarmOprateLogService; + + @Autowired + private YwAlarmMapper ywAlarmMapper; + + @Autowired + private YwRoutInspectPlanMapper ywRoutInspectPlanMapper; + + @Autowired + private RedisCache redisCache; + + + @Autowired + private YwAlarmViewMapper ywAlarmViewMapper; + + @Autowired + private yw_alarm_deal_logMapper alarm_deal_logMapper; + + @Autowired + private dpConfigMapper dpConfigMapper; + + @Autowired + private yw_alarm_deal_logMapper yw_alarm_deal_logMapper; + + @Autowired + private YwMaterialsOrderLogService ywMaterialsOrderLogService; + + @Autowired + private YwMaterialsOrderLogMapper ywMaterialsOrderLogMapper; + + @Autowired + private YwMaterialsStockService ywMaterialsStockService; + + @Autowired + private YwMaterialsClassesService ywMaterialsClassesService; + + @Autowired + private YwMaterialsInformService ywMaterialsInformService; + + @Autowired + private YwMaterialsBatchMapper ywMaterialsBatchMapper; + + @Autowired + private YwMaterialsBatchService ywMaterialsBatchService; + + @Autowired + private YwNoticeObjectService ywNoticeObjectService; + + @Autowired + private SysNoticeService sysNoticeService; + + @Autowired + private YwRoutInspectPlanService ywRoutInspectPlanService; + + @Autowired + private YwNoticeModelService ywNoticeModelService; + @Autowired + private YwRoutInspectLogMapper ywRoutInspectLogMapper; + + @Autowired + private dpAllMyServices DpAllMyServices; + + @Autowired + private TokenService tokenService; + + @Autowired + private YwSignLogViewMapper ywSignLogViewMapper; + + @Autowired + private YwScenePictureService ywScenePictureService; + + @Autowired + private YwSceneNoticeinfoService ywSceneNoticeinfoService; + + @Autowired + private YwSceneNetelementMapper ywSceneNetelementMapper; + + @Test + public void test7() throws Exception { + + ywSceneNetelementMapper.dp_2_refresh_materialized_view(); + +// ywSceneNoticeinfoService.statisticsNetNum(); + +// List lst = ywAlarmMapper.revokeAlarm(); +// int cnt = lst.size(); +// int i = 1; +// for (String revoke : lst ) +// { +// HandleDataDTO dto = new HandleDataDTO(); +// UserInfo user = new UserInfo(); +// user.setId("2"); +// user.setName("系统"); +// dto.setTaskName("alarm"); +// dto.setCurrentUserInfo(user); +// dto.setProcessInstanceId(revoke); +// try { +// System.out.println("当前已处理第"+cnt+"/"+i+"条,流程号:"+revoke); +// commonService.revokeTask(dto); +// i++; +// } +// catch(Exception ex) +// { +// continue; +// } +// } + + + +// QueryWrapper queryUserWrapper=new QueryWrapper<>(); +// queryUserWrapper.eq("scene_id",8599L); +// +// List lstSceneUser = ywSceneUserService.list(queryUserWrapper); +// +// List lstUserId = lstSceneUser.stream().map(x->x.getUserId()).collect(Collectors.toList()); +// +// System.out.println(StringUtils.join(lstUserId,",")); + +// Map dataMap = new HashMap<>(16); +// dataMap.put("name", "跑步比赛"); +// dataMap.put("beginTime", "07月27日"); +// dataMap.put("endTime", "07月29日"); +// dataMap.put("taskSub", "AGIS专网"); +// dataMap.put("type", "跑步"); +// dataMap.put("venueName", "奥体中心体育馆"); +// +// List> noList = new ArrayList<>(); +// int size = 7; +// for (int i = 0; i < size; i++) { +// Map map = new HashMap<>(16); +// map.put("id", ""); +// map.put("materialName", ""); +// map.put("materialSmallClass", ""); +// map.put("materialStand", ""); +// map.put("materialUnit", ""); +// map.put("sum", ""); +// noList.add(map); +// } +// +// List> taskList = new ArrayList<>(); +// size = 200; +// for (int i = 0; i < size; i++) { +// Map map = new HashMap<>(16); +// map.put("id", ""); +// map.put("materialName", ""); +// map.put("materialSmallClass", ""); +// map.put("materialStand", ""); +// map.put("materialUnit", ""); +// map.put("sum", ""); +// taskList.add(map); +// } +// +// dataMap.put("agisList", taskList); +// dataMap.put("wifiList", noList); +// dataMap.put("intercomList", noList); +// dataMap.put("vedioList", noList); +// dataMap.put("transList", noList); +// +// WordUtil word = new WordUtil(); +// +// String fileName = "报告模板_"+DateUtils.dateTime() + ".doc"; +// String filePath = RuoYiConfig.getDownloadPath()+fileName; +// try { +// word.createWord(dataMap, "word.xml", filePath); +// System.out.println(filePath); +// } +// catch (Exception ex){ +// System.out.println(ex.getMessage()); +// } + +// String template_id = ""; +// try { +// template_id = ywAlarmViewMapper.getTemplateId(TaskConstants.ALARM); +// } catch (Exception e) { +// // log.error(e.getMessage()); +// return; +// } +// +// if (StringUtils.isEmpty(template_id)) +// { +// //todo:有空需要让异常入数据库,方便查询 +// // log.error("没有找到告警工作流template_id"); +// return; +// } +// +// +// String processDefinitionId = ""; +// try { +// processDefinitionId = commonService.GetProcessDefinitionId(template_id); +// } catch (Exception e) { +// // log.error(e.getMessage()); +// return; +// } +// +// if (StringUtils.isEmpty(processDefinitionId)) +// { +// // log.error("没有正确的工作流processDefinitionId"); +// return; +// } +// +// +// UserInfo user = new UserInfo(); +// user.setId("2"); +// user.setName("系统"); +// user.setType("user"); +// user.setSex("1"); +// user.setSelected(true); +// +// Long sceneId = 2L; +// String code = "26324"; +// String groupColnum = "5329"; +// +// for (int i=0;i<10;i++) { +// +// //保存数据到yw_alarm_deal_log +// yw_alarm_deal_log alarm_deal = new yw_alarm_deal_log(); +// alarm_deal.setAlarmCode(code); +// alarm_deal.setAlarmType("wx"); +// alarm_deal.setGroupColnum(groupColnum); +// alarm_deal.setBeginTime(DateUtils.getNowDate()); +// alarm_deal.setPrimaryId(groupColnum); +// alarm_deal.setIsRed("Y"); +// alarm_deal.setSceneId(sceneId); +// alarm_deal.setAlarmTime(DateUtils.getNowDate()); +// +// +// //20230303只有在红线内的告警才需要生成工作流 +// +// YwSearchDTO ywSearchDTO = new YwSearchDTO(); +// ywSearchDTO.setArea_county_id("0571_4"); +// ywSearchDTO.setVenue_id("2"); +// ywSearchDTO.setVenue_name("杭州奥体中心主体育场"); +// ywSearchDTO.setCity("杭州"); +// ywSearchDTO.setCounty("滨江"); +// ywSearchDTO.setTask_type(TaskConstants.ALARM); +// ywSearchDTO.setAlarm_name("测试告警"); +// ywSearchDTO.setNet_name("测试网元"); +// ywSearchDTO.setSite_name("测试站名"); +// +// //20230303工作流增加任务名称 +// ywSearchDTO.setTask_name("测试123 测试告警"); +// //20230307工作流增加专业 +// ywSearchDTO.setSpecialty("无线"); +// +// StartProcessInstanceDTO startDTO = new StartProcessInstanceDTO(); +// startDTO.setStartUserInfo(user); +// startDTO.setProcessDefinitionId(processDefinitionId); +// +// JSONObject json = new JSONObject(); +// +// String groupId = MessageFormat.format("{0}|{1}|gz", "2", "wx"); +// +// json.put("input_cg_zy_id", groupId); +// json.put("input_gjbh", "test1"); +// json.put("input_zyfl", TaskConstants.ALARM); +// json.put("textarea_gjxx", MessageFormat.format("告警网元:{0},告警名称:{1},告警时间:{2}", "测试网元", "测试告警", DateUtils.getNowDate())); +// json.put("textarea_gzyy", ""); +// json.put("pictureupload_sczp", null); +// //20230217 增加查询条件 +// json.put("input_search", JSONObject.toJSONString(ywSearchDTO)); +// +// startDTO.setFormData(json); +// try { +// String res_flwprocessid = commonService.StartProcess(startDTO); +// if (StringUtils.isNotEmpty(res_flwprocessid)) { +// alarm_deal.setFlwProcessid(res_flwprocessid); +// //非红线内的直接进入记录表,用于查看 +// try { +// alarm_deal_logMapper.insert(alarm_deal); +// } catch (Exception e) { +// break; +// } +// } +// } catch (Exception e) { +// break; +// } +// } +// + + +// ywNoticeUserService.noticeYW("1648881170252963840","9169|wx|gz",TaskConstants.ALARM); + +// List alarms = ywAlarmViewService.GetAlarmInfoList("1641774928401481728",false); +// +// System.out.println(JSONObject.toJSONString(alarms.get(0))); +// System.out.println(JSONObject.toJSONString(ywMaterialsBatchMapper.selectBatch("ZXK-20230413-23"))); +// +// +// YwMaterialsSearchDTO searchDTO =new YwMaterialsSearchDTO(); +// searchDTO.setStoreId(0L); +// searchDTO.setTaskStatus("1"); +// searchDTO.setOrderType(1); +// searchDTO.setSearchDate("2023-04-12"); +// System.out.println(JSONObject.toJSONString(ywMaterialsStockService.getMaterialsStock(searchDTO))); + + +// List list = ywMaterialsInformService.getMaterials(); +// +// System.out.println(JSONObject.toJSONString(list)); + + YwMaterialsOrderLogDTO dto=new YwMaterialsOrderLogDTO(); +// dto.setOrderId("ZXK-20230413-23"); + dto.setOrderType(2); +// dto.setTaskStatus("1"); + dto.setInStoreVenue(9231L); + dto.setOutStoreVenue(0L); + dto.setApplyName("jkj"); + dto.setCheckName("jkj"); +// dto.setInStoreName(""); + + + +// String orderId = ywMaterialsOrderLogService.insertMaterialsOrderLog(dto); + + YwMaterialsDTO ywMaterialsDTO=new YwMaterialsDTO(); + ywMaterialsDTO.setAuditor("wm"); + ywMaterialsDTO.setOrderType(2); + ywMaterialsDTO.setOpType("提交申请"); + ywMaterialsDTO.setOrderId("SL-20230506-0008"); + + + YwMaterialsBatch batch =new YwMaterialsBatch(); + batch.setMaterialCode("1101011002"); + batch.setOutSum(3); + batch.setInSum(4); + + YwMaterialsBatch batch2 =new YwMaterialsBatch(); + batch2.setMaterialCode("1101011003"); + batch2.setOutSum(5); + batch2.setInSum(6); + + List listBath =new ArrayList<>(); + listBath.add(batch); + listBath.add(batch2); + YwMaterialsBatchDTO ywMaterialsBatchDTO = new YwMaterialsBatchDTO(); + ywMaterialsBatchDTO.setOrderId("SL-20230421-0002"); + ywMaterialsBatchDTO.setData(listBath); + + +// ywMaterialsOrderLogService.updateMaterialsOrderLogInner(dto); +// +// ywMaterialsStockService.updateMaterialsStock(ywMaterialsDTO); +// ywMaterialsStockService.updateInWayMaterialsStock(ywMaterialsDTO); +// YwMaterialsOrderLog ywMaterialsOrderLog = ywMaterialsStockService.Validate(ywMaterialsDTO); +// ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsBatchDTO); +// QueryWrapper queryWrapper=new QueryWrapper<>(); +// queryWrapper.eq("hangup_status","2"); +// queryWrapper.eq("flw_processid","1637101556262428672"); +// queryWrapper.orderByDesc("hangup_time"); +// YwAlarmHangupLog hangupLog = ywAlarmHangupLogMapper.selectList(queryWrapper).get(0); +// Date hangupBegin =hangupLog.getHangupTime(); +// +// double durSecond = Math.ceil((double) ((DateUtils.getNowDate().getTime() - hangupBegin.getTime()) / (1000*60))); +// +// yw_alarm_deal_logMapper.updateHangupSpantime(durSecond,"1637101556262428672"); +// +// throw new ServiceException("取消挂起失败,请联系管理员"); + + +// System.out.println(JSONObject.toJSONString(ywAlarmViewMapper.getYwAlarmInfoList("1638716980505591808"))); + +// YwAlarmDTO ywAlarmDto=new YwAlarmDTO(); +//// ywAlarmDto.setStartTime("2023-03-15"); +//// ywAlarmDto.setEndTime("2023-03-17 23:59:59"); +//// ywAlarmDto.setCounty("0571_3"); +// ywAlarmDto.setUserId(270L); +// ywAlarmDto.setPageNum(1); +// ywAlarmDto.setPageSize(10); +// ywAlarmDto.setIsAll(false); +// ywAlarmDto.setInRedLine("N"); +// ywAlarmDto.setAlarmStatus("1"); +//// ywAlarmDto.setDealStatus("2"); +//// List lstVenue=new ArrayList<>(); +//// lstVenue.add(42L); +//// ywAlarmDto.setVenues(lstVenue); +// ywAlarmDto.setAlarmType("cs"); +// ywAlarmDto.setIsAPP(true); +//// ywAlarmDto.setSearchBox("网元连接中断"); +// ywAlarmDto.setIsAPP(true); +//// System.out.println(JSONObject.toJSONString(ywAlarmWXService.GetAlarmList(ywAlarmDto))); +//// yw_alarm_deal_log alarm_deal = new yw_alarm_deal_log(); +//// alarm_deal.setAlarmCode("test"); +//// alarm_deal.setAlarmType("cs"); +//// alarm_deal.setGroupColnum("100000"); +//// alarm_deal.setBeginTime(DateUtils.getNowDate()); +//// alarm_deal.setPrimaryId("100000"); +//// alarm_deal.setIsRed("Y"); +//// alarm_deal.setSceneId(1L); +//// alarm_deal_logMapper.insert(alarm_deal); +// System.out.println(JSONObject.toJSONString(ywAlarmCSService.GetAlarmList(ywAlarmDto))); +// System.out.println(JSONObject.toJSONString(ywAlarmViewMapper.getYwAlarmNewNumByDto(ywAlarmDto))); +// System.out.println(JSONObject.toJSONString(ywAlarmViewService.getYwAlarmByDto(ywAlarmDto))); +// System.out.println(JSONObject.toJSONString(ywAlarmViewService.GetAlarmInfoList("1638716989053583360"))); +// System.out.println(JSONObject.toJSONString(ywAlarmViewService.getYwAlarmNewNumByDto(ywAlarmDto))); +// System.out.println(JSONObject.toJSONString(ywAlarmViewMapper.getYwAlarmWxNewNumByDto(ywAlarmDto))); +// System.out.println(JSONObject.toJSONString(ywAlarmViewService.GetAlarmInfoList("1637101547278229504"))); +// System.out.println(JSONObject.toJSONString(ywAlarmViewMapper.getYwAlarmByGroupId("")); +// ywAlarmViewMapper.getYwAlarmByGroupId("cs","1015"); +// YwSignPlanDTO ywSignPlanDTO=new YwSignPlanDTO(); +// ywSignPlanDTO.setNoticeType("短信"); +// ywSignPlanDTO.setVenueName("滨江体育馆"); +// ywSignPlanDTO.setSignDate("'2023-03-19'"); +// ywSignPlanDTO.setBeginTime("'8:00:00'"); +// ywSignPlanDTO.setEndTime("'17:00:00'"); +// ywSignPlanDTO.setRepWarnInterval("5,10"); +// ywSignPlanDTO.setNoticeType("短信"); +// List signPlanList =new ArrayList<>(); +// signPlanList.add(ywSignPlanDTO); +//// getLocalDateTime(double date, boolean use1904windowing, boolean roundSeconds) +// +// ywSignPlanService.importSignPlan(signPlanList,false,1L); + +// System.out.println(JSONObject.toJSONString(ywAlarmViewService.GetAlarmInfoList("1635898164437508096"))); + +//SysUser user =new SysUser(); +// List list = userService.selectUserList(user); +// System.out.println(JSONObject.toJSONString(list)); + +// String phone = "18367407691"; +// String code="123456"; +// redisCache.setCacheObject(CacheConstants.CAPTCHA_CODE_KEY + phone, code, 300, TimeUnit.SECONDS); +// + +// +// System.out.println(token); + +// System.out.println(JSONObject.toJSONString( ywRoutInspectPlanMapper.getExecutablePlanList(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(DateUtils.getNowDate())))); + +// YwAlarmOprateLog ywAlarmOprateLog=new YwAlarmOprateLog(); +// ywAlarmOprateLog.setAlarmGroup("109"); +// ywAlarmOprateLog.setUserId(8L); +// ywAlarmOprateLog.setId(0L); +// String aa=DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS); +// ywAlarmOprateLog.setOprateTime(aa); +// ywAlarmOprateLogService.saveOrUpdate(ywAlarmOprateLog); + +// ywSignPlanService.deleteSignPlan(2L); + +// List listScene = ywSceneUserService.getVenuesByUserId(29L); +// System.out.println(JSONObject.toJSONString(listScene)); +// List venueIds=new ArrayList<>(); +// listScene.forEach( +// ywSceneUser -> { +// venueIds.add(ywSceneUser.getSceneId()); +// } +// ); +// Long [] arr_ids = venueIds.toArray(new Long[venueIds.size()]); +// System.out.println(JSONObject.toJSONString(arr_ids)); + + + +// System.out.println(JSONObject.toJSONString(map_YwAlarmLastVo)); +// HashMap> map_YwAlarmLastVo=new HashMap>(); +// +// dictData.selectDictDataByType("yw_specialty").forEach(dictData -> { +// +// if(!map_YwAlarmLastVo.containsKey(dictData.getDictValue())) +// { +// map_YwAlarmLastVo.put(dictData.getDictValue(),new ArrayList()); +// } +// +// SysUser user=new SysUser(); +// user.setUserType(dictData.getDictValue()); +// +// userMapper.selectUserList(user).forEach(sysUser -> { +// +// map_YwAlarmLastVo.get(dictData.getDictValue()).add(sysUser); +// +// }); +// +// +// } ); +// System.out.println(ywSignPlanMapper.getSignRemindList()); +// System.out.println(JSONObject.toJSONString(map_YwAlarmLastVo)); +// ywAlarmViewService.insert_alarm_schedule(); + // ywAlarmHangupLogService.updateAlarmHangupSchedule(); +// YwSearchDTO ywSearchDTO=new YwSearchDTO(); +// ywSearchDTO.setAreaCounty("0571_4"); +// ywSearchDTO.setVenue("1000"); +// System.out.println(JSONObject.toJSONString(ywSearchDTO)); + // System.out.println(JSONObject.toJSONString( ywAlarmViewService.GetAlarmInfoList("1630761578490204160"))); +// YwAlarmHangupLog ywAlarmHangupLog=new YwAlarmHangupLog(); +// ywAlarmHangupLog.setId(2L); +// ywAlarmHangupLog.setRecoveryResult("0"); +// ywAlarmHangupLogMapper.updateById(ywAlarmHangupLog); +// HandleDataDTO handleDataDTO=new HandleDataDTO(); +// +// UserInfo user=new UserInfo(); +// user.setId("8"); +// handleDataDTO.setProcessInstanceId("1622422643670167552"); +// handleDataDTO.setTaskId("1622422643737276427"); +// handleDataDTO.setCurrentUserInfo(user); +// handleDataDTO.setTransferUserInfo(user); +// handleDataDTO.setTransferType(1); +// try { +// commonService.UpdateProcessStatus(handleDataDTO); +// } +// catch (Exception ex) +// { +// System.out.println(ex.getMessage()); +// } + +// YwAlarmHangupLogDTO ywAlarmHangupLog=new YwAlarmHangupLogDTO(); +// ywAlarmHangupLog.setHangupReason("123"); +// ywAlarmHangupLog.setHangupTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate())); +// ywAlarmHangupLog.setHangupUserId(10L); +// ywAlarmHangupLog.setRecoveryTime("2023-02-15 23:00:00"); +// ywAlarmHangupLog.setFlwProcessid("123"); +// ywAlarmHangupLog.setFlwTaskid("123"); +// ywAlarmHangupLogService.insertYwAlarmHangupLog(ywAlarmHangupLog); +// +// YwWireTaskLogDTO ywWireTaskLogDTO=new YwWireTaskLogDTO(); +// ywWireTaskLogDTO.setWireTaskName("test123(拆除)"); +// ywWireTaskLogDTO.setVenueId(155L); +// ywWireTaskLogDTO.setWireTaskId("BX-20230329-0001"); +// ywWireTaskLogDTO.setPageSize(10); +// ywWireTaskLogDTO.setPageNum(1); +// ywWireTaskLogDTO.setFlwProcessid("1635928391033245696"); +// ywWireTaskLogDTO.setWireTaskId("BX-20230315-0007"); +// ywWireTaskLogDTO.setCreateTime("2023-02-07 11:00:00"); +// ywWireTaskLogDTO.setTaskType(2); +// ywWireTaskLogDTO.setWireTaskId("123123123"); +// ywWireTaskLogDTO.setVenueId(1000L); +//// System.out.println(JSONObject.toJSONString(ywWireTaskLogService.getWireTaskLog(ywWireTaskLogDTO))); +// ywWireTaskLogService.insertWireTaskLogReWireTaskId(ywWireTaskLogDTO); +// List list = ywNoticeUserService.getYwNoticeUserList("1625355629520695296","1625355631231971328","1000|venuemanager","公网告警"); +// System.out.println(JSONObject.toJSONString(list)) +// String groupId = "0|centerstoragemaster"; +// if(groupId.contains("centerstorage")) +// { +// groupId = groupId.split("\\|")[1]; +// } +// System.out.println(JSONObject.toJSONString(ywNoticeUserMapper.getPhoneByGroupId(groupId))); +// String content = "您的验证码为123456,五分钟有效,请勿向他人泄露。"; +// SysNotice notice=new SysNotice(); +// notice.setNoticeType("3"); +// notice.setNoticeTitle("短信验证码"); +// notice.setStatus("0"); +// notice.setCreateBy("sys"); +// notice.setNoticeContent(content); +// notice.setReciveUser(8L); +// notice.setSendTime(DateUtils.getNowDate()); +// try +// { +// sysNoticeService.insertNotice(notice); +// } +// catch (Exception e) +// { +// e.printStackTrace(); +// } + +// ywAlarmViewService.insert_alarm_schedule(); + +// YwDataDTO ywDataDTO =new YwDataDTO(); +// ywDataDTO.setVenueIds(new Long[]{158L}); +// ywDataDTO.setUserTypes(new String[]{"wx"}); +// ywDataDTO.setRole(""); +// ywDataDTO.setSignDate("2023-03-14"); +// ywDataDTO.setSignType(0); +// List tdi = ywSceneService.getSysUserByVenueAndOther(ywDataDTO); +// System.out.println(JSONObject.toJSONString(tdi)); + +// System.out.println(JSONObject.toJSONString(ywDataDTO)); +// String url="http://localhost:8080/eastcom_yw/alarm/info/1622422643670167552"; +// String token = commonService.getToken("admin","123456"); +// +// HttpHeaders headers = new HttpHeaders(); +// headers.add("Authorization","Bearer "+token); +// headers.setContentType(MediaType.APPLICATION_JSON); +// HttpEntity> formEntity = new HttpEntity>(headers); +// +//// HttpEntity request2 = new HttpEntity(JSONObject.toJSONString(ywDataDTO),headers); +//// ResponseEntity responseEntity = restTemplate.postForEntity(url,request2,String.class); +// ResponseEntity responseEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity,String.class); +// System.out.println(responseEntity.getBody()); + +// SysNotice notice = new SysNotice(); +//// notice.setReciveUser(13L); +// +// List list = noticeService.selectNoticeListByUser(notice); +// +// System.out.println(JSONObject.toJSONString(list)); + +// List list= new ArrayList<>(); +//// +// list = ywSceneService.getSysUserByVenueAndOther(ywDataDTO); +////// +// TableDataInfo rspData = new TableDataInfo(); +// rspData.setCode(HttpStatus.SUCCESS); +// rspData.setMsg("查询成功"); +// rspData.setRows(list); +// rspData.setTotal(new PageInfo(list).getTotal()); +//// +//// +// System.out.println(JSONObject.toJSONString(rspData)); + } + + +} diff --git a/ruoyi-app/pom.xml b/ruoyi-app/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..e10b3c8bc07140aa1a9bcba18fa24659bdca1a42 --- /dev/null +++ b/ruoyi-app/pom.xml @@ -0,0 +1,134 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + 4.0.0 + jar + ruoyi-app + + + app服务入口 + + + + + + + org.springframework.boot + spring-boot-devtools + true + + + + + io.springfox + springfox-boot-starter + + + + + io.swagger + swagger-models + 1.6.2 + + + + + + + + + + org.postgresql + postgresql + + + + com.ruoyi + ruoyi-framework + + + + + com.ruoyi + ruoyi-generator + + + + com.ruoyi + eastcom_yw + + + + com.ruoyi + cmcc_gm + + + + junit + junit + 4.13.2 + test + + + org.springframework + spring-test + 5.3.23 + test + + + org.springframework.boot + spring-boot-test + 2.7.5 + test + + + + com.ruoyi + ruoyi-sunlm + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.1.1.RELEASE + + true + + + + + repackage + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 + + false + ${project.artifactId} + + + + ${project.artifactId} + + + \ No newline at end of file diff --git a/ruoyi-app/src/main/java/com/ruoyi/RuoYiAPPApplication.java b/ruoyi-app/src/main/java/com/ruoyi/RuoYiAPPApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..dcf0eeed619a9618cc18d1672a23318cfb7f6f7e --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/RuoYiAPPApplication.java @@ -0,0 +1,39 @@ +package com.ruoyi; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.web.client.RestTemplate; + +/** + * 启动程序 + * + * @author ruoyi + */ +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) +public class RuoYiAPPApplication +{ + + @Bean + public RestTemplate restTemplate(RestTemplateBuilder builder) { + return builder.build(); + } + + public static void main(String[] args) + { + // System.setProperty("spring.devtools.restart.enabled", "false"); + SpringApplication.run(RuoYiAPPApplication.class, args); + System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + + " .-------. ____ __ \n" + + " | _ _ \\ \\ \\ / / \n" + + " | ( ' ) | \\ _. / ' \n" + + " |(_ o _) / _( )_ .' \n" + + " | (_,_).' __ ___(_ o _)' \n" + + " | |\\ \\ | || |(_,_)' \n" + + " | | \\ `' /| `-' / \n" + + " | | \\ / \\ / \n" + + " ''-' `'-' `-..-' "); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/RuoYiServletInitializer.java b/ruoyi-app/src/main/java/com/ruoyi/RuoYiServletInitializer.java new file mode 100644 index 0000000000000000000000000000000000000000..b51948b5d5f26b98d83b63813d725d3c5e3be6bc --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/RuoYiServletInitializer.java @@ -0,0 +1,16 @@ +package com.ruoyi; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +/** + * web容器中进行部署 + * + * @author ruoyi + */ +public class RuoYiServletInitializer extends SpringBootServletInitializer { + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(RuoYiAPPApplication.class); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsClassesController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsClassesController.java new file mode 100644 index 0000000000000000000000000000000000000000..f44bb0836630f43d08830f1ae2600bc317b9de33 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsClassesController.java @@ -0,0 +1,113 @@ +package com.ruoyi.app.controller.cmcc_gm; + + +import com.ruoyi.cmcc_gm.domain.YwMaterialsClasses; +import com.ruoyi.cmcc_gm.domain.dto.YmMaterialsClassesParam; +import com.ruoyi.cmcc_gm.service.YwMaterialsClassesService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.PageUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.util.List; + +/** + * (YwMaterialsClasses)表控制层 + * + * @author lee + * @since 2023-04-19 10:15:59 + */ +@Api(tags = "物资类别") +@RestController +@RequestMapping("/app/ywMaterialsClasses") +public class YwMaterialsClassesController extends BaseController { + + /** + * 服务对象 + */ + @Resource + private YwMaterialsClassesService ywMaterialsClassesService; + + /** + * 分页查询所有数据 + * + * @param ywMaterialsClasses 查询实体 + * @return 所有数据 + */ + @ApiOperation(value = "分页查询", notes = "分页查询") + @PostMapping("/list") + public TableDataInfo selectAll(@RequestBody YmMaterialsClassesParam ywMaterialsClasses) { + PageUtils.startPage(ywMaterialsClasses, YmMaterialsClassesParam.class); + return getDataTable(ywMaterialsClassesService.getMaterialsBySearch(ywMaterialsClasses)); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @ApiOperation(value = "根据id查询", notes = "根据id查询") + @GetMapping("{id}") + public AjaxResult selectOne(@PathVariable Serializable id) { + return AjaxResult.success(this.ywMaterialsClassesService.getById(id)); + } + + /** + * 新增数据 + * + * @param ywMaterialsClasses 实体对象 + * @return 新增结果 + */ + @ApiOperation(value = "新增", notes = "新增") + @PostMapping + public AjaxResult insert(@RequestBody YwMaterialsClasses ywMaterialsClasses) { + boolean res = this.ywMaterialsClassesService.save(ywMaterialsClasses); + if(res) + { + ywMaterialsClassesService.loadingMaterialsClassesCache(); + } + return AjaxResult.success(res); + } + + /** + * 修改数据 + * + * @param ywMaterialsClasses 实体对象 + * @return 修改结果 + */ + @ApiOperation(value = "修改", notes = "修改") + @PutMapping + public AjaxResult update(@RequestBody YwMaterialsClasses ywMaterialsClasses) { + boolean res = this.ywMaterialsClassesService.updateById(ywMaterialsClasses); + if(res) + { + ywMaterialsClassesService.loadingMaterialsClassesCache(); + } + return AjaxResult.success(res); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @ApiOperation(value = "删除", notes = "删除") + @DeleteMapping + public AjaxResult delete(@RequestParam("idList") List idList) { + boolean res = this.ywMaterialsClassesService.removeByIds(idList); + if(res) + { + ywMaterialsClassesService.loadingMaterialsClassesCache(); + } + return AjaxResult.success(this.ywMaterialsClassesService.removeByIds(idList)); + } + +} + diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsController.java new file mode 100644 index 0000000000000000000000000000000000000000..33c58a9838103539a99d1e2a78dbeed7115a7160 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsController.java @@ -0,0 +1,611 @@ +package com.ruoyi.app.controller.cmcc_gm; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.common.enums.OrderStatus; +import com.ruoyi.cmcc_gm.common.enums.OrderType; +import com.ruoyi.cmcc_gm.domain.YwMaterialsBatch; +import com.ruoyi.cmcc_gm.domain.YwMaterialsOrderLog; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.ruoyi.cmcc_gm.domain.dto.*; +import com.ruoyi.cmcc_gm.domain.qo.YwMaterialsSnListQO; +import com.ruoyi.cmcc_gm.domain.vo.YwMaterialsInformRedisVo; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsBatchMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsOrderLogMapper; +import com.ruoyi.cmcc_gm.mapper.YwMaterialsSnListMapper; +import com.ruoyi.cmcc_gm.service.*; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.page.PageDomain; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.page.TableSupport; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.dto.YwSearchDTO; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + *

+ * 物资工单日志表 前端控制器 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@RestController +@RequestMapping("/app/ywMaterials") +public class YwMaterialsController extends BaseController { + + @Autowired + private YwMaterialsStockService ywMaterialsStockService; + + @Autowired + private YwMaterialsInformService ywMaterialsInformService; + + @Autowired + private YwMaterialsOrderLogService ywMaterialsOrderLogService; + + @Autowired + private YwMaterialsClassesService ywMaterialsClassesService; + + @Autowired + private YwMaterialsBatchService ywMaterialsBatchService; + + @Autowired + private YwMaterialsBatchMapper ywMaterialsBatchMapper; + + @Autowired + private YwMaterialsSnListService ywMaterialsSnListService; + + + @ApiOperation("根据条件查询仓库的物资库存数据") + @PostMapping("/stock/list") + @RepeatSubmit(enable = false,interval = 1000) + public TableDataInfo list(@RequestBody YwMaterialsSearchDTO ywMaterialsSearchDTO) throws Exception { + + //APP默认显示所有场馆的物资 +// if(ObjectUtils.isNotEmpty(ywMaterialsSearchDTO.getStoreIds())) +// { +// if(ywMaterialsSearchDTO.getStoreIds().length==0) { +// throw new ServiceException("仓库ID不能为空"); +// } +// } + + String pageNum = ServletUtils.getParameter("pageNum"); + String pageSize = ServletUtils.getParameter("pageSize"); + if(!StringUtils.isEmpty(pageNum) && !StringUtils.isEmpty(pageSize)) { + startPage(); + } + return getDataTable(ywMaterialsStockService.getMaterialsStock(ywMaterialsSearchDTO)); + + } + + + @Log(title = "更新物资库存信息数据", businessType = BusinessType.UPDATE) + @ApiOperation("更新物资库存信息数据") + @PostMapping("/stock/update") + @Transactional + public AjaxResult updateStock(@RequestBody YwMaterialsDTO ywMaterialsDTO) throws Exception { + + + Boolean res = true; + + if (ObjectUtils.isEmpty(ywMaterialsDTO.getOpType())) { + throw new ServiceException("操作类型不能为空"); + } + + if (ObjectUtils.isEmpty(ywMaterialsDTO.getOrderType())) { + throw new ServiceException("物资工单类型不能为空"); + } + +// 验证当前用户的角色是否具有操作权限 + List roles = SecurityUtils.getLoginUser().getUser().getRoles(); + + List filterRoles = null; + + boolean needCheck = false; + + if (ywMaterialsDTO.getOpType().equals("提交申请")) { + + if (ywMaterialsDTO.getOrderType().equals(OrderType.ZXK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragechecker")).collect(Collectors.toList()); + } + + if (ywMaterialsDTO.getOrderType().equals(OrderType.SL.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.TK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragechecker") || e.getRoleKey().equals("venuemanager")).collect(Collectors.toList()); + } + + //20230815 出入库不需要验证角色 +// if (ywMaterialsDTO.getOrderType().equals(OrderType.CK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.RK.getCode())) { +// filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("builder")).collect(Collectors.toList()); +// } + + if (ywMaterialsDTO.getOrderType().equals(OrderType.DB.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragemaster")).collect(Collectors.toList()); + } + + + if (ywMaterialsDTO.getOrderType().equals(OrderType.CK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.RK.getCode())) { + + } + else + { + needCheck = true; + } + + } + + if (ywMaterialsDTO.getOpType().equals("审核任务")) { + + if (ywMaterialsDTO.getOrderType().equals(OrderType.ZXK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.SL.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.TK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragemaster")).collect(Collectors.toList()); + } + + + if (ywMaterialsDTO.getOrderType().equals(OrderType.CK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.RK.getCode()) || ywMaterialsDTO.getOrderType().equals(OrderType.DB.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragemaster")).collect(Collectors.toList()); + } + needCheck = true; + } + + if (ywMaterialsDTO.getOpType().equals("出库确认") || ywMaterialsDTO.getOpType().equals("入库确认")) { + + if (!ywMaterialsDTO.getOrderType().equals(OrderType.ZXK.getCode())) { +// 默认都是场馆物资仓库管理员出入库确认 + //物资退库,是中心库物资维护员角色提交入库 + if (ywMaterialsDTO.getOpType().equals("入库确认")) { + if (ywMaterialsDTO.getOrderType().equals(OrderType.TK.getCode())) { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("centerstoragechecker")).collect(Collectors.toList()); + } else { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragekeeper")).collect(Collectors.toList()); + } + } else { + filterRoles = roles.stream().filter(e -> e.getRoleKey().equals("venuestoragekeeper")).collect(Collectors.toList()); + } + } + needCheck = true; + } + + if (needCheck) { + if(filterRoles!=null) { + if (filterRoles.isEmpty()) { + throw new ServiceException("当前用户没有操作的权限"); + } + } + } + + //创建时如果不是中心库,折旧入库 的需要冻结库存 + if (ywMaterialsDTO.getOpType().equals("创建")) { + + + YwMaterialsOrderLog ywMaterialsOrderLog = ywMaterialsStockService.Validate(ywMaterialsDTO); + + //待申请的才可以创建 + if (!ywMaterialsOrderLog.getTaskStatus().equals(OrderStatus.DSQ.getCode())) { + throw new ServiceException("当前物资订单状态不允许该操作"); + } + + if (!(ywMaterialsDTO.getOrderType() == OrderType.ZXK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.RK.getCode())) { + +// //正向,冻结操作放在了批量表的插入 +// if(StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) +// { +// res = ywMaterialsStockService.freezeOutWayMaterialsStock(ywMaterialsDTO, ywMaterialsOrderLog); +// } + + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + res = ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsDTO, ywMaterialsOrderLog); + } + } + } + + } + + if (ywMaterialsDTO.getOpType().equals("撤销")) { + + YwMaterialsOrderLog ywMaterialsOrderLog = ywMaterialsStockService.Validate(ywMaterialsDTO); + + if (!ywMaterialsOrderLog.getTaskStatus().equals(OrderStatus.DSQ.getCode())) { + throw new ServiceException("当前物资订单状态不允许该操作"); + } + + res = ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsDTO, ywMaterialsOrderLog); + + if (res) { + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsOrderLog.getOrderId()); + orderDto.setOrderType(ywMaterialsOrderLog.getOrderType()); + orderDto.setTaskStatus(OrderStatus.CX.getCode()); + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + + } + + if (res) { + return AjaxResult.success("撤销物资订单成功"); + } + + return AjaxResult.error("撤销物资订单失败"); + + } + + if (ywMaterialsDTO.getOpType().equals("驳回") || ywMaterialsDTO.getOpType().equals("提交申请")) { + + YwMaterialsOrderLog ywMaterialsOrderLog = ywMaterialsStockService.Validate(ywMaterialsDTO); + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + + orderDto.setOrderId(ywMaterialsOrderLog.getOrderId()); + orderDto.setOrderType(ywMaterialsOrderLog.getOrderType()); + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + + if (ywMaterialsDTO.getOpType().equals("驳回")) { + + if (!ywMaterialsOrderLog.getTaskStatus().equals(OrderStatus.DSH.getCode())) { + throw new ServiceException("当前物资订单不是待审核状态,无法驳回"); + } + + //驳回后释放库存 + boolean resBack = ywMaterialsStockService.freezeOutWayMaterialsStockBack(ywMaterialsDTO, ywMaterialsOrderLog); + + if (!resBack) { + throw new ServiceException("释放库存异常,驳回失败了,不用走工作流"); + } + + orderDto.setTaskStatus(OrderStatus.DSQ.getCode()); + } + + if (ywMaterialsDTO.getOpType().equals("提交申请")) { + + if (!ywMaterialsOrderLog.getTaskStatus().equals(OrderStatus.DSQ.getCode())) { + throw new ServiceException("当前物资订单不是待申请状态,无法提交申请"); + } + + orderDto.setTaskStatus(OrderStatus.DSH.getCode()); + } + + } + + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + + if (ywMaterialsDTO.getIsBack().equals("是")) { + if (ywMaterialsDTO.getOpType().equals("驳回")) { + + if (!ywMaterialsOrderLog.getTaskStatus().equals(OrderStatus.DSQ.getCode())) { + throw new ServiceException("当前物资订单不是待申请状态,无法回滚到待审核"); + } + + //工作流驳回失败了,重新冻结上去 + boolean resBack = ywMaterialsStockService.freezeOutWayMaterialsStock(ywMaterialsDTO, ywMaterialsOrderLog); + + if (!resBack) { + throw new ServiceException("回滚驳回库存异常,需要人工处理"); + } + + if (ywMaterialsDTO.getIsBack().equals("是")) { + orderDto.setTaskStatus(OrderStatus.DSH.getCode()); + } + } + } + + if (ywMaterialsDTO.getOpType().equals("提交申请")) { + + if (!ywMaterialsOrderLog.getTaskStatus().equals(OrderStatus.DSH.getCode())) { + throw new ServiceException("当前物资订单不是待审核状态,无法回滚到待申请"); + } + + if (ywMaterialsDTO.getIsBack().equals("是")) { + orderDto.setTaskStatus(OrderStatus.DSQ.getCode()); + } + + } + + } + + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + +// if(!res) +// { +// //回滚释放库存的操作 +// throw new ServiceException("修改为待审核异常,驳回失败了"); +// } + + } + + //中心库审核任务通过就入库确认 + if (ywMaterialsDTO.getOpType().equals("审核任务")) { + if (ywMaterialsDTO.getOrderType() == OrderType.ZXK.getCode()) { + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + res = ywMaterialsStockService.updateMaterialsStockBack(ywMaterialsDTO); + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + res = ywMaterialsStockService.updateMaterialsStock(ywMaterialsDTO); + } + } else { + + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + if(ywMaterialsDTO.getOrderType() == OrderType.SL.getCode() || ywMaterialsDTO.getOrderType() == OrderType.RK.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStockBack(ywMaterialsDTO); + } + + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsDTO.getOrderId()); + orderDto.setOrderType(ywMaterialsDTO.getOrderType()); + orderDto.setTaskStatus(OrderStatus.DSH.getCode()); + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + } + + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { +// 申领和入库在审核环节释放库存 + if(ywMaterialsDTO.getOrderType() == OrderType.SL.getCode() || ywMaterialsDTO.getOrderType() == OrderType.RK.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStock(ywMaterialsDTO); + } +// 退库,出库,调拨存在出库环节,只需要更新下状态为ysh就可以 + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + + YwMaterialsOrderLogDTO orderDto = new YwMaterialsOrderLogDTO(); + orderDto.setOrderId(ywMaterialsDTO.getOrderId()); + orderDto.setOrderType(ywMaterialsDTO.getOrderType()); + orderDto.setTaskStatus(OrderStatus.YSH.getCode()); + res = ywMaterialsOrderLogService.updateMaterialsOrderLogInner(orderDto); + } + + + + + } + + } + } + + if (ywMaterialsDTO.getOpType().equals("出库确认")) { + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStock(ywMaterialsDTO); + } + else + { + return AjaxResult.error("当前步骤和任务状态不同步"); + } + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + // 退库,出库和调拨在出库确认环节释放库存 + if(ywMaterialsDTO.getOrderType() == OrderType.TK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.CK.getCode() || ywMaterialsDTO.getOrderType() == OrderType.DB.getCode()) { + res = ywMaterialsStockService.updateFreezeOutWayMaterialsStock(ywMaterialsDTO); + } + else + { + return AjaxResult.error("当前步骤和任务状态不同步"); + } + } + + } + + if (ywMaterialsDTO.getOpType().equals("入库确认")) { + //回滚 + if (StringUtils.isNotEmpty(ywMaterialsDTO.getIsBack())) { + if (ywMaterialsDTO.getIsBack().equals("是")) { + res = ywMaterialsStockService.updateMaterialsStockBack(ywMaterialsDTO); + } + } + + //正向 + if (StringUtils.isEmpty(ywMaterialsDTO.getIsBack())) { + res = ywMaterialsStockService.updateMaterialsStock(ywMaterialsDTO); + } + } + + if (res) { + return AjaxResult.success("更新物资库存成功"); + } + + return AjaxResult.error("更新物资库存失败"); + + } + + + @ApiOperation("根据条件查询仓库的物资信息数据") + @PostMapping("/info/list") + public TableDataInfo info(@RequestBody YwMaterialsSearchDTO ywMaterialsSearchDTO) throws Exception { + String pageNum = ServletUtils.getParameter("pageNum"); + String pageSize = ServletUtils.getParameter("pageSize"); + if(!StringUtils.isEmpty(pageNum) && !StringUtils.isEmpty(pageSize)) { + startPage(); + } + return getDataTable(ywMaterialsInformService.selectMaterials(ywMaterialsSearchDTO)); + } + + @ApiOperation("获取所有物资信息数据") + @GetMapping("/info/list") + public AjaxResult InfoAll() throws Exception { + List list = ywMaterialsInformService.getMaterials(); + if(ObjectUtils.isNotEmpty(list)) { + return AjaxResult.success("获取物资信息数据成功", list); + } + return AjaxResult.error("获取物资信息数据失败"); + } + + + @Log(title = "新增物资信息数据", businessType = BusinessType.INSERT) + @ApiOperation("新增物资信息数据") + @PostMapping("/info/insert") + public AjaxResult insertInfo(@RequestBody YwMaterialsInformDTO ywMaterialsInformDTO) + { + + Boolean res = ywMaterialsInformService.insertMaterials(ywMaterialsInformDTO); + if(res) + { + return AjaxResult.success("新增物资信息数据成功"); + } + return AjaxResult.error("新增物资信息数据失败"); + + } + + @Log(title = "修改物资信息数据", businessType = BusinessType.UPDATE) + @ApiOperation("修改物资信息数据") + @PostMapping("/info/update") + public AjaxResult updateInfo(@RequestBody YwMaterialsInformDTO ywMaterialsInformDTO) + { + Boolean res = ywMaterialsInformService.updateMaterials(ywMaterialsInformDTO); + if(res) + { + return AjaxResult.success("修改物资信息数据成功"); + } + return AjaxResult.error("修改物资信息数据失败"); + + } + + + @ApiOperation("查询所有大小类") + @GetMapping("/classes/list") + public AjaxResult list() throws Exception { + + Map map = ywMaterialsClassesService.GetMaterialsClasses(); + if(ObjectUtils.isNotEmpty(map)) { + return AjaxResult.success("获取大小类数据成功", map); + } + + return AjaxResult.error("获取大小类数据失败"); + } + + @Log(title = "新增申领数据", businessType = BusinessType.INSERT) + @ApiOperation("新增申领数据") + @PostMapping("/batch/insert") + public AjaxResult insertBatch(@RequestBody YwMaterialsBatchDTO ywMaterialsBatchDTO) { + + boolean res = ywMaterialsBatchService.insertBatch(ywMaterialsBatchDTO); + + if(res) + { + return AjaxResult.success("新增申领数据成功"); + } + + return AjaxResult.error("新增申领数据失败"); + + } + + @Log(title = "修改申领数据", businessType = BusinessType.UPDATE) + @ApiOperation("修改申领数据") + @PostMapping("/batch/update") + public AjaxResult updateBatch(@RequestBody YwMaterialsBatch ywMaterialsBatch) { + + boolean res = ywMaterialsBatchService.updateBatch(ywMaterialsBatch); + + if(res) + { + return AjaxResult.success("修改申领数据成功"); + } + + return AjaxResult.error("修改申领数据失败"); + + } + + @Log(title = "删除申领数据", businessType = BusinessType.DELETE) + @ApiOperation("删除申领数据") + @PostMapping("/batch/delete") + public AjaxResult deleteBatch(@RequestBody YwMaterialsBatchDTO ywMaterialsBatchDTO) + { + + boolean res = ywMaterialsBatchService.deleteBatch(ywMaterialsBatchDTO); + + if(res) + { + return AjaxResult.success("删除申领数据成功"); + } + return AjaxResult.error("删除申领数据失败"); + } + + @ApiOperation("查询物资申领数据") + @PostMapping("/batch/list") + public TableDataInfo getBatch(@RequestBody YwMaterialsBatchDTO ywMaterialsBatchDTO) + { + if(StringUtils.isEmpty(ywMaterialsBatchDTO.getOrderId())) + { + throw new ServiceException("订单编号不允许为空"); + } + String pageNum = ServletUtils.getParameter("pageNum"); + String pageSize = ServletUtils.getParameter("pageSize"); + if(!StringUtils.isEmpty(pageNum) && !StringUtils.isEmpty(pageSize)) { + startPage(); + } + return getDataTable(ywMaterialsBatchMapper.selectBatch(ywMaterialsBatchDTO.getOrderId())); + } + + @Log(title = "新增物资串码数据", businessType = BusinessType.INSERT) + @ApiOperation("新增物资串码数据") + @PostMapping("/snList/insert") + public AjaxResult insertBatch(@RequestBody YwMaterialsSnListDTO ywMaterialsSnListDTO) { + + List roles = SecurityUtils.getLoginUser().getUser().getRoles(); + + List filterRoles = roles.stream().filter(e -> "venuestoragekeeper".equals(e.getRoleKey()) || "centerstoragechecker".equals(e.getRoleKey())).collect(Collectors.toList()); + + if(filterRoles!=null) { + if (filterRoles.isEmpty()) { + return AjaxResult.error("当前用户没有操作的权限"); + } + } + + boolean res = ywMaterialsSnListService.insertSnList(ywMaterialsSnListDTO); + + if(res) + { + return AjaxResult.success("新增串码数据成功"); + } + + return AjaxResult.error("新增串码数据失败"); + + } + + @ApiOperation("查询物资串码数据") + @PostMapping("/snList/list") + public TableDataInfo getSnList(@RequestBody YwMaterialsSnListQO ywMaterialsSnListQO) + { + String pageNum = ServletUtils.getParameter("pageNum"); + String pageSize = ServletUtils.getParameter("pageSize"); + if(!StringUtils.isEmpty(pageNum) && !StringUtils.isEmpty(pageSize)) { + startPage(); + } + return getDataTable(ywMaterialsSnListService.selectSnList(ywMaterialsSnListQO)); + } + +} + diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsInformController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsInformController.java new file mode 100644 index 0000000000000000000000000000000000000000..c6b2b68286ef3723f106883ef4c33bfd4ce248ff --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsInformController.java @@ -0,0 +1,164 @@ +package com.ruoyi.app.controller.cmcc_gm; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.domain.YwMaterialsInform; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.service.YwMaterialsInformService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.Serializable; +import java.util.List; + +/** + * 物资信息表(YwMaterialsInform)表控制层 + * + * @author lee + * @since 2023-04-14 16:35:17 + */ +@Api("物料信息") +@RestController +@RequestMapping("/app/ywMaterialsInform") +public class YwMaterialsInformController extends BaseController { + + /** + * 服务对象 + */ + @Resource + private YwMaterialsInformService ywMaterialsInformService; + + /** + * 分页查询所有数据 + * + * @param ywMaterialsInform 查询实体 + * @return 所有数据 + */ + @ApiOperation("分页查询") + @PostMapping("/list") + public TableDataInfo selectAll(@RequestBody YwMaterialsSearchDTO ywMaterialsInform) { + PageUtils.startPage(ywMaterialsInform, YwMaterialsSearchDTO.class); + return getDataTable(ywMaterialsInformService.getMaterialsBySearch(ywMaterialsInform)); + } + + /** + * 导出 + * @param ywMaterialsInform + */ + @ApiOperation("导出") + @PostMapping("/export") + public void exportRd(@RequestBody YwMaterialsSearchDTO ywMaterialsInform) { + PageUtils.startPage(ywMaterialsInform, YwMaterialsSearchDTO.class); + List list = ywMaterialsInformService.getMaterialsBySearch(ywMaterialsInform); + ExcelUtil util = new ExcelUtil<>(YwMaterialsInform.class); + util.hideColumn("sum", "reason"); + util.exportExcel(list, "物资信息导出"); + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @ApiOperation("根据id查询") + @GetMapping("{id}") + public AjaxResult selectOne(@PathVariable Serializable id) { + return AjaxResult.success(this.ywMaterialsInformService.getById(id)); + } + + /** + * 新增数据 + * + * @param ywMaterialsInform 实体对象 + * @return 新增结果 + */ + @ApiOperation("插入") + @PostMapping + public AjaxResult insert(@RequestBody YwMaterialsInform ywMaterialsInform) { + + //检查物资编号是否已经存在 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(YwMaterialsInform::getMaterialCode, ywMaterialsInform.getMaterialCode()); + + YwMaterialsInform inform = ywMaterialsInformService.getOne(query); + + if (ObjectUtils.isNotEmpty(inform)) { + throw new ServiceException("物资编号已存在"); + } + + boolean res = this.ywMaterialsInformService.save(ywMaterialsInform); + if(res) + { + ywMaterialsInformService.loadingMaterialsInfoCache(); + } + return AjaxResult.success(res); + } + + /** + * 修改数据 + * + * @param ywMaterialsInform 实体对象 + * @return 修改结果 + */ + @ApiOperation("更新") + @PutMapping + public AjaxResult update(@RequestBody YwMaterialsInform ywMaterialsInform) { + + if (ObjectUtils.isEmpty(ywMaterialsInform.getMaterialCode())) { + throw new ServiceException("物资编号不为空"); + } + + boolean res = this.ywMaterialsInformService.updateById(ywMaterialsInform); + if(res) + { + ywMaterialsInformService.loadingMaterialsInfoCache(); + } + return AjaxResult.success(); + } + + /** + * 删除数据 + * + * @param idList 主键结合 + * @return 删除结果 + */ + @ApiOperation("删除") + @DeleteMapping + public AjaxResult delete(@RequestParam("idList") List idList) { + boolean res = this.ywMaterialsInformService.removeByIds(idList); + if(res) + { + ywMaterialsInformService.loadingMaterialsInfoCache(); + } + return AjaxResult.success(); + } + + /** + * 导入 + * + * @param file excel + * @return + * @throws Exception + */ + @ApiOperation("导入") + @PostMapping("/import") + public AjaxResult doImport(@RequestPart(name = "file") MultipartFile file) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwMaterialsInform.class); + util.hideColumn("sum"); + List informs = util.importExcel(file.getInputStream()); + return ywMaterialsInformService.doImport(informs); + } + +} + diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsOrderLogController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsOrderLogController.java new file mode 100644 index 0000000000000000000000000000000000000000..5e4b052e12804db744c2275f9c49719a4dc70a40 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/cmcc_gm/YwMaterialsOrderLogController.java @@ -0,0 +1,176 @@ +package com.ruoyi.app.controller.cmcc_gm; + + +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.cmcc_gm.common.enums.OrderType; +import com.ruoyi.cmcc_gm.domain.YwMaterialsStock; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsOrderLogDTO; +import com.ruoyi.cmcc_gm.domain.dto.YwMaterialsSearchDTO; +import com.ruoyi.cmcc_gm.service.YwMaterialsOrderLogService; +import com.ruoyi.cmcc_gm.service.YwMaterialsStockService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 物资工单日志表 前端控制器 + *

+ * + * @author jkj + * @since 2023-04-07 + */ +@RestController +@RequestMapping("/app/ywMaterialsOrderLog") +public class YwMaterialsOrderLogController extends BaseController { + + @Autowired + private YwMaterialsOrderLogService ywMaterialsOrderLogService; + + @Autowired + private YwSceneMapper ywSceneMapper; + + + @Log(title = "新增物资日志记录", businessType = BusinessType.INSERT) + @ApiOperation("新增物资日志记录") + @PostMapping("/insert") + public AjaxResult insert(@RequestBody YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) + { + try + { + String res = ywMaterialsOrderLogService.insertMaterialsOrderLog(ywMaterialsOrderLogDTO); + + if(StringUtils.isNotEmpty(res)) + { + return AjaxResult.success("新增物资工单日志成功",res); + } + + return AjaxResult.error("新增物资工单日志失败"); + + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "修改物资日志记录", businessType = BusinessType.UPDATE) + @ApiOperation("修改物资日志记录") + @PostMapping("/update") + public AjaxResult update(@RequestBody YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) + { + try + { + boolean res = ywMaterialsOrderLogService.updateMaterialsOrderLog(ywMaterialsOrderLogDTO); + if(res) + { + return AjaxResult.success("修改物资日志记录成功"); + } + + return AjaxResult.error("修改物资日志记录失败"); + + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "删除物资日志记录", businessType = BusinessType.DELETE) + @ApiOperation("删除物资日志记录") + @PostMapping("/delete") + public AjaxResult remove(@RequestBody YwMaterialsOrderLogDTO ywMaterialsOrderLogDTO) + { + try + { + boolean res = ywMaterialsOrderLogService.deleteMaterialsOrderLog(ywMaterialsOrderLogDTO); + if(res) + { + return AjaxResult.success("删除物资日志记录成功"); + } + + return AjaxResult.error("删除物资日志记录失败"); + + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + } + + + @ApiOperation("获取物资日志记录") + @PostMapping("/list") + @RepeatSubmit(enable = false,interval = 1000) + public TableDataInfo list(@RequestBody YwMaterialsSearchDTO ywMaterialsSearchDTO) throws Exception { +// TableDataInfo resData = ywMaterialsOrderLogService.getMaterialsOrderLog(ywMaterialsSearchDTO); +// return getDataTable(resData.getRows(), resData.getTotal()); + + if(ObjectUtils.isEmpty(ywMaterialsSearchDTO.getOrderType())) + { + throw new ServiceException("工单类型不能为空"); + } + +// if(ObjectUtils.isEmpty(ywMaterialsSearchDTO.getInStoreId()) || ObjectUtils.isEmpty(ywMaterialsSearchDTO.getOutStoreId())) +// { +// throw new ServiceException("入库ID和出库ID不允许为空"); +// } + + //中心库和调拨不需要当前用户的所属场馆 + if(!(ywMaterialsSearchDTO.getOrderType() == OrderType.ZXK.getCode() || ywMaterialsSearchDTO.getOrderType() == OrderType.DB.getCode())) { + if (ObjectUtils.isNotEmpty(ywMaterialsSearchDTO.getInStoreId()) && ObjectUtils.isNotEmpty(ywMaterialsSearchDTO.getOutStoreId())) { + if (ywMaterialsSearchDTO.getInStoreId() == -2 || ywMaterialsSearchDTO.getOutStoreId() == -2) { + SysUser user = getLoginUser().getUser(); + if (!(user.isAdmin(user) || user.isCenter(user))) { + List list = ywSceneMapper.getVenueByUserId(user.getUserId()); + if(list.size()>0) { + List lstIds = list.stream().map(x -> x.getId()).collect(Collectors.toList()); + Long[] arr_ids = lstIds.toArray(new Long[lstIds.size()]); + if (ywMaterialsSearchDTO.getInStoreId() == -2) { + ywMaterialsSearchDTO.setInStoreIds(arr_ids); + ywMaterialsSearchDTO.setInStoreId(null); + } + if (ywMaterialsSearchDTO.getOutStoreId() == -2) { + ywMaterialsSearchDTO.setOutStoreIds(arr_ids); + ywMaterialsSearchDTO.setOutStoreId(null); + } + } + } + else + { + if (ywMaterialsSearchDTO.getInStoreId() == -2) { + ywMaterialsSearchDTO.setInStoreId(null); + } + if (ywMaterialsSearchDTO.getOutStoreId() == -2) { + ywMaterialsSearchDTO.setOutStoreId(null); + } + } + } + } + } + startPage(); + return getDataTable(ywMaterialsOrderLogService.selectMaterialsOrderLog(ywMaterialsSearchDTO)); + } + +} + diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/common/CaptchaController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/common/CaptchaController.java new file mode 100644 index 0000000000000000000000000000000000000000..551a4296b0210c7924592d31649f15c491be1212 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/common/CaptchaController.java @@ -0,0 +1,94 @@ +package com.ruoyi.app.controller.common; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.FastByteArrayOutputStream; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import com.google.code.kaptcha.Producer; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.sign.Base64; +import com.ruoyi.common.utils.uuid.IdUtils; +import com.ruoyi.system.service.ISysConfigService; + +/** + * 验证码操作处理 + * + * @author ruoyi + */ +@RestController +public class CaptchaController +{ + @Resource(name = "captchaProducer") + private Producer captchaProducer; + + @Resource(name = "captchaProducerMath") + private Producer captchaProducerMath; + + @Autowired + private RedisCache redisCache; + + @Autowired + private ISysConfigService configService; + /** + * 生成验证码 + */ + @GetMapping("/captchaImage") + public AjaxResult getCode(HttpServletResponse response) throws IOException + { + AjaxResult ajax = AjaxResult.success(); + boolean captchaEnabled = configService.selectCaptchaEnabled(); + ajax.put("captchaEnabled", captchaEnabled); + if (!captchaEnabled) + { + return ajax; + } + + // 保存验证码信息 + String uuid = IdUtils.simpleUUID(); + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; + + String capStr = null, code = null; + BufferedImage image = null; + + // 生成验证码 + String captchaType = RuoYiConfig.getCaptchaType(); + if ("math".equals(captchaType)) + { + String capText = captchaProducerMath.createText(); + capStr = capText.substring(0, capText.lastIndexOf("@")); + code = capText.substring(capText.lastIndexOf("@") + 1); + image = captchaProducerMath.createImage(capStr); + } + else if ("char".equals(captchaType)) + { + capStr = code = captchaProducer.createText(); + image = captchaProducer.createImage(capStr); + } + + redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + // 转换流信息写出 + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); + try + { + ImageIO.write(image, "jpg", os); + } + catch (IOException e) + { + return AjaxResult.error(e.getMessage()); + } + + ajax.put("uuid", uuid); + ajax.put("img", Base64.encode(os.toByteArray())); + return ajax; + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/common/CommonController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/common/CommonController.java new file mode 100644 index 0000000000000000000000000000000000000000..b4ac436d0463f211f611c42acaa2978d29f3db7f --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/common/CommonController.java @@ -0,0 +1,229 @@ +package com.ruoyi.app.controller.common; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.common.core.domain.dto.HandleDataDTO; +import com.ruoyi.common.core.domain.dto.TaskDTO; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.dto.WorkFlowDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwWireTaskLogDTO; +import com.ruoyi.eastcom_yw.domain.enums.TaskNameWithRoleEnum; +import com.ruoyi.eastcom_yw.service.CommonService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.system.service.ISysUserService; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.framework.config.ServerConfig; + +/** + * 通用请求处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/common") +public class CommonController { + private static final Logger log = LoggerFactory.getLogger(CommonController.class); + + @Autowired + private ServerConfig serverConfig; + + @Autowired + private CommonService commonService; + + @Autowired + private ISysUserService sysUserService; + + @Autowired + private ISysRoleService sysRoleService; + + @Autowired + private YwSceneService yw_sceneService; + + private static final String FILE_DELIMETER = ","; + + /** + * 通用下载请求 + * + * @param fileName 文件名称 + * @param delete 是否删除 + */ + @GetMapping("/download") + public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) { + try { + if (!FileUtils.checkAllowDownload(fileName)) { + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); + } + String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); + String filePath = RuoYiConfig.getDownloadPath() + fileName; + + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, realFileName); + FileUtils.writeBytes(filePath, response.getOutputStream()); + if (delete) { + FileUtils.deleteFile(filePath); + } + } catch (Exception e) { + log.error("下载文件失败", e); + } + } + + /** + * 自定义 Minio 服务器上传请求 + */ + @PostMapping("/uploadMinio") + public AjaxResult uploadFileMinio(MultipartFile file) throws Exception { + try { + // 上传并返回新文件名称 + String fileName = FileUploadUtils.uploadMinio(file); + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", fileName); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 通用上传请求(单个) + */ + @PostMapping("/upload") + public AjaxResult uploadFile(MultipartFile file) throws Exception { + try { + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", url); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 通用上传请求(多个) + */ + @PostMapping("/uploads") + public AjaxResult uploadFiles(List files) throws Exception { + try { + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + List urls = new ArrayList(); + List fileNames = new ArrayList(); + List newFileNames = new ArrayList(); + List originalFilenames = new ArrayList(); + for (MultipartFile file : files) { + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + urls.add(url); + fileNames.add(fileName); + newFileNames.add(FileUtils.getName(fileName)); + originalFilenames.add(file.getOriginalFilename()); + } + AjaxResult ajax = AjaxResult.success(); + ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); + ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); + ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); + ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); + return ajax; + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } + } + + /** + * 本地资源通用下载 + */ + @GetMapping("/download/resource") + public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) + throws Exception { + try { + if (!FileUtils.checkAllowDownload(resource)) { + throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); + } + // 本地资源路径 + String localPath = RuoYiConfig.getProfile(); + // 数据库资源地址 + String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); + // 下载名称 + String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); + response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); + FileUtils.setAttachmentResponseHeader(response, downloadName); + FileUtils.writeBytes(downloadPath, response.getOutputStream()); + } catch (Exception e) { + log.error("下载文件失败", e); + } + } + + @ApiOperation("查看节点详情") + @PostMapping("/taskInfo") + public AjaxResult getTaskInfo(@RequestBody WorkFlowDTO workFlowDTO) throws Exception { + HandleDataDTO handleDataDTO = new HandleDataDTO(); + handleDataDTO.setProcessInstanceId(workFlowDTO.getProcessInstanceId()); + handleDataDTO.setTaskName(workFlowDTO.getTaskName()); + JSONObject taskInfo = commonService.getTaskInfo(handleDataDTO); + String taskId = taskInfo.getString("taskId"); + String venueId = taskInfo.getString("venueId"); + String assignee = taskInfo.getString("assignee"); + String createTime = taskInfo.getString("createTime"); + String endTime = taskInfo.getString("endTime"); + String nickName = ""; + if (StrUtil.isNotBlank(assignee)) { + SysUser user = sysUserService.selectAllUserById(Long.valueOf(assignee)); + if(ObjectUtils.isNotEmpty(user)) + { + nickName = user.getNickName(); + } + } + String taskName = workFlowDTO.getTaskName(); + Long[] roleIds = TaskNameWithRoleEnum.getRoleId(taskName); + List sysUsers=new ArrayList<>(); + if (StrUtil.isNotBlank(venueId)) { + sysUsers = sysUserService.selectUserByRoleIdsAndSceneId(roleIds, Long.valueOf(venueId)); + } + AjaxResult ajax = AjaxResult.success(); + ajax.put("taskId", taskId); + ajax.put("assignee", assignee); + ajax.put("nickName", nickName); + ajax.put("createTime", createTime); + ajax.put("endTime", endTime); + ajax.put("role", TaskNameWithRoleEnum.getRoleName(taskName)); + ajax.put("sysUserList", sysUsers); + + return ajax; + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/AppBaseStationController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/AppBaseStationController.java new file mode 100644 index 0000000000000000000000000000000000000000..84a43ae8c22a1d455fd0e8987d9346133b7067a1 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/AppBaseStationController.java @@ -0,0 +1,58 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.domain.dto.MmlObjectDTO; +import com.ruoyi.eastcom_yw.service.OpenApiService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import io.swagger.annotations.Api; +import lombok.RequiredArgsConstructor; +import lombok.Synchronized; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.util.List; + +/** + * @author yqf + * @date 2023/6/5 + */ +@Api("app基站信息接口") +@RestController +@RequestMapping("/app/baseStation") +@Slf4j +@RequiredArgsConstructor +public class AppBaseStationController extends BaseController { + + private final YwSceneService ywSceneService; + private final OpenApiService openApiService; + + + /** + * 获取场馆json数据 + * + * @return + */ + @GetMapping(value = "/getJsonBySceneId") + public void getJsonBySceneId(@RequestParam Long sceneId, HttpServletRequest request, HttpServletResponse response) { + try { + ywSceneService.getJsonBySceneId(sceneId,response); + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + + /** + * 基站MML查询 + * + * @return + */ + @PostMapping(value = "/geMsgByMML") + public AjaxResult geMsgByMML(@RequestBody MmlObjectDTO mmlObjectDTO) { + return openApiService.getMsgByMML(mmlObjectDTO); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/AppKpiController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/AppKpiController.java new file mode 100644 index 0000000000000000000000000000000000000000..5e8c5c335fc152f431d0b998a1f36f3ba63f2a8a --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/AppKpiController.java @@ -0,0 +1,200 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.eastcom_yw.common.constant.KpiConstants; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiCellQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiMinQO; +import com.ruoyi.eastcom_yw.domain.qo.PmKpiVenueQO; +import com.ruoyi.eastcom_yw.domain.vo.*; +import com.ruoyi.eastcom_yw.service.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Api("app性能指标") +@RestController +@RequestMapping("/app/kpi") +@Slf4j +@RequiredArgsConstructor +public class AppKpiController extends BaseController { + + private final PmKpi4gVenueService pmKpi4gVenueService; + + private final PmKpi5gVenueService pmKpi5gVenueService; + + private final PmKpi5gCellService pmKpi5gCellService; + + private final PmKpi4gCellService pmKpi4gCellService; + + private final PmKpi4gMinService pmKpi4gMinService; + + private final PmKpi5gMinService pmKpi5gMinService; + + private final YwSceneService ywSceneService; + + /** + * 场馆级15分钟指标分页列表 + */ + @ApiOperation(value = "场馆级15分钟指标分页列表", notes = "场馆级15分钟指标分页列表") + @RequestMapping(value = "getVeueList", method = RequestMethod.POST) + public TableDataInfo getVeueList(@Validated @RequestBody PmKpiVenueQO qo) { + if(null == qo.getVenueIds() || null == qo.getVenueId()){ + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!user.isAdmin(user)) { + List ywScenes = ywSceneService.getVenueByUser(user); + Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + Integer[] sceneIds = new Integer[venueIds.length]; + for (int i = 0; i < venueIds.length; i++) { + sceneIds[i] = venueIds[i].intValue(); + } + qo.setVenueIds(sceneIds); + } + } + if (qo.getNetType().equals(KpiConstants.YW_NETTYPE_4G)) { + IPage page = pmKpi4gVenueService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } else { + IPage page = pmKpi5gVenueService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + } + + /** + * 场馆小区级15分钟指标分页列表 + */ + @ApiOperation(value = "场馆小区级15分钟指标分页列表", notes = "场馆小区级15分钟指标分页列表") + @RequestMapping(value = "getFifteenList", method = RequestMethod.POST) + public TableDataInfo getFifteenList(@Validated @RequestBody PmKpiCellQO qo) { + if(null == qo.getVenueIds() || null == qo.getVenueid()){ + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 +// List ywScenes = ywSceneService.getVenueByUser(user); +// Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); +// Integer[] sceneIds = new Integer[venueIds.length]; +// for (int i = 0; i < venueIds.length; i++) { +// sceneIds[i] = venueIds[i].intValue(); +// } +// qo.setVenueIds(sceneIds); + List lstScene = ywSceneService.getVenueByUserCanNoData(user,false); + if(!lstScene.isEmpty()) + { + Long[] venueIds = lstScene.stream().map(YwScene::getId).toArray(Long[]::new); + Integer[] sceneIds = new Integer[venueIds.length]; + for (int i = 0; i < venueIds.length; i++) { + sceneIds[i] = venueIds[i].intValue(); + } + qo.setVenueIds(sceneIds); + } + } + if (qo.getNetType().equals(KpiConstants.YW_NETTYPE_4G)) { + if(null == qo.getSortcol() || qo.getSortcol().equals("")){ + qo.setSortcol("starttime"); + } + if(null == qo.getSort() || qo.getSort().equals("")){ + qo.setSortcol("desc"); + } + IPage page = pmKpi4gCellService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } else { + if(null == qo.getSortcol() || qo.getSortcol().equals("")){ + qo.setSortcol("starttime"); + } + if(null == qo.getSort() || qo.getSort().equals("")){ + qo.setSortcol("desc"); + } + IPage page = pmKpi5gCellService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + } + + + /** + * 场馆小区级1分钟指标分页列表 + */ + @ApiOperation(value = "场馆小区级1分钟指标分页列表", notes = "场馆小区级1分钟指标分页列表") + @RequestMapping(value = "getOneMinList", method = RequestMethod.POST) + public TableDataInfo getOneMinList(@Validated @RequestBody PmKpiMinQO qo) { + if(null == qo.getVenueIds() || null == qo.getVenueid()){ + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!user.isAdmin(user)) { + List ywScenes = ywSceneService.getVenueByUser(user); + Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + Integer[] sceneIds = new Integer[venueIds.length]; + for (int i = 0; i < venueIds.length; i++) { + sceneIds[i] = venueIds[i].intValue(); + } + qo.setVenueIds(sceneIds); + } + } + + if (qo.getNetType().equals(KpiConstants.YW_NETTYPE_4G)) { + if(null == qo.getSortcol() || qo.getSortcol().equals("")){ + qo.setSortcol("时间"); + } + if(null == qo.getSort() || qo.getSort().equals("")){ + qo.setSortcol("desc"); + } + IPage page = pmKpi4gMinService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } else { + if(null == qo.getSortcol() || qo.getSortcol().equals("")){ + qo.setSortcol("时间"); + } + if(null == qo.getSort() || qo.getSort().equals("")){ + qo.setSortcol("desc"); + } + IPage page = pmKpi5gMinService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + } + + + /** + * 获取4G最新有数据的时间 + * + * @return + */ + @GetMapping(value = "/getLastTime") + public AjaxResult getLastTime(@RequestParam String type){ + Integer[] sceneIds = null; + Map lastTime = new HashMap<>(); + + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + if (!user.isAdmin(user)) { + List ywScenes = ywSceneService.getVenueByUser(user); + Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + sceneIds = new Integer[venueIds.length]; + for (int i = 0; i < venueIds.length; i++) { + sceneIds[i] = venueIds[i].intValue(); + } + } + if(type.equals("4G")){ + lastTime = pmKpi4gVenueService.get4gVenueLastTime(sceneIds); + }else { + lastTime = pmKpi5gVenueService.get5gVenueLastTime(sceneIds); + } + return success(lastTime); + + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/AppVersionController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/AppVersionController.java new file mode 100644 index 0000000000000000000000000000000000000000..55b585b5999bd2354802e36445a1784009776495 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/AppVersionController.java @@ -0,0 +1,30 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.eastcom_yw.domain.AppVersionConfig; +import com.ruoyi.eastcom_yw.service.AppVersionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api("app版本更新管理") +@RestController +@RequestMapping("/app/version") +public class AppVersionController extends BaseController { + + @Autowired + private AppVersionService appVersionService; + + @ApiOperation("获取更新配置") + @GetMapping("/config") + public TableDataInfo getConfig() { + List list = appVersionService.list(); + return getDataTable(list, (long) list.size()); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/PersonalCenterController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/PersonalCenterController.java new file mode 100644 index 0000000000000000000000000000000000000000..6245b04f2eb8a6bced313ce0936a5ff6022b9b6f --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/PersonalCenterController.java @@ -0,0 +1,142 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import cn.hutool.core.util.StrUtil; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysAppMenu; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.ISysAppMenuService; +import com.ruoyi.system.service.ISysDictDataService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/app/personalCenter") +public class PersonalCenterController extends BaseController { + + @Resource + private ISysAppMenuService appMenuService; + + @Autowired + private YwSceneService yw_sceneService; + + + + @Autowired + private ISysDictDataService dictDataService; + + /** + * 根据当前登录用户拥有权限获取更多中菜单列表(sys_app_menu) + */ + @GetMapping("/list") + public AjaxResult list(SysAppMenu menu) { + menu.setVisible("0"); + List menus = appMenuService.selectMenuList(menu, getUserId()); + //新增用户是否已添加应用标记 + List customMenus = appMenuService.selectCustomList(getUserId()); + for (SysAppMenu sysAppMenu : menus) { + for (SysAppMenu customMenu : customMenus) { + if (customMenu.getMenuId().equals(sysAppMenu.getMenuId())) { + sysAppMenu.setIsAdd(1); + } + } + } + + + List tree = appMenuService.buildMenuTree(menus); + return success(tree); + } + + /** + * 获取个人定制菜单列表(sys_app_user_menu) + */ + @GetMapping("/customList") + @RepeatSubmit(enable = false, interval = 1000) + public AjaxResult customList() { + //获取用户自定义展示菜单 + List menus = appMenuService.selectCustomList(getUserId()); + return success(menus); + } + + /** + * 更改个人定制菜单列表(sys_app_user_menu) + */ + @PostMapping("/updateCustomList") + public AjaxResult updateCustomList(@RequestBody List menuIds) { + appMenuService.updateCustomList(getUserId(), menuIds); + return success(); + } + + /** + * 获取当前登录用户场馆 + */ + @GetMapping("/getYwScene") + @RepeatSubmit(enable = false, interval = 1000) + public AjaxResult getYwScene(@RequestParam(required = false) String cityId, @RequestParam(required = false) String countyId) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + List ywScenes = yw_sceneService.getVenueByUser(user); + if (StrUtil.isNotBlank(cityId)) { + ywScenes = ywScenes.stream().filter(l -> cityId.equals(l.getCityId())).collect(Collectors.toList()); + } + if (StrUtil.isNotBlank(countyId)) { + ywScenes = ywScenes.stream().filter(l -> countyId.equals(l.getAreaCountyId())).collect(Collectors.toList()); + } + return success(ywScenes); + } + + /** + * 获取当前登录区县 + */ + @GetMapping("/getCounty") + @RepeatSubmit(enable = false, interval = 1000) + public AjaxResult getCounty(@RequestParam String cityId) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (SecurityUtils.isAdmin(user.getUserId())) { + List countyList = dictDataService.selectDictLabelByValues("yw_county", null); + countyList = countyList.stream().filter(l -> cityId.equals(l.getDictValue().substring(0, 4))).collect(Collectors.toList()); + return success(countyList); + } + //场馆集合 + List ywScenes = yw_sceneService.getVenueByUser(user); + //区县集合 + List countyIds = ywScenes.stream().map(YwScene::getAreaCountyId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); + List countyList = dictDataService.selectDictLabelByValues("yw_county", countyIds); + + if (StrUtil.isNotBlank(cityId)) { + countyList = countyList.stream().filter(l -> cityId.equals(l.getDictValue().substring(0, 4))).collect(Collectors.toList()); + } + return success(countyList); + } + + /** + * 获取当前登录用户地市 + */ + @GetMapping("/getCity") + @RepeatSubmit(enable = false, interval = 1000) + public AjaxResult getCity() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (SecurityUtils.isAdmin(user.getUserId())) { + return success(dictDataService.selectDictLabelByValues("yw_city", null)); + } + //场馆集合 + List ywScenes = yw_sceneService.getVenueByUser(user); + //区县集合 + List countyIds = ywScenes.stream().map(YwScene::getAreaCountyId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); + //地市集合 + List cityIds = countyIds.stream().map(l -> l.substring(0, 4)).distinct().collect(Collectors.toList()); + List cityList = dictDataService.selectDictLabelByValues("yw_city", cityIds); + return success(cityList); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/SysNoticeController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/SysNoticeController.java new file mode 100644 index 0000000000000000000000000000000000000000..b3b827e78e6c724a4e26bd8126e13efbca2ed81b --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/SysNoticeController.java @@ -0,0 +1,124 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.domain.dto.SysNoticeDTO; +import com.ruoyi.eastcom_yw.domain.qo.SysNoticeQO; +import com.ruoyi.eastcom_yw.domain.vo.SysNoticeVO; +import com.ruoyi.eastcom_yw.service.SysNoticeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + *

+ * 通知公告表 前端控制器 + *

+ * + * @author ck + * @since 2023-04-14 + */ +@Api(tags = "通知公告表") +@RestController +@RequestMapping("/app/sysNotice") +@Slf4j +@RequiredArgsConstructor +public class SysNoticeController extends BaseController { + + private final SysNoticeService sysNoticeService; + + /** + * 通知公告表列表 + */ + @ApiOperation(value = "通知公告表列表", notes = "通知公告表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody SysNoticeQO qo) { + List list = sysNoticeService.getData(qo); + return getDataTable(list); + } + + + /** + * 通知公告表分页列表 + */ + @ApiOperation(value = "通知公告表分页列表", notes = "通知公告表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody SysNoticeQO qo) { + IPage page = sysNoticeService.getDataByPage(qo); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 获取通知公告表详情 + */ + @ApiOperation(value = "通知公告表详情", notes = "通知公告表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(sysNoticeService.fetchById(id)); + } + + /** + * 新增或修改通知公告表 + */ + @Log(title = "新增或修改通知公告表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改通知公告表", notes = "新增或修改通知公告表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated SysNoticeDTO dto) { + sysNoticeService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除通知公告表 + */ + @Log(title = "根据id删除通知公告表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除通知公告表", notes = "根据id删除通知公告表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + sysNoticeService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除通知公告表 + */ + @Log(title = "根据id批量删除通知公告表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除通知公告表", notes = "根据id批量删除通知公告表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + sysNoticeService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "通知公告表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(SysNotice.class); + List list = util.importExcel(file.getInputStream()); + sysNoticeService.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * 通知公告表导出 + */ + @ApiOperation(value = "通知公告表导出") + @PostMapping(value = "/export") + public void export(@RequestBody SysNoticeQO qo) { + sysNoticeService.export(qo); + } + +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/WeatherController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/WeatherController.java new file mode 100644 index 0000000000000000000000000000000000000000..e8dda438e74e7209141681dc23d7fb4a339b5641 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/WeatherController.java @@ -0,0 +1,29 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.service.WeatherService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api("爬取天气数据") +@RestController +@RequestMapping("/app/weather") +public class WeatherController { + + @Autowired + private WeatherService weatherService; + + /** + * 获取场馆天气详情 + */ + @ApiOperation(value = "获取场馆天气详情", notes = "获取场馆天气详情") + @GetMapping(value = "/fetchById/{venueId}") + public AjaxResult fetchById(@PathVariable Long venueId) { + return AjaxResult.success(weatherService.fetchById(venueId)); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwAlarmController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwAlarmController.java new file mode 100644 index 0000000000000000000000000000000000000000..8cc6957d5cce3de63ed03c9f4a678e3bcc7c68ff --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwAlarmController.java @@ -0,0 +1,704 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.github.pagehelper.PageHelper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.dto.HandleDataDTO; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.common.constant.AlarmConstants; +import com.ruoyi.eastcom_yw.domain.*; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmDTONoPage; +import com.ruoyi.eastcom_yw.domain.dto.YwAlarmHangupLogDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmLastVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmNewNumVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmViewVo; +import com.ruoyi.eastcom_yw.domain.vo.YwAlarmVo; +import com.ruoyi.eastcom_yw.mapper.YwAlarmMapper; +import com.ruoyi.eastcom_yw.mapper.yw_alarm_deal_logMapper; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.generator.util.GenUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.http.util.EntityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import com.ruoyi.eastcom_yw.common.constant.CacheConstants; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * + * @author jkj + * @since 2023-01-12 + */ + +@Api("告警信息管理") +@RestController +@RequestMapping("/app/alarm") +public class YwAlarmController extends BaseController { + + @Autowired + private YwAlarmViewService ywAlarmViewService; + + @Autowired + private YwAlarmDHService ywAlarmDHService; + + @Autowired + private YwAlarmCSService ywAlarmCSService; + + @Autowired + private YwAlarmWXService ywAlarmWXService; + + @Autowired + private YwSceneService yw_sceneService; + + @Autowired + private YwAlarmService ywAlarmService; + + @Autowired + private YwAlarmHangupLogService ywAlarmHangupLogService; + + @Autowired + private YwAlarmOprateLogService ywAlarmOprateLogService; + + @Autowired + private RedisCache redisCache; + + @Autowired + private yw_alarm_deal_logMapper alarm_deal_logMapper; + + @Autowired + private HmAlarmDeriveService hmAlarmDeriveService; + + @ApiOperation("根据条件获取告警") + @PostMapping("/appList") + public TableDataInfo newlist2(@RequestBody YwAlarmDTO alarmDTO) + { + alarmDTO.setIsAPP(true); + SysUser user = getLoginUser().getUser(); + alarmDTO.setUserId(user.getUserId()); + if(ObjectUtils.isNotEmpty(alarmDTO.getIsRefresh())) + { + //1自动刷新,0是手动刷新 + if(0==alarmDTO.getIsRefresh()) { + //如果是用户点击的查询,保存当前用户查询的场馆,便于用户重新登录后自动勾选场馆查询 + redisCache.setCacheObject(CacheConstants.YW_ALARM_LAST_VENUES + getUserId(), alarmDTO.getVenues(), 3, TimeUnit.DAYS); + } + } + + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (alarmDTO.getVenues().size()==0) { +// boolean isAll= user.isAdmin(user); +// alarmDTO.setIsAll(isAll); +// if(!isAll) { +// List venueList = new ArrayList(); +// yw_sceneService.getVenueByUser(user).forEach( +// venue -> { +// venueList.add(venue.getId()); +// } +// ); +// alarmDTO.setVenues(venueList); +// } + List lstScene = yw_sceneService.getVenueByUserCanNoData(user,false); + + if(lstScene.isEmpty()) + { + alarmDTO.setIsAll(true); + } + + if(!lstScene.isEmpty()) + { + List venueList = new ArrayList(); + for(YwScene ywScene : lstScene) { + venueList.add(ywScene.getId()); + } + alarmDTO.setVenues(venueList); + } + } + + TableDataInfo resData = null; + if(!alarmDTO.getAlarmType().isEmpty()) + { + if(GenUtils.arraysContains(AlarmConstants.ALARMS,alarmDTO.getAlarmType())) + { + + String siteType = alarmDTO.getSiteType(); + + if(!"wx".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setSiteType(null); + } + + List list = null; + try { + list = ywAlarmViewService.getYwAlarmByDto(alarmDTO); + } + catch (Exception ex) + { + throw new ServiceException(ex.getMessage()); + } + resData = getDataTable(list); + HashMap alarmNewNum =new HashMap<>(); + YwAlarmDTONoPage alarmNoPage = new YwAlarmDTONoPage(); + BeanUtils.copyBeanProp(alarmNoPage, alarmDTO); + + alarmNoPage.setSiteType(siteType); + alarmNoPage.setAlarmType("wx"); + alarmNewNum.put("wx",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + + //其它类型没有网络类型 + alarmNoPage.setSiteType(null); + + alarmNoPage.setAlarmType("cs"); + alarmNewNum.put("cs",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("dh"); + alarmNewNum.put("dh",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("agis"); + alarmNewNum.put("agis",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("wifi"); + alarmNewNum.put("wifi",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("voip"); + alarmNewNum.put("voip",ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + resData.setMaps(alarmNewNum); + return resData; + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + @ApiOperation("根据条件获取告警") + @PostMapping("/newlist") + public TableDataInfo newlist3(@RequestBody YwAlarmDTO alarmDTO) + { + alarmDTO.setIsAPP(true); + SysUser user = getLoginUser().getUser(); + alarmDTO.setUserId(user.getUserId()); + if(ObjectUtils.isNotEmpty(alarmDTO.getIsRefresh())) + { + //1自动刷新,0是手动刷新 + if(0==alarmDTO.getIsRefresh()) { + //如果是用户点击的查询,保存当前用户查询的场馆,便于用户重新登录后自动勾选场馆查询 + redisCache.setCacheObject(CacheConstants.YW_ALARM_LAST_VENUES + getUserId(), alarmDTO.getVenues(), 3, TimeUnit.DAYS); + } + } + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (alarmDTO.getVenues().size()==0) { + List lstScene = yw_sceneService.getVenueByUserCanNoData(user,false); + + if(lstScene.isEmpty()) + { + alarmDTO.setIsAll(true); + } + + if(!lstScene.isEmpty()) + { + List venueList = new ArrayList(); + for(YwScene ywScene : lstScene) { + venueList.add(ywScene.getId()); + } + alarmDTO.setVenues(venueList); + } + } + TableDataInfo resData = null; + + if(!alarmDTO.getAlarmType().isEmpty()) + { + if("tel".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setAlarmType("voip"); + } + if(GenUtils.arraysContains(AlarmConstants.ALARMS,alarmDTO.getAlarmType())) + { + if(alarmDTO.getPageNum()<=0) + { + alarmDTO.setPageNum(1); + } + if(alarmDTO.getPageSize()<=0) + { + alarmDTO.setPageSize(10); + } + String siteType = alarmDTO.getSiteType(); + + if(!"wx".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setSiteType(null); + } + + List list = null; + try { + list = ywAlarmViewService.getYwAlarmByDto(alarmDTO); + } + catch (Exception ex) + { + throw new ServiceException("告警查询异常"); + } + resData = getDataTable(list); + return resData; + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + + @ApiOperation("根据条件未恢复告警数量") + @PostMapping("/num") + public AjaxResult newlistNum(@RequestBody YwAlarmDTO alarmDTO) { + + alarmDTO.setIsAPP(true); + SysUser user = getLoginUser().getUser(); + alarmDTO.setUserId(user.getUserId()); + + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (alarmDTO.getVenues().size() == 0) { + List lstScene = yw_sceneService.getVenueByUserCanNoData(user,false); + + if(lstScene.isEmpty()) + { + alarmDTO.setIsAll(true); + } + + if(!lstScene.isEmpty()) + { + List venueList = new ArrayList(); + for(YwScene ywScene : lstScene) { + venueList.add(ywScene.getId()); + } + alarmDTO.setVenues(venueList); + } + } + if (!alarmDTO.getAlarmType().isEmpty()) { + if ("tel".equals(alarmDTO.getAlarmType())) { + alarmDTO.setAlarmType("voip"); + } + if (GenUtils.arraysContains(AlarmConstants.ALARMS, alarmDTO.getAlarmType())) { + + String siteType = alarmDTO.getSiteType(); + + if(!"wx".equals(alarmDTO.getAlarmType())) + { + alarmDTO.setSiteType(null); + } + + HashMap alarmNewNum = new HashMap<>(); + if ("0".equals(alarmDTO.getAlarmStatus())) { + + YwAlarmDTONoPage alarmNoPage = new YwAlarmDTONoPage(); + BeanUtils.copyBeanProp(alarmNoPage, alarmDTO); + alarmNoPage.setSiteType(siteType); + alarmNoPage.setAlarmType("wx"); + alarmNewNum.put("wx", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + //其它类型没有网络类型 + alarmNoPage.setSiteType(null); + alarmNoPage.setAlarmType("cs"); + alarmNewNum.put("cs", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("dh"); + alarmNewNum.put("dh", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("agis"); + alarmNewNum.put("agis", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("wifi"); + alarmNewNum.put("wifi", ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage)); + alarmNoPage.setAlarmType("voip"); + Long voipNum = ywAlarmViewService.getYwAlarmNewNumByDto(alarmNoPage); + alarmNewNum.put("voip", voipNum); + //前端用的是tel + alarmNewNum.put("tel", voipNum); + } else { + alarmNewNum.put("cs", 0L); + alarmDTO.setAlarmType("dh"); + alarmNewNum.put("dh", 0L); + alarmDTO.setAlarmType("wx"); + alarmNewNum.put("wx", 0L); + alarmDTO.setAlarmType("agis"); + alarmNewNum.put("agis", 0L); + alarmDTO.setAlarmType("wifi"); + alarmNewNum.put("wifi", 0L); + alarmDTO.setAlarmType("voip"); + alarmNewNum.put("voip", 0L); + } + return AjaxResult.success(alarmNewNum); + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + + + @ApiOperation("根据条件获取告警") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwAlarmDTO alarmDTO) + { + alarmDTO.setIsAPP(true); + SysUser user = getLoginUser().getUser(); +// SysUser user = new SysUser(); +// user.setUserId(10L); + if(ObjectUtils.isNotEmpty(alarmDTO.getIsRefresh())) + { + //1自动刷新,0是手动刷新 + if(0==alarmDTO.getIsRefresh()) { + //如果是用户点击的查询,保存当前用户查询的场馆,便于用户重新登录后自动勾选场馆查询 + redisCache.setCacheObject(CacheConstants.YW_ALARM_LAST_VENUES + getUserId(), alarmDTO.getVenues(), 3, TimeUnit.DAYS); + } + } + + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (CollUtil.isEmpty(alarmDTO.getVenues())) { + boolean isAll= user.isAdmin(user); + alarmDTO.setIsAll(isAll); + if(!isAll) { + List venueList = new ArrayList(); + yw_sceneService.getVenueByUser(user).forEach( + venue -> { + venueList.add(venue.getId()); + } + ); + alarmDTO.setVenues(venueList); + } + } + + TableDataInfo resData = null; + if(!alarmDTO.getAlarmType().isEmpty()) + { + if(GenUtils.arraysContains(AlarmConstants.ALARMS,alarmDTO.getAlarmType())) + { + List list = ywAlarmViewService.getYwAlarmByDto(alarmDTO); + resData = getDataTable(list); + HashMap alarmNewNum =new HashMap<>(); + alarmDTO.setPageNum(1); + alarmDTO.setAlarmType("cs"); + alarmNewNum.put("cs",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + alarmDTO.setAlarmType("dh"); + alarmNewNum.put("dh",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + alarmDTO.setAlarmType("wx"); + alarmNewNum.put("wx",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + alarmDTO.setAlarmType("agis"); + alarmNewNum.put("agis",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + resData.setMaps(alarmNewNum); + return resData; + } + throw new ServiceException("告警类型未接入"); + } + throw new ServiceException("告警类型不允许为空"); + } + + + @ApiOperation("根据条件获取告警角标数量") + @PostMapping("/appNumList") + public TableDataInfo numList(@RequestBody YwAlarmDTO alarmDTO) + { + alarmDTO.setIsAPP(true); + SysUser user = getLoginUser().getUser(); +// SysUser user = new SysUser(); +// user.setUserId(10L); + if(ObjectUtils.isNotEmpty(alarmDTO.getIsRefresh())) + { + //1自动刷新,0是手动刷新 + if(0==alarmDTO.getIsRefresh()) { + //如果是用户点击的查询,保存当前用户查询的场馆,便于用户重新登录后自动勾选场馆查询 + redisCache.setCacheObject(CacheConstants.YW_ALARM_LAST_VENUES + getUserId(), alarmDTO.getVenues(), 3, TimeUnit.DAYS); + } + } + + //如果没有传入场馆就用当前登录用户的配置的场馆 + if (CollUtil.isEmpty(alarmDTO.getVenues())) { + boolean isAll= user.isAdmin(user); + alarmDTO.setIsAll(isAll); + if(!isAll) { + List venueList = new ArrayList(); + yw_sceneService.getVenueByUser(user).forEach( + venue -> { + venueList.add(venue.getId()); + } + ); + alarmDTO.setVenues(venueList); + } + } + + alarmDTO.setUserId(user.getUserId()); + //获取告警数据 + alarmDTO.setPageNum(1); + HashMap alarmNewNum =new HashMap<>(); + alarmDTO.setAlarmType("cs"); + alarmNewNum.put("cs",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + alarmDTO.setAlarmType("dh"); + alarmNewNum.put("dh",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + alarmDTO.setAlarmType("wx"); + alarmNewNum.put("wx",ywAlarmViewService.getYwAlarmNewNumByDto(alarmDTO)); + TableDataInfo tableDataInfo = new TableDataInfo(); + tableDataInfo.setMaps(alarmNewNum); + return tableDataInfo; + } + + @ApiOperation("根据用户ID获取最新的告警数量") + @PostMapping("/newAlarmNum") + public AjaxResult newAlarmNum(@RequestBody YwAlarmDTO alarmDTO) + { + //20230316 jkj 管理员类的不加判断场馆的条件,所有场馆的数据 + SysUser user = getLoginUser().getUser(); + + //获取告警数据 + List ywAlarmNewNumVos= ywAlarmViewService.GetNewAlarmNum(user.getUserId(),user.isAdmin(user)); + + return AjaxResult.success("操作成功",JSONObject.toJSONString(ywAlarmNewNumVos)); + + + } + + @ApiOperation("根据组号获取最新告警数据") + @PostMapping("/alarmGroup") + public TableDataInfo alarmGroup(@RequestBody YwAlarmDTO alarmDTO) + { + return getDataTable(ywAlarmViewService.getYwAlarmLessList(alarmDTO.getAlarmType(),alarmDTO.getAlarmGroup())); + } + + + @ApiOperation("根据用户ID获取最新的告警数量") + @GetMapping("/newAlarmNum/{userId}") + public AjaxResult newAlarmNum(@PathVariable String userId) + { + +// Long longUserId=Long.parseLong(userId); + //20230316 jkj 管理员类的不加判断场馆的条件,所有场馆的数据 + SysUser user = getLoginUser().getUser(); + + //获取告警数据 + List ywAlarmNewNumVos= ywAlarmViewService.GetNewAlarmNum(user.getUserId(),user.isAdmin(user)); + + return AjaxResult.success("操作成功",JSONObject.toJSONString(ywAlarmNewNumVos)); + + + } + + + @ApiOperation("根据processId获取告警详情") + @GetMapping("/info/{processId}") + public TableDataInfo info(@PathVariable String processId) + { + return getDataTable(ywAlarmViewService.GetAlarmInfoList(processId)); + } + + @ApiOperation("根据GroupId获取告警详情") + @GetMapping("/info/group/{groupId}") + public TableDataInfo infoByGroup(@PathVariable String groupId) + { + return getDataTable(ywAlarmViewService.getYwAlarmInfoListByGroup(groupId)); + } + + @Log(title = "告警挂起记录", businessType = BusinessType.INSERT) + @ApiOperation("根据条件新增告警挂起的记录") + @PostMapping("/insert/hanguplog") + public AjaxResult list(@RequestBody YwAlarmHangupLogDTO ywAlarmHangupLogDTO) throws Exception + { + try + { + if(ObjectUtils.isEmpty(ywAlarmHangupLogDTO.getHangupUserId())) + { + SysUser user = getLoginUser().getUser(); + ywAlarmHangupLogDTO.setHangupUserId(user.getUserId()); + } + if(ywAlarmHangupLogService.insertYwAlarmHangupLog(ywAlarmHangupLogDTO)) + { + return AjaxResult.success(); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + return AjaxResult.error(); + } + + @ApiOperation("获取告警问题") + @GetMapping("/question") + public TableDataInfo getAlarmQuestion(String spec) + { + return getDataTable(ywAlarmService.getYwAlarmQuestionList(spec)); + } + + @ApiOperation("告警操作") + @PostMapping("/operate") + public AjaxResult add(@RequestBody YwAlarmOprateLog ywAlarmOprateLog) + { + if(ywAlarmOprateLogService.saveOrUpdate(ywAlarmOprateLog)){ + return success(); + } + return error(); + } + + @ApiOperation("告警回填反馈人和反馈时间") + @PostMapping("/feedback") + public AjaxResult feedback(@RequestBody YwAlarmDTO ywAlarmDTO) + { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + yw_alarm_deal_log yw_alarm_deal_log =new yw_alarm_deal_log(); + yw_alarm_deal_log.setDealUser(ywAlarmDTO.getDealUser()); + yw_alarm_deal_log.setDealStatus(ywAlarmDTO.getDealStatus()); + updateWrapper.eq("flw_processid", ywAlarmDTO.getProcessId()); + if(alarm_deal_logMapper.update(yw_alarm_deal_log,updateWrapper)>0){ + return success(); + } + return error(); + } + + + @ApiOperation("获取告警数据") + @PostMapping("/getYwAlarmAll") + public TableDataInfo getYwAlarmAll(@RequestBody YwAlarmDTO ywAlarmDTO) + { + startPage(); + List list = ywAlarmViewService.getYwAlarmList(ywAlarmDTO.getAlarmType(),ywAlarmDTO.getVenueName(),ywAlarmDTO.getStartTime(),ywAlarmDTO.getEndTime()); + return getDataTable(list); + } + + @Log(title = "用户手工恢复告警", businessType = BusinessType.INSERT) + @ApiOperation("告警恢复时间") + @PostMapping("/alarmClear") + public AjaxResult alarmClear(@RequestBody YwAlarmDTO alarmDTO) + { + boolean res = ywAlarmService.YwAlarmClear(alarmDTO); + if(res) + { + return success(); + } + return error(); + } + + @Log(title = "告警记录", businessType = BusinessType.UPDATE) + @ApiOperation("告警记录") + @PostMapping("/record") + public AjaxResult record(@RequestBody YwAlarmDTO ywAlarmDTO) + { + if(ObjectUtils.isEmpty(ywAlarmDTO.getRecord())) + { + return AjaxResult.error("记录内容不允许为空"); + } + // String text_record = ywAlarmDTO.getRecords().stream().collect(Collectors.joining("##@##")); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + yw_alarm_deal_log yw_alarm_deal_log =new yw_alarm_deal_log(); + yw_alarm_deal_log.setRecord(ywAlarmDTO.getRecord()); + updateWrapper.eq("group_id", ywAlarmDTO.getAlarmId()); + updateWrapper.eq("is_new","0"); + if(alarm_deal_logMapper.update(yw_alarm_deal_log,updateWrapper)>0){ + return success(); + } + return error(); + } + + @ApiOperation("告警阶段处理记录查询") + @GetMapping("/record") + public AjaxResult recordList(YwAlarmDTO ywAlarmDTO) + { + if(ObjectUtils.isEmpty(ywAlarmDTO.getAlarmId())) + { + return AjaxResult.error("告警编号不允许为空"); + } + if(ObjectUtils.isEmpty(ywAlarmDTO.getAlarmType())) + { + return AjaxResult.error("告警类型不允许为空"); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("group_id", ywAlarmDTO.getAlarmId()); + queryWrapper.eq("alarm_type",ywAlarmDTO.getAlarmType()); + List lstDealLog = alarm_deal_logMapper.selectList(queryWrapper); + return AjaxResult.success(lstDealLog); + } + + @Log(title = "批量告警记录阶段处理", businessType = BusinessType.UPDATE) + @ApiOperation("批量告警记录阶段处理") + @PostMapping("/recordBatch") + public AjaxResult recordBatch(@RequestBody YwAlarmDTO ywAlarmDTO) + { + if(ObjectUtils.isEmpty(ywAlarmDTO.getAlarmIds()) || ObjectUtils.isEmpty(ywAlarmDTO.getStepInfo())) + { + return AjaxResult.error("缺少处理的参数"); + } + + if(ywAlarmDTO.getAlarmIds().length == 0) + { + return AjaxResult.error("alarmIds没有值"); + } + + if(StringUtils.isEmpty(ywAlarmDTO.getStepInfo().getTitle())||StringUtils.isEmpty(ywAlarmDTO.getStepInfo().getInfo())) + { + return AjaxResult.error("stepInfo没有值"); + } + + for(Long alarmId : ywAlarmDTO.getAlarmIds()) + { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("group_id", alarmId); + queryWrapper.eq("is_new","0"); + List lstAlarm = alarm_deal_logMapper.selectList(queryWrapper); + if(lstAlarm.isEmpty()) + { + continue; + } + String record = lstAlarm.get(0).getRecord(); + JSONArray arrayRecord = new JSONArray(); + if(StringUtils.isNotEmpty(record)) + { + arrayRecord = JSONArray.parseArray(record); + } + JSONObject jsonRecord = new JSONObject(); + jsonRecord.put("title",ywAlarmDTO.getStepInfo().getTitle()); + jsonRecord.put("info",ywAlarmDTO.getStepInfo().getInfo()); + arrayRecord.add(jsonRecord); + record = JSONArray.toJSONString(arrayRecord); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + yw_alarm_deal_log yw_alarm_deal_log =new yw_alarm_deal_log(); + yw_alarm_deal_log.setRecord(record); + updateWrapper.eq("group_id", alarmId); + updateWrapper.eq("is_new","0"); + alarm_deal_logMapper.update(yw_alarm_deal_log,updateWrapper); + } + return success(); + } + + @ApiOperation("查询亚运衍生告警") + @PostMapping("/hmAlarmDerive/list") + public TableDataInfo derivelist(@RequestBody YwAlarmDTO alarmDTO) { + startPage(); + return getDataTable(hmAlarmDeriveService.getAlarmDerive(alarmDTO)); + } + + + @ApiOperation("查询亚运衍生告警") + @PostMapping("/hmAlarmDerive/export") + public void deriveExport(@RequestBody YwAlarmDTO alarmDTO) throws IllegalAccessException { + alarmDTO.setPageNum(1); + alarmDTO.setPageSize(Integer.MAX_VALUE); + List list = hmAlarmDeriveService.getAlarmDerive(alarmDTO); + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + ExcelUtil util = new ExcelUtil(HmAlarmDerive.class); + util.exportExcel(response, list, "亚运事件告警"); + } + +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwContactBookController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwContactBookController.java new file mode 100644 index 0000000000000000000000000000000000000000..f5d0f5431e2a76a243c896626b399e6507a87e82 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwContactBookController.java @@ -0,0 +1,115 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.mapper.YwSceneBigConfigMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneMapper; +import com.ruoyi.eastcom_yw.mapper.YwSceneUserMapper; +import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.mapper.SysDictDataMapper; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.mapper.SysUserRoleMapper; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 通讯录 前端控制器 + *

+ * + * @author ck + * @since 2023-08-28 + */ +@Api(tags = "通讯录") +@RestController +@RequestMapping("/app/ywContactBook") +@Slf4j +@RequiredArgsConstructor +public class YwContactBookController extends BaseController { + + + private final YwSceneMapper ywSceneMapper; + private final YwSceneBigConfigMapper ywSceneBigConfigMapper; + private final YwSceneUserMapper ywSceneUserMapper; + private final SysUserMapper sysUserMapper; + private final SysUserRoleMapper sysUserRoleMapper; + private final SysDictDataMapper sysDictDataMapper; + + /** + * 场馆列表 + */ + @ApiOperation(value = "场馆列表", notes = "场馆列表") + @GetMapping(value = "venueList") + public TableDataInfo venueList(@RequestParam String cityId, @RequestParam String venueType, @RequestParam Long pageNum, @RequestParam Long pageSize) { + + Long sceneBigId = ywSceneBigConfigMapper.selectCurrentBig(); + if(sceneBigId==null){ + throw new ServiceException("当前没有大场景,请在场景配置配置一条当前状态的场景"); + } + + Page page = ywSceneMapper.selectPage(new Page<>(pageNum, pageSize), new LambdaQueryWrapper() + .eq(YwScene::getCityId, cityId) + .eq(YwScene::getVenueType, venueType) + .eq(YwScene::getSceneBigId,sceneBigId) + .orderByAsc(YwScene::getVenueName) + ); + return getDataTable(page.getRecords(), page.getTotal()); + } + + /** + * 人员列表 + */ + @ApiOperation(value = "人员列表", notes = "人员列表") + @GetMapping(value = "userList") + public TableDataInfo userList(@RequestParam(required = false) String keywords, @RequestParam(required = false) Long sceneId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) { + + PageHelper.startPage(pageNum, pageSize); + List sysUsers = sysUserMapper.selectUserByKeywords(keywords, sceneId); + for (SysUser sysUser : sysUsers) { + List sysUserRoles = sysUserRoleMapper.selectRoleByUserId(sysUser.getUserId()); + List roles = sysUserRoles.stream().map(SysUserRole::getRoleName).collect(Collectors.toList()); + String label = sysDictDataMapper.selectDictLabel("yw_specialty", sysUser.getUserType()); + sysUser.setUserTypeStr(label); + sysUser.setRoleNames(roles); + } + PageInfo pageInfo = PageInfo.of(sysUsers); + return getDataTable(pageInfo.getList(), pageInfo.getTotal()); + } + + /** + * 人员详情 + */ + @ApiOperation(value = "人员详情", notes = "人员详情") + @GetMapping(value = "userInfo") + public AjaxResult userInfo(@RequestParam Long userId) { + + SysUser user = sysUserMapper.selectUserById(userId); + List venues = ywSceneUserMapper.getVenuesByUserId(user.getUserId()); + List venueNames = venues.stream().map(YwSceneUser::getVenueName).collect(Collectors.toList()); + user.setVenueNames(venueNames); + String label = sysDictDataMapper.selectDictLabel("yw_specialty", user.getUserType()); + user.setUserTypeStr(label); + List sysUserRoles = sysUserRoleMapper.selectRoleByUserId(user.getUserId()); + List roles = sysUserRoles.stream().map(SysUserRole::getRoleName).collect(Collectors.toList()); + user.setRoleNames(roles); + return AjaxResult.success(user); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwDrsTempTaskController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwDrsTempTaskController.java new file mode 100644 index 0000000000000000000000000000000000000000..e8b43a7747074cbbfa234bc4bddccae26fb9949c --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwDrsTempTaskController.java @@ -0,0 +1,135 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.dto.YwDrsTempTaskDTO; +import com.ruoyi.eastcom_yw.domain.qo.YwDrsTempTaskQO; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsTempTaskVO; +import com.ruoyi.eastcom_yw.service.YwDrsTempTaskService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.time.LocalDate; +import java.util.List; + +/** + *

+ * DRS临时任务表 前端控制器 + *

+ * + * @author ck + * @since 2023-06-13 + */ +@Api(tags = "DRS临时任务表") +@RestController +@RequestMapping("/app/ywDrsTempTask") +@Slf4j +@RequiredArgsConstructor +public class YwDrsTempTaskController extends BaseController { + + private final YwDrsTempTaskService ywDrsTempTaskService; + + /** + * DRS临时任务表列表 + */ + @ApiOperation(value = "DRS临时任务表列表", notes = "DRS临时任务表列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody YwDrsTempTaskQO qo) { + List list = ywDrsTempTaskService.getData(qo); + return getDataTable(list); + } + + + /** + * DRS临时任务表分页列表 + */ + @ApiOperation(value = "DRS临时任务表分页列表", notes = "DRS临时任务表分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody YwDrsTempTaskQO qo) { + PageInfo page = ywDrsTempTaskService.getDataByPage(qo); + return getDataTable(page.getList(), page.getTotal()); + } + + /** + * 获取DRS临时任务表详情 + */ + @ApiOperation(value = "DRS临时任务表详情", notes = "DRS临时任务表详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(ywDrsTempTaskService.fetchById(id)); + } + + /** + * 新增或修改DRS临时任务表 + */ + @Log(title = "新增或修改DRS临时任务表", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改DRS临时任务表", notes = "新增或修改DRS临时任务表") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated YwDrsTempTaskDTO dto) { + ywDrsTempTaskService.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除DRS临时任务表 + */ + @Log(title = "根据id删除DRS临时任务表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除DRS临时任务表", notes = "根据id删除DRS临时任务表") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ywDrsTempTaskService.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除DRS临时任务表 + */ + @Log(title = "根据id批量删除DRS临时任务表", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除DRS临时任务表", notes = "根据id批量删除DRS临时任务表") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ywDrsTempTaskService.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "DRS临时任务表导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil util = new ExcelUtil<>(YwDrsTempTaskVO.class); + List list = util.importExcel(file.getInputStream()); + ywDrsTempTaskService.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * DRS临时任务表导出 + */ + @ApiOperation(value = "DRS临时任务表导出") + @PostMapping(value = "/export") + public void export(@RequestBody YwDrsTempTaskQO qo) { + ywDrsTempTaskService.export(qo); + } + + + /** + * DRS预览 + */ + @ApiOperation(value = "DRS预览", notes = "DRS预览") + @GetMapping(value = "/drsPreview/{venueId}/{date}") + public TableDataInfo drsPreview(@PathVariable("venueId") Long venueId, @PathVariable("date") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate date) { + return getDataTable(ywDrsTempTaskService.drsPreview(venueId,date)); + } + +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwRoutInspectLogController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwRoutInspectLogController.java new file mode 100644 index 0000000000000000000000000000000000000000..d92e08060ad579981e3266571e08324cff6f37bd --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwRoutInspectLogController.java @@ -0,0 +1,45 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.enums.OperatorType; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectLog; +import com.ruoyi.eastcom_yw.service.YwRoutInspectLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author los + */ +@Api("巡检计划反馈接口") +@RestController +@RequestMapping("/app/routInspectLog") +@RequiredArgsConstructor +public class YwRoutInspectLogController extends BaseController { + + private final YwRoutInspectLogService ywRoutInspectLogService; + + @ApiOperation("修改") + @PutMapping("") +// @PreAuthorize("@app.hasPermi('focus:inspect:update')") + @Log(title = "修改巡检计划", businessType = BusinessType.UPDATE,operatorType = OperatorType.MOBILE ) + public AjaxResult update(@RequestBody YwRoutInspectLog log) { + try { + ywRoutInspectLogService.updateLog(log); + + return AjaxResult.success(); + } catch (Exception e) { + e.printStackTrace(); + return AjaxResult.error(e.getMessage()); + } + } + +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwRoutInspectPlanController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwRoutInspectPlanController.java new file mode 100644 index 0000000000000000000000000000000000000000..f865d06f626ad661ca17161e8cf518335d8f2cce --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwRoutInspectPlanController.java @@ -0,0 +1,173 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.enums.OperatorType; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectConfig; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectPlan; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectStatDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectTaskDTO; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectConfigParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectPlanParam; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectStatParam; +import com.ruoyi.eastcom_yw.domain.vo.YwInspectLogVo; +import com.ruoyi.eastcom_yw.service.YwRoutInspectConfigService; +import com.ruoyi.eastcom_yw.service.YwRoutInspectPlanService; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + +/** + * @author huamile + */ +@Api("巡检计划管理") +@RestController +@RequestMapping("/app/routInspectPlan") +@RequiredArgsConstructor +public class YwRoutInspectPlanController extends BaseController { + + private final YwRoutInspectPlanService ywRoutInspectPlanService; + private final YwRoutInspectConfigService ywRoutInspectConfigService; + + private final YwSceneService yw_sceneService; + + @ApiOperation("获取巡检计划列表") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwRoutInspectConfigParam param) { + param = (YwRoutInspectConfigParam) yw_sceneService.validateUserVenues(param,YwRoutInspectConfigParam.class,"venueIds"); + List list = ywRoutInspectPlanService.getList(param); + return getDataTable(list); + } + + @ApiOperation("获取巡检记录列表") + @PostMapping("/plan/list") + public TableDataInfo planList(@RequestBody YwRoutInspectPlanParam param) { + param = (YwRoutInspectPlanParam) yw_sceneService.validateUserVenues(param,YwRoutInspectPlanParam.class,"venueIds"); + param.setIsApp(true); + return ywRoutInspectPlanService.getPlanList(param); + } + + @ApiOperation("根据条件获取巡检任务统计汇总") + @PostMapping("/stat") + public AjaxResult stat(@RequestBody YwRoutInspectStatParam param) { + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + Map data = ywRoutInspectPlanService.getStatData(param); + return AjaxResult.success(data); + } + + @ApiOperation("根据条件获取巡检任务统计列表") + @PostMapping("/stat/list") + public AjaxResult statList(@RequestBody YwRoutInspectStatParam param) { + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + Map map = ywRoutInspectPlanService.getStatListData(param); + return AjaxResult.success(map); + } + + @ApiOperation("根据条件获取巡检结果统计汇总") + @PostMapping("/resultStat") + public AjaxResult resultStat(@RequestBody YwRoutInspectStatParam param) { + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + Map data = ywRoutInspectPlanService.getResultStatData(param); + return AjaxResult.success(data); + } + + @ApiOperation("根据条件获取巡检结果统计列表") + @PostMapping("/resultStat/list") + public AjaxResult resultStatList(@RequestBody YwRoutInspectStatParam param) { + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + Map map = ywRoutInspectPlanService.getResultStatListData(param); + return AjaxResult.success(map); + } + + @ApiOperation("场馆任务结果统计列表(app端合并statList与resultStatList两接口结果返回)") + @PostMapping("/mergeResultStat/list") + public TableDataInfo mergeResultStat(@RequestBody YwRoutInspectStatParam param) { + param = (YwRoutInspectStatParam) yw_sceneService.validateUserVenues(param,YwRoutInspectStatParam.class,"venueIds"); + List list = ywRoutInspectPlanService.mergeResultStat(param); + return getDataTable(list); + } + + @ApiOperation("根据processId获取巡检详情") + @GetMapping("/info/{processId}") + public TableDataInfo info(@PathVariable String processId) + { + return getDataTable(ywRoutInspectPlanService.getRoutInspectInfoList(processId)); + } + + @ApiOperation("查巡检配置参数") + @PostMapping("/inspectConfigList") + public TableDataInfo inspectConfigList(@RequestBody YwRoutInspectConfigParam param) { + List list = ywRoutInspectConfigService.getInspectConfigList(param); + return getDataTable(list); + } + + @ApiOperation("新增巡检计划") + @PostMapping + @PreAuthorize("@app.hasPermi('focus:inspect:add')") + @Log(title = "新增巡检计划", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE ) + public AjaxResult create(@RequestBody YwInspectTaskDTO dto) { + try { + return ywRoutInspectPlanService.create(dto); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("编辑巡检计划") + @PutMapping + @PreAuthorize("@app.hasPermi('focus:inspect:update')") + public AjaxResult update(@RequestBody YwInspectTaskDTO dto) { + try { + if (ywRoutInspectPlanService.checkPlanStatus(dto.getYwRoutInspectPlan().getJobNo())) { + return AjaxResult.error("巡检记录已生成,无法修改。"); + } + ywRoutInspectPlanService.updatePlan(dto); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "巡检计划", businessType = BusinessType.DELETE) + @ApiOperation("删除巡检计划") + @DeleteMapping("/{ids}") + @PreAuthorize("@app.hasPermi('focus:inspect:del')") + public AjaxResult delete(@PathVariable String[] ids) { + try { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(YwRoutInspectPlan::getJobNo,ids); + ywRoutInspectPlanService.remove(wrapper); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("导出巡检任务列表") + @PostMapping("/export") + public void export(YwRoutInspectConfigParam param, HttpServletRequest request, HttpServletResponse response) { + ywRoutInspectPlanService.export(param,request,response); + } + + @ApiOperation("导出巡检计划列表") + @PostMapping("/plan/export") + public void planExport(YwRoutInspectPlanParam param, HttpServletRequest request, HttpServletResponse response) { + ywRoutInspectPlanService.planExport(param,request,response); + } + +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwRoutInspectQuestionConfigController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwRoutInspectQuestionConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..637561c22f6254b6c1a6158a0536a34eb77f0e2f --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwRoutInspectQuestionConfigController.java @@ -0,0 +1,93 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.eastcom_yw.domain.YwRoutInspectQuestionConfig; +import com.ruoyi.eastcom_yw.domain.param.YwInspectQuestionConfigParam; +import com.ruoyi.eastcom_yw.service.YwRoutInspectQuestionConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.util.List; + +/** + * @author huamile + */ +@Api("巡检问题类型管理") +@RestController +@RequestMapping("/app/routInspectQuestionConfig") +@RequiredArgsConstructor +public class YwRoutInspectQuestionConfigController extends BaseController { + + private final YwRoutInspectQuestionConfigService ywRoutInspectQuestionConfigService; + + @ApiOperation("获取巡检问题类型列表") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwInspectQuestionConfigParam param) { + List list = ywRoutInspectQuestionConfigService.getlist(param); + return getDataTable(list); + } + + @ApiOperation("获取巡检问题列表") + @PostMapping("/appList") + public TableDataInfo bigList(@RequestBody YwInspectQuestionConfigParam param) { + List list = ywRoutInspectQuestionConfigService.appList(param); + return getDataTable(list); + } + + + @Log(title = "巡检问题类型", businessType = BusinessType.INSERT) + @ApiOperation("新增巡检问题类型") + @PostMapping + public AjaxResult create(@RequestBody YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig) { + try { + ywRoutInspectQuestionConfigService.create(ywRoutInspectQuestionConfig); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "巡检问题类型", businessType = BusinessType.UPDATE) + @ApiOperation("编辑巡检问题类型") + @PutMapping + public AjaxResult update(@RequestBody YwRoutInspectQuestionConfig ywRoutInspectQuestionConfig) { + try { + ywRoutInspectQuestionConfigService.updateByPrimaryKeySelective(ywRoutInspectQuestionConfig); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "巡检问题类型", businessType = BusinessType.DELETE) + @ApiOperation("删除巡检问题类型") + @DeleteMapping("/{ids}") + public AjaxResult delete(@PathVariable Long[] ids) { + try { + ywRoutInspectQuestionConfigService.removeByIds(Arrays.asList(ids)); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @Log(title = "巡检问题类型", businessType = BusinessType.EXPORT) + @ApiOperation("导出巡检问题类型列表") + @PostMapping("/export") + public void export(YwInspectQuestionConfigParam param, HttpServletRequest request, HttpServletResponse response) { + ywRoutInspectQuestionConfigService.export(param,request,response); + } + +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwSceneController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwSceneController.java new file mode 100644 index 0000000000000000000000000000000000000000..691bbb8ce4c30a2ce46178398327502ce370aa62 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwSceneController.java @@ -0,0 +1,133 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.dto.YwDataDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSceneDTO; +import com.ruoyi.eastcom_yw.domain.param.YwSceneParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSceneVo; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.system.service.ISysUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * + * @author jkj + * @since 2023-01-12 + */ +@Api("场馆信息管理") +@RestController +@RequestMapping("/app/venue") +public class YwSceneController extends BaseController { + + @Autowired + private YwSceneService yw_sceneService; + + @Autowired + private ISysUserService userService; + + @ApiOperation("获取场馆数据") + @GetMapping("/list/redis") + public AjaxResult listAll() throws Exception { + return AjaxResult.success(yw_sceneService.selectVenues()); + } + + + @ApiOperation("获取当前登录用户关联的场馆数据") + @GetMapping("/list") + public TableDataInfo list() + { + startPage(); + + SysUser user = SecurityUtils.getLoginUser().getUser(); + + List list= yw_sceneService.getVenueByUser(user); + + return getDataTable(list); + } + + @ApiOperation("根据场馆和角色获取相关的用户") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwDataDTO ywDataDTO) + { + List list = yw_sceneService.getSysUserByVenueAndOther(ywDataDTO); + return getDataTable(list); + } + + @ApiOperation("根据场馆ID获取场馆") + @GetMapping(value = { "/", "/{venueId}" }) + public TableDataInfo list(@PathVariable(value = "venueId", required = false) Long venueId) + { + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(YwScene::getId,venueId); + List list = yw_sceneService.list(lambdaQueryWrapper); + + return getDataTable(list); + } + + @ApiOperation("获取场馆信息列表") + @PostMapping("/msgList") + public TableDataInfo msgList(@RequestBody YwSceneParam param) { + List list = yw_sceneService.msgList(param); + return getDataTable(list); + } + + @ApiOperation("新增场馆") + @PostMapping + public AjaxResult create(@RequestBody YwSceneDTO dto) { + try { + yw_sceneService.create(dto); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("编辑场馆信息") + @PutMapping + public AjaxResult update(@RequestBody YwSceneDTO dto) { + try { + yw_sceneService.updateByPrimaryKeySelective(dto); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("删除场馆") + @DeleteMapping("/{ids}") + public AjaxResult delete(@PathVariable Long[] ids) { + try { + yw_sceneService.delByIds(Arrays.asList(ids)); + return AjaxResult.success(); + } catch (Exception ex) { + ex.printStackTrace(); + return AjaxResult.error(ex.getMessage()); + } + } + + @ApiOperation("导出场馆") + @PostMapping("/export") + public void export(YwSceneParam param, HttpServletRequest request, HttpServletResponse response) { + yw_sceneService.export(param,request,response); + } + +} + diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwScenePictureController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwScenePictureController.java new file mode 100644 index 0000000000000000000000000000000000000000..cd9a20d1156c72675168ebe2b2a1fad66a724fbd --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwScenePictureController.java @@ -0,0 +1,108 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.eastcom_yw.service.YwScenePictureService; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author los + */ +@RestController +@RequestMapping("/app/scenePicture") +@RequiredArgsConstructor +public class YwScenePictureController extends BaseController { + + private final YwScenePictureService service; + + /** + * 任务管理统计 + * + * @param id 场馆id + * @return 返回数据 + */ + @ApiOperation(value = "任务管理统计", notes = "任务管理统计") + @PostMapping("/listTaskManage") + public AjaxResult listTaskManage(@RequestParam("sceneId") Long id) { + return AjaxResult.success(service.listTaskManage2(id,false)); + } + + /** + * 人员签到统计 + * + * @param id 场馆id + * @return 返回数据 + */ + @ApiOperation(value = "人员签到统计", tags = "人员签到统计") + @PostMapping("/listSign") + public AjaxResult listSign(@RequestParam("sceneId") Long id) { + return AjaxResult.success(service.listSign(id)); + } + + /** + * 场馆基本信息 + * + * @param id 场馆id + * @return 返回数据 + */ + @ApiOperation(value = "场馆基本信息", tags = "场馆基本信息") + @PostMapping("/baseInfo") + public AjaxResult listMatchTop3(@RequestParam("sceneId") Long id) { + return AjaxResult.success(service.listMatchTop3(id)); + } + + /** + * 场馆告警 + * + * @param id 场馆id + * @return 返回数据 + */ + @ApiOperation(value = "场馆告警", tags = "场馆告警") + @PostMapping("/alarm") + public AjaxResult listAlarm(@RequestParam("sceneId") Long id) { + return AjaxResult.success(service.listAlarm(id)); + } + + /** + * 场馆Kpi指标 + * + * @param id 场馆id + * @param typeId 网络类型 1 --> 4g 2 --> 5g + * @return 数据 + */ + @ApiOperation(value = "场馆性能(15分粒度)", tags = "场馆性能(15分粒度)") + @PostMapping("/kpi") + public AjaxResult listKPI(@RequestParam("sceneId") Long id, @RequestParam("typeId") String typeId) { + return AjaxResult.success(service.listKPI(id, typeId)); + } + + /** + * + * @param id 场馆id + * @param type 1-AGIS 2-互联网 3-固话 + * @return + */ + @ApiOperation(value = "场馆性能-专网", tags = "场馆性能-专网") + @PostMapping("/listNetKpi") + public AjaxResult listNetKpi(@RequestParam("sceneId") Long id,@RequestParam("type") Integer type) { + return service.listNetKpi(id,type); + } + + /** + * + * @param id 场馆id + * @param type 1-环路浏量 2-光功率 + * @return + */ + @ApiOperation(value = "场馆性能-传输", tags = "场馆性能-传输") + @PostMapping("/listTransKpi") + public AjaxResult listTransKpi(@RequestParam("sceneId") Long id,@RequestParam("type") Integer type) { + return service.listTransKpi(id,type); + } + +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwSignController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwSignController.java new file mode 100644 index 0000000000000000000000000000000000000000..eb5785a24ca52cc8443914a1e878dabfaca8eb8d --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwSignController.java @@ -0,0 +1,368 @@ +package com.ruoyi.app.controller.eastcom_yw; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.enums.OperatorType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.utils.reflect.ReflectUtils; +import com.ruoyi.eastcom_yw.domain.YwSignLog; +import com.ruoyi.eastcom_yw.domain.YwSignPlanView; +import com.ruoyi.eastcom_yw.domain.dto.*; +import com.ruoyi.eastcom_yw.domain.param.YwSignPlanParam; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogStaticVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogVo; +import com.ruoyi.eastcom_yw.domain.vo.YwSignPlanVo; +import com.ruoyi.eastcom_yw.mapper.YwSceneUserMapper; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.YwSignLogService; +import com.ruoyi.eastcom_yw.service.YwSignLogViewService; +import com.ruoyi.eastcom_yw.service.YwSignPlanService; +import com.ruoyi.system.mapper.SysUserMapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + + +/** + * + * @author jkj + * @since 2023-01-14 + */ +@Api("签到信息管理") +@RestController +@RequestMapping("/app/sign") +public class YwSignController extends BaseController { + + @Autowired + private YwSignLogService ywSignLogService; + + @Autowired + private YwSignPlanService ywSignPlanService; + + + @Autowired + private YwSignLogViewService ywSignLogViewService; + + @Autowired + private YwSceneUserMapper ywSceneUserMapper; + + @Autowired + private SysUserMapper sysUserMapper; + + @Autowired + private YwSceneService yw_sceneService; + + + @ApiOperation("是否可签到") + @PostMapping("/couldSign") + public AjaxResult couldSign(@RequestBody YwSignDTO ywSignDTO) + { + return AjaxResult.success( ywSignLogService.couldSign(ywSignDTO)); + } + + @ApiOperation("签到") + @PostMapping("/sign") + @Log(title = "APP", businessType = BusinessType.UPDATE,operatorType= OperatorType.MOBILE) + public AjaxResult sign(@RequestBody YwSignDTO ywSignDTO) + { + return AjaxResult.success( ywSignLogService.sign(ywSignDTO)); + } + + @ApiOperation("签到") + @PostMapping("/signTest") + @Log(title = "APP", businessType = BusinessType.UPDATE,operatorType= OperatorType.MOBILE) + public AjaxResult signTest(@RequestBody YwSignDTO ywSignDTO) + { + return AjaxResult.success( ywSignLogService.signTest(ywSignDTO)); + } + + @ApiOperation("根据场馆ID获取当前登录用户的签到记录") + @GetMapping("/getSignLogAndPlan/{venueId}") + public AjaxResult getSignLogAndPlan(@PathVariable("venueId") Long venueId) + { + return AjaxResult.success(ywSignLogViewService.getSignLogAndPlan(venueId)); + } + + @ApiOperation("根据签到计划ID获取当前登录用户的签到记录") + @GetMapping("/getSignLog/{signPlanId}") + public AjaxResult getSignLog(@PathVariable("signPlanId") Long signPlanId) + { + return AjaxResult.success(ywSignLogViewService.getSignLogByPlanId(signPlanId)); + } + + @ApiOperation("获取签到") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwSignLogDTO ywSignLogDTO) + { + ywSignLogDTO = (YwSignLogDTO) yw_sceneService.validateUserVenues(ywSignLogDTO,YwSignLogDTO.class,"venueIds"); + TableDataInfo resData=ywSignLogViewService.getSignLog(ywSignLogDTO); + return getDataTable(resData.getRows(),resData.getTotal()); + } + + /** + * 获取签到计划详情 + */ + @ApiOperation(value = "获取签到计划详情", notes = "获取签到计划详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + + YwSignPlanView ywSignPlanView = ywSignPlanService.getById(id); + + YwSignPlanVo ywSignPlanVo = ywSignPlanService.handleYwSignPlan(ywSignPlanView); + + return AjaxResult.success(ywSignPlanVo); + } + + @ApiOperation("获取签到统计") + @PostMapping("/static/list") +// @PreAuthorize("@app.hasPermi('focus:sign:static')") + public TableDataInfo static_list(@RequestBody YwSignLogDTO ywSignLogDTO) + { + ywSignLogDTO.setIsExport(false); + ywSignLogDTO.setGenTime(true); + ywSignLogDTO = (YwSignLogDTO) yw_sceneService.validateUserVenues(ywSignLogDTO,YwSignLogDTO.class,"venueIds"); + List list=ywSignLogViewService.getSignLogStatic(ywSignLogDTO); + return getDataTable(list); + } + + @ApiOperation("获取签到计划") + @PostMapping("/plan/list") +// @PreAuthorize("@app.hasPermi('focus:signPlan:list')") + public TableDataInfo plan_list(@RequestBody YwSignPlanDTO ywSignPlanDTO) + { + ywSignPlanDTO.setIsExport(false); + ywSignPlanDTO = (YwSignPlanDTO) yw_sceneService.validateUserVenues(ywSignPlanDTO,YwSignPlanDTO.class,"venueIds"); + TableDataInfo resData= ywSignPlanService.getSignPlan(ywSignPlanDTO); + return getDataTable(resData.getRows(),resData.getTotal()); + } + + @ApiOperation("获取登录用户的签到计划") + @PostMapping("/plan/listByUser") + public TableDataInfo plan_list2(@RequestBody YwSignPlanDTO ywSignPlanDTO) + { + startPage(); + return getDataTable(ywSignPlanService.getSignPlan(ywSignPlanDTO.getVenueId(),ywSignPlanDTO.getSignDate())); + } + + @Log(title = "签到计划", businessType = BusinessType.INSERT) + @ApiOperation("新增签到计划") + @PostMapping("/plan/insert") + @PreAuthorize("@app.hasPermi('focus:sign:add')") + public AjaxResult palnInsert(@RequestBody YwSignPlanParam ywSignPlanParam) + { + + Boolean res = false; + + String strError = ""; + + try + { + if(ObjectUtils.isEmpty(ywSignPlanParam.getTimePeriods())) + { + YwSignPlanDTO ywSignPlanDTO =new YwSignPlanDTO(); + + BeanUtils.copyBeanProp(ywSignPlanDTO,ywSignPlanParam); + + res = ywSignPlanService.insertSignPlan(ywSignPlanDTO); + + if(!res) + { + strError = ywSignPlanDTO.getSignDates()[0]+" "+ywSignPlanDTO.getBeginTime()+" "+ywSignPlanDTO.getEndTime()+"相同场馆存在时间重叠"; + } + } + + + if(ObjectUtils.isNotEmpty(ywSignPlanParam.getTimePeriods())) + { + + for(YwSignPlanUserDTO ywSignPlanUserDTO : ywSignPlanParam.getTimePeriods()) + { + YwSignPlanDTO ywSignPlanDTO =new YwSignPlanDTO(); + + BeanUtils.copyBeanProp(ywSignPlanDTO,ywSignPlanParam); + + ywSignPlanDTO.setBeginTime(ywSignPlanUserDTO.getBeginTime()); + + ywSignPlanDTO.setEndTime(ywSignPlanUserDTO.getEndTime()); + + ywSignPlanDTO.setSignUsers(StringUtils.join(ywSignPlanUserDTO.getSignUsers(),",")); + + res = ywSignPlanService.insertSignPlan(ywSignPlanDTO); + + if(!res) + { + strError = ywSignPlanDTO.getSignDates()[0]+" "+ywSignPlanDTO.getBeginTime()+" "+ywSignPlanDTO.getEndTime()+"相同场馆存在时间重叠"; + break; + } + } + } + + if(res) + { + return AjaxResult.success(); + } + else + { + return AjaxResult.error(strError); + } + + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "签到计划", businessType = BusinessType.UPDATE) + @ApiOperation("修改签到计划") + @PostMapping("/plan/update") + @PreAuthorize("@app.hasPermi('focus:signPlan:update')") + public AjaxResult palnUpdate(@RequestBody YwSignPlanParam ywSignPlanParam) + { + try + { + if(ObjectUtils.isEmpty(ywSignPlanParam.getTimePeriods())) + { + YwSignPlanDTO ywSignPlanDTO =new YwSignPlanDTO(); + BeanUtils.copyBeanProp(ywSignPlanDTO,ywSignPlanParam); + ywSignPlanService.updateSignPlan(ywSignPlanDTO); + return AjaxResult.success(); + } + + if(ObjectUtils.isNotEmpty(ywSignPlanParam.getTimePeriods())) + { + + for(YwSignPlanUserDTO ywSignPlanUserDTO : ywSignPlanParam.getTimePeriods()) + { + + YwSignPlanDTO ywSignPlanDTO =new YwSignPlanDTO(); + + BeanUtils.copyBeanProp(ywSignPlanDTO,ywSignPlanParam); + + ywSignPlanDTO.setBeginTime(ywSignPlanUserDTO.getBeginTime()); + + ywSignPlanDTO.setEndTime(ywSignPlanUserDTO.getEndTime()); + + ywSignPlanDTO.setSignUsers(StringUtils.join(ywSignPlanUserDTO.getSignUsers(),",")); + + ywSignPlanService.updateSignPlan(ywSignPlanDTO); + + } + } + + return AjaxResult.success(); + + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "签到计划", businessType = BusinessType.DELETE) + @ApiOperation("删除签到计划") + @DeleteMapping("/plan/{id}") + @PreAuthorize("@app.hasPermi('focus:signPlan:del')") + public AjaxResult palnDelete(@PathVariable Long id) + { + try + { + ywSignPlanService.deleteSignPlan(id); + return AjaxResult.success(); + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @ApiOperation("根据用户ID获取该用户的签到") + @GetMapping(value = { "/", "/{userId}" }) + public TableDataInfo list(@PathVariable(value = "userId", required = false) Long userId) + { + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(YwSignLog::getUserId,userId); + List list = ywSignLogService.list(lambdaQueryWrapper); + return getDataTable(list); + } + + @Log(title = "批量签到", businessType = BusinessType.UPDATE) + @ApiOperation("后端批量签到") + @PostMapping("/signIn") + public AjaxResult signIn(@RequestBody YwSignInDTO ywSignInDTO) + { + try + { +// SysUser user = getLoginUser().getUser(); +// ywSignInDTO.setUserId(user.getUserId()); + ywSignLogService.SignIn(ywSignInDTO); + return AjaxResult.success(); + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "签到计划导入", businessType = BusinessType.IMPORT) + @PostMapping("/plan/import") + public AjaxResult importData(MultipartFile file, Boolean updateSupport,Long sceneBigId) throws Exception + { + ExcelUtil util = new ExcelUtil(YwSignPlanDTO.class); + List signPlanList = util.importExcel(file.getInputStream()); + return ywSignPlanService.importSignPlan(signPlanList,updateSupport,sceneBigId); +// return success(message); + } + + @Log(title = "签到记录导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response,YwSignLogDTO ywSignLogDTO) throws IllegalAccessException { + ywSignLogDTO.setIsExport(true); + ywSignLogDTO = (YwSignLogDTO) yw_sceneService.validateUserVenues(ywSignLogDTO,YwSignLogDTO.class,"venueIds"); + TableDataInfo resData=ywSignLogViewService.getSignLog(ywSignLogDTO); + List list = ReflectUtils.toList(resData.getRows(),YwSignLogVo.class); + ExcelUtil util = new ExcelUtil(YwSignLogVo.class); + util.exportExcel(response, list, "签到数据"); + } + + @Log(title = "签到计划导出", businessType = BusinessType.EXPORT) + @PostMapping("/plan/export") + public void exportPlan(HttpServletResponse response,YwSignPlanDTO ywSignPlanDTO) throws IllegalAccessException { + ywSignPlanDTO.setIsExport(true); + ywSignPlanDTO = (YwSignPlanDTO) yw_sceneService.validateUserVenues(ywSignPlanDTO,YwSignPlanDTO.class,"venueIds"); + TableDataInfo resData=ywSignPlanService.getSignPlan(ywSignPlanDTO); + List list = ReflectUtils.toList(resData.getRows(), YwSignPlanVo.class); + ExcelUtil util = new ExcelUtil(YwSignPlanVo.class); + util.exportExcel(response, list, "签到计划数据"); + } + + @Log(title = "签到统计导出", businessType = BusinessType.EXPORT) + @PostMapping("/static/export") + public void exportStatic(HttpServletResponse response,YwSignLogDTO ywSignLogDTO) throws IllegalAccessException { + ywSignLogDTO.setIsExport(true); + ywSignLogDTO = (YwSignLogDTO) yw_sceneService.validateUserVenues(ywSignLogDTO,YwSignLogDTO.class,"venueIds"); + List list=ywSignLogViewService.getSignLogStatic(ywSignLogDTO); + ExcelUtil util = new ExcelUtil(YwSignLogStaticVo.class); + util.exportExcel(response, list, "签到统计数据"); + } + + +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwWireTaskLogController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwWireTaskLogController.java new file mode 100644 index 0000000000000000000000000000000000000000..db5cab002ed28a91238a2c2b3c75608f333e6556 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/YwWireTaskLogController.java @@ -0,0 +1,167 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwWireTaskLog; +import com.ruoyi.eastcom_yw.domain.dto.YwWireTaskLogDTO; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.YwWireTaskLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +/** + * + * @author jkj + * @since 2023-01-12 + */ + +@Api("综合布线") +@RestController +@RequestMapping("/app/wireTask") +public class YwWireTaskLogController extends BaseController { + + @Autowired + private YwWireTaskLogService ywWireTaskLogService; + + @Autowired + private YwSceneService yw_sceneService; + + @Log(title = "布线记录", businessType = BusinessType.INSERT) + @ApiOperation("布线记录") + @PostMapping("/insert") + @PreAuthorize("@app.hasPermi('focus:wireTask:add')") + public AjaxResult insert(@RequestBody YwWireTaskLogDTO ywWireTaskLogDTO) + { + try + { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(ywWireTaskLogDTO.getWireTaskName()), YwWireTaskLog::getWireTaskName, ywWireTaskLogDTO.getWireTaskName()); + + if(ywWireTaskLogService.list(lambdaQueryWrapper).size()>0) + { + return AjaxResult.error("该场馆的任务名称已存在"); + } + + String res = ywWireTaskLogService.insertWireTaskLogReWireTaskId(ywWireTaskLogDTO); + if(StringUtils.isNotEmpty(res)) + { + return AjaxResult.success("新增布线日志成功",res); + } + else + { + return AjaxResult.error("新增布线日志失败"); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "布线记录", businessType = BusinessType.UPDATE) + @ApiOperation("布线记录") + @PostMapping("/update") +// @PreAuthorize("@app.hasPermi('focus:wireTask:update')") + public AjaxResult update(@RequestBody YwWireTaskLogDTO ywWireTaskLogDTO) + { + try + { + boolean res = ywWireTaskLogService.updateWireTaskLog(ywWireTaskLogDTO); + if(res) + { + return AjaxResult.success(); + } + else + { + return AjaxResult.error("修改布线日志失败"); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + + } + + @Log(title = "布线记录", businessType = BusinessType.DELETE) + @PostMapping("/delete") + public AjaxResult remove(@RequestBody YwWireTaskLogDTO ywWireTaskLogDTO) + { + try + { + boolean res = ywWireTaskLogService.deleteWireTaskLog(ywWireTaskLogDTO); + if(res) + { + return AjaxResult.success(); + } + else + { + return AjaxResult.error("删除布线日志失败"); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + } + @Log(title = "布线记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{wireTaskId}") + public AjaxResult remove(@PathVariable String wireTaskId) + { + try + { + YwWireTaskLogDTO ywWireTaskLogDTO=new YwWireTaskLogDTO(); + ywWireTaskLogDTO.setWireTaskId(wireTaskId); + + boolean res = ywWireTaskLogService.deleteWireTaskLog(ywWireTaskLogDTO); + if(res) + { + return AjaxResult.success(); + } + else + { + return AjaxResult.error("修改布线日志失败"); + } + } + catch (Exception ex) + { + return AjaxResult.error(ex.getMessage()); + } + } + + + @ApiOperation("获取场馆布线记录") + @PostMapping("/list") + public TableDataInfo list(@RequestBody YwWireTaskLogDTO ywWireTaskLogDTO) throws Exception { + ywWireTaskLogDTO.setIsApp(true); + if(ywWireTaskLogDTO.getVenueIds()!=null&&ywWireTaskLogDTO.getVenueIds().length==0){ + SysUser user = SecurityUtils.getLoginUser().getUser(); + //场馆集合 + List ywScenes = yw_sceneService.getVenueByUser(user); + Long[] venueIds = ywScenes.stream().map(YwScene::getId).toArray(Long[]::new); + ywWireTaskLogDTO.setVenueIds(venueIds); + } + TableDataInfo resData = ywWireTaskLogService.getWireTaskLog(ywWireTaskLogDTO); + return getDataTable(resData.getRows(), resData.getTotal()); + } + + + +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/dpConfigController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/dpConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..1268d9ed1d3831ac386d290e37f97a952d4b3d78 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/eastcom_yw/dpConfigController.java @@ -0,0 +1,102 @@ +package com.ruoyi.app.controller.eastcom_yw; + +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.sunlm.domain.class_scene_match; +import com.ruoyi.sunlm.entity.scene_match_entity_list; +import com.ruoyi.sunlm.mapper.dpConfigMapper; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + + +/** + * 参数配置 信息操作处理 + * + * @author ruoyi + * Spring Security提供了Spring EL表达式,允许我们在定义接口访问的方法上面添加注解,来控制访问权限 + * + * 方法 参数 描述 + * hasPermi String 验证用户是否具备某权限 + * lacksPermi String 验证用户是否不具备某权限,与hasPermi逻辑相反 + * hasAnyPermi String 验证用户是否具有以下任意一个权限 + * hasRole String 判断用户是否拥有某个权限 + * lacksRole String 验证用户是否不具备某个权限,与hasRole逻辑相反 + * hasAnyRoles String 验证用户是否具有以下任意一个角色,多个逗号分隔 + + */ + +@RestController +@CrossOrigin +@RequestMapping("/eastcom_yw/config") + +public class dpConfigController extends BaseController +{ + @Resource + dpConfigMapper MydpConfigMapper; //直接在这里引用数据库操作层(MAPPER),就不用写Service层了! + + @Resource + YwSceneService ywSceneService; + + + + //region------------------------------------------------------------------------------------赛程增删改查接口 + //--------------------------------------------获取赛程列表 + @ApiOperation("根据ID获取赛程") + @GetMapping(value = "/getscenematch/{matchid}") + public AjaxResult getscenematch(@PathVariable int matchid, HttpServletRequest request) + { + class_scene_match scenematch=new class_scene_match(); + scenematch = MydpConfigMapper.getscenematch(matchid); + return success(scenematch); + } + + @ApiOperation("根据查询条件获取赛程") + @PostMapping(value = "/getscenematchlist") + @RepeatSubmit(enable = false,interval = 1000) + public TableDataInfo getscenematchlists(@RequestBody scene_match_entity_list jsonObject, HttpServletRequest request) + { + List scenematch=new ArrayList(); + + String scenebigid=jsonObject.sceneBigId==null?getSceneStatusIs2():jsonObject.sceneBigId; + List sceneid=jsonObject.sceneIds==null?new ArrayList():jsonObject.sceneIds; + String taskName=jsonObject.taskName==null?"":jsonObject.taskName; + String taskStatus=jsonObject.taskStatus==null?"":jsonObject.taskStatus; + String taskdate=jsonObject.taskDate==null?"":jsonObject.taskDate; + + String tasktype=jsonObject.taskType==null?"":jsonObject.taskType; + + int pagenumber=jsonObject.pageNum; + int pagesize=jsonObject.pageSize; + scenematch= MydpConfigMapper.getscenematchlists(scenebigid,sceneid,taskName,taskStatus,taskdate,tasktype,pagenumber,pagesize); + + Long total=MydpConfigMapper.getscenematchlistscnt(scenebigid,sceneid,taskName,taskStatus,taskdate,tasktype); + return getDataTable(scenematch,total); + } + + //----------------------------获取当前场景ID + public String getSceneStatusIs2() + { + return MydpConfigMapper.getSceneBigIs2(); + } + + //----------------------------------------------新增 + public int getscenematchbyName(int sceneId,String name) + { + int counts= MydpConfigMapper.getscenematchbyName(sceneId,name); + return counts; + } + + + //endregion +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/CacheController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/CacheController.java new file mode 100644 index 0000000000000000000000000000000000000000..4be98ffdaafd1447f359723d72fcc8d37e84a123 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/CacheController.java @@ -0,0 +1,120 @@ +package com.ruoyi.app.controller.monitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysCache; + +/** + * 缓存监控 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/cache") +public class CacheController +{ + @Autowired + private RedisTemplate redisTemplate; + + private final static List caches = new ArrayList(); + { + caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息")); + caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息")); + caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典")); + caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码")); + caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交")); + caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); + caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping() + public AjaxResult getInfo() throws Exception + { + Properties info = (Properties) redisTemplate.execute((RedisCallback) connection -> connection.info()); + Properties commandStats = (Properties) redisTemplate.execute((RedisCallback) connection -> connection.info("commandstats")); + Object dbSize = redisTemplate.execute((RedisCallback) connection -> connection.dbSize()); + + Map result = new HashMap<>(3); + result.put("info", info); + result.put("dbSize", dbSize); + + List> pieList = new ArrayList<>(); + commandStats.stringPropertyNames().forEach(key -> { + Map data = new HashMap<>(2); + String property = commandStats.getProperty(key); + data.put("name", StringUtils.removeStart(key, "cmdstat_")); + data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); + pieList.add(data); + }); + result.put("commandStats", pieList); + return AjaxResult.success(result); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping("/getNames") + public AjaxResult cache() + { + return AjaxResult.success(caches); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping("/getKeys/{cacheName}") + public AjaxResult getCacheKeys(@PathVariable String cacheName) + { + Set cacheKeys = redisTemplate.keys(cacheName + "*"); + return AjaxResult.success(cacheKeys); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping("/getValue/{cacheName}/{cacheKey}") + public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) + { + String cacheValue = redisTemplate.opsForValue().get(cacheKey); + SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); + return AjaxResult.success(sysCache); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @DeleteMapping("/clearCacheName/{cacheName}") + public AjaxResult clearCacheName(@PathVariable String cacheName) + { + Collection cacheKeys = redisTemplate.keys(cacheName + "*"); + redisTemplate.delete(cacheKeys); + return AjaxResult.success(); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @DeleteMapping("/clearCacheKey/{cacheKey}") + public AjaxResult clearCacheKey(@PathVariable String cacheKey) + { + redisTemplate.delete(cacheKey); + return AjaxResult.success(); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @DeleteMapping("/clearCacheAll") + public AjaxResult clearCacheAll() + { + Collection cacheKeys = redisTemplate.keys("*"); + redisTemplate.delete(cacheKeys); + return AjaxResult.success(); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/ServerController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/ServerController.java new file mode 100644 index 0000000000000000000000000000000000000000..33611020e5c71f6588c996c82f8ecb874e5c3a48 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/ServerController.java @@ -0,0 +1,27 @@ +package com.ruoyi.app.controller.monitor; + +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.framework.web.domain.Server; + +/** + * 服务器监控 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/server") +public class ServerController +{ + @PreAuthorize("@ss.hasPermi('monitor:server:list')") + @GetMapping() + public AjaxResult getInfo() throws Exception + { + Server server = new Server(); + server.copyTo(); + return AjaxResult.success(server); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/SysLogininforController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/SysLogininforController.java new file mode 100644 index 0000000000000000000000000000000000000000..734416328abf1538008068cb5dcdd073dcee6e33 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/SysLogininforController.java @@ -0,0 +1,82 @@ +package com.ruoyi.app.controller.monitor; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.service.SysPasswordService; +import com.ruoyi.system.domain.SysLogininfor; +import com.ruoyi.system.service.ISysLogininforService; + +/** + * 系统访问记录 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/logininfor") +public class SysLogininforController extends BaseController +{ + @Autowired + private ISysLogininforService logininforService; + + @Autowired + private SysPasswordService passwordService; + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") + @GetMapping("/list") + public TableDataInfo list(SysLogininfor logininfor) + { + startPage(); + List list = logininforService.selectLogininforList(logininfor); + return getDataTable(list); + } + + @Log(title = "登录日志", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysLogininfor logininfor) + { + List list = logininforService.selectLogininforList(logininfor); + ExcelUtil util = new ExcelUtil(SysLogininfor.class); + util.exportExcel(response, list, "登录日志"); + } + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") + @Log(title = "登录日志", businessType = BusinessType.DELETE) + @DeleteMapping("/{infoIds}") + public AjaxResult remove(@PathVariable Long[] infoIds) + { + return toAjax(logininforService.deleteLogininforByIds(infoIds)); + } + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") + @Log(title = "登录日志", businessType = BusinessType.CLEAN) + @DeleteMapping("/clean") + public AjaxResult clean() + { + logininforService.cleanLogininfor(); + return success(); + } + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") + @Log(title = "账户解锁", businessType = BusinessType.OTHER) + @GetMapping("/unlock/{userName}") + public AjaxResult unlock(@PathVariable("userName") String userName) + { + passwordService.clearLoginRecordCache(userName); + return success(); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/SysOperlogController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/SysOperlogController.java new file mode 100644 index 0000000000000000000000000000000000000000..a1d0f5a3e9d87eb52c30c3c4e4905f259d84f9aa --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/SysOperlogController.java @@ -0,0 +1,69 @@ +package com.ruoyi.app.controller.monitor; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.SysOperLog; +import com.ruoyi.system.service.ISysOperLogService; + +/** + * 操作日志记录 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/operlog") +public class SysOperlogController extends BaseController +{ + @Autowired + private ISysOperLogService operLogService; + + @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") + @GetMapping("/list") + public TableDataInfo list(SysOperLog operLog) + { + startPage(); + List list = operLogService.selectOperLogList(operLog); + return getDataTable(list); + } + + @Log(title = "操作日志", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysOperLog operLog) + { + List list = operLogService.selectOperLogList(operLog); + ExcelUtil util = new ExcelUtil(SysOperLog.class); + util.exportExcel(response, list, "操作日志"); + } + + @Log(title = "操作日志", businessType = BusinessType.DELETE) + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") + @DeleteMapping("/{operIds}") + public AjaxResult remove(@PathVariable Long[] operIds) + { + return toAjax(operLogService.deleteOperLogByIds(operIds)); + } + + @Log(title = "操作日志", businessType = BusinessType.CLEAN) + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") + @DeleteMapping("/clean") + public AjaxResult clean() + { + operLogService.cleanOperLog(); + return success(); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/SysUserOnlineController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/SysUserOnlineController.java new file mode 100644 index 0000000000000000000000000000000000000000..55b8ec343c558930daba012c7d7ee4e6572a746a --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/monitor/SysUserOnlineController.java @@ -0,0 +1,92 @@ +package com.ruoyi.app.controller.monitor; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysUserOnline; +import com.ruoyi.system.service.ISysUserOnlineService; + +/** + * 在线用户监控 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/online") +public class SysUserOnlineController extends BaseController +{ + @Autowired + private ISysUserOnlineService userOnlineService; + + @Autowired + private RedisCache redisCache; + + @PreAuthorize("@ss.hasPermi('monitor:online:list')") + @GetMapping("/list") + public TableDataInfo list(String ipaddr, String userName) + { + Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); + List userOnlineList = new ArrayList(); + for (String key : keys) + { + LoginUser user = redisCache.getCacheObject(key); + if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) + { + if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) + { + userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); + } + } + else if (StringUtils.isNotEmpty(ipaddr)) + { + if (StringUtils.equals(ipaddr, user.getIpaddr())) + { + userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); + } + } + else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) + { + if (StringUtils.equals(userName, user.getUsername())) + { + userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); + } + } + else + { + userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); + } + } + Collections.reverse(userOnlineList); + userOnlineList.removeAll(Collections.singleton(null)); + return getDataTable(userOnlineList); + } + + /** + * 强退用户 + */ + @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") + @Log(title = "在线用户", businessType = BusinessType.FORCE) + @DeleteMapping("/{tokenId}") + public AjaxResult forceLogout(@PathVariable String tokenId) + { + redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); + return success(); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysAppMenuController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysAppMenuController.java new file mode 100644 index 0000000000000000000000000000000000000000..40ec0c715c0ded262483c5b620d7b858f3198b60 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysAppMenuController.java @@ -0,0 +1,118 @@ +package com.ruoyi.app.controller.system; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysAppMenu; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysAppMenuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 菜单信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/system/appMenu") +public class SysAppMenuController extends BaseController { + @Autowired + private ISysAppMenuService appMenuService; + + /** + * 获取菜单列表 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:list')") + @GetMapping("/list") + public AjaxResult list(SysAppMenu menu) { + List menus = appMenuService.selectMenuList(menu, getUserId()); + return success(menus); + } + + /** + * 根据菜单编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:query')") + @GetMapping(value = "/{menuId}") + public AjaxResult getInfo(@PathVariable Long menuId) { + return success(appMenuService.selectMenuById(menuId)); + } + + /** + * 获取菜单下拉树列表 + */ + @GetMapping("/treeselect") + public AjaxResult treeselect(SysAppMenu menu) { + List menus = appMenuService.selectMenuList(menu, getUserId()); + return success(appMenuService.buildMenuTreeSelect(menus)); + } + + /** + * 加载对应角色菜单列表树 + */ + @GetMapping(value = "/roleMenuTreeselect/{roleId}/{menuCheckStrictly}") + public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId,@PathVariable("menuCheckStrictly") Boolean menuCheckStrictly) { + List menus = appMenuService.selectMenuList(getUserId()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", appMenuService.selectMenuListByRoleId(roleId,menuCheckStrictly)); + ajax.put("menus", appMenuService.buildMenuTreeSelect(menus)); + return ajax; + } + + /** + * 新增菜单 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:add')") + @Log(title = "菜单管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysAppMenu menu) { + if (UserConstants.NOT_UNIQUE.equals(appMenuService.checkMenuNameUnique(menu))) { + return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { + return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + menu.setCreateBy(getUsername()); + return toAjax(appMenuService.insertMenu(menu)); + } + + /** + * 修改菜单 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:edit')") + @Log(title = "菜单管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysAppMenu menu) { + if (UserConstants.NOT_UNIQUE.equals(appMenuService.checkMenuNameUnique(menu))) { + return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); + } else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) { + return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } else if (menu.getMenuId().equals(menu.getParentId())) { + return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); + } + menu.setUpdateBy(getUsername()); + return toAjax(appMenuService.updateMenu(menu)); + } + + /** + * 删除菜单 + */ + @PreAuthorize("@ss.hasPermi('system:appMenu:remove')") + @Log(title = "菜单管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{menuId}") + public AjaxResult remove(@PathVariable("menuId") Long menuId) { + if (appMenuService.hasChildByMenuId(menuId)) { + return warn("存在子菜单,不允许删除"); + } + if (appMenuService.checkMenuExistRole(menuId)) { + return warn("菜单已分配,不允许删除"); + } + return toAjax(appMenuService.deleteMenuById(menuId)); + } +} \ No newline at end of file diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysConfigController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysConfigController.java new file mode 100644 index 0000000000000000000000000000000000000000..305f25760c4d627802b404a1b176615431dac773 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysConfigController.java @@ -0,0 +1,134 @@ +package com.ruoyi.app.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.SysConfig; +import com.ruoyi.system.service.ISysConfigService; + +/** + * 参数配置 信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/system/config") +public class SysConfigController extends BaseController +{ + @Autowired + private ISysConfigService configService; + + /** + * 获取参数配置列表 + */ + @PreAuthorize("@ss.hasPermi('system:config:list')") + @GetMapping("/list") + public TableDataInfo list(SysConfig config) + { + startPage(); + List list = configService.selectConfigList(config); + return getDataTable(list); + } + + @Log(title = "参数管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:config:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysConfig config) + { + List list = configService.selectConfigList(config); + ExcelUtil util = new ExcelUtil(SysConfig.class); + util.exportExcel(response, list, "参数数据"); + } + + /** + * 根据参数编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:config:query')") + @GetMapping(value = "/{configId}") + public AjaxResult getInfo(@PathVariable Long configId) + { + return success(configService.selectConfigById(configId)); + } + + /** + * 根据参数键名查询参数值 + */ + @GetMapping(value = "/configKey/{configKey}") + public AjaxResult getConfigKey(@PathVariable String configKey) + { + return success(configService.selectConfigByKey(configKey)); + } + + /** + * 新增参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:add')") + @Log(title = "参数管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysConfig config) + { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) + { + return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setCreateBy(getUsername()); + return toAjax(configService.insertConfig(config)); + } + + /** + * 修改参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:edit')") + @Log(title = "参数管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysConfig config) + { + if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) + { + return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setUpdateBy(getUsername()); + return toAjax(configService.updateConfig(config)); + } + + /** + * 删除参数配置 + */ + @PreAuthorize("@ss.hasPermi('system:config:remove')") + @Log(title = "参数管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{configIds}") + public AjaxResult remove(@PathVariable Long[] configIds) + { + configService.deleteConfigByIds(configIds); + return success(); + } + + /** + * 刷新参数缓存 + */ + @PreAuthorize("@ss.hasPermi('system:config:remove')") + @Log(title = "参数管理", businessType = BusinessType.CLEAN) + @DeleteMapping("/refreshCache") + public AjaxResult refreshCache() + { + configService.resetConfigCache(); + return success(); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysDeptController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysDeptController.java new file mode 100644 index 0000000000000000000000000000000000000000..fbc4baca34aed7eff2ffe5ad38003090dc90be67 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysDeptController.java @@ -0,0 +1,132 @@ +package com.ruoyi.app.controller.system; + +import java.util.List; +import org.apache.commons.lang3.ArrayUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +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.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysDeptService; + +/** + * 部门信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/system/dept") +public class SysDeptController extends BaseController +{ + @Autowired + private ISysDeptService deptService; + + /** + * 获取部门列表 + */ + @PreAuthorize("@ss.hasPermi('system:dept:list')") + @GetMapping("/list") + public AjaxResult list(SysDept dept) + { + List depts = deptService.selectDeptList(dept); + return success(depts); + } + + /** + * 查询部门列表(排除节点) + */ + @PreAuthorize("@ss.hasPermi('system:dept:list')") + @GetMapping("/list/exclude/{deptId}") + public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) + { + List depts = deptService.selectDeptList(new SysDept()); + depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); + return success(depts); + } + + /** + * 根据部门编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:dept:query')") + @GetMapping(value = "/{deptId}") + public AjaxResult getInfo(@PathVariable Long deptId) + { + deptService.checkDeptDataScope(deptId); + return success(deptService.selectDeptById(deptId)); + } + + /** + * 新增部门 + */ + @PreAuthorize("@ss.hasPermi('system:dept:add')") + @Log(title = "部门管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDept dept) + { + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) + { + return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + dept.setCreateBy(getUsername()); + return toAjax(deptService.insertDept(dept)); + } + + /** + * 修改部门 + */ + @PreAuthorize("@ss.hasPermi('system:dept:edit')") + @Log(title = "部门管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDept dept) + { + Long deptId = dept.getDeptId(); + deptService.checkDeptDataScope(deptId); + if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) + { + return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); + } + else if (dept.getParentId().equals(deptId)) + { + return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); + } + else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) + { + return error("该部门包含未停用的子部门!"); + } + dept.setUpdateBy(getUsername()); + return toAjax(deptService.updateDept(dept)); + } + + /** + * 删除部门 + */ + @PreAuthorize("@ss.hasPermi('system:dept:remove')") + @Log(title = "部门管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{deptId}") + public AjaxResult remove(@PathVariable Long deptId) + { + if (deptService.hasChildByDeptId(deptId)) + { + return warn("存在下级部门,不允许删除"); + } + if (deptService.checkDeptExistUser(deptId)) + { + return warn("部门存在用户,不允许删除"); + } + deptService.checkDeptDataScope(deptId); + return toAjax(deptService.deleteDeptById(deptId)); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysDictDataController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysDictDataController.java new file mode 100644 index 0000000000000000000000000000000000000000..42fc1528def174a6b48ebd7c39aea064b07866a9 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysDictDataController.java @@ -0,0 +1,135 @@ +package com.ruoyi.app.controller.system; + +import java.util.ArrayList; +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.service.ISysDictDataService; +import com.ruoyi.system.service.ISysDictTypeService; + +/** + * 数据字典信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/system/dict/data") +public class SysDictDataController extends BaseController +{ + @Autowired + private ISysDictDataService dictDataService; + + @Autowired + private ISysDictTypeService dictTypeService; + + @PreAuthorize("@ss.hasPermi('system:dict:list')") + @GetMapping("/list") + public TableDataInfo list(SysDictData dictData) + { + startPage(); + List list = dictDataService.selectDictDataList(dictData); + return getDataTable(list); + } + + @Log(title = "字典数据", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:dict:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysDictData dictData) + { + List list = dictDataService.selectDictDataList(dictData); + ExcelUtil util = new ExcelUtil(SysDictData.class); + util.exportExcel(response, list, "字典数据"); + } + + /** + * 查询字典数据详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictCode}") + public AjaxResult getInfo(@PathVariable Long dictCode) + { + return success(dictDataService.selectDictDataById(dictCode)); + } + + /** + * 根据字典类型查询字典数据信息 + */ + @GetMapping(value = "/type/{dictType}") + public AjaxResult dictType(@PathVariable String dictType) + { + List data = dictTypeService.selectDictDataByType(dictType); + if (StringUtils.isNull(data)) + { + data = new ArrayList(); + } + return success(data); + } + + /** + * 新增字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:add')") + @Log(title = "字典数据", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDictData dict) + { + dict.setCreateBy(getUsername()); + return toAjax(dictDataService.insertDictData(dict)); + } + + /** + * 修改保存字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:edit')") + @Log(title = "字典数据", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDictData dict) + { + dict.setUpdateBy(getUsername()); + return toAjax(dictDataService.updateDictData(dict)); + } + + /** + * 删除字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{dictCodes}") + public AjaxResult remove(@PathVariable Long[] dictCodes) + { + dictDataService.deleteDictDataByIds(dictCodes); + return success(); + } + + /** + * 根据字典类型城市查询下属区域 + */ + @GetMapping(value = "/county") + public AjaxResult selectCountyByCity(String cityValue) + { + List data = dictTypeService.selectCountyByCity(cityValue); + if (StringUtils.isNull(data)) + { + data = new ArrayList(); + } + return success(data); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysDictTypeController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysDictTypeController.java new file mode 100644 index 0000000000000000000000000000000000000000..b802e7e8af24b3fe5359af7a59dc226694f3557f --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysDictTypeController.java @@ -0,0 +1,132 @@ +package com.ruoyi.app.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictType; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.service.ISysDictTypeService; + +/** + * 数据字典信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/system/dict/type") +public class SysDictTypeController extends BaseController +{ + @Autowired + private ISysDictTypeService dictTypeService; + + @PreAuthorize("@ss.hasPermi('system:dict:list')") + @GetMapping("/list") + public TableDataInfo list(SysDictType dictType) + { + startPage(); + List list = dictTypeService.selectDictTypeList(dictType); + return getDataTable(list); + } + + @Log(title = "字典类型", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:dict:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysDictType dictType) + { + List list = dictTypeService.selectDictTypeList(dictType); + ExcelUtil util = new ExcelUtil(SysDictType.class); + util.exportExcel(response, list, "字典类型"); + } + + /** + * 查询字典类型详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictId}") + public AjaxResult getInfo(@PathVariable Long dictId) + { + return success(dictTypeService.selectDictTypeById(dictId)); + } + + /** + * 新增字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:add')") + @Log(title = "字典类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDictType dict) + { + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) + { + return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setCreateBy(getUsername()); + return toAjax(dictTypeService.insertDictType(dict)); + } + + /** + * 修改字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:edit')") + @Log(title = "字典类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDictType dict) + { + if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) + { + return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setUpdateBy(getUsername()); + return toAjax(dictTypeService.updateDictType(dict)); + } + + /** + * 删除字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{dictIds}") + public AjaxResult remove(@PathVariable Long[] dictIds) + { + dictTypeService.deleteDictTypeByIds(dictIds); + return success(); + } + + /** + * 刷新字典缓存 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.CLEAN) + @DeleteMapping("/refreshCache") + public AjaxResult refreshCache() + { + dictTypeService.resetDictCache(); + return success(); + } + + /** + * 获取字典选择框列表 + */ + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + List dictTypes = dictTypeService.selectDictTypeAll(); + return success(dictTypes); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysIndexController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysIndexController.java new file mode 100644 index 0000000000000000000000000000000000000000..bd6ed8d93e4304cb2bee913983ffd654aec62953 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysIndexController.java @@ -0,0 +1,29 @@ +package com.ruoyi.app.controller.system; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.utils.StringUtils; + +/** + * 首页 + * + * @author ruoyi + */ +@RestController +public class SysIndexController +{ + /** 系统基础配置 */ + @Autowired + private RuoYiConfig ruoyiConfig; + + /** + * 访问首页,提示语 + */ + @RequestMapping("/") + public String index() + { + return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysLoginController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysLoginController.java new file mode 100644 index 0000000000000000000000000000000000000000..7595eb20cffb8855832d606c55fd6d7a9c648983 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysLoginController.java @@ -0,0 +1,167 @@ +package com.ruoyi.app.controller.system; + +import cn.hutool.core.util.StrUtil; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RateLimiter; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysMenu; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginBody; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.enums.LimitType; +import com.ruoyi.common.enums.OperatorType; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.framework.web.service.SysLoginService; +import com.ruoyi.framework.web.service.SysPermissionService; +import com.ruoyi.system.service.ISysDictDataService; +import com.ruoyi.system.service.ISysMenuService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 登录验证 + * + * @author ruoyi + */ +@RestController +public class SysLoginController { + @Autowired + private SysLoginService loginService; + + @Autowired + private ISysMenuService menuService; + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private YwSceneService yw_sceneService; + + @Autowired + private ISysDictDataService dictDataService; + + /** + * 发送登录短信验证码 + * + * @param + * @return + */ + @PostMapping("/getLoginCode") + @ApiOperation(value = "发送登录短信验证码") + @Log(title = "发送登录短信验证码日志", businessType = BusinessType.OTHER,operatorType= OperatorType.MOBILE) + @RateLimiter(time = 3,count = 1,limitType= LimitType.IP) + @RepeatSubmit(interval = 60000,message = "1分钟内请勿重复提交") + public AjaxResult getCode(@RequestBody LoginBody loginBody) throws Exception { + return loginService.getCode(loginBody); + } + + /** + * 登录方法 + * + * @param loginBody 登录信息 + * @return 结果 + */ + @PostMapping("/login") + @RateLimiter(time = 3,count = 1,limitType= LimitType.IP) + @Log(title = "发送登录日志", businessType = BusinessType.OTHER,operatorType= OperatorType.MANAGE) + public AjaxResult login(@RequestBody LoginBody loginBody) { + AjaxResult ajax = AjaxResult.success(); + String token = ""; + // 生成令牌 + if ("1".equals(loginBody.getLoginType())) { + token = loginService.loginByPhone(loginBody.getPhone(), loginBody.getCode(), + loginBody.getUuid(), UserConstants.APP); + } else { + token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), + loginBody.getUuid()); + } + ajax.put(Constants.TOKEN, Constants.TOKEN_PREFIX + token); + return ajax; + } + + /** + * app集成登录 + * + * @param mobile 登录信息 + * @return 结果 + */ + @PostMapping("/ydLogin") +// @RateLimiter(time = 3,count = 1,limitType= LimitType.IP) + @Log(title = "移动集成登录日志", businessType = BusinessType.OTHER,operatorType= OperatorType.OTHER) + public AjaxResult ydAppLogin(@RequestParam("mobile") String mobile) + { + if(StrUtil.isBlank(mobile)){ + AjaxResult ajaxResult = new AjaxResult(); + ajaxResult.put("success","false"); + ajaxResult.put("msg","手机号不能为空"); + ajaxResult.put("return_str",""); + return ajaxResult; + } + // 生成令牌 + return loginService.ydLoginByPhone(mobile); + } + + /** + * 获取用户信息 + * + * @return 用户信息 + */ + @GetMapping("getInfo") + @RepeatSubmit(enable = false) + public AjaxResult getInfo() { + SysUser user = SecurityUtils.getLoginUser().getUser(); + if (StrUtil.isNotBlank(user.getUserType())) { + String label = DictUtils.getDictLabel("yw_specialty", user.getUserType()); + user.setUserTypeStr(label); + } + // 角色集合 + Set roles = permissionService.getRolePermission(user); + // 权限集合 + Set permissions = permissionService.getAppMenuPermission(user); + //场馆集合 + //20230505APP端需要把用户场馆给绑定到下拉框,对于无法查询的那条场馆不能绑定,需要特殊处理去掉 + List ywScenes = yw_sceneService.getVenueByUserCanNoData(user,true); + //区县集合 + List countyIds = ywScenes.stream().map(YwScene::getAreaCountyId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); + List countyList = dictDataService.selectDictLabelByValues("yw_county", countyIds); + //地市集合 + List cityIds = countyIds.stream().map(l -> l.substring(0, 4)).distinct().collect(Collectors.toList()); + List cityList = dictDataService.selectDictLabelByValues("yw_city", cityIds); + //专业集合 +// List ywScenes = yw_sceneService.getVenueByUser(user); + + AjaxResult ajax = AjaxResult.success(); + ajax.put("user", user); + ajax.put("roles", roles); + ajax.put("permissions", permissions); + ajax.put("ywScenes", ywScenes); + ajax.put("countys", countyList); + ajax.put("cityList", cityList); + return ajax; + } + + /** + * 获取路由信息 + * + * @return 路由信息 + */ + @GetMapping("getRouters") + public AjaxResult getRouters() { + Long userId = SecurityUtils.getUserId(); + List menus = menuService.selectMenuTreeByUserId(userId); + return AjaxResult.success(menuService.buildMenus(menus)); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysPostController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysPostController.java new file mode 100644 index 0000000000000000000000000000000000000000..73e50b3691b4998998a33957094db43052ba0de2 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysPostController.java @@ -0,0 +1,130 @@ +package com.ruoyi.app.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.SysPost; +import com.ruoyi.system.service.ISysPostService; + +/** + * 岗位信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/system/post") +public class SysPostController extends BaseController +{ + @Autowired + private ISysPostService postService; + + /** + * 获取岗位列表 + */ + @PreAuthorize("@ss.hasPermi('system:post:list')") + @GetMapping("/list") + public TableDataInfo list(SysPost post) + { + startPage(); + List list = postService.selectPostList(post); + return getDataTable(list); + } + + @Log(title = "岗位管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:post:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysPost post) + { + List list = postService.selectPostList(post); + ExcelUtil util = new ExcelUtil(SysPost.class); + util.exportExcel(response, list, "岗位数据"); + } + + /** + * 根据岗位编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:post:query')") + @GetMapping(value = "/{postId}") + public AjaxResult getInfo(@PathVariable Long postId) + { + return success(postService.selectPostById(postId)); + } + + /** + * 新增岗位 + */ + @PreAuthorize("@ss.hasPermi('system:post:add')") + @Log(title = "岗位管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysPost post) + { + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) + { + return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setCreateBy(getUsername()); + return toAjax(postService.insertPost(post)); + } + + /** + * 修改岗位 + */ + @PreAuthorize("@ss.hasPermi('system:post:edit')") + @Log(title = "岗位管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysPost post) + { + if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) + { + return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) + { + return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); + } + post.setUpdateBy(getUsername()); + return toAjax(postService.updatePost(post)); + } + + /** + * 删除岗位 + */ + @PreAuthorize("@ss.hasPermi('system:post:remove')") + @Log(title = "岗位管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{postIds}") + public AjaxResult remove(@PathVariable Long[] postIds) + { + return toAjax(postService.deletePostByIds(postIds)); + } + + /** + * 获取岗位选择框列表 + */ + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + List posts = postService.selectPostAll(); + return success(posts); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysProfileController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysProfileController.java new file mode 100644 index 0000000000000000000000000000000000000000..24633344e0885a41e57ead3a1ee23e518a285e53 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysProfileController.java @@ -0,0 +1,145 @@ +package com.ruoyi.app.controller.system; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +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.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.MimeTypeUtils; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.service.ISysUserService; + +/** + * 个人信息 业务处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/system/user/profile") +public class SysProfileController extends BaseController +{ + @Autowired + private ISysUserService userService; + + @Autowired + private TokenService tokenService; + + /** + * 个人信息 + */ + @GetMapping + public AjaxResult profile() + { + LoginUser loginUser = getLoginUser(); + SysUser user = loginUser.getUser(); + AjaxResult ajax = AjaxResult.success(user); + ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); + ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); + return ajax; + } + + /** + * 修改用户 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult updateProfile(@RequestBody SysUser user) + { + LoginUser loginUser = getLoginUser(); + SysUser sysUser = loginUser.getUser(); + user.setUserName(sysUser.getUserName()); + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setUserId(sysUser.getUserId()); + user.setPassword(null); + user.setAvatar(null); + user.setDeptId(null); + if (userService.updateUserProfile(user) > 0) + { + // 更新缓存用户信息 + sysUser.setNickName(user.getNickName()); + sysUser.setPhonenumber(user.getPhonenumber()); + sysUser.setEmail(user.getEmail()); + sysUser.setSex(user.getSex()); + sysUser.setFirstPage(user.getFirstPage()); + tokenService.setLoginUser(loginUser); + return success(); + } + return error("修改个人信息异常,请联系管理员"); + } + + /** + * 重置密码 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PutMapping("/updatePwd") + public AjaxResult updatePwd(String oldPassword, String newPassword) + { + LoginUser loginUser = getLoginUser(); + String userName = loginUser.getUsername(); + String password = loginUser.getPassword(); + if (!SecurityUtils.matchesPassword(oldPassword, password)) + { + return error("修改密码失败,旧密码错误"); + } + if (SecurityUtils.matchesPassword(newPassword, password)) + { + return error("新密码不能与旧密码相同"); + } + if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) + { + // 更新缓存用户密码 + loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword)); + tokenService.setLoginUser(loginUser); + return success(); + } + return error("修改密码异常,请联系管理员"); + } + + /** + * 头像上传 + */ + @Log(title = "用户头像", businessType = BusinessType.UPDATE) + @PostMapping("/avatar") + public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception + { + if (!file.isEmpty()) + { + LoginUser loginUser = getLoginUser(); + String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); + if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) + { + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", avatar); + // 更新缓存用户头像 + loginUser.getUser().setAvatar(avatar); + tokenService.setLoginUser(loginUser); + return ajax; + } + } + return error("上传图片异常,请联系管理员"); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysRegisterController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysRegisterController.java new file mode 100644 index 0000000000000000000000000000000000000000..78331eedea0bb1b693c3368f5037bbe8bbe5749f --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysRegisterController.java @@ -0,0 +1,38 @@ +package com.ruoyi.app.controller.system; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.RegisterBody; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.web.service.SysRegisterService; +import com.ruoyi.system.service.ISysConfigService; + +/** + * 注册验证 + * + * @author ruoyi + */ +@RestController +public class SysRegisterController extends BaseController +{ + @Autowired + private SysRegisterService registerService; + + @Autowired + private ISysConfigService configService; + + @PostMapping("/register") + public AjaxResult register(@RequestBody RegisterBody user) + { + if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) + { + return error("当前系统没有开启注册功能!"); + } + String msg = registerService.register(user); + return StringUtils.isEmpty(msg) ? success() : error(msg); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysRoleController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysRoleController.java new file mode 100644 index 0000000000000000000000000000000000000000..ae93f78873f211a410eb2423acf0e4bbbb8dc6ad --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysRoleController.java @@ -0,0 +1,264 @@ +package com.ruoyi.app.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; +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.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.service.SysPermissionService; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.service.ISysDeptService; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.system.service.ISysUserService; + +/** + * 角色信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/system/role") +public class SysRoleController extends BaseController +{ + @Autowired + private ISysRoleService roleService; + + @Autowired + private TokenService tokenService; + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private ISysUserService userService; + + @Autowired + private ISysDeptService deptService; + + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/list") + public TableDataInfo list(SysRole role) + { + startPage(); + List list = roleService.selectRoleList(role); + return getDataTable(list); + } + + @Log(title = "角色管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:role:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysRole role) + { + List list = roleService.selectRoleList(role); + ExcelUtil util = new ExcelUtil(SysRole.class); + util.exportExcel(response, list, "角色数据"); + } + + /** + * 根据角色编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping(value = "/{roleId}") + public AjaxResult getInfo(@PathVariable Long roleId) + { + roleService.checkRoleDataScope(roleId); + return success(roleService.selectRoleById(roleId)); + } + + /** + * 新增角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:add')") + @Log(title = "角色管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysRole role) + { + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) + { + return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setCreateBy(getUsername()); + return toAjax(roleService.insertRole(role)); + + } + + /** + * 修改保存角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) + { + return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) + { + return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setUpdateBy(getUsername()); + + if (roleService.updateAppRole(role) > 0) + { + // 更新缓存用户权限 + LoginUser loginUser = getLoginUser(); + if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) + { + loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); + loginUser.setAppPermissions(permissionService.getAppMenuPermission(loginUser.getUser())); + loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); + tokenService.setLoginUser(loginUser); + } + return success(); + } + return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); + } + + /** + * 修改保存数据权限 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping("/dataScope") + public AjaxResult dataScope(@RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + return toAjax(roleService.authDataScope(role)); + } + + /** + * 状态修改 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysRole role) + { + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + role.setUpdateBy(getUsername()); + return toAjax(roleService.updateRoleStatus(role)); + } + + /** + * 删除角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:remove')") + @Log(title = "角色管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{roleIds}") + public AjaxResult remove(@PathVariable Long[] roleIds) + { + return toAjax(roleService.deleteRoleByIds(roleIds)); + } + + /** + * 获取角色选择框列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + return success(roleService.selectRoleAll()); + } + + /** + * 查询已分配用户角色列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/authUser/allocatedList") + public TableDataInfo allocatedList(SysUser user) + { + startPage(); + List list = userService.selectAllocatedList(user); + return getDataTable(list); + } + + /** + * 查询未分配用户角色列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/authUser/unallocatedList") + public TableDataInfo unallocatedList(SysUser user) + { + startPage(); + List list = userService.selectUnallocatedList(user); + return getDataTable(list); + } + + /** + * 取消授权用户 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/cancel") + public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) + { + return toAjax(roleService.deleteAuthUser(userRole)); + } + + /** + * 批量取消授权用户 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/cancelAll") + public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) + { + return toAjax(roleService.deleteAuthUsers(roleId, userIds)); + } + + /** + * 批量选择用户授权 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/selectAll") + public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) + { + roleService.checkRoleDataScope(roleId); + return toAjax(roleService.insertAuthUsers(roleId, userIds)); + } + + /** + * 获取对应角色部门树列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping(value = "/deptTree/{roleId}") + public AjaxResult deptTree(@PathVariable("roleId") Long roleId) + { + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); + ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); + return ajax; + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysUserController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysUserController.java new file mode 100644 index 0000000000000000000000000000000000000000..2d0e0e1c23713d8f46f0921fbdfbaab60ba61912 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/system/SysUserController.java @@ -0,0 +1,561 @@ +package com.ruoyi.app.controller.system; + +import cn.hutool.core.util.StrUtil; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.UserConstants; +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.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.eastcom_yw.domain.YwScene; +import com.ruoyi.eastcom_yw.domain.YwSceneUser; +import com.ruoyi.eastcom_yw.service.YwSceneService; +import com.ruoyi.eastcom_yw.service.YwSceneUserService; +import com.ruoyi.framework.web.service.SysPermissionService; +import com.ruoyi.framework.web.service.TokenService; +import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.service.*; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 用户信息 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/app/system/user") +@Transactional +public class SysUserController extends BaseController +{ + @Autowired + private ISysUserService userService; + + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysDeptService deptService; + + @Autowired + private ISysPostService postService; + + @Autowired + private YwSceneUserService ywSceneUserService; + + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private TokenService tokenService; + + @Autowired + private RedisCache redisCache; + + @Autowired + private RedisTemplate redisTemplate; + + @Autowired + private ISysDictDataService dictDataService; + + @Autowired + private YwSceneService ywSceneService; + + @Autowired + private SysUserMapper sysUserMapper; + + + /** + * 获取用户列表 + */ +// @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/list") + public TableDataInfo list(SysUser user) + { + startPage(); + List list = userService.selectUserList(user); + + if(list.size()>0) + { + + List lstUserId = list.stream().map(SysUser::getUserId).collect(Collectors.toList()); + + List listScene = ywSceneUserService.getVenuesByUserIds(lstUserId); + + List listRole = roleService.selectRolesByUserIds(lstUserId); + + for(SysUser sysUser:list) { + + List lstSceneId = listScene.stream().filter(r -> r.getUserId().equals(sysUser.getUserId())).map(YwSceneUser::getSceneId).collect(Collectors.toList()); + int userSceneNum = lstSceneId.size(); + if(userSceneNum>0) + { + Long[] arr_ids = new Long[userSceneNum]; + lstSceneId.toArray(arr_ids); + List venueNames = listScene.stream().filter(r -> r.getUserId().equals(sysUser.getUserId())).map(YwSceneUser::getVenueName).collect(Collectors.toList()); +// String[] arrNames = new String[venueNames.size()]; + sysUser.setVenueIds(arr_ids); + sysUser.setVenueNames(venueNames); + } + else + { + sysUser.setVenueIds(new Long[0]); + sysUser.setVenueNames(new ArrayList()); + } + + List roleNames = listRole.stream().filter(r -> r.getUserId().equals(sysUser.getUserId())).map(SysUserRole::getRoleName).collect(Collectors.toList()); + if(roleNames.size()>0) { +// String[] arrRoleNames = new String[roleNames.size()]; + sysUser.setRoleNames(roleNames); + } + else + { + sysUser.setRoleNames(new ArrayList()); + } + if (StringUtils.isNotEmpty(sysUser.getBelongArea())) { + sysUser.setBelongArea(DictUtils.getDictLabel("yw_belong_area", sysUser.getBelongArea())); + } + + + } + } +// list.forEach( +// sysUser -> { +// List listScene = ywSceneUserService.getVenuesByUserId(sysUser.getUserId()); +// Long[] arr_ids = null; +// listScene.stream().map(YwSceneUser::getSceneId).collect(Collectors.toList()).toArray(arr_ids); +// List venueNames = listScene.stream().map(YwSceneUser::getVenueName).collect(Collectors.toList()); +// sysUser.setVenueIds(arr_ids); +// sysUser.setVenueNames(venueNames); +// +// List listRole = roleService.selectRolesByUserId2(sysUser.getUserId()); +// List roleNames = listRole.stream().map(SysRole::getRoleName).collect(Collectors.toList()); +// sysUser.setRoleNames(roleNames); +// +// } +// ); + return getDataTable(list); + } + + + @GetMapping("/specList") + public AjaxResult specList(SysUser user) + { + HashMap> map = userService.selectUserSpecList(user); + return success(map); + } + + + @Log(title = "用户管理", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:user:export')") + @PostMapping("/export") + public void export(HttpServletResponse response, SysUser user) + { + List list = userService.selectUserList(user); + + list.forEach( + sysUser -> { + List listScene = ywSceneUserService.getVenuesByUserId(sysUser.getUserId()); + List venueNames=new ArrayList<>(); + List venueBelong=new ArrayList<>(); + listScene.forEach( + ywSceneUserVo -> { + venueNames.add(ywSceneUserVo.getVenueName()); + if(StringUtils.isNotEmpty(ywSceneUserVo.getBelongArea())) + { + String label = DictUtils.getDictLabel("yw_belong_area", ywSceneUserVo.getBelongArea()); + venueBelong.add(label); + } + } + ); + sysUser.setStrVenueNames(StringUtils.join(venueNames,",")); + sysUser.setStrBelongArea(StringUtils.join(venueBelong,",")); + List listRole = roleService.selectRolesByUserId2(sysUser.getUserId()); + List roleNames=new ArrayList<>(); + listRole.forEach( + role -> { + roleNames.add(role.getRoleName()); + } + ); + //设置角色 + sysUser.setStrRoles(StringUtils.join(roleNames,",")); + + if(StringUtils.isNotEmpty(sysUser.getUserType())) + { + //设置用户专业 + String label = DictUtils.getDictLabel("yw_specialty", sysUser.getUserType()); + sysUser.setUserType(label); + } + + //对city和county进行转中文 + if(StringUtils.isNotEmpty(sysUser.getCity())) + { + String label = DictUtils.getDictLabel("yw_city", sysUser.getCity()); + sysUser.setCity(label); + } + if(StringUtils.isNotEmpty(sysUser.getCounty())) + { + String label = DictUtils.getDictLabel("yw_county", sysUser.getCounty()); + sysUser.setCounty(label); + } + //场馆分区转 + if(StringUtils.isNotEmpty(sysUser.getDistinctArea())) + { + String label = DictUtils.getDictLabel("yw_belong_area", sysUser.getDistinctArea()); + sysUser.setDistinctArea(label); + } + + } + ); + + ExcelUtil util = new ExcelUtil(SysUser.class); + util.exportExcel(response, list, "用户数据"); + } + + @Log(title = "用户管理", businessType = BusinessType.IMPORT) + @PreAuthorize("@ss.hasPermi('system:user:import')") + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(SysUser.class); + List userList = util.importExcel(file.getInputStream()); + String operName = getUsername(); + String message = userService.importUser(userList, updateSupport, operName); + return success(message); + } + + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) + { + ExcelUtil util = new ExcelUtil(SysUser.class); + util.importTemplateExcel(response, "用户数据"); + } + + /** + * 根据用户编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping(value = { "/", "/{userId}" }) + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) + { + userService.checkUserDataScope(userId); + AjaxResult ajax = AjaxResult.success(); + List roles = roleService.selectRoleAll(); + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); + ajax.put("posts", postService.selectPostAll()); + if (StringUtils.isNotNull(userId)) + { + SysUser sysUser = userService.selectUserById(userId); + ajax.put(AjaxResult.DATA_TAG, sysUser); + ajax.put("postIds", postService.selectPostListByUserId(userId)); + ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); + } + return ajax; + } + + /** + * 新增用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:add')") + @Log(title = "用户管理", businessType = BusinessType.INSERT) + @PostMapping + @Transactional + public AjaxResult add(@Validated @RequestBody SysUser user) + { + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setCreateBy(getUsername()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + + //假定是可以看到所有场馆的角色,那么就不需要设置区县 +// if(user.isAdmin()) +// { +// user.setCounty(""); +// } + + int num = userService.insertUser(user); + //新增用户的场馆 + //20230303更新用户的场馆Ids + if(num>0) { + if (ObjectUtils.isNotEmpty(user.getVenueIds())) { + if (user.getVenueIds().length > 0) { + for (Long venueId : user.getVenueIds()) { + YwSceneUser ywSceneUser = new YwSceneUser(); + //由于没有返回用户的ID,所有这边需要去查询一次 + SysUser thisUser = userService.selectUserByPhone(user.getPhonenumber()); + List userIds =new ArrayList<>(); + userIds.add(thisUser.getUserId()); + ywSceneUser.setUserIds(userIds); + ywSceneUser.setSceneId(venueId); + //设置默认值,需签到,红区 + ywSceneUser.setNeedSign("1"); + //20230330 jkj 如果用户有设置区域,就用这个区域作为默认值,否则的话就用红区做默认值 + if(StringUtils.isNotEmpty(user.getDistinctArea())) + { + ywSceneUser.setBelongArea(user.getDistinctArea()); + } + if(StringUtils.isEmpty(user.getDistinctArea())) { + ywSceneUser.setBelongArea("red"); + } + ywSceneUserService.create(ywSceneUser); + } + } + } + } + return toAjax(num); + } + + /** + * 修改用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping + @Transactional + public AjaxResult edit(@Validated @RequestBody SysUser user) + { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + if (StringUtils.isNotEmpty(user.getPhonenumber()) + && UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) + { + return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + else if (StringUtils.isNotEmpty(user.getEmail()) + && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) + { + return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); + } + user.setUpdateBy(getUsername()); + + //20230303更新用户的场馆Ids + //删除之前的场馆,重新绑定新的 + ywSceneUserService.delete(user.getUserId()); + if(ObjectUtils.isNotEmpty(user.getVenueIds())) + { + for(Long venueId : user.getVenueIds()) { + YwSceneUser ywSceneUser = new YwSceneUser(); + ywSceneUser.setUserId(user.getUserId()); + ywSceneUser.setSceneId(venueId); + //设置默认值,需签到,红区 + ywSceneUser.setNeedSign("1"); + //20230330 jkj 如果用户有设置区域,就用这个区域作为默认值,否则的话就用红区做默认值 + if(StringUtils.isNotEmpty(user.getDistinctArea())) + { + ywSceneUser.setBelongArea(user.getDistinctArea()); + } + if(StringUtils.isEmpty(user.getDistinctArea())) { + ywSceneUser.setBelongArea("red"); + } + ywSceneUserService.save(ywSceneUser); + } + } + int res =userService.updateUser(user); + if(res>0) + { + //删除用户短信验证码错误的次数的缓存 + if(UserStatus.OK.getCode().equals(user.getStatus())) + { + String key = CacheConstants.SMS_ERR_CNT_KEY + user.getPhonenumber(); + if(redisCache.hasKey(key)) + { + redisCache.deleteObject(key); + } + } + + //删除处理用户登录的缓存 + //客户反映不够人性化 + //更新用户的缓存 + Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); + for (String key : keys) { + LoginUser redisUser = redisCache.getCacheObject(key); + if (redisUser.getUserId().equals(user.getUserId())) { + redisUser.setVenueIds(user.getVenueIds()); + redisUser.setPermissions(permissionService.getMenuPermission(user)); + redisUser.setAppPermissions(permissionService.getAppMenuPermission(user)); + redisUser.setUser(userService.selectUserByUserName(user.getPhonenumber())); + //删除冻结账号的缓存 + if(UserStatus.SLEEP.getCode().equals(user.getStatus())) + { + redisCache.deleteObject(key); + } + else { + tokenService.refreshToken(redisUser); + } + } + } + +// +// for (String key : keys) { +// LoginUser redisUser = redisCache.getCacheObject(key); +// //找到登录用户 +// if (redisUser.getUserId().equals(user.getUserId())) { +// redisCache.deleteObject(key); +// } +// } + + } + return toAjax(res); + } + + /** + * 删除用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:remove')") + @Log(title = "用户管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{userIds}") + public AjaxResult remove(@PathVariable Long[] userIds) + { + //判断当前用户有没有进行中的物资审核任务 + List lstCheckUserId = sysUserMapper.selectCheckUserIdList(); + + for (Long checkUserId : lstCheckUserId) + { + if (ArrayUtils.contains(userIds, checkUserId)) + { +// return error("当前用户存在进行中的物资审核任务,请在任务完结或者驳回后重新选择其它审核人后再删除该用户"); + return error("当前用户存在进行中的物资审核任务"); + } + } + + if (ArrayUtils.contains(userIds, getUserId())) + { + return error("当前用户不能删除"); + } + + return toAjax(userService.deleteUserByIds(userIds)); + } + + /** + * 重置密码 + */ + @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/resetPwd") + public AjaxResult resetPwd(@RequestBody SysUser user) + { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + user.setUpdateBy(getUsername()); + return toAjax(userService.resetPwd(user)); + } + + /** + * 状态修改 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysUser user) + { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + user.setUpdateBy(getUsername()); + return toAjax(userService.updateUserStatus(user)); + } + + /** + * 根据用户编号获取授权角色 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping("/authRole/{userId}") + public AjaxResult authRole(@PathVariable("userId") Long userId) + { + AjaxResult ajax = AjaxResult.success(); + SysUser user = userService.selectUserById(userId); + List roles = roleService.selectRolesByUserId(userId); + ajax.put("user", user); + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); + return ajax; + } + + /** + * 用户授权角色 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.GRANT) + @PutMapping("/authRole") + public AjaxResult insertAuthRole(Long userId, Long[] roleIds) + { + userService.checkUserDataScope(userId); + userService.insertUserAuth(userId, roleIds); + return success(); + } + + /** + * 获取部门树列表 + */ + @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/deptTree") + public AjaxResult deptTree(SysDept dept) + { + return success(deptService.selectDeptTreeList(dept)); + } + + + /** + * 获取当前用户关联的场馆所在区县 + */ + @GetMapping("/getCounty") + public AjaxResult getCounty(String cityId) { + SysUser user = SecurityUtils.getLoginUser().getUser(); + if(SecurityUtils.isAdmin(user.getUserId())){ + List countyList = dictDataService.selectDictLabelByValues("yw_county", null); + countyList=countyList.stream().filter(l->cityId.equals(l.getDictValue().substring(0,4))).collect(Collectors.toList()); + return success(countyList); + } + //场馆集合 + List ywScenes = ywSceneService.getVenueByUser(user); + //区县集合 + List countyIds = ywScenes.stream().map(YwScene::getAreaCountyId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); + List countyList = dictDataService.selectDictLabelByValues("yw_county", countyIds); + + if(StrUtil.isNotBlank(cityId)){ + countyList=countyList.stream().filter(l->cityId.equals(l.getDictValue().substring(0,4))).collect(Collectors.toList()); + } + return success(countyList); + } + + /** + * 根据专业查询专业下人数 + */ + @GetMapping("/selectUserByUserType") + public TableDataInfo selectUserByUserType() + { + return getDataTable(userService.selectUserByUserType()); + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/controller/tool/TestController.java b/ruoyi-app/src/main/java/com/ruoyi/app/controller/tool/TestController.java new file mode 100644 index 0000000000000000000000000000000000000000..7fe6bef4e416785a644239ecd227d18b26801e3e --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/controller/tool/TestController.java @@ -0,0 +1,183 @@ +package com.ruoyi.app.controller.tool; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiOperation; + +/** + * swagger 用户测试方法 + * + * @author ruoyi + */ +@Api("用户信息管理") +@RestController +@RequestMapping("/test/user") +public class TestController extends BaseController +{ + private final static Map users = new LinkedHashMap(); + { + users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); + users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); + } + + @ApiOperation("获取用户列表") + @GetMapping("/list") + public R> userList() + { + List userList = new ArrayList(users.values()); + return R.ok(userList); + } + + @ApiOperation("获取用户详细") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) + @GetMapping("/{userId}") + public R getUser(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + return R.ok(users.get(userId)); + } + else + { + return R.fail("用户不存在"); + } + } + + @ApiOperation("新增用户") + @ApiImplicitParams({ + @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class), + @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class), + @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class), + @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class) + }) + @PostMapping("/save") + public R save(UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return R.fail("用户ID不能为空"); + } + users.put(user.getUserId(), user); + return R.ok(); + } + + @ApiOperation("更新用户") + @PutMapping("/update") + public R update(@RequestBody UserEntity user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) + { + return R.fail("用户ID不能为空"); + } + if (users.isEmpty() || !users.containsKey(user.getUserId())) + { + return R.fail("用户不存在"); + } + users.remove(user.getUserId()); + users.put(user.getUserId(), user); + return R.ok(); + } + + @ApiOperation("删除用户信息") + @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) + @DeleteMapping("/{userId}") + public R delete(@PathVariable Integer userId) + { + if (!users.isEmpty() && users.containsKey(userId)) + { + users.remove(userId); + return R.ok(); + } + else + { + return R.fail("用户不存在"); + } + } +} + +@ApiModel(value = "UserEntity", description = "用户实体") +class UserEntity +{ + @ApiModelProperty("用户ID") + private Integer userId; + + @ApiModelProperty("用户名称") + private String username; + + @ApiModelProperty("用户密码") + private String password; + + @ApiModelProperty("用户手机") + private String mobile; + + public UserEntity() + { + + } + + public UserEntity(Integer userId, String username, String password, String mobile) + { + this.userId = userId; + this.username = username; + this.password = password; + this.mobile = mobile; + } + + public Integer getUserId() + { + return userId; + } + + public void setUserId(Integer userId) + { + this.userId = userId; + } + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getMobile() + { + return mobile; + } + + public void setMobile(String mobile) + { + this.mobile = mobile; + } +} diff --git a/ruoyi-app/src/main/java/com/ruoyi/app/core/config/SwaggerConfig.java b/ruoyi-app/src/main/java/com/ruoyi/app/core/config/SwaggerConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..be199786ec5a17f777d6fb492de9064025f4ed99 --- /dev/null +++ b/ruoyi-app/src/main/java/com/ruoyi/app/core/config/SwaggerConfig.java @@ -0,0 +1,125 @@ +package com.ruoyi.app.core.config; + +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.ruoyi.common.config.RuoYiConfig; +import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.service.AuthorizationScope; +import springfox.documentation.service.Contact; +import springfox.documentation.service.SecurityReference; +import springfox.documentation.service.SecurityScheme; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; + +/** + * Swagger2的接口配置 + * + * @author ruoyi + */ +@Configuration +public class SwaggerConfig +{ + /** 系统基础配置 */ + @Autowired + private RuoYiConfig ruoyiConfig; + + /** 是否开启swagger */ + @Value("${swagger.enabled}") + private boolean enabled; + + /** 设置请求的统一前缀 */ + @Value("${swagger.pathMapping}") + private String pathMapping; + + /** + * 创建API + */ + @Bean + public Docket createRestApi() + { + return new Docket(DocumentationType.OAS_30) + // 是否启用Swagger + .enable(enabled) + // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) + .apiInfo(apiInfo()) + // 设置哪些接口暴露给Swagger展示 + .select() + // 扫描所有有注解的api,用这种方式更灵活 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + // 扫描指定包中的swagger注解 + // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) + // 扫描所有 .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build() + /* 设置安全模式,swagger可以设置访问token */ + .securitySchemes(securitySchemes()) + .securityContexts(securityContexts()) + .pathMapping(pathMapping); + } + + /** + * 安全模式,这里指定token通过Authorization头请求头传递 + */ + private List securitySchemes() + { + List apiKeyList = new ArrayList(); + apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); + return apiKeyList; + } + + /** + * 安全上下文 + */ + private List securityContexts() + { + List securityContexts = new ArrayList<>(); + securityContexts.add( + SecurityContext.builder() + .securityReferences(defaultAuth()) + .operationSelector(o -> o.requestMappingPattern().matches("/.*")) + .build()); + return securityContexts; + } + + /** + * 默认的安全上引用 + */ + private List defaultAuth() + { + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + List securityReferences = new ArrayList<>(); + securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); + return securityReferences; + } + + /** + * 添加摘要信息 + */ + private ApiInfo apiInfo() + { + // 用ApiInfoBuilder进行定制 + return new ApiInfoBuilder() + // 设置标题 + .title("标题:若依管理系统_接口文档") + // 描述 + .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") + // 作者信息 + .contact(new Contact(ruoyiConfig.getName(), null, null)) + // 版本 + .version("版本号:" + ruoyiConfig.getVersion()) + .build(); + } +} diff --git a/ruoyi-app/src/main/resources/META-INF/spring-devtools.properties b/ruoyi-app/src/main/resources/META-INF/spring-devtools.properties new file mode 100644 index 0000000000000000000000000000000000000000..2b23f85a3d4877a1d3e7aee610ce1c9cffdd159b --- /dev/null +++ b/ruoyi-app/src/main/resources/META-INF/spring-devtools.properties @@ -0,0 +1 @@ +restart.include.json=/com.alibaba.fastjson.*.jar \ No newline at end of file diff --git a/ruoyi-app/src/main/resources/application-bak1.yml b/ruoyi-app/src/main/resources/application-bak1.yml new file mode 100644 index 0000000000000000000000000000000000000000..dc3166bc2f8633629925dad84f7722c5a87666b2 --- /dev/null +++ b/ruoyi-app/src/main/resources/application-bak1.yml @@ -0,0 +1,145 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi_app + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: /home/hzdx/data/java/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource +# driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: +# url: jdbc:mysql://183.247.163.49:7940/ry_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:postgresql://10.71.80.241:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# url: jdbc:postgresql://127.0.0.1:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# url: jdbc:postgresql://183.247.163.49:8099/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + username: pms + password: Ea$tcyd2023 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 + host: 10.71.80.241 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: YyunRedis@Zxp01 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +#简报配置 +file: + #文件访问地址前缀 + visitpath: http://183.247.163.49:8093/profile/upload/ + #json本地保存路径 + briefingJsonPath: /home/hzdx/data/java/uploadPath/briefingJson + #json上传路径 + briefingShortUrl: http://10.71.80.185:31994/uploadfile/asiagame + #场馆配置中ppru拓扑图存放路径 + sceneJsonPath: /home/hzdx/data/java/uploadPath/shorturl + +# 短信发送配置 +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + #企业编号 + applicationid: 1087 + #企业名 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + +workFlowUrl: http://10.71.80.231:8080 +#workFlowUrl: http://127.0.0.1:8080 + +# minio 文件存储配置信息 +minio: + url: http://192.168.97.212:9000/ + endpoint: + accesskey: minioadmin + secretKey: minioadmin + bucketName: yyzxp + prefix: + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: false + +logging: + level: + com.ruoyi: info + org.springframework: warn \ No newline at end of file diff --git a/ruoyi-app/src/main/resources/application-bak2.yml b/ruoyi-app/src/main/resources/application-bak2.yml new file mode 100644 index 0000000000000000000000000000000000000000..2572bc3e412bf4a3b845f9902a457ebf07def959 --- /dev/null +++ b/ruoyi-app/src/main/resources/application-bak2.yml @@ -0,0 +1,145 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi_app + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: /home/hzdx/data/java/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource +# driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: +# url: jdbc:mysql://183.247.163.49:7940/ry_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:postgresql://10.71.80.231:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# url: jdbc:postgresql://127.0.0.1:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# url: jdbc:postgresql://183.247.163.49:8099/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + username: pms + password: Ea$tcyd2023 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 + host: 10.71.80.231 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: YyunRedis@Zxp01 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +#简报配置 +file: + #文件访问地址前缀 + visitpath: http://183.247.163.49:8093/profile/upload/ + #json本地保存路径 + briefingJsonPath: /home/hzdx/data/java/uploadPath/briefingJson + #json上传路径 + briefingShortUrl: http://10.71.80.185:31994/uploadfile/asiagame + #场馆配置中ppru拓扑图存放路径 + sceneJsonPath: /home/hzdx/data/java/uploadPath/shorturl + +# 短信发送配置 +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + #企业编号 + applicationid: 1087 + #企业名 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + +workFlowUrl: http://10.71.80.231:8080 +#workFlowUrl: http://127.0.0.1:8080 + +# minio 文件存储配置信息 +minio: + url: http://192.168.97.212:9000/ + endpoint: + accesskey: minioadmin + secretKey: minioadmin + bucketName: yyzxp + prefix: + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: false + +logging: + level: + com.ruoyi: info + org.springframework: warn \ No newline at end of file diff --git a/ruoyi-app/src/main/resources/application-druid.yml b/ruoyi-app/src/main/resources/application-druid.yml new file mode 100644 index 0000000000000000000000000000000000000000..77487354b1b40ddf8b827817316cb8ff2f434b02 --- /dev/null +++ b/ruoyi-app/src/main/resources/application-druid.yml @@ -0,0 +1,138 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi_app + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: C:/ruoyi/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource +# driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: +# url: jdbc:mysql://183.247.163.49:7940/ry_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:postgresql://192.168.97.156:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# url: jdbc:postgresql://183.247.163.49:8099/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + username: postgres + password: eastcom + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 + host: 192.168.97.212 + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: YyunRedis@Zxp01 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +#简报配置 +file: + #文件访问地址前缀 + visitpath: http://183.247.163.49:8093/profile/upload/ + #json本地保存路径 + briefingJsonPath: C:\json\ + #json上传路径 + briefingShortUrl: http://192.168.97.142:80/uploadfile/test + #场馆配置中ppru拓扑图存放路径 + sceneJsonPath: C:\home\data\java\uploadPath\upload\json\ + +# 短信发送配置 +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + #企业编号 + applicationid: 1087 + #企业名 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + +workFlowUrl: http://192.168.97.212:8080 + +# minio 文件存储配置信息 +minio: + url: http://192.168.97.212:9000/ + endpoint: + accesskey: minioadmin + secretKey: minioadmin + bucketName: yyzxp + prefix: + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: true \ No newline at end of file diff --git a/ruoyi-app/src/main/resources/application-test.yml b/ruoyi-app/src/main/resources/application-test.yml new file mode 100644 index 0000000000000000000000000000000000000000..af95de91ad83c8be42f72f48c4224dcb7a641ffb --- /dev/null +++ b/ruoyi-app/src/main/resources/application-test.yml @@ -0,0 +1,145 @@ +# 项目相关配置 +ruoyi: + # 名称 + name: RuoYi_app + # 版本 + version: 3.8.4 + # 版权年份 + copyrightYear: 2022 + # 实例演示开关 + demoEnabled: true + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: /home/data/java/uploadPath + # 获取ip地址开关 + addressEnabled: false + # 验证码类型 math 数组计算 char 字符验证 + captchaType: math + +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource +# driverClassName: com.mysql.cj.jdbc.Driver + driverClassName: org.postgresql.Driver + druid: + # 主库数据源 + master: +# url: jdbc:mysql://183.247.163.49:7940/ry_v3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# url: jdbc:postgresql://10.71.80.241:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + url: jdbc:postgresql://127.0.0.1:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# url: jdbc:postgresql://183.247.163.49:8099/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true + username: pms + password: Ea$tcyd2023 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 + 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 + # redis 配置 + redis: + # 地址 + host: localhost + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: YyunRedis@Zxp01 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + +#简报配置 +file: + #文件访问地址前缀 + visitpath: http://183.247.163.49:8093/profile/upload/ + #json本地保存路径 + briefingJsonPath: /home/data/java/uploadPath/briefingJson + #json上传路径 + briefingShortUrl: http://10.71.80.185:31994/uploadfile/asiagame + #场馆配置中ppru拓扑图存放路径 + sceneJsonPath: /home/data/java/uploadPath/shorturl + +# 短信发送配置 +system: + msg: + url: http://10.71.80.246/api/PublicHandler.ashx + sms_comm: send_sms + ivr_comm: send_ivr_call + mobileoffice_comm: send_mobileoffice_zmcc + #企业编号 + applicationid: 1087 + #企业名 + platform_code: 东信亚运重保 + publickey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB + +workFlowUrl: http://10.71.80.241:8080 +#workFlowUrl: http://127.0.0.1:8080 + +# minio 文件存储配置信息 +minio: + url: http://192.168.97.212:9000/ + endpoint: + accesskey: minioadmin + secretKey: minioadmin + bucketName: yyzxp + prefix: + +token: + # 是否允许同类型端同时登录(true允许 false不允许) + soloLogin: false + +logging: + level: + com.ruoyi: info + org.springframework: warn \ No newline at end of file diff --git a/ruoyi-app/src/main/resources/application.properties b/ruoyi-app/src/main/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..16046493c2963407b0f4016e061428fca9df650f --- /dev/null +++ b/ruoyi-app/src/main/resources/application.properties @@ -0,0 +1,5 @@ +pagehelper.reasonable=false +pagehelper.supportMethodsArguments=true +pagehelper.params.count=countSql +pagehelper.auto-dialect=true +pagehelper.auto-runtime-dialect=true \ No newline at end of file diff --git a/ruoyi-app/src/main/resources/application.yml b/ruoyi-app/src/main/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..8e79cd182943cad75426f12a425c3ab063a27c28 --- /dev/null +++ b/ruoyi-app/src/main/resources/application.yml @@ -0,0 +1,124 @@ +# 开发环境配置 +server: + # 服务器的HTTP端口,默认为8080 + port: 9000 + servlet: + # 应用的访问路径 + context-path: / + tomcat: + # tomcat的URI编码 + uri-encoding: UTF-8 + # 连接数满后的排队数,默认为100 + accept-count: 1000 + threads: + # tomcat最大线程数,默认为200 + max: 800 + # Tomcat启动初始化的线程数,默认值10 + min-spare: 100 + +# 安全停机 调用curl -X POST http://localhost:9000/monitor/shutdown +management: + endpoint: + shutdown: + enabled: true + endpoints: + web: + exposure: + include: "shutdown" + base-path: /monitor + +# 日志配置 +logging: + level: + com.ruoyi: debug + org.springframework: warn + +# 用户配置 +user: + password: + # 密码最大错误次数 + maxRetryCount: 5 + # 密码锁定时间(默认10分钟) + lockTime: 10 + sms: + # 密码最大错误次数 + maxRetryCount: 3 + # 密码锁定时间(默认10分钟) + lockTime: 15 + defaultCode: false + + +# Spring配置 +spring: + # 资源信息 + messages: + # 国际化资源文件路径 + basename: i18n/messages + profiles: + active: druid + # 文件上传 + servlet: + multipart: + # 单个文件大小 + max-file-size: 10MB + # 设置总上传的文件大小 + max-request-size: 20MB + # 服务模块 + devtools: + restart: + # 热部署开关 + enabled: true + jackson: + #日期格式化 + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 +# token配置 +token: + # 令牌自定义标识 + header: Authorization + # 令牌密钥 + secret: abcdefghijklmnopqrstuvwxyz + # 令牌有效期(默认30分钟) + expireTime: 4320 + +# MyBatis配置 +#mybatis: +# # 搜索指定包别名 +# typeAliasesPackage: com.ruoyi.**.domain +# # 配置mapper的扫描,找到所有的mapper.xml映射文件 +# mapperLocations: classpath*:mapper/**/*Mapper.xml +# # 加载全局的配置文件 +# configLocation: classpath:mybatis/mybatis-config.xml + +mybatis-plus: + type-aliases-package: com.ruoyi.**.domain + mapper-locations: classpath*:mapper/**/*Mapper.xml + config-location: classpath:mybatis/mybatis-config.xml + +# PageHelper分页插件 +pagehelper: + helperDialect: mysql + supportMethodsArguments: true + params: count=countSql + page-size-zero: true + +# Swagger配置 +swagger: + # 是否开启swagger + enabled: true + # 请求前缀 + pathMapping: /dev-api + +# 防止XSS攻击 +xss: + # 过滤开关 + enabled: true + # 排除链接(多个用逗号分隔) + excludes: /system/notice + # 匹配链接 + urlPatterns: /system/*,/monitor/*,/tool/* + +# 登录文本加密公私钥 +login: + publicKey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCqjPHyVJ5u9E+d0CMYyc3mMdQ/ac9UZdF9oz2Bxr6UDKNax+Zhn/OARKozMAzH2cpYsb4kGPYTHPzmrbgegbACC7bTFSFFBSkotvvfDHd+YbfgxfNf/VbwczMl/E3OMHzRFbrLO8v3ozA+2w2Gyg0UAV6AGliVrQHCuKIDYV0EwIDAQAB + privateKey: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMKqM8fJUnm70T53QIxjJzeYx1D9pz1Rl0X2jPYHGvpQMo1rH5mGf84BEqjMwDMfZylixviQY9hMc/OatuB6BsAILttMVIUUFKSi2+98Md35ht+DF81/9VvBzMyX8Tc4wfNEVuss7y/ejMD7bDYbKDRQBXoAaWJWtAcK4ogNhXQTAgMBAAECgYBAzlzytClK8aYVf6nzksbpkWk5o1hb55/O4OfIuFDY6H4L6o/YkphVwrGtlIyf+GJlusa21YsH5Vvsy6L6VGWOT/T1Q924zxwhPHFP8fzWrWJ60IT5jGDChJ1jls8GRWHgCnriQRMHU36eqENC5VZiYdfuulGN2bUNgMzUgmv9UQJBAOZio3CAQ+mwOsdRWixaput636qXoryleXiYrzGOulTzdYrRnJCIF3fE6H9uX5i2MwA3HtgTkN3qS4mtyBHvWP0CQQDYTt4KlkVJN3hsfV3qMk48zYE68lUg0umRaYXlQ0moLPO2P3wLFLLOq0jhWIwWz7ApIQXsR7x0RZOK2NadFFZPAkEA30Nh7klvBw2wuK3+/BLRxkxqavDOVZDq+dLFnPobWu4gz+m4l1w7mebqBWxaGi0fmarRKkcz0csXbxJJXBAepQJAKJtNpbEmGqOWMM+sJL4C3/k4TGeXwYy2mjy0DSD/n9moessaLz5YfuG60cr8qX+ds2rmoL+qyi0RkJw6VcyukwJAS5sxmn0YKbXw7GxDm7HmMcGuRYTo6ai+Olzk1GLwddTj56pfOgex+FF4FFyO33zzpEPeZbEzkbxkLC7Z8m0lWg== diff --git a/ruoyi-app/src/main/resources/banner.txt b/ruoyi-app/src/main/resources/banner.txt new file mode 100644 index 0000000000000000000000000000000000000000..0931cb84428b04a15f637865d9c9c00f5a408419 --- /dev/null +++ b/ruoyi-app/src/main/resources/banner.txt @@ -0,0 +1,24 @@ +Application Version: ${ruoyi.version} +Spring Boot Version: ${spring-boot.version} +//////////////////////////////////////////////////////////////////// +// _ooOoo_ // +// o8888888o // +// 88" . "88 // +// (| ^_^ |) // +// O\ = /O // +// ____/`---'\____ // +// .' \\| |// `. // +// / \\||| : |||// \ // +// / _||||| -:- |||||- \ // +// | | \\\ - /// | | // +// | \_| ''\---/'' | | // +// \ .-\__ `-` ___/-. / // +// ___`. .' /--.--\ `. . ___ // +// ."" '< `.___\_<|>_/___.' >'"". // +// | | : `- \`.;`\ _ /`;.`/ - ` : | | // +// \ \ `-. \_ __\ /__ _/ .-` / / // +// ========`-.____`-.___\_____/___.-`____.-'======== // +// `=---=' // +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// 佛祖保佑 永不宕机 永无BUG // +//////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/ruoyi-app/src/main/resources/i18n/messages.properties b/ruoyi-app/src/main/resources/i18n/messages.properties new file mode 100644 index 0000000000000000000000000000000000000000..6a9e0ab8b3f6a9693b3955ab583dc084d472f5df --- /dev/null +++ b/ruoyi-app/src/main/resources/i18n/messages.properties @@ -0,0 +1,41 @@ +#错误消息 +not.null=* 必须填写 +user.jcaptcha.error=验证码错误 +user.jcaptcha.expire=验证码已失效 +user.sms.expire=短信验证码已失效 +user.not.exists=用户不存在/密码错误 +user.password.not.match=用户不存在/密码错误 +user.password.retry.limit.count=密码输入错误{0}次 +user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟 +user.sms.not.match=短信验证码输入错误,还剩{0}次 +user.sms.retry.limit.count=短信验证码输入错误{0}次 +user.sms.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{1}分钟 +user.password.delete=对不起,您的账号已被删除 +user.blocked=用户已封禁,请联系管理员 +role.blocked=角色已封禁,请联系管理员 +user.logout.success=退出成功 + +length.not.valid=长度必须在{min}到{max}个字符之间 + +user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 +user.password.not.valid=* 5-50个字符 + +user.email.not.valid=邮箱格式错误 +user.mobile.phone.number.not.valid=手机号格式错误 +user.login.success=登录成功 +user.register.success=注册成功 +user.notfound=请重新登录 +user.forcelogout=管理员强制退出,请重新登录 +user.unknown.error=未知错误,请重新登录 + +##文件上传消息 +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!
允许的文件最大大小是:{0}MB! +upload.filename.exceed.length=上传的文件名最长{0}个字符 + +##权限 +no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] +no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] +no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] +no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] +no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] +no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] diff --git a/ruoyi-app/src/main/resources/logback.xml b/ruoyi-app/src/main/resources/logback.xml new file mode 100644 index 0000000000000000000000000000000000000000..a360583fa4424fe5b8b88b39eca0a5aa203e7064 --- /dev/null +++ b/ruoyi-app/src/main/resources/logback.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/sys-info.log + + + + ${log.path}/sys-info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/sys-error.log + + + + ${log.path}/sys-error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + ${log.path}/sys-user.log + + + ${log.path}/sys-user.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-app/src/main/resources/mybatis/mybatis-config.xml b/ruoyi-app/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..10cf6b0b2eb92848f09f27365c8f4b8e2e9522b8 --- /dev/null +++ b/ruoyi-app/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-app/src/main/resources/rebel-remote.xml b/ruoyi-app/src/main/resources/rebel-remote.xml new file mode 100644 index 0000000000000000000000000000000000000000..3496ea5ba842e132e6ae4c2574d84c3838e4cf8f --- /dev/null +++ b/ruoyi-app/src/main/resources/rebel-remote.xml @@ -0,0 +1,4 @@ + + + com.ruoyi.ruoyi-app + diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..e71a266a05f4b4d012f0ff1c908806c1d7aa1fd4 --- /dev/null +++ b/ruoyi-common/pom.xml @@ -0,0 +1,230 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + 4.0.0 + + ruoyi-common + + + common通用工具 + + + + + + + + + org.springframework + spring-context-support + + + + + org.springframework + spring-web + + + + + org.springframework.boot + spring-boot-starter-security + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + + + + + org.springframework.boot + spring-boot-starter-validation + + + + + org.apache.commons + commons-lang3 + + + + + com.fasterxml.jackson.core + jackson-databind + + + + + com.alibaba.fastjson2 + fastjson2 + + + + + commons-io + commons-io + + + + + commons-fileupload + commons-fileupload + + + + org.springframework.boot + spring-boot-starter-freemarker + + + + + org.apache.poi + poi-ooxml + + + cn.afterturn + easypoi-spring-boot-starter + 4.1.3 + + + + + org.yaml + snakeyaml + + + + + io.jsonwebtoken + jjwt + + + + + + + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.apache.commons + commons-pool2 + + + + + eu.bitwalker + UserAgentUtils + + + + org.projectlombok + lombok + + + + + javax.servlet + javax.servlet-api + + + + com.baomidou + mybatis-plus-annotation + 3.5.2 + + + + io.swagger + swagger-annotations + 1.6.6 + + + + cn.hutool + hutool-all + + + + + org.gavaghan + geodesy + + + + + io.minio + minio + 8.2.1 + + + + org.apache.commons + commons-text + + + + dom4j + dom4j + 1.6.1 + + + + org.docx4j + docx4j + 6.1.2 + + + slf4j-log4j12 + org.slf4j + + + + + + javax.xml.bind + jaxb-api + 2.3.1 + + + + com.sun.xml.bind + jaxb-impl + 2.3.4 + + + + + commons-httpclient + commons-httpclient + 3.1 + + + org.apache.httpcomponents + httpclient + 4.3.1 + + + org.apache.httpcomponents + httpcore + 4.3.1 + + + + + + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java new file mode 100644 index 0000000000000000000000000000000000000000..1d6d4f44205da151211d2dbe00215ff70b54f9aa --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Anonymous.java @@ -0,0 +1,19 @@ +package com.ruoyi.common.annotation; + +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.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Anonymous +{ +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/BindDict.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/BindDict.java new file mode 100644 index 0000000000000000000000000000000000000000..3d69482285d06871ca8b927b4d7407df10c4f641 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/BindDict.java @@ -0,0 +1,20 @@ +package com.ruoyi.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author ntxz + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface BindDict { + + //绑定的字段映射 + String filedMapping() default ""; + + //字典类型 + String type() default ""; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java new file mode 100644 index 0000000000000000000000000000000000000000..be49c8053a5e1520845bb0c833664b5cceac0371 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java @@ -0,0 +1,33 @@ +package com.ruoyi.common.annotation; + +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.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface DataScope +{ + /** + * 部门表的别名 + */ + public String deptAlias() default ""; + + /** + * 用户表的别名 + */ + public String userAlias() default ""; + + /** + * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来 + */ + public String permission() default ""; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java new file mode 100644 index 0000000000000000000000000000000000000000..79cd191f8e2f85e0a28dae98880a88dd134e49fc --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataSource.java @@ -0,0 +1,28 @@ +package com.ruoyi.common.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.ruoyi.common.enums.DataSourceType; + +/** + * 自定义多数据源切换注解 + * + * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准 + * + * @author ruoyi + */ +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +public @interface DataSource +{ + /** + * 切换数据源名称 + */ + public DataSourceType value() default DataSourceType.MASTER; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java new file mode 100644 index 0000000000000000000000000000000000000000..f7aaca5fb606ab58290091162d87560229970b0a --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java @@ -0,0 +1,187 @@ +package com.ruoyi.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.math.BigDecimal; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.IndexedColors; +import com.ruoyi.common.utils.poi.ExcelHandlerAdapter; + +/** + * 自定义导出Excel数据注解 + * + * @author ruoyi + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Excel +{ + /** + * 导出时在excel中排序 + */ + public int sort() default Integer.MAX_VALUE; + + /** + * 导出到Excel中的名字. + */ + public String name() default ""; + + /** + * 日期格式, 如: yyyy-MM-dd + */ + public String dateFormat() default ""; + + /** + * 如果是字典类型,请设置字典的type值 (如: sys_user_sex) + */ + public String dictType() default ""; + + /** + * 读取内容转表达式 (如: 0=男,1=女,2=未知) + */ + public String readConverterExp() default ""; + + /** + * 分隔符,读取字符串组内容 + */ + public String separator() default ","; + + /** + * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化) + */ + public int scale() default -1; + + /** + * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN + */ + public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; + + /** + * 导出时在excel中每个列的高度 单位为字符 + */ + public double height() default 14; + + /** + * 导出时在excel中每个列的宽 单位为字符 + */ + public double width() default 16; + + /** + * 文字后缀,如% 90 变成90% + */ + public String suffix() default ""; + + /** + * 当值为空时,字段的默认值 + */ + public String defaultValue() default ""; + + /** + * 提示信息 + */ + public String prompt() default ""; + + /** + * 设置只能选择不能输入的列内容. + */ + public String[] combo() default {}; + + /** + * 是否需要纵向合并单元格,应对需求:含有list集合单元格) + */ + public boolean needMerge() default false; + + /** + * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. + */ + public boolean isExport() default true; + + /** + * 另一个类中的属性名称,支持多级获取,以小数点隔开 + */ + public String targetAttr() default ""; + + /** + * 是否自动统计数据,在最后追加一行统计数据总和 + */ + public boolean isStatistics() default false; + + /** + * 导出类型(0数字 1字符串 2图片) + */ + public ColumnType cellType() default ColumnType.STRING; + + /** + * 导出列头背景色 + */ + public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT; + + /** + * 导出列头字体颜色 + */ + public IndexedColors headerColor() default IndexedColors.WHITE; + + /** + * 导出单元格背景色 + */ + public IndexedColors backgroundColor() default IndexedColors.WHITE; + + /** + * 导出单元格字体颜色 + */ + public IndexedColors color() default IndexedColors.BLACK; + + /** + * 导出字段对齐方式 + */ + public HorizontalAlignment align() default HorizontalAlignment.CENTER; + + /** + * 自定义数据处理器 + */ + public Class handler() default ExcelHandlerAdapter.class; + + /** + * 自定义数据处理器参数 + */ + public String[] args() default {}; + + /** + * 字段类型(0:导出导入;1:仅导出;2:仅导入) + */ + Type type() default Type.ALL; + + public enum Type + { + ALL(0), EXPORT(1), IMPORT(2); + private final int value; + + Type(int value) + { + this.value = value; + } + + public int value() + { + return this.value; + } + } + + public enum ColumnType + { + NUMERIC(0), STRING(1), IMAGE(2); + private final int value; + + ColumnType(int value) + { + this.value = value; + } + + public int value() + { + return this.value; + } + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java new file mode 100644 index 0000000000000000000000000000000000000000..1f1cc81bfa5d8116c390659fd090f0ac5db57eee --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java @@ -0,0 +1,18 @@ +package com.ruoyi.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Excel注解集 + * + * @author ruoyi + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Excels +{ + public Excel[] value(); +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java new file mode 100644 index 0000000000000000000000000000000000000000..ca02c6c4a21bdbbc0430af36e634f0690ee34658 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java @@ -0,0 +1,46 @@ +package com.ruoyi.common.annotation; + +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; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.enums.OperatorType; + +/** + * 自定义操作日志记录注解 + * + * @author ruoyi + * + */ +@Target({ ElementType.PARAMETER, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Log +{ + /** + * 模块 + */ + public String title() default ""; + + /** + * 功能 + */ + public BusinessType businessType() default BusinessType.OTHER; + + /** + * 操作人类别 + */ + public OperatorType operatorType() default OperatorType.MANAGE; + + /** + * 是否保存请求的参数 + */ + public boolean isSaveRequestData() default true; + + /** + * 是否保存响应的参数 + */ + public boolean isSaveResponseData() default true; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java new file mode 100644 index 0000000000000000000000000000000000000000..0f024c7d476597bd0c892bd4621d7f7114fab7e0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java @@ -0,0 +1,40 @@ +package com.ruoyi.common.annotation; + +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; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.enums.LimitType; + +/** + * 限流注解 + * + * @author ruoyi + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface RateLimiter +{ + /** + * 限流key + */ + public String key() default CacheConstants.RATE_LIMIT_KEY; + + /** + * 限流时间,单位秒 + */ + public int time() default 60; + + /** + * 限流次数 + */ + public int count() default 100; + + /** + * 限流类型 + */ + public LimitType limitType() default LimitType.DEFAULT; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java new file mode 100644 index 0000000000000000000000000000000000000000..3f6b7e35d2aec357fbdd39daa93f03eaa357b1ca --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java @@ -0,0 +1,35 @@ +package com.ruoyi.common.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 自定义注解防止表单重复提交 + * + * @author ruoyi + * + */ +@Inherited +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface RepeatSubmit +{ + /** + * 间隔时间(ms),小于此时间视为重复提交 + */ + public int interval() default 5000; + + /** + * 提示消息 + */ + public String message() default "不允许重复提交,请稍候再试"; + + public boolean enable() default true; + + public int num() default 9; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/MinioConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/MinioConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..2e380010ee128c76ea62d6c0371e8de3357d9fb4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/MinioConfig.java @@ -0,0 +1,82 @@ +package com.ruoyi.common.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import io.minio.MinioClient; + +/** + * Minio 配置信息 + * + * @author ruoyi + */ +@Configuration +@ConfigurationProperties(prefix = "minio") +public class MinioConfig +{ + /** + * 服务地址 + */ + private static String url; + + /** + * 用户名 + */ + private static String accessKey; + + /** + * 密码 + */ + private static String secretKey; + + /** + * 存储桶名称 + */ + private static String bucketName; + + public static String getUrl() + { + return url; + } + + public void setUrl(String url) + { + MinioConfig.url = url; + } + + public static String getAccessKey() + { + return accessKey; + } + + public void setAccessKey(String accessKey) + { + MinioConfig.accessKey = accessKey; + } + + public static String getSecretKey() + { + return secretKey; + } + + public void setSecretKey(String secretKey) + { + MinioConfig.secretKey = secretKey; + } + + public static String getBucketName() + { + return bucketName; + } + + public void setBucketName(String bucketName) + { + MinioConfig.bucketName = bucketName; + } + + @Bean + public MinioClient getMinioClient() + { + return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..00f70f64027c88c3fabd85034963f5a58224c5ee --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java @@ -0,0 +1,135 @@ +package com.ruoyi.common.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 读取项目相关配置 + * + * @author ruoyi + */ +@Component +@ConfigurationProperties(prefix = "ruoyi") +public class RuoYiConfig +{ + /** 项目名称 */ + private String name; + + /** 版本 */ + private String version; + + /** 版权年份 */ + private String copyrightYear; + + /** 实例演示开关 */ + private boolean demoEnabled; + + /** 上传路径 */ + private static String profile; + + /** 获取地址开关 */ + private static boolean addressEnabled; + + /** 验证码类型 */ + private static String captchaType; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getVersion() + { + return version; + } + + public void setVersion(String version) + { + this.version = version; + } + + public String getCopyrightYear() + { + return copyrightYear; + } + + public void setCopyrightYear(String copyrightYear) + { + this.copyrightYear = copyrightYear; + } + + public boolean isDemoEnabled() + { + return demoEnabled; + } + + public void setDemoEnabled(boolean demoEnabled) + { + this.demoEnabled = demoEnabled; + } + + public static String getProfile() + { + return profile; + } + + public void setProfile(String profile) + { + RuoYiConfig.profile = profile; + } + + public static boolean isAddressEnabled() + { + return addressEnabled; + } + + public void setAddressEnabled(boolean addressEnabled) + { + RuoYiConfig.addressEnabled = addressEnabled; + } + + public static String getCaptchaType() { + return captchaType; + } + + public void setCaptchaType(String captchaType) { + RuoYiConfig.captchaType = captchaType; + } + + /** + * 获取导入上传路径 + */ + public static String getImportPath() + { + return getProfile() + "/import"; + } + + /** + * 获取头像上传路径 + */ + public static String getAvatarPath() + { + return getProfile() + "/avatar"; + } + + /** + * 获取下载路径 + */ + public static String getDownloadPath() + { + return getProfile() + "/download/"; + } + + /** + * 获取上传路径 + */ + public static String getUploadPath() + { + return getProfile() + "/upload"; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/AlarmConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/AlarmConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..1b0d0cd7554513e35c8168b21536b359817fe357 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/AlarmConstants.java @@ -0,0 +1,13 @@ +package com.ruoyi.common.constant; + +public class AlarmConstants { + + public static final String NoRecover = "0"; + + public static final String Recover = "1"; + + public static final String RedInLine = "Y"; + + public static final String RedOutLine = "N"; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..17a10539f5a5f52dd3836c7e74e7696dc11f97f4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -0,0 +1,104 @@ +package com.ruoyi.common.constant; + +/** + * 缓存的key 常量 + * + * @author ruoyi + */ +public class CacheConstants +{ + /** + * 登录用户 redis key + */ + public static final String LOGIN_TOKEN_KEY = "login_tokens:"; + + /** + * 验证码 redis key + */ + public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; + + + /** + * 参数管理 cache key + */ + public static final String SYS_CONFIG_KEY = "sys_config:"; + + /** + * 物资信息 cache key + */ + public static final String YW_MATERIALS_INFO = "yw_materials_info"; + + /** + * 性能监控15分钟 cache key + */ + public static final String YW_KPIMONITORCELL_INFO = "yw_kpimonitorcell_info"; + + /** + * 性能监控1分钟 cache key + */ + public static final String YW_KPIMONITORMIN_INFO = "yw_kpimonitormin_info"; + + + public static final String YW_MATERIALS_CLASS = "yw_materials_class"; + + public static final String YW_VENUES = "yw_venues"; + + /** + * 字典管理 cache key + */ + public static final String SYS_DICT_KEY = "sys_dict:"; + + /** + * 防重提交 redis key + */ + public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; + + /** + * 限流 redis key + */ + public static final String RATE_LIMIT_KEY = "rate_limit:"; + + /** + * 登录账户密码错误次数 redis key + */ + public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; + + public static final String SMS_ERR_CNT_KEY = "sms_err_cnt:"; + + + public static final String DP_DATA = "dp_"; + + /** + * 登录账户密码错误次数 + * {@value} + */ + public static int PWD_ERR_CNT= 5; + + /** + * 登录账户锁定时间 + * {@value} + */ + public static int LOCK_TIME= 900; + + /** + * 缓存过期时间-600分钟 10小时 + * {@value} + */ + public static int REDIS_TIME_OUT_300MINUTES = 36000; + + + public static String YW_TRANS_ALARM = "yw_trans_alarm"; + public static String YW_TRANS_MAP = "yw_trans_map"; + public static String YW_MACHINEROOM_ALARM = "yw_machineroom_alarm"; + public static String YW_GB_TOP5 = "yw_gb_top5"; + public static String YW_OPTICALPOWER = "yw_opticalpower"; + public static String YW_NET_ALARM = "yw_net_alarm"; + public static String YW_NET_MAP = "yw_net_map"; + public static String YW_NET_CODE_AGIS = "yw_net_code_agis"; + public static String YW_COM_MANAGE_SCENE = "ym_dp_commamage_scene"; + public static String YW_COM_MANAGE_ALL = "ym_dp_commamage_all"; + + + public static String ZXP_TOKEN = "zxp_token"; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java new file mode 100644 index 0000000000000000000000000000000000000000..6ec69da4c2fa4e0e49e320f715f4ac9e91d9d361 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -0,0 +1,150 @@ +package com.ruoyi.common.constant; + +import io.jsonwebtoken.Claims; + +/** + * 通用常量信息 + * + * @author ruoyi + */ +public class Constants +{ + /** + * UTF-8 字符集 + */ + public static final String UTF8 = "UTF-8"; + + /** + * GBK 字符集 + */ + public static final String GBK = "GBK"; + + /** + * www主域 + */ + public static final String WWW = "www."; + + /** + * http请求 + */ + public static final String HTTP = "http://"; + + /** + * https请求 + */ + public static final String HTTPS = "https://"; + + /** + * 通用成功标识 + */ + public static final String SUCCESS = "0"; + + /** + * 通用失败标识 + */ + public static final String FAIL = "1"; + + /** + * 登录成功 + */ + public static final String LOGIN_SUCCESS = "Success"; + + /** + * 注销 + */ + public static final String LOGOUT = "Logout"; + + /** + * 注册 + */ + public static final String REGISTER = "Register"; + + /** + * 登录失败 + */ + public static final String LOGIN_FAIL = "Error"; + + /** + * 验证码有效期(分钟) + */ + public static final Integer CAPTCHA_EXPIRATION = 2; + + /** + * 令牌 + */ + public static final String TOKEN = "token"; + + /** + * 令牌前缀 + */ + public static final String TOKEN_PREFIX = "Bearer "; + + /** + * 令牌前缀 + */ + public static final String LOGIN_USER_KEY = "login_user_key"; + + /** + * 用户ID + */ + public static final String JWT_USERID = "userid"; + + /** + * 用户名称 + */ + public static final String JWT_USERNAME = Claims.SUBJECT; + + /** + * 用户头像 + */ + public static final String JWT_AVATAR = "avatar"; + + /** + * 创建时间 + */ + public static final String JWT_CREATED = "created"; + + /** + * 用户权限 + */ + public static final String JWT_AUTHORITIES = "authorities"; + /** + * 安全相关 + */ + public static final String JWT_SIGN_KEY = "icloud"; + /** + * 资源映射路径 前缀 + */ + public static final String RESOURCE_PREFIX = "/profile"; + + /** + * RMI 远程方法调用 + */ + public static final String LOOKUP_RMI = "rmi:"; + + /** + * LDAP 远程方法调用 + */ + public static final String LOOKUP_LDAP = "ldap:"; + + /** + * LDAPS 远程方法调用 + */ + public static final String LOOKUP_LDAPS = "ldaps:"; + + /** + * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) + */ + public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" }; + + /** + * 定时任务违规的字符 + */ + public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", + "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" }; + + /** + * 登录用户编号 redis key + */ + public static final String LOGIN_USERID_KEY = "login_userid:"; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..7d899d4964882b2e3e90a5452a4cc2a6711264ae --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java @@ -0,0 +1,117 @@ +package com.ruoyi.common.constant; + +/** + * 代码生成通用常量 + * + * @author ruoyi + */ +public class GenConstants +{ + /** 单表(增删改查) */ + public static final String TPL_CRUD = "crud"; + + /** 树表(增删改查) */ + public static final String TPL_TREE = "tree"; + + /** 主子表(增删改查) */ + public static final String TPL_SUB = "sub"; + + /** 树编码字段 */ + public static final String TREE_CODE = "treeCode"; + + /** 树父编码字段 */ + public static final String TREE_PARENT_CODE = "treeParentCode"; + + /** 树名称字段 */ + public static final String TREE_NAME = "treeName"; + + /** 上级菜单ID字段 */ + public static final String PARENT_MENU_ID = "parentMenuId"; + + /** 上级菜单名称字段 */ + public static final String PARENT_MENU_NAME = "parentMenuName"; + + /** 数据库字符串类型 */ + public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; + + /** 数据库文本类型 */ + public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" }; + + /** 数据库时间类型 */ + public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; + + /** 数据库数字类型 */ + public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", + "bit", "bigint", "float", "double", "decimal" }; + + /** 页面不需要编辑字段 */ + public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; + + /** 页面不需要显示的列表字段 */ + public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", + "update_time" }; + + /** 页面不需要查询字段 */ + public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", + "update_time", "remark" }; + + /** Entity基类字段 */ + public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; + + /** Tree基类字段 */ + public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" }; + + /** 文本框 */ + public static final String HTML_INPUT = "input"; + + /** 文本域 */ + public static final String HTML_TEXTAREA = "textarea"; + + /** 下拉框 */ + public static final String HTML_SELECT = "select"; + + /** 单选框 */ + public static final String HTML_RADIO = "radio"; + + /** 复选框 */ + public static final String HTML_CHECKBOX = "checkbox"; + + /** 日期控件 */ + public static final String HTML_DATETIME = "datetime"; + + /** 图片上传控件 */ + public static final String HTML_IMAGE_UPLOAD = "imageUpload"; + + /** 文件上传控件 */ + public static final String HTML_FILE_UPLOAD = "fileUpload"; + + /** 富文本控件 */ + public static final String HTML_EDITOR = "editor"; + + /** 字符串类型 */ + public static final String TYPE_STRING = "String"; + + /** 整型 */ + public static final String TYPE_INTEGER = "Integer"; + + /** 长整型 */ + public static final String TYPE_LONG = "Long"; + + /** 浮点型 */ + public static final String TYPE_DOUBLE = "Double"; + + /** 高精度计算类型 */ + public static final String TYPE_BIGDECIMAL = "BigDecimal"; + + /** 时间类型 */ + public static final String TYPE_DATE = "Date"; + + /** 模糊查询 */ + public static final String QUERY_LIKE = "LIKE"; + + /** 相等查询 */ + public static final String QUERY_EQ = "EQ"; + + /** 需要 */ + public static final String REQUIRE = "1"; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java new file mode 100644 index 0000000000000000000000000000000000000000..a983c77ece3f2b1f8bdb0136c084aaa9782215fe --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java @@ -0,0 +1,94 @@ +package com.ruoyi.common.constant; + +/** + * 返回状态码 + * + * @author ruoyi + */ +public class HttpStatus +{ + /** + * 操作成功 + */ + public static final int SUCCESS = 200; + + /** + * 对象创建成功 + */ + public static final int CREATED = 201; + + /** + * 请求已经被接受 + */ + public static final int ACCEPTED = 202; + + /** + * 操作已经执行成功,但是没有返回数据 + */ + public static final int NO_CONTENT = 204; + + /** + * 资源已被移除 + */ + public static final int MOVED_PERM = 301; + + /** + * 重定向 + */ + public static final int SEE_OTHER = 303; + + /** + * 资源没有被修改 + */ + public static final int NOT_MODIFIED = 304; + + /** + * 参数列表错误(缺少,格式不匹配) + */ + public static final int BAD_REQUEST = 400; + + /** + * 未授权 + */ + public static final int UNAUTHORIZED = 401; + + /** + * 访问受限,授权过期 + */ + public static final int FORBIDDEN = 403; + + /** + * 资源,服务未找到 + */ + public static final int NOT_FOUND = 404; + + /** + * 不允许的http方法 + */ + public static final int BAD_METHOD = 405; + + /** + * 资源冲突,或者资源被锁 + */ + public static final int CONFLICT = 409; + + /** + * 不支持的数据,媒体类型 + */ + public static final int UNSUPPORTED_TYPE = 415; + + /** + * 系统内部错误 + */ + public static final int ERROR = 500; + + /** + * 接口未实现 + */ + public static final int NOT_IMPLEMENTED = 501; + + /** + * 系统警告消息 + */ + public static final int WARN = 601; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..62ad81545b42892d37a89dee5e1f7cc3b13f2067 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java @@ -0,0 +1,50 @@ +package com.ruoyi.common.constant; + +/** + * 任务调度通用常量 + * + * @author ruoyi + */ +public class ScheduleConstants +{ + public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; + + /** 执行目标key */ + public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; + + /** 默认 */ + public static final String MISFIRE_DEFAULT = "0"; + + /** 立即触发执行 */ + public static final String MISFIRE_IGNORE_MISFIRES = "1"; + + /** 触发一次执行 */ + public static final String MISFIRE_FIRE_AND_PROCEED = "2"; + + /** 不触发立即执行 */ + public static final String MISFIRE_DO_NOTHING = "3"; + + public enum Status + { + /** + * 正常 + */ + NORMAL("0"), + /** + * 暂停 + */ + PAUSE("1"); + + private String value; + + private Status(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/TaskConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/TaskConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..f26c3ec2e87cd33b7628cac283650edad99239d6 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/TaskConstants.java @@ -0,0 +1,13 @@ +package com.ruoyi.common.constant; + +public class TaskConstants { + + public static final String ALARM = "告警处理"; + + public static final String INSPECT = "巡检任务"; + + public static final String WIRE = "布线"; + + public static final String MATERIAL = "物资"; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..e1f8230c377dad56d6fe35c4bfd82d32ae99871e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java @@ -0,0 +1,82 @@ +package com.ruoyi.common.constant; + +/** + * 用户常量信息 + * + * @author ruoyi + */ +public class UserConstants +{ + /** + * 平台内系统用户的唯一标志 + */ + public static final String SYS_USER = "SYS_USER"; + + /** 正常状态 */ + public static final String NORMAL = "0"; + + /** 异常状态 */ + public static final String EXCEPTION = "1"; + + /** 用户封禁状态 */ + public static final String USER_DISABLE = "1"; + + /** 角色封禁状态 */ + public static final String ROLE_DISABLE = "1"; + + /** 部门正常状态 */ + public static final String DEPT_NORMAL = "0"; + + /** 部门停用状态 */ + public static final String DEPT_DISABLE = "1"; + + /** 字典正常状态 */ + public static final String DICT_NORMAL = "0"; + + /** 是否为系统默认(是) */ + public static final String YES = "Y"; + + public static final String APP = "app"; + + public static final String PC = "pc"; + + /** 是否菜单外链(是) */ + public static final String YES_FRAME = "0"; + + /** 是否菜单外链(否) */ + public static final String NO_FRAME = "1"; + + /** 菜单类型(目录) */ + public static final String TYPE_DIR = "M"; + + /** 菜单类型(菜单) */ + public static final String TYPE_MENU = "C"; + + /** 菜单类型(按钮) */ + public static final String TYPE_BUTTON = "F"; + + /** Layout组件标识 */ + public final static String LAYOUT = "Layout"; + + /** ParentView组件标识 */ + public final static String PARENT_VIEW = "ParentView"; + + /** InnerLink组件标识 */ + public final static String INNER_LINK = "InnerLink"; + + /** 校验返回结果码 */ + public final static String UNIQUE = "0"; + public final static String NOT_UNIQUE = "1"; + + /** + * 用户名长度限制 + */ + public static final int USERNAME_MIN_LENGTH = 2; + public static final int USERNAME_MAX_LENGTH = 20; + + /** + * 密码长度限制 + */ + public static final int PASSWORD_MIN_LENGTH = 5; + public static final int PASSWORD_MAX_LENGTH = 20; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/WordConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/WordConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..e30b8dc766de694d72961544c11afcc162d965c4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/WordConstants.java @@ -0,0 +1,13 @@ +package com.ruoyi.common.constant; + +public class WordConstants { + + public final static String DOC_SUF = ".doc"; + + public final static String DOCX_SUF = ".docx"; + + public final static String PDF_SUF = ".pdf"; + + public final static String CONVERT_SUF = "(\\.docx)|(\\.doc)|(\\.xml)"; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java new file mode 100644 index 0000000000000000000000000000000000000000..be8984750b30ee89ca4f7727b87633d0003ddb3c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -0,0 +1,216 @@ +package com.ruoyi.common.core.controller; + +import java.beans.PropertyEditorSupport; +import java.util.Date; +import java.util.List; + +import com.alibaba.fastjson2.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.page.PageDomain; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.page.TableSupport; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.sql.SqlUtil; + +/** + * web层通用数据处理 + * + * @author ruoyi + */ +public class BaseController +{ + protected final Logger logger = LoggerFactory.getLogger(this.getClass()); + + + + /** + * 将前台传递过来的日期格式的字符串,自动转化为Date类型 + */ + @InitBinder + public void initBinder(WebDataBinder binder) + { + // Date 类型转换 + binder.registerCustomEditor(Date.class, new PropertyEditorSupport() + { + @Override + public void setAsText(String text) + { + setValue(DateUtils.parseDate(text)); + } + }); + } + + /** + * 设置请求分页数据 + */ + protected void startPage() + { + PageUtils.startPage(); + } + + /** + * 设置请求排序数据 + */ + protected void startOrderBy() + { + PageDomain pageDomain = TableSupport.buildPageRequest(); + if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) + { + String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); + PageHelper.orderBy(orderBy); + } + } + + /** + * 清理分页的线程变量 + */ + protected void clearPage() + { + PageUtils.clearPage(); + } + + /** + * 响应请求分页数据 + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected TableDataInfo getDataTable(List list) + { + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + rspData.setRows(list); + rspData.setTotal(new PageInfo(list).getTotal()); + return rspData; + } + + protected TableDataInfo getDataTable(List List,Long total) + { + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + rspData.setRows(List); + rspData.setTotal(total); + return rspData; + } + + /** + * 返回成功 + */ + public AjaxResult success() + { + return AjaxResult.success(); + } + + /** + * 返回失败消息 + */ + public AjaxResult error() + { + return AjaxResult.error(); + } + + /** + * 返回成功消息 + */ + public AjaxResult success(String message) + { + return AjaxResult.success(message); + } + + /** + * 返回成功消息 + */ + public AjaxResult success(Object data) + { + return AjaxResult.success(data); + } + + /** + * 返回失败消息 + */ + public AjaxResult error(String message) + { + return AjaxResult.error(message); + } + + /** + * 返回警告消息 + */ + public AjaxResult warn(String message) + { + return AjaxResult.warn(message); + } + + /** + * 响应返回结果 + * + * @param rows 影响行数 + * @return 操作结果 + */ + protected AjaxResult toAjax(int rows) + { + return rows > 0 ? AjaxResult.success() : AjaxResult.error(); + } + + /** + * 响应返回结果 + * + * @param result 结果 + * @return 操作结果 + */ + protected AjaxResult toAjax(boolean result) + { + return result ? success() : error(); + } + + /** + * 页面跳转 + */ + public String redirect(String url) + { + return StringUtils.format("redirect:{}", url); + } + + /** + * 获取用户缓存信息 + */ + public LoginUser getLoginUser() + { + return SecurityUtils.getLoginUser(); + } + + /** + * 获取登录用户id + */ + public Long getUserId() + { + return getLoginUser().getUserId(); + } + + /** + * 获取登录部门id + */ + public Long getDeptId() + { + return getLoginUser().getDeptId(); + } + + /** + * 获取登录用户名 + */ + public String getUsername() + { + return getLoginUser().getUsername(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java new file mode 100644 index 0000000000000000000000000000000000000000..42fbd9c875532b50275c2deadc83c16a871608b9 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java @@ -0,0 +1,185 @@ +package com.ruoyi.common.core.domain; + +import java.util.HashMap; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.utils.StringUtils; + +/** + * 操作消息提醒 + * + * @author ruoyi + */ +public class AjaxResult extends HashMap +{ + private static final long serialVersionUID = 1L; + + /** 状态码 */ + public static final String CODE_TAG = "code"; + + /** 返回内容 */ + public static final String MSG_TAG = "msg"; + + /** 数据对象 */ + public static final String DATA_TAG = "data"; + + /** + * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 + */ + public AjaxResult() + { + } + + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + */ + public AjaxResult(int code, String msg) + { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + } + + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + * @param data 数据对象 + */ + public AjaxResult(int code, String msg, Object data) + { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + if (StringUtils.isNotNull(data)) + { + super.put(DATA_TAG, data); + } + } + + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static AjaxResult success() + { + return AjaxResult.success("操作成功"); + } + + /** + * 返回成功数据 + * + * @return 成功消息 + */ + public static AjaxResult success(Object data) + { + return AjaxResult.success("操作成功", data); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @return 成功消息 + */ + public static AjaxResult success(String msg) + { + return AjaxResult.success(msg, null); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 成功消息 + */ + public static AjaxResult success(String msg, Object data) + { + return new AjaxResult(HttpStatus.SUCCESS, msg, data); + } + + /** + * 返回警告消息 + * + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult warn(String msg) + { + return AjaxResult.warn(msg, null); + } + + /** + * 返回警告消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 警告消息 + */ + public static AjaxResult warn(String msg, Object data) + { + return new AjaxResult(HttpStatus.WARN, msg, data); + } + + /** + * 返回错误消息 + * + * @return 错误消息 + */ + public static AjaxResult error() + { + return AjaxResult.error("操作失败"); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @return 错误消息 + */ + public static AjaxResult error(String msg) + { + return AjaxResult.error(msg, null); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 错误消息 + */ + public static AjaxResult error(String msg, Object data) + { + return new AjaxResult(HttpStatus.ERROR, msg, data); + } + + /** + * 返回错误消息 + * + * @param code 状态码 + * @param msg 返回内容 + * @return 错误消息 + */ + public static AjaxResult error(int code, String msg) + { + return new AjaxResult(code, msg, null); + } + + /** + * 方便链式调用 + * + * @param key 键 + * @param value 值 + * @return 数据对象 + */ + @Override + public AjaxResult put(String key, Object value) + { + super.put(key, value); + return this; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..38e47b2eca53dced5e8bad61443f530f071d35bf --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -0,0 +1,129 @@ +package com.ruoyi.common.core.domain; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.common.annotation.Excel; + +/** + * Entity基类 + * + * @author ruoyi + */ +public class BaseEntity implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 搜索值 */ + @JsonIgnore + @TableField(exist = false) + private String searchValue; + + /** 创建者 */ + @TableField(value = "create_by",fill = FieldFill.INSERT) + private String createBy; + + /** 创建时间 */ + // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + @TableField(value = "create_time",fill = FieldFill.INSERT) + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss",sort = 30) + private Date createTime; + + /** 更新者 */ + @TableField(value = "update_by",fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** 更新时间 */ + // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE) + private Date updateTime; + + /** 备注 */ + @Excel(name = "备注", type = Excel.Type.ALL, sort = 31) + private String remark; + + /** 请求参数 */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private Map params; + + public String getSearchValue() + { + return searchValue; + } + + public void setSearchValue(String searchValue) + { + this.searchValue = searchValue; + } + + public String getCreateBy() + { + return createBy; + } + + public void setCreateBy(String createBy) + { + this.createBy = createBy; + } + + public Date getCreateTime() + { + return createTime; + } + + public void setCreateTime(Date createTime) + { + this.createTime = createTime; + } + + public String getUpdateBy() + { + return updateBy; + } + + public void setUpdateBy(String updateBy) + { + this.updateBy = updateBy; + } + + public Date getUpdateTime() + { + return updateTime; + } + + public void setUpdateTime(Date updateTime) + { + this.updateTime = updateTime; + } + + public String getRemark() + { + return remark; + } + + public void setRemark(String remark) + { + this.remark = remark; + } + + public Map getParams() + { + if (params == null) + { + params = new HashMap<>(); + } + return params; + } + + public void setParams(Map params) + { + this.params = params; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java new file mode 100644 index 0000000000000000000000000000000000000000..ef15802b98a0652ec5259b38b82c3e9a3593c90f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java @@ -0,0 +1,115 @@ +package com.ruoyi.common.core.domain; + +import java.io.Serializable; +import com.ruoyi.common.constant.HttpStatus; + +/** + * 响应信息主体 + * + * @author ruoyi + */ +public class R implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 成功 */ + public static final int SUCCESS = HttpStatus.SUCCESS; + + /** 失败 */ + public static final int FAIL = HttpStatus.ERROR; + + private int code; + + private String msg; + + private T data; + + public static R ok() + { + return restResult(null, SUCCESS, "操作成功"); + } + + public static R ok(T data) + { + return restResult(data, SUCCESS, "操作成功"); + } + + public static R ok(T data, String msg) + { + return restResult(data, SUCCESS, msg); + } + + public static R fail() + { + return restResult(null, FAIL, "操作失败"); + } + + public static R fail(String msg) + { + return restResult(null, FAIL, msg); + } + + public static R fail(T data) + { + return restResult(data, FAIL, "操作失败"); + } + + public static R fail(T data, String msg) + { + return restResult(data, FAIL, msg); + } + + public static R fail(int code, String msg) + { + return restResult(null, code, msg); + } + + private static R restResult(T data, int code, String msg) + { + R apiResult = new R<>(); + apiResult.setCode(code); + apiResult.setData(data); + apiResult.setMsg(msg); + return apiResult; + } + + public int getCode() + { + return code; + } + + public void setCode(int code) + { + this.code = code; + } + + public String getMsg() + { + return msg; + } + + public void setMsg(String msg) + { + this.msg = msg; + } + + public T getData() + { + return data; + } + + public void setData(T data) + { + this.data = data; + } + + public static Boolean isError(R ret) + { + return !isSuccess(ret); + } + + public static Boolean isSuccess(R ret) + { + return R.SUCCESS == ret.getCode(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..a180a18c59353522f3ee3a60ba1a8d05c8b23090 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java @@ -0,0 +1,79 @@ +package com.ruoyi.common.core.domain; + +import java.util.ArrayList; +import java.util.List; + +/** + * Tree基类 + * + * @author ruoyi + */ +public class TreeEntity extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 父菜单名称 */ + private String parentName; + + /** 父菜单ID */ + private Long parentId; + + /** 显示顺序 */ + private Integer orderNum; + + /** 祖级列表 */ + private String ancestors; + + /** 子部门 */ + private List children = new ArrayList<>(); + + public String getParentName() + { + return parentName; + } + + public void setParentName(String parentName) + { + this.parentName = parentName; + } + + public Long getParentId() + { + return parentId; + } + + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + public Integer getOrderNum() + { + return orderNum; + } + + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public String getAncestors() + { + return ancestors; + } + + public void setAncestors(String ancestors) + { + this.ancestors = ancestors; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java new file mode 100644 index 0000000000000000000000000000000000000000..564f082ba42fc8a0f6e2412b3a0060a24818b825 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java @@ -0,0 +1,85 @@ +package com.ruoyi.common.core.domain; + +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.common.core.domain.entity.SysAppMenu; +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.entity.SysMenu; + +/** + * Treeselect树结构实体类 + * + * @author ruoyi + */ +public class TreeSelect implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 节点ID */ + private Long id; + + /** 节点名称 */ + private String label; + + /** 子节点 */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + public TreeSelect() + { + + } + + public TreeSelect(SysDept dept) + { + this.id = dept.getDeptId(); + this.label = dept.getDeptName(); + this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + public TreeSelect(SysMenu menu) + { + this.id = menu.getMenuId(); + this.label = menu.getMenuName(); + this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + public TreeSelect(SysAppMenu menu) + { + this.id = menu.getMenuId(); + this.label = menu.getMenuName(); + this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getLabel() + { + return label; + } + + public void setLabel(String label) + { + this.label = label; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/HandleDataDTO.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/HandleDataDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..2d929ea84afd9f78036920652a10dedb42fecf99 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/HandleDataDTO.java @@ -0,0 +1,46 @@ +package com.ruoyi.common.core.domain.dto; + +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author LoveMyOrange + * @create 2022-10-15 16:27 + */ +@Data +@ApiModel("各个按钮 处理数据需要传递的参数") +public class HandleDataDTO { + @ApiModelProperty("任务id") + private String taskId; + @ApiModelProperty("流程实例id") + private String processInstanceId; + @ApiModelProperty("表单数据") + private JSONObject formData; + @ApiModelProperty("附件") + private List attachments; + @ApiModelProperty("意见") + private String comments; + @ApiModelProperty("签名信息") + private String signInfo; + @ApiModelProperty("转办类型") + private Integer transferType; + @ApiModelProperty("转办用户信息") + private UserInfo transferUserInfo; + @ApiModelProperty("加签用户信息") + private UserInfo multiAddUserInfo; + @ApiModelProperty("退回节点id") + private String rollbackId; + @ApiModelProperty("当前用户信息") + private UserInfo currentUserInfo; + @ApiModelProperty("任务名称") + private String taskName; + @ApiModelProperty("委派的人") + private UserInfo delegateUserInfo; + @ApiModelProperty("是否需要获取原来的fromData") + private String oldFromData; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/SearchInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/SearchInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..c1decce2589d33d7a541ce565e50bdc6c7e87610 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/SearchInfo.java @@ -0,0 +1,26 @@ +package com.ruoyi.common.core.domain.dto; + +import lombok.Data; + +/** + * @Author:LoveMyOrange + * @Description: + * @Date:Created in 2022/10/9 16:10 + */ +@Data +public class SearchInfo { + //地市 + private String city; + //区县 + private String county; + //子场景,场馆 + private String venue; + //状态 + private String status; + //开始时间 + private String startDate; + //结束时间 + private String endDate; + //任务类型 + private String taskType; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/StartProcessInstanceDTO.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/StartProcessInstanceDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..d96e00163723afd8c93e47a213fb7aaf60f9caa5 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/StartProcessInstanceDTO.java @@ -0,0 +1,20 @@ +package com.ruoyi.common.core.domain.dto; + +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + * @author LoveMyOrange + * @create 2022-10-14 23:27 + */ +@Data +public class StartProcessInstanceDTO { + private String processDefinitionId; + private JSONObject formData; + private Map> processUsers; + private UserInfo startUserInfo; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/TaskDTO.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/TaskDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..78e2ccb044f4ceb6cbc02d0a7a84587412d0824f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/TaskDTO.java @@ -0,0 +1,27 @@ +package com.ruoyi.common.core.domain.dto; + +import com.ruoyi.common.core.domain.dto.json.UserInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author LoveMyOrange + * @create 2022-10-14 23:47 + */ +@Data +@ApiModel("待办 需要返回给前端的VO") +public class TaskDTO { + + @ApiModelProperty(value = "第几页",required = true) + private Integer pageNo; + @ApiModelProperty(value = "多少条",required = true) + private Integer pageSize; + + private UserInfo currentUserInfo; + + private SearchInfo searchInfo; + + private String isApp; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/json/UserInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/json/UserInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..5226a016fd500069ca1af17b623e12b29475ce56 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/dto/json/UserInfo.java @@ -0,0 +1,22 @@ +package com.ruoyi.common.core.domain.dto.json; + +import lombok.Data; + +import java.util.List; + +/** + * @Author:LoveMyOrange + * @Description: + * @Date:Created in 2022/10/9 16:10 + */ +@Data +public class UserInfo { + private String id; + private String name; + private String type; + private String sex; + private String specialty; + private Boolean selected; + private List roles; + private List venue; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysAppMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysAppMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..da429a6f562e6f83cc29cc8815a4fbb62b5788a1 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysAppMenu.java @@ -0,0 +1,298 @@ +package com.ruoyi.common.core.domain.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.ArrayList; +import java.util.List; + +/** + * 菜单权限表 sys_app_menu + * + * @author ruoyi + */ +@TableName("sys_app_menu") +public class SysAppMenu extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 菜单ID + */ + @TableId(value = "menu_id") + private Long menuId; + + /** + * 菜单名称 + */ + @TableField(value = "menu_name") + private String menuName; + + /** 父菜单名称 */ +// private String parentName; + + /** + * 父菜单ID + */ + @TableField(value = "parent_id") + private Long parentId; + + /** + * 显示顺序 + */ + @TableField(value = "order_num") + private Integer orderNum; + + /** + * 路由地址 + */ + private String path; + + /** + * 组件路径 + */ + private String component; + + /** + * 路由参数 + */ + private String query; + + /** + * 是否为外链(0是 1否) + */ + @TableField(value = "is_frame") + private String isFrame; + + /** + * 是否缓存(0缓存 1不缓存) + */ + @TableField(value = "is_cache") + private String isCache; + + /** + * 是否已添加(0否 1已添加) + */ + @TableField(exist = false) + private Integer isAdd=0; + + /** + * 类型(M目录 C菜单 F按钮) + */ + @TableField(value = "menu_type") + private String menuType; + + /** + * 显示状态(0显示 1隐藏) + */ + private String visible; + + /** + * 菜单状态(0正常 1停用) + */ + private String status; + + /** + * 权限字符串 + */ + private String perms; + + /** + * 菜单图标 + */ + private String icon; + + /** + * 菜单图标2 + */ + private String icon2; + + public String getIcon2() { + return icon2; + } + + public void setIcon2(String icon2) { + this.icon2 = icon2; + } + + /** + * 子菜单 + */ + private List children = new ArrayList(); + + public Long getMenuId() { + return menuId; + } + + public void setMenuId(Long menuId) { + this.menuId = menuId; + } + + @NotBlank(message = "菜单名称不能为空") + @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") + public String getMenuName() { + return menuName; + } + + public void setMenuName(String menuName) { + this.menuName = menuName; + } + +// public String getParentName() +// { +// return parentName; +// } +// +// public void setParentName(String parentName) +// { +// this.parentName = parentName; +// } + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + @NotNull(message = "显示顺序不能为空") + public Integer getOrderNum() { + return orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") + public String getComponent() { + return component; + } + + public void setComponent(String component) { + this.component = component; + } + + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public String getIsFrame() { + return isFrame; + } + + public void setIsFrame(String isFrame) { + this.isFrame = isFrame; + } + + public String getIsCache() { + return isCache; + } + + public void setIsCache(String isCache) { + this.isCache = isCache; + } + + public Integer getIsAdd() { + return isAdd; + } + + public void setIsAdd(Integer isAdd) { + this.isAdd = isAdd; + } + + @NotBlank(message = "菜单类型不能为空") + public String getMenuType() { + return menuType; + } + + public void setMenuType(String menuType) { + this.menuType = menuType; + } + + public String getVisible() { + return visible; + } + + public void setVisible(String visible) { + this.visible = visible; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") + public String getPerms() { + return perms; + } + + public void setPerms(String perms) { + this.perms = perms; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("menuId", getMenuId()) + .append("menuName", getMenuName()) + .append("parentId", getParentId()) + .append("orderNum", getOrderNum()) + .append("path", getPath()) + .append("component", getComponent()) + .append("isFrame", getIsFrame()) + .append("IsCache", getIsCache()) + .append("menuType", getMenuType()) + .append("visible", getVisible()) + .append("status ", getStatus()) + .append("perms", getPerms()) + .append("icon", getIcon()) + .append("icon2", getIcon2()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java new file mode 100644 index 0000000000000000000000000000000000000000..c1366ce5b2753afbd503a54a1aa8d55921f7eb53 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -0,0 +1,215 @@ +package com.ruoyi.common.core.domain.entity; + +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 部门表 sys_dept + * + * @author ruoyi + */ +@TableName("sys_dept") +public class SysDept extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 部门ID */ + + @TableId(value = "dept_id") + private Long deptId; + + /** 父部门ID */ + @TableField(value = "parent_id") + private Long parentId; + + /** 祖级列表 */ + private String ancestors; + + /** 部门名称 */ + @TableField(value = "dept_name") + private String deptName; + + /** 显示顺序 */ + + @TableField(value = "order_num") + private Integer orderNum; + + /** 负责人 */ + private String leader; + + /** 联系电话 */ + private String phone; + + /** 邮箱 */ + private String email; + + /** 部门状态:0正常,1停用 */ + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + @TableField(value = "del_flag") + private String delFlag; + + /** 父部门名称 */ + private String parentName; + + /** 子部门 */ + private List children = new ArrayList(); + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public Long getParentId() + { + return parentId; + } + + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + public String getAncestors() + { + return ancestors; + } + + public void setAncestors(String ancestors) + { + this.ancestors = ancestors; + } + + @NotBlank(message = "部门名称不能为空") + @Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符") + public String getDeptName() + { + return deptName; + } + + public void setDeptName(String deptName) + { + this.deptName = deptName; + } + + @NotNull(message = "显示顺序不能为空") + public Integer getOrderNum() + { + return orderNum; + } + + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + public String getLeader() + { + return leader; + } + + public void setLeader(String leader) + { + this.leader = leader; + } + + @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符") + public String getPhone() + { + return phone; + } + + public void setPhone(String phone) + { + this.phone = phone; + } + + @Email(message = "邮箱格式不正确") + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getParentName() + { + return parentName; + } + + public void setParentName(String parentName) + { + this.parentName = parentName; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("deptId", getDeptId()) + .append("parentId", getParentId()) + .append("ancestors", getAncestors()) + .append("deptName", getDeptName()) + .append("orderNum", getOrderNum()) + .append("leader", getLeader()) + .append("phone", getPhone()) + .append("email", getEmail()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java new file mode 100644 index 0000000000000000000000000000000000000000..65427f64a879b7bde802605f6eba8976b085c053 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java @@ -0,0 +1,189 @@ +package com.ruoyi.common.core.domain.entity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 字典数据表 sys_dict_data + * + * @author ruoyi + */ +@TableName("sys_dict_data") +public class SysDictData extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 字典编码 */ + @Excel(name = "字典编码", cellType = ColumnType.NUMERIC) + @TableId(value = "dict_code") + private Long dictCode; + + /** 字典排序 */ + @Excel(name = "字典排序", cellType = ColumnType.NUMERIC) + @TableField(value = "dict_sort") + private Long dictSort; + + /** 字典标签 */ + @Excel(name = "字典标签") + @TableField(value = "dict_label") + private String dictLabel; + + /** 字典键值 */ + @Excel(name = "字典键值") + @TableField(value = "dict_value") + private String dictValue; + + /** 字典类型 */ + @Excel(name = "字典类型") + @TableField(value = "dict_type") + private String dictType; + + /** 样式属性(其他样式扩展) */ + @TableField(value = "css_class") + private String cssClass; + + /** 表格字典样式 */ + @TableField(value = "list_class") + private String listClass; + + /** 是否默认(Y是 N否) */ + @Excel(name = "是否默认", readConverterExp = "Y=是,N=否") + @TableField(value = "is_default") + private String isDefault; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + public Long getDictCode() + { + return dictCode; + } + + public void setDictCode(Long dictCode) + { + this.dictCode = dictCode; + } + + public Long getDictSort() + { + return dictSort; + } + + public void setDictSort(Long dictSort) + { + this.dictSort = dictSort; + } + + @NotBlank(message = "字典标签不能为空") + @Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符") + public String getDictLabel() + { + return dictLabel; + } + + public void setDictLabel(String dictLabel) + { + this.dictLabel = dictLabel; + } + + @NotBlank(message = "字典键值不能为空") + @Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") + public String getDictValue() + { + return dictValue; + } + + public void setDictValue(String dictValue) + { + this.dictValue = dictValue; + } + + @NotBlank(message = "字典类型不能为空") + @Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符") + public String getDictType() + { + return dictType; + } + + public void setDictType(String dictType) + { + this.dictType = dictType; + } + + @Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符") + public String getCssClass() + { + return cssClass; + } + + public void setCssClass(String cssClass) + { + this.cssClass = cssClass; + } + + public String getListClass() + { + return listClass; + } + + public void setListClass(String listClass) + { + this.listClass = listClass; + } + + public boolean getDefault() + { + return UserConstants.YES.equals(this.isDefault); + } + + public String getIsDefault() + { + return isDefault; + } + + public void setIsDefault(String isDefault) + { + this.isDefault = isDefault; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("dictCode", getDictCode()) + .append("dictSort", getDictSort()) + .append("dictLabel", getDictLabel()) + .append("dictValue", getDictValue()) + .append("dictType", getDictType()) + .append("cssClass", getCssClass()) + .append("listClass", getListClass()) + .append("isDefault", getIsDefault()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java new file mode 100644 index 0000000000000000000000000000000000000000..fff0842d6445825ba0e6836a3745353f47c887cb --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java @@ -0,0 +1,104 @@ +package com.ruoyi.common.core.domain.entity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 字典类型表 sys_dict_type + * + * @author ruoyi + */ +@TableName("sys_dict_type") +public class SysDictType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 字典主键 */ + @Excel(name = "字典主键", cellType = ColumnType.NUMERIC) + @TableId(value = "dict_id") + private Long dictId; + + /** 字典名称 */ + @Excel(name = "字典名称") + @TableField(value = "dict_name") + private String dictName; + + /** 字典类型 */ + @Excel(name = "字典类型") + @TableField(value = "dict_type") + private String dictType; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + public Long getDictId() + { + return dictId; + } + + public void setDictId(Long dictId) + { + this.dictId = dictId; + } + + @NotBlank(message = "字典名称不能为空") + @Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符") + public String getDictName() + { + return dictName; + } + + public void setDictName(String dictName) + { + this.dictName = dictName; + } + + @NotBlank(message = "字典类型不能为空") + @Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符") + @Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)") + public String getDictType() + { + return dictType; + } + + public void setDictType(String dictType) + { + this.dictType = dictType; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("dictId", getDictId()) + .append("dictName", getDictName()) + .append("dictType", getDictType()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..1ed2c2500bfcae87936bb2ef75fba01d5a4527bb --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java @@ -0,0 +1,271 @@ +package com.ruoyi.common.core.domain.entity; + +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 菜单权限表 sys_menu + * + * @author ruoyi + */ +@TableName("sys_menu") +public class SysMenu extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 菜单ID */ + @TableId(value = "menu_id") + private Long menuId; + + /** 菜单名称 */ + @TableField(value = "menu_name") + private String menuName; + + /** 父菜单名称 */ +// private String parentName; + + /** 父菜单ID */ + @TableField(value = "parent_id") + private Long parentId; + + /** 显示顺序 */ + @TableField(value = "order_num") + private Integer orderNum; + + /** 路由地址 */ + private String path; + + /** 组件路径 */ + private String component; + + /** 路由参数 */ + private String query; + + /** 是否为外链(0是 1否) */ + @TableField(value = "is_frame") + private String isFrame; + + /** 是否缓存(0缓存 1不缓存) */ + @TableField(value = "is_cache") + private String isCache; + + /** 类型(M目录 C菜单 F按钮) */ + @TableField(value = "menu_type") + private String menuType; + + /** 显示状态(0显示 1隐藏) */ + private String visible; + + /** 菜单状态(0正常 1停用) */ + private String status; + + /** 权限字符串 */ + private String perms; + + /** 菜单图标 */ + private String icon; + + /** 子菜单 */ + private List children = new ArrayList(); + + public Long getMenuId() + { + return menuId; + } + + public void setMenuId(Long menuId) + { + this.menuId = menuId; + } + + @NotBlank(message = "菜单名称不能为空") + @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符") + public String getMenuName() + { + return menuName; + } + + public void setMenuName(String menuName) + { + this.menuName = menuName; + } + +// public String getParentName() +// { +// return parentName; +// } +// +// public void setParentName(String parentName) +// { +// this.parentName = parentName; +// } + + public Long getParentId() + { + return parentId; + } + + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + @NotNull(message = "显示顺序不能为空") + public Integer getOrderNum() + { + return orderNum; + } + + public void setOrderNum(Integer orderNum) + { + this.orderNum = orderNum; + } + + @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") + public String getPath() + { + return path; + } + + public void setPath(String path) + { + this.path = path; + } + + @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") + public String getComponent() + { + return component; + } + + public void setComponent(String component) + { + this.component = component; + } + + public String getQuery() + { + return query; + } + + public void setQuery(String query) + { + this.query = query; + } + + public String getIsFrame() + { + return isFrame; + } + + public void setIsFrame(String isFrame) + { + this.isFrame = isFrame; + } + + public String getIsCache() + { + return isCache; + } + + public void setIsCache(String isCache) + { + this.isCache = isCache; + } + + @NotBlank(message = "菜单类型不能为空") + public String getMenuType() + { + return menuType; + } + + public void setMenuType(String menuType) + { + this.menuType = menuType; + } + + public String getVisible() + { + return visible; + } + + public void setVisible(String visible) + { + this.visible = visible; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") + public String getPerms() + { + return perms; + } + + public void setPerms(String perms) + { + this.perms = perms; + } + + public String getIcon() + { + return icon; + } + + public void setIcon(String icon) + { + this.icon = icon; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("menuId", getMenuId()) + .append("menuName", getMenuName()) + .append("parentId", getParentId()) + .append("orderNum", getOrderNum()) + .append("path", getPath()) + .append("component", getComponent()) + .append("isFrame", getIsFrame()) + .append("IsCache", getIsCache()) + .append("menuType", getMenuType()) + .append("visible", getVisible()) + .append("status ", getStatus()) + .append("perms", getPerms()) + .append("icon", getIcon()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java new file mode 100644 index 0000000000000000000000000000000000000000..8d6b3141782a2ae1f38cf8471d7f2b06efe9bff2 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -0,0 +1,286 @@ +package com.ruoyi.common.core.domain.entity; + +import java.util.Set; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 角色表 sys_role + * + * @author ruoyi + */ +@TableName("sys_role") +public class SysRole extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 角色ID */ + @Excel(name = "ID", cellType = ColumnType.NUMERIC,sort = 1) + @TableId(value = "role_id") + private Long roleId; + + /** 角色名称 */ + @Excel(name = "角色名称",sort = 2) + @TableField(value = "role_name") + private String roleName; + + /** 角色权限 */ + @Excel(name = "权限范围",sort = 3) + @TableField(value = "role_key") + private String roleKey; + + /** 角色排序 */ + @TableField(value = "role_sort") + private Integer roleSort; + + /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */ +// @Excel(name = "权限范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") + @TableField(value = "data_scope") + private String dataScope; + + /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */ + @TableField(value = "menu_check_strictly") + private boolean menuCheckStrictly; + + /** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */ + @TableField(value = "dept_check_strictly") + private boolean deptCheckStrictly; + + /** 角色状态(0正常 1停用) */ + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + @TableField(value = "del_flag") + private String delFlag; + + /** 用户是否存在此角色标识 默认不存在 */ + private boolean flag = false; + + /** 菜单组 */ + private Long[] menuIds; + + public String getStrMenuNames() { + return strMenuNames; + } + + public void setStrMenuNames(String strMenuNames) { + this.strMenuNames = strMenuNames; + } + + @Excel(name = "菜单权限",sort = 4) + private String strMenuNames; + + public Long[] getUserIds() { + return userIds; + } + + public void setUserIds(Long[] userIds) { + this.userIds = userIds; + } + + private Long[] userIds; + + /** app菜单组 */ + private Long[] appMenuIds; + + /** 部门组(数据权限) */ + private Long[] deptIds; + + /** 角色菜单权限 */ + private Set permissions; + + public SysRole() + { + + } + + public SysRole(Long roleId) + { + this.roleId = roleId; + } + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + public boolean isAdmin() + { + return isAdmin(this.roleId); + } + + public static boolean isAdmin(Long roleId) + { + return roleId != null && 1L == roleId; + } + + @NotBlank(message = "角色名称不能为空") + @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") + public String getRoleName() + { + return roleName; + } + + public void setRoleName(String roleName) + { + this.roleName = roleName; + } + + @NotBlank(message = "权限字符不能为空") + @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符") + public String getRoleKey() + { + return roleKey; + } + + public void setRoleKey(String roleKey) + { + this.roleKey = roleKey; + } + + @NotNull(message = "显示顺序不能为空") + public Integer getRoleSort() + { + return roleSort; + } + + public void setRoleSort(Integer roleSort) + { + this.roleSort = roleSort; + } + + public String getDataScope() + { + return dataScope; + } + + public void setDataScope(String dataScope) + { + this.dataScope = dataScope; + } + + public boolean isMenuCheckStrictly() + { + return menuCheckStrictly; + } + + public void setMenuCheckStrictly(boolean menuCheckStrictly) + { + this.menuCheckStrictly = menuCheckStrictly; + } + + public boolean isDeptCheckStrictly() + { + return deptCheckStrictly; + } + + public void setDeptCheckStrictly(boolean deptCheckStrictly) + { + this.deptCheckStrictly = deptCheckStrictly; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public boolean isFlag() + { + return flag; + } + + public void setFlag(boolean flag) + { + this.flag = flag; + } + + public Long[] getMenuIds() + { + return menuIds; + } + + public void setMenuIds(Long[] menuIds) + { + this.menuIds = menuIds; + } + + public Long[] getAppMenuIds() + { + return appMenuIds; + } + + public void setAppMenuIds(Long[] appMenuIds) + { + this.appMenuIds = appMenuIds; + } + + public Long[] getDeptIds() + { + return deptIds; + } + + public void setDeptIds(Long[] deptIds) + { + this.deptIds = deptIds; + } + + public Set getPermissions() + { + return permissions; + } + + public void setPermissions(Set permissions) + { + this.permissions = permissions; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("roleName", getRoleName()) + .append("roleKey", getRoleKey()) + .append("roleSort", getRoleSort()) + .append("dataScope", getDataScope()) + .append("menuCheckStrictly", isMenuCheckStrictly()) + .append("deptCheckStrictly", isDeptCheckStrictly()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java new file mode 100644 index 0000000000000000000000000000000000000000..15319308382075c43e8c84b720f9964a36f99a41 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -0,0 +1,575 @@ +package com.ruoyi.common.core.domain.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.Type; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.xss.Xss; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.util.Date; +import java.util.List; + +/** + * 用户对象 sys_user + * + * @author ruoyi + */ +@TableName("sys_user") +public class SysUser extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 用户ID */ + @Excel(name = "ID",sort = 1) + @TableId(value = "user_id") + private Long userId; + + /** 部门ID */ + @TableField(value = "dept_id") + private Long deptId; + + /** 用户账号 */ + @TableField(value = "user_name") + private String userName; + + /** 用户昵称 */ + @Excel(name = "用户姓名" , type = Type.ALL , sort = 2) + @TableField(value = "nick_name") + private String nickName; + + public String getUserType() { + return userType; + } + + public void setUserType(String userType) { + this.userType = userType; + } + + + @Excel(name = "专业", type = Type.ALL, sort = 3 ) + @TableField(value = "user_type") + private String userType; + + + public String getUserTypeStr() { + return userTypeStr; + } + + public void setUserTypeStr(String userTypeStr) { + this.userTypeStr = userTypeStr; + } + + + @TableField(exist = false) + private String userTypeStr; + + /** 用户邮箱 */ +// @Excel(name = "用户邮箱") + private String email; + + /** 手机号码 */ + @Excel(name = "手机号码", type = Type.ALL , sort = 4) + @TableField(value = "phonenumber") + private String phonenumber; + + /** 用户性别 */ +// @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") + private String sex; + + /** 用户头像 */ + @Excel(name = "用户头像URL", sort = 4) + private String avatar; + + /** 密码 */ + private String password; + + /** 账号状态(0正常 1锁定 2冻结) */ + @Excel(name = "账号状态", readConverterExp = "0=正常,1=锁定,2=冻结", sort = 5) + private String status; + + /** 删除标志(0代表存在 2代表删除) */ +// @Excel(name = "是否删除", readConverterExp = "0=否,2=是", sort = 6) + @TableField(value = "del_flag") + private String delFlag; + + /** 最后登录IP */ + @Excel(name = "最后登录IP", sort = 7) + @TableField(value = "login_ip") + private String loginIp; + + public String getFirstPage() { + return firstPage; + } + + public void setFirstPage(String firstPage) { + this.firstPage = firstPage; + } + + @TableField(value = "first_page") + private String firstPage; + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getCounty() { + return county; + } + + public void setCounty(String county) { + this.county = county; + } + + public String getDistinctArea() { + return distinctArea; + } + + public void setDistinctArea(String distinctArea) { + this.distinctArea = distinctArea; + } + + @Excel(name = "地市",type = Type.ALL, sort = 9) + private String city; + + + @Excel(name = "区县",type = Type.ALL, sort = 10) + private String county; + + @Excel(name = "场馆分区",type = Type.ALL, sort = 11) + private String distinctArea; + + public String getUserVenue() { + return userVenue; + } + + public void setUserVenue(String userVenue) { + this.userVenue = userVenue; + } + + private String userVenue; + + public String getUserVenueId() { + return userVenueId; + } + + public void setUserVenueId(String userVenueId) { + this.userVenueId = userVenueId; + } + + private String userVenueId; + + /** 最后登录时间 */ + @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT, sort = 8) + @TableField(value = "login_date") + private Date loginDate; + + /** 部门对象 */ +// @Excels({ +// @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), +// @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) +// }) + private SysDept dept; + + /** 角色对象 */ + private List roles; + + /** 角色组 */ + private Long[] roleIds; + + /** 岗位组 */ + private Long[] postIds; + + /** 角色ID */ + private Long roleId; + + /** 用户顺序,按用户拥有角色排列,如场馆经理、场馆助理、通信主管....., 取最前的角色 */ + @TableField(exist = false) + private Integer userSort; + + public Integer getUserSort() { + return userSort; + } + + public void setUserSort(Integer userSort) { + this.userSort = userSort; + } + + public String getBelongArea() { + return belongArea; + } + + public void setBelongArea(String belongArea) { + this.belongArea = belongArea; + } + + private String belongArea; + + public Long[] getVenueIds() { + return venueIds; + } + + public void setVenueIds(Long[] venueIds) { + this.venueIds = venueIds; + } + + public List getVenueNames() { + return venueNames; + } + + public void setVenueNames(List venueNames) { + this.venueNames = venueNames; + } + + public List getRoleNames() { + return roleNames; + } + + public void setRoleNames(List roleNames) { + this.roleNames = roleNames; + } + + private Long[] venueIds; + + private List venueNames; + + @Excel(name = "角色", sort = 12) + private String strRoles; + + @Excel(name = "所属场馆", sort = 13) + private String strVenueNames; + + @Excel(name = "自有/三方",type = Type.ALL,sort = 14) + private String ywUserBelong; + + public String getYwUserBelong() { + return ywUserBelong; + } + + public void setYwUserBelong(String ywUserBelong) { + this.ywUserBelong = ywUserBelong; + } + + public String getStrRoles() { + return strRoles; + } + + public void setStrRoles(String strRoles) { + this.strRoles = strRoles; + } + + public String getStrVenueNames() { + return strVenueNames; + } + + public void setStrVenueNames(String strVenueNames) { + this.strVenueNames = strVenueNames; + } + + public String getStrBelongArea() { + return strBelongArea; + } + + + public void setStrBelongArea(String strBelongArea) { + this.strBelongArea = strBelongArea; + } + + + private String strBelongArea; + + private List roleNames; + + public SysUser() + { + + } + + + public SysUser(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public boolean isAdmin() + { + return isAdmin(this.userId); + } + + public static boolean isAdmin(Long userId) + { + return userId != null && 1L == userId; + } + + public boolean isAdmin(SysUser user) { + Boolean isAdmin=false; + if(ObjectUtils.isNotEmpty(user.getRoles())) { + for (SysRole sysRole : user.getRoles()) { + if (sysRole.getRoleKey().contains("admin") || "monitor" .equals(sysRole.getRoleKey()) || "noticemaster" .equals(sysRole.getRoleKey())) +// if(sysRole.getRoleKey().contains("admin")||sysRole.getRoleKey().contains("monitor")) + { + isAdmin = true; + break; + } + } + } + return isAdmin; + } + + public boolean isLeader(SysUser user) { + Boolean isLeader=false; + if(ObjectUtils.isNotEmpty(user.getRoles())) { + for (SysRole sysRole : user.getRoles()) { + if (sysRole.getRoleKey().contains("leader")) +// if(sysRole.getRoleKey().contains("admin")||sysRole.getRoleKey().contains("monitor")) + { + isLeader = true; + break; + } + } + } + return isLeader; + } + + public boolean isCenter(SysUser user) { + Boolean isCenter=false; + if(ObjectUtils.isNotEmpty(user.getRoles())) { + for (SysRole sysRole : user.getRoles()) { + if (sysRole.getRoleKey().contains("centerstorage")) +// if(sysRole.getRoleKey().contains("admin")||sysRole.getRoleKey().contains("monitor")) + { + isCenter = true; + break; + } + } + } + return isCenter; + } + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + @Xss(message = "用户昵称不能包含脚本字符") + @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") + public String getNickName() + { + return nickName; + } + + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + @Xss(message = "用户账号不能包含脚本字符") + @NotBlank(message = "用户账号不能为空") + @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") + public String getUserName() + { + return userName; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + @Email(message = "邮箱格式不正确") + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") + public String getEmail() + { + return email; + } + + public void setEmail(String email) + { + this.email = email; + } + + @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") + public String getPhonenumber() + { + return phonenumber; + } + + public void setPhonenumber(String phonenumber) + { + this.phonenumber = phonenumber; + } + + public String getSex() + { + return sex; + } + + public void setSex(String sex) + { + this.sex = sex; + } + + public String getAvatar() + { + return avatar; + } + + public void setAvatar(String avatar) + { + this.avatar = avatar; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getDelFlag() + { + return delFlag; + } + + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getLoginIp() + { + return loginIp; + } + + public void setLoginIp(String loginIp) + { + this.loginIp = loginIp; + } + + public Date getLoginDate() + { + return loginDate; + } + + public void setLoginDate(Date loginDate) + { + this.loginDate = loginDate; + } + + public SysDept getDept() + { + return dept; + } + + public void setDept(SysDept dept) + { + this.dept = dept; + } + + public List getRoles() + { + return roles; + } + + public void setRoles(List roles) + { + this.roles = roles; + } + + public Long[] getRoleIds() + { + return roleIds; + } + + public void setRoleIds(Long[] roleIds) + { + this.roleIds = roleIds; + } + + public Long[] getPostIds() + { + return postIds; + } + + public void setPostIds(Long[] postIds) + { + this.postIds = postIds; + } + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("deptId", getDeptId()) + .append("userName", getUserName()) + .append("nickName", getNickName()) + .append("userType", getUserType()) + .append("email", getEmail()) + .append("phonenumber", getPhonenumber()) + .append("sex", getSex()) + .append("avatar", getAvatar()) + .append("password", getPassword()) + .append("status", getStatus()) + .append("delFlag", getDelFlag()) + .append("loginIp", getLoginIp()) + .append("loginDate", getLoginDate()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("firstPage", getFirstPage()) + .append("dept", getDept()) + .append("ywUserBelong", getYwUserBelong()) + .toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/ExcelSelector.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/ExcelSelector.java new file mode 100644 index 0000000000000000000000000000000000000000..acb5f3336d285d8c9eea5cb9e711ce020389268c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/ExcelSelector.java @@ -0,0 +1,41 @@ +package com.ruoyi.common.core.domain.model; + +import lombok.Data; + +/** + * @author huamile + */ +@Data +public class ExcelSelector { + + /** + * 第几个sheet,从0开始 + */ + private int sheetIndex; + + /** + * 下拉单元格行号,从0开始 + */ + private int firstRow = 2; + + /** + * 下拉单元格行(结束) + */ + private int lastRow = 102; + + /** + * 下拉单元格列号,从0开始 + */ + private int firstCol; + + /** + * 下拉单元格列(结束) + */ + private int lastCol; + + /** + * 动态生成的下拉内容,easypoi使用的是字符数组 + */ + private String[] datas; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java new file mode 100644 index 0000000000000000000000000000000000000000..70ba9016c90eae186b119b5a7f882238c0d312ec --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java @@ -0,0 +1,94 @@ +package com.ruoyi.common.core.domain.model; + +/** + * 用户登录对象 + * + * @author ruoyi + */ +public class LoginBody +{ + /** + * 用户名 + */ + private String username; + + /** + * 用户密码 + */ + private String password; + + /** + * 手机号 + */ + private String phone; + + /** + * 验证码 + */ + private String code; + + private String loginType; + + /** + * 唯一标识 + */ + private String uuid; + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getCode() + { + return code; + } + + public void setCode(String code) + { + this.code = code; + } + + public String getUuid() + { + return uuid; + } + + public void setUuid(String uuid) + { + this.uuid = uuid; + } + + public String getLoginType() + { + return loginType; + } + + public void setLoginType(String loginType) + { + this.loginType = loginType; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java new file mode 100644 index 0000000000000000000000000000000000000000..ccede75f8890e490f2dff95ad8e005f011b474b0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java @@ -0,0 +1,310 @@ +package com.ruoyi.common.core.domain.model; + +import java.util.Collection; +import java.util.Set; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import com.alibaba.fastjson2.annotation.JSONField; +import com.ruoyi.common.core.domain.entity.SysUser; + +/** + * 登录用户身份权限 + * + * @author ruoyi + */ +public class LoginUser implements UserDetails +{ + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private Long userId; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 用户唯一标识 + */ + private String token; + + /** + * 登录时间 + */ + private Long loginTime; + + /** + * 过期时间 + */ + private Long expireTime; + + public Long[] getVenueIds() { + return venueIds; + } + + public void setVenueIds(Long[] venueIds) { + this.venueIds = venueIds; + } + + private Long[] venueIds; + + /** + * 登录IP地址 + */ + private String ipaddr; + + /** + * 登录地点 + */ + private String loginLocation; + + /** + * 浏览器类型 + */ + private String browser; + + /** + * 操作系统 + */ + private String os; + + public String getLoginType() { + return loginType; + } + + public void setLoginType(String loginType) { + this.loginType = loginType; + } + + /** + * 登录类型 + */ + private String loginType; + + /** + * 权限列表 + */ + private Set permissions; + + /** + * app权限列表 + */ + private Set appPermissions; + + /** + * 用户信息 + */ + private SysUser user; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public String getToken() + { + return token; + } + + public void setToken(String token) + { + this.token = token; + } + + public LoginUser() + { + } + + public LoginUser(SysUser user, Set permissions) + { + this.user = user; + this.permissions = permissions; + } + + public LoginUser(Long userId, Long deptId, SysUser user, Set permissions,Set appPermissions) + { + this.userId = userId; + this.deptId = deptId; + this.user = user; + this.permissions = permissions; + this.appPermissions = appPermissions; + } + + @JSONField(serialize = false) + @Override + public String getPassword() + { + return user.getPassword(); + } + + @Override + public String getUsername() + { + return user.getUserName(); + } + + public String getNickName() + { + return user.getNickName(); + } + + /** + * 账户是否未过期,过期无法验证 + */ + @JSONField(serialize = false) + @Override + public boolean isAccountNonExpired() + { + return true; + } + + /** + * 指定用户是否解锁,锁定的用户无法进行身份验证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isAccountNonLocked() + { + return true; + } + + /** + * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isCredentialsNonExpired() + { + return true; + } + + /** + * 是否可用 ,禁用的用户不能身份验证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isEnabled() + { + return true; + } + + public Long getLoginTime() + { + return loginTime; + } + + public void setLoginTime(Long loginTime) + { + this.loginTime = loginTime; + } + + public String getIpaddr() + { + return ipaddr; + } + + public void setIpaddr(String ipaddr) + { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() + { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) + { + this.loginLocation = loginLocation; + } + + public String getBrowser() + { + return browser; + } + + public void setBrowser(String browser) + { + this.browser = browser; + } + + public String getOs() + { + return os; + } + + public void setOs(String os) + { + this.os = os; + } + + public Long getExpireTime() + { + return expireTime; + } + + public void setExpireTime(Long expireTime) + { + this.expireTime = expireTime; + } + + public Set getPermissions() + { + return permissions; + } + + public void setPermissions(Set permissions) + { + this.permissions = permissions; + } + + public Set getAppPermissions() + { + return appPermissions; + } + + public void setAppPermissions(Set appPermissions) + { + this.appPermissions = appPermissions; + } + + public SysUser getUser() + { + return user; + } + + public void setUser(SysUser user) + { + this.user = user; + } + + @Override + public Collection getAuthorities() + { + return null; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java new file mode 100644 index 0000000000000000000000000000000000000000..868a1fc520430cac797c15d9b80252d741a62ccb --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java @@ -0,0 +1,11 @@ +package com.ruoyi.common.core.domain.model; + +/** + * 用户注册对象 + * + * @author ruoyi + */ +public class RegisterBody extends LoginBody +{ + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java new file mode 100644 index 0000000000000000000000000000000000000000..8966cb4c4e0edf7847cbde0cf5e5788391067cda --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java @@ -0,0 +1,101 @@ +package com.ruoyi.common.core.page; + +import com.ruoyi.common.utils.StringUtils; + +/** + * 分页数据 + * + * @author ruoyi + */ +public class PageDomain +{ + /** 当前记录起始索引 */ + private Integer pageNum; + + /** 每页显示记录数 */ + private Integer pageSize; + + /** 排序列 */ + private String orderByColumn; + + /** 排序的方向desc或者asc */ + private String isAsc = "asc"; + + /** 分页参数合理化 */ + private Boolean reasonable = true; + + public String getOrderBy() + { + if (StringUtils.isEmpty(orderByColumn)) + { + return ""; + } + return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc; + } + + public Integer getPageNum() + { + return pageNum; + } + + public void setPageNum(Integer pageNum) + { + this.pageNum = pageNum; + } + + public Integer getPageSize() + { + return pageSize; + } + + public void setPageSize(Integer pageSize) + { + this.pageSize = pageSize; + } + + public String getOrderByColumn() + { + return orderByColumn; + } + + public void setOrderByColumn(String orderByColumn) + { + this.orderByColumn = orderByColumn; + } + + public String getIsAsc() + { + return isAsc; + } + + public void setIsAsc(String isAsc) + { + if (StringUtils.isNotEmpty(isAsc)) + { + // 兼容前端排序类型 + if ("ascending".equals(isAsc)) + { + isAsc = "asc"; + } + else if ("descending".equals(isAsc)) + { + isAsc = "desc"; + } + this.isAsc = isAsc; + } + } + + public Boolean getReasonable() + { + if (StringUtils.isNull(reasonable)) + { + return Boolean.TRUE; + } + return reasonable; + } + + public void setReasonable(Boolean reasonable) + { + this.reasonable = reasonable; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..8813e0ac14b92826e5e644ca1f6398027094da1c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java @@ -0,0 +1,96 @@ +package com.ruoyi.common.core.page; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +/** + * 表格分页数据对象 + * + * @author ruoyi + */ +public class TableDataInfo implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 总记录数 */ + private long total; + + /** 列表数据 */ + private List rows; + + public HashMap getMaps() { + return maps; + } + + public void setMaps(HashMap maps) { + this.maps = maps; + } + + private HashMap maps; + + /** 消息状态码 */ + private int code; + + /** 消息内容 */ + private String msg; + + /** + * 表格数据对象 + */ + public TableDataInfo() + { + } + + /** + * 分页 + * + * @param list 列表数据 + * @param total 总记录数 + */ + public TableDataInfo(List list, int total) + { + this.rows = list; + this.total = total; + } + + public long getTotal() + { + return total; + } + + public void setTotal(long total) + { + this.total = total; + } + + public List getRows() + { + return rows; + } + + public void setRows(List rows) + { + this.rows = rows; + } + + public int getCode() + { + return code; + } + + public void setCode(int code) + { + this.code = code; + } + + public String getMsg() + { + return msg; + } + + public void setMsg(String msg) + { + this.msg = msg; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java new file mode 100644 index 0000000000000000000000000000000000000000..a120c3002e441bd0acf8a1b4af7f622760624f84 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java @@ -0,0 +1,56 @@ +package com.ruoyi.common.core.page; + +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.utils.ServletUtils; + +/** + * 表格数据处理 + * + * @author ruoyi + */ +public class TableSupport +{ + /** + * 当前记录起始索引 + */ + public static final String PAGE_NUM = "pageNum"; + + /** + * 每页显示记录数 + */ + public static final String PAGE_SIZE = "pageSize"; + + /** + * 排序列 + */ + public static final String ORDER_BY_COLUMN = "orderByColumn"; + + /** + * 排序的方向 "desc" 或者 "asc". + */ + public static final String IS_ASC = "isAsc"; + + /** + * 分页参数合理化 + */ + public static final String REASONABLE = "reasonable"; + + /** + * 封装分页对象 + */ + public static PageDomain getPageDomain() + { + PageDomain pageDomain = new PageDomain(); + pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1)); + pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10)); + pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN)); + pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC)); + pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE)); + return pageDomain; + } + + public static PageDomain buildPageRequest() + { + return getPageDomain(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java new file mode 100644 index 0000000000000000000000000000000000000000..44e80d83ae61ed90eb0377aa1758e10d0250af44 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java @@ -0,0 +1,268 @@ +package com.ruoyi.common.core.redis; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.BoundSetOperations; +import org.springframework.data.redis.core.HashOperations; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Component; + +/** + * spring redis 工具类 + * + * @author ruoyi + **/ +@SuppressWarnings(value = { "unchecked", "rawtypes" }) +@Component +public class RedisCache +{ + @Autowired + public RedisTemplate redisTemplate; + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + */ + public void setCacheObject(final String key, final T value) + { + redisTemplate.opsForValue().set(key, value); + } + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @param timeout 时间 + * @param timeUnit 时间颗粒度 + */ + public void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) + { + redisTemplate.opsForValue().set(key, value, timeout, timeUnit); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout) + { + return expire(key, timeout, TimeUnit.SECONDS); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @param unit 时间单位 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout, final TimeUnit unit) + { + return redisTemplate.expire(key, timeout, unit); + } + + /** + * 获取有效时间 + * + * @param key Redis键 + * @return 有效时间 + */ + public long getExpire(final String key) + { + return redisTemplate.getExpire(key); + } + + /** + * 判断 key是否存在 + * + * @param key 键 + * @return true 存在 false不存在 + */ + public Boolean hasKey(String key) + { + return redisTemplate.hasKey(key); + } + + /** + * 获得缓存的基本对象。 + * + * @param key 缓存键值 + * @return 缓存键值对应的数据 + */ + public T getCacheObject(final String key) + { + ValueOperations operation = redisTemplate.opsForValue(); + return operation.get(key); + } + + /** + * 删除单个对象 + * + * @param key + */ + public boolean deleteObject(final String key) + { + return redisTemplate.delete(key); + } + + /** + * 删除集合对象 + * + * @param collection 多个对象 + * @return + */ + public boolean deleteObject(final Collection collection) + { + return redisTemplate.delete(collection) > 0; + } + + /** + * 缓存List数据 + * + * @param key 缓存的键值 + * @param dataList 待缓存的List数据 + * @return 缓存的对象 + */ + public long setCacheList(final String key, final List dataList) + { + Long count = redisTemplate.opsForList().rightPushAll(key, dataList); + return count == null ? 0 : count; + } + + /** + * 获得缓存的list对象 + * + * @param key 缓存的键值 + * @return 缓存键值对应的数据 + */ + public List getCacheList(final String key) + { + return redisTemplate.opsForList().range(key, 0, -1); + } + + /** + * 缓存Set + * + * @param key 缓存键值 + * @param dataSet 缓存的数据 + * @return 缓存数据的对象 + */ + public BoundSetOperations setCacheSet(final String key, final Set dataSet) + { + BoundSetOperations setOperation = redisTemplate.boundSetOps(key); + Iterator it = dataSet.iterator(); + while (it.hasNext()) + { + setOperation.add(it.next()); + } + return setOperation; + } + + /** + * 获得缓存的set + * + * @param key + * @return + */ + public Set getCacheSet(final String key) + { + return redisTemplate.opsForSet().members(key); + } + + /** + * 缓存Map + * + * @param key + * @param dataMap + */ + public void setCacheMap(final String key, final Map dataMap) + { + if (dataMap != null) { + redisTemplate.opsForHash().putAll(key, dataMap); + } + } + + /** + * 获得缓存的Map + * + * @param key + * @return + */ + public Map getCacheMap(final String key) + { + return redisTemplate.opsForHash().entries(key); + } + + /** + * 往Hash中存入数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @param value 值 + */ + public void setCacheMapValue(final String key, final String hKey, final T value) + { + redisTemplate.opsForHash().put(key, hKey, value); + } + + /** + * 获取Hash中的数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @return Hash中的对象 + */ + public T getCacheMapValue(final String key, final String hKey) + { + HashOperations opsForHash = redisTemplate.opsForHash(); + return opsForHash.get(key, hKey); + } + + /** + * 获取多个Hash中的数据 + * + * @param key Redis键 + * @param hKeys Hash键集合 + * @return Hash对象集合 + */ + public List getMultiCacheMapValue(final String key, final Collection hKeys) + { + return redisTemplate.opsForHash().multiGet(key, hKeys); + } + + /** + * 删除Hash中的某条数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @return 是否成功 + */ + public boolean deleteCacheMapValue(final String key, final String hKey) + { + return redisTemplate.opsForHash().delete(key, hKey) > 0; + } + + /** + * 获得缓存的基本对象列表 + * + * @param pattern 字符串前缀 + * @return 对象列表 + */ + public Collection keys(final String pattern) + { + return redisTemplate.keys(pattern); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java new file mode 100644 index 0000000000000000000000000000000000000000..84124aac547f699d5ac26932be599d85d8baa715 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java @@ -0,0 +1,86 @@ +package com.ruoyi.common.core.text; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import com.ruoyi.common.utils.StringUtils; + +/** + * 字符集工具类 + * + * @author ruoyi + */ +public class CharsetKit +{ + /** ISO-8859-1 */ + public static final String ISO_8859_1 = "ISO-8859-1"; + /** UTF-8 */ + public static final String UTF_8 = "UTF-8"; + /** GBK */ + public static final String GBK = "GBK"; + + /** ISO-8859-1 */ + public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); + /** UTF-8 */ + public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); + /** GBK */ + public static final Charset CHARSET_GBK = Charset.forName(GBK); + + /** + * 转换为Charset对象 + * + * @param charset 字符集,为空则返回默认字符集 + * @return Charset + */ + public static Charset charset(String charset) + { + return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); + } + + /** + * 转换字符串的字符集编码 + * + * @param source 字符串 + * @param srcCharset 源字符集,默认ISO-8859-1 + * @param destCharset 目标字符集,默认UTF-8 + * @return 转换后的字符集 + */ + public static String convert(String source, String srcCharset, String destCharset) + { + return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); + } + + /** + * 转换字符串的字符集编码 + * + * @param source 字符串 + * @param srcCharset 源字符集,默认ISO-8859-1 + * @param destCharset 目标字符集,默认UTF-8 + * @return 转换后的字符集 + */ + public static String convert(String source, Charset srcCharset, Charset destCharset) + { + if (null == srcCharset) + { + srcCharset = StandardCharsets.ISO_8859_1; + } + + if (null == destCharset) + { + destCharset = StandardCharsets.UTF_8; + } + + if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) + { + return source; + } + return new String(source.getBytes(srcCharset), destCharset); + } + + /** + * @return 系统字符集编码 + */ + public static String systemCharset() + { + return Charset.defaultCharset().name(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java new file mode 100644 index 0000000000000000000000000000000000000000..b82321cd3597e747a72a1f1e8357019a0af59e1c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java @@ -0,0 +1,1000 @@ +package com.ruoyi.common.core.text; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.text.NumberFormat; +import java.util.Set; +import com.ruoyi.common.utils.StringUtils; +import org.apache.commons.lang3.ArrayUtils; + +/** + * 类型转换器 + * + * @author ruoyi + */ +public class Convert +{ + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static String toStr(Object value, String defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof String) + { + return (String) value; + } + return value.toString(); + } + + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static String toStr(Object value) + { + return toStr(value, null); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Character toChar(Object value, Character defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof Character) + { + return (Character) value; + } + + final String valueStr = toStr(value, null); + return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Character toChar(Object value) + { + return toChar(value, null); + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Byte toByte(Object value, Byte defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Byte) + { + return (Byte) value; + } + if (value instanceof Number) + { + return ((Number) value).byteValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Byte.parseByte(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Byte toByte(Object value) + { + return toByte(value, null); + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Short toShort(Object value, Short defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Short) + { + return (Short) value; + } + if (value instanceof Number) + { + return ((Number) value).shortValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Short.parseShort(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Short toShort(Object value) + { + return toShort(value, null); + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Number toNumber(Object value, Number defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Number) + { + return (Number) value; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return NumberFormat.getInstance().parse(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Number toNumber(Object value) + { + return toNumber(value, null); + } + + /** + * 转换为int
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Integer toInt(Object value, Integer defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Integer) + { + return (Integer) value; + } + if (value instanceof Number) + { + return ((Number) value).intValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Integer.parseInt(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为int
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Integer toInt(Object value) + { + return toInt(value, null); + } + + /** + * 转换为Integer数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String str) + { + return toIntArray(",", str); + } + + /** + * 转换为Long数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String str) + { + return toLongArray(",", str); + } + + /** + * 转换为Integer数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Integer[] {}; + } + String[] arr = str.split(split); + final Integer[] ints = new Integer[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Integer v = toInt(arr[i], 0); + ints[i] = v; + } + return ints; + } + + /** + * 转换为Long数组
+ * + * @param split 分隔符 + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Long[] {}; + } + String[] arr = str.split(split); + final Long[] longs = new Long[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Long v = toLong(arr[i], null); + longs[i] = v; + } + return longs; + } + + /** + * 转换为String数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String str) + { + return toStrArray(",", str); + } + + /** + * 转换为String数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String split, String str) + { + return str.split(split); + } + + /** + * 转换为long
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Long toLong(Object value, Long defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Long) + { + return (Long) value; + } + if (value instanceof Number) + { + return ((Number) value).longValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).longValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为long
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Long toLong(Object value) + { + return toLong(value, null); + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Double toDouble(Object value, Double defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Double) + { + return (Double) value; + } + if (value instanceof Number) + { + return ((Number) value).doubleValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).doubleValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Double toDouble(Object value) + { + return toDouble(value, null); + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Float toFloat(Object value, Float defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Float) + { + return (Float) value; + } + if (value instanceof Number) + { + return ((Number) value).floatValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Float.parseFloat(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Float toFloat(Object value) + { + return toFloat(value, null); + } + + /** + * 转换为boolean
+ * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Boolean toBool(Object value, Boolean defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Boolean) + { + return (Boolean) value; + } + String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + valueStr = valueStr.trim().toLowerCase(); + switch (valueStr) + { + case "true": + case "yes": + case "ok": + case "1": + return true; + case "false": + case "no": + case "0": + return false; + default: + return defaultValue; + } + } + + /** + * 转换为boolean
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Boolean toBool(Object value) + { + return toBool(value, null); + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * + * @param clazz Enum的Class + * @param value 值 + * @param defaultValue 默认值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value, E defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (clazz.isAssignableFrom(value.getClass())) + { + @SuppressWarnings("unchecked") + E myE = (E) value; + return myE; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Enum.valueOf(clazz, valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * + * @param clazz Enum的Class + * @param value 值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value) + { + return toEnum(clazz, value, null); + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value, BigInteger defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigInteger) + { + return (BigInteger) value; + } + if (value instanceof Long) + { + return BigInteger.valueOf((Long) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigInteger(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value) + { + return toBigInteger(value, null); + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigDecimal) + { + return (BigDecimal) value; + } + if (value instanceof Long) + { + return new BigDecimal((Long) value); + } + if (value instanceof Double) + { + return new BigDecimal((Double) value); + } + if (value instanceof Integer) + { + return new BigDecimal((Integer) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigDecimal(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value) + { + return toBigDecimal(value, null); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @return 字符串 + */ + public static String utf8Str(Object obj) + { + return str(obj, CharsetKit.CHARSET_UTF_8); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charsetName 字符集 + * @return 字符串 + */ + public static String str(Object obj, String charsetName) + { + return str(obj, Charset.forName(charsetName)); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(Object obj, Charset charset) + { + if (null == obj) + { + return null; + } + + if (obj instanceof String) + { + return (String) obj; + } + else if (obj instanceof byte[]) + { + return str((byte[]) obj, charset); + } + else if (obj instanceof Byte[]) + { + byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj); + return str(bytes, charset); + } + else if (obj instanceof ByteBuffer) + { + return str((ByteBuffer) obj, charset); + } + return obj.toString(); + } + + /** + * 将byte数组转为字符串 + * + * @param bytes byte数组 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(byte[] bytes, String charset) + { + return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); + } + + /** + * 解码字节码 + * + * @param data 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 解码后的字符串 + */ + public static String str(byte[] data, Charset charset) + { + if (data == null) + { + return null; + } + + if (null == charset) + { + return new String(data); + } + return new String(data, charset); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, String charset) + { + if (data == null) + { + return null; + } + + return str(data, Charset.forName(charset)); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, Charset charset) + { + if (null == charset) + { + charset = Charset.defaultCharset(); + } + return charset.decode(data).toString(); + } + + // ----------------------------------------------------------------------- 全角半角转换 + /** + * 半角转全角 + * + * @param input String. + * @return 全角字符串. + */ + public static String toSBC(String input) + { + return toSBC(input, null); + } + + /** + * 半角转全角 + * + * @param input String + * @param notConvertSet 不替换的字符集合 + * @return 全角字符串. + */ + public static String toSBC(String input, Set notConvertSet) + { + char[] c = input.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == ' ') + { + c[i] = '\u3000'; + } + else if (c[i] < '\177') + { + c[i] = (char) (c[i] + 65248); + + } + } + return new String(c); + } + + /** + * 全角转半角 + * + * @param input String. + * @return 半角字符串 + */ + public static String toDBC(String input) + { + return toDBC(input, null); + } + + /** + * 替换全角为半角 + * + * @param text 文本 + * @param notConvertSet 不替换的字符集合 + * @return 替换后的字符 + */ + public static String toDBC(String text, Set notConvertSet) + { + char[] c = text.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == '\u3000') + { + c[i] = ' '; + } + else if (c[i] > '\uFF00' && c[i] < '\uFF5F') + { + c[i] = (char) (c[i] - 65248); + } + } + String returnString = new String(c); + + return returnString; + } + + /** + * 数字金额大写转换 先写个完整的然后将如零拾替换成零 + * + * @param n 数字 + * @return 中文大写数字 + */ + public static String digitUppercase(double n) + { + String[] fraction = { "角", "分" }; + String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; + String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; + + String head = n < 0 ? "负" : ""; + n = Math.abs(n); + + String s = ""; + for (int i = 0; i < fraction.length; i++) + { + s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); + } + if (s.length() < 1) + { + s = "整"; + } + int integerPart = (int) Math.floor(n); + + for (int i = 0; i < unit[0].length && integerPart > 0; i++) + { + String p = ""; + for (int j = 0; j < unit[1].length && n > 0; j++) + { + p = digit[integerPart % 10] + unit[1][j] + p; + integerPart = integerPart / 10; + } + s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; + } + return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java new file mode 100644 index 0000000000000000000000000000000000000000..c78ac776db9944295f3634be2e1122472bfc346e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java @@ -0,0 +1,92 @@ +package com.ruoyi.common.core.text; + +import com.ruoyi.common.utils.StringUtils; + +/** + * 字符串格式化 + * + * @author ruoyi + */ +public class StrFormatter +{ + public static final String EMPTY_JSON = "{}"; + public static final char C_BACKSLASH = '\\'; + public static final char C_DELIM_START = '{'; + public static final char C_DELIM_END = '}'; + + /** + * 格式化字符串
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param strPattern 字符串模板 + * @param argArray 参数列表 + * @return 结果 + */ + public static String format(final String strPattern, final Object... argArray) + { + if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) + { + return strPattern; + } + final int strPatternLength = strPattern.length(); + + // 初始化定义好的长度以获得更好的性能 + StringBuilder sbuf = new StringBuilder(strPatternLength + 50); + + int handledPosition = 0; + int delimIndex;// 占位符所在位置 + for (int argIndex = 0; argIndex < argArray.length; argIndex++) + { + delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); + if (delimIndex == -1) + { + if (handledPosition == 0) + { + return strPattern; + } + else + { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果 + sbuf.append(strPattern, handledPosition, strPatternLength); + return sbuf.toString(); + } + } + else + { + if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) + { + if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) + { + // 转义符之前还有一个转义符,占位符依旧有效 + sbuf.append(strPattern, handledPosition, delimIndex - 1); + sbuf.append(Convert.utf8Str(argArray[argIndex])); + handledPosition = delimIndex + 2; + } + else + { + // 占位符被转义 + argIndex--; + sbuf.append(strPattern, handledPosition, delimIndex - 1); + sbuf.append(C_DELIM_START); + handledPosition = delimIndex + 1; + } + } + else + { + // 正常占位符 + sbuf.append(strPattern, handledPosition, delimIndex); + sbuf.append(Convert.utf8Str(argArray[argIndex])); + handledPosition = delimIndex + 2; + } + } + } + // 加入最后一个占位符后所有的字符 + sbuf.append(strPattern, handledPosition, strPattern.length()); + + return sbuf.toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java new file mode 100644 index 0000000000000000000000000000000000000000..10b7306fe9ba89d6ed4ed19c9647ddc421bfeb28 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java @@ -0,0 +1,20 @@ +package com.ruoyi.common.enums; + +/** + * 操作状态 + * + * @author ruoyi + * + */ +public enum BusinessStatus +{ + /** + * 成功 + */ + SUCCESS, + + /** + * 失败 + */ + FAIL, +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java new file mode 100644 index 0000000000000000000000000000000000000000..2e17c4a5d210eb930468412673a9b408ed61a787 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java @@ -0,0 +1,59 @@ +package com.ruoyi.common.enums; + +/** + * 业务操作类型 + * + * @author ruoyi + */ +public enum BusinessType +{ + /** + * 其它 + */ + OTHER, + + /** + * 新增 + */ + INSERT, + + /** + * 修改 + */ + UPDATE, + + /** + * 删除 + */ + DELETE, + + /** + * 授权 + */ + GRANT, + + /** + * 导出 + */ + EXPORT, + + /** + * 导入 + */ + IMPORT, + + /** + * 强退 + */ + FORCE, + + /** + * 生成代码 + */ + GENCODE, + + /** + * 清空数据 + */ + CLEAN, +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java new file mode 100644 index 0000000000000000000000000000000000000000..0d945be54936e8449d7b46f205bfa2269e15a33f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java @@ -0,0 +1,19 @@ +package com.ruoyi.common.enums; + +/** + * 数据源 + * + * @author ruoyi + */ +public enum DataSourceType +{ + /** + * 主库 + */ + MASTER, + + /** + * 从库 + */ + SLAVE +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/FlowDealStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/FlowDealStatus.java new file mode 100644 index 0000000000000000000000000000000000000000..1530d74217b6b902ef4885af5c634ce7106fd44c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/FlowDealStatus.java @@ -0,0 +1,59 @@ +package com.ruoyi.common.enums; + +public enum FlowDealStatus { + + BUSINESS_STATUS_0("0", "待处理") ,BUSINESS_STATUS_1("1", "正在处理") ,BUSINESS_STATUS_2("2", "挂起") , + BUSINESS_STATUS_3("3","驳回"),BUSINESS_STATUS_4("4","已结束") ,BUSINESS_STATUS_5("5","撤销"); + + /** code */ + private String code; + + /** 显示标签 */ + private String label; + + FlowDealStatus(String code, String label){ + + this.code = code; + + this.label = label; + } + + public static String getLabelByCode (String code) { + + for (FlowDealStatus enuma : FlowDealStatus.values()) { + + if (enuma.getCode().equals(code)) { + + return enuma.getLabel(); + + } + + } + + return ""; + + } + + + @Override + public String toString(){ + + return label; + + } + + public String getLabel() { + + return label; + + } + + + public String getCode(){ + + return this.code; + + } + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java new file mode 100644 index 0000000000000000000000000000000000000000..be6f73929f796eba7331b285bee6406fe4b50ed5 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java @@ -0,0 +1,36 @@ +package com.ruoyi.common.enums; + +import java.util.HashMap; +import java.util.Map; +import org.springframework.lang.Nullable; + +/** + * 请求方式 + * + * @author ruoyi + */ +public enum HttpMethod +{ + GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; + + private static final Map mappings = new HashMap<>(16); + + static + { + for (HttpMethod httpMethod : values()) + { + mappings.put(httpMethod.name(), httpMethod); + } + } + + @Nullable + public static HttpMethod resolve(@Nullable String method) + { + return (method != null ? mappings.get(method) : null); + } + + public boolean matches(String method) + { + return (this == resolve(method)); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java new file mode 100644 index 0000000000000000000000000000000000000000..c609fd8ace91a817d9736605a186f2ecc3ade92c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java @@ -0,0 +1,20 @@ +package com.ruoyi.common.enums; + +/** + * 限流类型 + * + * @author ruoyi + */ + +public enum LimitType +{ + /** + * 默认策略全局限流 + */ + DEFAULT, + + /** + * 根据请求者IP进行限流 + */ + IP +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/NoticeType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/NoticeType.java new file mode 100644 index 0000000000000000000000000000000000000000..6d1a8e5c478e3f8992f607c91b15febb99979b18 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/NoticeType.java @@ -0,0 +1,47 @@ +package com.ruoyi.common.enums; + +import lombok.Data; + +/** + * 操作状态 + * + * @author ruoyi + * + */ +public enum NoticeType +{ + /** + * 短信 + */ + message("message","短信"), + + /** + * 微信 + */ + webchat("webchat","微信"), + + /** + * 邮件 + */ + mail("mail","邮件"); + + private final String code; + private final String info; + + NoticeType(String code, String info) + { + this.code = code; + this.info = info; + } + + public String getCode() + { + return code; + } + + public String getInfo() + { + return info; + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java new file mode 100644 index 0000000000000000000000000000000000000000..bdd143c1cbd91b36741cf940b3887c33dadcf9f4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/OperatorType.java @@ -0,0 +1,24 @@ +package com.ruoyi.common.enums; + +/** + * 操作人类别 + * + * @author ruoyi + */ +public enum OperatorType +{ + /** + * 其它 + */ + OTHER, + + /** + * 后台用户 + */ + MANAGE, + + /** + * 手机端用户 + */ + MOBILE +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java new file mode 100644 index 0000000000000000000000000000000000000000..306514b35bb94b390e5e8f28db2b3ecf46e3b3b0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/UserStatus.java @@ -0,0 +1,30 @@ +package com.ruoyi.common.enums; + +/** + * 用户状态 + * + * @author ruoyi + */ +public enum UserStatus +{ + OK("0", "正常"), DISABLE("1", "停用"), SLEEP("2", "冻结"), DELETED("2", "删除"); + + private final String code; + private final String info; + + UserStatus(String code, String info) + { + this.code = code; + this.info = info; + } + + public String getCode() + { + return code; + } + + public String getInfo() + { + return info; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java new file mode 100644 index 0000000000000000000000000000000000000000..f6ad2ab49745be8a51eaa5ce72718ae2c373a8cb --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/DemoModeException.java @@ -0,0 +1,15 @@ +package com.ruoyi.common.exception; + +/** + * 演示模式异常 + * + * @author ruoyi + */ +public class DemoModeException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + public DemoModeException() + { + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java new file mode 100644 index 0000000000000000000000000000000000000000..81a71b5d339ad6c588caac0b95c193116ba1f7c2 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/GlobalException.java @@ -0,0 +1,58 @@ +package com.ruoyi.common.exception; + +/** + * 全局异常 + * + * @author ruoyi + */ +public class GlobalException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 错误提示 + */ + private String message; + + /** + * 错误明细,内部调试错误 + * + * 和 {@link CommonResult#getDetailMessage()} 一致的设计 + */ + private String detailMessage; + + /** + * 空构造方法,避免反序列化问题 + */ + public GlobalException() + { + } + + public GlobalException(String message) + { + this.message = message; + } + + public String getDetailMessage() + { + return detailMessage; + } + + public GlobalException setDetailMessage(String detailMessage) + { + this.detailMessage = detailMessage; + return this; + } + + @Override + public String getMessage() + { + return message; + } + + public GlobalException setMessage(String message) + { + this.message = message; + return this; + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java new file mode 100644 index 0000000000000000000000000000000000000000..8479cee2a3899c9cc6bc1a79f44277b165a9c576 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java @@ -0,0 +1,80 @@ +package com.ruoyi.common.exception; + +/** + * 业务异常 + * + * @author ruoyi + */ +public final class ServiceException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 错误码 + */ + private Integer code; + + /** + * 错误提示 + */ + private String message; + + /** + * 错误明细,内部调试错误 + * + * 和 {@link CommonResult#getDetailMessage()} 一致的设计 + */ + private String detailMessage; + + /** + * 空构造方法,避免反序列化问题 + */ + public ServiceException() + { + } + + public ServiceException(String message) + { + this.message = message; + } + + public ServiceException(String message, Integer code) + { + this.message = message; + this.code = code; + } + public ServiceException(String message, Throwable cause) { + super(message, cause); + } + public ServiceException(Throwable cause) { + super(cause); + } + + public String getDetailMessage() + { + return detailMessage; + } + + @Override + public String getMessage() + { + return message; + } + + public Integer getCode() + { + return code; + } + + public ServiceException setMessage(String message) + { + this.message = message; + return this; + } + + public ServiceException setDetailMessage(String detailMessage) + { + this.detailMessage = detailMessage; + return this; + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java new file mode 100644 index 0000000000000000000000000000000000000000..980fa465e866e4c0b67bdb77f065d31e1f246e8f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/UtilException.java @@ -0,0 +1,26 @@ +package com.ruoyi.common.exception; + +/** + * 工具类异常 + * + * @author ruoyi + */ +public class UtilException extends RuntimeException +{ + private static final long serialVersionUID = 8247610319171014183L; + + public UtilException(Throwable e) + { + super(e.getMessage(), e); + } + + public UtilException(String message) + { + super(message); + } + + public UtilException(String message, Throwable throwable) + { + super(message, throwable); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java new file mode 100644 index 0000000000000000000000000000000000000000..b55d72e185608246f9d9bd8766a314f04a864c78 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java @@ -0,0 +1,97 @@ +package com.ruoyi.common.exception.base; + +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.StringUtils; + +/** + * 基础异常 + * + * @author ruoyi + */ +public class BaseException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 所属模块 + */ + private String module; + + /** + * 错误码 + */ + private String code; + + /** + * 错误码对应的参数 + */ + private Object[] args; + + /** + * 错误消息 + */ + private String defaultMessage; + + public BaseException(String module, String code, Object[] args, String defaultMessage) + { + this.module = module; + this.code = code; + this.args = args; + this.defaultMessage = defaultMessage; + } + + public BaseException(String module, String code, Object[] args) + { + this(module, code, args, null); + } + + public BaseException(String module, String defaultMessage) + { + this(module, null, null, defaultMessage); + } + + public BaseException(String code, Object[] args) + { + this(null, code, args, null); + } + + public BaseException(String defaultMessage) + { + this(null, null, null, defaultMessage); + } + + @Override + public String getMessage() + { + String message = null; + if (!StringUtils.isEmpty(code)) + { + message = MessageUtils.message(code, args); + } + if (message == null) + { + message = defaultMessage; + } + return message; + } + + public String getModule() + { + return module; + } + + public String getCode() + { + return code; + } + + public Object[] getArgs() + { + return args; + } + + public String getDefaultMessage() + { + return defaultMessage; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java new file mode 100644 index 0000000000000000000000000000000000000000..871f09b528b423650aa807a8e8e0ae9656933d44 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java @@ -0,0 +1,19 @@ +package com.ruoyi.common.exception.file; + +import com.ruoyi.common.exception.base.BaseException; + +/** + * 文件信息异常类 + * + * @author ruoyi + */ +public class FileException extends BaseException +{ + private static final long serialVersionUID = 1L; + + public FileException(String code, Object[] args) + { + super("file", code, args, null); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java new file mode 100644 index 0000000000000000000000000000000000000000..70e0ec9b1dfd5a521aa8cb77d64c99ecef12a3e7 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.file; + +/** + * 文件名称超长限制异常类 + * + * @author ruoyi + */ +public class FileNameLengthLimitExceededException extends FileException +{ + private static final long serialVersionUID = 1L; + + public FileNameLengthLimitExceededException(int defaultFileNameLength) + { + super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java new file mode 100644 index 0000000000000000000000000000000000000000..ec6ab054d656146c1498fac8d91123958794c326 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.file; + +/** + * 文件名大小限制异常类 + * + * @author ruoyi + */ +public class FileSizeLimitExceededException extends FileException +{ + private static final long serialVersionUID = 1L; + + public FileSizeLimitExceededException(long defaultMaxSize) + { + super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java new file mode 100644 index 0000000000000000000000000000000000000000..8b2af16cc7b9d591bcb276ad2f340ec076cb5f87 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java @@ -0,0 +1,81 @@ +package com.ruoyi.common.exception.file; + +import java.util.Arrays; +import org.apache.commons.fileupload.FileUploadException; + +/** + * 文件上传 误异常类 + * + * @author ruoyi + */ +public class InvalidExtensionException extends FileUploadException +{ + private static final long serialVersionUID = 1L; + + private String[] allowedExtension; + private String extension; + private String filename; + + public InvalidExtensionException(String[] allowedExtension, String extension, String filename) + { + super("文件[" + filename + "]后缀[" + extension + "]不正确,请上传" + Arrays.toString(allowedExtension) + "格式"); + this.allowedExtension = allowedExtension; + this.extension = extension; + this.filename = filename; + } + + public String[] getAllowedExtension() + { + return allowedExtension; + } + + public String getExtension() + { + return extension; + } + + public String getFilename() + { + return filename; + } + + public static class InvalidImageExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } + + public static class InvalidFlashExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } + + public static class InvalidMediaExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } + + public static class InvalidVideoExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java new file mode 100644 index 0000000000000000000000000000000000000000..a567b408b29c690fab6ca7987326d5d2a34b68f8 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/job/TaskException.java @@ -0,0 +1,34 @@ +package com.ruoyi.common.exception.job; + +/** + * 计划策略异常 + * + * @author ruoyi + */ +public class TaskException extends Exception +{ + private static final long serialVersionUID = 1L; + + private Code code; + + public TaskException(String msg, Code code) + { + this(msg, code, null); + } + + public TaskException(String msg, Code code, Exception nestedEx) + { + super(msg, nestedEx); + this.code = code; + } + + public Code getCode() + { + return code; + } + + public enum Code + { + TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java new file mode 100644 index 0000000000000000000000000000000000000000..389dbc7535ee6640aca99296266ac50d0c56ddfb --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.user; + +/** + * 验证码错误异常类 + * + * @author ruoyi + */ +public class CaptchaException extends UserException +{ + private static final long serialVersionUID = 1L; + + public CaptchaException() + { + super("user.jcaptcha.error", null); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java new file mode 100644 index 0000000000000000000000000000000000000000..85f94861bcbbb43a774374cb9f1212fb79fd9203 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.user; + +/** + * 验证码失效异常类 + * + * @author ruoyi + */ +public class CaptchaExpireException extends UserException +{ + private static final long serialVersionUID = 1L; + + public CaptchaExpireException() + { + super("user.jcaptcha.expire", null); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java new file mode 100644 index 0000000000000000000000000000000000000000..c292d70ed70dbb8df65a7ef8240df6cd3f1766b3 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java @@ -0,0 +1,18 @@ +package com.ruoyi.common.exception.user; + +import com.ruoyi.common.exception.base.BaseException; + +/** + * 用户信息异常类 + * + * @author ruoyi + */ +public class UserException extends BaseException +{ + private static final long serialVersionUID = 1L; + + public UserException(String code, Object[] args) + { + super("user", code, args, null); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java new file mode 100644 index 0000000000000000000000000000000000000000..a7f3e5ffed23e5e502f37f7a49cc616c33a593fd --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.user; + +/** + * 用户密码不正确或不符合规范异常类 + * + * @author ruoyi + */ +public class UserPasswordNotMatchException extends UserException +{ + private static final long serialVersionUID = 1L; + + public UserPasswordNotMatchException() + { + super("user.password.not.match", null); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java new file mode 100644 index 0000000000000000000000000000000000000000..c887cf1171d3e0b7eb6a729a962ecb3a4658affe --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.user; + +/** + * 用户错误最大次数异常类 + * + * @author ruoyi + */ +public class UserPasswordRetryLimitExceedException extends UserException +{ + private static final long serialVersionUID = 1L; + + public UserPasswordRetryLimitExceedException(int retryLimitCount, int lockTime) + { + super("user.password.retry.limit.exceed", new Object[] { retryLimitCount, lockTime }); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserSmsNotMatchException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserSmsNotMatchException.java new file mode 100644 index 0000000000000000000000000000000000000000..8c80afeb73e94b8d85b3cc4b5516c019b2a26698 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserSmsNotMatchException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.user; + +/** + * 用户密码不正确或不符合规范异常类 + * + * @author ruoyi + */ +public class UserSmsNotMatchException extends UserException +{ + private static final long serialVersionUID = 1L; + + public UserSmsNotMatchException(Integer surplusCount) + { + super("user.sms.not.match", new Object[] { surplusCount }); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserSmsRetryLimitExceedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserSmsRetryLimitExceedException.java new file mode 100644 index 0000000000000000000000000000000000000000..bb72b33b7edf9acd6ac6ec735bdfccbe1d46a5a5 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserSmsRetryLimitExceedException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.user; + +/** + * 用户错误最大次数异常类 + * + * @author ruoyi + */ +public class UserSmsRetryLimitExceedException extends UserException +{ + private static final long serialVersionUID = 1L; + + public UserSmsRetryLimitExceedException(int retryLimitCount, int lockTime) + { + super("user.sms.retry.limit.exceed", new Object[] { retryLimitCount, lockTime }); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/PropertyPreExcludeFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/PropertyPreExcludeFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..e1e431b190b483d30b023f3b732bb421cccb691e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/PropertyPreExcludeFilter.java @@ -0,0 +1,24 @@ +package com.ruoyi.common.filter; + +import com.alibaba.fastjson2.filter.SimplePropertyPreFilter; + +/** + * 排除JSON敏感属性 + * + * @author ruoyi + */ +public class PropertyPreExcludeFilter extends SimplePropertyPreFilter +{ + public PropertyPreExcludeFilter() + { + } + + public PropertyPreExcludeFilter addExcludes(String... filters) + { + for (int i = 0; i < filters.length; i++) + { + this.getExcludes().add(filters[i]); + } + return this; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..a1bcfe2a479a772254b00aa91c811ab242bf52af --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java @@ -0,0 +1,52 @@ +package com.ruoyi.common.filter; + +import java.io.IOException; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import org.springframework.http.MediaType; +import com.ruoyi.common.utils.StringUtils; + +/** + * Repeatable 过滤器 + * + * @author ruoyi + */ +public class RepeatableFilter implements Filter +{ + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + ServletRequest requestWrapper = null; + if (request instanceof HttpServletRequest + && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) + { + requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); + } + if (null == requestWrapper) + { + chain.doFilter(request, response); + } + else + { + chain.doFilter(requestWrapper, response); + } + } + + @Override + public void destroy() + { + + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java new file mode 100644 index 0000000000000000000000000000000000000000..407d1ba420cb8672f35f2efb2872774d333a4012 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java @@ -0,0 +1,76 @@ +package com.ruoyi.common.filter; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import com.ruoyi.common.utils.http.HttpHelper; +import com.ruoyi.common.constant.Constants; + +/** + * 构建可重复读取inputStream的request + * + * @author ruoyi + */ +public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper +{ + private final byte[] body; + + public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException + { + super(request); + request.setCharacterEncoding(Constants.UTF8); + response.setCharacterEncoding(Constants.UTF8); + + body = HttpHelper.getBodyString(request).getBytes(Constants.UTF8); + } + + @Override + public BufferedReader getReader() throws IOException + { + return new BufferedReader(new InputStreamReader(getInputStream())); + } + + @Override + public ServletInputStream getInputStream() throws IOException + { + final ByteArrayInputStream bais = new ByteArrayInputStream(body); + return new ServletInputStream() + { + @Override + public int read() throws IOException + { + return bais.read(); + } + + @Override + public int available() throws IOException + { + return body.length; + } + + @Override + public boolean isFinished() + { + return false; + } + + @Override + public boolean isReady() + { + return false; + } + + @Override + public void setReadListener(ReadListener readListener) + { + + } + }; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..9052f0da3984b28270eb1832707f0ae76ab423ed --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java @@ -0,0 +1,75 @@ +package com.ruoyi.common.filter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.enums.HttpMethod; + +/** + * 防止XSS攻击的过滤器 + * + * @author ruoyi + */ +public class XssFilter implements Filter +{ + /** + * 排除链接 + */ + public List excludes = new ArrayList<>(); + + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + String tempExcludes = filterConfig.getInitParameter("excludes"); + if (StringUtils.isNotEmpty(tempExcludes)) + { + String[] url = tempExcludes.split(","); + for (int i = 0; url != null && i < url.length; i++) + { + excludes.add(url[i]); + } + } + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse resp = (HttpServletResponse) response; + if (handleExcludeURL(req, resp)) + { + chain.doFilter(request, response); + return; + } + XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request); + chain.doFilter(xssRequest, response); + } + + private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) + { + String url = request.getServletPath(); + String method = request.getMethod(); + // GET DELETE 不过滤 + if (method == null || HttpMethod.GET.matches(method) || HttpMethod.DELETE.matches(method)) + { + return true; + } + return StringUtils.matches(url, excludes); + } + + @Override + public void destroy() + { + + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java new file mode 100644 index 0000000000000000000000000000000000000000..b1eeb65c7a24a94bda94b0342a542e8482369c14 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java @@ -0,0 +1,111 @@ +package com.ruoyi.common.filter; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import org.apache.commons.io.IOUtils; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.html.EscapeUtil; + +/** + * XSS过滤处理 + * + * @author ruoyi + */ +public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper +{ + /** + * @param request + */ + public XssHttpServletRequestWrapper(HttpServletRequest request) + { + super(request); + } + + @Override + public String[] getParameterValues(String name) + { + String[] values = super.getParameterValues(name); + if (values != null) + { + int length = values.length; + String[] escapseValues = new String[length]; + for (int i = 0; i < length; i++) + { + // 防xss攻击和过滤前后空格 + escapseValues[i] = EscapeUtil.clean(values[i]).trim(); + } + return escapseValues; + } + return super.getParameterValues(name); + } + + @Override + public ServletInputStream getInputStream() throws IOException + { + // 非json类型,直接返回 + if (!isJsonRequest()) + { + return super.getInputStream(); + } + + // 为空,直接返回 + String json = IOUtils.toString(super.getInputStream(), "utf-8"); + if (StringUtils.isEmpty(json)) + { + return super.getInputStream(); + } + + // xss过滤 + json = EscapeUtil.clean(json).trim(); + byte[] jsonBytes = json.getBytes("utf-8"); + final ByteArrayInputStream bis = new ByteArrayInputStream(jsonBytes); + return new ServletInputStream() + { + @Override + public boolean isFinished() + { + return true; + } + + @Override + public boolean isReady() + { + return true; + } + + @Override + public int available() throws IOException + { + return jsonBytes.length; + } + + @Override + public void setReadListener(ReadListener readListener) + { + } + + @Override + public int read() throws IOException + { + return bis.read(); + } + }; + } + + /** + * 是否是Json请求 + * + * @param request + */ + public boolean isJsonRequest() + { + String header = super.getHeader(HttpHeaders.CONTENT_TYPE); + return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE); + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/importer/ImporterBase.java b/ruoyi-common/src/main/java/com/ruoyi/common/importer/ImporterBase.java new file mode 100644 index 0000000000000000000000000000000000000000..c03f28562462d76e957305d4376f1687f1c3cc0b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/importer/ImporterBase.java @@ -0,0 +1,527 @@ +package com.ruoyi.common.importer; + +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.importer.beans.CellFormatBean; +import com.ruoyi.common.importer.beans.ResultBean; +import com.ruoyi.common.importer.beans.enums.ImportResultType; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 导入模块基类 + * + * @author lqz + */ +@Slf4j +public abstract class ImporterBase { + + @Setter + @Getter + protected Class className; + + protected List cellFormatBeans = new ArrayList<>(); + + String no = "false"; + + String yes = "true"; + + protected Long sceneBigId; + protected String importType; + protected Object[] args; + + /** + * 值唯一的列名,并且至少有一个不能为空 + */ + private List uniqueColumnNameList; + /** + * 值唯一的列的数据,外列里行 + */ + private List> uniqueColumnValues; + private String uniqueColumnNames; + /** + * 导入结果排除特定列 + */ + @Setter + private String[] hiddenResultColumns; + /** + * 临时保存组合唯一字段的值 + */ + private List tempUniqueColumnValue = new ArrayList<>(); + + /** + * 获取泛型对应的Class对象 + * + * @param clazz importer + * @param i 参数索引 + * @return CLass对象 + */ + public Class getActualTypeArgument(Class clazz, int i) { + Class entitiClass = null; + Type genericSuperclass = clazz.getGenericSuperclass(); + if (genericSuperclass instanceof ParameterizedType) { + Type[] actualTypeArguments = ((ParameterizedType) genericSuperclass) + .getActualTypeArguments(); + if (actualTypeArguments != null && actualTypeArguments.length > 0) { + entitiClass = (Class) actualTypeArguments[i]; + } + } + return entitiClass; + } + + /** + * 获取isUnique为"true”的字段 + * + * @param ruleList 核查规则 + * @return Unique + */ + private List getUniqueColumnNameList(List ruleList) { + List uniqueColumnNameList = new ArrayList<>(); + + for (CellFormatBean bean : ruleList) { + if (yes.equalsIgnoreCase(bean.getIsUnique())) { + uniqueColumnNameList.add(bean.getColumnCn()); + } + } + return uniqueColumnNameList; + } + + /** + * 初始化唯一列的列名 + * + * @param ruleList 核查规则 + */ + private void disposeUniqueColumns(List ruleList) { + // 值唯一的列名 + uniqueColumnNameList = this.getUniqueColumnNameList(ruleList); + + // 值唯一的列的数据 + uniqueColumnValues = new ArrayList<>(); + uniqueColumnNames = ""; + for (String s : uniqueColumnNameList) { + uniqueColumnValues.add(new ArrayList<>()); + uniqueColumnNames = uniqueColumnNames + s + ","; + } + if (uniqueColumnNames.length() > 0) { + uniqueColumnNames = uniqueColumnNames.substring(0, uniqueColumnNames.length() - 1); + } + } + + /** + * 导入 + * + * @param datas 数据 + * @param args 可选参数 + * @return 导入结果 + * @throws Exception 异常 + */ + public AjaxResult doAdd(List datas, Object... args) throws Exception { + return doAdd(datas, null, "", args); + } + + /** + * 核查规则放到importer里面 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 参数 + * @return 导入结果 + * @throws Exception 异常 + */ + public AjaxResult doAdd(List datas, Long sceneBigId, String importType, Object... args) throws Exception { + return doAdd(datas, cellFormatBeans, sceneBigId, importType, args); + } + + /** + * 导入 + * + * @param datas 数据 + * @param formats 核查规则 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @return 导入结果 + */ + public AjaxResult doAdd(List datas, List formats, Long sceneBigId, String importType, Object... args) throws Exception { + // 核查数据是否为空 + if (StringUtils.isNull(datas) || datas.size() == 0) { + return AjaxResult.error(ImportResultType.DATA_EMPTY.getValue()); + } + if (!validTemplate(datas)) { + return AjaxResult.error(ImportResultType.TEMPLATE_ERR.getValue()); + } + + // 参数赋值 + this.sceneBigId = sceneBigId; + this.importType = importType; + this.args = args; + + // 初始化唯一列的列名 + this.disposeUniqueColumns(formats); + boolean f = true; + for (int i = 0; i < datas.size(); i++) { + StringBuilder reasonB = new StringBuilder(); + for (int j = 0; j < formats.size(); j++) { + try { + Class aClass = datas.get(i).getClass(); + Field field = aClass.getDeclaredField(formats.get(j).getColumnEn()); + field.setAccessible(true); + String s = (String) field.get(datas.get(i)); + if (isNotEmpty(s)) { + s = preHandleCellValue(s, formats.get(j)); + } + StringBuilder reasonS = new StringBuilder(); + StringBuilder reasonL = new StringBuilder(); + StringBuilder reasonSh = new StringBuilder(); + if (basicCheck(s, formats.get(j), reasonS)) { + specialCheck(s, formats.get(j), reasonS, sceneBigId, importType, args, i, j); + checkRegionCountyComboLink(s, formats.get(j), reasonS); + } + checkUniqueColumns(s, formats.get(j), reasonS); + if (j == formats.size() - 1) { + checkAtRowEnd(s, formats.get(j), reasonL, sceneBigId, importType, args, i); + if (i == datas.size() - 1) { + checkAtLastEnd(s, formats.get(j), reasonSh, sceneBigId, importType, args); + } + } + if (isNotEmpty(reasonS.toString())) { + reasonB.append("【").append(formats.get(j).getColumnCn()).append("】").append(reasonS); + } + if (isNotEmpty(reasonL.toString())) { + reasonB.append(reasonL); + } + if (isNotEmpty(reasonSh.toString())) { + reasonB.append(reasonSh); + } + field.set(datas.get(i), s); + } catch (Exception e) { + e.printStackTrace(); + reasonB.append("【").append(formats.get(j).getColumnCn()).append("】").append("未知错误,请仔细阅读填写规范确保填写正确。"); + } + } + datas.get(i).setReason(reasonB.toString()); + if (isNotEmpty(datas.get(i).getReason())) { + f = false; + } + } + if (!f) { + className = getActualTypeArgument(this.getClass(), 0); + ExcelUtil util = new ExcelUtil<>(className); + util.hideColumn(hiddenResultColumns); + String name = (String) util.exportExcel(datas, "导入结果").get(AjaxResult.MSG_TAG); + return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", name); + } + + try { + insertDataToDB(datas, sceneBigId, importType, args); + } catch (Exception e) { + e.printStackTrace(); + throw new ServiceException("数据库异常。"); + } + + return AjaxResult.success(); + } + + /** + * 数据预处理 + * + * @param s cell + * @param cellFormatBean 校验规则 + */ + protected String preHandleCellValue(String s, CellFormatBean cellFormatBean) { + return s.trim(); + } + + private String city; + private String county; + + /** + * 地市区县联动核查 + * + * @param s 值 + * @param cellFormatBean 规则 + * @param reasonS 结果 + */ + private void checkRegionCountyComboLink(String s, CellFormatBean cellFormatBean, StringBuilder reasonS) { + if ("city".equals(cellFormatBean.getColumnEn())) { + city = DictUtils.getDictValue("yw_city", s); + } + if ("county".equals(cellFormatBean.getColumnEn())) { + county = DictUtils.getDictValue("yw_county", s); + if (isNotEmpty(city) && isNotEmpty(county) && !county.substring(0, 4).equals(city)) { + reasonS.append("区县不在该地市下"); + } + } + } + + /** + * 表尾核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonSh 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + protected abstract void checkAtLastEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonSh, Long sceneBigId, String importType, Object[] args) throws Exception; + + /** + * 行末核查 + * + * @param s 数据 + * @param cellFormatBean 校验格式 + * @param reasonL 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @throws Exception 异常 + */ + protected abstract void checkAtRowEnd(String s, CellFormatBean cellFormatBean, StringBuilder reasonL, Long sceneBigId, String importType, Object[] args, int i) throws Exception; + + /** + * 核查字段唯一性 + * + * @param s 字段 + * @param format 核查规则 + * @param reasonS 核查结果 + */ + private void checkUniqueColumns(String s, CellFormatBean format, StringBuilder reasonS) { + if (uniqueColumnNameList.size() == 1) { + if (format.getColumnCn().equals(uniqueColumnNameList.get(0))) { + if (!"".equals(s)) { + if (uniqueColumnValues.get(0).contains(s)) { + reasonS.append("不唯一,存在重复值。"); + } else { + uniqueColumnValues.get(0).add(s); + } + } else { + reasonS.append(uniqueColumnNameList).append("不能为空。"); + } + } + } else if (uniqueColumnNameList.size() > 1) { + if (uniqueColumnNameList.contains(format.getColumnCn())) { + + int index = uniqueColumnNameList.indexOf(format.getColumnCn()); + tempUniqueColumnValue.add(s); + + if (index == uniqueColumnNameList.size() - 1) { + + boolean flagAllSame = false; + boolean flagAllSameIn; + for (int i = 0; i < uniqueColumnValues.get(0).size(); i++) { + flagAllSameIn = true; + for (int m = 0; m < tempUniqueColumnValue.size(); m++) { + if (!uniqueColumnValues.get(m).get(i).equals(tempUniqueColumnValue.get(m))) { + flagAllSameIn = false; + break; + } + } + if (flagAllSameIn) { + flagAllSame = true; + break; + } + } + + boolean flagAllNull = true; + for (String value : tempUniqueColumnValue) { + if (!"".equals(value)) { + flagAllNull = false; + break; + } + } + + if (flagAllSame) { + reasonS.append(uniqueColumnNames).append("组合后的值不唯一,存在重复值。"); + tempUniqueColumnValue.clear(); + } else { + for (int k = 0; k < tempUniqueColumnValue.size(); k++) { + uniqueColumnValues.get(k).add(tempUniqueColumnValue.get(k)); + } + tempUniqueColumnValue.clear(); + } + + if (flagAllNull) { + reasonS.append(uniqueColumnNameList.toString()).append("至少有一个值不能为空。"); + } + + tempUniqueColumnValue = new ArrayList<>(); + } + } + } + } + + /** + * 子类核查 + * + * @param s 数据 + * @param format 校验格式 + * @param reasonS 失败原因 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @param i 行 + * @param j 列 + * @throws Exception 异常 + */ + protected abstract void specialCheck(String s, CellFormatBean format, StringBuilder reasonS, Long sceneBigId, String importType, Object[] args, int i, int j) throws Exception; + + /** + * 通用核查 + * + * @param s 数据 + * @param format 核查规则 + * @param reasonS 失败原因 + * @return 核查结果 + */ + private boolean basicCheck(String s, CellFormatBean format, StringBuilder reasonS) { + + boolean flag = true; + + if (no.equalsIgnoreCase(format.getIsNull())) { + if (isEmpty(s)) { + flag = false; + reasonS.append("值不能为空。"); + } + } + if (isNotEmpty(s)) { + if (yes.equalsIgnoreCase(format.getIsDate())) { + if (!StringUtils.isDate(s, format.getDateFormat())) { + flag = false; + reasonS.append("日期格式不正确,必须符合").append(format.getDateFormat()).append("。"); + } + } + if (yes.equalsIgnoreCase(format.getIsNum())) { + if (!StringUtils.isNum(s)) { + flag = false; + reasonS.append("必须是数字。"); + } + if ("nonNegative".equalsIgnoreCase(format.getNumType())) { + if (!StringUtils.isUnNegativeInt(s)) { + flag = false; + reasonS.append("必须是非负整数。"); + } + } else if ("integer".equalsIgnoreCase(format.getNumType())) { + if (!StringUtils.isInt(s)) { + flag = false; + reasonS.append("必须是整数。"); + } + } else if ("positiveInt".equalsIgnoreCase(format.getNumType())) { + if (!StringUtils.isPositiveInt(s)) { + flag = false; + reasonS.append("必须是正整数。"); + } + } else if ("phone".equalsIgnoreCase(format.getNumType())) { + if (!StringUtils.isPhone(s)) { + flag = false; + reasonS.append("必须是合法的手机号码格式。"); + } + } + } + if (isNotEmpty(format.getDictType())) { + String id = getDictValue(format.getDictType(), s); + if (isEmpty(id)) { + flag = false; + reasonS.append("枚举值不正确。"); + } + } + if (isNotEmpty(format.getOptVal())) { + String[] val = format.getOptVal().split(","); + if (!Arrays.asList(val).contains(s)) { + flag = false; + reasonS.append("枚举值不正确。"); + } + } + } + + return flag; + } + + /** + * 数据更新 + * + * @param datas 数据 + * @param sceneBigId 大场景id + * @param importType 导入类型 + * @param args 可选参数 + * @throws Exception 异常 + */ + protected abstract void insertDataToDB(List datas, Long sceneBigId, String importType, Object[] args) throws Exception; + + /** + * 核查模板 + * + * @param datas 数据 + * @return 是否核查通过 + */ + private boolean validTemplate(List datas) { + for (T data : datas) { + if (StringUtils.isNull(data)) { + return false; + } + } + return true; + } + + protected boolean isEmpty(String s) { + return StringUtils.isEmpty(s); + } + + protected boolean isNotEmpty(String s) { + return StringUtils.isNotEmpty(s); + } + + protected String getDictValue(String dictType, String dictLabel) { + return getDictValue(dictType, dictLabel, DictUtils.SEPARATOR); + } + + /** + * 根据字典label获取字典值 + * + * @param dictType 字典类型 + * @param dictLabel label + * @param separator 分隔符 + * @return 字典值 + */ + protected String getDictValue(String dictType, String dictLabel, String separator) { + + StringBuilder propertyString = new StringBuilder(); + List datas = DictUtils.getDictCache(dictType); + + if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas)) { + for (SysDictData dict : datas) { + for (String label : dictLabel.split(separator)) { + if (label.equals(dict.getDictLabel())) { + propertyString.append(dict.getDictValue()).append(separator); + break; + } + } + } + } else { + for (SysDictData dict : datas) { + if (dictLabel.equals(dict.getDictLabel())) { + return dict.getDictValue(); + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/importer/beans/CellFormatBean.java b/ruoyi-common/src/main/java/com/ruoyi/common/importer/beans/CellFormatBean.java new file mode 100644 index 0000000000000000000000000000000000000000..96327a344ad903eac8df6f3429adc24526abb3d2 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/importer/beans/CellFormatBean.java @@ -0,0 +1,79 @@ +package com.ruoyi.common.importer.beans; + +import lombok.Data; + +/** + * 单元格校验实体 + * + * @author los + */ +@Data +public class CellFormatBean { + + /** + * 字段中文名 + */ + private String columnCn; + /** + * 字段英文名 + */ + private String columnEn; + /** + * 是否可以为空 + */ + private String isNull; + /** + * 是否为日期 + */ + private String isDate; + /** + * 是否是数字 + */ + private String isNum; + /** + * 数字类型 + */ + private String numType; + /** + * 日期格式 + */ + private String dateFormat; + /** + * 字典类型 + */ + private String dictType; + /** + * 枚举值 + */ + private String optVal; + /** + * 是否唯一 + */ + private String isUnique; + + public CellFormatBean(String columnCn, String columnEn, String isNull, String isDate, String isNum, String dateFormat, String dictType, String optVal, String isUnique) { + this.columnCn = columnCn; + this.columnEn = columnEn; + this.isNull = isNull; + this.isDate = isDate; + this.isNum = isNum; + this.dateFormat = dateFormat; + this.dictType = dictType; + this.optVal = optVal; + this.isUnique = isUnique; + } + + public CellFormatBean(String columnCn, String columnEn, String isNull, String isDate, String isNum, String numType, String dateFormat, String dictType, String optVal, String isUnique) { + this.columnCn = columnCn; + this.columnEn = columnEn; + this.isNull = isNull; + this.isDate = isDate; + this.isNum = isNum; + this.numType = numType; + this.dateFormat = dateFormat; + this.dictType = dictType; + this.optVal = optVal; + this.isUnique = isUnique; + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/importer/beans/ResultBean.java b/ruoyi-common/src/main/java/com/ruoyi/common/importer/beans/ResultBean.java new file mode 100644 index 0000000000000000000000000000000000000000..9158326aec84e5a1d037ce54b1c1f5a653b5e85d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/importer/beans/ResultBean.java @@ -0,0 +1,17 @@ +package com.ruoyi.common.importer.beans; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +/** + * 导入结果 + * + * @author los + */ +@Data +public class ResultBean { + @Excel(name = "失败原因", type = Excel.Type.EXPORT) + @TableField(exist = false) + private String reason; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/importer/beans/enums/ImportResultType.java b/ruoyi-common/src/main/java/com/ruoyi/common/importer/beans/enums/ImportResultType.java new file mode 100644 index 0000000000000000000000000000000000000000..fdde51702dfded85e8cee47da94ea67f1e8d2944 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/importer/beans/enums/ImportResultType.java @@ -0,0 +1,39 @@ +package com.ruoyi.common.importer.beans.enums; + +import lombok.Getter; +import lombok.ToString; + +/** + * 核查失败原因 + * + * @author los + */ +@Getter +@ToString +public enum ImportResultType { + + /** + * 模板不对 + */ + TEMPLATE_ERR(1, "导入失败,模板不正确。"), + /** + * 核查失败 + */ + CHECK_ERR(2, "导入失败,核查失败。"), + /** + * 数据为空 + */ + DATA_EMPTY(3, "导入失败,数据为空。"), + /** + * 导入成功 + */ + SUCCESS(4, "导入成功。"); + private Integer code; + private String value; + + ImportResultType(Integer code, String value) { + this.code = code; + this.value = value; + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/importer/service/YwBatchAddService.java b/ruoyi-common/src/main/java/com/ruoyi/common/importer/service/YwBatchAddService.java new file mode 100644 index 0000000000000000000000000000000000000000..1e1ab6eded592f32cc3ef557b88e986e19d1f7b9 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/importer/service/YwBatchAddService.java @@ -0,0 +1,47 @@ +package com.ruoyi.common.importer.service; + +import cn.hutool.core.collection.CollUtil; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 批量插入 + * + * @author los + */ +public interface YwBatchAddService { + + /** + * 批量导入,单次1000 + * + * @param all 记录 + */ + default void add(List all) { + add(all, 0L, 1000L); + } + + /** + * 批量导入 + * + * @param all 记录 + * @param strart 起始 + * @param limit 单次 + */ + default void add(List all, long strart, long limit) { + List collect = all.stream().skip(strart).limit(limit).collect(Collectors.toList()); + if (CollUtil.isEmpty(collect)) { + return; + } + insertB(collect); + this.add(all, strart + limit, limit); + } + + /** + * 实现类提供具体插入方法 + * + * @param collect 数据 + */ + void insertB(List collect); + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/mybatis/JsonListLongTypeHandler.java b/ruoyi-common/src/main/java/com/ruoyi/common/mybatis/JsonListLongTypeHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..144a1703c343fc20decb3d6afe9a3fd8ab6e321a --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/mybatis/JsonListLongTypeHandler.java @@ -0,0 +1,62 @@ +package com.ruoyi.common.mybatis; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +/* + + */ +public class JsonListLongTypeHandler extends BaseTypeHandler> { + private static final ObjectMapper mapper = new ObjectMapper(); + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, List parameter, JdbcType jdbcType) + throws SQLException { + ps.setString(i, toJson(parameter)); + } + + @Override + public List getNullableResult(ResultSet rs, String columnName) throws SQLException { + return this.toObject(rs.getString(columnName)); + } + + @Override + public List getNullableResult(ResultSet rs, int columnIndex) throws SQLException { + return this.toObject(rs.getString(columnIndex)); + } + + @Override + public List getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { + return this.toObject(cs.getString(columnIndex)); + } + + private String toJson(List params) { + try { + return mapper.writeValueAsString(params); + } catch (Exception e) { + e.printStackTrace(); + } + return "[]"; + } + + private List toObject(String content) { + if (content != null && !content.isEmpty()) { + try { + return mapper.readValue(content, new TypeReference>() { + }); + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + return null; + } + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/AppUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/AppUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..5b2b716b8487d4d094c7058bc59477fade1b28d0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/AppUtils.java @@ -0,0 +1,85 @@ +package com.ruoyi.common.utils; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.UUID; + +/** + * @author los + */ +public class AppUtils { + + //生成 app_secret 密钥 + private final static String SERVER_NAME = "杭州YY中小屏大屏对接接口-告警统计列表查询"; + private final static String[] chars = new String[]{"a", "b", "c", "d", "e", "f", + "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", + "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", + "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", + "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", + "W", "X", "Y", "Z"}; + + /** + * @Description:

+ * 短8位UUID思想其实借鉴微博短域名的生成方式,但是其重复概率过高,而且每次生成4个,需要随即选取一个。 + * 本算法利用62个可打印字符,通过随机生成32位UUID,由于UUID都为十六进制,所以将UUID分成8组,每4个为一组,然后通过模62操作,结果作为索引取出字符, + * 这样重复率大大降低。 + * 经测试,在生成一千万个数据也没有出现重复,完全满足大部分需求。 + *

+ * @date 2023-02-15 + */ + public static String getAppId() { + StringBuffer shortBuffer = new StringBuffer(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + for (int i = 0; i < 8; i++) { + String str = uuid.substring(i * 4, i * 4 + 4); + int x = Integer.parseInt(str, 16); + shortBuffer.append(chars[x % 0x3E]); + } + return shortBuffer.toString(); + } + + /** + *

+ * 通过appId和内置关键词生成APP Secret + *

+ * + * @date 2023-02-15 + */ + public static String getAppSecret(String appId) { + try { + String[] array = new String[]{appId, SERVER_NAME}; + StringBuffer sb = new StringBuffer(); + // 字符串排序 + Arrays.sort(array); + for (int i = 0; i < array.length; i++) { + sb.append(array[i]); + } + String str = sb.toString(); + MessageDigest md = MessageDigest.getInstance("SHA-256"); + md.update(str.getBytes()); + byte[] digest = md.digest(); + + StringBuffer hexstr = new StringBuffer(); + String shaHex = ""; + for (int i = 0; i < digest.length; i++) { + shaHex = Integer.toHexString(digest[i] & 0xFF); + if (shaHex.length() < 2) { + hexstr.append(0); + } + hexstr.append(shaHex); + } + return hexstr.toString(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + throw new RuntimeException(); + } + } + + /*public static void main(String[] args) { + String appId = getAppId(); + System.out.println(appId); + System.out.println(getAppSecret(appId)); + }*/ + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java new file mode 100644 index 0000000000000000000000000000000000000000..b6326c2b1bff208446fa9c45530b399f0ea7f0cd --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java @@ -0,0 +1,114 @@ +package com.ruoyi.common.utils; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 精确的浮点数运算 + * + * @author ruoyi + */ +public class Arith +{ + + /** 默认除法运算精度 */ + private static final int DEF_DIV_SCALE = 10; + + /** 这个类不能实例化 */ + private Arith() + { + } + + /** + * 提供精确的加法运算。 + * @param v1 被加数 + * @param v2 加数 + * @return 两个参数的和 + */ + public static double add(double v1, double v2) + { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.add(b2).doubleValue(); + } + + /** + * 提供精确的减法运算。 + * @param v1 被减数 + * @param v2 减数 + * @return 两个参数的差 + */ + public static double sub(double v1, double v2) + { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.subtract(b2).doubleValue(); + } + + /** + * 提供精确的乘法运算。 + * @param v1 被乘数 + * @param v2 乘数 + * @return 两个参数的积 + */ + public static double mul(double v1, double v2) + { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + return b1.multiply(b2).doubleValue(); + } + + /** + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到 + * 小数点以后10位,以后的数字四舍五入。 + * @param v1 被除数 + * @param v2 除数 + * @return 两个参数的商 + */ + public static double div(double v1, double v2) + { + return div(v1, v2, DEF_DIV_SCALE); + } + + /** + * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指 + * 定精度,以后的数字四舍五入。 + * @param v1 被除数 + * @param v2 除数 + * @param scale 表示表示需要精确到小数点以后几位。 + * @return 两个参数的商 + */ + public static double div(double v1, double v2, int scale) + { + if (scale < 0) + { + throw new IllegalArgumentException( + "The scale must be a positive integer or zero"); + } + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + if (b1.compareTo(BigDecimal.ZERO) == 0) + { + return BigDecimal.ZERO.doubleValue(); + } + return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue(); + } + + /** + * 提供精确的小数位四舍五入处理。 + * @param v 需要四舍五入的数字 + * @param scale 小数点后保留几位 + * @return 四舍五入后的结果 + */ + public static double round(double v, int scale) + { + if (scale < 0) + { + throw new IllegalArgumentException( + "The scale must be a positive integer or zero"); + } + BigDecimal b = new BigDecimal(Double.toString(v)); + BigDecimal one = BigDecimal.ONE; + return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CoordinateConversionUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/CoordinateConversionUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..45448ffa731a3cdf68605efdf507a3ac42a6c98c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/CoordinateConversionUtils.java @@ -0,0 +1,168 @@ +package com.ruoyi.common.utils; + +/** + * 坐标转换工具 + * 目前国内主要有以下三种坐标系: + *

+ * WGS84:为一种大地坐标系,也是目前广泛使用的GPS全球卫星定位系统使用的坐标系。 + *

+ * GCJ02:又称火星坐标系,是由中国国家测绘局制订的地理信息系统的坐标系统。由WGS84坐标系经加密后的坐标系。 + *

+ * BD09:为百度坐标系,在GCJ02坐标系基础上再次加密。其中bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托米制坐标。 + *

+ * 非中国地区地图,服务坐标统一使用WGS84坐标。 + */ +public class CoordinateConversionUtils { + static double x_PI = 3.14159265358979324 * 3000.0 / 180.0; + static double PI = 3.1415926535897932384626; + static double a = 6378245.0; + static double ee = 0.00669342162296594323; + + /** + * 百度坐标系 (BD-09) 与 火星坐标系 (GCJ-02)的转换 + * 即 百度 转 谷歌、高德 + * + * @param bd_lon + * @param bd_lat + * @returns {*[]} + */ + public String bd09togcj02(double bd_lon, double bd_lat) { + double x = bd_lon - 0.0065; + double y = bd_lat - 0.006; + double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI); + double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI); + double gg_lng = z * Math.cos(theta); + double gg_lat = z * Math.sin(theta); + // Point point=new Point(gg_lng, gg_lat); + // return point; + return gg_lng + "," + gg_lat; + } + + /** + * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换 + * 即谷歌、高德 转 百度 + * + * @param lng + * @param lat + * @returns {*[]} + */ + public static String gcj02tobd09(double lng, double lat) { + double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_PI); + double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_PI); + double bd_lng = z * Math.cos(theta) + 0.0065; + double bd_lat = z * Math.sin(theta) + 0.006; + //Point point=new Point(bd_lng, bd_lat); + // return point; + return bd_lng + "," + bd_lat; + } + + ; + + /** + * WGS84转GCj02 + * + * @param lng + * @param lat + * @returns {*[]} + */ + public static String wgs84togcj02(double lng, double lat) { + double dlat = transformlat(lng - 105.0, lat - 35.0); + double dlng = transformlng(lng - 105.0, lat - 35.0); + double radlat = lat / 180.0 * PI; + double magic = Math.sin(radlat); + magic = 1 - ee * magic * magic; + double sqrtmagic = Math.sqrt(magic); + dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI); + dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI); + double mglat = lat + dlat; + double mglng = lng + dlng; + //Point point=new Point(mglng, mglat); + // return point; + return mglng + "," + mglat; + } + + ; + + /** + * GCJ02 转换为 WGS84 + * + * @param lng + * @param lat + * @returns {*[]} + */ + public String gcj02towgs84(double lng, double lat) { + double dlat = transformlat(lng - 105.0, lat - 35.0); + double dlng = transformlng(lng - 105.0, lat - 35.0); + double radlat = lat / 180.0 * PI; + double magic = Math.sin(radlat); + magic = 1 - ee * magic * magic; + double sqrtmagic = Math.sqrt(magic); + dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI); + dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI); + double mglat = lat + dlat; + double mglng = lng + dlng; + // Point point=new Point(mglng, mglat); + // return point; + return mglat + "," + mglng; + } + + ; + + /** + * WGS84 转换为 BD-09 + * + * @param lng + * @param lat + * @returns {*[]} + */ + public static String wgs84tobd09(double lng, double lat) { + //第一次转换 + double dlat = transformlat(lng - 105.0, lat - 35.0); + double dlng = transformlng(lng - 105.0, lat - 35.0); + double radlat = lat / 180.0 * PI; + double magic = Math.sin(radlat); + magic = 1 - ee * magic * magic; + double sqrtmagic = Math.sqrt(magic); + dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI); + dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI); + double mglat = lat + dlat; + double mglng = lng + dlng; + + //第二次转换 + double z = Math.sqrt(mglng * mglng + mglat * mglat) + 0.00002 * Math.sin(mglat * x_PI); + double theta = Math.atan2(mglat, mglng) + 0.000003 * Math.cos(mglng * x_PI); + double bd_lng = z * Math.cos(theta) + 0.0065; + double bd_lat = z * Math.sin(theta) + 0.006; + return bd_lng + "," + bd_lat; + } + + private static double transformlat(double lng, double lat) { + double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng)); + ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; + ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0; + ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0; + return ret; + } + + private static double transformlng(double lng, double lat) { + double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng)); + ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; + ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0; + ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0; + return ret; + } + + public static void main(String[] args) { + // 两次谷歌转换为百度坐标 + // 第一次 WGS84转GCj02 + String lnglat = wgs84togcj02(117.20296517261839, 31.841652709281103); + double lng = Double.parseDouble(lnglat.split(",")[0]); + double lat = Double.parseDouble(lnglat.split(",")[1]); + System.out.println("第一次转换的结果:" + lng + "," + lat); + // 第二次 gcj02tobd09 + System.out.println("第二次转换的结果:" + gcj02tobd09(lng, lat)); + + // 谷歌转百度一次转换 + System.out.println("谷歌转换为百度一次转换的结果:" + wgs84tobd09(117.20296517261839, 31.841652709281103)); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..b2295d514a259e2aa08f368e6792525fd9136a07 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java @@ -0,0 +1,193 @@ +package com.ruoyi.common.utils; + +import java.lang.management.ManagementFactory; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.util.Date; +import org.apache.commons.lang3.time.DateFormatUtils; + +/** + * 时间工具类 + * + * @author ruoyi + */ +public class DateUtils extends org.apache.commons.lang3.time.DateUtils +{ + public static String YYYY = "yyyy"; + + public static String YYYY_MM = "yyyy-MM"; + + public static String YYYY_MM_DD = "yyyy-MM-dd"; + + public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; + + public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + + private static String[] parsePatterns = { + "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", + "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", + "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; + + /** + * 获取当前Date型日期 + * + * @return Date() 当前日期 + */ + public static Date getNowDate() + { + return new Date(); + } + + /** + * 获取当前日期, 默认格式为yyyy-MM-dd + * + * @return String + */ + public static String getDate() + { + return dateTimeNow(YYYY_MM_DD); + } + + public static final String getTime() + { + return dateTimeNow(YYYY_MM_DD_HH_MM_SS); + } + + public static final String dateTimeNow() + { + return dateTimeNow(YYYYMMDDHHMMSS); + } + + public static final String dateTimeNow(final String format) + { + return parseDateToStr(format, new Date()); + } + + public static final String dateTime(final Date date) + { + return parseDateToStr(YYYY_MM_DD, date); + } + + public static final String parseDateToStr(final String format, final Date date) + { + return new SimpleDateFormat(format).format(date); + } + + public static final Date dateTime(final String format, final String ts) + { + try + { + return new SimpleDateFormat(format).parse(ts); + } + catch (ParseException e) + { + throw new RuntimeException(e); + } + } + + /** + * 日期路径 即年/月/日 如2018/08/08 + */ + public static final String datePath() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyy/MM/dd"); + } + + /** + * 日期路径 即年/月/日 如20180808 + */ + public static final String dateDate() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyyMMdd"); + } + + public static final String dateTime() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyyMMddhhmmss"); + } + + /** + * 日期型字符串转化为日期 格式 + */ + public static Date parseDate(Object str) + { + if (str == null) + { + return null; + } + try + { + return parseDate(str.toString(), parsePatterns); + } + catch (ParseException e) + { + return null; + } + } + + /** + * 获取服务器启动时间 + */ + public static Date getServerStartDate() + { + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + return new Date(time); + } + + /** + * 计算相差天数 + */ + public static int differentDaysByMillisecond(Date date1, Date date2) + { + return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); + } + + /** + * 计算两个时间差 + */ + public static String getDatePoor(Date endDate, Date nowDate) + { + long nd = 1000 * 24 * 60 * 60; + long nh = 1000 * 60 * 60; + long nm = 1000 * 60; + // long ns = 1000; + // 获得两个时间的毫秒时间差异 + long diff = endDate.getTime() - nowDate.getTime(); + // 计算差多少天 + long day = diff / nd; + // 计算差多少小时 + long hour = diff % nd / nh; + // 计算差多少分钟 + long min = diff % nd % nh / nm; + // 计算差多少秒//输出结果 + // long sec = diff % nd % nh % nm / ns; + return day + "天" + hour + "小时" + min + "分钟"; + } + + /** + * 增加 LocalDateTime ==> Date + */ + public static Date toDate(LocalDateTime temporalAccessor) + { + ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault()); + return Date.from(zdt.toInstant()); + } + + /** + * 增加 LocalDate ==> Date + */ + public static Date toDate(LocalDate temporalAccessor) + { + LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0)); + ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); + return Date.from(zdt.toInstant()); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..8c9c7796be9f04e43d59b3094e78134fe18ed86b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java @@ -0,0 +1,188 @@ +package com.ruoyi.common.utils; + +import java.util.Collection; +import java.util.List; +import com.alibaba.fastjson2.JSONArray; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.spring.SpringUtils; + +/** + * 字典工具类 + * + * @author ruoyi + */ +public class DictUtils +{ + /** + * 分隔符 + */ + public static final String SEPARATOR = ","; + + /** + * 设置字典缓存 + * + * @param key 参数键 + * @param dictDatas 字典数据列表 + */ + public static void setDictCache(String key, List dictDatas) + { + SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas); + } + + /** + * 获取字典缓存 + * + * @param key 参数键 + * @return dictDatas 字典数据列表 + */ + public static List getDictCache(String key) + { + JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); + if (StringUtils.isNotNull(arrayCache)) + { + return arrayCache.toList(SysDictData.class); + } + return null; + } + + /** + * 根据字典类型和字典值获取字典标签 + * + * @param dictType 字典类型 + * @param dictValue 字典值 + * @return 字典标签 + */ + public static String getDictLabel(String dictType, String dictValue) + { + return getDictLabel(dictType, dictValue, SEPARATOR); + } + + /** + * 根据字典类型和字典标签获取字典值 + * + * @param dictType 字典类型 + * @param dictLabel 字典标签 + * @return 字典值 + */ + public static String getDictValue(String dictType, String dictLabel) + { + return getDictValue(dictType, dictLabel, SEPARATOR); + } + + /** + * 根据字典类型和字典值获取字典标签 + * + * @param dictType 字典类型 + * @param dictValue 字典值 + * @param separator 分隔符 + * @return 字典标签 + */ + public static String getDictLabel(String dictType, String dictValue, String separator) + { + StringBuilder propertyString = new StringBuilder(); + List datas = getDictCache(dictType); + + if (StringUtils.isNotNull(datas)) + { + if (StringUtils.containsAny(separator, dictValue)) + { + for (SysDictData dict : datas) + { + for (String value : dictValue.split(separator)) + { + if (value.equals(dict.getDictValue())) + { + propertyString.append(dict.getDictLabel()).append(separator); + break; + } + } + } + } + else + { + for (SysDictData dict : datas) + { + if (dictValue.equals(dict.getDictValue())) + { + return dict.getDictLabel(); + } + } + } + } + return dictValue; +// return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 根据字典类型和字典标签获取字典值 + * + * @param dictType 字典类型 + * @param dictLabel 字典标签 + * @param separator 分隔符 + * @return 字典值 + */ + public static String getDictValue(String dictType, String dictLabel, String separator) + { + StringBuilder propertyString = new StringBuilder(); + List datas = getDictCache(dictType); + + if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas)) + { + for (SysDictData dict : datas) + { + for (String label : dictLabel.split(separator)) + { + if (label.equals(dict.getDictLabel())) + { + propertyString.append(dict.getDictValue()).append(separator); + break; + } + } + } + } + else + { + for (SysDictData dict : datas) + { + if (dictLabel.equals(dict.getDictLabel())) + { + return dict.getDictValue(); + } + } + } + return dictLabel; +// return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 删除指定字典缓存 + * + * @param key 字典键 + */ + public static void removeDictCache(String key) + { + SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key)); + } + + /** + * 清空字典缓存 + */ + public static void clearDictCache() + { + Collection keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*"); + SpringUtils.getBean(RedisCache.class).deleteObject(keys); + } + + /** + * 设置cache key + * + * @param configKey 参数键 + * @return 缓存键key + */ + public static String getCacheKey(String configKey) + { + return CacheConstants.SYS_DICT_KEY + configKey; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..214e4a0dfe278499e72611749b31c0bd25469e99 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java @@ -0,0 +1,39 @@ +package com.ruoyi.common.utils; + +import java.io.PrintWriter; +import java.io.StringWriter; +import org.apache.commons.lang3.exception.ExceptionUtils; + +/** + * 错误信息处理类。 + * + * @author ruoyi + */ +public class ExceptionUtil +{ + /** + * 获取exception的详细错误信息。 + */ + public static String getExceptionMessage(Throwable e) + { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + return sw.toString(); + } + + public static String getRootErrorMessage(Exception e) + { + Throwable root = ExceptionUtils.getRootCause(e); + root = (root == null ? e : root); + if (root == null) + { + return ""; + } + String msg = root.getMessage(); + if (msg == null) + { + return "null"; + } + return StringUtils.defaultString(msg); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/GeoUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/GeoUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..80d6eafa224b7bc323bb03407643dfc1ca380661 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/GeoUtils.java @@ -0,0 +1,18 @@ +package com.ruoyi.common.utils; + +import org.gavaghan.geodesy.Ellipsoid; +import org.gavaghan.geodesy.GeodeticCalculator; +import org.gavaghan.geodesy.GeodeticCurve; +import org.gavaghan.geodesy.GlobalCoordinates; + +public class GeoUtils { + + /** + * 经纬度计算 + */ + public static double getDistanceMeter(GlobalCoordinates gpsFrom, GlobalCoordinates gpsTo, Ellipsoid ellipsoid) { + //创建GeodeticCalculator,调用计算方法,传入坐标系、经纬度用于计算距离 + GeodeticCurve geoCurve = new GeodeticCalculator().calculateGeodeticCurve(ellipsoid, gpsFrom, gpsTo); + return geoCurve.getEllipsoidalDistance(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..0de30c6b631511e12f55fb9d11fcaadd68c2f593 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java @@ -0,0 +1,18 @@ +package com.ruoyi.common.utils; + +/** + * 处理并记录日志文件 + * + * @author ruoyi + */ +public class LogUtils +{ + public static String getBlock(Object msg) + { + if (msg == null) + { + msg = ""; + } + return "[" + msg.toString() + "]"; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..7dac75a3bb3d066108584025816339ae1aab5477 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java @@ -0,0 +1,26 @@ +package com.ruoyi.common.utils; + +import org.springframework.context.MessageSource; +import org.springframework.context.i18n.LocaleContextHolder; +import com.ruoyi.common.utils.spring.SpringUtils; + +/** + * 获取i18n资源文件 + * + * @author ruoyi + */ +public class MessageUtils +{ + /** + * 根据消息键和参数 获取消息 委托给spring messageSource + * + * @param code 消息键 + * @param args 参数 + * @return 获取国际化翻译值 + */ + public static String message(String code, Object... args) + { + MessageSource messageSource = SpringUtils.getBean(MessageSource.class); + return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..838105542796e7062f8e43484d52d286b03a0083 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PageUtils.java @@ -0,0 +1,62 @@ +package com.ruoyi.common.utils; + +import com.github.pagehelper.PageHelper; +import com.ruoyi.common.core.page.PageDomain; +import com.ruoyi.common.core.page.TableSupport; +import com.ruoyi.common.utils.sql.SqlUtil; + +import java.lang.reflect.Field; + +/** + * 分页工具类 + * + * @author ruoyi + */ +public class PageUtils extends PageHelper +{ + /** + * 设置请求分页数据 + */ + public static void startPage() + { + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); + Boolean reasonable = pageDomain.getReasonable(); + PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable); + } + + /** + * 清理分页的线程变量 + */ + public static void clearPage() + { + PageHelper.clearPage(); + } + + public static void startPage(Object o,Class clazz) { + Integer pageNum = 1; + Integer pageSize = 10; + + try { + Field num = clazz.getSuperclass().getDeclaredField("pageNum"); + num.setAccessible(true); + if (num.get(o) != null) { + pageNum = Integer.valueOf(num.get(o).toString()); + } + + Field size = clazz.getSuperclass().getDeclaredField("pageSize"); + size.setAccessible(true); + if (size.get(o) != null) { + pageSize = Integer.valueOf(size.get(o).toString()); + } + + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + + PageHelper.startPage(pageNum, pageSize); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/PasswordUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PasswordUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..26434cb0edd8d73093e9168dbed6f07ac1a84a93 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/PasswordUtil.java @@ -0,0 +1,963 @@ +package com.ruoyi.common.utils; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Locale; +import java.util.Map.Entry; +import java.util.Random; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 密码强度检测工具类 + * 密碼最低要求8字元 + * 最少符合下列四項中三項規則: + * 大寫英文字元 + * 小寫英文字元 + * 數字字元 + * 符號字元 + *

+ * 增加字元的變化能提高分數. + * 最後的分數為加分項目和減分項目的總和. + * 分數的範圍為0~100分. + * 分數不需達到最低字元即可計算. + */ +public class PasswordUtil { + + /** + * 正则_大写字母 + */ + private static final Pattern REGEX_UPPERCASE = Pattern.compile("[A-Z]"); + /** + * 正则_小写字母 + */ + private static final Pattern REGEX_LOWERCASE = Pattern.compile("[a-z]"); + /** + * 正则_数字 + */ + private static final Pattern NUM_REGEX = Pattern.compile("[0-9]"); + + /**----------------------------加分项------------------------------**/ + + /** + * 获取密码长度积分 + * + * @param password + * + * @return + */ + public static int CheckPswLength(String password) { + return password.length() * 4; + } + + /** + * 获取大写字母积分 + * + * @param password + * + * @return + */ + public static int CheckPswUpper(String password) { + String reg = "[A-Z]"; + Pattern pattern = Pattern.compile(reg); + Matcher matcher = pattern.matcher(password); + int iUpper = 0; + while (matcher.find()) { + iUpper++; + } + if (iUpper <= 0) { + return 0; + } + return (password.length() - iUpper) * 2; + } + + /** + * 获取小写字母长度积分 + * + * @param password + * + * @return + */ + public static int CheckPwsLower(String password) { + String reg = "[a-z]"; + Pattern pattern = Pattern.compile(reg); + Matcher matcher = pattern.matcher(password); + int iLower = 0; + while (matcher.find()) { + iLower++; + } + if (iLower <= 0) { + return 0; + } + return (password.length() - iLower) * 2; + } + + /** + * 获取数字长度积分 + * + * @param password + * + * @return + */ + public static int checkNum(String password) { + String reg = "[0-9]"; + Pattern pattern = Pattern.compile(reg); + Matcher matcher = pattern.matcher(password); + int iNum = 0; + while (matcher.find()) { + iNum++; + } + if (iNum == password.length()) { + return 0; + } + return iNum * 4; + } + //测试符号字元 + + /** + * 获取特殊字符长度积分 + * + * @param password + * + * @return + */ + public static int checkChar(String password) { + String regUpper = "[A-Z]"; + Pattern patternUpper = Pattern.compile(regUpper); + Matcher matcherUpper = patternUpper.matcher(password); + int iUpper = 0; + while (matcherUpper.find()) { + iUpper++; + } + String regLower = "[a-z]"; + Pattern patternLower = Pattern.compile(regLower); + Matcher matcherLower = patternLower.matcher(password); + int iLower = 0; + while (matcherLower.find()) { + iLower++; + } + String regNum = "[0-9]"; + Pattern patternNum = Pattern.compile(regNum); + Matcher matcherNum = patternNum.matcher(password); + int iNum = 0; + while (matcherNum.find()) { + iNum++; + } + int iChar = password.length() - iUpper - iLower - iNum; + return iChar * 6; + } + + /** + * 获取密码中间穿插数字或字符积分 + * + * @param password + * + * @return + */ + public static int checkNumOrCharInStr(String password) { + String regUpper = "[A-Z]"; + Pattern patternUpper = Pattern.compile(regUpper); + Matcher matcherUpper = patternUpper.matcher(password); + int iUpper = 0; + while (matcherUpper.find()) { + iUpper++; + } + String regLower = "[a-z]"; + Pattern patternLower = Pattern.compile(regLower); + Matcher matcherLower = patternLower.matcher(password); + int iLower = 0; + while (matcherLower.find()) { + iLower++; + } + String regNum = "[0-9]"; + Pattern patternNum = Pattern.compile(regNum); + Matcher matcherNum = patternNum.matcher(password); + int iNum = 0; + while (matcherNum.find()) { + iNum++; + } + int iChar = password.length() - iUpper - iLower - iNum; + + int jCharOrNum = iNum + iChar - 1; + if (jCharOrNum < 0) { + jCharOrNum = 0; + } + if (iNum + iChar == password.length()) { + jCharOrNum = password.length() - 2; + } + return jCharOrNum * 2; + } + + /** + * 最低要求标准 + * + * @param password + * + * @return + */ + public static int LowerQuest(String password) { + String regUpper = "[A-Z]"; + Pattern patternUpper = Pattern.compile(regUpper); + Matcher matcherUpper = patternUpper.matcher(password); + int iUpper = 0; + while (matcherUpper.find()) { + iUpper++; + } + String regLower = "[a-z]"; + Pattern patternLower = Pattern.compile(regLower); + Matcher matcherLower = patternLower.matcher(password); + int iLower = 0; + while (matcherLower.find()) { + iLower++; + } + String regNum = "[0-9]"; + Pattern patternNum = Pattern.compile(regNum); + Matcher matcherNum = patternNum.matcher(password); + int iNum = 0; + while (matcherNum.find()) { + iNum++; + } + int iChar = password.length() - iUpper - iLower - iNum; + + int iLowerQuest = 0; + if (password.length() >= 8) { + iLowerQuest++; + } + if (iUpper > 0) { + iLowerQuest++; + } + if (iLower > 0) { + iLowerQuest++; + } + if (iNum > 0) { + iLowerQuest++; + } + if (iChar > 0) { + iLowerQuest++; + } + if (iLowerQuest >= 4) { + + } else { + iLowerQuest = 0; + } + return iLowerQuest * 2; + } + + /**=================扣分项目=====================**/ + + /** + * 只包含字母积分 + * + * @param password + * + * @return + */ + public static int OnlyHasAlp(String password) { + String regUpper = "[A-Z]"; + Pattern patternUpper = Pattern.compile(regUpper); + Matcher matcherUpper = patternUpper.matcher(password); + int iUpper = 0; + while (matcherUpper.find()) { + iUpper++; + } + String regLower = "[a-z]"; + Pattern patternLower = Pattern.compile(regLower); + Matcher matcherLower = patternLower.matcher(password); + int iLower = 0; + while (matcherLower.find()) { + iLower++; + } + if (password.length() == (iUpper + iLower)) { + return -password.length(); + } + return 0; + } + + /** + * 只包含数字积分 + * + * @param password + * + * @return + */ + public static int OnlyHasNum(String password) { + String regNum = "[0-9]"; + Pattern patternNum = Pattern.compile(regNum); + Matcher matcherNum = patternNum.matcher(password); + int iNum = 0; + while (matcherNum.find()) { + iNum++; + } + if (password.length() == iNum) { + return -password.length(); + } + return 0; + } + + + /** + * 重复字符积分 + * + * @param password + * + * @return + */ + public static int repeatDex(String password) { + char[] c = password.toLowerCase().toCharArray(); + HashMap hashMap = + new HashMap(); + for (int i = 0; i < c.length; i++) { + if (hashMap.containsKey(c[i])) { + hashMap.put(c[i], hashMap.get(c[i]) + 1); + } else { + hashMap.put(c[i], 1); + } + } + int sum = 0; + Iterator> iterator = + hashMap.entrySet().iterator(); + while (iterator.hasNext()) { + int j = iterator.next().getValue(); + if (j > 0) { + sum = sum + j * (j - 1); + } + } + return -sum; + } + + /** + * 连续英文大写字母扣分项 + * + * @param password + * + * @return + */ + public static int seriseUpperAlp(String password) { + int j = 0; + char[] c = password.toCharArray(); + for (int i = 0; i < c.length - 1; i++) { + if (REGEX_UPPERCASE.matcher(c[i] + "").find()) { + if (REGEX_UPPERCASE.matcher(c[i + 1] + "").find()) { + j++; + } + } + } + return -2 * j; + } + + /** + * 连续英文字母扣分项 + * + * @param password + * + * @return + */ + public static int seriseLowerAlp(String password) { + int j = 0; + char[] c = password.toCharArray(); + for (int i = 0; i < c.length - 1; i++) { + if (REGEX_LOWERCASE.matcher(c[i] + "").find()) { + if (REGEX_LOWERCASE.matcher(c[i + 1] + "").find()) { + j++; + } + } + } + return -2 * j; + } + + /** + * 连续数字扣分项 + * + * @param password + * + * @return + */ + public static int seriseNum(String password) { + String reg = "[0-9]"; + Pattern pattern = Pattern.compile(reg); + char[] c = password.toCharArray(); + int j = 0; + for (int i = 0; i < c.length - 1; i++) { + if (pattern.matcher(c[i] + "").matches() + && pattern.matcher(c[i + 1] + "").matches()) { + j++; + } + } + return -2 * j; + } + + /** + * 连续字母abc def之类超过3个,不区分大小写字母 + * + * @param password + * + * @return + */ + public static int seriesAlp2Three(String password) { + int j = 0; + char[] c = password.toLowerCase(Locale.CHINA).toCharArray(); + for (int i = 0; i < c.length - 2; i++) { + if (REGEX_LOWERCASE.matcher(c[i] + "").find()) { + if ((c[i + 1] == c[i] + 1) && (c[i + 2] == c[i] + 2)) { + j++; + } + } + } + return -3 * j; + } + + /** + * 连续数字123 234之类超过3个扣分 + * + * @param password + * + * @return + */ + public static int seriesNum2Three(String password) { + int j = 0; + char[] c = password.toLowerCase(Locale.CHINA).toCharArray(); + for (int i = 0; i < c.length - 2; i++) { + if (NUM_REGEX.matcher(c[i] + "").find()) { + if ((c[i + 1] == c[i] + 1) && (c[i + 2] == c[i] + 2)) { + j++; + } + } + } + return -3 * j; + } + + /** + * 获取密码强度分数 + * + * @param password + * + * @return + */ + public static int getPasswordScore(String password) { + // System.out.println("密码长度加分="+CheckPswLength(password)); + // System.out.println("大写字母加分="+CheckPswUpper(password)); + // System.out.println("小写字母加分="+CheckPwsLower(password)); + // System.out.println("数字加分="+checkNum(password)); + // System.out.println("特殊符号加分="+checkChar(password)); + // System.out.println("密码中间穿插数字或特殊字符加分="+checkNumOrCharInStr(password)); + // System.out.println("最低要求加分="+LowerQuest(password)); + // System.out.println("只有英文字母扣分="+OnlyHasAlp(password)); + // System.out.println("只有數字扣分="+OnlyHasNum(password)); + // System.out.println("重复字符(不区分大小写)扣分="+repeatDex(password)); + // System.out.println("连续大写字母扣分="+seriseUpperAlp(password)); + // System.out.println("连续小写字母扣分="+seriseLowerAlp(password)); + // System.out.println("连续数字扣分="+seriseNum(password)); + // System.out.println("连续字母超过三个(如abc,def)扣分="+seriesAlp2Three(password)); + // System.out.println("连续数字超过三个(如123,234)扣分="+seriesNum2Three(password)); + int score = CheckPswLength(password) + CheckPswUpper(password) + CheckPwsLower(password) + checkNum(password) + checkChar(password) + + checkNumOrCharInStr(password) + LowerQuest(password) + OnlyHasAlp(password) + OnlyHasNum(password) + repeatDex(password) + + seriseUpperAlp(password) + seriseLowerAlp(password) + seriseNum(password) + seriesAlp2Three(password) + seriesNum2Three(password); + return score; + } + + /**-----------------------------------校验密码合规性-----------------------------------**/ + /** + * 获取大写字母数量 + * + * @param password + * + * @return + */ + public static int getNumOfUpperChar(String password) { + String reg = "[A-Z]"; + Pattern pattern = Pattern.compile(reg); + Matcher matcher = pattern.matcher(password); + int iUpper = 0; + while (matcher.find()) { + iUpper++; + } + return iUpper; + } + + /** + * 获取小写字母数量 + * + * @param password + * + * @return + */ + public static int getNumOfLowerChar(String password) { + String reg = "[a-z]"; + Pattern pattern = Pattern.compile(reg); + Matcher matcher = pattern.matcher(password); + int iLower = 0; + while (matcher.find()) { + iLower++; + } + return iLower; + } + + /** + * 获取数字字母数量 + * + * @param password + * + * @return + */ + public static int getNumOfNum(String password) { + String reg = "[0-9]"; + Pattern pattern = Pattern.compile(reg); + Matcher matcher = pattern.matcher(password); + int iNum = 0; + while (matcher.find()) { + iNum++; + } + return iNum; + } + + /** + * 获取特殊字符长度积分 + * + * @param password + * + * @return + */ + public static int getNumOfSpecChar(String password) { + String regUpper = "[A-Z]"; + Pattern patternUpper = Pattern.compile(regUpper); + Matcher matcherUpper = patternUpper.matcher(password); + int iUpper = 0; + while (matcherUpper.find()) { + iUpper++; + } + String regLower = "[a-z]"; + Pattern patternLower = Pattern.compile(regLower); + Matcher matcherLower = patternLower.matcher(password); + int iLower = 0; + while (matcherLower.find()) { + iLower++; + } + String regNum = "[0-9]"; + Pattern patternNum = Pattern.compile(regNum); + Matcher matcherNum = patternNum.matcher(password); + int iNum = 0; + while (matcherNum.find()) { + iNum++; + } + int iChar = password.length() - iUpper - iLower - iNum; + return iChar; + } + + /** + * 获取连续字母abc def之类超过3个的个数 + * + * @param password + * + * @return + */ + public static int getNumOfSeriesCharThree(String password) { + int j = 0; + char[] c = password.toLowerCase().toCharArray(); + for (int i = 0; i < c.length - 2; i++) { + if (REGEX_LOWERCASE.matcher(c[i] + "").find()) { + if ((c[i + 1] == c[i] + 1) && (c[i + 2] == c[i] + 2)) { + j++; + } + } + } + return j; + } + + /** + * 连续数字123 234之类超过3个的数量 + * + * @param password + * + * @return + */ + public static int getNumOfSeriesNumThree(String password) { + int j = 0; + char[] c = password.toLowerCase().toCharArray(); + for (int i = 0; i < c.length - 2; i++) { + if (NUM_REGEX.matcher(c[i] + "").find()) { + if ((c[i + 1] == c[i] + 1) && (c[i + 2] == c[i] + 2)) { + j++; + } + } + } + return j; + } + + /** + * 校验密码是否符合要求 + * + * @param password + * + * @return + */ + public static boolean validatePassword(String password) { + boolean bResult = true; + //如果密码长度8-16位 + if (password.length() < 8 || password.length() > 16) { + bResult = false; + } + //符号种类 + int iType = 0; + //检测是否包含字母 + if (getNumOfUpperChar(password) > 0 || getNumOfLowerChar(password) > 0) { + iType++; + } + //检测是否包含数字 + if (getNumOfNum(password) > 0) { + iType++; + } + //检测是否包含特殊符号 + if (getNumOfSpecialChar(password) > 0) { + iType++; + } + //如果字符种类少于3种不符合要求 + if (iType < 3) { + bResult = false; + } + //判断是否包行3个连续字母的个数(如abc,bcd) + //if (getNumOfSeriesCharThree(password) > 0) { + // bResult = false; + //} + //判断是否包行3个连续数字的个数(如123,345) + //if (getNumOfSeriesNumThree(password) > 0) { + // bResult = false; + //} + return bResult; + } + + private static int getNumOfSpecialChar(String password) { + String reg = "^.*[_!@#%&*]+.*$"; + Pattern pattern = Pattern.compile(reg); + Matcher matcher = pattern.matcher(password); + int iLower = 0; + while (matcher.find()) { + iLower++; + } + return iLower; + } + + /**-----------------------------------随机生成密码------------------------------------**/ + + + /** + * 生成指定长度随机数字密码 + * + * @param len + * @param len + * + * @return + */ + public static String createNumPassWord(int len) { + Random rd = new Random(); + final int maxNum = 70; + StringBuffer sb = new StringBuffer(); + int rdGet;//取得随机数 + char[] str = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + int count = 0; + while (count < len) { + rdGet = Math.abs(rd.nextInt(maxNum));//生成的数最大为10-1 + if (rdGet >= 0 && rdGet < str.length) { + sb.append(str[rdGet]); + count++; + } + } + return sb.toString(); + } + + /** + * 生成随机小写字母密码 + * + * @param len + * + * @return + */ + public static String createLowerCharPassWord(int len) { + Random rd = new Random(); + final int maxNum = 26; + StringBuffer sb = new StringBuffer(); + int rdGet;//取得随机数 + char[] str = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', + 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z'}; + int count = 0; + while (count < len) { + rdGet = Math.abs(rd.nextInt(maxNum));//生成的数最大为62-1 + if (rdGet >= 0 && rdGet < str.length) { + sb.append(str[rdGet]); + count++; + } + } + return sb.toString(); + } + + /** + * 生成随机小写字母密码 + * + * @param len + * + * @return + */ + public static String createUpperCharPassWord(int len) { + Random rd = new Random(); + final int maxNum = 26; + StringBuffer sb = new StringBuffer(); + int rdGet;//取得随机数 + char[] str = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z'}; + int count = 0; + while (count < len) { + rdGet = Math.abs(rd.nextInt(maxNum));//生成的数最大为62-1 + if (rdGet >= 0 && rdGet < str.length) { + sb.append(str[rdGet]); + count++; + } + } + return sb.toString(); + } + + /** + * 生成随机字母 + * + * @param len + * + * @return + */ + public static String createLowerCharNumPassWord(int len) { + Random rd = new Random(); + StringBuffer sb = new StringBuffer(); + final int maxNumChar = 26; + char[] strChar = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', + 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z'}; + final int maxNumNum = 10; + char[] strNum = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + int count = 0; + while (count < len) { + int rdGetChar = Math.abs(rd.nextInt(maxNumChar));//生成的数最大为26-1 + if (rdGetChar >= 0 && rdGetChar < strChar.length) { + sb.append(strChar[rdGetChar]); + count++; + } + if (count < len) { + int rdGetNum = Math.abs(rd.nextInt(maxNumNum));//生成的数最大为10-1 + if (rdGetNum >= 0 && rdGetNum < strNum.length) { + sb.append(strNum[rdGetNum]); + count++; + } + } + } + return sb.toString(); + } + + /** + * 生成随机字母 + * + * @param len + * + * @return + */ + public static String createCharNumPassWord(int len) { + + StringBuffer sb = new StringBuffer(); + final int maxNumChar = 52; + char[] strChar = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', + 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z'}; + final int maxNumNum = 10; + char[] strNum = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + int count = 0; + while (count < len) { + Random rdChar = new Random(); + int rdGetChar = Math.abs(rdChar.nextInt(maxNumChar));//生成的数最大为52-1 + if (rdGetChar >= 0 && rdGetChar < strChar.length) { + sb.append(strChar[rdGetChar]); + count++; + } + if (count < len) { + Random rdNum = new Random(); + int rdGetNum = Math.abs(rdNum.nextInt(maxNumNum));//生成的数最大为10-1 + if (rdGetNum >= 0 && rdGetNum < strNum.length) { + sb.append(strNum[rdGetNum]); + count++; + } + } + } + return sb.toString(); + } + + /** + * 生成随机大小写字母+数字+特殊字符的密码 + * + * @param len + * + * @return + */ + public static String createPassWord(int len) { + StringBuffer sb = new StringBuffer(); + final int maxNumChar = 52; + char[] strChar = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', + 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z'}; + final int maxNumNum = 10; + char[] strNum = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + + final int maxNumSpec = 10; + char[] strSpec = {'!', '@', '#', '$', '%', '^', '&', '*', '(', ')'}; + int count = 0; + while (count < len) { + Random rdChar = new Random(); + int rdGetChar = Math.abs(rdChar.nextInt(maxNumChar));//生成的数最大为52-1 + if (rdGetChar >= 0 && rdGetChar < strChar.length) { + sb.append(strChar[rdGetChar]); + count++; + } + if (count < len) { + Random rdNum = new Random(); + int rdGetNum = Math.abs(rdNum.nextInt(maxNumNum));//生成的数最大为10-1 + if (rdGetNum >= 0 && rdGetNum < strNum.length) { + sb.append(strNum[rdGetNum]); + count++; + } + } + if (count < len) { + Random rdSpec = new Random(); + int rdGetSpec = Math.abs(rdSpec.nextInt(maxNumSpec));//生成的数最大为10-1 + if (rdGetSpec >= 0 && rdGetSpec < strSpec.length) { + sb.append(strSpec[rdGetSpec]); + count++; + } + } + } + return sb.toString(); + } + + public static void main(String[] args) { + System.out.println(validatePassword("!avA2asfdas12")); + // for (int i=0;i<1000;i++){ + // String passwordNum = PasswordUtil.createNumPassWord(8); + // System.out.println("生成随机数字密码"+passwordNum); + // int iScoreNum = getPasswordScore(passwordNum); + // System.out.println("密码强度分数:"+iScoreNum); + // if (!validatePassword(passwordNum)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // String passwordLowerChar = PasswordUtil.createLowerCharPassWord(8); + // System.out.println("生成随机小写字母密码"+passwordLowerChar); + // int iScoreLowerChar = getPasswordScore(passwordLowerChar); + // System.out.println("密码强度分数:"+iScoreLowerChar); + // if (!validatePassword(passwordLowerChar)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // String passwordUpperChar = PasswordUtil.createUpperCharPassWord(8); + // System.out.println("生成随机大写字母密码"+passwordUpperChar); + // int iScoreUpperChar = getPasswordScore(passwordUpperChar); + // System.out.println("密码强度分数:"+iScoreUpperChar); + // if (!validatePassword(passwordUpperChar)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // String passwordLowerCharNum = PasswordUtil.createLowerCharNumPassWord(8); + // System.out.println("生成随机小写字母+数字密码"+passwordLowerCharNum); + // int iScoreLowerCharNum = getPasswordScore(passwordLowerCharNum); + // System.out.println("密码强度分数:"+iScoreLowerCharNum); + // if (!validatePassword(passwordLowerCharNum)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // String passwordCharNum = PasswordUtil.createCharNumPassWord(8); + // System.out.println("生成随机大小写字母+数字密码"+passwordCharNum); + // int iScoreCharNum = getPasswordScore(passwordCharNum); + // System.out.println("密码强度分数:"+iScoreCharNum); + // if (!validatePassword(passwordCharNum)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // String password = PasswordUtil.createPassWord(8); + // System.out.println("生成随机大小写字母+数字+特殊字符密码"+password); + // int iScore = getPasswordScore(password); + // System.out.println("密码强度分数:"+iScore); + // if (!validatePassword(password)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // } + // String pwd = "12345678"; + // System.out.println("密码"+pwd); + // int iScore = getPasswordScore(pwd); + // System.out.println("密码强度分数:"+iScore); + // if (!validatePassword(pwd)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // pwd = "and34353"; + // System.out.println("密码"+pwd); + // iScore = getPasswordScore(pwd); + // System.out.println("密码强度分数:"+iScore); + // if (!validatePassword(pwd)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // pwd = "And34353"; + // System.out.println("密码"+pwd); + // iScore = getPasswordScore(pwd); + // System.out.println("密码强度分数:"+iScore); + // if (!validatePassword(pwd)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // pwd = "abcd8239"; + // System.out.println("密码"+pwd); + // iScore = getPasswordScore(pwd); + // System.out.println("密码强度分数:"+iScore); + // if (!validatePassword(pwd)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // pwd = "wero1234"; + // System.out.println("密码"+pwd); + // iScore = getPasswordScore(pwd); + // System.out.println("密码强度分数:"+iScore); + // if (!validatePassword(pwd)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + // + // pwd = "admin123"; + // System.out.println("密码"+pwd); + // iScore = getPasswordScore(pwd); + // System.out.println("密码强度分数:"+iScore); + // if (!validatePassword(pwd)){ + // System.out.println("密码不符合要求"); + // }else{ + // System.out.println("密码符合要求"); + // } + } + +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RestTemplateUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RestTemplateUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..5894e555c947c4bcc66280751571684d40958009 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RestTemplateUtils.java @@ -0,0 +1,664 @@ +package com.ruoyi.common.utils; + +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +/** + * + * + * @author Johny + * @desc http请求工具类 + */ + +@Component +public class RestTemplateUtils { + // http模板 + private final RestTemplate restTemplate; + //注入RestTemplate + public RestTemplateUtils(RestTemplate restTemplate) { + this.restTemplate = restTemplate; + } + + // ----------------------------------GET------------------------------------------------------- + + /** + * GET请求调用方式 + * + * @param url 请求URL + * @param responseType 返回对象类型 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity get(String url, Class responseType) throws RestClientException { + return restTemplate.getForEntity(url, responseType); + } + + /** + * GET请求调用方式 + * + * @param url 请求URL + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity get(String url, Class responseType, Object... uriVariables) + throws RestClientException { + return restTemplate.getForEntity(url, responseType, uriVariables); + } + + /** + * GET请求调用方式 + * + * @param url 请求URL + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity get(String url, Class responseType, Map uriVariables) + throws RestClientException { + return restTemplate.getForEntity(url, responseType, uriVariables); + } + + /** + * 带请求头的GET请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity get(String url, Map headers, Class responseType, + Object... uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return get(url, httpHeaders, responseType, uriVariables); + } + + /** + * 带请求头的GET请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity get(String url, HttpHeaders headers, Class responseType, Object... uriVariables) + throws RestClientException { + HttpEntity requestEntity = new HttpEntity<>(headers); + return exchange(url, HttpMethod.GET, requestEntity, responseType, uriVariables); + } + + /** + * 带请求头的GET请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity get(String url, Map headers, Class responseType, + Map uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return get(url, httpHeaders, responseType, uriVariables); + } + + /** + * 带请求头的GET请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity get(String url, HttpHeaders headers, Class responseType, + Map uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity<>(headers); + return exchange(url, HttpMethod.GET, requestEntity, responseType, uriVariables); + } + + // ----------------------------------POST------------------------------------------------------- + + /** + * POST请求调用方式 + * + * @param url 请求URL + * @param responseType 返回对象类型 + * @return + */ + public ResponseEntity post(String url, Class responseType) throws RestClientException { + return restTemplate.postForEntity(url, HttpEntity.EMPTY, responseType); + } + + /** + * POST请求调用方式 + * + * @param url 请求URL + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity post(String url, Object requestBody, Class responseType) + throws RestClientException { + return restTemplate.postForEntity(url, requestBody, responseType); + } + + /** + * POST请求调用方式 + * + * @param url 请求URL + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity post(String url, Object requestBody, Class responseType, Object... uriVariables) + throws RestClientException { + return restTemplate.postForEntity(url, requestBody, responseType, uriVariables); + } + + /** + * POST请求调用方式 + * + * @param url 请求URL + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity post(String url, Object requestBody, Class responseType, + Map uriVariables) throws RestClientException { + return restTemplate.postForEntity(url, requestBody, responseType, uriVariables); + } + + /** + * 带请求头的POST请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity post(String url, Map headers, Object requestBody, + Class responseType, Object... uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return post(url, httpHeaders, requestBody, responseType, uriVariables); + } + + /** + * 带请求头的POST请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity post(String url, HttpHeaders headers, Object requestBody, Class responseType, + Object... uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody, headers); + return post(url, requestEntity, responseType, uriVariables); + } + + /** + * 带请求头的POST请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity post(String url, Map headers, Object requestBody, + Class responseType, Map uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return post(url, httpHeaders, requestBody, responseType, uriVariables); + } + + /** + * 带请求头的POST请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity post(String url, HttpHeaders headers, Object requestBody, Class responseType, + Map uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody, headers); + return post(url, requestEntity, responseType, uriVariables); + } + + /** + * 自定义请求头和请求体的POST请求调用方式 + * + * @param url 请求URL + * @param requestEntity 请求头和请求体封装对象 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity post(String url, HttpEntity requestEntity, Class responseType, + Object... uriVariables) throws RestClientException { + return restTemplate.exchange(url, HttpMethod.POST, requestEntity, responseType, uriVariables); + } + + /** + * 自定义请求头和请求体的POST请求调用方式 + * + * @param url 请求URL + * @param requestEntity 请求头和请求体封装对象 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity post(String url, HttpEntity requestEntity, Class responseType, + Map uriVariables) throws RestClientException { + return restTemplate.exchange(url, HttpMethod.POST, requestEntity, responseType, uriVariables); + } + + // ----------------------------------PUT------------------------------------------------------- + + /** + * PUT请求调用方式 + * + * @param url 请求URL + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity put(String url, Class responseType, Object... uriVariables) + throws RestClientException { + return put(url, HttpEntity.EMPTY, responseType, uriVariables); + } + + /** + * PUT请求调用方式 + * + * @param url 请求URL + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity put(String url, Object requestBody, Class responseType, Object... uriVariables) + throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody); + return put(url, requestEntity, responseType, uriVariables); + } + + /** + * PUT请求调用方式 + * + * @param url 请求URL + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity put(String url, Object requestBody, Class responseType, Map uriVariables) + throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody); + return put(url, requestEntity, responseType, uriVariables); + } + + /** + * 带请求头的PUT请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity put(String url, Map headers, Object requestBody, Class responseType, + Object... uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return put(url, httpHeaders, requestBody, responseType, uriVariables); + } + + /** + * 带请求头的PUT请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity put(String url, HttpHeaders headers, Object requestBody, Class responseType, + Object... uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody, headers); + return put(url, requestEntity, responseType, uriVariables); + } + + /** + * 带请求头的PUT请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity put(String url, Map headers, Object requestBody, Class responseType, + Map uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return put(url, httpHeaders, requestBody, responseType, uriVariables); + } + + /** + * 带请求头的PUT请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity put(String url, HttpHeaders headers, Object requestBody, Class responseType, + Map uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody, headers); + return put(url, requestEntity, responseType, uriVariables); + } + + /** + * 自定义请求头和请求体的PUT请求调用方式 + * + * @param url 请求URL + * @param requestEntity 请求头和请求体封装对象 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity put(String url, HttpEntity requestEntity, Class responseType, + Object... uriVariables) throws RestClientException { + return restTemplate.exchange(url, HttpMethod.PUT, requestEntity, responseType, uriVariables); + } + + /** + * 自定义请求头和请求体的PUT请求调用方式 + * + * @param url 请求URL + * @param requestEntity 请求头和请求体封装对象 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity put(String url, HttpEntity requestEntity, Class responseType, + Map uriVariables) throws RestClientException { + return restTemplate.exchange(url, HttpMethod.PUT, requestEntity, responseType, uriVariables); + } + + // ----------------------------------DELETE------------------------------------------------------- + + /** + * DELETE请求调用方式 + * + * @param url 请求URL + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, Class responseType, Object... uriVariables) + throws RestClientException { + return delete(url, HttpEntity.EMPTY, responseType, uriVariables); + } + + /** + * DELETE请求调用方式 + * + * @param url 请求URL + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, Class responseType, Map uriVariables) + throws RestClientException { + return delete(url, HttpEntity.EMPTY, responseType, uriVariables); + } + + /** + * DELETE请求调用方式 + * + * @param url 请求URL + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, Object requestBody, Class responseType, Object... uriVariables) + throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody); + return delete(url, requestEntity, responseType, uriVariables); + } + + /** + * DELETE请求调用方式 + * + * @param url 请求URL + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, Object requestBody, Class responseType, + Map uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody); + return delete(url, requestEntity, responseType, uriVariables); + } + + /** + * 带请求头的DELETE请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, Map headers, Class responseType, + Object... uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return delete(url, httpHeaders, responseType, uriVariables); + } + + /** + * 带请求头的DELETE请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, HttpHeaders headers, Class responseType, Object... uriVariables) + throws RestClientException { + HttpEntity requestEntity = new HttpEntity(headers); + return delete(url, requestEntity, responseType, uriVariables); + } + + /** + * 带请求头的DELETE请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, Map headers, Class responseType, + Map uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return delete(url, httpHeaders, responseType, uriVariables); + } + + /** + * 带请求头的DELETE请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, HttpHeaders headers, Class responseType, + Map uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity(headers); + return delete(url, requestEntity, responseType, uriVariables); + } + + /** + * 带请求头的DELETE请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, Map headers, Object requestBody, + Class responseType, Object... uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return delete(url, httpHeaders, requestBody, responseType, uriVariables); + } + + /** + * 带请求头的DELETE请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, HttpHeaders headers, Object requestBody, Class responseType, + Object... uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody, headers); + return delete(url, requestEntity, responseType, uriVariables); + } + + /** + * 带请求头的DELETE请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, Map headers, Object requestBody, + Class responseType, Map uriVariables) throws RestClientException { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setAll(headers); + return delete(url, httpHeaders, requestBody, responseType, uriVariables); + } + + /** + * 带请求头的DELETE请求调用方式 + * + * @param url 请求URL + * @param headers 请求头参数 + * @param requestBody 请求参数体 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, HttpHeaders headers, Object requestBody, Class responseType, + Map uriVariables) throws RestClientException { + HttpEntity requestEntity = new HttpEntity(requestBody, headers); + return delete(url, requestEntity, responseType, uriVariables); + } + + /** + * 自定义请求头和请求体的DELETE请求调用方式 + * + * @param url 请求URL + * @param requestEntity 请求头和请求体封装对象 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, HttpEntity requestEntity, Class responseType, + Object... uriVariables) throws RestClientException { + return restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, responseType, uriVariables); + } + + /** + * 自定义请求头和请求体的DELETE请求调用方式 + * + * @param url 请求URL + * @param requestEntity 请求头和请求体封装对象 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity delete(String url, HttpEntity requestEntity, Class responseType, + Map uriVariables) throws RestClientException { + return restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, responseType, uriVariables); + } + + // ----------------------------------通用方法------------------------------------------------------- + + /** + * 通用调用方式 + * + * @param url 请求URL + * @param method 请求方法类型 + * @param requestEntity 请求头和请求体封装对象 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,按顺序依次对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity exchange(String url, HttpMethod method, HttpEntity requestEntity, + Class responseType, Object... uriVariables) throws RestClientException { + return restTemplate.exchange(url, method, requestEntity, responseType, uriVariables); + } + + /** + * 通用调用方式 + * + * @param url 请求URL + * @param method 请求方法类型 + * @param requestEntity 请求头和请求体封装对象 + * @param responseType 返回对象类型 + * @param uriVariables URL中的变量,与Map中的key对应 + * @return ResponseEntity 响应对象封装类 + */ + public ResponseEntity exchange(String url, HttpMethod method, HttpEntity requestEntity, + Class responseType, Map uriVariables) throws RestClientException { + return restTemplate.exchange(url, method, requestEntity, responseType, uriVariables); + } + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RsaUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RsaUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..3d54730586813e9436880e04f49dda6d1e5bcc4d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RsaUtils.java @@ -0,0 +1,148 @@ +package com.ruoyi.common.utils; + +import org.apache.commons.codec.binary.Base64; +import org.springframework.beans.factory.annotation.Value; + +import javax.crypto.Cipher; +import java.security.*; +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +/** + * RSA加密解密 + * + * @author ruoyi + **/ +public class RsaUtils +{ + // Rsa 私钥 静态取不到值 +// @Value("${login.privateKey}") + public static String privateKey="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMKqM8fJUnm70T53QIxjJzeYx1D9pz1Rl0X2jPYHGvpQMo1rH5mGf84BEqjMwDMfZylixviQY9hMc/OatuB6BsAILttMVIUUFKSi2+98Md35ht+DF81/9VvBzMyX8Tc4wfNEVuss7y/ejMD7bDYbKDRQBXoAaWJWtAcK4ogNhXQTAgMBAAECgYBAzlzytClK8aYVf6nzksbpkWk5o1hb55/O4OfIuFDY6H4L6o/YkphVwrGtlIyf+GJlusa21YsH5Vvsy6L6VGWOT/T1Q924zxwhPHFP8fzWrWJ60IT5jGDChJ1jls8GRWHgCnriQRMHU36eqENC5VZiYdfuulGN2bUNgMzUgmv9UQJBAOZio3CAQ+mwOsdRWixaput636qXoryleXiYrzGOulTzdYrRnJCIF3fE6H9uX5i2MwA3HtgTkN3qS4mtyBHvWP0CQQDYTt4KlkVJN3hsfV3qMk48zYE68lUg0umRaYXlQ0moLPO2P3wLFLLOq0jhWIwWz7ApIQXsR7x0RZOK2NadFFZPAkEA30Nh7klvBw2wuK3+/BLRxkxqavDOVZDq+dLFnPobWu4gz+m4l1w7mebqBWxaGi0fmarRKkcz0csXbxJJXBAepQJAKJtNpbEmGqOWMM+sJL4C3/k4TGeXwYy2mjy0DSD/n9moessaLz5YfuG60cr8qX+ds2rmoL+qyi0RkJw6VcyukwJAS5sxmn0YKbXw7GxDm7HmMcGuRYTo6ai+Olzk1GLwddTj56pfOgex+FF4FFyO33zzpEPeZbEzkbxkLC7Z8m0lWg=="; + /** + * 私钥解密 + * + * @param text 待解密的文本 + * @return 解密后的文本 + */ + public static String decryptByPrivateKey(String text) throws Exception + { + return decryptByPrivateKey(privateKey, text); + } + + /** + * 公钥解密 + * + * @param publicKeyString 公钥 + * @param text 待解密的信息 + * @return 解密后的文本 + */ + public static String decryptByPublicKey(String publicKeyString, String text) throws Exception + { + X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString)); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.DECRYPT_MODE, publicKey); + byte[] result = cipher.doFinal(Base64.decodeBase64(text)); + return new String(result); + } + + /** + * 私钥加密 + * + * @param privateKeyString 私钥 + * @param text 待加密的信息 + * @return 加密后的文本 + */ + public static String encryptByPrivateKey(String privateKeyString, String text) throws Exception + { + PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString)); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, privateKey); + byte[] result = cipher.doFinal(text.getBytes()); + return Base64.encodeBase64String(result); + } + + /** + * 私钥解密 + * + * @param privateKeyString 私钥 + * @param text 待解密的文本 + * @return 解密后的文本 + */ + public static String decryptByPrivateKey(String privateKeyString, String text) throws Exception + { + PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString)); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + byte[] result = cipher.doFinal(Base64.decodeBase64(text)); + return new String(result); + } + + /** + * 公钥加密 + * + * @param publicKeyString 公钥 + * @param text 待加密的文本 + * @return 加密后的文本 + */ + public static String encryptByPublicKey(String publicKeyString, String text) throws Exception + { + X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString)); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2); + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + byte[] result = cipher.doFinal(text.getBytes()); + return Base64.encodeBase64String(result); + } + + /** + * 构建RSA密钥对 + * + * @return 生成后的公私钥信息 + */ + public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException + { + KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); + keyPairGenerator.initialize(1024); + KeyPair keyPair = keyPairGenerator.generateKeyPair(); + RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic(); + RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate(); + String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded()); + String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded()); + return new RsaKeyPair(publicKeyString, privateKeyString); + } + + /** + * RSA密钥对对象 + */ + public static class RsaKeyPair + { + private final String publicKey; + private final String privateKey; + + public RsaKeyPair(String publicKey, String privateKey) + { + this.publicKey = publicKey; + this.privateKey = privateKey; + } + + public String getPublicKey() + { + return publicKey; + } + + public String getPrivateKey() + { + return privateKey; + } + } +} + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..a6f3d5386191f302d635eeb670dc354888a7cb08 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java @@ -0,0 +1,120 @@ +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; + +/** + * 安全服务工具类 + * + * @author ruoyi + */ +public class SecurityUtils +{ + /** + * 用户ID + **/ + public static Long getUserId() + { + try + { + return getLoginUser().getUserId(); + } + catch (Exception e) + { + throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取部门ID + **/ + public static Long getDeptId() + { + try + { + return getLoginUser().getDeptId(); + } + catch (Exception e) + { + throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户账户 + **/ + public static String getUsername() + { + try + { + return getLoginUser().getUsername(); + } + catch (Exception e) + { + throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户 + **/ + public static LoginUser getLoginUser() + { + try + { + return (LoginUser) getAuthentication().getPrincipal(); + } + catch (Exception e) + { + throw new ServiceException("获取用户信息异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取Authentication + */ + public static Authentication getAuthentication() + { + return SecurityContextHolder.getContext().getAuthentication(); + } + + /** + * 生成BCryptPasswordEncoder密码 + * + * @param password 密码 + * @return 加密字符串 + */ + public static String encryptPassword(String password) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.encode(password); + } + + /** + * 判断密码是否相同 + * + * @param rawPassword 真实密码 + * @param encodedPassword 加密后字符 + * @return 结果 + */ + 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) + { + return userId != null && 1L == userId; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..febb60340cd425d2527c24df106aa111710cfa8b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java @@ -0,0 +1,218 @@ +package com.ruoyi.common.utils; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import javax.servlet.ServletRequest; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.text.Convert; + +/** + * 客户端工具类 + * + * @author ruoyi + */ +public class ServletUtils +{ + /** + * 获取String参数 + */ + public static String getParameter(String name) + { + return getRequest().getParameter(name); + } + + /** + * 获取String参数 + */ + public static String getParameter(String name, String defaultValue) + { + return Convert.toStr(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name) + { + return Convert.toInt(getRequest().getParameter(name)); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name, Integer defaultValue) + { + return Convert.toInt(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取Boolean参数 + */ + public static Boolean getParameterToBool(String name) + { + return Convert.toBool(getRequest().getParameter(name)); + } + + /** + * 获取Boolean参数 + */ + public static Boolean getParameterToBool(String name, Boolean defaultValue) + { + return Convert.toBool(getRequest().getParameter(name), defaultValue); + } + + /** + * 获得所有请求参数 + * + * @param request 请求对象{@link ServletRequest} + * @return Map + */ + public static Map getParams(ServletRequest request) + { + final Map map = request.getParameterMap(); + return Collections.unmodifiableMap(map); + } + + /** + * 获得所有请求参数 + * + * @param request 请求对象{@link ServletRequest} + * @return Map + */ + public static Map getParamMap(ServletRequest request) + { + Map params = new HashMap<>(); + for (Map.Entry entry : getParams(request).entrySet()) + { + params.put(entry.getKey(), StringUtils.join(entry.getValue(), ",")); + } + return params; + } + + /** + * 获取request + */ + public static HttpServletRequest getRequest() + { + return getRequestAttributes().getRequest(); + } + + /** + * 获取response + */ + public static HttpServletResponse getResponse() + { + return getRequestAttributes().getResponse(); + } + + /** + * 获取session + */ + public static HttpSession getSession() + { + return getRequest().getSession(); + } + + public static ServletRequestAttributes getRequestAttributes() + { + RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); + return (ServletRequestAttributes) attributes; + } + + /** + * 将字符串渲染到客户端 + * + * @param response 渲染对象 + * @param string 待渲染的字符串 + */ + public static void renderString(HttpServletResponse response, String string) + { + try + { + response.setStatus(200); + response.setContentType("application/json"); + response.setCharacterEncoding("utf-8"); + response.getWriter().print(string); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + /** + * 是否是Ajax异步请求 + * + * @param request + */ + public static boolean isAjaxRequest(HttpServletRequest request) + { + String accept = request.getHeader("accept"); + if (accept != null && accept.contains("application/json")) + { + return true; + } + + String xRequestedWith = request.getHeader("X-Requested-With"); + if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest")) + { + return true; + } + + String uri = request.getRequestURI(); + if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) + { + return true; + } + + String ajax = request.getParameter("__ajax"); + return StringUtils.inStringIgnoreCase(ajax, "json", "xml"); + } + + /** + * 内容编码 + * + * @param str 内容 + * @return 编码后的内容 + */ + public static String urlEncode(String str) + { + try + { + return URLEncoder.encode(str, Constants.UTF8); + } + catch (UnsupportedEncodingException e) + { + return StringUtils.EMPTY; + } + } + + /** + * 内容解码 + * + * @param str 内容 + * @return 解码后的内容 + */ + public static String urlDecode(String str) + { + try + { + return URLDecoder.decode(str, Constants.UTF8); + } + catch (UnsupportedEncodingException e) + { + return StringUtils.EMPTY; + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..e364b8bc996118e25cd82a29a9550b4a102d71f7 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java @@ -0,0 +1,633 @@ +package com.ruoyi.common.utils; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.springframework.util.AntPathMatcher; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.text.StrFormatter; + +/** + * 字符串工具类 + * + * @author ruoyi + */ +public class StringUtils extends org.apache.commons.lang3.StringUtils { + /** + * 空字符串 + */ + private static final String NULLSTR = ""; + + /** + * 下划线 + */ + private static final char SEPARATOR = '_'; + + /** + * 获取参数不为空值 + * + * @param value defaultValue 要判断的value + * @return value 返回值 + */ + public static T nvl(T value, T defaultValue) { + return value != null ? value : defaultValue; + } + + /** + * * 判断一个Collection是否为空, 包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Collection coll) { + return isNull(coll) || coll.isEmpty(); + } + + /** + * * 判断一个Collection是否非空,包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Collection coll) { + return !isEmpty(coll); + } + + /** + * * 判断一个对象数组是否为空 + * + * @param objects 要判断的对象数组 + * * @return true:为空 false:非空 + */ + public static boolean isEmpty(Object[] objects) { + return isNull(objects) || (objects.length == 0); + } + + /** + * * 判断一个对象数组是否非空 + * + * @param objects 要判断的对象数组 + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Object[] objects) { + return !isEmpty(objects); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Map map) { + return isNull(map) || map.isEmpty(); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Map map) { + return !isEmpty(map); + } + + /** + * * 判断一个字符串是否为空串 + * + * @param str String + * @return true:为空 false:非空 + */ + public static boolean isEmpty(String str) { + return isNull(str) || NULLSTR.equals(str.trim()); + } + + /** + * * 判断一个字符串是否为非空串 + * + * @param str String + * @return true:非空串 false:空串 + */ + public static boolean isNotEmpty(String str) { + return !isEmpty(str); + } + + /** + * * 判断一个对象是否为空 + * + * @param object Object + * @return true:为空 false:非空 + */ + public static boolean isNull(Object object) { + return object == null; + } + + /** + * * 判断一个对象是否非空 + * + * @param object Object + * @return true:非空 false:空 + */ + public static boolean isNotNull(Object object) { + return !isNull(object); + } + + /** + * * 判断一个对象是否是数组类型(Java基本型别的数组) + * + * @param object 对象 + * @return true:是数组 false:不是数组 + */ + public static boolean isArray(Object object) { + return isNotNull(object) && object.getClass().isArray(); + } + + /** + * 去空格 + */ + public static String trim(String str) { + return (str == null ? "" : str.trim()); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @return 结果 + */ + public static String substring(final String str, int start) { + if (str == null) { + return NULLSTR; + } + + if (start < 0) { + start = str.length() + start; + } + + if (start < 0) { + start = 0; + } + if (start > str.length()) { + return NULLSTR; + } + + return str.substring(start); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @param end 结束 + * @return 结果 + */ + public static String substring(final String str, int start, int end) { + if (str == null) { + return NULLSTR; + } + + if (end < 0) { + end = str.length() + end; + } + if (start < 0) { + start = str.length() + start; + } + + if (end > str.length()) { + end = str.length(); + } + + if (start > end) { + return NULLSTR; + } + + if (start < 0) { + start = 0; + } + if (end < 0) { + end = 0; + } + + return str.substring(start, end); + } + + /** + * 格式化文本, {} 表示占位符
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param params 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... params) { + if (isEmpty(params) || isEmpty(template)) { + return template; + } + return StrFormatter.format(template, params); + } + + /** + * 是否为http(s)://开头 + * + * @param link 链接 + * @return 结果 + */ + public static boolean ishttp(String link) { + return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS); + } + + /** + * 字符串转set + * + * @param str 字符串 + * @param sep 分隔符 + * @return set集合 + */ + public static final Set str2Set(String str, String sep) { + return new HashSet(str2List(str, sep, true, false)); + } + + /** + * 字符串转list + * + * @param str 字符串 + * @param sep 分隔符 + * @param filterBlank 过滤纯空白 + * @param trim 去掉首尾空白 + * @return list集合 + */ + public static final List str2List(String str, String sep, boolean filterBlank, boolean trim) { + List list = new ArrayList(); + if (StringUtils.isEmpty(str)) { + return list; + } + + // 过滤空白字符串 + if (filterBlank && StringUtils.isBlank(str)) { + return list; + } + String[] split = str.split(sep); + for (String string : split) { + if (filterBlank && StringUtils.isBlank(string)) { + continue; + } + if (trim) { + string = string.trim(); + } + list.add(string); + } + + return list; + } + + /** + * 判断给定的set列表中是否包含数组array 判断给定的数组array中是否包含给定的元素value + * + * @param collection 给定的集合 + * @param array 给定的数组 + * @return boolean 结果 + */ + public static boolean containsAny(Collection collection, String... array) { + if (isEmpty(collection) || isEmpty(array)) { + return false; + } else { + for (String str : array) { + if (collection.contains(str)) { + return true; + } + } + return false; + } + } + + /** + * 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写 + * + * @param cs 指定字符串 + * @param searchCharSequences 需要检查的字符串数组 + * @return 是否包含任意一个字符串 + */ + public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) { + if (isEmpty(cs) || isEmpty(searchCharSequences)) { + return false; + } + for (CharSequence testStr : searchCharSequences) { + if (containsIgnoreCase(cs, testStr)) { + return true; + } + } + return false; + } + + /** + * 驼峰转下划线命名 + */ + public static String toUnderScoreCase(String str) { + if (str == null) { + return null; + } + StringBuilder sb = new StringBuilder(); + // 前置字符是否大写 + boolean preCharIsUpperCase = true; + // 当前字符是否大写 + boolean curreCharIsUpperCase = true; + // 下一字符是否大写 + boolean nexteCharIsUpperCase = true; + for (int i = 0; i < str.length(); i++) { + char c = str.charAt(i); + if (i > 0) { + preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); + } else { + preCharIsUpperCase = false; + } + + curreCharIsUpperCase = Character.isUpperCase(c); + + if (i < (str.length() - 1)) { + nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); + } + + if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) { + sb.append(SEPARATOR); + } else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) { + sb.append(SEPARATOR); + } + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 是否包含字符串 + * + * @param str 验证字符串 + * @param strs 字符串组 + * @return 包含返回true + */ + public static boolean inStringIgnoreCase(String str, String... strs) { + if (str != null && strs != null) { + for (String s : strs) { + if (str.equalsIgnoreCase(trim(s))) { + return true; + } + } + } + return false; + } + + /** + * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld + * + * @param name 转换前的下划线大写方式命名的字符串 + * @return 转换后的驼峰式命名的字符串 + */ + public static String convertToCamelCase(String name) { + StringBuilder result = new StringBuilder(); + // 快速检查 + if (name == null || name.isEmpty()) { + // 没必要转换 + return ""; + } else if (!name.contains("_")) { + // 不含下划线,仅将首字母大写 + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + // 用下划线将原始字符串分割 + String[] camels = name.split("_"); + for (String camel : camels) { + // 跳过原始字符串中开头、结尾的下换线或双重下划线 + if (camel.isEmpty()) { + continue; + } + // 首字母大写 + result.append(camel.substring(0, 1).toUpperCase()); + result.append(camel.substring(1).toLowerCase()); + } + return result.toString(); + } + + /** + * 驼峰式命名法 例如:user_name->userName + */ + public static String toCamelCase(String s) { + if (s == null) { + return null; + } + s = s.toLowerCase(); + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + + if (c == SEPARATOR) { + upperCase = true; + } else if (upperCase) { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } else { + sb.append(c); + } + } + return sb.toString(); + } + + /** + * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串 + * + * @param str 指定字符串 + * @param strs 需要检查的字符串数组 + * @return 是否匹配 + */ + public static boolean matches(String str, List strs) { + if (isEmpty(str) || isEmpty(strs)) { + return false; + } + for (String pattern : strs) { + if (isMatch(pattern, str)) { + return true; + } + } + return false; + } + + /** + * 判断url是否与规则配置: + * ? 表示单个字符; + * * 表示一层路径内的任意字符串,不可跨层级; + * ** 表示任意层路径; + * + * @param pattern 匹配规则 + * @param url 需要匹配的url + * @return + */ + public static boolean isMatch(String pattern, String url) { + AntPathMatcher matcher = new AntPathMatcher(); + return matcher.match(pattern, url); + } + + @SuppressWarnings("unchecked") + public static T cast(Object obj) { + return (T) obj; + } + + /** + * 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。 + * + * @param num 数字对象 + * @param size 字符串指定长度 + * @return 返回数字的字符串格式,该字符串为指定长度。 + */ + public static final String padl(final Number num, final int size) { + return padl(num.toString(), size, '0'); + } + + // 日期校验 + public static boolean isDate(String value, String format) { + + if (isEmpty(value) || isEmpty(format)) { + return false; + } + + try { + SimpleDateFormat sdf = new SimpleDateFormat(format); + //sdf.setLenient(false);//严格parse时,分钟为0会parse为null,比如2015/11/11 3:00:00失败 + Date date = sdf.parse(value); + if (date == null) { + return false; + } else { + //反向验证,使得检测出2011/21/11不合法 + return value.equals(sdf.format(date)); + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } + + } + + private static final Pattern pPositiveInt = Pattern.compile("[1-9][0-9]*"); + + //非负整数 + public static boolean isUnNegativeInt(String str) { + return "0".equals(str) || isPositiveInt(str); + } + + //正整数 + public static boolean isPositiveInt(String str) { + + if (null == str || "".equals(str) || "null".equals(str)) { + return false; + } + Matcher m = pPositiveInt.matcher(str); + return m.matches(); + + } + + private static final Pattern pNumCode = Pattern.compile("[0-9][0-9]*"); + + //数字编码 + public static boolean isNumCode(String str) { + + if (null == str || "".equals(str) || "null".equals(str)) { + return false; + } + Matcher m = pNumCode.matcher(str); + return m.matches(); + + } + + /** + * 校验是否是手机号 + * + * @param str 字符串 + * @return 校验结果 + */ + public static boolean isPhone(String str) { + if (null == str || "".equals(str) || "null".equals(str)) { + return false; + } + Matcher m = Pattern.compile("^1[3-9][0-9]{9}$").matcher(str); + return m.matches(); + } + + /** + * 是否是数字,包括小数 + * + * @param str + * @return + */ + public static boolean isNum(String str) { + if (null == str || "".equals(str) || "null".equals(str)) { + return false; + } + Pattern pattern = Pattern.compile("[-+]?([1-9]+[0-9]*|0)(\\.[\\d]+)?"); + Matcher isNum = pattern.matcher(str); + return isNum.matches(); + + } + + /** + * 是否是整数 + * + * @param str + * @return + */ + public static boolean isInt(String str) { + + if (null == str || "".equals(str) || "null".equals(str)) + return false; + Pattern pattern = Pattern.compile("[-+]?[0-9]*"); + Matcher isInt = pattern.matcher(str); + if (!isInt.matches()) { + return false; + } + return true; + + } + + /** + * 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。 + * + * @param s 原始字符串 + * @param size 字符串指定长度 + * @param c 用于补齐的字符 + * @return 返回指定长度的字符串,由原字符串左补齐或截取得到。 + */ + public static final String padl(final String s, final int size, final char c) { + final StringBuilder sb = new StringBuilder(size); + if (s != null) { + final int len = s.length(); + if (s.length() <= size) { + for (int i = size - len; i > 0; i--) { + sb.append(c); + } + sb.append(s); + } else { + return s.substring(len - size, len); + } + } else { + for (int i = size; i > 0; i--) { + sb.append(c); + } + } + return sb.toString(); + } + + public static final String nonNullString(Object o) { + if (isNull(o)) { + return ""; + } else { + return String.valueOf(o); + } + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java new file mode 100644 index 0000000000000000000000000000000000000000..71fe6d52efb92d9732dfb7b2ea28e06ad952e351 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java @@ -0,0 +1,99 @@ +package com.ruoyi.common.utils; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 线程相关工具类. + * + * @author ruoyi + */ +public class Threads +{ + private static final Logger logger = LoggerFactory.getLogger(Threads.class); + + /** + * sleep等待,单位为毫秒 + */ + public static void sleep(long milliseconds) + { + try + { + Thread.sleep(milliseconds); + } + catch (InterruptedException e) + { + return; + } + } + + /** + * 停止线程池 + * 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务. + * 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数. + * 如果仍然超時,則強制退出. + * 另对在shutdown时线程本身被调用中断做了处理. + */ + public static void shutdownAndAwaitTermination(ExecutorService pool) + { + if (pool != null && !pool.isShutdown()) + { + pool.shutdown(); + try + { + if (!pool.awaitTermination(120, TimeUnit.SECONDS)) + { + pool.shutdownNow(); + if (!pool.awaitTermination(120, TimeUnit.SECONDS)) + { + logger.info("Pool did not terminate"); + } + } + } + catch (InterruptedException ie) + { + pool.shutdownNow(); + Thread.currentThread().interrupt(); + } + } + } + + /** + * 打印线程异常信息 + */ + public static void printException(Runnable r, Throwable t) + { + if (t == null && r instanceof Future) + { + try + { + Future future = (Future) r; + if (future.isDone()) + { + future.get(); + } + } + catch (CancellationException ce) + { + t = ce; + } + catch (ExecutionException ee) + { + t = ee.getCause(); + } + catch (InterruptedException ie) + { + Thread.currentThread().interrupt(); + } + } + if (t != null) + { + logger.error(t.getMessage(), t); + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ZipUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ZipUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..bdb33e43576493f8fede73255ffc5cfc342c8c83 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ZipUtils.java @@ -0,0 +1,84 @@ +package com.ruoyi.common.utils; + +import java.io.*; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * @author yqf + * @date 2023/6/6 + */ +public class ZipUtils { + + /** + * 需要压缩的文件 例如 ["/woke/file/1.jpg", "/woke/file/2.jpg"...] + * @param files + * @param zipFile + */ + public static void zip(String[] files, File zipFile) { + + FileInputStream fileInputStream = null; + FileOutputStream fileOutputStream = null; + ZipOutputStream zipOutputStream = null; + BufferedInputStream bufferInputStream = null; + try { + // zipFileName为压缩文件的名称(xx.zip),首先在某个目录下(C:/temp/路径可以根据自己的需求进行修改)创建一个.zip结尾的文件 + fileOutputStream = new FileOutputStream(zipFile); + zipOutputStream = new ZipOutputStream(new BufferedOutputStream(fileOutputStream)); + // 创建读写缓冲区 + byte[] bufs = new byte[1024 * 10]; + for (String file : files) { + File voiceFile = new File(file); + if (voiceFile.exists()) { + ZipEntry zipEntry; + // 压缩文件下的目录分级,如果不分目录可以直接用fileName.文件后缀 + zipEntry = new ZipEntry("pRRU_topo_config." + getFileExtension(voiceFile)); + + // 创建ZIP实体,并添加进压缩包 + zipOutputStream.putNextEntry(zipEntry); + + // 读取待压缩的文件并写进压缩包里 + fileInputStream = new FileInputStream(voiceFile); + bufferInputStream = new BufferedInputStream(fileInputStream, 1024 * 10); + int read = 0; + while ((read = bufferInputStream.read(bufs, 0, 1024 * 10)) != -1) { + zipOutputStream.write(bufs, 0, read); + } + + } + + } + + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (bufferInputStream != null) { + bufferInputStream.close(); + } + if (zipOutputStream != null) { + zipOutputStream.close(); + } + + } catch (IOException e) { + e.printStackTrace(); + } + + } + } + + + /** + * 获取文件后缀名 + * @param file + * @return + */ + private static String getFileExtension(File file) { + String fileName = file.getName(); + if (fileName.lastIndexOf(".") != -1 && fileName.lastIndexOf(".") != 0) + return fileName.substring(fileName.lastIndexOf(".") + 1); + else return " "; + } + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..4463662d4c195212b82c6d861c3a149f7909291b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanUtils.java @@ -0,0 +1,110 @@ +package com.ruoyi.common.utils.bean; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Bean 工具类 + * + * @author ruoyi + */ +public class BeanUtils extends org.springframework.beans.BeanUtils +{ + /** Bean方法名中属性名开始的下标 */ + private static final int BEAN_METHOD_PROP_INDEX = 3; + + /** * 匹配getter方法的正则表达式 */ + private static final Pattern GET_PATTERN = Pattern.compile("get(\\p{javaUpperCase}\\w*)"); + + /** * 匹配setter方法的正则表达式 */ + private static final Pattern SET_PATTERN = Pattern.compile("set(\\p{javaUpperCase}\\w*)"); + + /** + * Bean属性复制工具方法。 + * + * @param dest 目标对象 + * @param src 源对象 + */ + public static void copyBeanProp(Object dest, Object src) + { + try + { + copyProperties(src, dest); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + /** + * 获取对象的setter方法。 + * + * @param obj 对象 + * @return 对象的setter方法列表 + */ + public static List getSetterMethods(Object obj) + { + // setter方法列表 + List setterMethods = new ArrayList(); + + // 获取所有方法 + Method[] methods = obj.getClass().getMethods(); + + // 查找setter方法 + + for (Method method : methods) + { + Matcher m = SET_PATTERN.matcher(method.getName()); + if (m.matches() && (method.getParameterTypes().length == 1)) + { + setterMethods.add(method); + } + } + // 返回setter方法列表 + return setterMethods; + } + + /** + * 获取对象的getter方法。 + * + * @param obj 对象 + * @return 对象的getter方法列表 + */ + + public static List getGetterMethods(Object obj) + { + // getter方法列表 + List getterMethods = new ArrayList(); + // 获取所有方法 + Method[] methods = obj.getClass().getMethods(); + // 查找getter方法 + for (Method method : methods) + { + Matcher m = GET_PATTERN.matcher(method.getName()); + if (m.matches() && (method.getParameterTypes().length == 0)) + { + getterMethods.add(method); + } + } + // 返回getter方法列表 + return getterMethods; + } + + /** + * 检查Bean方法名中的属性名是否相等。
+ * 如getName()和setName()属性名一样,getName()和setAge()属性名不一样。 + * + * @param m1 方法名1 + * @param m2 方法名2 + * @return 属性名一样返回true,否则返回false + */ + + public static boolean isMethodPropEquals(String m1, String m2) + { + return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX)); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanValidators.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanValidators.java new file mode 100644 index 0000000000000000000000000000000000000000..80bfed7b414cb815847191e0d3eb57e86134394d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/BeanValidators.java @@ -0,0 +1,24 @@ +package com.ruoyi.common.utils.bean; + +import java.util.Set; +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.Validator; + +/** + * bean对象属性验证 + * + * @author ruoyi + */ +public class BeanValidators +{ + public static void validateWithException(Validator validator, Object object, Class... groups) + throws ConstraintViolationException + { + Set> constraintViolations = validator.validate(object, groups); + if (!constraintViolations.isEmpty()) + { + throw new ConstraintViolationException(constraintViolations); + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..68130b9c923ae4bef3175b78e1eb5ab9a7e1e07e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java @@ -0,0 +1,76 @@ +package com.ruoyi.common.utils.file; + +import java.io.File; +import org.apache.commons.lang3.StringUtils; + +/** + * 文件类型工具类 + * + * @author ruoyi + */ +public class FileTypeUtils +{ + /** + * 获取文件类型 + *

+ * 例如: ruoyi.txt, 返回: txt + * + * @param file 文件名 + * @return 后缀(不含".") + */ + public static String getFileType(File file) + { + if (null == file) + { + return StringUtils.EMPTY; + } + return getFileType(file.getName()); + } + + /** + * 获取文件类型 + *

+ * 例如: ruoyi.txt, 返回: txt + * + * @param fileName 文件名 + * @return 后缀(不含".") + */ + public static String getFileType(String fileName) + { + int separatorIndex = fileName.lastIndexOf("."); + if (separatorIndex < 0) + { + return ""; + } + return fileName.substring(separatorIndex + 1).toLowerCase(); + } + + /** + * 获取文件类型 + * + * @param photoByte 文件字节码 + * @return 后缀(不含".") + */ + public static String getFileExtendName(byte[] photoByte) + { + String strFileExtendName = "JPG"; + if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) + && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) + { + strFileExtendName = "GIF"; + } + else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) + { + strFileExtendName = "JPG"; + } + else if ((photoByte[0] == 66) && (photoByte[1] == 77)) + { + strFileExtendName = "BMP"; + } + else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) + { + strFileExtendName = "PNG"; + } + return strFileExtendName; + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..4365253b63f004fc4fd7fae0f7c81c2bf3c6cb01 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -0,0 +1,319 @@ +package com.ruoyi.common.utils.file; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.Objects; + +import cn.hutool.core.util.RandomUtil; +import org.apache.commons.io.FilenameUtils; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.common.config.MinioConfig; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException; +import com.ruoyi.common.exception.file.FileSizeLimitExceededException; +import com.ruoyi.common.exception.file.InvalidExtensionException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.uuid.Seq; + +/** + * 文件上传工具类 + * + * @author ruoyi + */ +public class FileUploadUtils +{ + /** + * 默认大小 50M + */ + public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024; + + /** + * 默认的文件名最大长度 100 + */ + public static final int DEFAULT_FILE_NAME_LENGTH = 100; + + /** + * 本地默认上传的地址 + */ + private static String defaultBaseDir = RuoYiConfig.getProfile(); + + /** + * Minio默认上传的地址 + */ + private static String bucketName = MinioConfig.getBucketName(); + + public static void setDefaultBaseDir(String defaultBaseDir) + { + FileUploadUtils.defaultBaseDir = defaultBaseDir; + } + + public static String getDefaultBaseDir() + { + return defaultBaseDir; + } + + public static String getBucketName() + { + return bucketName; + } + + /** + * 以默认配置进行文件上传 + * + * @param file 上传的文件 + * @return 文件名称 + * @throws Exception + */ + public static final String upload(MultipartFile file) throws IOException + { + try + { + return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + /** + * 根据文件路径上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @return 文件名称 + * @throws IOException + */ + public static final String upload(String baseDir, MultipartFile file) throws IOException + { + try + { + return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + /** + * 文件上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @param allowedExtension 上传文件类型 + * @return 返回上传成功的文件名 + * @throws FileSizeLimitExceededException 如果超出最大大小 + * @throws FileNameLengthLimitExceededException 文件名太长 + * @throws IOException 比如读写文件出错时 + * @throws InvalidExtensionException 文件校验异常 + */ + public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, + InvalidExtensionException + { + int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length(); + if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) + { + throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); + } + + assertAllowed(file, allowedExtension); + + String fileName = extractFilename(file); + + String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); + file.transferTo(Paths.get(absPath)); + return getPathFileName(baseDir, fileName); + } + + /** + * 以默认BucketName配置上传到Minio服务器 + * + * @param file 上传的文件 + * @return 文件名称 + * @throws Exception + */ + public static final String uploadMinio(MultipartFile file) throws IOException + { + try + { + return uploadMinio(getBucketName(),file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + /** + * 自定义bucketName配置上传到Minio服务器 + * + * @param file 上传的文件 + * @return 文件名称 + * @throws Exception + */ + public static final String uploadMinio(String bucketName,MultipartFile file) throws IOException + { + try + { + return uploadMinio(bucketName,file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + public static final String uploadMinio(MultipartFile file,String[] allowedExtension) throws IOException + { + try + { + return uploadMinio(getBucketName(),file, allowedExtension); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + public static final String uploadMinio(String bucketName, MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, + InvalidExtensionException + { + int fileNamelength = file.getOriginalFilename().length(); + if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) + { + throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); + } + assertAllowed(file, allowedExtension); + try + { + String fileName = extractFilename(file); + String pathFileName = MinioUtil.uploadFile(bucketName, fileName, file); + return pathFileName; + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + /** + * 编码文件名 + */ + public static final String extractFilename(MultipartFile file) + { + return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(), + FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file)); +// return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(), +// FilenameUtils.getBaseName(RandomUtil.randomNumbers(16)), Seq.getId(Seq.uploadSeqType), getExtension(file)); + } + + public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException + { + File desc = new File(uploadDir + File.separator + fileName); + + if (!desc.exists()) + { + if (!desc.getParentFile().exists()) + { + desc.getParentFile().mkdirs(); + } + } + return desc; + } + + public static final String getPathFileName(String uploadDir, String fileName) throws IOException + { + int dirLastIndex = RuoYiConfig.getProfile().length() + 1; + String currentDir = StringUtils.substring(uploadDir, dirLastIndex); + return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName; + } + + /** + * 文件大小校验 + * + * @param file 上传的文件 + * @return + * @throws FileSizeLimitExceededException 如果超出最大大小 + * @throws InvalidExtensionException + */ + public static final void assertAllowed(MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, InvalidExtensionException + { + long size = file.getSize(); + if (size > DEFAULT_MAX_SIZE) + { + throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); + } + + String fileName = file.getOriginalFilename(); + String extension = getExtension(file); + if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) + { + if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) + { + throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, + fileName); + } + else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) + { + throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, + fileName); + } + else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) + { + throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, + fileName); + } + else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) + { + throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, + fileName); + } + else + { + throw new InvalidExtensionException(allowedExtension, extension, fileName); + } + } + } + + /** + * 判断MIME类型是否是允许的MIME类型 + * + * @param extension + * @param allowedExtension + * @return + */ + public static final boolean isAllowedExtension(String extension, String[] allowedExtension) + { + for (String str : allowedExtension) + { + if (str.equalsIgnoreCase(extension)) + { + return true; + } + } + return false; + } + + /** + * 获取文件名的后缀 + * + * @param file 表单文件 + * @return 后缀名 + */ + public static final String getExtension(MultipartFile file) + { + String extension = FilenameUtils.getExtension(file.getOriginalFilename()); + if (StringUtils.isEmpty(extension)) + { + extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType())); + } + return extension; + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..f8442702db9ea7671e9e7bdaf300ba391776fe7c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java @@ -0,0 +1,293 @@ +package com.ruoyi.common.utils.file; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.ArrayUtils; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.uuid.IdUtils; +import org.apache.commons.io.FilenameUtils; + +/** + * 文件处理工具类 + * + * @author ruoyi + */ +public class FileUtils +{ + public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; + + /** + * 输出指定文件的byte数组 + * + * @param filePath 文件路径 + * @param os 输出流 + * @return + */ + public static void writeBytes(String filePath, OutputStream os) throws IOException + { + FileInputStream fis = null; + try + { + File file = new File(filePath); + if (!file.exists()) + { + throw new FileNotFoundException(filePath); + } + fis = new FileInputStream(file); + byte[] b = new byte[1024]; + int length; + while ((length = fis.read(b)) > 0) + { + os.write(b, 0, length); + } + } + catch (IOException e) + { + throw e; + } + finally + { + IOUtils.close(os); + IOUtils.close(fis); + } + } + + /** + * 写数据到文件中 + * + * @param data 数据 + * @return 目标文件 + * @throws IOException IO异常 + */ + public static String writeImportBytes(byte[] data) throws IOException + { + return writeBytes(data, RuoYiConfig.getImportPath()); + } + + /** + * 写数据到文件中 + * + * @param data 数据 + * @param uploadDir 目标文件 + * @return 目标文件 + * @throws IOException IO异常 + */ + public static String writeBytes(byte[] data, String uploadDir) throws IOException + { + FileOutputStream fos = null; + String pathName = ""; + try + { + String extension = getFileExtendName(data); + pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension; + File file = FileUploadUtils.getAbsoluteFile(uploadDir, pathName); + fos = new FileOutputStream(file); + fos.write(data); + } + finally + { + IOUtils.close(fos); + } + return FileUploadUtils.getPathFileName(uploadDir, pathName); + } + + /** + * 删除文件 + * + * @param filePath 文件 + * @return + */ + public static boolean deleteFile(String filePath) + { + boolean flag = false; + File file = new File(filePath); + // 路径为文件且不为空则进行删除 + if (file.isFile() && file.exists()) + { + file.delete(); + flag = true; + } + return flag; + } + + /** + * 文件名称验证 + * + * @param filename 文件名称 + * @return true 正常 false 非法 + */ + public static boolean isValidFilename(String filename) + { + return filename.matches(FILENAME_PATTERN); + } + + /** + * 检查文件是否可下载 + * + * @param resource 需要下载的文件 + * @return true 正常 false 非法 + */ + public static boolean checkAllowDownload(String resource) + { + // 禁止目录上跳级别 + if (StringUtils.contains(resource, "..")) + { + return false; + } + + // 检查允许下载的文件规则 + if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource))) + { + return true; + } + + // 不在允许下载的文件规则 + return false; + } + + /** + * 下载文件名重新编码 + * + * @param request 请求对象 + * @param fileName 文件名 + * @return 编码后的文件名 + */ + public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException + { + final String agent = request.getHeader("USER-AGENT"); + String filename = fileName; + if (agent.contains("MSIE")) + { + // IE浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + filename = filename.replace("+", " "); + } + else if (agent.contains("Firefox")) + { + // 火狐浏览器 + filename = new String(fileName.getBytes(), "ISO8859-1"); + } + else if (agent.contains("Chrome")) + { + // google浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + } + else + { + // 其它浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + } + return filename; + } + + /** + * 下载文件名重新编码 + * + * @param response 响应对象 + * @param realFileName 真实文件名 + */ + public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException + { + String percentEncodedFileName = percentEncode(realFileName); + + StringBuilder contentDispositionValue = new StringBuilder(); + contentDispositionValue.append("attachment; filename=") + .append(percentEncodedFileName) + .append(";") + .append("filename*=") + .append("utf-8''") + .append(percentEncodedFileName); + + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename"); + response.setHeader("Content-disposition", contentDispositionValue.toString()); + response.setHeader("download-filename", percentEncodedFileName); + } + + /** + * 百分号编码工具方法 + * + * @param s 需要百分号编码的字符串 + * @return 百分号编码后的字符串 + */ + public static String percentEncode(String s) throws UnsupportedEncodingException + { + String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); + return encode.replaceAll("\\+", "%20"); + } + + /** + * 获取图像后缀 + * + * @param photoByte 图像数据 + * @return 后缀名 + */ + public static String getFileExtendName(byte[] photoByte) + { + String strFileExtendName = "jpg"; + if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) + && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) + { + strFileExtendName = "gif"; + } + else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) + { + strFileExtendName = "jpg"; + } + else if ((photoByte[0] == 66) && (photoByte[1] == 77)) + { + strFileExtendName = "bmp"; + } + else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) + { + strFileExtendName = "png"; + } + return strFileExtendName; + } + + /** + * 获取文件名称 /profile/upload/2022/04/16/ruoyi.png -- ruoyi.png + * + * @param fileName 路径名称 + * @return 没有文件路径的名称 + */ + public static String getName(String fileName) + { + if (fileName == null) + { + return null; + } + int lastUnixPos = fileName.lastIndexOf('/'); + int lastWindowsPos = fileName.lastIndexOf('\\'); + int index = Math.max(lastUnixPos, lastWindowsPos); + return fileName.substring(index + 1); + } + + /** + * 获取不带后缀文件名称 /profile/upload/2022/04/16/ruoyi.png -- ruoyi + * + * @param fileName 路径名称 + * @return 没有文件路径和后缀的名称 + */ + public static String getNameNotSuffix(String fileName) + { + if (fileName == null) + { + return null; + } + String baseName = FilenameUtils.getBaseName(fileName); + return baseName; + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..432dfda6f7004596e022d5db1c6643ac320d5c21 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java @@ -0,0 +1,98 @@ +package com.ruoyi.common.utils.file; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.util.Arrays; +import org.apache.poi.util.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.utils.StringUtils; + +/** + * 图片处理工具类 + * + * @author ruoyi + */ +public class ImageUtils +{ + private static final Logger log = LoggerFactory.getLogger(ImageUtils.class); + + public static byte[] getImage(String imagePath) + { + InputStream is = getFile(imagePath); + try + { + return IOUtils.toByteArray(is); + } + catch (Exception e) + { + log.error("图片加载异常 {}", e); + return null; + } + finally + { + IOUtils.closeQuietly(is); + } + } + + public static InputStream getFile(String imagePath) + { + try + { + byte[] result = readFile(imagePath); + result = Arrays.copyOf(result, result.length); + return new ByteArrayInputStream(result); + } + catch (Exception e) + { + log.error("获取图片异常 {}", e); + } + return null; + } + + /** + * 读取文件为字节数据 + * + * @param url 地址 + * @return 字节数据 + */ + public static byte[] readFile(String url) + { + InputStream in = null; + try + { + if (url.startsWith("http")) + { + // 网络地址 + URL urlObj = new URL(url); + URLConnection urlConnection = urlObj.openConnection(); + urlConnection.setConnectTimeout(30 * 1000); + urlConnection.setReadTimeout(60 * 1000); + urlConnection.setDoInput(true); + in = urlConnection.getInputStream(); + } + else + { + // 本机地址 + String localPath = RuoYiConfig.getProfile(); + String downloadPath = localPath + StringUtils.substringAfter(url, Constants.RESOURCE_PREFIX); + in = new FileInputStream(downloadPath); + } + return IOUtils.toByteArray(in); + } + catch (Exception e) + { + log.error("获取文件路径异常 {}", e); + return null; + } + finally + { + IOUtils.closeQuietly(in); + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..8fb163c48d627f6814c1ee2c6b29e082808cbc70 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java @@ -0,0 +1,59 @@ +package com.ruoyi.common.utils.file; + +/** + * 媒体类型工具类 + * + * @author ruoyi + */ +public class MimeTypeUtils +{ + public static final String IMAGE_PNG = "image/png"; + + public static final String IMAGE_JPG = "image/jpg"; + + public static final String IMAGE_JPEG = "image/jpeg"; + + public static final String IMAGE_BMP = "image/bmp"; + + public static final String IMAGE_GIF = "image/gif"; + + public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; + + public static final String[] FLASH_EXTENSION = { "swf", "flv" }; + + public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", + "asf", "rm", "rmvb" }; + + public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; + + public static final String[] DEFAULT_ALLOWED_EXTENSION = { + // 图片 + "bmp", "gif", "jpg", "jpeg", "png", "json", + // word excel powerpoint + "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", + // 压缩文件 + "rar", "zip", "gz", "bz2", + // 视频格式 + "mp4", "avi", "rmvb", + // pdf + "pdf" }; + + public static String getExtension(String prefix) + { + switch (prefix) + { + case IMAGE_PNG: + return "png"; + case IMAGE_JPG: + return "jpg"; + case IMAGE_JPEG: + return "jpeg"; + case IMAGE_BMP: + return "bmp"; + case IMAGE_GIF: + return "gif"; + default: + return ""; + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MinioUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MinioUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..30ea4b140ab10a66c125ce6272b2b9c393860923 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MinioUtil.java @@ -0,0 +1,43 @@ +package com.ruoyi.common.utils.file; + +import java.io.IOException; +import java.io.InputStream; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import io.minio.GetPresignedObjectUrlArgs; +import io.minio.MinioClient; +import io.minio.PutObjectArgs; +import io.minio.http.Method; + +/** + * Minio 文件存储工具类 + * + * @author ruoyi + */ +public class MinioUtil +{ + /** + * 上传文件 + * + * @param bucketName 桶名称 + * @param fileName + * @throws IOException + */ + public static String uploadFile(String bucketName, String fileName, MultipartFile multipartFile) throws IOException + { + String url = ""; + MinioClient minioClient = SpringUtils.getBean(MinioClient.class); + try (InputStream inputStream = multipartFile.getInputStream()) + { + minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(inputStream, multipartFile.getSize(), -1).contentType(multipartFile.getContentType()).build()); + url = minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(fileName).method(Method.GET).build()); + url = url.substring(0, url.indexOf('?')); + return ServletUtils.urlDecode(url); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/XmlDocToDocxUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/XmlDocToDocxUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..bccfcdb7dd44ef2347f879e9200e74b907360ca3 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/XmlDocToDocxUtil.java @@ -0,0 +1,41 @@ +package com.ruoyi.common.utils.file; + +import com.ruoyi.common.constant.WordConstants; +import org.docx4j.Docx4J; +import org.docx4j.openpackaging.packages.WordprocessingMLPackage; + + +import java.io.FileInputStream; +import java.io.FileOutputStream; + +/** + * 转换xml格式的doc文档为docx + */ +public class XmlDocToDocxUtil { + + + private XmlDocToDocxUtil(){}; + /** + * 转换执行方法,转换后和原始路径 + * @param xmlPath 原始路径 + */ + public static boolean invoke(String xmlPath){ + + //DOC文档才转换 + String docxPath = xmlPath.replaceAll(WordConstants.CONVERT_SUF,WordConstants.DOCX_SUF); + try(FileInputStream inputStream = new FileInputStream(xmlPath);){ + + WordprocessingMLPackage wmlPackage = Docx4J.load(inputStream); + //转换为DOCX + try(FileOutputStream docx = new FileOutputStream(docxPath);){ + Docx4J.save(wmlPackage, docx, Docx4J.FLAG_SAVE_ZIP_FILE); + xmlPath = docxPath; + } + } catch (Exception e) { + System.out.println(xmlPath+":不需要转换:"+e.getLocalizedMessage()); + } + +// System.out.println("WORD 路径:"+xmlPath); + return true; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..f52e83e51f67535498ed914e93ebb034591c2cd7 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/EscapeUtil.java @@ -0,0 +1,167 @@ +package com.ruoyi.common.utils.html; + +import com.ruoyi.common.utils.StringUtils; + +/** + * 转义和反转义工具类 + * + * @author ruoyi + */ +public class EscapeUtil +{ + public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)"; + + private static final char[][] TEXT = new char[64][]; + + static + { + for (int i = 0; i < 64; i++) + { + TEXT[i] = new char[] { (char) i }; + } + + // special HTML characters + TEXT['\''] = "'".toCharArray(); // 单引号 + TEXT['"'] = """.toCharArray(); // 双引号 + TEXT['&'] = "&".toCharArray(); // &符 + TEXT['<'] = "<".toCharArray(); // 小于号 + TEXT['>'] = ">".toCharArray(); // 大于号 + } + + /** + * 转义文本中的HTML字符为安全的字符 + * + * @param text 被转义的文本 + * @return 转义后的文本 + */ + public static String escape(String text) + { + return encode(text); + } + + /** + * 还原被转义的HTML特殊字符 + * + * @param content 包含转义符的HTML内容 + * @return 转换后的字符串 + */ + public static String unescape(String content) + { + return decode(content); + } + + /** + * 清除所有HTML标签,但是不删除标签内的内容 + * + * @param content 文本 + * @return 清除标签后的文本 + */ + public static String clean(String content) + { + return new HTMLFilter().filter(content); + } + + /** + * Escape编码 + * + * @param text 被编码的文本 + * @return 编码后的字符 + */ + private static String encode(String text) + { + if (StringUtils.isEmpty(text)) + { + return StringUtils.EMPTY; + } + + final StringBuilder tmp = new StringBuilder(text.length() * 6); + char c; + for (int i = 0; i < text.length(); i++) + { + c = text.charAt(i); + if (c < 256) + { + tmp.append("%"); + if (c < 16) + { + tmp.append("0"); + } + tmp.append(Integer.toString(c, 16)); + } + else + { + tmp.append("%u"); + if (c <= 0xfff) + { + // issue#I49JU8@Gitee + tmp.append("0"); + } + tmp.append(Integer.toString(c, 16)); + } + } + return tmp.toString(); + } + + /** + * Escape解码 + * + * @param content 被转义的内容 + * @return 解码后的字符串 + */ + public static String decode(String content) + { + if (StringUtils.isEmpty(content)) + { + return content; + } + + StringBuilder tmp = new StringBuilder(content.length()); + int lastPos = 0, pos = 0; + char ch; + while (lastPos < content.length()) + { + pos = content.indexOf("%", lastPos); + if (pos == lastPos) + { + if (content.charAt(pos + 1) == 'u') + { + ch = (char) Integer.parseInt(content.substring(pos + 2, pos + 6), 16); + tmp.append(ch); + lastPos = pos + 6; + } + else + { + ch = (char) Integer.parseInt(content.substring(pos + 1, pos + 3), 16); + tmp.append(ch); + lastPos = pos + 3; + } + } + else + { + if (pos == -1) + { + tmp.append(content.substring(lastPos)); + lastPos = content.length(); + } + else + { + tmp.append(content.substring(lastPos, pos)); + lastPos = pos; + } + } + } + return tmp.toString(); + } + + public static void main(String[] args) + { + String html = ""; + String escape = EscapeUtil.escape(html); + // String html = "ipt>alert(\"XSS\")ipt>"; + // String html = "<123"; + // String html = "123>"; + System.out.println("clean: " + EscapeUtil.clean(html)); + System.out.println("escape: " + escape); + System.out.println("unescape: " + EscapeUtil.unescape(escape)); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..ebff3fd6377097b7db960c023dd8c1667d9c4557 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java @@ -0,0 +1,570 @@ +package com.ruoyi.common.utils.html; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * HTML过滤器,用于去除XSS漏洞隐患。 + * + * @author ruoyi + */ +public final class HTMLFilter +{ + /** + * regex flag union representing /si modifiers in php + **/ + private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL; + private static final Pattern P_COMMENTS = Pattern.compile("", Pattern.DOTALL); + private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI); + private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL); + private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI); + private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI); + private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI); + private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI); + private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI); + private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?"); + private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?"); + private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?"); + private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))"); + private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL); + private static final Pattern P_END_ARROW = Pattern.compile("^>"); + private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_AMP = Pattern.compile("&"); + private static final Pattern P_QUOTE = Pattern.compile("\""); + private static final Pattern P_LEFT_ARROW = Pattern.compile("<"); + private static final Pattern P_RIGHT_ARROW = Pattern.compile(">"); + private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>"); + + // @xxx could grow large... maybe use sesat's ReferenceMap + private static final ConcurrentMap P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>(); + private static final ConcurrentMap P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>(); + + /** + * set of allowed html elements, along with allowed attributes for each element + **/ + private final Map> vAllowed; + /** + * counts of open tags for each (allowable) html element + **/ + private final Map vTagCounts = new HashMap<>(); + + /** + * html elements which must always be self-closing (e.g. "") + **/ + private final String[] vSelfClosingTags; + /** + * html elements which must always have separate opening and closing tags (e.g. "") + **/ + private final String[] vNeedClosingTags; + /** + * set of disallowed html elements + **/ + private final String[] vDisallowed; + /** + * attributes which should be checked for valid protocols + **/ + private final String[] vProtocolAtts; + /** + * allowed protocols + **/ + private final String[] vAllowedProtocols; + /** + * tags which should be removed if they contain no content (e.g. "" or "") + **/ + private final String[] vRemoveBlanks; + /** + * entities allowed within html markup + **/ + private final String[] vAllowedEntities; + /** + * flag determining whether comments are allowed in input String. + */ + private final boolean stripComment; + private final boolean encodeQuotes; + /** + * flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g. "" + * becomes " text "). If set to false, unbalanced angle brackets will be html escaped. + */ + private final boolean alwaysMakeTags; + + /** + * Default constructor. + */ + public HTMLFilter() + { + vAllowed = new HashMap<>(); + + final ArrayList a_atts = new ArrayList<>(); + a_atts.add("href"); + a_atts.add("target"); + vAllowed.put("a", a_atts); + + final ArrayList img_atts = new ArrayList<>(); + img_atts.add("src"); + img_atts.add("width"); + img_atts.add("height"); + img_atts.add("alt"); + vAllowed.put("img", img_atts); + + final ArrayList no_atts = new ArrayList<>(); + vAllowed.put("b", no_atts); + vAllowed.put("strong", no_atts); + vAllowed.put("i", no_atts); + vAllowed.put("em", no_atts); + + vSelfClosingTags = new String[] { "img" }; + vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" }; + vDisallowed = new String[] {}; + vAllowedProtocols = new String[] { "http", "mailto", "https" }; // no ftp. + vProtocolAtts = new String[] { "src", "href" }; + vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" }; + vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" }; + stripComment = true; + encodeQuotes = true; + alwaysMakeTags = false; + } + + /** + * Map-parameter configurable constructor. + * + * @param conf map containing configuration. keys match field names. + */ + @SuppressWarnings("unchecked") + public HTMLFilter(final Map conf) + { + + assert conf.containsKey("vAllowed") : "configuration requires vAllowed"; + assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags"; + assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags"; + assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed"; + assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols"; + assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts"; + assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks"; + assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities"; + + vAllowed = Collections.unmodifiableMap((HashMap>) conf.get("vAllowed")); + vSelfClosingTags = (String[]) conf.get("vSelfClosingTags"); + vNeedClosingTags = (String[]) conf.get("vNeedClosingTags"); + vDisallowed = (String[]) conf.get("vDisallowed"); + vAllowedProtocols = (String[]) conf.get("vAllowedProtocols"); + vProtocolAtts = (String[]) conf.get("vProtocolAtts"); + vRemoveBlanks = (String[]) conf.get("vRemoveBlanks"); + vAllowedEntities = (String[]) conf.get("vAllowedEntities"); + stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true; + encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true; + alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true; + } + + private void reset() + { + vTagCounts.clear(); + } + + // --------------------------------------------------------------- + // my versions of some PHP library functions + public static String chr(final int decimal) + { + return String.valueOf((char) decimal); + } + + public static String htmlSpecialChars(final String s) + { + String result = s; + result = regexReplace(P_AMP, "&", result); + result = regexReplace(P_QUOTE, """, result); + result = regexReplace(P_LEFT_ARROW, "<", result); + result = regexReplace(P_RIGHT_ARROW, ">", result); + return result; + } + + // --------------------------------------------------------------- + + /** + * given a user submitted input String, filter out any invalid or restricted html. + * + * @param input text (i.e. submitted by a user) than may contain html + * @return "clean" version of input, with only valid, whitelisted html elements allowed + */ + public String filter(final String input) + { + reset(); + String s = input; + + s = escapeComments(s); + + s = balanceHTML(s); + + s = checkTags(s); + + s = processRemoveBlanks(s); + + // s = validateEntities(s); + + return s; + } + + public boolean isAlwaysMakeTags() + { + return alwaysMakeTags; + } + + public boolean isStripComments() + { + return stripComment; + } + + private String escapeComments(final String s) + { + final Matcher m = P_COMMENTS.matcher(s); + final StringBuffer buf = new StringBuffer(); + if (m.find()) + { + final String match = m.group(1); // (.*?) + m.appendReplacement(buf, Matcher.quoteReplacement("")); + } + m.appendTail(buf); + + return buf.toString(); + } + + private String balanceHTML(String s) + { + if (alwaysMakeTags) + { + // + // try and form html + // + s = regexReplace(P_END_ARROW, "", s); + // 不追加结束标签 + s = regexReplace(P_BODY_TO_END, "<$1>", s); + s = regexReplace(P_XML_CONTENT, "$1<$2", s); + + } + else + { + // + // escape stray brackets + // + s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s); + s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s); + + // + // the last regexp causes '<>' entities to appear + // (we need to do a lookahead assertion so that the last bracket can + // be used in the next pass of the regexp) + // + s = regexReplace(P_BOTH_ARROWS, "", s); + } + + return s; + } + + private String checkTags(String s) + { + Matcher m = P_TAGS.matcher(s); + + final StringBuffer buf = new StringBuffer(); + while (m.find()) + { + String replaceStr = m.group(1); + replaceStr = processTag(replaceStr); + m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr)); + } + m.appendTail(buf); + + // these get tallied in processTag + // (remember to reset before subsequent calls to filter method) + final StringBuilder sBuilder = new StringBuilder(buf.toString()); + for (String key : vTagCounts.keySet()) + { + for (int ii = 0; ii < vTagCounts.get(key); ii++) + { + sBuilder.append(""); + } + } + s = sBuilder.toString(); + + return s; + } + + private String processRemoveBlanks(final String s) + { + String result = s; + for (String tag : vRemoveBlanks) + { + if (!P_REMOVE_PAIR_BLANKS.containsKey(tag)) + { + P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?>")); + } + result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result); + if (!P_REMOVE_SELF_BLANKS.containsKey(tag)) + { + P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>")); + } + result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result); + } + + return result; + } + + private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) + { + Matcher m = regex_pattern.matcher(s); + return m.replaceAll(replacement); + } + + private String processTag(final String s) + { + // ending tags + Matcher m = P_END_TAG.matcher(s); + if (m.find()) + { + final String name = m.group(1).toLowerCase(); + if (allowed(name)) + { + if (!inArray(name, vSelfClosingTags)) + { + if (vTagCounts.containsKey(name)) + { + vTagCounts.put(name, vTagCounts.get(name) - 1); + return ""; + } + } + } + } + + // starting tags + m = P_START_TAG.matcher(s); + if (m.find()) + { + final String name = m.group(1).toLowerCase(); + final String body = m.group(2); + String ending = m.group(3); + + // debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" ); + if (allowed(name)) + { + final StringBuilder params = new StringBuilder(); + + final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body); + final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body); + final List paramNames = new ArrayList<>(); + final List paramValues = new ArrayList<>(); + while (m2.find()) + { + paramNames.add(m2.group(1)); // ([a-z0-9]+) + paramValues.add(m2.group(3)); // (.*?) + } + while (m3.find()) + { + paramNames.add(m3.group(1)); // ([a-z0-9]+) + paramValues.add(m3.group(3)); // ([^\"\\s']+) + } + + String paramName, paramValue; + for (int ii = 0; ii < paramNames.size(); ii++) + { + paramName = paramNames.get(ii).toLowerCase(); + paramValue = paramValues.get(ii); + + // debug( "paramName='" + paramName + "'" ); + // debug( "paramValue='" + paramValue + "'" ); + // debug( "allowed? " + vAllowed.get( name ).contains( paramName ) ); + + if (allowedAttribute(name, paramName)) + { + if (inArray(paramName, vProtocolAtts)) + { + paramValue = processParamProtocol(paramValue); + } + params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\\\""); + } + } + + if (inArray(name, vSelfClosingTags)) + { + ending = " /"; + } + + if (inArray(name, vNeedClosingTags)) + { + ending = ""; + } + + if (ending == null || ending.length() < 1) + { + if (vTagCounts.containsKey(name)) + { + vTagCounts.put(name, vTagCounts.get(name) + 1); + } + else + { + vTagCounts.put(name, 1); + } + } + else + { + ending = " /"; + } + return "<" + name + params + ending + ">"; + } + else + { + return ""; + } + } + + // comments + m = P_COMMENT.matcher(s); + if (!stripComment && m.find()) + { + return "<" + m.group() + ">"; + } + + return ""; + } + + private String processParamProtocol(String s) + { + s = decodeEntities(s); + final Matcher m = P_PROTOCOL.matcher(s); + if (m.find()) + { + final String protocol = m.group(1); + if (!inArray(protocol, vAllowedProtocols)) + { + // bad protocol, turn into local anchor link instead + s = "#" + s.substring(protocol.length() + 1); + if (s.startsWith("#//")) + { + s = "#" + s.substring(3); + } + } + } + + return s; + } + + private String decodeEntities(String s) + { + StringBuffer buf = new StringBuffer(); + + Matcher m = P_ENTITY.matcher(s); + while (m.find()) + { + final String match = m.group(1); + final int decimal = Integer.decode(match).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENTITY_UNICODE.matcher(s); + while (m.find()) + { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENCODE.matcher(s); + while (m.find()) + { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16).intValue(); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + s = validateEntities(s); + return s; + } + + private String validateEntities(final String s) + { + StringBuffer buf = new StringBuffer(); + + // validate entities throughout the string + Matcher m = P_VALID_ENTITIES.matcher(s); + while (m.find()) + { + final String one = m.group(1); // ([^&;]*) + final String two = m.group(2); // (?=(;|&|$)) + m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); + } + m.appendTail(buf); + + return encodeQuotes(buf.toString()); + } + + private String encodeQuotes(final String s) + { + if (encodeQuotes) + { + StringBuffer buf = new StringBuffer(); + Matcher m = P_VALID_QUOTES.matcher(s); + while (m.find()) + { + final String one = m.group(1); // (>|^) + final String two = m.group(2); // ([^<]+?) + final String three = m.group(3); // (<|$) + // 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two) + m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); + } + m.appendTail(buf); + return buf.toString(); + } + else + { + return s; + } + } + + private String checkEntity(final String preamble, final String term) + { + + return ";".equals(term) && isValidEntity(preamble) ? '&' + preamble : "&" + preamble; + } + + private boolean isValidEntity(final String entity) + { + return inArray(entity, vAllowedEntities); + } + + private static boolean inArray(final String s, final String[] array) + { + for (String item : array) + { + if (item != null && item.equals(s)) + { + return true; + } + } + return false; + } + + private boolean allowed(final String name) + { + return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed); + } + + private boolean allowedAttribute(final String name, final String paramName) + { + return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName)); + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..589d12310a662186ca64d7c0c2ab514b04cf93c6 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java @@ -0,0 +1,55 @@ +package com.ruoyi.common.utils.http; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import javax.servlet.ServletRequest; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 通用http工具封装 + * + * @author ruoyi + */ +public class HttpHelper +{ + private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); + + public static String getBodyString(ServletRequest request) + { + StringBuilder sb = new StringBuilder(); + BufferedReader reader = null; + try (InputStream inputStream = request.getInputStream()) + { + reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); + String line = ""; + while ((line = reader.readLine()) != null) + { + sb.append(line); + } + } + catch (IOException e) + { + LOGGER.warn("getBodyString出现问题!"); + } + finally + { + if (reader != null) + { + try + { + reader.close(); + } + catch (IOException e) + { + LOGGER.error(ExceptionUtils.getMessage(e)); + } + } + } + return sb.toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..b5b25cce3d07cbe09168bb5736fc9f548f2bd920 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java @@ -0,0 +1,328 @@ +package com.ruoyi.common.utils.http; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.ConnectException; +import java.net.SocketTimeoutException; +import java.net.URL; +import java.net.URLConnection; +import java.nio.charset.StandardCharsets; +import java.security.cert.X509Certificate; +import java.util.Map; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.RequestEntity; +import org.apache.commons.httpclient.methods.StringRequestEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.utils.StringUtils; + +/** + * 通用http发送方法 + * + * @author ruoyi + */ +public class HttpUtils +{ + private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url) + { + return sendGet(url, StringUtils.EMPTY); + } + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param) + { + return sendGet(url, param, Constants.UTF8); + } + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @param contentType 编码类型 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param, String contentType) + { + StringBuilder result = new StringBuilder(); + BufferedReader in = null; + try + { + String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url; + log.info("sendGet - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection connection = realUrl.openConnection(); + connection.setRequestProperty("accept", "*/*"); + connection.setRequestProperty("connection", "Keep-Alive"); + connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + connection.connect(); + in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + log.info("recv - {}", result); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); + } + finally + { + try + { + if (in != null) + { + in.close(); + } + } + catch (Exception ex) + { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendPost(String url, String param) + { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try + { + log.info("sendPost - {}", url); + URL realUrl = new URL(url); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); + String line; + while ((line = in.readLine()) != null) + { + result.append(line); + } + log.info("recv - {}", result); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + } + finally + { + try + { + if (out != null) + { + out.close(); + } + if (in != null) + { + in.close(); + } + } + catch (IOException ex) + { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + public static String sendSSLPost(String url, String param) + { + StringBuilder result = new StringBuilder(); + String urlNameString = url + "?" + param; + try + { + log.info("sendSSLPost - {}", urlNameString); + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); + URL console = new URL(urlNameString); + HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + + conn.setSSLSocketFactory(sc.getSocketFactory()); + conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); + conn.connect(); + InputStream is = conn.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + String ret = ""; + while ((ret = br.readLine()) != null) + { + if (ret != null && !"".equals(ret.trim())) + { + result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8)); + } + } + log.info("recv - {}", result); + conn.disconnect(); + br.close(); + } + catch (ConnectException e) + { + log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); + } + catch (SocketTimeoutException e) + { + log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } + catch (IOException e) + { + log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); + } + catch (Exception e) + { + log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); + } + return result.toString(); + } + + /** + * post请求 + * + * @param url + * @param json + * @return + */ + public static String postJosnContent(String url, String json) { + return postJosnContent(url, json, null); + } + + /** + * post请求 + * + * @param url + * @param json + * @return + */ + public static String postJosnContent(String url, String json, Map header) { + log.info("请求接口参数:" + json); + PostMethod method = new PostMethod(url); + HttpClient httpClient = new HttpClient(); + try { + RequestEntity entity = new StringRequestEntity(json, "application/json", "UTF-8"); + method.setRequestEntity(entity); + + httpClient.executeMethod(method); + log.info("请求接口路径url:" + method.getURI().toString()); + InputStream in = method.getResponseBodyAsStream(); + //下面将stream转换为String + StringBuffer sb = new StringBuffer(); + InputStreamReader isr = new InputStreamReader(in, StandardCharsets.UTF_8); + char[] b = new char[4096]; + for (int n; (n = isr.read(b)) != -1; ) { + sb.append(new String(b, 0, n)); + } + String returnStr = sb.toString(); + log.info("请求返回结果:" + returnStr); + return returnStr; + } catch (Exception e) { + e.printStackTrace(); + } finally { + method.releaseConnection(); + } + return ""; + } + + + private static class TrustAnyTrustManager implements X509TrustManager + { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + { + } + + @Override + public X509Certificate[] getAcceptedIssuers() + { + return new X509Certificate[] {}; + } + } + + private static class TrustAnyHostnameVerifier implements HostnameVerifier + { + @Override + public boolean verify(String hostname, SSLSession session) + { + return true; + } + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..edfe419a00ef30be172bac877616a389524ad523 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java @@ -0,0 +1,56 @@ +package com.ruoyi.common.utils.ip; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.http.HttpUtils; + +/** + * 获取地址类 + * + * @author ruoyi + */ +public class AddressUtils +{ + private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); + + // IP地址查询 + public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp"; + + // 未知地址 + public static final String UNKNOWN = "XX XX"; + + public static String getRealAddressByIP(String ip) + { + // 内网不查询 + if (IpUtils.internalIp(ip)) + { + return "内网IP"; + } + if (RuoYiConfig.isAddressEnabled()) + { + try + { + String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK); + if (StringUtils.isEmpty(rspStr)) + { + log.error("获取地理位置异常 {}", ip); + return UNKNOWN; + } + JSONObject obj = JSON.parseObject(rspStr); + String region = obj.getString("pro"); + String city = obj.getString("city"); + return String.format("%s %s", region, city); + } + catch (Exception e) + { + log.error("获取地理位置异常 {}", ip); + } + } + return UNKNOWN; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..c18c56a44780cd264ce185634d654c493952c80b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java @@ -0,0 +1,264 @@ +package com.ruoyi.common.utils.ip; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import javax.servlet.http.HttpServletRequest; +import com.ruoyi.common.utils.StringUtils; + +/** + * 获取IP方法 + * + * @author ruoyi + */ +public class IpUtils +{ + /** + * 获取客户端IP + * + * @param request 请求对象 + * @return IP地址 + */ + public static String getIpAddr(HttpServletRequest request) + { + if (request == null) + { + return "unknown"; + } + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Forwarded-For"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Real-IP"); + } + + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getRemoteAddr(); + } + + return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip); + } + + /** + * 检查是否为内部IP地址 + * + * @param ip IP地址 + * @return 结果 + */ + public static boolean internalIp(String ip) + { + byte[] addr = textToNumericFormatV4(ip); + return internalIp(addr) || "127.0.0.1".equals(ip); + } + + /** + * 检查是否为内部IP地址 + * + * @param addr byte地址 + * @return 结果 + */ + private static boolean internalIp(byte[] addr) + { + if (StringUtils.isNull(addr) || addr.length < 2) + { + return true; + } + final byte b0 = addr[0]; + final byte b1 = addr[1]; + // 10.x.x.x/8 + final byte SECTION_1 = 0x0A; + // 172.16.x.x/12 + final byte SECTION_2 = (byte) 0xAC; + final byte SECTION_3 = (byte) 0x10; + final byte SECTION_4 = (byte) 0x1F; + // 192.168.x.x/16 + final byte SECTION_5 = (byte) 0xC0; + final byte SECTION_6 = (byte) 0xA8; + switch (b0) + { + case SECTION_1: + return true; + case SECTION_2: + if (b1 >= SECTION_3 && b1 <= SECTION_4) + { + return true; + } + case SECTION_5: + switch (b1) + { + case SECTION_6: + return true; + } + default: + return false; + } + } + + /** + * 将IPv4地址转换成字节 + * + * @param text IPv4地址 + * @return byte 字节 + */ + public static byte[] textToNumericFormatV4(String text) + { + if (text.length() == 0) + { + return null; + } + + byte[] bytes = new byte[4]; + String[] elements = text.split("\\.", -1); + try + { + long l; + int i; + switch (elements.length) + { + case 1: + l = Long.parseLong(elements[0]); + if ((l < 0L) || (l > 4294967295L)) + { + return null; + } + bytes[0] = (byte) (int) (l >> 24 & 0xFF); + bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 2: + l = Integer.parseInt(elements[0]); + if ((l < 0L) || (l > 255L)) + { + return null; + } + bytes[0] = (byte) (int) (l & 0xFF); + l = Integer.parseInt(elements[1]); + if ((l < 0L) || (l > 16777215L)) + { + return null; + } + bytes[1] = (byte) (int) (l >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 3: + for (i = 0; i < 2; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) + { + return null; + } + bytes[i] = (byte) (int) (l & 0xFF); + } + l = Integer.parseInt(elements[2]); + if ((l < 0L) || (l > 65535L)) + { + return null; + } + bytes[2] = (byte) (int) (l >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 4: + for (i = 0; i < 4; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) + { + return null; + } + bytes[i] = (byte) (int) (l & 0xFF); + } + break; + default: + return null; + } + } + catch (NumberFormatException e) + { + return null; + } + return bytes; + } + + /** + * 获取IP地址 + * + * @return 本地IP地址 + */ + public static String getHostIp() + { + try + { + return InetAddress.getLocalHost().getHostAddress(); + } + catch (UnknownHostException e) + { + } + return "127.0.0.1"; + } + + /** + * 获取主机名 + * + * @return 本地主机名 + */ + public static String getHostName() + { + try + { + return InetAddress.getLocalHost().getHostName(); + } + catch (UnknownHostException e) + { + } + return "未知"; + } + + /** + * 从多级反向代理中获得第一个非unknown IP地址 + * + * @param ip 获得的IP地址 + * @return 第一个非unknown IP地址 + */ + public static String getMultistageReverseProxyIp(String ip) + { + // 多级反向代理检测 + if (ip != null && ip.indexOf(",") > 0) + { + final String[] ips = ip.trim().split(","); + for (String subIp : ips) + { + if (false == isUnknown(subIp)) + { + ip = subIp; + break; + } + } + } + return ip; + } + + /** + * 检测给定字符串是否为未知,多用于检测HTTP请求相关 + * + * @param checkString 被检测的字符串 + * @return 是否未知 + */ + public static boolean isUnknown(String checkString) + { + return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString); + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/EasyPoiExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/EasyPoiExcelUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..8f393e3653b2266a42cdce0fcaf275148ac86823 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/EasyPoiExcelUtil.java @@ -0,0 +1,104 @@ +package com.ruoyi.common.utils.poi; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; +import cn.hutool.core.collection.CollectionUtil; +import com.ruoyi.common.core.domain.model.ExcelSelector; +import org.apache.poi.hssf.usermodel.DVConstraint; +import org.apache.poi.hssf.usermodel.HSSFDataValidation; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLEncoder; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * @author huamile + */ +public class EasyPoiExcelUtil { + + public static void exportExcel(String title, Class pojoClass, Collection dataSet, HttpServletRequest request, HttpServletResponse response) { + ExportParams params = new ExportParams(); + params.setTitle(title); + params.setSheetName(title); + Workbook wb = ExcelExportUtil.exportExcel(params, pojoClass, dataSet); + writeOutStream(wb,request,response); + } + + public static void exportMultiSheetExcel(List> list, List selectorList, HttpServletRequest request, HttpServletResponse response) { + Workbook wb = ExcelExportUtil.exportExcel(list, ExcelType.HSSF); + generateSelector(wb,selectorList); + writeOutStream(wb,request,response); + } + + private static void generateSelector(Workbook wb,List selectorList) { + if (CollectionUtil.isNotEmpty(selectorList)) { + Sheet sheet; + CellRangeAddressList cellRangeAddressList; + DVConstraint dvConstraint; + HSSFDataValidation dataValidation; + for (ExcelSelector selector : selectorList) { + sheet = wb.getSheetAt(selector.getSheetIndex()); + cellRangeAddressList = new CellRangeAddressList(selector.getFirstRow(),selector.getLastRow(),selector.getFirstCol(),selector.getLastCol()); + dvConstraint = DVConstraint.createExplicitListConstraint(selector.getDatas()); + dataValidation = new HSSFDataValidation(cellRangeAddressList, dvConstraint); + sheet.addValidationData(dataValidation); + } + } + } + + private static void writeOutStream(Workbook workbook,HttpServletRequest request, HttpServletResponse response) { + try { + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-Type", "application/vnd.ms-excel"); + String filename = System.currentTimeMillis() + ".xls"; + if ("IE".equals(getBrowser(request))){ + filename = URLEncoder.encode(filename,"UTF-8"); + } else { + filename = new String(filename.getBytes("UTF-8"),"ISO-8859-1"); + } + response.setHeader("Content-Disposition", "attachment;filename=" + filename); + + response.setHeader("Pargam", "no-cache"); + response.setHeader("Cache-Control", "no-cache"); + ServletOutputStream outStream = null; + try { + outStream = response.getOutputStream(); + workbook.write(outStream); + outStream.flush(); + } finally { + outStream.close(); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("excel导出报错 : " + e.getMessage()); + } + } + + private static String getBrowser(HttpServletRequest request){ + String userAgent = request.getHeader("User-Agent").toLowerCase(); + if (userAgent.indexOf("firefox") >= 0){ + return "FF"; + } else if (userAgent.indexOf("safari") >= 0){ + return "Chrome"; + } else { + return "IE"; + } + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelHandlerAdapter.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelHandlerAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..5ea74c11ef678115cd8661a279221a09574d9182 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelHandlerAdapter.java @@ -0,0 +1,19 @@ +package com.ruoyi.common.utils.poi; + +/** + * Excel数据格式处理适配器 + * + * @author ruoyi + */ +public interface ExcelHandlerAdapter +{ + /** + * 格式化 + * + * @param value 单元格数据值 + * @param args excel注解args参数组 + * + * @return 处理后的值 + */ + Object format(Object value, String[] args); +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..f505fd4d045b3333e9107bd0e9f7984ddcb31d4a --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -0,0 +1,1721 @@ +package com.ruoyi.common.utils.poi; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.annotation.Excel.Type; +import com.ruoyi.common.annotation.Excels; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.exception.UtilException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileTypeUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.common.utils.file.ImageUtils; +import com.ruoyi.common.utils.reflect.ReflectUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.RegExUtils; +import org.apache.commons.lang3.reflect.FieldUtils; +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.ooxml.POIXMLDocumentPart; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.util.IOUtils; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.apache.poi.xssf.usermodel.*; +import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.lang.reflect.*; +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * Excel相关处理 + * + * @author ruoyi + */ +public class ExcelUtil +{ + private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); + + public static final String FORMULA_REGEX_STR = "=|-|\\+|@"; + + public static final String[] FORMULA_STR = { "=", "-", "+", "@" }; + + /** + * Excel sheet最大行数,默认65536 + */ + public static final int sheetSize = 65536; + + /** + * 工作表名称 + */ + private String sheetName; + + /** + * 导出类型(EXPORT:导出数据;IMPORT:导入模板) + */ + private Type type; + + /** + * 工作薄对象 + */ + private Workbook wb; + + /** + * 工作表对象 + */ + private Sheet sheet; + + /** + * 样式列表 + */ + private Map styles; + + /** + * 导入导出数据列表 + */ + private List list; + + /** + * 注解列表 + */ + private List fields; + + /** + * 当前行号 + */ + private int rownum; + + /** + * 标题 + */ + private String title; + + /** + * 最大高度 + */ + private short maxHeight; + + /** + * 合并后最后行数 + */ + private int subMergedLastRowNum = 0; + + /** + * 合并后开始行数 + */ + private int subMergedFirstRowNum = 1; + + /** + * 对象的子列表方法 + */ + private Method subMethod; + + /** + * 对象的子列表属性 + */ + private List subFields; + + /** + * 统计列表 + */ + private Map statistics = new HashMap(); + + /** + * 数字格式 + */ + private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00"); + + /** + * 实体对象 + */ + public Class clazz; + + /** + * 需要排除列属性 + */ + public String[] excludeFields; + + public ExcelUtil(Class clazz) + { + this.clazz = clazz; + } + + /** + * 隐藏Excel中列属性 + * + * @param fields 列属性名 示例[单个"name"/多个"id","name"] + * @throws Exception + */ + public void hideColumn(String... fields) + { + this.excludeFields = fields; + } + + public void init(List list, String sheetName, String title, Type type) + { + if (list == null) + { + list = new ArrayList(); + } + this.list = list; + this.sheetName = sheetName; + this.type = type; + this.title = title; + createExcelField(); + createWorkbook(); + createTitle(); + createSubHead(); + } + + /** + * 创建excel第一行标题 + */ + public void createTitle() + { + if (StringUtils.isNotEmpty(title)) + { + subMergedFirstRowNum++; + subMergedLastRowNum++; + int titleLastCol = this.fields.size() - 1; + if (isSubList()) + { + titleLastCol = titleLastCol + subFields.size() - 1; + } + Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0); + titleRow.setHeightInPoints(30); + Cell titleCell = titleRow.createCell(0); + titleCell.setCellStyle(styles.get("title")); + titleCell.setCellValue(title); + sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(), titleRow.getRowNum(), titleRow.getRowNum(), titleLastCol)); + } + } + + /** + * 创建对象的子列表名称 + */ + public void createSubHead() + { + if (isSubList()) + { + subMergedFirstRowNum++; + subMergedLastRowNum++; + Row subRow = sheet.createRow(rownum); + int excelNum = 0; + for (Object[] objects : fields) + { + Excel attr = (Excel) objects[1]; + Cell headCell1 = subRow.createCell(excelNum); + headCell1.setCellValue(attr.name()); + headCell1.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor()))); + excelNum++; + } + int headFirstRow = excelNum - 1; + int headLastRow = headFirstRow + subFields.size() - 1; + if (headLastRow > headFirstRow) + { + sheet.addMergedRegion(new CellRangeAddress(rownum, rownum, headFirstRow, headLastRow)); + } + rownum++; + } + } + + /** + * 对excel表单默认第一个索引名转换成list + * + * @param is 输入流 + * @return 转换后集合 + */ + public List importExcel(InputStream is) throws Exception + { + return importExcel(is, 0); + } + + /** + * 对excel表单默认第一个索引名转换成list + * + * @param is 输入流 + * @param titleNum 标题占用行数 + * @return 转换后集合 + */ + public List importExcel(InputStream is, int titleNum) throws Exception + { + return importExcel(StringUtils.EMPTY, is, titleNum); + } + + /** + * 对excel表单指定表格索引名转换成list + * + * @param sheetName 表格索引名 + * @param titleNum 标题占用行数 + * @param is 输入流 + * @return 转换后集合 + */ + public List importExcel(String sheetName, InputStream is, int titleNum) throws Exception + { + this.type = Type.IMPORT; + this.wb = WorkbookFactory.create(is); + List list = new ArrayList(); + // 如果指定sheet名,则取指定sheet中的内容 否则默认指向第1个sheet + Sheet sheet = StringUtils.isNotEmpty(sheetName) ? wb.getSheet(sheetName) : wb.getSheetAt(0); + if (sheet == null) + { + throw new IOException("文件sheet不存在"); + } + boolean isXSSFWorkbook = !(wb instanceof HSSFWorkbook); + Map pictures; + if (isXSSFWorkbook) + { + pictures = getSheetPictures07((XSSFSheet) sheet, (XSSFWorkbook) wb); + } + else + { + pictures = getSheetPictures03((HSSFSheet) sheet, (HSSFWorkbook) wb); + } + // 获取最后一个非空行的行下标,比如总行数为n,则返回的为n-1 + int rows = sheet.getLastRowNum(); + + if (rows > 0) + { + // 定义一个map用于存放excel列的序号和field. + Map cellMap = new HashMap(); + // 获取表头 + Row tableHeader = sheet.getRow(titleNum); + for (int i = 0; i < tableHeader.getPhysicalNumberOfCells(); i++) + { + Cell cell = tableHeader.getCell(i); + if (StringUtils.isNotNull(cell)) + { + String value = this.getCellValue(tableHeader, i).toString(); + cellMap.put(value, i); + } + else + { + cellMap.put(null, i); + } + } + // 有数据时才处理 得到类的所有field. + List fields = this.getFields(); + Map fieldsMap = new HashMap(); + for (Object[] objects : fields) + { + Excel attr = (Excel) objects[1]; + Integer column = cellMap.get(attr.name()); + if (column != null) + { + fieldsMap.put(column, objects); + } + } + for (int i = titleNum + 1; i <= rows; i++) + { + // 从第2行开始取数据,默认第一行是表头. + Row row = sheet.getRow(i); + // 判断当前行是否是空行 + if (isRowEmpty(row) || isRowEmptyAfterRemoveSpace(row)) + { + continue; + } + T entity = null; + for (Map.Entry entry : fieldsMap.entrySet()) + { + Object val = this.getCellValue(row, entry.getKey()); + + // 如果不存在实例则新建. + entity = (entity == null ? clazz.newInstance() : entity); + // 从map中得到对应列的field. + Field field = (Field) entry.getValue()[0]; + Excel attr = (Excel) entry.getValue()[1]; + // 取得类型,并根据对象类型设置值. + Class fieldType = field.getType(); + if (String.class == fieldType) + { + String s = Convert.toStr(val); + if (StringUtils.endsWith(s, ".0")) + { + val = StringUtils.substringBefore(s, ".0"); + } + else + { + String dateFormat = field.getAnnotation(Excel.class).dateFormat(); + if (StringUtils.isNotEmpty(dateFormat)) + { + val = parseDateToStr(dateFormat, val); + } + else + { + val = Convert.toStr(val); + } + } + } + else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) + { + val = Convert.toInt(val); + } + else if ((Long.TYPE == fieldType || Long.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) + { + val = Convert.toLong(val); + } + else if (Double.TYPE == fieldType || Double.class == fieldType) + { + val = Convert.toDouble(val); + } + else if (Float.TYPE == fieldType || Float.class == fieldType) + { + val = Convert.toFloat(val); + } + else if (BigDecimal.class == fieldType) + { + val = Convert.toBigDecimal(val); + } + else if (Date.class == fieldType) + { + if (val instanceof String) + { + val = DateUtils.parseDate(val); + } + else if (val instanceof Double) + { + val = DateUtil.getJavaDate((Double) val); + } + } + else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) + { + val = Convert.toBool(val, false); + } + if (StringUtils.isNotNull(fieldType)) + { + String propertyName = field.getName(); + if (StringUtils.isNotEmpty(attr.targetAttr())) + { + propertyName = field.getName() + "." + attr.targetAttr(); + } + else if (StringUtils.isNotEmpty(attr.readConverterExp())) + { + val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator()); + } + else if (StringUtils.isNotEmpty(attr.dictType())) + { + val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator()); + } + else if (!attr.handler().equals(ExcelHandlerAdapter.class)) + { + val = dataFormatHandlerAdapter(val, attr); + } + else if (ColumnType.IMAGE == attr.cellType() && StringUtils.isNotEmpty(pictures)) + { + PictureData image = pictures.get(row.getRowNum() + "_" + entry.getKey()); + if (image == null) + { + val = ""; + } + else + { + byte[] data = image.getData(); + val = FileUtils.writeImportBytes(data); + } + } + ReflectUtils.invokeSetter(entity, propertyName, val); + } + } + list.add(entity); + } + } + return list; + } + + /** + * 去除前后空白后是否存在空行 + * + * @param row 行对象 + * @return 是否存在空行 + */ + private boolean isRowEmptyAfterRemoveSpace(Row row) { + for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) { + Cell cell = row.getCell(i); + if (cell != null && cell.getCellType() == CellType.STRING && StringUtils.isNotEmpty(cell.getStringCellValue())) { + return false; + } + } + return true; + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param list 导出数据集合 + * @param sheetName 工作表的名称 + * @return 结果 + */ + public AjaxResult exportExcel(List list, String sheetName) + { + return exportExcel(list, sheetName, StringUtils.EMPTY); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param list 导出数据集合 + * @param sheetName 工作表的名称 + * @param title 标题 + * @return 结果 + */ + public AjaxResult exportExcel(List list, String sheetName, String title) + { + this.init(list, sheetName, title, Type.EXPORT); + return exportExcel(); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param response 返回数据 + * @param list 导出数据集合 + * @param sheetName 工作表的名称 + * @return 结果 + */ + public void exportExcel(HttpServletResponse response, List list, String sheetName) + { + exportExcel(response, list, sheetName, StringUtils.EMPTY); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param response 返回数据 + * @param list 导出数据集合 + * @param sheetName 工作表的名称 + * @param title 标题 + * @return 结果 + */ + public void exportExcel(HttpServletResponse response, List list, String sheetName, String title) + { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + this.init(list, sheetName, title, Type.EXPORT); + exportExcel(response); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param sheetName 工作表的名称 + * @return 结果 + */ + public AjaxResult importTemplateExcel(String sheetName) + { + return importTemplateExcel(sheetName, StringUtils.EMPTY); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param sheetName 工作表的名称 + * @param title 标题 + * @return 结果 + */ + public AjaxResult importTemplateExcel(String sheetName, String title) + { + this.init(null, sheetName, title, Type.IMPORT); + return exportExcel(); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param sheetName 工作表的名称 + * @return 结果 + */ + public void importTemplateExcel(HttpServletResponse response, String sheetName) + { + importTemplateExcel(response, sheetName, StringUtils.EMPTY); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @param sheetName 工作表的名称 + * @param title 标题 + * @return 结果 + */ + public void importTemplateExcel(HttpServletResponse response, String sheetName, String title) + { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + this.init(null, sheetName, title, Type.IMPORT); + exportExcel(response); + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @return 结果 + */ + public void exportExcel(HttpServletResponse response) + { + try + { + writeSheet(); + wb.write(response.getOutputStream()); + } + catch (Exception e) + { + log.error("导出Excel异常{}", e.getMessage()); + } + finally + { + IOUtils.closeQuietly(wb); + } + } + + /** + * 对list数据源将其里面的数据导入到excel表单 + * + * @return 结果 + */ + public AjaxResult exportExcel() + { + OutputStream out = null; + try + { + writeSheet(); + String filename = encodingFilename(sheetName); + out = new FileOutputStream(getAbsoluteFile(filename)); + wb.write(out); + return AjaxResult.success(filename); + } + catch (Exception e) + { + log.error("导出Excel异常{}", e.getMessage()); + throw new UtilException("导出Excel失败,请联系网站管理员!"); + } + finally + { + IOUtils.closeQuietly(wb); + IOUtils.closeQuietly(out); + } + } + + /** + * 创建写入数据到Sheet + */ + public void writeSheet() + { + // 取出一共有多少个sheet. + int sheetNo = Math.max(1, (int) Math.ceil(list.size() * 1.0 / sheetSize)); + for (int index = 0; index < sheetNo; index++) + { + createSheet(sheetNo, index); + + // 产生一行 + Row row = sheet.createRow(rownum); + int column = 0; + // 写入各个字段的列头名称 + for (Object[] os : fields) + { + Field field = (Field) os[0]; + Excel excel = (Excel) os[1]; + if (Collection.class.isAssignableFrom(field.getType())) + { + for (Field subField : subFields) + { + Excel subExcel = subField.getAnnotation(Excel.class); + this.createHeadCell(subExcel, row, column++); + } + } + else + { + this.createHeadCell(excel, row, column++); + } + } + if (Type.EXPORT.equals(type)) + { + fillExcelData(index, row); + addStatisticsRow(); + } + } + } + + /** + * 填充excel数据 + * + * @param index 序号 + * @param row 单元格行 + */ + @SuppressWarnings("unchecked") + public void fillExcelData(int index, Row row) + { + int startNo = index * sheetSize; + int endNo = Math.min(startNo + sheetSize, list.size()); + int rowNo = (1 + rownum) - startNo; + for (int i = startNo; i < endNo; i++) + { + rowNo = isSubList() ? (i > 1 ? rowNo + 1 : rowNo + i) : i + 1 + rownum - startNo; + row = sheet.createRow(rowNo); + // 得到导出对象. + T vo = (T) list.get(i); + Collection subList = null; + if (isSubList()) + { + if (isSubListValue(vo)) + { + subList = getListCellValue(vo); + subMergedLastRowNum = subMergedLastRowNum + subList.size(); + } + else + { + subMergedFirstRowNum++; + subMergedLastRowNum++; + } + } + int column = 0; + for (Object[] os : fields) + { + Field field = (Field) os[0]; + Excel excel = (Excel) os[1]; + if (Collection.class.isAssignableFrom(field.getType()) && StringUtils.isNotNull(subList)) + { + boolean subFirst = false; + for (Object obj : subList) + { + if (subFirst) + { + rowNo++; + row = sheet.createRow(rowNo); + } + List subFields = FieldUtils.getFieldsListWithAnnotation(obj.getClass(), Excel.class); + int subIndex = 0; + for (Field subField : subFields) + { + if (subField.isAnnotationPresent(Excel.class)) + { + subField.setAccessible(true); + Excel attr = subField.getAnnotation(Excel.class); + this.addCell(attr, row, (T) obj, subField, column + subIndex); + } + subIndex++; + } + subFirst = true; + } + this.subMergedFirstRowNum = this.subMergedFirstRowNum + subList.size(); + } + else + { + this.addCell(excel, row, vo, field, column++); + } + } + } + } + + /** + * 创建表格样式 + * + * @param wb 工作薄对象 + * @return 样式列表 + */ + private Map createStyles(Workbook wb) + { + // 写入各条记录,每条记录对应excel表中的一行 + Map styles = new HashMap(); + CellStyle style = wb.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + Font titleFont = wb.createFont(); + titleFont.setFontName("Arial"); + titleFont.setFontHeightInPoints((short) 16); + titleFont.setBold(true); + style.setFont(titleFont); + styles.put("title", style); + + style = wb.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setBorderRight(BorderStyle.THIN); + style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderLeft(BorderStyle.THIN); + style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderTop(BorderStyle.THIN); + style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderBottom(BorderStyle.THIN); + style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + Font dataFont = wb.createFont(); + dataFont.setFontName("Arial"); + dataFont.setFontHeightInPoints((short) 10); + style.setFont(dataFont); + styles.put("data", style); + + style = wb.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + Font totalFont = wb.createFont(); + totalFont.setFontName("Arial"); + totalFont.setFontHeightInPoints((short) 10); + style.setFont(totalFont); + styles.put("total", style); + + styles.putAll(annotationHeaderStyles(wb, styles)); + + styles.putAll(annotationDataStyles(wb)); + + return styles; + } + + /** + * 根据Excel注解创建表格头样式 + * + * @param wb 工作薄对象 + * @return 自定义样式列表 + */ + private Map annotationHeaderStyles(Workbook wb, Map styles) + { + Map headerStyles = new HashMap(); + for (Object[] os : fields) + { + Excel excel = (Excel) os[1]; + String key = StringUtils.format("header_{}_{}", excel.headerColor(), excel.headerBackgroundColor()); + if (!headerStyles.containsKey(key)) + { + CellStyle style = wb.createCellStyle(); + style.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setFillForegroundColor(excel.headerBackgroundColor().index); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + Font headerFont = wb.createFont(); + headerFont.setFontName("Arial"); + headerFont.setFontHeightInPoints((short) 10); + headerFont.setBold(true); + headerFont.setColor(excel.headerColor().index); + style.setFont(headerFont); + headerStyles.put(key, style); + } + } + return headerStyles; + } + + /** + * 根据Excel注解创建表格列样式 + * + * @param wb 工作薄对象 + * @return 自定义样式列表 + */ + private Map annotationDataStyles(Workbook wb) + { + Map styles = new HashMap(); + for (Object[] os : fields) + { + Excel excel = (Excel) os[1]; + String key = StringUtils.format("data_{}_{}_{}", excel.align(), excel.color(), excel.backgroundColor()); + if (!styles.containsKey(key)) + { + CellStyle style = wb.createCellStyle(); + style.setAlignment(excel.align()); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setBorderRight(BorderStyle.THIN); + style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderLeft(BorderStyle.THIN); + style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderTop(BorderStyle.THIN); + style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderBottom(BorderStyle.THIN); + style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + style.setFillForegroundColor(excel.backgroundColor().getIndex()); + Font dataFont = wb.createFont(); + dataFont.setFontName("Arial"); + dataFont.setFontHeightInPoints((short) 10); + dataFont.setColor(excel.color().index); + style.setFont(dataFont); + styles.put(key, style); + } + } + return styles; + } + + /** + * 创建单元格 + */ + public Cell createHeadCell(Excel attr, Row row, int column) + { + // 创建列 + Cell cell = row.createCell(column); + // 写入列信息 + cell.setCellValue(attr.name()); + setDataValidation(attr, row, column); + cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor()))); + if (isSubList()) + { + // 填充默认样式,防止合并单元格样式失效 + sheet.setDefaultColumnStyle(column, styles.get(StringUtils.format("data_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor()))); + if (attr.needMerge()) + { + sheet.addMergedRegion(new CellRangeAddress(rownum - 1, rownum, column, column)); + } + } + return cell; + } + + /** + * 设置单元格信息 + * + * @param value 单元格值 + * @param attr 注解相关 + * @param cell 单元格信息 + */ + public void setCellVo(Object value, Excel attr, Cell cell,Field field) + { + if (ColumnType.STRING == attr.cellType()) + { + String cellValue = Convert.toStr(value); + // 对于任何以表达式触发字符 =-+@开头的单元格,直接使用tab字符作为前缀,防止CSV注入。 + if (StringUtils.startsWithAny(cellValue, FORMULA_STR)) + { + cellValue = RegExUtils.replaceFirst(cellValue, FORMULA_REGEX_STR, "\t$0"); + } + if (value instanceof Collection && StringUtils.equals("[]", cellValue)) + { + cellValue = StringUtils.EMPTY; + } + cell.setCellValue(StringUtils.isNull(cellValue) ? attr.defaultValue() : cellValue + attr.suffix()); + } + else if (ColumnType.NUMERIC == attr.cellType()) + { + if (StringUtils.isNotNull(value)) + { + try { + cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value)); + } catch (Exception e) { + cell.setCellValue(""); + } + } + } + else if (ColumnType.IMAGE == attr.cellType()) + { + ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1); + String imagePath = Convert.toStr(value); + if (StringUtils.isNotEmpty(imagePath)) + { + byte[] data = ImageUtils.getImage(imagePath); + getDrawingPatriarch(cell.getSheet()).createPicture(anchor, + cell.getSheet().getWorkbook().addPicture(data, getImageType(data))); + } + } + } + + /** + * 获取画布 + */ + public static Drawing getDrawingPatriarch(Sheet sheet) + { + if (sheet.getDrawingPatriarch() == null) + { + sheet.createDrawingPatriarch(); + } + return sheet.getDrawingPatriarch(); + } + + /** + * 获取图片类型,设置图片插入类型 + */ + public int getImageType(byte[] value) + { + String type = FileTypeUtils.getFileExtendName(value); + if ("JPG".equalsIgnoreCase(type)) + { + return Workbook.PICTURE_TYPE_JPEG; + } + else if ("PNG".equalsIgnoreCase(type)) + { + return Workbook.PICTURE_TYPE_PNG; + } + return Workbook.PICTURE_TYPE_JPEG; + } + + /** + * 创建表格样式 + */ + public void setDataValidation(Excel attr, Row row, int column) + { + if (attr.name().indexOf("注:") >= 0) + { + sheet.setColumnWidth(column, 6000); + } + else + { + // 设置列宽 + sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256)); + } + if (StringUtils.isNotEmpty(attr.prompt()) || attr.combo().length > 0) + { + if (attr.combo().length > 15 || StringUtils.join(attr.combo()).length() > 255) + { + // 如果下拉数大于15或字符串长度大于255,则使用一个新sheet存储,避免生成的模板下拉值获取不到 + setXSSFValidationWithHidden(sheet, attr.combo(), attr.prompt(), 1, 100, column, column); + } + else + { + // 提示信息或只能选择不能输入的列内容. + setPromptOrValidation(sheet, attr.combo(), attr.prompt(), 1, 100, column, column); + } + } + } + + /** + * 添加单元格 + */ + public Cell addCell(Excel attr, Row row, T vo, Field field, int column) + { + Cell cell = null; + try + { + // 设置行高 + row.setHeight(maxHeight); + // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列. + if (attr.isExport()) + { + // 创建cell + cell = row.createCell(column); + if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge()) + { + CellRangeAddress cellAddress = new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column); + sheet.addMergedRegion(cellAddress); + } + cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor()))); + + // 用于读取对象中的属性 + Object value = getTargetValue(vo, field, attr); + String dateFormat = attr.dateFormat(); + String readConverterExp = attr.readConverterExp(); + String separator = attr.separator(); + String dictType = attr.dictType(); + if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) + { + cell.setCellValue(parseDateToStr(dateFormat, value)); + } + else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) + { + cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator)); + } + else if (StringUtils.isNotEmpty(dictType) && StringUtils.isNotNull(value)) + { + cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator)); + } + else if (value instanceof BigDecimal && -1 != attr.scale()) + { + cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).doubleValue()); + } + else if (!attr.handler().equals(ExcelHandlerAdapter.class)) + { + cell.setCellValue(dataFormatHandlerAdapter(value, attr)); + } + else + { + // 设置列类型 + setCellVo(value, attr, cell,field); + } + addStatisticsData(column, Convert.toStr(value), attr); + } + } + catch (Exception e) + { + log.error(field.getName()); + log.error("导出Excel失败{}", e); + } + return cell; + } + + /** + * 设置 POI XSSFSheet 单元格提示或选择框 + * + * @param sheet 表单 + * @param textlist 下拉框显示的内容 + * @param promptContent 提示内容 + * @param firstRow 开始行 + * @param endRow 结束行 + * @param firstCol 开始列 + * @param endCol 结束列 + */ + public void setPromptOrValidation(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, + int firstCol, int endCol) + { + DataValidationHelper helper = sheet.getDataValidationHelper(); + DataValidationConstraint constraint = textlist.length > 0 ? helper.createExplicitListConstraint(textlist) : helper.createCustomConstraint("DD1"); + CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); + DataValidation dataValidation = helper.createValidation(constraint, regions); + if (StringUtils.isNotEmpty(promptContent)) + { + // 如果设置了提示信息则鼠标放上去提示 + dataValidation.createPromptBox("", promptContent); + dataValidation.setShowPromptBox(true); + } + // 处理Excel兼容性问题 + if (dataValidation instanceof XSSFDataValidation) + { + dataValidation.setSuppressDropDownArrow(true); + dataValidation.setShowErrorBox(true); + } + else + { + dataValidation.setSuppressDropDownArrow(false); + } + sheet.addValidationData(dataValidation); + } + + /** + * 设置某些列的值只能输入预制的数据,显示下拉框(兼容超出一定数量的下拉框). + * + * @param sheet 要设置的sheet. + * @param textlist 下拉框显示的内容 + * @param promptContent 提示内容 + * @param firstRow 开始行 + * @param endRow 结束行 + * @param firstCol 开始列 + * @param endCol 结束列 + */ + public void setXSSFValidationWithHidden(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol) + { + String hideSheetName = "combo_" + firstCol + "_" + endCol; + Sheet hideSheet = wb.createSheet(hideSheetName); // 用于存储 下拉菜单数据 + for (int i = 0; i < textlist.length; i++) + { + hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]); + } + // 创建名称,可被其他单元格引用 + Name name = wb.createName(); + name.setNameName(hideSheetName + "_data"); + name.setRefersToFormula(hideSheetName + "!$A$1:$A$" + textlist.length); + DataValidationHelper helper = sheet.getDataValidationHelper(); + // 加载下拉列表内容 + DataValidationConstraint constraint = helper.createFormulaListConstraint(hideSheetName + "_data"); + // 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列 + CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); + // 数据有效性对象 + DataValidation dataValidation = helper.createValidation(constraint, regions); + if (StringUtils.isNotEmpty(promptContent)) + { + // 如果设置了提示信息则鼠标放上去提示 + dataValidation.createPromptBox("", promptContent); + dataValidation.setShowPromptBox(true); + } + // 处理Excel兼容性问题 + if (dataValidation instanceof XSSFDataValidation) + { + dataValidation.setSuppressDropDownArrow(true); + dataValidation.setShowErrorBox(true); + } + else + { + dataValidation.setSuppressDropDownArrow(false); + } + + sheet.addValidationData(dataValidation); + // 设置hiddenSheet隐藏 + wb.setSheetHidden(wb.getSheetIndex(hideSheet), true); + } + + /** + * 解析导出值 0=男,1=女,2=未知 + * + * @param propertyValue 参数值 + * @param converterExp 翻译注解 + * @param separator 分隔符 + * @return 解析后值 + */ + public static String convertByExp(String propertyValue, String converterExp, String separator) + { + StringBuilder propertyString = new StringBuilder(); + String[] convertSource = converterExp.split(","); + for (String item : convertSource) + { + String[] itemArray = item.split("="); + if (StringUtils.containsAny(propertyValue, separator)) + { + for (String value : propertyValue.split(separator)) + { + if (itemArray[0].equals(value)) + { + propertyString.append(itemArray[1] + separator); + break; + } + } + } + else + { + if (itemArray[0].equals(propertyValue)) + { + return itemArray[1]; + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 反向解析值 男=0,女=1,未知=2 + * + * @param propertyValue 参数值 + * @param converterExp 翻译注解 + * @param separator 分隔符 + * @return 解析后值 + */ + public static String reverseByExp(String propertyValue, String converterExp, String separator) + { + StringBuilder propertyString = new StringBuilder(); + String[] convertSource = converterExp.split(","); + for (String item : convertSource) + { + String[] itemArray = item.split("="); + if (StringUtils.containsAny(propertyValue, separator)) + { + for (String value : propertyValue.split(separator)) + { + if (itemArray[1].equals(value)) + { + propertyString.append(itemArray[0] + separator); + break; + } + } + } + else + { + if (itemArray[1].equals(propertyValue)) + { + return itemArray[0]; + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 解析字典值 + * + * @param dictValue 字典值 + * @param dictType 字典类型 + * @param separator 分隔符 + * @return 字典标签 + */ + public static String convertDictByExp(String dictValue, String dictType, String separator) + { + return DictUtils.getDictLabel(dictType, dictValue, separator); + } + + /** + * 反向解析值字典值 + * + * @param dictLabel 字典标签 + * @param dictType 字典类型 + * @param separator 分隔符 + * @return 字典值 + */ + public static String reverseDictByExp(String dictLabel, String dictType, String separator) + { + return DictUtils.getDictValue(dictType, dictLabel, separator); + } + + /** + * 数据处理器 + * + * @param value 数据值 + * @param excel 数据注解 + * @return + */ + public String dataFormatHandlerAdapter(Object value, Excel excel) + { + try + { + Object instance = excel.handler().newInstance(); + Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class }); + value = formatMethod.invoke(instance, value, excel.args()); + } + catch (Exception e) + { + log.error("不能格式化数据 " + excel.handler(), e.getMessage()); + } + return Convert.toStr(value); + } + + /** + * 合计统计信息 + */ + private void addStatisticsData(Integer index, String text, Excel entity) + { + if (entity != null && entity.isStatistics()) + { + Double temp = 0D; + if (!statistics.containsKey(index)) + { + statistics.put(index, temp); + } + try + { + temp = Double.valueOf(text); + } + catch (NumberFormatException e) + { + } + statistics.put(index, statistics.get(index) + temp); + } + } + + /** + * 创建统计行 + */ + public void addStatisticsRow() + { + if (statistics.size() > 0) + { + Row row = sheet.createRow(sheet.getLastRowNum() + 1); + Set keys = statistics.keySet(); + Cell cell = row.createCell(0); + cell.setCellStyle(styles.get("total")); + cell.setCellValue("合计"); + + for (Integer key : keys) + { + cell = row.createCell(key); + cell.setCellStyle(styles.get("total")); + cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key))); + } + statistics.clear(); + } + } + + /** + * 编码文件名 + */ + public String encodingFilename(String filename) + { + filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx"; + return filename; + } + + /** + * 获取下载路径 + * + * @param filename 文件名称 + */ + public String getAbsoluteFile(String filename) + { + String downloadPath = RuoYiConfig.getDownloadPath() + filename; + File desc = new File(downloadPath); + if (!desc.getParentFile().exists()) + { + desc.getParentFile().mkdirs(); + } + return downloadPath; + } + + /** + * 获取bean中的属性值 + * + * @param vo 实体对象 + * @param field 字段 + * @param excel 注解 + * @return 最终的属性值 + * @throws Exception + */ + private Object getTargetValue(T vo, Field field, Excel excel) throws Exception + { + Object o = field.get(vo); + if (StringUtils.isNotEmpty(excel.targetAttr())) + { + String target = excel.targetAttr(); + if (target.contains(".")) + { + String[] targets = target.split("[.]"); + for (String name : targets) + { + o = getValue(o, name); + } + } + else + { + o = getValue(o, target); + } + } + return o; + } + + /** + * 以类的属性的get方法方法形式获取值 + * + * @param o + * @param name + * @return value + * @throws Exception + */ + private Object getValue(Object o, String name) throws Exception + { + if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name)) + { + Class clazz = o.getClass(); + Field field = clazz.getDeclaredField(name); + field.setAccessible(true); + o = field.get(o); + } + return o; + } + + /** + * 得到所有定义字段 + */ + private void createExcelField() + { + this.fields = getFields(); + this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList()); + this.maxHeight = getRowHeight(); + } + + /** + * 获取字段注解信息 + */ + public List getFields() + { + List fields = new ArrayList(); + List tempFields = new ArrayList<>(); + tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields())); + tempFields.addAll(Arrays.asList(clazz.getDeclaredFields())); + for (Field field : tempFields) + { + if (!ArrayUtils.contains(this.excludeFields, field.getName())) + { + // 单注解 + if (field.isAnnotationPresent(Excel.class)) + { + Excel attr = field.getAnnotation(Excel.class); + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) + { + field.setAccessible(true); + fields.add(new Object[] { field, attr }); + } + if (Collection.class.isAssignableFrom(field.getType())) + { + subMethod = getSubMethod(field.getName(), clazz); + ParameterizedType pt = (ParameterizedType) field.getGenericType(); + Class subClass = (Class) pt.getActualTypeArguments()[0]; + this.subFields = FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class); + } + } + + // 多注解 + if (field.isAnnotationPresent(Excels.class)) + { + Excels attrs = field.getAnnotation(Excels.class); + Excel[] excels = attrs.value(); + for (Excel attr : excels) + { + if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) + { + field.setAccessible(true); + fields.add(new Object[] { field, attr }); + } + } + } + } + } + return fields; + } + + /** + * 根据注解获取最大行高 + */ + public short getRowHeight() + { + double maxHeight = 0; + for (Object[] os : this.fields) + { + Excel excel = (Excel) os[1]; + maxHeight = Math.max(maxHeight, excel.height()); + } + return (short) (maxHeight * 20); + } + + /** + * 创建一个工作簿 + */ + public void createWorkbook() + { + this.wb = new SXSSFWorkbook(500); + this.sheet = wb.createSheet(); + wb.setSheetName(0, sheetName); + this.styles = createStyles(wb); + } + + /** + * 创建工作表 + * + * @param sheetNo sheet数量 + * @param index 序号 + */ + public void createSheet(int sheetNo, int index) + { + // 设置工作表的名称. + if (sheetNo > 1 && index > 0) + { + this.sheet = wb.createSheet(); + this.createTitle(); + wb.setSheetName(index, sheetName + index); + } + } + + /** + * 获取单元格值 + * + * @param row 获取的行 + * @param column 获取单元格列号 + * @return 单元格值 + */ + public Object getCellValue(Row row, int column) + { + if (row == null) + { + return row; + } + Object val = ""; + try + { + Cell cell = row.getCell(column); + if (StringUtils.isNotNull(cell)) + { + if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) + { + val = cell.getNumericCellValue(); + if (DateUtil.isCellDateFormatted(cell)) + { + val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换 + } + else + { + if ((Double) val % 1 != 0) + { + val = new BigDecimal(val.toString()); + } + else + { + val = new DecimalFormat("0").format(val); + } + } + } + else if (cell.getCellType() == CellType.STRING) + { + val = cell.getStringCellValue(); + } + else if (cell.getCellType() == CellType.BOOLEAN) + { + val = cell.getBooleanCellValue(); + } + else if (cell.getCellType() == CellType.ERROR) + { + val = cell.getErrorCellValue(); + } + + } + } + catch (Exception e) + { + return val; + } + return val; + } + + /** + * 判断是否是空行 + * + * @param row 判断的行 + * @return + */ + private boolean isRowEmpty(Row row) + { + if (row == null) + { + return true; + } + for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) + { + Cell cell = row.getCell(i); + if (cell != null && cell.getCellType() != CellType.BLANK) + { + return false; + } + } + return true; + } + + /** + * 获取Excel2003图片 + * + * @param sheet 当前sheet对象 + * @param workbook 工作簿对象 + * @return Map key:图片单元格索引(1_1)String,value:图片流PictureData + */ + public static Map getSheetPictures03(HSSFSheet sheet, HSSFWorkbook workbook) + { + Map sheetIndexPicMap = new HashMap(); + List pictures = workbook.getAllPictures(); + if (!pictures.isEmpty()) + { + for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) + { + HSSFClientAnchor anchor = (HSSFClientAnchor) shape.getAnchor(); + if (shape instanceof HSSFPicture) + { + HSSFPicture pic = (HSSFPicture) shape; + int pictureIndex = pic.getPictureIndex() - 1; + HSSFPictureData picData = pictures.get(pictureIndex); + String picIndex = String.valueOf(anchor.getRow1()) + "_" + String.valueOf(anchor.getCol1()); + sheetIndexPicMap.put(picIndex, picData); + } + } + return sheetIndexPicMap; + } + else + { + return sheetIndexPicMap; + } + } + + /** + * 获取Excel2007图片 + * + * @param sheet 当前sheet对象 + * @param workbook 工作簿对象 + * @return Map key:图片单元格索引(1_1)String,value:图片流PictureData + */ + public static Map getSheetPictures07(XSSFSheet sheet, XSSFWorkbook workbook) + { + Map sheetIndexPicMap = new HashMap(); + for (POIXMLDocumentPart dr : sheet.getRelations()) + { + if (dr instanceof XSSFDrawing) + { + XSSFDrawing drawing = (XSSFDrawing) dr; + List shapes = drawing.getShapes(); + for (XSSFShape shape : shapes) + { + if (shape instanceof XSSFPicture) + { + XSSFPicture pic = (XSSFPicture) shape; + XSSFClientAnchor anchor = pic.getPreferredSize(); + CTMarker ctMarker = anchor.getFrom(); + String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol(); + sheetIndexPicMap.put(picIndex, pic.getPictureData()); + } + } + } + } + return sheetIndexPicMap; + } + + /** + * 格式化不同类型的日期对象 + * + * @param dateFormat 日期格式 + * @param val 被格式化的日期对象 + * @return 格式化后的日期字符 + */ + public String parseDateToStr(String dateFormat, Object val) + { + if (val == null) + { + return ""; + } + String str; + if (val instanceof Date) + { + str = DateUtils.parseDateToStr(dateFormat, (Date) val); + } + else if (val instanceof LocalDateTime) + { + str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDateTime) val)); + } + else if (val instanceof LocalDate) + { + str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDate) val)); + } + else + { + str = val.toString(); + } + return str; + } + + /** + * 是否有对象的子列表 + */ + public boolean isSubList() + { + return StringUtils.isNotNull(subFields) && subFields.size() > 0; + } + + /** + * 是否有对象的子列表,集合不为空 + */ + public boolean isSubListValue(T vo) + { + return StringUtils.isNotNull(subFields) && subFields.size() > 0 && StringUtils.isNotNull(getListCellValue(vo)) && getListCellValue(vo).size() > 0; + } + + /** + * 获取集合的值 + */ + public Collection getListCellValue(Object obj) + { + Object value; + try + { + value = subMethod.invoke(obj, new Object[] {}); + } + catch (Exception e) + { + return new ArrayList(); + } + return (Collection) value; + } + + /** + * 获取对象的子列表方法 + * + * @param name 名称 + * @param pojoClass 类对象 + * @return 子列表方法 + */ + public Method getSubMethod(String name, Class pojoClass) + { + StringBuffer getMethodName = new StringBuffer("get"); + getMethodName.append(name.substring(0, 1).toUpperCase()); + getMethodName.append(name.substring(1)); + Method method = null; + try { + method = pojoClass.getMethod(getMethodName.toString(), new Class[]{}); + } catch (Exception e) { + log.error("获取对象异常{}", e.getMessage()); + } + return method; + } + + public void setExcelAnnotationValue(String annotatedColumnName, String annotationFieldName, String newAnnotationFieldValue,Class myClass) { + try { + Field classDeclaredField = myClass.getDeclaredField(annotatedColumnName); + Excel excel = classDeclaredField.getAnnotation(Excel.class); + InvocationHandler excelInvocationHandler = Proxy.getInvocationHandler(excel); + Field excelInvocationHandlerField = excelInvocationHandler.getClass().getDeclaredField("memberValues"); + excelInvocationHandlerField.setAccessible(true); + Map map = (Map) excelInvocationHandlerField.get(excelInvocationHandler); + map.put(annotationFieldName, newAnnotationFieldValue); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/LocalDateExcelHandlerAdapter.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/LocalDateExcelHandlerAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..10b0839e9e34c326e46ca70045f74cd4c7600c1a --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/LocalDateExcelHandlerAdapter.java @@ -0,0 +1,13 @@ +package com.ruoyi.common.utils.poi; + +import java.time.LocalDate; + +public class LocalDateExcelHandlerAdapter implements ExcelHandlerAdapter { + @Override + public LocalDate format(Object value, String[] args) { + String s = value.toString(); + LocalDate parse = LocalDate.parse(s); + + return parse; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/LocalDateTimeExcelHandlerAdapter.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/LocalDateTimeExcelHandlerAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..998f794f9076eead061be4bfa03bb4e4ab45fbe2 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/LocalDateTimeExcelHandlerAdapter.java @@ -0,0 +1,14 @@ +package com.ruoyi.common.utils.poi; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +public class LocalDateTimeExcelHandlerAdapter implements ExcelHandlerAdapter { + @Override + public LocalDateTime format(Object value, String[] args) { + String s = value.toString(); + LocalDateTime parse = LocalDateTime.parse(s); + + return parse; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/WordUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/WordUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..cb2cd5b0c78f1ae2c2acb49480e161477444d3df --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/WordUtil.java @@ -0,0 +1,47 @@ +package com.ruoyi.common.utils.poi; + +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +import static freemarker.template.Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS; + + +public class WordUtil { + private final Configuration configuration; + + public WordUtil() { + configuration = new Configuration(DEFAULT_INCOMPATIBLE_IMPROVEMENTS); + configuration.setDefaultEncoding("UTF-8"); + } + + public boolean createWord(Map dataMap, String templateName, String fileName) { + // 模板文件所在路径 + configuration.setClassForTemplateLoading(this.getClass(), "/templates"); + Template t = null; + try { + // 获取模板文件 + t = configuration.getTemplate(templateName, "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + return false; + } + // 导出文件 + File outFile = new File(fileName); + try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), StandardCharsets.UTF_8))) { + if (t != null) { + // 将填充数据填入模板文件并输出到目标文件 + t.process(dataMap, out); + } + } catch (IOException | TemplateException e1) { + e1.printStackTrace(); + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..7c5daa3cd9d477fbb5babd9c1313e4573a60137a --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java @@ -0,0 +1,489 @@ +package com.ruoyi.common.utils.reflect; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Locale; + +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.StrUtil; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; +import org.apache.poi.ss.formula.functions.T; +import org.apache.poi.ss.usermodel.DateUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.utils.DateUtils; + +/** + * 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数. + * + * @author ruoyi + */ +@SuppressWarnings("rawtypes") +public class ReflectUtils +{ + private static final String SETTER_PREFIX = "set"; + + private static final String GETTER_PREFIX = "get"; + + private static final String CGLIB_CLASS_SEPARATOR = "$$"; + + private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class); + + /** + * 调用Getter方法. + * 支持多级,如:对象名.对象名.方法 + */ + @SuppressWarnings("unchecked") + public static E invokeGetter(Object obj, String propertyName) + { + Object object = obj; + for (String name : StringUtils.split(propertyName, ".")) + { + String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name); + object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); + } + return (E) object; + } + + /** + * 调用Setter方法, 仅匹配方法名。 + * 支持多级,如:对象名.对象名.方法 + */ + public static void invokeSetter(Object obj, String propertyName, E value) + { + Object object = obj; + String[] names = StringUtils.split(propertyName, "."); + for (int i = 0; i < names.length; i++) + { + if (i < names.length - 1) + { + String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]); + object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); + } + else + { + String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]); + invokeMethodByName(object, setterMethodName, new Object[] { value }); + } + } + } + + /** + * 直接读取对象属性值, 无视private/protected修饰符, 不经过getter函数. + */ + @SuppressWarnings("unchecked") + public static E getFieldValue(final Object obj, final String fieldName) + { + Field field = getAccessibleField(obj, fieldName); + if (field == null) + { + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); + return null; + } + E result = null; + try + { + result = (E) field.get(obj); + } + catch (IllegalAccessException e) + { + logger.error("不可能抛出的异常{}", e.getMessage()); + } + return result; + } + + /** + * 直接设置对象属性值, 无视private/protected修饰符, 不经过setter函数. + */ + public static void setFieldValue(final Object obj, final String fieldName, final E value) + { + Field field = getAccessibleField(obj, fieldName); + if (field == null) + { + // throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); + return; + } + try + { + field.set(obj, value); + } + catch (IllegalAccessException e) + { + logger.error("不可能抛出的异常: {}", e.getMessage()); + } + } + + /** + * 直接调用对象方法, 无视private/protected修饰符. + * 用于一次性调用的情况,否则应使用getAccessibleMethod()函数获得Method后反复调用. + * 同时匹配方法名+参数类型, + */ + @SuppressWarnings("unchecked") + public static E invokeMethod(final Object obj, final String methodName, final Class[] parameterTypes, + final Object[] args) + { + if (obj == null || methodName == null) + { + return null; + } + Method method = getAccessibleMethod(obj, methodName, parameterTypes); + if (method == null) + { + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); + return null; + } + try + { + return (E) method.invoke(obj, args); + } + catch (Exception e) + { + String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; + throw convertReflectionExceptionToUnchecked(msg, e); + } + } + + /** + * 直接调用对象方法, 无视private/protected修饰符, + * 用于一次性调用的情况,否则应使用getAccessibleMethodByName()函数获得Method后反复调用. + * 只匹配函数名,如果有多个同名函数调用第一个。 + */ + @SuppressWarnings("unchecked") + public static E invokeMethodByName(final Object obj, final String methodName, final Object[] args) + { + Method method = getAccessibleMethodByName(obj, methodName, args.length); + if (method == null) + { + // 如果为空不报错,直接返回空。 + logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); + return null; + } + try + { + // 类型转换(将参数数据类型转换为目标方法参数类型) + Class[] cs = method.getParameterTypes(); + for (int i = 0; i < cs.length; i++) + { + if (args[i] != null && !args[i].getClass().equals(cs[i])) + { + if (cs[i] == String.class) + { + args[i] = Convert.toStr(args[i]); + if (StringUtils.endsWith((String) args[i], ".0")) + { + args[i] = StringUtils.substringBefore((String) args[i], ".0"); + } + } + else if (cs[i] == Integer.class) + { + args[i] = Convert.toInt(args[i]); + } + else if (cs[i] == Long.class) + { + args[i] = Convert.toLong(args[i]); + } + else if (cs[i] == Double.class) + { + args[i] = Convert.toDouble(args[i]); + } + else if (cs[i] == Float.class) + { + args[i] = Convert.toFloat(args[i]); + } + else if (cs[i] == Date.class) + { + if (args[i] instanceof String) + { + args[i] = DateUtils.parseDate(args[i]); + } + else + { + args[i] = DateUtil.getJavaDate((Double) args[i]); + } + } + else if (cs[i] == LocalDate.class) + { + if (args[i] instanceof String) + { + if(StrUtil.isBlank(args[i].toString())){ + args[i]=null; + }else { + SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + String str = sdf1.format(sdf.parse(args[i].toString())); + args[i] = LocalDate.parse(str, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } catch (ParseException e) { + try { + args[i] = LocalDate.parse(args[i].toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd")); + } catch (Exception ex) { + args[i]=null; + } + } + } + } + } + else if (cs[i] == LocalDateTime.class) + { + if (args[i] instanceof String) + { + if(StrUtil.isBlank(args[i].toString())){ + args[i]=null; + }else { + SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + String str = sdf1.format(sdf.parse(args[i].toString())); + args[i] = LocalDateTime.parse(str, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } catch (ParseException e) { + try { + args[i] = LocalDateTime.parse(args[i].toString(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } catch (Exception ex) { + args[i]=null; + } + } + } + } + else + { + if(StrUtil.isBlank(args[i].toString())){ + args[i]=null; + }else { + args[i] = LocalDateTimeUtil.of(Long.parseLong(args[i].toString())); + } + } + } + else if (cs[i] == boolean.class || cs[i] == Boolean.class) + { + args[i] = Convert.toBool(args[i]); + } + } + } + return (E) method.invoke(obj, args); + } + catch (Exception e) + { + String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; + throw convertReflectionExceptionToUnchecked(msg, e); + } + } + + /** + * 循环向上转型, 获取对象的DeclaredField, 并强制设置为可访问. + * 如向上转型到Object仍无法找到, 返回null. + */ + public static Field getAccessibleField(final Object obj, final String fieldName) + { + // 为空不报错。直接返回 null + if (obj == null) + { + return null; + } + Validate.notBlank(fieldName, "fieldName can't be blank"); + for (Class superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) + { + try + { + Field field = superClass.getDeclaredField(fieldName); + makeAccessible(field); + return field; + } + catch (NoSuchFieldException e) + { + continue; + } + } + return null; + } + + /** + * 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. + * 如向上转型到Object仍无法找到, 返回null. + * 匹配函数名+参数类型。 + * 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) + */ + public static Method getAccessibleMethod(final Object obj, final String methodName, + final Class... parameterTypes) + { + // 为空不报错。直接返回 null + if (obj == null) + { + return null; + } + Validate.notBlank(methodName, "methodName can't be blank"); + for (Class searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) + { + try + { + Method method = searchType.getDeclaredMethod(methodName, parameterTypes); + makeAccessible(method); + return method; + } + catch (NoSuchMethodException e) + { + continue; + } + } + return null; + } + + /** + * 循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. + * 如向上转型到Object仍无法找到, 返回null. + * 只匹配函数名。 + * 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) + */ + public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum) + { + // 为空不报错。直接返回 null + if (obj == null) + { + return null; + } + Validate.notBlank(methodName, "methodName can't be blank"); + for (Class searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) + { + Method[] methods = searchType.getDeclaredMethods(); + for (Method method : methods) + { + if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum) + { + makeAccessible(method); + return method; + } + } + } + return null; + } + + /** + * 改变private/protected的方法为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。 + */ + public static void makeAccessible(Method method) + { + if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) + && !method.isAccessible()) + { + method.setAccessible(true); + } + } + + /** + * 改变private/protected的成员变量为public,尽量不调用实际改动的语句,避免JDK的SecurityManager抱怨。 + */ + public static void makeAccessible(Field field) + { + if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) + || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) + { + field.setAccessible(true); + } + } + + /** + * 通过反射, 获得Class定义中声明的泛型参数的类型, 注意泛型必须定义在父类处 + * 如无法找到, 返回Object.class. + */ + @SuppressWarnings("unchecked") + public static Class getClassGenricType(final Class clazz) + { + return getClassGenricType(clazz, 0); + } + + /** + * 通过反射, 获得Class定义中声明的父类的泛型参数的类型. + * 如无法找到, 返回Object.class. + */ + public static Class getClassGenricType(final Class clazz, final int index) + { + Type genType = clazz.getGenericSuperclass(); + + if (!(genType instanceof ParameterizedType)) + { + logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType"); + return Object.class; + } + + Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); + + if (index >= params.length || index < 0) + { + logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " + + params.length); + return Object.class; + } + if (!(params[index] instanceof Class)) + { + logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); + return Object.class; + } + + return (Class) params[index]; + } + + public static Class getUserClass(Object instance) + { + if (instance == null) + { + throw new RuntimeException("Instance must not be null"); + } + Class clazz = instance.getClass(); + if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) + { + Class superClass = clazz.getSuperclass(); + if (superClass != null && !Object.class.equals(superClass)) + { + return superClass; + } + } + return clazz; + + } + + + + public static List toList(Object obj, Class cla) { + List list = new ArrayList(); + //判断参数是否为List类型 + if (obj instanceof List) { + for (Object o : (List) obj) { + //将父类对象强制转换为子类对象 + list.add(cla.cast(o)); + } + return list; + } + return null; + } + + /** + * 将反射时的checked exception转换为unchecked exception. + */ + public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e) + { + if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException + || e instanceof NoSuchMethodException) + { + return new IllegalArgumentException(msg, e); + } + else if (e instanceof InvocationTargetException) + { + return new RuntimeException(msg, ((InvocationTargetException) e).getTargetException()); + } + return new RuntimeException(msg, e); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java new file mode 100644 index 0000000000000000000000000000000000000000..ca1cd92480e958a7cf4da69a6e8c2457dbed9776 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java @@ -0,0 +1,291 @@ +package com.ruoyi.common.utils.sign; + +/** + * Base64工具类 + * + * @author ruoyi + */ +public final class Base64 +{ + static private final int BASELENGTH = 128; + static private final int LOOKUPLENGTH = 64; + static private final int TWENTYFOURBITGROUP = 24; + static private final int EIGHTBIT = 8; + static private final int SIXTEENBIT = 16; + static private final int FOURBYTE = 4; + static private final int SIGN = -128; + static private final char PAD = '='; + static final private byte[] base64Alphabet = new byte[BASELENGTH]; + static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; + + static + { + for (int i = 0; i < BASELENGTH; ++i) + { + base64Alphabet[i] = -1; + } + for (int i = 'Z'; i >= 'A'; i--) + { + base64Alphabet[i] = (byte) (i - 'A'); + } + for (int i = 'z'; i >= 'a'; i--) + { + base64Alphabet[i] = (byte) (i - 'a' + 26); + } + + for (int i = '9'; i >= '0'; i--) + { + base64Alphabet[i] = (byte) (i - '0' + 52); + } + + base64Alphabet['+'] = 62; + base64Alphabet['/'] = 63; + + for (int i = 0; i <= 25; i++) + { + lookUpBase64Alphabet[i] = (char) ('A' + i); + } + + for (int i = 26, j = 0; i <= 51; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('a' + j); + } + + for (int i = 52, j = 0; i <= 61; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('0' + j); + } + lookUpBase64Alphabet[62] = (char) '+'; + lookUpBase64Alphabet[63] = (char) '/'; + } + + private static boolean isWhiteSpace(char octect) + { + return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); + } + + private static boolean isPad(char octect) + { + return (octect == PAD); + } + + private static boolean isData(char octect) + { + return (octect < BASELENGTH && base64Alphabet[octect] != -1); + } + + /** + * Encodes hex octects into Base64 + * + * @param binaryData Array containing binaryData + * @return Encoded Base64 array + */ + public static String encode(byte[] binaryData) + { + if (binaryData == null) + { + return null; + } + + int lengthDataBits = binaryData.length * EIGHTBIT; + if (lengthDataBits == 0) + { + return ""; + } + + int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; + int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; + int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; + char encodedData[] = null; + + encodedData = new char[numberQuartet * 4]; + + byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; + + int encodedIndex = 0; + int dataIndex = 0; + + for (int i = 0; i < numberTriplets; i++) + { + b1 = binaryData[dataIndex++]; + b2 = binaryData[dataIndex++]; + b3 = binaryData[dataIndex++]; + + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; + } + + // form integral number of 6-bit groups + if (fewerThan24bits == EIGHTBIT) + { + b1 = binaryData[dataIndex]; + k = (byte) (b1 & 0x03); + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; + encodedData[encodedIndex++] = PAD; + encodedData[encodedIndex++] = PAD; + } + else if (fewerThan24bits == SIXTEENBIT) + { + b1 = binaryData[dataIndex]; + b2 = binaryData[dataIndex + 1]; + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; + encodedData[encodedIndex++] = PAD; + } + return new String(encodedData); + } + + /** + * Decodes Base64 data into octects + * + * @param encoded string containing Base64 data + * @return Array containind decoded data. + */ + public static byte[] decode(String encoded) + { + if (encoded == null) + { + return null; + } + + char[] base64Data = encoded.toCharArray(); + // remove white spaces + int len = removeWhiteSpace(base64Data); + + if (len % FOURBYTE != 0) + { + return null;// should be divisible by four + } + + int numberQuadruple = (len / FOURBYTE); + + if (numberQuadruple == 0) + { + return new byte[0]; + } + + byte decodedData[] = null; + byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; + char d1 = 0, d2 = 0, d3 = 0, d4 = 0; + + int i = 0; + int encodedIndex = 0; + int dataIndex = 0; + decodedData = new byte[(numberQuadruple) * 3]; + + for (; i < numberQuadruple - 1; i++) + { + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) + || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) + { + return null; + } // if found "no data" just return null + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + } + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) + { + return null;// if found "no data" just return null + } + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + + d3 = base64Data[dataIndex++]; + d4 = base64Data[dataIndex++]; + if (!isData((d3)) || !isData((d4))) + {// Check if they are PAD characters + if (isPad(d3) && isPad(d4)) + { + if ((b2 & 0xf) != 0)// last 4 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 1]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + return tmp; + } + else if (!isPad(d3) && isPad(d4)) + { + b3 = base64Alphabet[d3]; + if ((b3 & 0x3) != 0)// last 2 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 2]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + return tmp; + } + else + { + return null; + } + } + else + { // No PAD e.g 3cQl + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + + } + return decodedData; + } + + /** + * remove WhiteSpace from MIME containing encoded Base64 data. + * + * @param data the byte array of base64 data (with WS) + * @return the new length + */ + private static int removeWhiteSpace(char[] data) + { + if (data == null) + { + return 0; + } + + // count characters that's not whitespace + int newSize = 0; + int len = data.length; + for (int i = 0; i < len; i++) + { + if (!isWhiteSpace(data[i])) + { + data[newSize++] = data[i]; + } + } + return newSize; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java new file mode 100644 index 0000000000000000000000000000000000000000..c1c58dbc0848efc983ca6df62b2c54fd51f5b89e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java @@ -0,0 +1,67 @@ +package com.ruoyi.common.utils.sign; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Md5加密方法 + * + * @author ruoyi + */ +public class Md5Utils +{ + private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); + + private static byte[] md5(String s) + { + MessageDigest algorithm; + try + { + algorithm = MessageDigest.getInstance("MD5"); + algorithm.reset(); + algorithm.update(s.getBytes("UTF-8")); + byte[] messageDigest = algorithm.digest(); + return messageDigest; + } + catch (Exception e) + { + log.error("MD5 Error...", e); + } + return null; + } + + private static final String toHex(byte hash[]) + { + if (hash == null) + { + return null; + } + StringBuffer buf = new StringBuffer(hash.length * 2); + int i; + + for (i = 0; i < hash.length; i++) + { + if ((hash[i] & 0xff) < 0x10) + { + buf.append("0"); + } + buf.append(Long.toString(hash[i] & 0xff, 16)); + } + return buf.toString(); + } + + public static String hash(String s) + { + try + { + return new String(toHex(md5(s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); + } + catch (Exception e) + { + log.error("not supported charset...{}", e); + return s; + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..f290ec3763f5b25f78117f0419ffc608ab88dc50 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java @@ -0,0 +1,158 @@ +package com.ruoyi.common.utils.spring; + +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; +import com.ruoyi.common.utils.StringUtils; + +/** + * spring工具类 方便在非spring管理环境中获取bean + * + * @author ruoyi + */ +@Component +public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware +{ + /** Spring应用上下文环境 */ + private static ConfigurableListableBeanFactory beanFactory; + + private static ApplicationContext applicationContext; + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException + { + SpringUtils.beanFactory = beanFactory; + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException + { + SpringUtils.applicationContext = applicationContext; + } + + /** + * 获取对象 + * + * @param name + * @return Object 一个以所给名字注册的bean的实例 + * @throws org.springframework.beans.BeansException + * + */ + @SuppressWarnings("unchecked") + public static T getBean(String name) throws BeansException + { + return (T) beanFactory.getBean(name); + } + + /** + * 获取类型为requiredType的对象 + * + * @param clz + * @return + * @throws org.springframework.beans.BeansException + * + */ + public static T getBean(Class clz) throws BeansException + { + T result = (T) beanFactory.getBean(clz); + return result; + } + + /** + * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true + * + * @param name + * @return boolean + */ + public static boolean containsBean(String name) + { + return beanFactory.containsBean(name); + } + + /** + * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) + * + * @param name + * @return boolean + * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException + * + */ + public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.isSingleton(name); + } + + /** + * @param name + * @return Class 注册对象的类型 + * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException + * + */ + public static Class getType(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.getType(name); + } + + /** + * 如果给定的bean名字在bean定义中有别名,则返回这些别名 + * + * @param name + * @return + * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException + * + */ + public static String[] getAliases(String name) throws NoSuchBeanDefinitionException + { + return beanFactory.getAliases(name); + } + + /** + * 获取aop代理对象 + * + * @param invoker + * @return + */ + @SuppressWarnings("unchecked") + public static T getAopProxy(T invoker) + { + return (T) AopContext.currentProxy(); + } + + /** + * 获取当前的环境配置,无配置返回null + * + * @return 当前的环境配置 + */ + public static String[] getActiveProfiles() + { + return applicationContext.getEnvironment().getActiveProfiles(); + } + + /** + * 获取当前的环境配置,当有多个环境配置时,只获取第一个 + * + * @return 当前的环境配置 + */ + public static String getActiveProfile() + { + final String[] activeProfiles = getActiveProfiles(); + return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null; + } + + /** + * 获取配置文件中的值 + * + * @param key 配置文件的key + * @return 当前的配置文件的值 + * + */ + public static String getRequiredProperty(String key) + { + return applicationContext.getEnvironment().getRequiredProperty(key); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..246a9cfc89f8c7a69990cbbda763aba0f1707da6 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sql/SqlUtil.java @@ -0,0 +1,61 @@ +package com.ruoyi.common.utils.sql; + +import com.ruoyi.common.exception.UtilException; +import com.ruoyi.common.utils.StringUtils; + +/** + * sql操作工具类 + * + * @author ruoyi + */ +public class SqlUtil +{ + /** + * 定义常用的 sql关键字 + */ + public static String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare "; + + /** + * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序) + */ + public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; + + /** + * 检查字符,防止注入绕过 + */ + public static String escapeOrderBySql(String value) + { + if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) + { + throw new UtilException("参数不符合规范,不能进行查询"); + } + return value; + } + + /** + * 验证 order by 语法是否符合规范 + */ + public static boolean isValidOrderBySql(String value) + { + return value.matches(SQL_PATTERN); + } + + /** + * SQL关键字检查 + */ + public static void filterKeyword(String value) + { + if (StringUtils.isEmpty(value)) + { + return; + } + String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|"); + for (String sqlKeyword : sqlKeywords) + { + if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1) + { + throw new UtilException("参数存在SQL注入风险"); + } + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..2c84427151e9416d2eb6cb7144383414c102efc0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java @@ -0,0 +1,49 @@ +package com.ruoyi.common.utils.uuid; + +/** + * ID生成器工具类 + * + * @author ruoyi + */ +public class IdUtils +{ + /** + * 获取随机UUID + * + * @return 随机UUID + */ + public static String randomUUID() + { + return UUID.randomUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线 + * + * @return 简化的UUID,去掉了横线 + */ + public static String simpleUUID() + { + return UUID.randomUUID().toString(true); + } + + /** + * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 随机UUID + */ + public static String fastUUID() + { + return UUID.fastUUID().toString(); + } + + /** + * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID + * + * @return 简化的UUID,去掉了横线 + */ + public static String fastSimpleUUID() + { + return UUID.fastUUID().toString(true); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/Seq.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/Seq.java new file mode 100644 index 0000000000000000000000000000000000000000..528f3c1b631c5fdcc6a7114c2d0b4f881a01ce16 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/Seq.java @@ -0,0 +1,86 @@ +package com.ruoyi.common.utils.uuid; + +import java.util.concurrent.atomic.AtomicInteger; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; + +/** + * @author ruoyi 序列生成类 + */ +public class Seq +{ + // 通用序列类型 + public static final String commSeqType = "COMMON"; + + // 上传序列类型 + public static final String uploadSeqType = "UPLOAD"; + + // 通用接口序列数 + private static AtomicInteger commSeq = new AtomicInteger(1); + + // 上传接口序列数 + private static AtomicInteger uploadSeq = new AtomicInteger(1); + + // 机器标识 + private static String machineCode = "A"; + + /** + * 获取通用序列号 + * + * @return 序列值 + */ + public static String getId() + { + return getId(commSeqType); + } + + /** + * 默认16位序列号 yyMMddHHmmss + 一位机器标识 + 3长度循环递增字符串 + * + * @return 序列值 + */ + public static String getId(String type) + { + AtomicInteger atomicInt = commSeq; + if (uploadSeqType.equals(type)) + { + atomicInt = uploadSeq; + } + return getId(atomicInt, 3); + } + + /** + * 通用接口序列号 yyMMddHHmmss + 一位机器标识 + length长度循环递增字符串 + * + * @param atomicInt 序列数 + * @param length 数值长度 + * @return 序列值 + */ + public static String getId(AtomicInteger atomicInt, int length) + { + String result = DateUtils.dateTimeNow(); + result += machineCode; + result += getSeq(atomicInt, length); + return result; + } + + /** + * 序列循环递增字符串[1, 10 的 (length)幂次方), 用0左补齐length位数 + * + * @return 序列值 + */ + private synchronized static String getSeq(AtomicInteger atomicInt, int length) + { + // 先取值再+1 + int value = atomicInt.getAndIncrement(); + + // 如果更新后值>=10 的 (length)幂次方则重置为1 + int maxSeq = (int) Math.pow(10, length); + if (atomicInt.get() >= maxSeq) + { + atomicInt.set(1); + } + // 转字符串,用0左补齐 + return StringUtils.padl(value, length); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java new file mode 100644 index 0000000000000000000000000000000000000000..dfda46cf019d625c2def86da904ca02398c1f9d4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java @@ -0,0 +1,484 @@ +package com.ruoyi.common.utils.uuid; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; +import com.ruoyi.common.exception.UtilException; + +/** + * 提供通用唯一识别码(universally unique identifier)(UUID)实现 + * + * @author ruoyi + */ +public final class UUID implements java.io.Serializable, Comparable +{ + private static final long serialVersionUID = -1185015143654744140L; + + /** + * SecureRandom 的单例 + * + */ + private static class Holder + { + static final SecureRandom numberGenerator = getSecureRandom(); + } + + /** 此UUID的最高64有效位 */ + private final long mostSigBits; + + /** 此UUID的最低64有效位 */ + private final long leastSigBits; + + /** + * 私有构造 + * + * @param data 数据 + */ + private UUID(byte[] data) + { + long msb = 0; + long lsb = 0; + assert data.length == 16 : "data must be 16 bytes in length"; + for (int i = 0; i < 8; i++) + { + msb = (msb << 8) | (data[i] & 0xff); + } + for (int i = 8; i < 16; i++) + { + lsb = (lsb << 8) | (data[i] & 0xff); + } + this.mostSigBits = msb; + this.leastSigBits = lsb; + } + + /** + * 使用指定的数据构造新的 UUID。 + * + * @param mostSigBits 用于 {@code UUID} 的最高有效 64 位 + * @param leastSigBits 用于 {@code UUID} 的最低有效 64 位 + */ + public UUID(long mostSigBits, long leastSigBits) + { + this.mostSigBits = mostSigBits; + this.leastSigBits = leastSigBits; + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的本地线程伪随机数生成器生成该 UUID。 + * + * @return 随机生成的 {@code UUID} + */ + public static UUID fastUUID() + { + return randomUUID(false); + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 + * + * @return 随机生成的 {@code UUID} + */ + public static UUID randomUUID() + { + return randomUUID(true); + } + + /** + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 使用加密的强伪随机数生成器生成该 UUID。 + * + * @param isSecure 是否使用{@link SecureRandom}如果是可以获得更安全的随机码,否则可以得到更好的性能 + * @return 随机生成的 {@code UUID} + */ + public static UUID randomUUID(boolean isSecure) + { + final Random ng = isSecure ? Holder.numberGenerator : getRandom(); + + byte[] randomBytes = new byte[16]; + ng.nextBytes(randomBytes); + randomBytes[6] &= 0x0f; /* clear version */ + randomBytes[6] |= 0x40; /* set to version 4 */ + randomBytes[8] &= 0x3f; /* clear variant */ + randomBytes[8] |= 0x80; /* set to IETF variant */ + return new UUID(randomBytes); + } + + /** + * 根据指定的字节数组获取类型 3(基于名称的)UUID 的静态工厂。 + * + * @param name 用于构造 UUID 的字节数组。 + * + * @return 根据指定数组生成的 {@code UUID} + */ + public static UUID nameUUIDFromBytes(byte[] name) + { + MessageDigest md; + try + { + md = MessageDigest.getInstance("MD5"); + } + catch (NoSuchAlgorithmException nsae) + { + throw new InternalError("MD5 not supported"); + } + byte[] md5Bytes = md.digest(name); + md5Bytes[6] &= 0x0f; /* clear version */ + md5Bytes[6] |= 0x30; /* set to version 3 */ + md5Bytes[8] &= 0x3f; /* clear variant */ + md5Bytes[8] |= 0x80; /* set to IETF variant */ + return new UUID(md5Bytes); + } + + /** + * 根据 {@link #toString()} 方法中描述的字符串标准表示形式创建{@code UUID}。 + * + * @param name 指定 {@code UUID} 字符串 + * @return 具有指定值的 {@code UUID} + * @throws IllegalArgumentException 如果 name 与 {@link #toString} 中描述的字符串表示形式不符抛出此异常 + * + */ + public static UUID fromString(String name) + { + String[] components = name.split("-"); + if (components.length != 5) + { + throw new IllegalArgumentException("Invalid UUID string: " + name); + } + for (int i = 0; i < 5; i++) + { + components[i] = "0x" + components[i]; + } + + long mostSigBits = Long.decode(components[0]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[1]).longValue(); + mostSigBits <<= 16; + mostSigBits |= Long.decode(components[2]).longValue(); + + long leastSigBits = Long.decode(components[3]).longValue(); + leastSigBits <<= 48; + leastSigBits |= Long.decode(components[4]).longValue(); + + return new UUID(mostSigBits, leastSigBits); + } + + /** + * 返回此 UUID 的 128 位值中的最低有效 64 位。 + * + * @return 此 UUID 的 128 位值中的最低有效 64 位。 + */ + public long getLeastSignificantBits() + { + return leastSigBits; + } + + /** + * 返回此 UUID 的 128 位值中的最高有效 64 位。 + * + * @return 此 UUID 的 128 位值中最高有效 64 位。 + */ + public long getMostSignificantBits() + { + return mostSigBits; + } + + /** + * 与此 {@code UUID} 相关联的版本号. 版本号描述此 {@code UUID} 是如何生成的。 + *

+ * 版本号具有以下含意: + *

    + *
  • 1 基于时间的 UUID + *
  • 2 DCE 安全 UUID + *
  • 3 基于名称的 UUID + *
  • 4 随机生成的 UUID + *
+ * + * @return 此 {@code UUID} 的版本号 + */ + public int version() + { + // Version is bits masked by 0x000000000000F000 in MS long + return (int) ((mostSigBits >> 12) & 0x0f); + } + + /** + * 与此 {@code UUID} 相关联的变体号。变体号描述 {@code UUID} 的布局。 + *

+ * 变体号具有以下含意: + *

    + *
  • 0 为 NCS 向后兼容保留 + *
  • 2 IETF RFC 4122(Leach-Salz), 用于此类 + *
  • 6 保留,微软向后兼容 + *
  • 7 保留供以后定义使用 + *
+ * + * @return 此 {@code UUID} 相关联的变体号 + */ + public int variant() + { + // This field is composed of a varying number of bits. + // 0 - - Reserved for NCS backward compatibility + // 1 0 - The IETF aka Leach-Salz variant (used by this class) + // 1 1 0 Reserved, Microsoft backward compatibility + // 1 1 1 Reserved for future definition. + return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62))) & (leastSigBits >> 63)); + } + + /** + * 与此 UUID 相关联的时间戳值。 + * + *

+ * 60 位的时间戳值根据此 {@code UUID} 的 time_low、time_mid 和 time_hi 字段构造。
+ * 所得到的时间戳以 100 毫微秒为单位,从 UTC(通用协调时间) 1582 年 10 月 15 日零时开始。 + * + *

+ * 时间戳值仅在在基于时间的 UUID(其 version 类型为 1)中才有意义。
+ * 如果此 {@code UUID} 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 + * + * @throws UnsupportedOperationException 如果此 {@code UUID} 不是 version 为 1 的 UUID。 + */ + public long timestamp() throws UnsupportedOperationException + { + checkTimeBase(); + return (mostSigBits & 0x0FFFL) << 48// + | ((mostSigBits >> 16) & 0x0FFFFL) << 32// + | mostSigBits >>> 32; + } + + /** + * 与此 UUID 相关联的时钟序列值。 + * + *

+ * 14 位的时钟序列值根据此 UUID 的 clock_seq 字段构造。clock_seq 字段用于保证在基于时间的 UUID 中的时间唯一性。 + *

+ * {@code clockSequence} 值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。 如果此 UUID 不是基于时间的 UUID,则此方法抛出 + * UnsupportedOperationException。 + * + * @return 此 {@code UUID} 的时钟序列 + * + * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 + */ + public int clockSequence() throws UnsupportedOperationException + { + checkTimeBase(); + return (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48); + } + + /** + * 与此 UUID 相关的节点值。 + * + *

+ * 48 位的节点值根据此 UUID 的 node 字段构造。此字段旨在用于保存机器的 IEEE 802 地址,该地址用于生成此 UUID 以保证空间唯一性。 + *

+ * 节点值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。
+ * 如果此 UUID 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。 + * + * @return 此 {@code UUID} 的节点值 + * + * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1 + */ + public long node() throws UnsupportedOperationException + { + checkTimeBase(); + return leastSigBits & 0x0000FFFFFFFFFFFFL; + } + + /** + * 返回此{@code UUID} 的字符串表现形式。 + * + *

+ * UUID 的字符串表示形式由此 BNF 描述: + * + *

+     * {@code
+     * UUID                   = ----
+     * time_low               = 4*
+     * time_mid               = 2*
+     * time_high_and_version  = 2*
+     * variant_and_sequence   = 2*
+     * node                   = 6*
+     * hexOctet               = 
+     * hexDigit               = [0-9a-fA-F]
+     * }
+     * 
+ * + * + * + * @return 此{@code UUID} 的字符串表现形式 + * @see #toString(boolean) + */ + @Override + public String toString() + { + return toString(false); + } + + /** + * 返回此{@code UUID} 的字符串表现形式。 + * + *

+ * UUID 的字符串表示形式由此 BNF 描述: + * + *

+     * {@code
+     * UUID                   = ----
+     * time_low               = 4*
+     * time_mid               = 2*
+     * time_high_and_version  = 2*
+     * variant_and_sequence   = 2*
+     * node                   = 6*
+     * hexOctet               = 
+     * hexDigit               = [0-9a-fA-F]
+     * }
+     * 
+ * + * + * + * @param isSimple 是否简单模式,简单模式为不带'-'的UUID字符串 + * @return 此{@code UUID} 的字符串表现形式 + */ + public String toString(boolean isSimple) + { + final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36); + // time_low + builder.append(digits(mostSigBits >> 32, 8)); + if (!isSimple) + { + builder.append('-'); + } + // time_mid + builder.append(digits(mostSigBits >> 16, 4)); + if (!isSimple) + { + builder.append('-'); + } + // time_high_and_version + builder.append(digits(mostSigBits, 4)); + if (!isSimple) + { + builder.append('-'); + } + // variant_and_sequence + builder.append(digits(leastSigBits >> 48, 4)); + if (!isSimple) + { + builder.append('-'); + } + // node + builder.append(digits(leastSigBits, 12)); + + return builder.toString(); + } + + /** + * 返回此 UUID 的哈希码。 + * + * @return UUID 的哈希码值。 + */ + @Override + public int hashCode() + { + long hilo = mostSigBits ^ leastSigBits; + return ((int) (hilo >> 32)) ^ (int) hilo; + } + + /** + * 将此对象与指定对象比较。 + *

+ * 当且仅当参数不为 {@code null}、而是一个 UUID 对象、具有与此 UUID 相同的 varriant、包含相同的值(每一位均相同)时,结果才为 {@code true}。 + * + * @param obj 要与之比较的对象 + * + * @return 如果对象相同,则返回 {@code true};否则返回 {@code false} + */ + @Override + public boolean equals(Object obj) + { + if ((null == obj) || (obj.getClass() != UUID.class)) + { + return false; + } + UUID id = (UUID) obj; + return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits); + } + + // Comparison Operations + + /** + * 将此 UUID 与指定的 UUID 比较。 + * + *

+ * 如果两个 UUID 不同,且第一个 UUID 的最高有效字段大于第二个 UUID 的对应字段,则第一个 UUID 大于第二个 UUID。 + * + * @param val 与此 UUID 比较的 UUID + * + * @return 在此 UUID 小于、等于或大于 val 时,分别返回 -1、0 或 1。 + * + */ + @Override + public int compareTo(UUID val) + { + // The ordering is intentionally set up so that the UUIDs + // can simply be numerically compared as two numbers + return (this.mostSigBits < val.mostSigBits ? -1 : // + (this.mostSigBits > val.mostSigBits ? 1 : // + (this.leastSigBits < val.leastSigBits ? -1 : // + (this.leastSigBits > val.leastSigBits ? 1 : // + 0)))); + } + + // ------------------------------------------------------------------------------------------------------------------- + // Private method start + /** + * 返回指定数字对应的hex值 + * + * @param val 值 + * @param digits 位 + * @return 值 + */ + private static String digits(long val, int digits) + { + long hi = 1L << (digits * 4); + return Long.toHexString(hi | (val & (hi - 1))).substring(1); + } + + /** + * 检查是否为time-based版本UUID + */ + private void checkTimeBase() + { + if (version() != 1) + { + throw new UnsupportedOperationException("Not a time-based UUID"); + } + } + + /** + * 获取{@link SecureRandom},类提供加密的强随机数生成器 (RNG) + * + * @return {@link SecureRandom} + */ + public static SecureRandom getSecureRandom() + { + try + { + return SecureRandom.getInstance("SHA1PRNG"); + } + catch (NoSuchAlgorithmException e) + { + throw new UtilException(e); + } + } + + /** + * 获取随机数生成器对象
+ * ThreadLocalRandom是JDK 7之后提供并发产生随机数,能够解决多个线程发生的竞争争夺。 + * + * @return {@link ThreadLocalRandom} + */ + public static ThreadLocalRandom getRandom() + { + return ThreadLocalRandom.current(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java b/ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java new file mode 100644 index 0000000000000000000000000000000000000000..7bfdf04bd42e84aca2339f6cd0b3333b9bfa4d55 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java @@ -0,0 +1,27 @@ +package com.ruoyi.common.xss; + +import javax.validation.Constraint; +import javax.validation.Payload; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 自定义xss校验注解 + * + * @author ruoyi + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(value = { ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER }) +@Constraint(validatedBy = { XssValidator.class }) +public @interface Xss +{ + String message() + + default "不允许任何脚本运行"; + + Class[] groups() default {}; + + Class[] payload() default {}; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java b/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java new file mode 100644 index 0000000000000000000000000000000000000000..ed9ec1f555b54376d0cf8bb6500fcecc25e04533 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssValidator.java @@ -0,0 +1,34 @@ +package com.ruoyi.common.xss; + +import com.ruoyi.common.utils.StringUtils; +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 自定义xss校验注解实现 + * + * @author ruoyi + */ +public class XssValidator implements ConstraintValidator +{ + private static final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />"; + + @Override + public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) + { + if (StringUtils.isBlank(value)) + { + return true; + } + return !containsHtml(value); + } + + public static boolean containsHtml(String value) + { + Pattern pattern = Pattern.compile(HTML_PATTERN); + Matcher matcher = pattern.matcher(value); + return matcher.matches(); + } +} \ No newline at end of file diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..62bcfcb551a793dc5f771001ccd7d475e4de22cd --- /dev/null +++ b/ruoyi-framework/pom.xml @@ -0,0 +1,76 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + 4.0.0 + + ruoyi-framework + + + framework框架核心 + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + com.alibaba + druid-spring-boot-starter + + + + + pro.fessional + kaptcha + + + javax.servlet-api + javax.servlet + + + + + + + com.github.oshi + oshi-core + + + + + com.ruoyi + ruoyi-system + + + + + com.baomidou + mybatis-plus-boot-starter + + + + + org.redisson + redisson + + + + + \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/BindDictAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/BindDictAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..04e43672c866225b6bd2ed471bbc2db75aee578d --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/BindDictAspect.java @@ -0,0 +1,161 @@ +package com.ruoyi.framework.aspectj; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ReflectUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.annotation.BindDict; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.system.service.ISysDictDataService; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +/** + * @author ntxz + * @create 2023-02-20-14:36 + */ +@Aspect +@Component +@Slf4j +public class BindDictAspect { + + @Autowired + private ISysDictDataService sysDictDataService; + + + //切入点 com.ntxz.functional包下所有 类名是 *Controller 的类,方法参数任意个。 + @Pointcut("execution(* com.ruoyi.*.controller..*.*Controller.*(..))") + public void around() { + } + + /* + * 环绕通知 + * */ + @Around("around()") + public Object process(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { + //1.执行原方法 + Object proceed = proceedingJoinPoint.proceed(); + //2.拿到原方法的原返回值 调用parseDict进行字典转换 + this.parseDict(proceed); + return proceed; + } + + + private void parseDict(Object result) throws IllegalAccessException { + +// 1. 检测是否为统一返回(更据自身情况修改,Result是我自己编写的一个统一返回) + if (result instanceof TableDataInfo) { + //2.获取Result中的数据体 + Object metaObj = ((TableDataInfo) result).getRows(); + + if (metaObj instanceof Page) { + List list = ((Page) metaObj).getRecords(); + for (Object a : list) { + doParseDict(a); + } + } + //返回是否是列表 + if (metaObj instanceof ArrayList) { + ArrayList list = (ArrayList) metaObj; + for (Object a : list) { + doParseDict(a); + } + } + + } + if (result instanceof AjaxResult) { + //2.获取Result中的数据体 + Object metaObj = ((AjaxResult) result).get("data"); + + //返回单个对象 + if (metaObj != null && !(metaObj instanceof ArrayList)) { + doParseDict(metaObj); + } + + } + + } + + //绑定字典 + public void doParseDict(Object obj) throws IllegalAccessException { + Field[] fields = ReflectUtil.getFields(obj.getClass()); + if (fields != null && fields.length != 0) { + Iterator iterator = Arrays.stream(fields).iterator(); + while (iterator.hasNext()) { + Field field = iterator.next(); + BindDict dict = field.getAnnotation(BindDict.class); + //获取绑定了注解的字段 + if (dict != null) { + if (List.class.equals(field.getType())) { + ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType(); + Class actualTypeArgument = (Class) parameterizedType.getActualTypeArguments()[0]; + if(actualTypeArgument.getClassLoader()==null){ + continue; + } + field.setAccessible(true); + List list = (List) field.get(obj); + if(CollUtil.isNotEmpty(list)) { + for (Object object : list) { + doParseDict(object); + } + } + continue; + + } + if (field.getType().getClassLoader() != null) { + field.setAccessible(true); + Object o = field.get(obj); + if(o!=null) { + doParseDict(o); + } + continue; + } + + //设置取消字段保护 + field.setAccessible(true); + String mapping = dict.filedMapping();//字典值所在字段名 + Field mappingField = ReflectUtil.getField(obj.getClass(), mapping);//获取字典值所在字段 + mappingField.setAccessible(true); + + //查询字典表 + QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("dict_type",dict.type()).eq("dict_value",mappingField.get(obj)); + String label = ""; + if (mappingField.get(obj) != null) { + if(mappingField.get(obj).toString().startsWith("[")){ + List split = JSONUtil.toList(mappingField.get(obj).toString(), String.class); + ArrayList strings = new ArrayList<>(); + for (String s : split) { + String label1 = sysDictDataService.selectDictLabel(dict.type(), s); + strings.add(label1); + } + label = JSONUtil.toJsonStr(strings).replace("\"","").replace("[","").replace("]",""); + }else { + label = sysDictDataService.selectDictLabel(dict.type(), mappingField.get(obj).toString()); + } + + } + field.set(obj, label);//设置字典 + } + } + } + } + +} + + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..9ba02f4a3f2b347fbc545a8eacb068defc4c5b75 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -0,0 +1,168 @@ +package com.ruoyi.framework.aspectj; + +import java.util.ArrayList; +import java.util.List; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.springframework.stereotype.Component; +import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.security.context.PermissionContextHolder; + +/** + * 数据过滤处理 + * + * @author ruoyi + */ +@Aspect +@Component +public class DataScopeAspect +{ + /** + * 全部数据权限 + */ + public static final String DATA_SCOPE_ALL = "1"; + + /** + * 自定数据权限 + */ + public static final String DATA_SCOPE_CUSTOM = "2"; + + /** + * 部门数据权限 + */ + public static final String DATA_SCOPE_DEPT = "3"; + + /** + * 部门及以下数据权限 + */ + public static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; + + /** + * 仅本人数据权限 + */ + public static final String DATA_SCOPE_SELF = "5"; + + /** + * 数据权限过滤关键字 + */ + public static final String DATA_SCOPE = "dataScope"; + + @Before("@annotation(controllerDataScope)") + public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable + { + clearDataScope(point); + handleDataScope(point, controllerDataScope); + } + + protected void handleDataScope(final JoinPoint joinPoint, DataScope controllerDataScope) + { + // 获取当前的用户 + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNotNull(loginUser)) + { + SysUser currentUser = loginUser.getUser(); + // 如果是超级管理员,则不过滤数据 + if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) + { + String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext()); + dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), + controllerDataScope.userAlias(), permission); + } + } + } + + /** + * 数据范围过滤 + * + * @param joinPoint 切点 + * @param user 用户 + * @param deptAlias 部门别名 + * @param userAlias 用户别名 + * @param permission 权限字符 + */ + public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission) + { + StringBuilder sqlString = new StringBuilder(); + List conditions = new ArrayList(); + + for (SysRole role : user.getRoles()) + { + String dataScope = role.getDataScope(); + if (!DATA_SCOPE_CUSTOM.equals(dataScope) && conditions.contains(dataScope)) + { + continue; + } + if (StringUtils.isNotEmpty(permission) && StringUtils.isNotEmpty(role.getPermissions()) + && !StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))) + { + continue; + } + if (DATA_SCOPE_ALL.equals(dataScope)) + { + sqlString = new StringBuilder(); + break; + } + else if (DATA_SCOPE_CUSTOM.equals(dataScope)) + { + sqlString.append(StringUtils.format( + " OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, + role.getRoleId())); + } + else if (DATA_SCOPE_DEPT.equals(dataScope)) + { + sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); + } + else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) + { + sqlString.append(StringUtils.format( + // " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", + " OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or cast({} as varchar) = any(string_to_array(ancestors,',')) )", + deptAlias, user.getDeptId(), user.getDeptId())); + } + else if (DATA_SCOPE_SELF.equals(dataScope)) + { + if (StringUtils.isNotBlank(userAlias)) + { + sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId())); + } + else + { + // 数据权限为仅本人且没有userAlias别名不查询任何数据 + sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias)); + } + } + conditions.add(dataScope); + } + + if (StringUtils.isNotBlank(sqlString.toString())) + { + Object params = joinPoint.getArgs()[0]; + if (StringUtils.isNotNull(params) && params instanceof BaseEntity) + { + BaseEntity baseEntity = (BaseEntity) params; + baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); + } + } + } + + /** + * 拼接权限sql前先清空params.dataScope参数防止注入 + */ + private void clearDataScope(final JoinPoint joinPoint) + { + Object params = joinPoint.getArgs()[0]; + if (StringUtils.isNotNull(params) && params instanceof BaseEntity) + { + BaseEntity baseEntity = (BaseEntity) params; + baseEntity.getParams().put(DATA_SCOPE, ""); + } + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..8c2c9f4385732249ebd98b9a793352358d2dd7db --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java @@ -0,0 +1,72 @@ +package com.ruoyi.framework.aspectj; + +import java.util.Objects; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.datasource.DynamicDataSourceContextHolder; + +/** + * 多数据源处理 + * + * @author ruoyi + */ +@Aspect +@Order(1) +@Component +public class DataSourceAspect +{ + protected Logger logger = LoggerFactory.getLogger(getClass()); + + @Pointcut("@annotation(com.ruoyi.common.annotation.DataSource)" + + "|| @within(com.ruoyi.common.annotation.DataSource)") + public void dsPointCut() + { + + } + + @Around("dsPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable + { + DataSource dataSource = getDataSource(point); + + if (StringUtils.isNotNull(dataSource)) + { + DynamicDataSourceContextHolder.setDataSourceType(dataSource.value().name()); + } + + try + { + return point.proceed(); + } + finally + { + // 销毁数据源 在执行方法之后 + DynamicDataSourceContextHolder.clearDataSourceType(); + } + } + + /** + * 获取需要切换的数据源 + */ + public DataSource getDataSource(ProceedingJoinPoint point) + { + MethodSignature signature = (MethodSignature) point.getSignature(); + DataSource dataSource = AnnotationUtils.findAnnotation(signature.getMethod(), DataSource.class); + if (Objects.nonNull(dataSource)) + { + return dataSource; + } + + return AnnotationUtils.findAnnotation(signature.getDeclaringType(), DataSource.class); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..0c33f54340440cab79807d3518621c19e430c611 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -0,0 +1,227 @@ +package com.ruoyi.framework.aspectj; + +import java.util.Collection; +import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +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.stereotype.Component; +import org.springframework.validation.BindingResult; +import org.springframework.web.multipart.MultipartFile; +import com.alibaba.fastjson2.JSON; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.enums.BusinessStatus; +import com.ruoyi.common.enums.HttpMethod; +import com.ruoyi.common.filter.PropertyPreExcludeFilter; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.system.domain.SysOperLog; + +/** + * 操作日志记录处理 + * + * @author ruoyi + */ +@Aspect +@Component +public class LogAspect +{ + private static final Logger log = LoggerFactory.getLogger(LogAspect.class); + + /** 排除敏感属性字段 */ + public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" }; + + /** + * 处理完请求后执行 + * + * @param joinPoint 切点 + */ + @AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult") + public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult) + { + handleLog(joinPoint, controllerLog, null, jsonResult); + } + + /** + * 拦截异常操作 + * + * @param joinPoint 切点 + * @param e 异常 + */ + @AfterThrowing(value = "@annotation(controllerLog)", throwing = "e") + public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e) + { + handleLog(joinPoint, controllerLog, e, null); + } + + protected void handleLog(final JoinPoint joinPoint, Log controllerLog, final Exception e, Object jsonResult) + { + try + { + // 获取当前的用户 + LoginUser loginUser = SecurityUtils.getLoginUser(); + + // *========数据库日志=========*// + SysOperLog operLog = new SysOperLog(); + operLog.setStatus(BusinessStatus.SUCCESS.ordinal()); + // 请求的地址 + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + operLog.setOperIp(ip); + operLog.setOperUrl(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255)); + if (loginUser != null) + { + operLog.setOperName(loginUser.getUsername()); + } + + if (e != null) + { + operLog.setStatus(BusinessStatus.FAIL.ordinal()); + operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000)); + } + // 设置方法名称 + String className = joinPoint.getTarget().getClass().getName(); + String methodName = joinPoint.getSignature().getName(); + operLog.setMethod(className + "." + methodName + "()"); + // 设置请求方式 + operLog.setRequestMethod(ServletUtils.getRequest().getMethod()); + // 处理设置注解上的参数 + getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult); + // 保存数据库 + AsyncManager.me().execute(AsyncFactory.recordOper(operLog)); + } + catch (Exception exp) + { + // 记录本地异常日志 + log.error("异常信息:{}", exp.getMessage()); + exp.printStackTrace(); + } + } + + /** + * 获取注解中对方法的描述信息 用于Controller层注解 + * + * @param log 日志 + * @param operLog 操作日志 + * @throws Exception + */ + public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception + { + // 设置action动作 + operLog.setBusinessType(log.businessType().ordinal()); + // 设置标题 + operLog.setTitle(log.title()); + // 设置操作人类别 + operLog.setOperatorType(log.operatorType().ordinal()); + // 是否需要保存request,参数和值 + if (log.isSaveRequestData()) + { + // 获取参数的信息,传入到数据库中。 + setRequestValue(joinPoint, operLog); + } + // 是否需要保存response,参数和值 + if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult)) + { + operLog.setJsonResult(StringUtils.substring(JSON.toJSONString(jsonResult), 0, 2000)); + } + } + + /** + * 获取请求的参数,放到log中 + * + * @param operLog 操作日志 + * @throws Exception 异常 + */ + private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) throws Exception + { + String requestMethod = operLog.getRequestMethod(); + if (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) + { + String params = argsArrayToString(joinPoint.getArgs()); + operLog.setOperParam(StringUtils.substring(params, 0, 2000)); + } + else + { + Map paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest()); + operLog.setOperParam(StringUtils.substring(JSON.toJSONString(paramsMap, excludePropertyPreFilter()), 0, 2000)); + } + } + + /** + * 参数拼装 + */ + private String argsArrayToString(Object[] paramsArray) + { + String params = ""; + if (paramsArray != null && paramsArray.length > 0) + { + for (Object o : paramsArray) + { + if (StringUtils.isNotNull(o) && !isFilterObject(o)) + { + try + { + String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter()); + params += jsonObj.toString() + " "; + } + catch (Exception e) + { + } + } + } + } + return params.trim(); + } + + /** + * 忽略敏感属性 + */ + public PropertyPreExcludeFilter excludePropertyPreFilter() + { + return new PropertyPreExcludeFilter().addExcludes(EXCLUDE_PROPERTIES); + } + + /** + * 判断是否需要过滤的对象。 + * + * @param o 对象信息。 + * @return 如果是需要过滤的对象,则返回true;否则返回false。 + */ + @SuppressWarnings("rawtypes") + public boolean isFilterObject(final Object o) + { + Class clazz = o.getClass(); + if (clazz.isArray()) + { + return clazz.getComponentType().isAssignableFrom(MultipartFile.class); + } + else if (Collection.class.isAssignableFrom(clazz)) + { + Collection collection = (Collection) o; + for (Object value : collection) + { + return value instanceof MultipartFile; + } + } + else if (Map.class.isAssignableFrom(clazz)) + { + Map map = (Map) o; + for (Object value : map.entrySet()) + { + Map.Entry entry = (Map.Entry) value; + return entry.getValue() instanceof MultipartFile; + } + } + return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse + || o instanceof BindingResult; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java new file mode 100644 index 0000000000000000000000000000000000000000..69811bc6966c16bdae8668e2e4b93e3c59daca0d --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java @@ -0,0 +1,90 @@ +package com.ruoyi.framework.aspectj; + +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.List; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.RedisScript; +import org.springframework.stereotype.Component; +import com.ruoyi.common.annotation.RateLimiter; +import com.ruoyi.common.enums.LimitType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.IpUtils; + +/** + * 限流处理 + * + * @author ruoyi + */ +@Aspect +@Component +public class RateLimiterAspect +{ + private static final Logger log = LoggerFactory.getLogger(RateLimiterAspect.class); + + private RedisTemplate redisTemplate; + + private RedisScript limitScript; + + @Autowired + public void setRedisTemplate1(RedisTemplate redisTemplate) + { + this.redisTemplate = redisTemplate; + } + + @Autowired + public void setLimitScript(RedisScript limitScript) + { + this.limitScript = limitScript; + } + + @Before("@annotation(rateLimiter)") + public void doBefore(JoinPoint point, RateLimiter rateLimiter) throws Throwable + { + int time = rateLimiter.time(); + int count = rateLimiter.count(); + + String combineKey = getCombineKey(rateLimiter, point); + List keys = Collections.singletonList(combineKey); + try + { + Long number = redisTemplate.execute(limitScript, keys, count, time); + if (StringUtils.isNull(number) || number.intValue() > count) + { + throw new ServiceException("访问过于频繁,请稍候再试"); + } + log.info("限制请求'{}',当前请求'{}',缓存key'{}'", count, number.intValue(), combineKey); + } + catch (ServiceException e) + { + throw e; + } + catch (Exception e) + { + throw new RuntimeException("服务器限流异常,请稍候再试"); + } + } + + public String getCombineKey(RateLimiter rateLimiter, JoinPoint point) + { + StringBuffer stringBuffer = new StringBuffer(rateLimiter.key()); + if (rateLimiter.limitType() == LimitType.IP) + { + stringBuffer.append(IpUtils.getIpAddr(ServletUtils.getRequest())).append("-"); + } + MethodSignature signature = (MethodSignature) point.getSignature(); + Method method = signature.getMethod(); + Class targetClass = method.getDeclaringClass(); + stringBuffer.append(targetClass.getName()).append("-").append(method.getName()); + return stringBuffer.toString(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..1d4dc1f724ca36dbdfaa693ea88510606ebfd91f --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java @@ -0,0 +1,30 @@ +package com.ruoyi.framework.config; + +import java.util.TimeZone; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.EnableAspectJAutoProxy; + +/** + * 程序注解配置 + * + * @author ruoyi + */ +@Configuration +// 表示通过aop框架暴露该代理对象,AopContext能够访问 +@EnableAspectJAutoProxy(exposeProxy = true) +// 指定要扫描的Mapper类的包的路径 +@MapperScan("com.ruoyi.**.mapper") +public class ApplicationConfig +{ + /** + * 时区配置 + */ + @Bean + public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() + { + return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..43e78aebeaca373303d5dd9be863ac5a7a263b74 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/CaptchaConfig.java @@ -0,0 +1,83 @@ +package com.ruoyi.framework.config; + +import java.util.Properties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.google.code.kaptcha.impl.DefaultKaptcha; +import com.google.code.kaptcha.util.Config; +import static com.google.code.kaptcha.Constants.*; + +/** + * 验证码配置 + * + * @author ruoyi + */ +@Configuration +public class CaptchaConfig +{ + @Bean(name = "captchaProducer") + public DefaultKaptcha getKaptchaBean() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 是否有边框 默认为true 我们可以自己设置yes,no + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 验证码文本字符颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "black"); + // 验证码图片宽度 默认为200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 验证码图片高度 默认为50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 验证码文本字符大小 默认为40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode"); + // 验证码文本字符长度 默认为5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4"); + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } + + @Bean(name = "captchaProducerMath") + public DefaultKaptcha getKaptchaBeanMath() + { + DefaultKaptcha defaultKaptcha = new DefaultKaptcha(); + Properties properties = new Properties(); + // 是否有边框 默认为true 我们可以自己设置yes,no + properties.setProperty(KAPTCHA_BORDER, "yes"); + // 边框颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90"); + // 验证码文本字符颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue"); + // 验证码图片宽度 默认为200 + properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160"); + // 验证码图片高度 默认为50 + properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60"); + // 验证码文本字符大小 默认为40 + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35"); + // KAPTCHA_SESSION_KEY + properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath"); + // 验证码文本生成器 + properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.ruoyi.framework.config.KaptchaTextCreator"); + // 验证码文本字符间距 默认为2 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3"); + // 验证码文本字符长度 默认为5 + properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6"); + // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize) + properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier"); + // 验证码噪点颜色 默认为Color.BLACK + properties.setProperty(KAPTCHA_NOISE_COLOR, "white"); + // 干扰实现类 + properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise"); + // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy + properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy"); + Config config = new Config(properties); + defaultKaptcha.setConfig(config); + return defaultKaptcha; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..f6abac13754cab722069c9c5cbd2c84cff0390a2 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java @@ -0,0 +1,126 @@ +package com.ruoyi.framework.config; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.sql.DataSource; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; +import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties; +import com.alibaba.druid.util.Utils; +import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.framework.config.properties.DruidProperties; +import com.ruoyi.framework.datasource.DynamicDataSource; + +/** + * druid 配置多数据源 + * + * @author ruoyi + */ +@Configuration +public class DruidConfig +{ + @Bean + @ConfigurationProperties("spring.datasource.druid.master") + public DataSource masterDataSource(DruidProperties druidProperties) + { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource(dataSource); + } + + @Bean + @ConfigurationProperties("spring.datasource.druid.slave") + @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true") + public DataSource slaveDataSource(DruidProperties druidProperties) + { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource(dataSource); + } + + @Bean(name = "dynamicDataSource") + @Primary + public DynamicDataSource dataSource(DataSource masterDataSource) + { + Map targetDataSources = new HashMap<>(); + targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); + setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); + return new DynamicDataSource(masterDataSource, targetDataSources); + } + + /** + * 设置数据源 + * + * @param targetDataSources 备选数据源集合 + * @param sourceName 数据源名称 + * @param beanName bean名称 + */ + public void setDataSource(Map targetDataSources, String sourceName, String beanName) + { + try + { + DataSource dataSource = SpringUtils.getBean(beanName); + targetDataSources.put(sourceName, dataSource); + } + catch (Exception e) + { + } + } + + /** + * 去除监控页面底部的广告 + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true") + public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) + { + // 获取web监控页面的参数 + DruidStatProperties.StatViewServlet config = properties.getStatViewServlet(); + // 提取common.js的配置路径 + String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*"; + String commonJsPattern = pattern.replaceAll("\\*", "js/common.js"); + final String filePath = "support/http/resources/js/common.js"; + // 创建filter进行过滤 + Filter filter = new Filter() + { + @Override + public void init(javax.servlet.FilterConfig filterConfig) throws ServletException + { + } + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + chain.doFilter(request, response); + // 重置缓冲区,响应头不会被重置 + response.resetBuffer(); + // 获取common.js + String text = Utils.readFromResource(filePath); + // 正则替换banner, 除去底部的广告信息 + text = text.replaceAll("
", ""); + text = text.replaceAll("powered.*?shrek.wang", ""); + response.getWriter().write(text); + } + @Override + public void destroy() + { + } + }; + FilterRegistrationBean registrationBean = new FilterRegistrationBean(); + registrationBean.setFilter(filter); + registrationBean.addUrlPatterns(commonJsPattern); + return registrationBean; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..b6d61106e044758837ccc3623ede6fe01a9a1f53 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java @@ -0,0 +1,48 @@ +package com.ruoyi.framework.config; + +import java.nio.charset.Charset; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationException; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONReader; +import com.alibaba.fastjson2.JSONWriter; + +/** + * Redis使用FastJson序列化 + * + * @author ruoyi + */ +public class FastJson2JsonRedisSerializer implements RedisSerializer +{ + public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); + + private Class clazz; + + public FastJson2JsonRedisSerializer(Class clazz) + { + super(); + this.clazz = clazz; + } + + @Override + public byte[] serialize(T t) throws SerializationException + { + if (t == null) + { + return new byte[0]; + } + return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(DEFAULT_CHARSET); + } + + @Override + public T deserialize(byte[] bytes) throws SerializationException + { + if (bytes == null || bytes.length <= 0) + { + return null; + } + String str = new String(bytes, DEFAULT_CHARSET); + + return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..bb14c04da57be3597d9f8f6534004f9d01c84827 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java @@ -0,0 +1,58 @@ +package com.ruoyi.framework.config; + +import java.util.HashMap; +import java.util.Map; +import javax.servlet.DispatcherType; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import com.ruoyi.common.filter.RepeatableFilter; +import com.ruoyi.common.filter.XssFilter; +import com.ruoyi.common.utils.StringUtils; + +/** + * Filter配置 + * + * @author ruoyi + */ +@Configuration +public class FilterConfig +{ + @Value("${xss.excludes}") + private String excludes; + + @Value("${xss.urlPatterns}") + private String urlPatterns; + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + @ConditionalOnProperty(value = "xss.enabled", havingValue = "true") + public FilterRegistrationBean xssFilterRegistration() + { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setDispatcherTypes(DispatcherType.REQUEST); + registration.setFilter(new XssFilter()); + registration.addUrlPatterns(StringUtils.split(urlPatterns, ",")); + registration.setName("xssFilter"); + registration.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE); + Map initParameters = new HashMap(); + initParameters.put("excludes", excludes); + registration.setInitParameters(initParameters); + return registration; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + public FilterRegistrationBean someFilterRegistration() + { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new RepeatableFilter()); + registration.addUrlPatterns("/*"); + registration.setName("repeatableFilter"); + registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE); + return registration; + } + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java new file mode 100644 index 0000000000000000000000000000000000000000..7f8e1d50fcf870cbfc5c0ec105f01a3d186727b5 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java @@ -0,0 +1,68 @@ +package com.ruoyi.framework.config; + +import java.util.Random; +import com.google.code.kaptcha.text.impl.DefaultTextCreator; + +/** + * 验证码文本生成器 + * + * @author ruoyi + */ +public class KaptchaTextCreator extends DefaultTextCreator +{ + private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(","); + + @Override + public String getText() + { + Integer result = 0; + Random random = new Random(); + int x = random.nextInt(10); + int y = random.nextInt(10); + StringBuilder suChinese = new StringBuilder(); + int randomoperands = random.nextInt(3); + if (randomoperands == 0) + { + result = x * y; + suChinese.append(CNUMBERS[x]); + suChinese.append("*"); + suChinese.append(CNUMBERS[y]); + } + else if (randomoperands == 1) + { + if ((x != 0) && y % x == 0) + { + result = y / x; + suChinese.append(CNUMBERS[y]); + suChinese.append("/"); + suChinese.append(CNUMBERS[x]); + } + else + { + result = x + y; + suChinese.append(CNUMBERS[x]); + suChinese.append("+"); + suChinese.append(CNUMBERS[y]); + } + } + else + { + if (x >= y) + { + result = x - y; + suChinese.append(CNUMBERS[x]); + suChinese.append("-"); + suChinese.append(CNUMBERS[y]); + } + else + { + result = y - x; + suChinese.append(CNUMBERS[y]); + suChinese.append("-"); + suChinese.append(CNUMBERS[x]); + } + } + suChinese.append("=?@" + result); + return suChinese.toString(); + } +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.zip b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.zip new file mode 100644 index 0000000000000000000000000000000000000000..192cde542c36db4075c266a9eb19ec8ee191dbb6 Binary files /dev/null and b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.zip differ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..d27902c325012b66848e7c60563b208e81cb5769 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java @@ -0,0 +1,80 @@ +package com.ruoyi.framework.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.apache.ibatis.logging.slf4j.Slf4jImpl; +import org.apache.ibatis.type.JdbcType; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.sql.DataSource; + +/** + * @Author: unscrupulous + * @CreateTime: 2022-08-10 15:52 + * @Version: 1.0 + */ +@EnableTransactionManagement(proxyTargetClass = true) +@MapperScan("com.ruoyi.*.mapper") +@Configuration +public class MybatisPlusConfig { + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() + { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + // 分页插件 + interceptor.addInnerInterceptor(paginationInnerInterceptor()); + // 乐观锁插件 + interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); + // 阻断插件 + interceptor.addInnerInterceptor(blockAttackInnerInterceptor()); + return interceptor; + } + + /** + * 分页插件,自动识别数据库类型 https://baomidou.com/guide/interceptor-pagination.html + */ + public PaginationInnerInterceptor paginationInnerInterceptor() + { + PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); + // 设置数据库类型为mysql + paginationInnerInterceptor.setDbType(DbType.POSTGRE_SQL); + // 设置最大单页限制数量,默认 500 条,-1 不受限制 + paginationInnerInterceptor.setMaxLimit(-1L); + return paginationInnerInterceptor; + } + + public MybatisConfiguration configuration(DataSource dataSource){ + MybatisConfiguration mybatisConfiguration = new MybatisConfiguration(); + mybatisConfiguration.setMapUnderscoreToCamelCase(true); + mybatisConfiguration.setCacheEnabled(true); + mybatisConfiguration.setLogImpl(Slf4jImpl.class); + mybatisConfiguration.setJdbcTypeForNull(JdbcType.NULL); + + return mybatisConfiguration; + } + + /** + * 乐观锁插件 https://baomidou.com/guide/interceptor-optimistic-locker.html + */ + @Bean + public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() + { + return new OptimisticLockerInnerInterceptor(); + } + + /** + * 如果是对全表的删除或更新操作,就会终止该操作 https://baomidou.com/guide/interceptor-block-attack.html + */ + public BlockAttackInnerInterceptor blockAttackInnerInterceptor() + { + return new BlockAttackInnerInterceptor(); + } +} + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..1e79924d86482a096588409fa5fc4d55ca445bd8 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java @@ -0,0 +1,81 @@ +package com.ruoyi.framework.config; + +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.DefaultRedisScript; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +/** + * redis配置 + * + * @author ruoyi + */ +@Configuration +@EnableCaching +public class RedisConfig extends CachingConfigurerSupport +{ + @Bean + @SuppressWarnings(value = { "unchecked", "rawtypes" }) + public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) + { + + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(connectionFactory); + + FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class); + + // 使用StringRedisSerializer来序列化和反序列化redis的key值 + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(serializer); + + // Hash的key也采用StringRedisSerializer的序列化方式 + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(serializer); + + template.afterPropertiesSet(); + return template; + } + + @Bean + RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) { + + RedisMessageListenerContainer container = new RedisMessageListenerContainer(); + container.setConnectionFactory(connectionFactory); + return container; + } + + + @Bean + public DefaultRedisScript limitScript() + { + DefaultRedisScript redisScript = new DefaultRedisScript<>(); + redisScript.setScriptText(limitScriptText()); + redisScript.setResultType(Long.class); + return redisScript; + } + + /** + * 限流脚本 + */ + private String limitScriptText() + { + return "local key = KEYS[1]\n" + + "local count = tonumber(ARGV[1])\n" + + "local time = tonumber(ARGV[2])\n" + + "local current = redis.call('get', key);\n" + + "if current and tonumber(current) > count then\n" + + " return tonumber(current);\n" + + "end\n" + + "current = redis.call('incr', key)\n" + + "if tonumber(current) == 1 then\n" + + " redis.call('expire', key, time)\n" + + "end\n" + + "return tonumber(current);"; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedissonConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedissonConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..fb73c1083a0bea14802c97dd4054dc8dd147d6ee --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedissonConfig.java @@ -0,0 +1,27 @@ +package com.ruoyi.framework.config; + +import org.redisson.Redisson; +import org.redisson.api.RedissonClient; +import org.redisson.config.Config; +import org.springframework.context.annotation.Bean; +import org.springframework.beans.factory.annotation.Value; + +public class RedissonConfig { + + @Value("${redisson.addr.singleAddr.host}") + private String host; + + @Value("${redisson.addr.singleAddr.password}") + private String password; + + @Value("${redisson.addr.singleAddr.database}") + private int database; + + @Bean + public RedissonClient redissonClient() { + Config config = new Config(); + config.useSingleServer().setAddress(host).setPassword(password).setDatabase(database); + return Redisson.create(config); + } + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..68445cfe95ff36b871c6daee18454bfc6a8abc11 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java @@ -0,0 +1,126 @@ +package com.ruoyi.framework.config; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.deser.std.DateDeserializers; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.DateSerializer; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.format.datetime.DateFormatter; +import org.springframework.http.CacheControl; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor; + +/** + * 通用配置 + * + * @author ruoyi + */ +@Configuration +public class ResourcesConfig implements WebMvcConfigurer +{ + @Autowired + private RepeatSubmitInterceptor repeatSubmitInterceptor; + + private static final String DEFAULT_DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; + private static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd"; + private static final String DEFAULT_TIME_PATTERN = "HH:mm:ss"; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) + { + /** 本地文件上传路径 */ + registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**") + .addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); + + /** swagger配置 */ + registry.addResourceHandler("/swagger-ui/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/") + .setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());; + } + + /** + * 自定义拦截规则 + */ + @Override + public void addInterceptors(InterceptorRegistry registry) + { + registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**"); + } + + /** + * 跨域配置 + */ + @Bean + public CorsFilter corsFilter() + { + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + // 设置访问源地址 + config.addAllowedOriginPattern("*"); + // 设置访问源请求头 + config.addAllowedHeader("*"); + // 设置访问源请求方法 + config.addAllowedMethod("*"); + // 有效期 1800秒 + config.setMaxAge(1800L); + // 添加映射路径,拦截一切请求 + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", config); + // 返回新的CorsFilter + return new CorsFilter(source); + } + + @Bean + public MappingJackson2HttpMessageConverter toStringConverter() { + MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); + ObjectMapper mapper = new ObjectMapper(); + SimpleModule simpleModule = new SimpleModule(); +// simpleModule.addSerializer(Long.class, ToStringSerializer.instance); +// simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance); + simpleModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_PATTERN))); + simpleModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_PATTERN))); + simpleModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_PATTERN))); + simpleModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_PATTERN))); + simpleModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_PATTERN))); + simpleModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_PATTERN))); + mapper.registerModule(simpleModule); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + //接收前端的""反序列化为null + mapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + mapper.setDateFormat(dateFormat); + converter.setObjectMapper(mapper); + + return converter; + } + +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..85ef53b0d22f868f689ea4e482fec7e167eb9c98 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -0,0 +1,158 @@ +package com.ruoyi.framework.config; + +import com.ruoyi.framework.security.sms.SmsCodeAuthenticationProvider; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.authentication.logout.LogoutFilter; +import org.springframework.web.filter.CorsFilter; +import com.ruoyi.framework.config.properties.PermitAllUrlProperties; +import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; +import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl; +import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; + +/** + * spring security配置 + * + * @author ruoyi + */ +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class SecurityConfig extends WebSecurityConfigurerAdapter +{ + /** + * 自定义用户认证逻辑 + */ + @Autowired + @Qualifier("userDetailsServiceImpl") + private UserDetailsService userDetailsByUsername; + + @Autowired + @Qualifier("userDetailsByTelephoneServiceImpl") + private UserDetailsService userDetailsByPhonenumber; + + /** + * 认证失败处理类 + */ + @Autowired + private AuthenticationEntryPointImpl unauthorizedHandler; + + /** + * 退出处理类 + */ + @Autowired + private LogoutSuccessHandlerImpl logoutSuccessHandler; + + /** + * token认证过滤器 + */ + @Autowired + private JwtAuthenticationTokenFilter authenticationTokenFilter; + + /** + * 跨域过滤器 + */ + @Autowired + private CorsFilter corsFilter; + + /** + * 允许匿名访问的地址 + */ + @Autowired + private PermitAllUrlProperties permitAllUrl; + + /** + * 解决 无法直接注入 AuthenticationManager + * + * @return + * @throws Exception + */ + @Bean + @Override + public AuthenticationManager authenticationManagerBean() throws Exception + { + return super.authenticationManagerBean(); + } + + /** + * anyRequest | 匹配所有请求路径 + * access | SpringEl表达式结果为true时可以访问 + * anonymous | 匿名可以访问 + * denyAll | 用户不能访问 + * fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录) + * hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问 + * hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问 + * hasAuthority | 如果有参数,参数表示权限,则其权限可以访问 + * hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问 + * hasRole | 如果有参数,参数表示角色,则其角色可以访问 + * permitAll | 用户可以任意访问 + * rememberMe | 允许通过remember-me登录的用户访问 + * authenticated | 用户登录后可访问 + */ + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception + { + // 注解标记允许匿名访问的url + ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests(); + permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll()); + + httpSecurity + // CSRF禁用,因为不使用session + .csrf().disable() + // 禁用HTTP响应标头 + .headers().cacheControl().disable().and() + // 认证失败处理类 + .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() + // 基于token,所以不需要session + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() + // 过滤请求 + .authorizeRequests() + // 对于登录login 注册register 验证码captchaImage 允许匿名访问 + .antMatchers("/app/version/config","/ydLogin","/login","/autoLogin","/getLoginCode","/autoLogin", "/register", "/captchaImage","/eastcom_yw/notice","/eastcom_yw/daping/**").permitAll() + .antMatchers("/monitor/shutdown").access("@ss.hasRole('admin')") + // 静态资源,可匿名访问 + .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() + .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() + // 除上面外的所有请求全部需要鉴权认证 + .anyRequest().authenticated() + .and() + .headers().frameOptions().disable(); + // 添加Logout filter + httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); + // 添加JWT filter + httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); + // 添加CORS filter + httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class); + httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class); + } + + /** + * 强散列哈希加密实现 + */ + @Bean + public BCryptPasswordEncoder bCryptPasswordEncoder() + { + return new BCryptPasswordEncoder(); + } + + /** + * 身份认证接口 + */ + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception + { + auth.authenticationProvider(new SmsCodeAuthenticationProvider(userDetailsByPhonenumber)); + + auth.userDetailsService(userDetailsByUsername).passwordEncoder(bCryptPasswordEncoder()); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..b5b7de31659f588674b5acc9d6c5b6d6d97e1121 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java @@ -0,0 +1,32 @@ +package com.ruoyi.framework.config; + +import javax.servlet.http.HttpServletRequest; +import org.springframework.stereotype.Component; +import com.ruoyi.common.utils.ServletUtils; + +/** + * 服务相关配置 + * + * @author ruoyi + */ +@Component +public class ServerConfig +{ + /** + * 获取完整的请求路径,包括:域名,端口,上下文访问路径 + * + * @return 服务地址 + */ + public String getUrl() + { + HttpServletRequest request = ServletUtils.getRequest(); + return getDomain(request); + } + + public static String getDomain(HttpServletRequest request) + { + StringBuffer url = request.getRequestURL(); + String contextPath = request.getServletContext().getContextPath(); + return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..7840141e54f63bb3039ae7c3333bf2399f680e9f --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java @@ -0,0 +1,63 @@ +package com.ruoyi.framework.config; + +import com.ruoyi.common.utils.Threads; +import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 线程池配置 + * + * @author ruoyi + **/ +@Configuration +public class ThreadPoolConfig +{ + // 核心线程池大小 + private int corePoolSize = 50; + + // 最大可创建的线程数 + private int maxPoolSize = 200; + + // 队列最大长度 + private int queueCapacity = 1000; + + // 线程池维护线程所允许的空闲时间 + private int keepAliveSeconds = 300; + + @Bean(name = "threadPoolTaskExecutor") + public ThreadPoolTaskExecutor threadPoolTaskExecutor() + { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setMaxPoolSize(maxPoolSize); + executor.setCorePoolSize(corePoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveSeconds); + // 线程池对拒绝任务(无线程可用)的处理策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + return executor; + } + + /** + * 执行周期性或定时任务 + */ + @Bean(name = "scheduledExecutorService") + protected ScheduledExecutorService scheduledExecutorService() + { + return new ScheduledThreadPoolExecutor(corePoolSize, + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(), + new ThreadPoolExecutor.CallerRunsPolicy()) + { + @Override + protected void afterExecute(Runnable r, Throwable t) + { + super.afterExecute(r, t); + Threads.printException(r, t); + } + }; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..84f7e0090bb65861abd685eb77c3fb7159b10ed3 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/DruidProperties.java @@ -0,0 +1,77 @@ +package com.ruoyi.framework.config.properties; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import com.alibaba.druid.pool.DruidDataSource; + +/** + * druid 配置属性 + * + * @author ruoyi + */ +@Configuration +public class DruidProperties +{ + @Value("${spring.datasource.druid.initialSize}") + private int initialSize; + + @Value("${spring.datasource.druid.minIdle}") + private int minIdle; + + @Value("${spring.datasource.druid.maxActive}") + private int maxActive; + + @Value("${spring.datasource.druid.maxWait}") + private int maxWait; + + @Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}") + private int timeBetweenEvictionRunsMillis; + + @Value("${spring.datasource.druid.minEvictableIdleTimeMillis}") + private int minEvictableIdleTimeMillis; + + @Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}") + private int maxEvictableIdleTimeMillis; + + @Value("${spring.datasource.druid.validationQuery}") + private String validationQuery; + + @Value("${spring.datasource.druid.testWhileIdle}") + private boolean testWhileIdle; + + @Value("${spring.datasource.druid.testOnBorrow}") + private boolean testOnBorrow; + + @Value("${spring.datasource.druid.testOnReturn}") + private boolean testOnReturn; + + public DruidDataSource dataSource(DruidDataSource datasource) + { + /** 配置初始化大小、最小、最大 */ + datasource.setInitialSize(initialSize); + datasource.setMaxActive(maxActive); + datasource.setMinIdle(minIdle); + + /** 配置获取连接等待超时的时间 */ + datasource.setMaxWait(maxWait); + + /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ + datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); + + /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */ + datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); + datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis); + + /** + * 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。 + */ + datasource.setValidationQuery(validationQuery); + /** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */ + datasource.setTestWhileIdle(testWhileIdle); + /** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ + datasource.setTestOnBorrow(testOnBorrow); + /** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ + datasource.setTestOnReturn(testOnReturn); + return datasource; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..9632eb1f7db0ccbe12ba784c4469e66df50912dc --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java @@ -0,0 +1,72 @@ +package com.ruoyi.framework.config.properties; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.regex.Pattern; +import org.apache.commons.lang3.RegExUtils; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; +import com.ruoyi.common.annotation.Anonymous; + +/** + * 设置Anonymous注解允许匿名访问的url + * + * @author ruoyi + */ +@Configuration +public class PermitAllUrlProperties implements InitializingBean, ApplicationContextAware +{ + private static final Pattern PATTERN = Pattern.compile("\\{(.*?)\\}"); + + private ApplicationContext applicationContext; + + private List urls = new ArrayList<>(); + + public String ASTERISK = "*"; + + @Override + public void afterPropertiesSet() + { + RequestMappingHandlerMapping mapping = applicationContext.getBean(RequestMappingHandlerMapping.class); + Map map = mapping.getHandlerMethods(); + + map.keySet().forEach(info -> { + HandlerMethod handlerMethod = map.get(info); + + // 获取方法上边的注解 替代path variable 为 * + Anonymous method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Anonymous.class); + Optional.ofNullable(method).ifPresent(anonymous -> info.getPatternsCondition().getPatterns() + .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK)))); + + // 获取类上边的注解, 替代path variable 为 * + Anonymous controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Anonymous.class); + Optional.ofNullable(controller).ifPresent(anonymous -> info.getPatternsCondition().getPatterns() + .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK)))); + }); + } + + @Override + public void setApplicationContext(ApplicationContext context) throws BeansException + { + this.applicationContext = context; + } + + public List getUrls() + { + return urls; + } + + public void setUrls(List urls) + { + this.urls = urls; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java new file mode 100644 index 0000000000000000000000000000000000000000..e70b8cfa7a96a7a4bab5473172fca33a5d1ecea2 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java @@ -0,0 +1,26 @@ +package com.ruoyi.framework.datasource; + +import java.util.Map; +import javax.sql.DataSource; +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +/** + * 动态数据源 + * + * @author ruoyi + */ +public class DynamicDataSource extends AbstractRoutingDataSource +{ + public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) + { + super.setDefaultTargetDataSource(defaultTargetDataSource); + super.setTargetDataSources(targetDataSources); + super.afterPropertiesSet(); + } + + @Override + protected Object determineCurrentLookupKey() + { + return DynamicDataSourceContextHolder.getDataSourceType(); + } +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..3572db91707884599a7e9ecb4416dce778b50904 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java @@ -0,0 +1,45 @@ +package com.ruoyi.framework.datasource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 数据源切换处理 + * + * @author ruoyi + */ +public class DynamicDataSourceContextHolder +{ + public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); + + /** + * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, + * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 + */ + private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); + + /** + * 设置数据源的变量 + */ + public static void setDataSourceType(String dsType) + { + log.info("切换到{}数据源", dsType); + CONTEXT_HOLDER.set(dsType); + } + + /** + * 获得数据源的变量 + */ + public static String getDataSourceType() + { + return CONTEXT_HOLDER.get(); + } + + /** + * 清空数据源变量 + */ + public static void clearDataSourceType() + { + CONTEXT_HOLDER.remove(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/MyMetaObjectHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/MyMetaObjectHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..4ed5d5c86b20a1e7ff03a598e029e60a81f6ff72 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/handler/MyMetaObjectHandler.java @@ -0,0 +1,68 @@ +package com.ruoyi.framework.handler; + +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.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.Objects; + +/** + * 字段自动填充处理器 + * @author ** + */ +@Component +@Slf4j +public class MyMetaObjectHandler implements MetaObjectHandler { + + @Override + public void insertFill(MetaObject metaObject) { + log.debug("start insert fill ...."); + Long id = getUserId(); + String userName = getUserName(); + LocalDateTime now = LocalDateTime.now(); + this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, now); + this.strictInsertFill(metaObject, "createBy", String.class, userName); + this.strictInsertFill(metaObject, "createUserId", Long.class, id); + this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, now); + this.strictInsertFill(metaObject, "updateBy", String.class, userName); + } + + @Override + public void updateFill(MetaObject metaObject) { + log.debug("start update fill ...."); + String userName = getUserName(); + Long id = getUserId(); + this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); + this.strictInsertFill(metaObject, "updateBy", String.class, userName); + this.strictInsertFill(metaObject, "updateUserId", Long.class, id); + } + + private Long getUserId() { + + Long userId =null; + try { + userId = SecurityUtils.getUserId(); + } catch (Exception e) { + log.error(e.getMessage()); + } + long id = 1L; + if (Objects.nonNull(userId)) { + id = userId; + } + return id; + } + + private String getUserName() { + + String userName =""; + try { + userName = SecurityUtils.getLoginUser().getNickName(); + } catch (Exception e) { + log.error(e.getMessage()); + } + return userName; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java new file mode 100644 index 0000000000000000000000000000000000000000..fa0e4b26628072319f1d9570fcff2276ee40e0de --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java @@ -0,0 +1,72 @@ +package com.ruoyi.framework.interceptor; + +import java.lang.reflect.Method; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.stereotype.Component; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerInterceptor; +import com.alibaba.fastjson2.JSON; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.ServletUtils; + +/** + * 防止重复提交拦截器 + * + * @author ruoyi + */ +@Component +public abstract class RepeatSubmitInterceptor implements HandlerInterceptor +{ + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception + { + if (handler instanceof HandlerMethod) + { + HandlerMethod handlerMethod = (HandlerMethod) handler; + Method method = handlerMethod.getMethod(); + RepeatSubmit annotation = method.getAnnotation(RepeatSubmit.class); + if (annotation != null) + { + if(annotation.enable()) { + if (this.isRepeatSubmit(request, annotation)) { +// AjaxResult ajaxResult = AjaxResult.error(annotation.message() + request.getRequestURL()); +// ServletUtils.renderString(response, JSON.toJSONString(ajaxResult)); + return false; + } + } + } +// if (annotation == null) { +// if (this.isRepeatSubmit(request)) { +//// AjaxResult ajaxResult = AjaxResult.error("请不要重复提交"+request.getRequestURL()); +//// ServletUtils.renderString(response, JSON.toJSONString(ajaxResult)); +// return false; +// } +// } + return true; + } + else + { + + if (this.isRepeatSubmit(request)) { +// AjaxResult ajaxResult = AjaxResult.error("请不要重复提交"+ request.getRequestURL()); +// ServletUtils.renderString(response, JSON.toJSONString(ajaxResult)); + return false; + } + + return true; + } + } + + /** + * 验证是否重复提交由子类实现具体的防重复提交的规则 + * + * @param request + * @return + * @throws Exception + */ + public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation); + + public abstract boolean isRepeatSubmit(HttpServletRequest request); +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java new file mode 100644 index 0000000000000000000000000000000000000000..89d666ee53e91f670c3d7f69f5e6f8bf2a346a73 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java @@ -0,0 +1,213 @@ +package com.ruoyi.framework.interceptor.impl; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.servlet.http.HttpServletRequest; + +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.alibaba.fastjson2.JSON; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.filter.RepeatedlyRequestWrapper; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.http.HttpHelper; +import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor; + +/** + * 判断请求url和数据是否和上一次相同, + * 如果和上次相同,则是重复提交表单。 有效时间为10秒内。 + * + * @author ruoyi + */ +@Component +public class SameUrlDataInterceptor extends RepeatSubmitInterceptor +{ + public final String REPEAT_PARAMS = "repeatParams"; + + public final String REPEAT_TIME = "repeatTime"; + + + public final String REPEAT_NUM = "repeatNum"; + + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + @Autowired + private RedisCache redisCache; + + @SuppressWarnings("unchecked") + @Override + public boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation) + { + String nowParams = ""; + if (request instanceof RepeatedlyRequestWrapper) + { + RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request; + nowParams = HttpHelper.getBodyString(repeatedlyRequest); + } + + // body参数为空,获取Parameter的数据 + if (StringUtils.isEmpty(nowParams)) + { + nowParams = JSON.toJSONString(request.getParameterMap()); + } + Map nowDataMap = new HashMap(); + nowDataMap.put(REPEAT_PARAMS, nowParams); + nowDataMap.put(REPEAT_TIME, System.currentTimeMillis()); + + // 请求地址(作为存放cache的key值) + String url = request.getRequestURI(); + + // 唯一值(没有消息头则使用请求地址) + String submitKey = StringUtils.trimToEmpty(request.getHeader(header)); + + //ip +// String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + + // 唯一标识(指定key + url + 消息头) + String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + url + submitKey; +// String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY +ip+ url; + + Integer nowRepeatNum = 1; + + Object sessionObj = redisCache.getCacheObject(cacheRepeatKey); + if (sessionObj != null) + { + Map sessionMap = (Map) sessionObj; + if (sessionMap.containsKey(url)) + { + Map preDataMap = (Map) sessionMap.get(url); + + if(!annotation.enable()) + { + nowDataMap.put(REPEAT_NUM, 1); + + if(preDataMap.containsKey(REPEAT_NUM)) + { + Integer repeatNum = (Integer) preDataMap.get(REPEAT_NUM); + + nowRepeatNum = repeatNum + 1; + + if(nowRepeatNum > annotation.num()) + { + return true; + } + + nowDataMap.put(REPEAT_NUM, nowRepeatNum); + } + } + if(annotation.enable()) { + if (compareParams(nowDataMap, preDataMap) && compareTime(nowDataMap, preDataMap, annotation.interval())) { + return true; + } + } + } + } + System.out.println(JSONObject.toJSONString(nowDataMap)); + Map cacheMap = new HashMap(); + cacheMap.put(url, nowDataMap); + redisCache.setCacheObject(cacheRepeatKey, cacheMap, annotation.interval(), TimeUnit.MILLISECONDS); + return false; + } + + @Override + public boolean isRepeatSubmit(HttpServletRequest request) + { + String nowParams = ""; + if (request instanceof RepeatedlyRequestWrapper) + { + RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request; + nowParams = HttpHelper.getBodyString(repeatedlyRequest); + } + + // body参数为空,获取Parameter的数据 + if (StringUtils.isEmpty(nowParams)) + { + nowParams = JSON.toJSONString(request.getParameterMap()); + } + Map nowDataMap = new HashMap(); + nowDataMap.put(REPEAT_PARAMS, nowParams); + nowDataMap.put(REPEAT_TIME, System.currentTimeMillis()); + + // 请求地址(作为存放cache的key值) + String url = request.getRequestURI(); + + // 唯一值(没有消息头则使用请求地址) + String submitKey = StringUtils.trimToEmpty(request.getHeader(header)); + + //ip +// String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + + // 唯一标识(指定key + url + 消息头) + String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + url + submitKey; +// String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY +ip+ url; + Integer nowRepeatNum = 1; + Object sessionObj = redisCache.getCacheObject(cacheRepeatKey); + if (sessionObj != null) + { + Map sessionMap = (Map) sessionObj; + if (sessionMap.containsKey(url)) + { + Map preDataMap = (Map) sessionMap.get(url); + + nowDataMap.put(REPEAT_NUM, nowRepeatNum); + +// 默认可以请求2次 + if(preDataMap.containsKey(REPEAT_NUM)) + { + Integer repeatNum = (Integer) preDataMap.get(REPEAT_NUM); + + nowRepeatNum = repeatNum + 1; + + if(nowRepeatNum > 1) + { + if (compareParams(nowDataMap, preDataMap) && compareTime(nowDataMap, preDataMap, 1000)) + { + return true; + } + } + + nowDataMap.put(REPEAT_NUM, nowRepeatNum); + } + + } + } + System.out.println(JSONObject.toJSONString(nowDataMap)); + Map cacheMap = new HashMap(); + cacheMap.put(url, nowDataMap); + redisCache.setCacheObject(cacheRepeatKey, cacheMap, 1000, TimeUnit.MILLISECONDS); + return false; + } + + /** + * 判断参数是否相同 + */ + private boolean compareParams(Map nowMap, Map preMap) + { + String nowParams = (String) nowMap.get(REPEAT_PARAMS); + String preParams = (String) preMap.get(REPEAT_PARAMS); + return nowParams.equals(preParams); + } + + /** + * 判断两次间隔时间 + */ + private boolean compareTime(Map nowMap, Map preMap, int interval) + { + long time1 = (Long) nowMap.get(REPEAT_TIME); + long time2 = (Long) preMap.get(REPEAT_TIME); + if ((time1 - time2) < interval) + { + return true; + } + return false; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/listener/RedisKeyExpirationListener.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/listener/RedisKeyExpirationListener.java new file mode 100644 index 0000000000000000000000000000000000000000..ebe9f79bba399d95373ac9a92d0a33e5db0301f9 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/listener/RedisKeyExpirationListener.java @@ -0,0 +1,61 @@ +package com.ruoyi.framework.listener; + +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.system.service.ISysUserService; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.connection.Message; +import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * Created by Administrator on 2019/2/26. + */ +@Component +class RedisKeyExpirationListener extends KeyExpirationEventMessageListener { + + public RedisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) { + super(listenerContainer); + } + + @Autowired + private ISysUserService userService; + + private Logger logger = LoggerFactory.getLogger(RedisKeyExpirationListener.class); + + private final Object fanNumUpdate = new Object(); + /** + * 针对redis数据失效事件,进行数据处理 + * @param message + * @param pattern + */ + @Override + public void onMessage(Message message, byte[] pattern) { + // 用户做自己的业务处理即可,注意message.toString()可以获取失效的key + String expiredKey = message.toString(); +// logger.info("key"+expiredKey+"已过期"); + //如果用户的短信验证码错误redis过期,则更新用户的状态为正常 + if(expiredKey.contains(CacheConstants.SMS_ERR_CNT_KEY)) + { + String phone = expiredKey.split(":")[1]; + if(StringUtils.isNotEmpty(phone)) { + SysUser user = userService.selectUserByPhone(phone); + if (ObjectUtils.isNotEmpty(user)) { + user.setStatus(UserStatus.OK.getCode()); + userService.updateUserStatus(user); + } + } + } + + + } +} + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java new file mode 100644 index 0000000000000000000000000000000000000000..7387a02cb13d0e0a1926a440f4566fa68595f7e9 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java @@ -0,0 +1,55 @@ +package com.ruoyi.framework.manager; + +import java.util.TimerTask; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import com.ruoyi.common.utils.Threads; +import com.ruoyi.common.utils.spring.SpringUtils; + +/** + * 异步任务管理器 + * + * @author ruoyi + */ +public class AsyncManager +{ + /** + * 操作延迟10毫秒 + */ + private final int OPERATE_DELAY_TIME = 10; + + /** + * 异步操作任务调度线程池 + */ + private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService"); + + /** + * 单例模式 + */ + private AsyncManager(){} + + private static AsyncManager me = new AsyncManager(); + + public static AsyncManager me() + { + return me; + } + + /** + * 执行任务 + * + * @param task 任务 + */ + public void execute(TimerTask task) + { + executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); + } + + /** + * 停止任务线程池 + */ + public void shutdown() + { + Threads.shutdownAndAwaitTermination(executor); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java new file mode 100644 index 0000000000000000000000000000000000000000..e36ca3c58c4d6c6f04fd07a2789f749fcece8524 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java @@ -0,0 +1,39 @@ +package com.ruoyi.framework.manager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import javax.annotation.PreDestroy; + +/** + * 确保应用退出时能关闭后台线程 + * + * @author ruoyi + */ +@Component +public class ShutdownManager +{ + private static final Logger logger = LoggerFactory.getLogger("sys-user"); + + @PreDestroy + public void destroy() + { + shutdownAsyncManager(); + } + + /** + * 停止异步执行任务 + */ + private void shutdownAsyncManager() + { + try + { + logger.info("====关闭后台任务任务线程池===="); + AsyncManager.me().shutdown(); + } + catch (Exception e) + { + logger.error(e.getMessage(), e); + } + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..23d02308a82c168a390fba2e26c338e23bad5312 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java @@ -0,0 +1,102 @@ +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.StringUtils; +import com.ruoyi.common.utils.ip.AddressUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.system.domain.SysLogininfor; +import com.ruoyi.system.domain.SysOperLog; +import com.ruoyi.system.service.ISysLogininforService; +import com.ruoyi.system.service.ISysOperLogService; +import eu.bitwalker.useragentutils.UserAgent; + +/** + * 异步工厂(产生任务用) + * + * @author ruoyi + */ +public class AsyncFactory +{ + private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user"); + + /** + * 记录登录信息 + * + * @param username 用户名 + * @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")); + final String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + return new TimerTask() + { + @Override + public void run() + { + String address = AddressUtils.getRealAddressByIP(ip); + StringBuilder s = new StringBuilder(); + s.append(LogUtils.getBlock(ip)); + s.append(address); + s.append(LogUtils.getBlock(username)); + s.append(LogUtils.getBlock(status)); + s.append(LogUtils.getBlock(message)); + // 打印信息到日志 + sys_user_logger.info(s.toString(), args); + // 获取客户端操作系统 + String os = userAgent.getOperatingSystem().getName(); + // 获取客户端浏览器 + String browser = userAgent.getBrowser().getName(); + // 封装对象 + SysLogininfor logininfor = new SysLogininfor(); + logininfor.setUserName(username); + logininfor.setIpaddr(ip); + logininfor.setLoginLocation(address); + logininfor.setBrowser(browser); + logininfor.setOs(os); + logininfor.setMsg(message); + // 日志状态 + if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) + { + logininfor.setStatus(Constants.SUCCESS); + } + else if (Constants.LOGIN_FAIL.equals(status)) + { + logininfor.setStatus(Constants.FAIL); + } + // 插入数据 + SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor); + } + }; + } + + /** + * 操作日志记录 + * + * @param operLog 操作日志信息 + * @return 任务task + */ + public static TimerTask recordOper(final SysOperLog operLog) + { + return new TimerTask() + { + @Override + public void run() + { + // 远程查询操作地点 + operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp())); + SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog); + } + }; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/AuthenticationContextHolder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/AuthenticationContextHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..6c776ce3fb28736230ebeced47b2b812fb148b8e --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/AuthenticationContextHolder.java @@ -0,0 +1,28 @@ +package com.ruoyi.framework.security.context; + +import org.springframework.security.core.Authentication; + +/** + * 身份验证信息 + * + * @author ruoyi + */ +public class AuthenticationContextHolder +{ + private static final ThreadLocal contextHolder = new ThreadLocal<>(); + + public static Authentication getContext() + { + return contextHolder.get(); + } + + public static void setContext(Authentication context) + { + contextHolder.set(context); + } + + public static void clearContext() + { + contextHolder.remove(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java new file mode 100644 index 0000000000000000000000000000000000000000..5472f3d2bc512450befbb07c84d521ba9379da45 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java @@ -0,0 +1,27 @@ +package com.ruoyi.framework.security.context; + +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import com.ruoyi.common.core.text.Convert; + +/** + * 权限信息 + * + * @author ruoyi + */ +public class PermissionContextHolder +{ + private static final String PERMISSION_CONTEXT_ATTRIBUTES = "PERMISSION_CONTEXT"; + + public static void setContext(String permission) + { + RequestContextHolder.currentRequestAttributes().setAttribute(PERMISSION_CONTEXT_ATTRIBUTES, permission, + RequestAttributes.SCOPE_REQUEST); + } + + public static String getContext() + { + return Convert.toStr(RequestContextHolder.currentRequestAttributes().getAttribute(PERMISSION_CONTEXT_ATTRIBUTES, + RequestAttributes.SCOPE_REQUEST)); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..3eb24954e7aafafb6b06872313213e8abdb7c2d4 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java @@ -0,0 +1,44 @@ +package com.ruoyi.framework.security.filter; + +import java.io.IOException; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.web.service.TokenService; + +/** + * token过滤器 验证token有效性 + * + * @author ruoyi + */ +@Component +public class JwtAuthenticationTokenFilter extends OncePerRequestFilter +{ + @Autowired + private TokenService tokenService; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException + { + LoginUser loginUser = tokenService.getLoginUser(request); + if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) + { + tokenService.verifyToken(loginUser); + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities()); + authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); + SecurityContextHolder.getContext().setAuthentication(authenticationToken); + } + chain.doFilter(request, response); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..93b70325931df51d828c34d2ad49cfc13f773c4c --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java @@ -0,0 +1,34 @@ +package com.ruoyi.framework.security.handle; + +import java.io.IOException; +import java.io.Serializable; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; +import com.alibaba.fastjson2.JSON; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; + +/** + * 认证失败处理类 返回未授权 + * + * @author ruoyi + */ +@Component +public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable +{ + private static final long serialVersionUID = -8970718410437077606L; + + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) + throws IOException + { + int code = HttpStatus.UNAUTHORIZED; + String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); + ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg))); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9245bbd22c4317b8fde9d175cc1c4458904069cf --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java @@ -0,0 +1,58 @@ +package com.ruoyi.framework.security.handle; + +import com.alibaba.fastjson2.JSON; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.framework.web.service.TokenService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 自定义退出处理类 返回成功 + * + * @author ruoyi + */ +@Configuration +public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler +{ + @Autowired + private TokenService tokenService; + + @Autowired + private RedisCache redisCache; + + /** + * 退出处理 + * + * @return + */ + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) + throws IOException, ServletException + { + LoginUser loginUser = tokenService.getLoginUser(request); + if (StringUtils.isNotNull(loginUser)) + { + String userName = loginUser.getUsername(); + // 删除用户缓存记录 + tokenService.delLoginUser(loginUser.getToken(),loginUser.getUserId(),loginUser.getLoginType()); + + // 记录用户退出日志 + AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功")); + } + ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.success("退出成功"))); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/sms/SmsCodeAuthenticationProvider.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/sms/SmsCodeAuthenticationProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..9ca1440c3ea15e8b8eeb91ef70d8256090359cb3 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/sms/SmsCodeAuthenticationProvider.java @@ -0,0 +1,52 @@ +package com.ruoyi.framework.security.sms; + +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; + +/** + * 短信登陆鉴权 Provider,要求实现 AuthenticationProvider 接口 + * + * @author gmk + */ +public class SmsCodeAuthenticationProvider implements AuthenticationProvider { + + private UserDetailsService userDetailsService; + + public SmsCodeAuthenticationProvider(UserDetailsService userDetailsService){ + setUserDetailsService(userDetailsService); + } + + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + SmsCodeAuthenticationToken authenticationToken = (SmsCodeAuthenticationToken) authentication; + + String telephone = (String) authenticationToken.getPrincipal(); + + UserDetails userDetails = userDetailsService.loadUserByUsername(telephone); + + // 此时鉴权成功后,应当重新 new 一个拥有鉴权的 authenticationResult 返回 + SmsCodeAuthenticationToken authenticationResult = new SmsCodeAuthenticationToken(userDetails, userDetails.getAuthorities()); + + authenticationResult.setDetails(authenticationToken.getDetails()); + + return authenticationResult; + } + + + @Override + public boolean supports(Class authentication) { + // 判断 authentication 是不是 SmsCodeAuthenticationToken 的子类或子接口 + return SmsCodeAuthenticationToken.class.isAssignableFrom(authentication); + } + + public UserDetailsService getUserDetailsService() { + return userDetailsService; + } + + public void setUserDetailsService(UserDetailsService userDetailsService) { + this.userDetailsService = userDetailsService; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/sms/SmsCodeAuthenticationToken.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/sms/SmsCodeAuthenticationToken.java new file mode 100644 index 0000000000000000000000000000000000000000..e7a15dbe7609dc82f487c25f65ebb437fc281a68 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/sms/SmsCodeAuthenticationToken.java @@ -0,0 +1,73 @@ +package com.ruoyi.framework.security.sms; + +import org.springframework.security.authentication.AbstractAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.SpringSecurityCoreVersion; + +import java.util.Collection; + +/** + * 短信登录 AuthenticationToken,模仿 UsernamePasswordAuthenticationToken 实现 + * + * @author gmk + */ +public class SmsCodeAuthenticationToken extends AbstractAuthenticationToken { + + private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; + + /** + * 在 UsernamePasswordAuthenticationToken 中该字段代表登录的用户名, + * 在这里就代表登录的手机号码 + */ + private final Object principal; + + //短信验证码 + private Object credentials; + + /** + * 构建一个没有鉴权的 SmsCodeAuthenticationToken + */ + public SmsCodeAuthenticationToken(Object principal, Object credentials) { + super(null); + this.principal = principal; + this.credentials = credentials; + setAuthenticated(false); + } + + + /** + * 构建拥有鉴权的 SmsCodeAuthenticationToken + */ + public SmsCodeAuthenticationToken(Object principal, Collection authorities) { + super(authorities); + this.principal = principal; + // must use super, as we override + super.setAuthenticated(true); + } + + @Override + public Object getCredentials() { + return this.credentials; + } + + @Override + public Object getPrincipal() { + return this.principal; + } + + @Override + public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { + if (isAuthenticated) { + throw new IllegalArgumentException( + "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); + } + + super.setAuthenticated(false); + } + + @Override + public void eraseCredentials() { + super.eraseCredentials(); + } + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java new file mode 100644 index 0000000000000000000000000000000000000000..63b03da78a06e09bf6f7b7fce5b1dad677a5d6a8 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java @@ -0,0 +1,240 @@ +package com.ruoyi.framework.web.domain; + +import java.net.UnknownHostException; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; +import com.ruoyi.common.utils.Arith; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.framework.web.domain.server.Cpu; +import com.ruoyi.framework.web.domain.server.Jvm; +import com.ruoyi.framework.web.domain.server.Mem; +import com.ruoyi.framework.web.domain.server.Sys; +import com.ruoyi.framework.web.domain.server.SysFile; +import oshi.SystemInfo; +import oshi.hardware.CentralProcessor; +import oshi.hardware.CentralProcessor.TickType; +import oshi.hardware.GlobalMemory; +import oshi.hardware.HardwareAbstractionLayer; +import oshi.software.os.FileSystem; +import oshi.software.os.OSFileStore; +import oshi.software.os.OperatingSystem; +import oshi.util.Util; + +/** + * 服务器相关信息 + * + * @author ruoyi + */ +public class Server +{ + private static final int OSHI_WAIT_SECOND = 1000; + + /** + * CPU相关信息 + */ + private Cpu cpu = new Cpu(); + + /** + * 內存相关信息 + */ + private Mem mem = new Mem(); + + /** + * JVM相关信息 + */ + private Jvm jvm = new Jvm(); + + /** + * 服务器相关信息 + */ + private Sys sys = new Sys(); + + /** + * 磁盘相关信息 + */ + private List sysFiles = new LinkedList(); + + public Cpu getCpu() + { + return cpu; + } + + public void setCpu(Cpu cpu) + { + this.cpu = cpu; + } + + public Mem getMem() + { + return mem; + } + + public void setMem(Mem mem) + { + this.mem = mem; + } + + public Jvm getJvm() + { + return jvm; + } + + public void setJvm(Jvm jvm) + { + this.jvm = jvm; + } + + public Sys getSys() + { + return sys; + } + + public void setSys(Sys sys) + { + this.sys = sys; + } + + public List getSysFiles() + { + return sysFiles; + } + + public void setSysFiles(List sysFiles) + { + this.sysFiles = sysFiles; + } + + public void copyTo() throws Exception + { + SystemInfo si = new SystemInfo(); + HardwareAbstractionLayer hal = si.getHardware(); + + setCpuInfo(hal.getProcessor()); + + setMemInfo(hal.getMemory()); + + setSysInfo(); + + setJvmInfo(); + + setSysFiles(si.getOperatingSystem()); + } + + /** + * 设置CPU信息 + */ + private void setCpuInfo(CentralProcessor processor) + { + // CPU信息 + long[] prevTicks = processor.getSystemCpuLoadTicks(); + Util.sleep(OSHI_WAIT_SECOND); + long[] ticks = processor.getSystemCpuLoadTicks(); + long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()]; + long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()]; + long softirq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()]; + long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()]; + long cSys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()]; + long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()]; + long iowait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()]; + long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()]; + long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal; + cpu.setCpuNum(processor.getLogicalProcessorCount()); + cpu.setTotal(totalCpu); + cpu.setSys(cSys); + cpu.setUsed(user); + cpu.setWait(iowait); + cpu.setFree(idle); + } + + /** + * 设置内存信息 + */ + private void setMemInfo(GlobalMemory memory) + { + mem.setTotal(memory.getTotal()); + mem.setUsed(memory.getTotal() - memory.getAvailable()); + mem.setFree(memory.getAvailable()); + } + + /** + * 设置服务器信息 + */ + private void setSysInfo() + { + Properties props = System.getProperties(); + sys.setComputerName(IpUtils.getHostName()); + sys.setComputerIp(IpUtils.getHostIp()); + sys.setOsName(props.getProperty("os.name")); + sys.setOsArch(props.getProperty("os.arch")); + sys.setUserDir(props.getProperty("user.dir")); + } + + /** + * 设置Java虚拟机 + */ + private void setJvmInfo() throws UnknownHostException + { + Properties props = System.getProperties(); + jvm.setTotal(Runtime.getRuntime().totalMemory()); + jvm.setMax(Runtime.getRuntime().maxMemory()); + jvm.setFree(Runtime.getRuntime().freeMemory()); + jvm.setVersion(props.getProperty("java.version")); + jvm.setHome(props.getProperty("java.home")); + } + + /** + * 设置磁盘信息 + */ + private void setSysFiles(OperatingSystem os) + { + FileSystem fileSystem = os.getFileSystem(); + List fsArray = fileSystem.getFileStores(); + for (OSFileStore fs : fsArray) + { + long free = fs.getUsableSpace(); + long total = fs.getTotalSpace(); + long used = total - free; + SysFile sysFile = new SysFile(); + sysFile.setDirName(fs.getMount()); + sysFile.setSysTypeName(fs.getType()); + sysFile.setTypeName(fs.getName()); + sysFile.setTotal(convertFileSize(total)); + sysFile.setFree(convertFileSize(free)); + sysFile.setUsed(convertFileSize(used)); + sysFile.setUsage(Arith.mul(Arith.div(used, total, 4), 100)); + sysFiles.add(sysFile); + } + } + + /** + * 字节转换 + * + * @param size 字节大小 + * @return 转换后值 + */ + public String convertFileSize(long size) + { + long kb = 1024; + long mb = kb * 1024; + long gb = mb * 1024; + if (size >= gb) + { + return String.format("%.1f GB", (float) size / gb); + } + else if (size >= mb) + { + float f = (float) size / mb; + return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f); + } + else if (size >= kb) + { + float f = (float) size / kb; + return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f); + } + else + { + return String.format("%d B", size); + } + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/SysNoticeEntity.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/SysNoticeEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..27f7fb5db442e213a0463afa7ee4ef53e2dbcb87 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/SysNoticeEntity.java @@ -0,0 +1,125 @@ +package com.ruoyi.framework.web.domain; + +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 com.ruoyi.common.mybatis.JsonListLongTypeHandler; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; +import java.util.List; + +/** + *

+ * 通知公告表 + *

+ * + * @author ck + * @since 2023-04-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "SysNotice对象", description = "通知公告表") +public class SysNoticeEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("自增id") + private Integer noticeId; + + @ApiModelProperty("通知标题") + private String noticeTitle; + + @ApiModelProperty("通知类型--字典表sys_notice_type") + @TableField("notice_type") + private String noticeType; + + @ApiModelProperty("通知内容") + @TableField("notice_content") + private String noticeContent; + + @ApiModelProperty("状态 0未读 1已读") + @TableField("status") + private String status; + + @ApiModelProperty("创建人") + @TableField("create_by") + private String createBy; + + @ApiModelProperty("插入时间") + @TableField("create_time") + private LocalDateTime createTime; + + @ApiModelProperty("更新人") + @TableField("update_by") + private String updateBy; + + @ApiModelProperty("更新时间") + @TableField("update_time") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + @TableField("remark") + private String remark; + + @ApiModelProperty("接收人") + @TableField("recive_user") + private Long reciveUser; + + @ApiModelProperty("工作流id") + @TableField("flw_processid") + private String flwProcessid; + + @ApiModelProperty("工作流任务id") + @TableField("flw_taskid") + private String flwTaskid; + + @ApiModelProperty("实际发送时间") + @TableField("send_time") + private LocalDateTime sendTime; + + @ApiModelProperty("发送是否成功,1成功 0失败") + @TableField("send_status") + private String sendStatus; + + @ApiModelProperty("接收人手机号") + @TableField("recive_user_phone") + private String reciveUserPhone; + + @ApiModelProperty("计划发送时间(同天当前时间之前立即发送)") + @TableField("exp_send_time") + private LocalDateTime expSendTime; + + @ApiModelProperty("加入定时任务标记 默认0未加入 1已加入") + @TableField("add_flag") + private String addFlag; + + @ApiModelProperty("通知对象ids数组") + @TableField(value = "notice_object_id",typeHandler = JsonListLongTypeHandler.class) + private List noticeObjectId; + + @ApiModelProperty("通知模板id") + @TableField("notice_model_id") + private Long noticeModelId; + + @ApiModelProperty("通知场景--字典yw_notice_scene (0一般告警 1重大告警 ....)") + @TableField("model_scene") + private String modelScene; + + @ApiModelProperty("对象属性--yw_notice_object(0场馆层 1分公司层 2亚运指挥层 3ITCC层)") + @TableField("object_proto") + private String objectProto; + + @ApiModelProperty("通知对象(是指具体的通知接受者,呈现方式包括场馆+群组;分公司+群组名;地市+群组名;ITCC+群组名;场馆+个人名;分公司+个人名;地市+个人名;ITCC+个人名这几种组合。具体呈现内容和对象属性、通知方式相关联)") + @TableField("notice_object") + private String noticeObject; + + @ApiModelProperty("通知类型model_suit_type 1 普通 2 手工 3简报") + @TableField("model_suit_type") + private String modelSuitType; + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/dto/MobileOfficesDTO.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/dto/MobileOfficesDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..19462d13ce3b07a11134fbfe5c545a004fa759b3 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/dto/MobileOfficesDTO.java @@ -0,0 +1,47 @@ +package com.ruoyi.framework.web.domain.dto; + +import lombok.Data; + +@Data +public class MobileOfficesDTO { + + /** + * 发送移动办公群ID + * 根据省公司的参数要求,需要提供群号 + * 例如:378930703,378930703 多个群需要用英文逗号‘,’隔开输入 + * */ + private String mobileoffices; + + /** + * 移动办公群人员@ + * */ + private String mobileoffice_user; + + /** + * 发送的文件 base64 + * 文件、图片、文本必填一个,支持同时传送三个 + * file(文件),filename(文件名)一起传递 + * img(图片),imgname(图片名)一起传递 + * */ + private String file; + + /** + * 文件名称 + * */ + private String filename; + + /** + * 发送的图片 base64 + * */ + private String img; + + /** + * 图片名称 + * */ + private String imgname; + + /** + * 发送内容 + * */ + private String content; +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java new file mode 100644 index 0000000000000000000000000000000000000000..a13a66cf24dd614309ae41d208c566e22414c872 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Cpu.java @@ -0,0 +1,101 @@ +package com.ruoyi.framework.web.domain.server; + +import com.ruoyi.common.utils.Arith; + +/** + * CPU相关信息 + * + * @author ruoyi + */ +public class Cpu +{ + /** + * 核心数 + */ + private int cpuNum; + + /** + * CPU总的使用率 + */ + private double total; + + /** + * CPU系统使用率 + */ + private double sys; + + /** + * CPU用户使用率 + */ + private double used; + + /** + * CPU当前等待率 + */ + private double wait; + + /** + * CPU当前空闲率 + */ + private double free; + + public int getCpuNum() + { + return cpuNum; + } + + public void setCpuNum(int cpuNum) + { + this.cpuNum = cpuNum; + } + + public double getTotal() + { + return Arith.round(Arith.mul(total, 100), 2); + } + + public void setTotal(double total) + { + this.total = total; + } + + public double getSys() + { + return Arith.round(Arith.mul(sys / total, 100), 2); + } + + public void setSys(double sys) + { + this.sys = sys; + } + + public double getUsed() + { + return Arith.round(Arith.mul(used / total, 100), 2); + } + + public void setUsed(double used) + { + this.used = used; + } + + public double getWait() + { + return Arith.round(Arith.mul(wait / total, 100), 2); + } + + public void setWait(double wait) + { + this.wait = wait; + } + + public double getFree() + { + return Arith.round(Arith.mul(free / total, 100), 2); + } + + public void setFree(double free) + { + this.free = free; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java new file mode 100644 index 0000000000000000000000000000000000000000..444b280d39529e8813290401785319671b105d12 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Jvm.java @@ -0,0 +1,130 @@ +package com.ruoyi.framework.web.domain.server; + +import java.lang.management.ManagementFactory; +import com.ruoyi.common.utils.Arith; +import com.ruoyi.common.utils.DateUtils; + +/** + * JVM相关信息 + * + * @author ruoyi + */ +public class Jvm +{ + /** + * 当前JVM占用的内存总数(M) + */ + private double total; + + /** + * JVM最大可用内存总数(M) + */ + private double max; + + /** + * JVM空闲内存(M) + */ + private double free; + + /** + * JDK版本 + */ + private String version; + + /** + * JDK路径 + */ + private String home; + + public double getTotal() + { + return Arith.div(total, (1024 * 1024), 2); + } + + public void setTotal(double total) + { + this.total = total; + } + + public double getMax() + { + return Arith.div(max, (1024 * 1024), 2); + } + + public void setMax(double max) + { + this.max = max; + } + + public double getFree() + { + return Arith.div(free, (1024 * 1024), 2); + } + + public void setFree(double free) + { + this.free = free; + } + + public double getUsed() + { + return Arith.div(total - free, (1024 * 1024), 2); + } + + public double getUsage() + { + return Arith.mul(Arith.div(total - free, total, 4), 100); + } + + /** + * 获取JDK名称 + */ + public String getName() + { + return ManagementFactory.getRuntimeMXBean().getVmName(); + } + + public String getVersion() + { + return version; + } + + public void setVersion(String version) + { + this.version = version; + } + + public String getHome() + { + return home; + } + + public void setHome(String home) + { + this.home = home; + } + + /** + * JDK启动时间 + */ + public String getStartTime() + { + return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getServerStartDate()); + } + + /** + * JDK运行时间 + */ + public String getRunTime() + { + return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate()); + } + + /** + * 运行参数 + */ + public String getInputArgs() + { + return ManagementFactory.getRuntimeMXBean().getInputArguments().toString(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java new file mode 100644 index 0000000000000000000000000000000000000000..13eec521a4011f9ef970f3863ef562c833946282 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Mem.java @@ -0,0 +1,61 @@ +package com.ruoyi.framework.web.domain.server; + +import com.ruoyi.common.utils.Arith; + +/** + * 內存相关信息 + * + * @author ruoyi + */ +public class Mem +{ + /** + * 内存总量 + */ + private double total; + + /** + * 已用内存 + */ + private double used; + + /** + * 剩余内存 + */ + private double free; + + public double getTotal() + { + return Arith.div(total, (1024 * 1024 * 1024), 2); + } + + public void setTotal(long total) + { + this.total = total; + } + + public double getUsed() + { + return Arith.div(used, (1024 * 1024 * 1024), 2); + } + + public void setUsed(long used) + { + this.used = used; + } + + public double getFree() + { + return Arith.div(free, (1024 * 1024 * 1024), 2); + } + + public void setFree(long free) + { + this.free = free; + } + + public double getUsage() + { + return Arith.mul(Arith.div(used, total, 4), 100); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java new file mode 100644 index 0000000000000000000000000000000000000000..45d64d9cde55be168dbaf22959c8d78835bd3ed3 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/Sys.java @@ -0,0 +1,84 @@ +package com.ruoyi.framework.web.domain.server; + +/** + * 系统相关信息 + * + * @author ruoyi + */ +public class Sys +{ + /** + * 服务器名称 + */ + private String computerName; + + /** + * 服务器Ip + */ + private String computerIp; + + /** + * 项目路径 + */ + private String userDir; + + /** + * 操作系统 + */ + private String osName; + + /** + * 系统架构 + */ + private String osArch; + + public String getComputerName() + { + return computerName; + } + + public void setComputerName(String computerName) + { + this.computerName = computerName; + } + + public String getComputerIp() + { + return computerIp; + } + + public void setComputerIp(String computerIp) + { + this.computerIp = computerIp; + } + + public String getUserDir() + { + return userDir; + } + + public void setUserDir(String userDir) + { + this.userDir = userDir; + } + + public String getOsName() + { + return osName; + } + + public void setOsName(String osName) + { + this.osName = osName; + } + + public String getOsArch() + { + return osArch; + } + + public void setOsArch(String osArch) + { + this.osArch = osArch; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java new file mode 100644 index 0000000000000000000000000000000000000000..1320cde6ecc13557972c359ac9c8acc87959e721 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/server/SysFile.java @@ -0,0 +1,114 @@ +package com.ruoyi.framework.web.domain.server; + +/** + * 系统文件相关信息 + * + * @author ruoyi + */ +public class SysFile +{ + /** + * 盘符路径 + */ + private String dirName; + + /** + * 盘符类型 + */ + private String sysTypeName; + + /** + * 文件类型 + */ + private String typeName; + + /** + * 总大小 + */ + private String total; + + /** + * 剩余大小 + */ + private String free; + + /** + * 已经使用量 + */ + private String used; + + /** + * 资源的使用率 + */ + private double usage; + + public String getDirName() + { + return dirName; + } + + public void setDirName(String dirName) + { + this.dirName = dirName; + } + + public String getSysTypeName() + { + return sysTypeName; + } + + public void setSysTypeName(String sysTypeName) + { + this.sysTypeName = sysTypeName; + } + + public String getTypeName() + { + return typeName; + } + + public void setTypeName(String typeName) + { + this.typeName = typeName; + } + + public String getTotal() + { + return total; + } + + public void setTotal(String total) + { + this.total = total; + } + + public String getFree() + { + return free; + } + + public void setFree(String free) + { + this.free = free; + } + + public String getUsed() + { + return used; + } + + public void setUsed(String used) + { + this.used = used; + } + + public double getUsage() + { + return usage; + } + + public void setUsage(double usage) + { + this.usage = usage; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/ErrorInfoBuilder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/ErrorInfoBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..207393d6f66d9ae807cf6b3d6f50d45e8b199815 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/ErrorInfoBuilder.java @@ -0,0 +1,138 @@ +package com.ruoyi.framework.web.exception; + +import cn.hutool.core.util.StrUtil; +import com.ruoyi.common.core.domain.AjaxResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.web.ErrorProperties; +import org.springframework.boot.autoconfigure.web.ServerProperties; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.HandlerExceptionResolver; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.util.WebUtils; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import java.io.StringWriter; + +/** + * ErrorBuilder之所以使用@Order注解和实现HandlerExceptionResolver接口是为了获取错误/异常 + * 通常情况下@ExceptionHandler并不需要这么做,因为在映射方法注入Throwable就可以获得错误/异常, + * 这是主要是为了ErrorController根据Request对象快速获取错误/异常 + */ +@Order(Ordered.HIGHEST_PRECEDENCE) +@Component +@Slf4j +public class ErrorInfoBuilder implements HandlerExceptionResolver, Ordered { + + /** + * 错误KEY + */ + private final static String ERROR_NAME = "error"; + + private ErrorProperties errorProperties; + + public ErrorInfoBuilder(ServerProperties serverProperties) { + this.errorProperties = serverProperties.getError(); + } + + public AjaxResult getErrorInfo(HttpServletRequest request) { + return getErrorInfo(request, getError(request)); + } + + public AjaxResult getErrorInfo(HttpServletRequest request, Throwable error) { + log.error(request.getRequestURI() + " error: " + error.getMessage(), error); + return AjaxResult.error("服务器异常" + error.getMessage()); + } + + public Throwable getError(HttpServletRequest request) { + //根据HandlerExceptionResolver接口方法来获取错误 + Throwable error = (Throwable) request.getAttribute(ERROR_NAME); + + if (error == null) { + error = (Throwable) request.getAttribute(WebUtils.ERROR_EXCEPTION_ATTRIBUTE); + } + + //当获取错误非空,取出RootCause + if (error != null) { + while (error instanceof ServletException && error.getCause() != null) { + error = error.getCause(); + } + } else { + String message = (String) request.getAttribute(WebUtils.ERROR_MESSAGE_ATTRIBUTE); + if (StrUtil.isEmpty(message)) { + HttpStatus httpStatus = getHttpStatus(request); + message = "Unknown Exception But " + httpStatus.value() + " " + httpStatus.getReasonPhrase(); + } + + error = new Exception(message); + } + + return error; + } + + /** + * 获取通信状态 + */ + public HttpStatus getHttpStatus(HttpServletRequest request) { + Integer statusCode = (Integer) request.getAttribute(WebUtils.ERROR_STATUS_CODE_ATTRIBUTE); + try { + return statusCode != null ? HttpStatus.valueOf(statusCode) : HttpStatus.INTERNAL_SERVER_ERROR; + } catch (Exception e) { + return HttpStatus.INTERNAL_SERVER_ERROR; + } + } + + /** + * 获取堆栈轨迹(StackTrace) + */ + public String getStackTraceInfo(Throwable error, boolean flag) { +// if (!flag) { +// return "omitted"; +// } + StringWriter stackTrace = new StringWriter(); + error.printStackTrace(new PrintWriter(stackTrace)); + stackTrace.flush(); + return stackTrace.toString(); + } + + public boolean isIncludeStackTrade(HttpServletRequest request) { + // 读取配置 + ErrorProperties.IncludeAttribute includeStacktrace = errorProperties.getIncludeStacktrace(); + + if (includeStacktrace == ErrorProperties.IncludeAttribute.ALWAYS) { + return true; + } + + // 若请求参数含有trace + if (includeStacktrace == ErrorProperties.IncludeAttribute.ON_PARAM) { + String parameter = request.getParameter("trace"); + return parameter != null && !"false".equalsIgnoreCase(parameter); + } + + return false; + } + + @Override + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE; + } + + @Override + public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) { + httpServletRequest.setAttribute(ERROR_NAME, e); + return null; + } + + public ErrorProperties getErrorProperties() { + return errorProperties; + } + + public void setErrorProperties(ErrorProperties errorProperties) { + this.errorProperties = errorProperties; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..ac61eeebf52b5c974935e9fb86de6bc769706dbe --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java @@ -0,0 +1,188 @@ +package com.ruoyi.framework.web.exception; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.apache.ibatis.exceptions.PersistenceException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.validation.BindException; +import org.springframework.validation.ObjectError; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.MissingServletRequestParameterException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.exception.DemoModeException; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; + +import java.sql.SQLIntegrityConstraintViolationException; +import java.util.List; + +/** + * 全局异常处理器 + * + * @author ruoyi + */ +@RestControllerAdvice +public class GlobalExceptionHandler +{ + private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); + + @Autowired + ErrorInfoBuilder errorInfoBuilder; + + @ExceptionHandler(value = Exception.class) + public ResponseEntity errorHandle(HttpServletRequest request, Exception e) { + e.printStackTrace(); + ResponseEntity responseEntity = null; + + if(e instanceof MissingServletRequestParameterException){ + responseEntity = new ResponseEntity(AjaxResult.error(e.getMessage()), org.springframework.http.HttpStatus.OK); + return responseEntity; + } + + if(e instanceof ServiceException){ + responseEntity = new ResponseEntity(AjaxResult.error(e.getMessage()), org.springframework.http.HttpStatus.OK); + return responseEntity; + } + + if(e instanceof DuplicateKeyException) { + log.error("数据重复" + e.getMessage(),e); + responseEntity = new ResponseEntity(AjaxResult.error("数据重复!"), org.springframework.http.HttpStatus.OK); + return responseEntity; + } + + if(e instanceof PersistenceException) { + Throwable rootCause = ExceptionUtils.getRootCause(e); + if(rootCause instanceof SQLIntegrityConstraintViolationException + && rootCause.getMessage().toLowerCase().contains("duplicate")){ + log.error("数据库处理异常" + e.getMessage(),e); + responseEntity = new ResponseEntity(AjaxResult.error("数据重复!"+e.getMessage()), org.springframework.http.HttpStatus.OK); + return responseEntity; + } + + log.error("数据库处理异常" + e.getMessage(),e); + responseEntity = new ResponseEntity(AjaxResult.error("数据库错误,请联系管理员!"+e.getMessage()), org.springframework.http.HttpStatus.OK); + return responseEntity; + } + + if (e instanceof MethodArgumentNotValidException) { + log.error(request.getRequestURI() + e.getMessage(), e); + MethodArgumentNotValidException exception = (MethodArgumentNotValidException) e; + List allErrors = exception.getBindingResult().getAllErrors(); + StringBuilder stringBuilder = new StringBuilder(); + for (ObjectError objectError : allErrors) { + stringBuilder.append(objectError.getDefaultMessage()).append(";"); + } + if (stringBuilder.length() > 0) { + stringBuilder.deleteCharAt(stringBuilder.length() - 1); + } + return new ResponseEntity(AjaxResult.error(stringBuilder.toString()), org.springframework.http.HttpStatus.OK); + } + + if(e instanceof IllegalArgumentException){ + responseEntity = new ResponseEntity(AjaxResult.error(e.getMessage()), org.springframework.http.HttpStatus.OK); + return responseEntity; + } + + AjaxResult errorInfo = errorInfoBuilder.getErrorInfo(request); + responseEntity = new ResponseEntity(errorInfo, org.springframework.http.HttpStatus.OK); + + return responseEntity; + } + + /** + * 权限校验异常 + */ + @ExceptionHandler(AccessDeniedException.class) + public AjaxResult handleAccessDeniedException(AccessDeniedException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("请求地址'{}',权限校验失败'{}'", requestURI, e.getMessage()); + return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权"); + } + + /** + * 请求方式不支持 + */ + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e, + HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod()); + return AjaxResult.error(e.getMessage()); + } + + /** + * 业务异常 + */ + @ExceptionHandler(ServiceException.class) + public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request) + { + log.error(e.getMessage(), e); + Integer code = e.getCode(); + return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage()); + } + +// /** +// * 拦截未知的运行时异常 +// */ +// @ExceptionHandler(RuntimeException.class) +// public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) +// { +// String requestURI = request.getRequestURI(); +// log.error("请求地址'{}',发生未知异常.", requestURI, e); +// return AjaxResult.error(e.getMessage()); +// } + +// /** +// * 系统异常 +// */ +// @ExceptionHandler(Exception.class) +// public AjaxResult handleException(Exception e, HttpServletRequest request) +// { +// String requestURI = request.getRequestURI(); +// log.error("请求地址'{}',发生系统异常.", requestURI, e); +// return AjaxResult.error(e.getMessage()); +// } + + /** + * 自定义验证异常 + */ + @ExceptionHandler(BindException.class) + public AjaxResult handleBindException(BindException e) + { + log.error(e.getMessage(), e); + String message = e.getAllErrors().get(0).getDefaultMessage(); + return AjaxResult.error(message); + } + + /** + * 自定义验证异常 + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) + { + log.error(e.getMessage(), e); + String message = e.getBindingResult().getFieldError().getDefaultMessage(); + return AjaxResult.error(message); + } + + /** + * 演示模式异常 + */ + @ExceptionHandler(DemoModeException.class) + public AjaxResult handleDemoModeException(DemoModeException e) + { + return AjaxResult.error("演示模式,不允许操作"); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/mapper/SysLoginMapper.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/mapper/SysLoginMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..1d69066ea90b19178e3b0a23bb6f1c44730dd2b3 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/mapper/SysLoginMapper.java @@ -0,0 +1,11 @@ +package com.ruoyi.framework.web.mapper; + +import com.ruoyi.framework.web.domain.SysNoticeEntity; +import org.apache.ibatis.annotations.Insert; + +public interface SysLoginMapper { + + @Insert("insert into sys_notice (notice_title, notice_type, status, create_by,create_time, notice_content, recive_user,recive_user_phone, exp_send_time, add_flag) VALUES " + + "(#{noticeTitle},#{noticeType},#{status},#{createBy},#{createTime},#{noticeContent},#{reciveUser},#{reciveUserPhone},#{expSendTime},#{addFlag})") + void insertNotice(SysNoticeEntity notice); +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppPermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppPermissionService.java new file mode 100644 index 0000000000000000000000000000000000000000..27a4cf6b2fd726c0aef230cb151928786e9d5930 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AppPermissionService.java @@ -0,0 +1,169 @@ +package com.ruoyi.framework.web.service; + +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.security.context.PermissionContextHolder; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.Set; + +/** + * RuoYi首创 自定义权限实现,ss取自SpringSecurity首字母 app专用 + * + * @author ruoyi + */ +@Service("app") +public class AppPermissionService +{ + /** 所有权限标识 */ + private static final String ALL_PERMISSION = "*:*:*"; + + /** 管理员角色权限标识 */ + private static final String SUPER_ADMIN = "admin"; + + private static final String ROLE_DELIMETER = ","; + + private static final String PERMISSION_DELIMETER = ","; + + /** + * 验证用户是否具备某权限 + * + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + public boolean hasPermi(String permission) + { + if (StringUtils.isEmpty(permission)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getAppPermissions())) + { + return false; + } + PermissionContextHolder.setContext(permission); + return hasPermissions(loginUser.getAppPermissions(), permission); + } + + /** + * 验证用户是否不具备某权限,与 hasPermi逻辑相反 + * + * @param permission 权限字符串 + * @return 用户是否不具备某权限 + */ + public boolean lacksPermi(String permission) + { + return hasPermi(permission) != true; + } + + /** + * 验证用户是否具有以下任意一个权限 + * + * @param permissions 以 PERMISSION_NAMES_DELIMETER 为分隔符的权限列表 + * @return 用户是否具有以下任意一个权限 + */ + public boolean hasAnyPermi(String permissions) + { + if (StringUtils.isEmpty(permissions)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getAppPermissions())) + { + return false; + } + PermissionContextHolder.setContext(permissions); + Set authorities = loginUser.getAppPermissions(); + for (String permission : permissions.split(PERMISSION_DELIMETER)) + { + if (permission != null && hasPermissions(authorities, permission)) + { + return true; + } + } + return false; + } + + /** + * 判断用户是否拥有某个角色 + * + * @param role 角色字符串 + * @return 用户是否具备某角色 + */ + public boolean hasRole(String role) + { + if (StringUtils.isEmpty(role)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) + { + return false; + } + for (SysRole sysRole : loginUser.getUser().getRoles()) + { + String roleKey = sysRole.getRoleKey(); + if (SUPER_ADMIN.equals(roleKey) || roleKey.equals(StringUtils.trim(role))) + { + return true; + } + } + return false; + } + + /** + * 验证用户是否不具备某角色,与 isRole逻辑相反。 + * + * @param role 角色名称 + * @return 用户是否不具备某角色 + */ + public boolean lacksRole(String role) + { + return hasRole(role) != true; + } + + /** + * 验证用户是否具有以下任意一个角色 + * + * @param roles 以 ROLE_NAMES_DELIMETER 为分隔符的角色列表 + * @return 用户是否具有以下任意一个角色 + */ + public boolean hasAnyRoles(String roles) + { + if (StringUtils.isEmpty(roles)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) + { + return false; + } + for (String role : roles.split(ROLE_DELIMETER)) + { + if (hasRole(role)) + { + return true; + } + } + return false; + } + + /** + * 判断是否包含权限 + * + * @param permissions 权限列表 + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + private boolean hasPermissions(Set permissions, String permission) + { + return permissions.contains(ALL_PERMISSION) || permissions.contains(StringUtils.trim(permission)); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java new file mode 100644 index 0000000000000000000000000000000000000000..c2f97a170b4f57cb7e853b6b4b64410669b95652 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java @@ -0,0 +1,168 @@ +package com.ruoyi.framework.web.service; + +import java.util.Set; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.security.context.PermissionContextHolder; + +/** + * RuoYi首创 自定义权限实现,ss取自SpringSecurity首字母 + * + * @author ruoyi + */ +@Service("ss") +public class PermissionService +{ + /** 所有权限标识 */ + private static final String ALL_PERMISSION = "*:*:*"; + + /** 管理员角色权限标识 */ + private static final String SUPER_ADMIN = "admin"; + + private static final String ROLE_DELIMETER = ","; + + private static final String PERMISSION_DELIMETER = ","; + + /** + * 验证用户是否具备某权限 + * + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + public boolean hasPermi(String permission) + { + if (StringUtils.isEmpty(permission)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) + { + return false; + } + PermissionContextHolder.setContext(permission); + return hasPermissions(loginUser.getPermissions(), permission); + } + + /** + * 验证用户是否不具备某权限,与 hasPermi逻辑相反 + * + * @param permission 权限字符串 + * @return 用户是否不具备某权限 + */ + public boolean lacksPermi(String permission) + { + return hasPermi(permission) != true; + } + + /** + * 验证用户是否具有以下任意一个权限 + * + * @param permissions 以 PERMISSION_NAMES_DELIMETER 为分隔符的权限列表 + * @return 用户是否具有以下任意一个权限 + */ + public boolean hasAnyPermi(String permissions) + { + if (StringUtils.isEmpty(permissions)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) + { + return false; + } + PermissionContextHolder.setContext(permissions); + Set authorities = loginUser.getPermissions(); + for (String permission : permissions.split(PERMISSION_DELIMETER)) + { + if (permission != null && hasPermissions(authorities, permission)) + { + return true; + } + } + return false; + } + + /** + * 判断用户是否拥有某个角色 + * + * @param role 角色字符串 + * @return 用户是否具备某角色 + */ + public boolean hasRole(String role) + { + if (StringUtils.isEmpty(role)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) + { + return false; + } + for (SysRole sysRole : loginUser.getUser().getRoles()) + { + String roleKey = sysRole.getRoleKey(); + if (SUPER_ADMIN.equals(roleKey) || roleKey.equals(StringUtils.trim(role))) + { + return true; + } + } + return false; + } + + /** + * 验证用户是否不具备某角色,与 isRole逻辑相反。 + * + * @param role 角色名称 + * @return 用户是否不具备某角色 + */ + public boolean lacksRole(String role) + { + return hasRole(role) != true; + } + + /** + * 验证用户是否具有以下任意一个角色 + * + * @param roles 以 ROLE_NAMES_DELIMETER 为分隔符的角色列表 + * @return 用户是否具有以下任意一个角色 + */ + public boolean hasAnyRoles(String roles) + { + if (StringUtils.isEmpty(roles)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) + { + return false; + } + for (String role : roles.split(ROLE_DELIMETER)) + { + if (hasRole(role)) + { + return true; + } + } + return false; + } + + /** + * 判断是否包含权限 + * + * @param permissions 权限列表 + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + private boolean hasPermissions(Set permissions, String permission) + { + return permissions.contains(ALL_PERMISSION) || permissions.contains(StringUtils.trim(permission)); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java new file mode 100644 index 0000000000000000000000000000000000000000..d47f1c335cf17187108d0b107b3bf4eaaee97f2f --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -0,0 +1,438 @@ +package com.ruoyi.framework.web.service; + +import com.github.pagehelper.util.StringUtil; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginBody; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.exception.user.CaptchaException; +import com.ruoyi.common.exception.user.CaptchaExpireException; +import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.utils.*; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.framework.security.context.AuthenticationContextHolder; +import com.ruoyi.framework.security.sms.SmsCodeAuthenticationToken; +import com.ruoyi.framework.web.service.sms.MessageService; +import com.ruoyi.framework.web.service.sms.SmsRsponseVo; +import com.ruoyi.system.service.ISysConfigService; +import com.ruoyi.system.service.ISysUserService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.binary.Base64; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.crypto.*; +import javax.crypto.spec.SecretKeySpec; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.concurrent.TimeUnit; + +/** + * 登录校验方法 + * + * @author ruoyi + */ +@Component +@Slf4j +public class SysLoginService { + @Autowired + private TokenService tokenService; + + @Resource + private AuthenticationManager authenticationManager; + + @Autowired + private RedisCache redisCache; + + @Autowired + private MessageService messageService; + + @Autowired + private ISysUserService userService; + + @Autowired + private ISysConfigService configService; + + @Autowired + private SysPermissionService permissionService; + + @Value("${user.sms.defaultCode}") + private boolean defaultCode; + + // 是否允许同类型端同时登录(true允许 false不允许) + @Value("${token.soloLogin}") + private boolean soloLogin; + + //密钥 前后台一致16位 + private static final String KEY = "MFwwDQYJKoZIhvcN"; + //参数分别代表 算法名称/加密模式/数据填充方式 + private static final String ALGORITHMESTR = "AES/ECB/PKCS5Padding"; + + /** + * 登录验证 + * + * @param username 用户名 + * @param password 密码 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public String login(String username, String password, String code, String uuid) { + + // 密码解密 + password = aESDecodePassword(password); + + boolean captchaEnabled = configService.selectCaptchaEnabled(); + // 验证码开关 + if (captchaEnabled) { + validateCaptcha(username, code, uuid); + } + // 用户验证 + Authentication authentication = null; + try { + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password); + AuthenticationContextHolder.setContext(authenticationToken); + // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername + authentication = authenticationManager.authenticate(authenticationToken); + } catch (Exception e) { + if (e instanceof BadCredentialsException) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } else { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage())); + throw new ServiceException(e.getMessage()); + } + } finally { + AuthenticationContextHolder.clearContext(); + } + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); + +// 从缓存中去掉原来登录的用户 +// Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); +// for (String key : keys) { +// LoginUser user = redisCache.getCacheObject(key); +// +// if (user.getUsername().equals(username)) { +// redisCache.deleteObject(key); +// break; +// } +// } + + LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + + if (!soloLogin) + { + // 如果用户不允许多终端同时登录,清除缓存信息 + String userIdKey = Constants.LOGIN_USERID_KEY + loginUser.getUser().getUserId()+":"+UserConstants.PC; + String userKey = redisCache.getCacheObject(userIdKey); + if (StringUtils.isNotEmpty(userKey)) + { + redisCache.deleteObject(userIdKey); + redisCache.deleteObject(userKey); + } + } + loginUser.setLoginType("pc"); + recordLoginInfo(loginUser.getUserId()); + // 生成token + return tokenService.createToken(loginUser); + } + + private String aESDecodePassword(String password) { + try { + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + kgen.init(128); + //拿到秘钥,KEY是我们刚刚定义的 + SecretKeySpec key = new SecretKeySpec(KEY.getBytes(),"AES"); + //创建密码器[算法名/加密模式/数据填充模式] + Cipher cipher = Cipher.getInstance(ALGORITHMESTR); + //表示密码器要使用key进行解码 + cipher.init(Cipher.DECRYPT_MODE, key); + //根据刚刚加密得到的结果,我们需要把info.getPassword字符串通过base64编码成cipher能识别的byte数组 + byte[] result = cipher.doFinal(Base64.decodeBase64(password)); + System.out.println("decode:"+new String(result)); + return new String(result); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (BadPaddingException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } + return password; + } + + public AjaxResult getCode(LoginBody loginBody) throws Exception { + String phoneText = loginBody.getPhone(); + //测试阶段暂不加密 + String phone = null; + try { + phone = RsaUtils.decryptByPrivateKey(phoneText); + } catch (Exception e) { + log.info("密文解密失败:"+phoneText); + throw new ServiceException("解密失败"); + } + if (StringUtil.isEmpty(phone) || phone.length() != 11) { + throw new ServiceException("手机号码有误!"); + } + SysUser user = userService.selectUserByPhone(phone); + if (StringUtils.isNull(user)) { + log.info("登录用户的手机号码:{} 不存在.", phone); + throw new ServiceException("登录用户手机号码不存在"); + } + if (!"0".equals(user.getStatus())) { + if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { + //20230510锁定的在缓存结束后解锁 + String smsCodeKey = CacheConstants.SMS_ERR_CNT_KEY + phone; + Long expire = 1L ; + if(redisCache.hasKey(smsCodeKey)) { + //获取到的是秒 + expire = redisCache.getExpire(smsCodeKey) / 60; + if(expire<1) + { + expire = 1L; + } + log.info("登录用户的手机号码:{} 已被锁定.", phone); + throw new ServiceException("手机号码:" + phone + " 已锁定,还剩下" + expire + "分钟"); + } + else + { + //没有缓存锁定用户已经恢复,需要设置为正常 + user.setStatus(UserStatus.OK.getCode()); + userService.updateUserStatus(user); + } +// log.info("登录用户的手机号码:{} 已被锁定.", phone); +// throw new ServiceException("登录用户手机号码:" + phone + " 已锁定"); + } + if (UserStatus.SLEEP.getCode().equals(user.getStatus())) { + log.info("登录用户的手机号码:{} 已被已冻结.", phone); + throw new ServiceException("登录用户手机号码:" + phone + " 已冻结"); + } +// log.info("登录用户的帐号非正常状态,状态:"+user.getStatus()); +// throw new ServiceException("登录用户的帐号非正常状态"); + } + //从缓存获取验证码 + String code = (String) redisCache.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + phone); + + if (!StringUtils.isEmpty(code)) { + //数据库轮询发送短信 + SmsRsponseVo smsRsponseVo = messageService.senSMSCodeByUser(user.getUserId(), phone, code); + if (!smsRsponseVo.getCode().equals(0)) { + throw new ServiceException("短信发送失败!"); + } + log.info(phone + "有效期内重新发送短信验证码:" + code); + //需求即使还在有效期内也重新发送短信 + throw new ServiceException("验证码还在有效期内,短信已发送,请注意查收"); + } + + if (StringUtils.isEmpty(code)) { + if (defaultCode) { + code = "123456"; + } else { + code = PasswordUtil.createNumPassWord(6); + } + log.info(phone + "生成短信验证码:" + code); + redisCache.setCacheObject(CacheConstants.CAPTCHA_CODE_KEY + phone, code, 300, TimeUnit.SECONDS); + } + + + + //数据库轮询发送短信 + SmsRsponseVo smsRsponseVo = messageService.senSMSCodeByUser(user.getUserId(), phone, code); + if (!smsRsponseVo.getCode().equals(0)) { + throw new ServiceException("短信发送失败!"); + } + + + return AjaxResult.success(); + } + + public String loginByPhone(String phoneText, String code, String uuid,String loginType) { + + if (StringUtil.isEmpty(phoneText)) { + throw new ServiceException("手机号码不能为空"); + } + + if (StringUtil.isEmpty(code)) { + throw new ServiceException("短信验证码不能为空"); + } + + //测试阶段暂不加密 + String phone = null; + try { + phone = RsaUtils.decryptByPrivateKey(phoneText); + } catch (Exception e) { + log.info("密文解密失败:"+phoneText); + throw new ServiceException("解密失败"); + } + + // 用户验证 + Authentication authentication = null; + try { + SmsCodeAuthenticationToken authenticationToken = new SmsCodeAuthenticationToken(phone, code); + AuthenticationContextHolder.setContext(authenticationToken); + // userDetailsByTelephoneServiceImpl.loadUserByUsername + authentication = authenticationManager.authenticate(authenticationToken); + } catch (Exception e) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(phone, Constants.LOGIN_FAIL, e.getMessage())); + throw new ServiceException(e.getMessage()); + } finally { + AuthenticationContextHolder.clearContext(); + } + + AsyncManager.me().execute(AsyncFactory.recordLogininfor(phone, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); + + SysUser user= userService.selectUserByPhone(phone); + + boolean captchaEnabled = configService.selectDistinctEnabled(); + +// if(captchaEnabled) { +// //从缓存中去除原来登录的用户 +// Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); +// for (String key : keys) { +// LoginUser redisUser = redisCache.getCacheObject(key); +// if(StringUtil.isNotEmpty(redisUser.getLoginType())) { +// if (redisUser.getUsername().equals(user.getUserName()) && redisUser.getLoginType().equals(loginType)) { +// redisCache.deleteObject(key); +// break; +// } +// } +// } +// } +// String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + "/getLoginCode"; + if (redisCache.hasKey(cacheRepeatKey)) { + redisCache.deleteObject(cacheRepeatKey); + } + // + if (redisCache.hasKey(CacheConstants.CAPTCHA_CODE_KEY + phone)&&(!"15726940139".equals(phone))) { + redisCache.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + phone); + } + + //假定用户有验证码错误次数,则删除 + String key = CacheConstants.SMS_ERR_CNT_KEY + phone; + if (redisCache.hasKey(key)) { + redisCache.deleteObject(key); + } + + //授权用户登录 + LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + + loginUser.setLoginType(loginType); + + if (!soloLogin) + { + // 如果用户不允许多终端同时登录,清除缓存信息 + String userIdKey = Constants.LOGIN_USERID_KEY + loginUser.getUser().getUserId()+":"+loginType; + String userKey = redisCache.getCacheObject(userIdKey); + if (StringUtils.isNotEmpty(userKey)) + { + redisCache.deleteObject(userIdKey); + redisCache.deleteObject(userKey); + } + } + + recordLoginInfo(loginUser.getUserId()); + + // 生成token + return tokenService.createToken(loginUser); + + } + + /** + * 校验验证码 + * + * @param username 用户名 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public void validateCaptcha(String username, String code, String uuid) { + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, ""); + String captcha = redisCache.getCacheObject(verifyKey); + redisCache.deleteObject(verifyKey); + if (captcha == null) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); + throw new CaptchaExpireException(); + } + if (!code.equalsIgnoreCase(captcha)) { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); + throw new CaptchaException(); + } + } + + /** + * 记录登录信息 + * + * @param userId 用户ID + */ + public void recordLoginInfo(Long userId) { + SysUser sysUser = new SysUser(); + sysUser.setUserId(userId); + sysUser.setLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest())); + sysUser.setLoginDate(DateUtils.getNowDate()); + userService.updateUserLogin(sysUser); + } + + + public static void main(String[] args) { + try { + String s = RsaUtils.decryptByPrivateKey("Ox0ruk7PvJq4Sdc95dyrMPwTz1zH2lGKdA58aEQVMREL1iPlAOADuKNb9rvMGNzB/r2xWyV97JMew8sKklxaRWxozPM+AhKuAnxGMgAvkh7xnLGybMsbMi3/nWtL5rR3O6FXUpN9lFzjRYJ9Uqbc0R03uWR2Ys02x6YX6ilYHdc="); + RsaUtils.RsaKeyPair rsaKeyPair = RsaUtils.generateKeyPair(); + System.out.println(rsaKeyPair.getPublicKey()); + System.out.println("-----------------"); + System.out.println(rsaKeyPair.getPrivateKey()); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public AjaxResult ydLoginByPhone(String phone) { + SysUser user = userService.selectUserByPhone(phone); + if(user!=null){ + if (!soloLogin) + { + // 如果用户不允许多终端同时登录,清除缓存信息 + String userIdKey = Constants.LOGIN_USERID_KEY + user.getUserId()+":"+UserConstants.APP; + String userKey = redisCache.getCacheObject(userIdKey); + if (StringUtils.isNotEmpty(userKey)) + { + redisCache.deleteObject(userIdKey); + redisCache.deleteObject(userKey); + } + } + LoginUser loginUser = new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user), permissionService.getAppMenuPermission(user)); + loginUser.setLoginType(UserConstants.APP); + String token = tokenService.createToken(loginUser); + AjaxResult ajaxResult = new AjaxResult(); + ajaxResult.put("success","true"); + ajaxResult.put("msg",""); + ajaxResult.put("return_str",token); + return ajaxResult; + } + AjaxResult ajaxResult = new AjaxResult(); + ajaxResult.put("success","false"); + ajaxResult.put("msg","用户不存在"); + ajaxResult.put("return_str",""); + return ajaxResult; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java new file mode 100644 index 0000000000000000000000000000000000000000..6ad91b06a727063adb77e3fc3943106744c4a1c2 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java @@ -0,0 +1,94 @@ +package com.ruoyi.framework.web.service; + +import java.util.concurrent.TimeUnit; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.framework.security.context.AuthenticationContextHolder; + +/** + * 登录密码方法 + * + * @author ruoyi + */ +@Component +public class SysPasswordService +{ + @Autowired + private RedisCache redisCache; + + @Value(value = "${user.password.maxRetryCount}") + private int maxRetryCount; + + @Value(value = "${user.password.lockTime}") + private int lockTime; + + /** + * 登录账户密码错误次数缓存键名 + * + * @param username 用户名 + * @return 缓存键key + */ + private String getCacheKey(String username) + { + return CacheConstants.PWD_ERR_CNT_KEY + username; + } + + public void validate(SysUser user) + { + Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext(); + String username = usernamePasswordAuthenticationToken.getName(); + String password = usernamePasswordAuthenticationToken.getCredentials().toString(); + + Integer retryCount = redisCache.getCacheObject(getCacheKey(username)); + + if (retryCount == null) + { + retryCount = 0; + } + + if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, + MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount, lockTime))); + throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime); + } + + if (!matches(user, password)) + { + retryCount = retryCount + 1; + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, + MessageUtils.message("user.password.retry.limit.count", retryCount))); + redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); + throw new UserPasswordNotMatchException(); + } + else + { + clearLoginRecordCache(username); + } + } + + public boolean matches(SysUser user, String rawPassword) + { + return SecurityUtils.matchesPassword(rawPassword, user.getPassword()); + } + + public void clearLoginRecordCache(String loginName) + { + if (redisCache.hasKey(getCacheKey(loginName))) + { + redisCache.deleteObject(getCacheKey(loginName)); + } + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java new file mode 100644 index 0000000000000000000000000000000000000000..9a71f25e30200b3c5c30ab08604c5804a76fff5f --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java @@ -0,0 +1,122 @@ +package com.ruoyi.framework.web.service; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.ruoyi.system.service.ISysAppMenuService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.system.service.ISysMenuService; +import com.ruoyi.system.service.ISysRoleService; + +/** + * 用户权限处理 + * + * @author ruoyi + */ +@Component +public class SysPermissionService +{ + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysMenuService menuService; + + @Autowired + private ISysAppMenuService appMenuService; + + /** + * 获取角色数据权限 + * + * @param user 用户信息 + * @return 角色权限信息 + */ + public Set getRolePermission(SysUser user) + { + Set roles = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin()) + { + roles.add("admin"); + } + else + { + roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId())); + } + return roles; + } + + /** + * 获取菜单数据权限 + * + * @param user 用户信息 + * @return 菜单权限信息 + */ + public Set getMenuPermission(SysUser user) + { + Set perms = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin()) + { + perms.add("*:*:*"); + } + else + { + List roles = user.getRoles(); + if (!roles.isEmpty() && roles.size() > 1) + { + // 多角色设置permissions属性,以便数据权限匹配权限 + for (SysRole role : roles) + { + Set rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId()); + role.setPermissions(rolePerms); + perms.addAll(rolePerms); + } + } + else + { + perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); + } + } + return perms; + } + + /** + * 获取APP菜单数据权限 + * + * @param user 用户信息 + * @return 菜单权限信息 + */ + public Set getAppMenuPermission(SysUser user) + { + Set perms = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin()) + { + perms.add("*:*:*"); + } + else + { + List roles = user.getRoles(); + if (!roles.isEmpty() && roles.size() > 1) + { + // 多角色设置permissions属性,以便数据权限匹配权限 + for (SysRole role : roles) + { + Set rolePerms = appMenuService.selectMenuPermsByRoleId(role.getRoleId()); + role.setPermissions(rolePerms); + perms.addAll(rolePerms); + } + } + else + { + perms.addAll(appMenuService.selectMenuPermsByUserId(user.getUserId())); + } + } + return perms; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysRegisterService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysRegisterService.java new file mode 100644 index 0000000000000000000000000000000000000000..974580ef86342903daad5e4f35144c31b3c79c1c --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysRegisterService.java @@ -0,0 +1,115 @@ +package com.ruoyi.framework.web.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.RegisterBody; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.user.CaptchaException; +import com.ruoyi.common.exception.user.CaptchaExpireException; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.system.service.ISysConfigService; +import com.ruoyi.system.service.ISysUserService; + +/** + * 注册校验方法 + * + * @author ruoyi + */ +@Component +public class SysRegisterService +{ + @Autowired + private ISysUserService userService; + + @Autowired + private ISysConfigService configService; + + @Autowired + private RedisCache redisCache; + + /** + * 注册 + */ + public String register(RegisterBody registerBody) + { + String msg = "", username = registerBody.getUsername(), password = registerBody.getPassword(); + SysUser sysUser = new SysUser(); + sysUser.setUserName(username); + + // 验证码开关 + boolean captchaEnabled = configService.selectCaptchaEnabled(); + if (captchaEnabled) + { + validateCaptcha(username, registerBody.getCode(), registerBody.getUuid()); + } + + if (StringUtils.isEmpty(username)) + { + msg = "用户名不能为空"; + } + else if (StringUtils.isEmpty(password)) + { + msg = "用户密码不能为空"; + } + else if (username.length() < UserConstants.USERNAME_MIN_LENGTH + || username.length() > UserConstants.USERNAME_MAX_LENGTH) + { + msg = "账户长度必须在2到20个字符之间"; + } + else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH + || password.length() > UserConstants.PASSWORD_MAX_LENGTH) + { + msg = "密码长度必须在5到20个字符之间"; + } + else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(sysUser))) + { + msg = "保存用户'" + username + "'失败,注册账号已存在"; + } + else + { + sysUser.setNickName(username); + sysUser.setPassword(SecurityUtils.encryptPassword(password)); + boolean regFlag = userService.registerUser(sysUser); + if (!regFlag) + { + msg = "注册失败,请联系系统管理人员"; + } + else + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, MessageUtils.message("user.register.success"))); + } + } + return msg; + } + + /** + * 校验验证码 + * + * @param username 用户名 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public void validateCaptcha(String username, String code, String uuid) + { + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, ""); + String captcha = redisCache.getCacheObject(verifyKey); + redisCache.deleteObject(verifyKey); + if (captcha == null) + { + throw new CaptchaExpireException(); + } + if (!code.equalsIgnoreCase(captcha)) + { + throw new CaptchaException(); + } + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysSmsService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysSmsService.java new file mode 100644 index 0000000000000000000000000000000000000000..159360973dffe4b90742a89294d1db4f82f85f14 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysSmsService.java @@ -0,0 +1,119 @@ +package com.ruoyi.framework.web.service; + +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.user.*; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.framework.security.context.AuthenticationContextHolder; +import com.ruoyi.framework.security.sms.SmsCodeAuthenticationToken; +import com.ruoyi.system.service.ISysUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +/** + * 登录密码方法 + * + * @author ruoyi + */ +@Component +public class SysSmsService +{ + @Autowired + private RedisCache redisCache; + + @Autowired + private ISysUserService userService; + + @Value(value = "${user.sms.maxRetryCount}") + private int maxRetryCount; + + @Value(value = "${user.sms.lockTime}") + private int lockTime; + + /** + * 登录账户短信错误次数缓存键名 + * + * @param phone 手机号码 + * @return 缓存键key + */ + private String getCacheKey(String phone) + { + return CacheConstants.SMS_ERR_CNT_KEY + phone; + } + + public void validate(Long userId) + { + + Authentication smsCodeAuthenticationToken = AuthenticationContextHolder.getContext(); + + String phone = smsCodeAuthenticationToken.getName(); + String code = smsCodeAuthenticationToken.getCredentials().toString(); + + String smsCode = (String) redisCache.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + phone); + + //短信验证码是否过期 + if (StringUtils.isEmpty(smsCode)) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(phone, Constants.LOGIN_FAIL, MessageUtils.message("user.sms.expire"))); + throw new CaptchaExpireException(); + } + + Integer retryCount = redisCache.getCacheObject(getCacheKey(phone)); + + if (retryCount == null) + { + retryCount = 0; + } + + if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(phone, Constants.LOGIN_FAIL, + MessageUtils.message("user.sms.retry.limit.exceed", maxRetryCount, lockTime))); + + //设置锁定状态 + SysUser user=new SysUser(); + user.setUserId(userId); + user.setStatus(UserStatus.DISABLE.getCode()); + userService.updateUserStatus(user); + + throw new UserSmsRetryLimitExceedException(maxRetryCount, lockTime); + } + + if (!smsCode.equalsIgnoreCase(code)) + { + retryCount = retryCount + 1; + + Integer surplusCount = Integer.valueOf(maxRetryCount).intValue() - retryCount; + + AsyncManager.me().execute(AsyncFactory.recordLogininfor(phone, Constants.LOGIN_FAIL, + MessageUtils.message("user.sms.retry.limit.count", retryCount))); + + redisCache.setCacheObject(getCacheKey(phone), retryCount, lockTime, TimeUnit.MINUTES); + + throw new UserSmsNotMatchException(surplusCount); + } + else + { + clearLoginRecordCache(phone); + } + } + + public void clearLoginRecordCache(String loginName) + { + if (redisCache.hasKey(getCacheKey(loginName))) + { + redisCache.deleteObject(getCacheKey(loginName)); + } + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java new file mode 100644 index 0000000000000000000000000000000000000000..37d825b88d71e9ab63aa52e53ade0ce369326d66 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java @@ -0,0 +1,289 @@ +package com.ruoyi.framework.web.service; + +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.AddressUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.common.utils.uuid.IdUtils; +import com.ruoyi.system.service.ISysConfigService; +import eu.bitwalker.useragentutils.UserAgent; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * token验证处理 + * + * @author ruoyi + */ +@Component +public class TokenService +{ + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + // 令牌秘钥 + @Value("${token.secret}") + private String secret; + + // 令牌有效期(默认30分钟) + @Value("${token.expireTime}") + private int expireTime; + + // 是否允许同类型端同时登录(true允许 false不允许) + @Value("${token.soloLogin}") + private boolean soloLogin; + + protected static final long MILLIS_SECOND = 1000; + + protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; + + private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; + + @Autowired + private RedisCache redisCache; + + @Autowired + private ISysConfigService configService; + + /** + * 获取用户身份信息 + * + * @return 用户信息 + */ + public LoginUser getLoginUser(HttpServletRequest request) + { + // 获取请求携带的令牌 + String token = getToken(request); + if (StringUtils.isNotEmpty(token)) + { + try + { + Claims claims = parseToken(token); + // 解析对应的权限以及用户信息 + String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); + String userKey = getTokenKey(uuid); + LoginUser user = redisCache.getCacheObject(userKey); + return user; + } + catch (Exception e) + { + } + } + return null; + } + + /** + * 设置用户身份信息 + */ + public void setLoginUser(LoginUser loginUser) + { + if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) + { + refreshToken(loginUser); + } + } + + /** + * 删除用户身份信息 + */ + public void delLoginUser(String token,Long userId,String loginType) + { + if (StringUtils.isNotEmpty(token)) + { + String userKey = getTokenKey(token); + redisCache.deleteObject(userKey); + } + if (!soloLogin && StringUtils.isNotNull(userId)) + { + String userIdKey = getUserIdKey(userId,loginType); + redisCache.deleteObject(userIdKey); + } + } + + /** + * 创建令牌 + * + * @param loginUser 用户信息 + * @return 令牌 + */ + public String createToken(LoginUser loginUser) + { + String token = IdUtils.fastUUID(); + loginUser.setToken(token); + setUserAgent(loginUser); + refreshToken(loginUser); + + Map claims = new HashMap<>(); + claims.put(Constants.LOGIN_USER_KEY, token); + return createToken(claims); + } + + /** + * 验证令牌有效期,相差不足20分钟,自动刷新缓存 + * + * @param loginUser + * @return 令牌 + */ + public void verifyToken(LoginUser loginUser) + { + long expireTime = loginUser.getExpireTime(); + long currentTime = System.currentTimeMillis(); + if (expireTime - currentTime <= MILLIS_MINUTE_TEN) + { + refreshToken(loginUser); + } + } + + /** + * 刷新令牌有效期 + * + * @param loginUser 登录信息 + */ + public void refreshToken(LoginUser loginUser) + { + + + + loginUser.setLoginTime(System.currentTimeMillis()); + loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE); + // 根据uuid将loginUser缓存 + String userKey = getTokenKey(loginUser.getToken()); + + //大屏用户缓存不过期 + if("bigscreen".equals(loginUser.getUser().getUserName())) + { + redisCache.setCacheObject(userKey, loginUser); + return; + } + + redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); + + if (!soloLogin) + { + // 缓存用户唯一标识,防止同一帐号,同时登录 + String userIdKey = getUserIdKey(loginUser.getUser().getUserId(),loginUser.getLoginType()); + redisCache.setCacheObject(userIdKey, userKey, expireTime, TimeUnit.MINUTES); + } + } + + /** + * 设置用户代理信息 + * + * @param loginUser 登录信息 + */ + public void setUserAgent(LoginUser loginUser) + { + UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + loginUser.setIpaddr(ip); + loginUser.setLoginLocation(AddressUtils.getRealAddressByIP(ip)); + loginUser.setBrowser(userAgent.getBrowser().getName()); + loginUser.setOs(userAgent.getOperatingSystem().getName()); + } + + private String getUserIdKey(Long userId,String loginType) + { + return Constants.LOGIN_USERID_KEY + userId+":"+loginType; + } + + /** + * 从数据声明生成令牌 + * + * @param claims 数据声明 + * @return 令牌 + */ + private String createToken(Map claims) + { + String token = Jwts.builder() + .setClaims(claims) + .signWith(SignatureAlgorithm.HS512, secret).compact(); + return token; + } + + /** + * 从令牌中获取数据声明 + * + * @param token 令牌 + * @return 数据声明 + */ + private Claims parseToken(String token) + { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody(); + } + + /** + * 从令牌中获取用户名 + * + * @param token 令牌 + * @return 用户名 + */ + public String getUsernameFromToken(String token) + { + Claims claims = parseToken(token); + return claims.getSubject(); + } + + /** + * 获取请求token + * + * @param request + * @return token + */ + private String getToken(HttpServletRequest request) + { + String token = request.getHeader(header); + if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) + { + token = token.replace(Constants.TOKEN_PREFIX, ""); + } + return token; + } + + private String getTokenKey(String uuid) + { + return CacheConstants.LOGIN_TOKEN_KEY + uuid; + } + + public Boolean isLogin(String token) throws Exception { + try + { + Claims claims = parseToken(token); + // 解析对应的权限以及用户信息 + String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); + String userKey = getTokenKey(uuid); + LoginUser user = redisCache.getCacheObject(userKey); + if(ObjectUtils.isEmpty(user)) + { + return false; + } + + } + catch (Exception e) + { + throw new Exception(e.getMessage()); + } + + return true; + } + + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsByTelephoneServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsByTelephoneServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..322a08deea44e04b5f04b47231d354bf8e13d30c --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsByTelephoneServiceImpl.java @@ -0,0 +1,101 @@ +package com.ruoyi.framework.web.service; + +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.exception.base.BaseException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.core.TimeoutUtils; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * 用户验证处理 + * + * @author gmk + */ +@Service("userDetailsByTelephoneServiceImpl") +public class UserDetailsByTelephoneServiceImpl implements UserDetailsService { + private static final Logger log = LoggerFactory.getLogger(UserDetailsByTelephoneServiceImpl.class); + + @Autowired + private ISysUserService userService; + + @Autowired + private SysPermissionService permissionService; + + @Autowired + private SysSmsService sysSmsService; + + @Autowired + private RedisCache redisCache; + + @Override + public UserDetails loadUserByUsername(String phone) throws UsernameNotFoundException { + + SysUser user= userService.selectUserByPhone(phone); + if (StringUtils.isNull(user)) + { + log.info("登录用户的手机号码:{} 不存在.", phone); + throw new ServiceException("登录用户手机号码:" + phone + " 不存在"); + } + else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) + { + log.info("登录用户:{} 已被删除.", user.getUserName()); + throw new ServiceException("登录用户手机号码:" + phone + " 不存在"); + } + else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) + { + String smsCodeKey = CacheConstants.SMS_ERR_CNT_KEY + phone; + Long expire = 1L ; + if(redisCache.hasKey(smsCodeKey)) { + //获取到的是秒 + expire = redisCache.getExpire(smsCodeKey) / 60; + if(expire<1) + { + expire = 1L; + } + log.info("登录用户:{} 已被锁定.",user.getUserName()); + throw new ServiceException("手机号码:" + phone + " 已锁定,还剩下" + expire + "分钟"); + } + else + { + //锁定用户假定已经恢复,需要设置为正常 + user.setStatus(UserStatus.OK.getCode()); + userService.updateUserStatus(user); + } + } + else if (UserStatus.SLEEP.getCode().equals(user.getStatus())) + { + log.info("登录用户:{} 已被冻结.",user.getUserName()); + throw new ServiceException("登录用户手机号码:" + phone + " 已冻结"); + } + + sysSmsService.validate(user.getUserId()); + + return createLoginUser(user); + } + + public UserDetails createLoginUser(SysUser user) { + return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user),permissionService.getAppMenuPermission(user)); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..ec392439a2289397036d7d743d28fd688e684438 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java @@ -0,0 +1,65 @@ +package com.ruoyi.framework.web.service; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysUserService; + +/** + * 用户验证处理 + * + * @author ruoyi + */ +@Service +public class UserDetailsServiceImpl implements UserDetailsService +{ + private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class); + + @Autowired + private ISysUserService userService; + + @Autowired + private SysPasswordService passwordService; + + @Autowired + private SysPermissionService permissionService; + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException + { + SysUser user = userService.selectUserByUserName(username); + + if (StringUtils.isNull(user)) { + log.info("登录用户:{} 不存在.", username); + throw new ServiceException("登录用户:" + username + " 不存在"); + } + + //20230324 管理员不用判断 + if(!user.isAdmin()) { + if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) { + log.info("登录用户:{} 已被删除.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); + } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { + log.info("登录用户:{} 已被锁定.", username); + throw new ServiceException("对不起,您的账号:" + username + " 已锁定"); + } + passwordService.validate(user); + } + + return createLoginUser(user); + } + + public UserDetails createLoginUser(SysUser user) + { + return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user),permissionService.getAppMenuPermission(user)); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/sms/MessageService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/sms/MessageService.java new file mode 100644 index 0000000000000000000000000000000000000000..ccf1d23d80cd901a659674cb7d651307b7b72dbe --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/sms/MessageService.java @@ -0,0 +1,54 @@ +package com.ruoyi.framework.web.service.sms; + +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.framework.web.domain.dto.MobileOfficesDTO; + +/** + * @author yqf + * @date 2022/8/4 + */ +public interface MessageService { + +// /** +// * 开发期间,全部返回成功。 +// * @param content +// * :发送内容 +// * @param mobile +// * :手机号 +// * 返回信息:返回信息:0-发送成功 1-业务号不能为空 2-内容不能为空 3-内容长度超出512个字符 4-手机号不能为空 5-业务号不存在 6-号码有误 7-信息机不可用 +// */ +// public SmsRsponseVo sendSM(String content, String mobile); + +// /** +// * 发送短信验证码 +// * @param mobile +// * @param code +// * @return +// */ +// public SmsRsponseVo senSMSCode(String mobile,String code); + + /** + * 发送移动办公群 + */ + public JSONObject sendMobileOffice(MobileOfficesDTO dto); + + /** + * 发送短信 + */ + public JSONObject sendSMS(String content, String mobile); + + /** + * 发送IVR + */ + public JSONObject sendIvr(String content, String mobile); + + public SmsRsponseVo senSMSCodeByUser(Long userId,String phone,String code); + + /** + * 获取系统运行环境 + * dev 测试环境 + * prod 生产环境 + * @return + */ + public String getActive(); +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/sms/MessageServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/sms/MessageServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..aa3198868379243eab991eb2de66e0d2fce110eb --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/sms/MessageServiceImpl.java @@ -0,0 +1,361 @@ +package com.ruoyi.framework.web.service.sms; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.asymmetric.AsymmetricAlgorithm; +import cn.hutool.crypto.asymmetric.KeyType; +import cn.hutool.crypto.asymmetric.RSA; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.framework.web.domain.SysNoticeEntity; +import com.ruoyi.framework.web.domain.dto.MobileOfficesDTO; +import com.ruoyi.framework.web.mapper.SysLoginMapper; +import com.ruoyi.system.service.ISysConfigService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.HashMap; + +/** + * @author yqf + * @date 2022/8/4 + */ +@Slf4j +@Service +public class MessageServiceImpl implements MessageService { + // @Value("${system.sms.imbms.url}") + private String SMS_URL; + // @Value("${system.sms.imbms.code}") + private String CODE; + // @Value("${system.sms.imbms.username}") + private String UUSER_NAME; + + @Value("${spring.profiles.active}") + private String ACTIVE; + + @Value("${system.msg.url}") + private String url; + + @Value("${system.msg.sms_comm}") + private String sms_comm; + + @Value("${system.msg.ivr_comm}") + private String ivr_comm; + + @Value("${system.msg.mobileoffice_comm}") + private String mobileoffice_comm; + + @Value("${system.msg.applicationid}") + private String applicationid; + + @Value("${system.msg.platform_code}") + private String platform_code; + + @Value("${system.msg.publickey}") + private String publickey; + + @Autowired + private ISysConfigService sysConfigService; + + @Autowired + private SysLoginMapper sysLoginMapper; + // @Override + public SmsRsponseVo sendSM(String content, String mobile) { + // 向WebService发送的参数格式(xml) +// String strParameter = "\n" + +// "\n" + +// " \n" + +// " \n" + +// " \n" + +// " " + CODE + "\n" + +// " " + content + "\n" + +// " " + mobile + "\n" + +// " " + UUSER_NAME + "\n" + +// " \n" + +// " \n" + +// ""; +// log.info("开始发送短信",strParameter); + // 向HttpClient发送请求 +// String returnDatabase = HttpUtils.sendPost(SMS_URL, strParameter); +// JSONObject jsonObject = null; +// try { +// // 将请求结果转换成json类型 +// jsonObject = WebServiceUnit.xml2Json(returnDatabase); +// } catch (Exception e) { +// log.error("短信发送失败!",e); +// e.printStackTrace(); +// } +// log.info("短信发送结果",returnDatabase); + + SmsRsponseVo smsRsponseVo = new SmsRsponseVo(); + smsRsponseVo.setCode(0); + return smsRsponseVo; + } + + /** + * 发送移动办公群 + * + * @param dto 发送内容 + * @return code 返回代码 0/1 1成功 0失败 + * message 返回信息 成功/失败/别的提示 + * mobileoffice_id 返回id 查询发送结果的id + */ + @Override + public JSONObject sendMobileOffice(MobileOfficesDTO dto) { + + HashMap map = new HashMap<>(); + map.put("comm", mobileoffice_comm); + map.put("applicationid", applicationid); + String tokenId = createTokenId(); + map.put("tokenid", tokenId); + map.put("mobileoffices", dto.getMobileoffices()); + map.put("mobileoffice_user", dto.getMobileoffice_user()); + map.put("file", dto.getFile()); + map.put("filename", dto.getFilename()); + map.put("img", dto.getImg()); + map.put("imgname", dto.getImgname()); + map.put("content", dto.getContent()); + // 向HttpClient发送请求 + String url = sysConfigService.selectConfigByKey("sys.sms.url"); + log.info("移动办公群发送url=" + url); + url = StrUtil.isNotBlank(url) ? url : this.url; + String res = ""; + try { + res = HttpUtil.post(url, map, 5000); + } catch (Exception e) { + e.printStackTrace(); + } + JSONObject jsonObject = JSONObject.parseObject(res); + if(jsonObject!=null) { + if ("1".equals(jsonObject.getString("code"))) { + log.info("移动办公群发送成功!"); + } else { + log.error("移动办公群发送失败:" + jsonObject.getString("message")); + } + } + return jsonObject; + } + + /** + * 发送短信(适合发送内容相同的多人发送) + * + * @param content 发送内容 + * @param mobile 发送手机号码 13805711234,13805715678,13805710000 逗号隔开 + * @return code 返回代码 0/1 1成功 0失败 + * message 返回信息 成功/失败/别的提示 + * sms_id 返回id 查询发送结果的id + */ + @Override + public JSONObject sendSMS(String content, String mobile) { + + HashMap map = new HashMap<>(); + map.put("comm", sms_comm); + map.put("applicationid", applicationid); + String tokenId = createTokenId(); + map.put("tokenid", tokenId); + map.put("mobiles", mobile); + map.put("content", content); + + // 向HttpClient发送请求 + String url = sysConfigService.selectConfigByKey("sys.sms.url"); + log.info("短信发送url=" + url); + url = StrUtil.isNotBlank(url) ? url : this.url; + String res = ""; + try { + res = HttpUtil.post(url, map, 5000); + } catch (Exception e) { + log.error("调用三方失败"); + e.printStackTrace(); + } + if(StrUtil.isBlank(res)){ + log.error("调用三方失败"); + } + JSONObject jsonObject = JSONObject.parseObject(res); + if(jsonObject!=null) { + if ("1".equals(jsonObject.getString("code"))) { + log.info("短信发送成功!"); + } else { + jsonObject.put("code",0); + jsonObject.put("message","调用三方失败"); + log.error("短信发送失败:调用三方失败"); + } + } + return jsonObject; + } + + /** + * 发送IVR(适合发送内容相同的多人发送) + * + * @param content 发送内容 + * @param mobile 发送手机号码 13805711234,13805715678,13805710000 逗号隔开 + * @return code 返回代码 0/1 1成功 0失败 + * message 返回信息 成功/失败/别的提示 + * sms_id 返回id 查询发送结果的id + */ + @Override + public JSONObject sendIvr(String content, String mobile) { + + HashMap map = new HashMap<>(); + map.put("comm", ivr_comm); + map.put("applicationid", applicationid); + String tokenId = createTokenId(); + map.put("tokenid", tokenId); + //手机号码 13805711234,13805715678,13805710000 逗号隔开 + map.put("mobiles", mobile); + map.put("content", content); + //拨打方式 不必填 0:一次性全拨打 1:一个接个拨打,成功一个结束 + map.put("call_type", "0"); + //最大拨号次数 必填 + map.put("call_times", "1"); + //重拨间隔时间 必填 颗粒度:分钟 + map.put("call_interval_time", "1"); + + // 向HttpClient发送请求 + String url = sysConfigService.selectConfigByKey("sys.sms.url"); + log.info("IVR发送url=" + url); + url = StrUtil.isNotBlank(url) ? url : this.url; + String res = ""; + try { + log.info("传递参数:"+map); + res = HttpUtil.post(url, map, 5000); + } catch (Exception e) { + e.printStackTrace(); + } + JSONObject jsonObject = JSONObject.parseObject(res); + if(jsonObject!=null) { + if ("1".equals(jsonObject.getString("code"))) { + log.info("IVR发送成功!"); + } else { + log.error("IVR发送失败:" + jsonObject.getString("message")); + } + } + return jsonObject; + } + + /** + * 获取短信发送结果( 查询IVR、短信、微信、移动办公、MOA发送结果) + * + * @param type 查询类型:ivr、sms、wechat、mobileoffice、mobileoffice_zmcc、moa + * @param id 查询id ivr_id\sms_id\wechat_id\mobileoffice_id\moa_id + * @return + */ + public JSONObject getResult(String type, String id) { + HashMap map = new HashMap<>(); + map.put("comm", "get_result"); + map.put("applicationid", applicationid); + String tokenId = createTokenId(); + map.put("tokenid", tokenId); + map.put("type", type); + map.put("id", id); + + // 向HttpClient发送请求 + String res = HttpUtil.post(SMS_URL, map, 5000); + JSONObject jsonObject = JSONObject.parseObject(res); + if ("1".equals(jsonObject.getString("code"))) { + log.info("获取发送结果成功!"); + } else { + log.error("获取发送结果失败:" + jsonObject.getString("message")); + } + return jsonObject; + } + + +// @Override +// public SmsRsponseVo senSMSCode(String mobile, String code) { +// String content = "您的验证码为" + code + ",请勿向他人泄露。"; +// return sendSM(content, mobile); +// } + + //生成tokenid + public String createTokenId() { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("platform_code", platform_code); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String currenTime = dateFormat.format(new Date()); + jsonObject.put("time", currenTime); + RSA rsa = new RSA(AsymmetricAlgorithm.RSA_ECB_PKCS1.getValue(), null, publickey); + return rsa.encryptBase64(jsonObject.toJSONString(), KeyType.PublicKey); + } + + //生成tokenid + public static void main(String[] args) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("platform_code", "东信亚运重保"); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String currenTime = dateFormat.format(new Date()); + jsonObject.put("time", currenTime); + String s = jsonObject.toJSONString(); + System.out.println(s); + String pubilcKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDhBtwcgGVE1ILMDoxU4Og77PugS2JlHDnfkmHO3Ek0s+L4ukWDbh6XvRNxUIBM9GvhvrdT7JGE7/Xq6oIYRk6QqfvYp/aHzw1DkhoEz7Bx9O0fdQKWMCHd4kl6hmyLeurmr11/h6nwtu1U/R2BqJ/blRCebUuYvMaCxVO1rr8irQIDAQAB"; + RSA rsa = new RSA(AsymmetricAlgorithm.RSA_ECB_PKCS1.getValue(), null, pubilcKey); + String s1 = rsa.encryptBase64(s, KeyType.PublicKey); + System.out.println(s1); + System.out.println(s1.length()); + } + + @Override + public SmsRsponseVo senSMSCodeByUser(Long userId, String phone, String code) { +// String content = "尊敬的用户,您本次登录的验证码是[" + code + "],请在5分钟内使用!"; +// SysNotice notice = new SysNotice(); +// notice.setNoticeType("3"); +// notice.setNoticeTitle("亚运保障平台登录验证码"); +// notice.setStatus("0"); +// notice.setCreateBy("sys"); +// notice.setNoticeContent(content); +// notice.setReciveUser(userId); +// notice.setReciveUserPhone(phone); +// //计划发送时间 当前时间立即发送 +// notice.setExpSendTime(LocalDateTime.now()); +// //加入定时任务标记 初始0 +// notice.setAddFlag("0"); +// //定时任务实际发送时修改 +//// notice.setSendTime(DateUtils.getNowDate()); +// try { +// sysNoticeService.saveOrUpdate(notice); +// } catch (Exception e) { +// log.error("短信发送失败!", e); +// e.printStackTrace(); +// } +// +// SmsRsponseVo smsRsponseVo = new SmsRsponseVo(); +// smsRsponseVo.setCode(0); +// return smsRsponseVo; + + + String content = "尊敬的用户,您本次登录的验证码是[" + code + "],请在5分钟内使用!"; + SysNoticeEntity notice = new SysNoticeEntity(); + notice.setNoticeType("3"); + notice.setNoticeTitle("亚运保障平台登录验证码"); + notice.setStatus("0"); + notice.setCreateBy("sys"); + notice.setCreateTime(LocalDateTime.now()); + notice.setNoticeContent(content); + notice.setReciveUser(userId); + notice.setReciveUserPhone(phone); + //计划发送时间 当前时间立即发送 + notice.setExpSendTime(LocalDateTime.now()); + //加入定时任务标记 初始0 + notice.setAddFlag("0"); + //定时任务实际发送时修改 +// notice.setSendTime(DateUtils.getNowDate()); + try { + sysLoginMapper.insertNotice(notice); + } catch (Exception e) { + log.error("短信发送失败!", e); + e.printStackTrace(); + } + + SmsRsponseVo smsRsponseVo = new SmsRsponseVo(); + smsRsponseVo.setCode(0); + return smsRsponseVo; + } + + @Override + public String getActive() { + return ACTIVE; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/sms/SmsRsponseVo.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/sms/SmsRsponseVo.java new file mode 100644 index 0000000000000000000000000000000000000000..2c10a5d35215d1db31ca59475162425bed9b2696 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/sms/SmsRsponseVo.java @@ -0,0 +1,16 @@ +package com.ruoyi.framework.web.service.sms; + +import lombok.Data; + +@Data +public class SmsRsponseVo { + /** + * 发送短信响应状态码 + * 返回信息:0-发送成功 1-业务号不能为空 2-内容不能为空 3-内容长度超出512个字符 4-手机号不能为空 5-业务号不存在 6-号码有误 7-信息机不可用 + */ + private Integer code; + /** + * 发送短信返回信息 + */ + private String msg; +} diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ac2e9649cca41b99f7ffb7129cc519215a3e0999 --- /dev/null +++ b/ruoyi-generator/pom.xml @@ -0,0 +1,69 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + 4.0.0 + + ruoyi-generator + + + generator代码生成 + + + + + + + + + + + + org.postgresql + postgresql + + + + + org.apache.velocity + velocity-engine-core + + + + + commons-collections + commons-collections + + + + + com.ruoyi + ruoyi-common + + + + com.baomidou + mybatis-plus-boot-starter + + + + com.baomidou + mybatis-plus-generator + 3.5.3.1 + + + + org.freemarker + freemarker + 2.3.28 + compile + + + + + \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/MyBatisPlusGenerator.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/MyBatisPlusGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..66292fd18dc431dbaada5f6208f761b84de37614 --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/MyBatisPlusGenerator.java @@ -0,0 +1,75 @@ +package com.ruoyi.generator; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.generator.FastAutoGenerator; +import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.baomidou.mybatisplus.generator.config.OutputFile; +import com.baomidou.mybatisplus.generator.config.converts.PostgreSqlTypeConvert; +import com.baomidou.mybatisplus.generator.config.querys.PostgreSqlQuery; +import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; +import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; +import com.baomidou.mybatisplus.generator.fill.Column; +import com.baomidou.mybatisplus.generator.fill.Property; +import com.baomidou.mybatisplus.generator.keywords.PostgreSqlKeyWordsHandler; + +import java.sql.Types; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +public class MyBatisPlusGenerator { + + private static final DataSourceConfig.Builder DATA_SOURCE_CONFIG = new DataSourceConfig + .Builder("jdbc:postgresql://192.168.97.156:5432/hz_zxp?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true", "postgres", "eastcom") + .dbQuery(new PostgreSqlQuery()) //数据库查询 + .schema("public") //数据库schema(部分数据库适用) + .typeConvert(new PostgreSqlTypeConvert()) //数据库类型转换器 + .keyWordsHandler(new PostgreSqlKeyWordsHandler()); + + public static void main(String[] args) { + + FastAutoGenerator.create(DATA_SOURCE_CONFIG) + .globalConfig(builder -> { + builder.author("yqf") // 设置作者 + .enableSwagger() // 开启 swagger 模式 + .fileOverride() // 覆盖已生成文件 + .outputDir("D://code_gen"); // 指定输出目录 + }) + .packageConfig(builder -> { + builder.parent("com.ruoyi.web") // 设置父包名 + .moduleName("eastcom_yw") // 设置父包模块名 + .pathInfo(Collections.singletonMap(OutputFile.xml, "D://code_gen")); // 设置mapperXml生成路径 + }) + .strategyConfig(builder -> { + builder.addInclude("yw_spare_parts") // 设置需要生成的表名 + .addTablePrefix()// 设置过滤表前缀 + .serviceBuilder() + .formatServiceFileName("%sService") + .entityBuilder() + .enableLombok() + .enableTableFieldAnnotation(); +// .addSuperEntityColumns("id", "status_", "seq_no", "create_date", "create_user_id", "modify_date", "modify_user_id") +// .addTableFills(new Column("create_date", FieldFill.INSERT)) +// .addTableFills(new Column("create_user_id", FieldFill.INSERT)) +// .addTableFills(new Property("modify_date", FieldFill.UPDATE)) +// .addTableFills(new Property("modify_user_id", FieldFill.UPDATE)); + + + }) + .templateEngine(new FreemarkerTemplateEngine())// 使用Freemarker引擎模板,默认的是Velocity引擎模板 +// .templateConfig(builder -> { +// builder.("/templates/dto.java"); +// builder.entity("/templates/qo.java"); +// }) + .injectionConfig(consumer -> { + Map customFile = new HashMap<>(); + // DTO + customFile.put("DTO.java", "/templates/dto.java.ftl"); + customFile.put("QO.java", "/templates/qo.java.ftl"); + customFile.put("VO.java", "/templates/vo.java.ftl"); + customFile.put("Convert.java", "/templates/convert.java.ftl"); + consumer.customFile(customFile); + }) + .execute(); + } +} \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..cc4cd14c83a69a064debb30731de462d51d11972 --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java @@ -0,0 +1,73 @@ +package com.ruoyi.generator.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; + +/** + * 读取代码生成相关配置 + * + * @author ruoyi + */ +@Component +@ConfigurationProperties(prefix = "gen") +@PropertySource(value = { "classpath:generator.yml" }) +public class GenConfig +{ + /** 作者 */ + public static String author; + + /** 生成包路径 */ + public static String packageName; + + /** 自动去除表前缀,默认是false */ + public static boolean autoRemovePre; + + /** 表前缀(类名不会包含表前缀) */ + public static String tablePrefix; + + public static String getAuthor() + { + return author; + } + + @Value("${author}") + public void setAuthor(String author) + { + GenConfig.author = author; + } + + public static String getPackageName() + { + return packageName; + } + + @Value("${packageName}") + public void setPackageName(String packageName) + { + GenConfig.packageName = packageName; + } + + public static boolean getAutoRemovePre() + { + return autoRemovePre; + } + + @Value("${autoRemovePre}") + public void setAutoRemovePre(boolean autoRemovePre) + { + GenConfig.autoRemovePre = autoRemovePre; + } + + public static String getTablePrefix() + { + return tablePrefix; + } + + @Value("${tablePrefix}") + public void setTablePrefix(String tablePrefix) + { + GenConfig.tablePrefix = tablePrefix; + } +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java new file mode 100644 index 0000000000000000000000000000000000000000..2aed686a6f709a92d63653a3e49fc673d36795ad --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -0,0 +1,214 @@ +package com.ruoyi.generator.controller; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import org.apache.commons.io.IOUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.generator.domain.GenTable; +import com.ruoyi.generator.domain.GenTableColumn; +import com.ruoyi.generator.service.IGenTableColumnService; +import com.ruoyi.generator.service.IGenTableService; + +/** + * 代码生成 操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/tool/gen") +public class GenController extends BaseController +{ + @Autowired + private IGenTableService genTableService; + + @Autowired + private IGenTableColumnService genTableColumnService; + + /** + * 查询代码生成列表 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @GetMapping("/list") + public TableDataInfo genList(GenTable genTable) + { + startPage(); + List list = genTableService.selectGenTableList(genTable); + return getDataTable(list); + } + + /** + * 修改代码生成业务 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:query')") + @GetMapping(value = "/{tableId}") + public AjaxResult getInfo(@PathVariable Long tableId) + { + GenTable table = genTableService.selectGenTableById(tableId); + List tables = genTableService.selectGenTableAll(); + List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); + Map map = new HashMap(); + map.put("info", table); + map.put("rows", list); + map.put("tables", tables); + return success(map); + } + + /** + * 查询数据库列表 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @GetMapping("/db/list") + public TableDataInfo dataList(GenTable genTable) + { + startPage(); + List list = genTableService.selectDbTableList(genTable); + return getDataTable(list); + } + + /** + * 查询数据表字段列表 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @GetMapping(value = "/column/{tableId}") + public TableDataInfo columnList(Long tableId) + { + TableDataInfo dataInfo = new TableDataInfo(); + List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); + dataInfo.setRows(list); + dataInfo.setTotal(list.size()); + return dataInfo; + } + + /** + * 导入表结构(保存) + */ + @PreAuthorize("@ss.hasPermi('tool:gen:import')") + @Log(title = "代码生成", businessType = BusinessType.IMPORT) + @PostMapping("/importTable") + public AjaxResult importTableSave(String tables) + { + String[] tableNames = Convert.toStrArray(tables); + // 查询表信息 + List tableList = genTableService.selectDbTableListByNames(tableNames); + genTableService.importGenTable(tableList); + return success(); + } + + /** + * 修改保存代码生成业务 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:edit')") + @Log(title = "代码生成", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult editSave(@Validated @RequestBody GenTable genTable) + { + genTableService.validateEdit(genTable); + genTableService.updateGenTable(genTable); + return success(); + } + + /** + * 删除代码生成 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:remove')") + @Log(title = "代码生成", businessType = BusinessType.DELETE) + @DeleteMapping("/{tableIds}") + public AjaxResult remove(@PathVariable Long[] tableIds) + { + genTableService.deleteGenTableByIds(tableIds); + return success(); + } + + /** + * 预览代码 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:preview')") + @GetMapping("/preview/{tableId}") + public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException + { + Map dataMap = genTableService.previewCode(tableId); + return success(dataMap); + } + + /** + * 生成代码(下载方式) + */ + @PreAuthorize("@ss.hasPermi('tool:gen:code')") + @Log(title = "代码生成", businessType = BusinessType.GENCODE) + @GetMapping("/download/{tableName}") + public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException + { + byte[] data = genTableService.downloadCode(tableName); + genCode(response, data); + } + + /** + * 生成代码(自定义路径) + */ + @PreAuthorize("@ss.hasPermi('tool:gen:code')") + @Log(title = "代码生成", businessType = BusinessType.GENCODE) + @GetMapping("/genCode/{tableName}") + public AjaxResult genCode(@PathVariable("tableName") String tableName) + { + genTableService.generatorCode(tableName); + return success(); + } + + /** + * 同步数据库 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:edit')") + @Log(title = "代码生成", businessType = BusinessType.UPDATE) + @GetMapping("/synchDb/{tableName}") + public AjaxResult synchDb(@PathVariable("tableName") String tableName) + { + genTableService.synchDb(tableName); + return success(); + } + + /** + * 批量生成代码 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:code')") + @Log(title = "代码生成", businessType = BusinessType.GENCODE) + @GetMapping("/batchGenCode") + public void batchGenCode(HttpServletResponse response, String tables) throws IOException + { + String[] tableNames = Convert.toStrArray(tables); + byte[] data = genTableService.downloadCode(tableNames); + genCode(response, data); + } + + /** + * 生成zip文件 + */ + private void genCode(HttpServletResponse response, byte[] data) throws IOException + { + response.reset(); + response.addHeader("Access-Control-Allow-Origin", "*"); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\""); + response.addHeader("Content-Length", "" + data.length); + response.setContentType("application/octet-stream; charset=UTF-8"); + IOUtils.write(data, response.getOutputStream()); + } +} \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java new file mode 100644 index 0000000000000000000000000000000000000000..269779cf252789b9edde68ed20ef3fcc3a0478ec --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java @@ -0,0 +1,372 @@ +package com.ruoyi.generator.domain; + +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import org.apache.commons.lang3.ArrayUtils; +import com.ruoyi.common.constant.GenConstants; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.utils.StringUtils; + +/** + * 业务表 gen_table + * + * @author ruoyi + */ +public class GenTable extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 编号 */ + private Long tableId; + + /** 表名称 */ + @NotBlank(message = "表名称不能为空") + private String tableName; + + /** 表描述 */ + @NotBlank(message = "表描述不能为空") + private String tableComment; + + /** 关联父表的表名 */ + private String subTableName; + + /** 本表关联父表的外键名 */ + private String subTableFkName; + + /** 实体类名称(首字母大写) */ + @NotBlank(message = "实体类名称不能为空") + private String className; + + /** 使用的模板(crud单表操作 tree树表操作 sub主子表操作) */ + private String tplCategory; + + /** 生成包路径 */ + @NotBlank(message = "生成包路径不能为空") + private String packageName; + + /** 生成模块名 */ + @NotBlank(message = "生成模块名不能为空") + private String moduleName; + + /** 生成业务名 */ + @NotBlank(message = "生成业务名不能为空") + private String businessName; + + /** 生成功能名 */ + @NotBlank(message = "生成功能名不能为空") + private String functionName; + + /** 生成作者 */ + @NotBlank(message = "作者不能为空") + private String functionAuthor; + + /** 生成代码方式(0zip压缩包 1自定义路径) */ + private String genType; + + /** 生成路径(不填默认项目路径) */ + private String genPath; + + /** 主键信息 */ + private GenTableColumn pkColumn; + + /** 子表信息 */ + private GenTable subTable; + + /** 表列信息 */ + @Valid + private List columns; + + /** 其它生成选项 */ + private String options; + + /** 树编码字段 */ + private String treeCode; + + /** 树父编码字段 */ + private String treeParentCode; + + /** 树名称字段 */ + private String treeName; + + /** 上级菜单ID字段 */ + private String parentMenuId; + + /** 上级菜单名称字段 */ + private String parentMenuName; + + public Long getTableId() + { + return tableId; + } + + public void setTableId(Long tableId) + { + this.tableId = tableId; + } + + public String getTableName() + { + return tableName; + } + + public void setTableName(String tableName) + { + this.tableName = tableName; + } + + public String getTableComment() + { + return tableComment; + } + + public void setTableComment(String tableComment) + { + this.tableComment = tableComment; + } + + public String getSubTableName() + { + return subTableName; + } + + public void setSubTableName(String subTableName) + { + this.subTableName = subTableName; + } + + public String getSubTableFkName() + { + return subTableFkName; + } + + public void setSubTableFkName(String subTableFkName) + { + this.subTableFkName = subTableFkName; + } + + public String getClassName() + { + return className; + } + + public void setClassName(String className) + { + this.className = className; + } + + public String getTplCategory() + { + return tplCategory; + } + + public void setTplCategory(String tplCategory) + { + this.tplCategory = tplCategory; + } + + public String getPackageName() + { + return packageName; + } + + public void setPackageName(String packageName) + { + this.packageName = packageName; + } + + public String getModuleName() + { + return moduleName; + } + + public void setModuleName(String moduleName) + { + this.moduleName = moduleName; + } + + public String getBusinessName() + { + return businessName; + } + + public void setBusinessName(String businessName) + { + this.businessName = businessName; + } + + public String getFunctionName() + { + return functionName; + } + + public void setFunctionName(String functionName) + { + this.functionName = functionName; + } + + public String getFunctionAuthor() + { + return functionAuthor; + } + + public void setFunctionAuthor(String functionAuthor) + { + this.functionAuthor = functionAuthor; + } + + public String getGenType() + { + return genType; + } + + public void setGenType(String genType) + { + this.genType = genType; + } + + public String getGenPath() + { + return genPath; + } + + public void setGenPath(String genPath) + { + this.genPath = genPath; + } + + public GenTableColumn getPkColumn() + { + return pkColumn; + } + + public void setPkColumn(GenTableColumn pkColumn) + { + this.pkColumn = pkColumn; + } + + public GenTable getSubTable() + { + return subTable; + } + + public void setSubTable(GenTable subTable) + { + this.subTable = subTable; + } + + public List getColumns() + { + return columns; + } + + public void setColumns(List columns) + { + this.columns = columns; + } + + public String getOptions() + { + return options; + } + + public void setOptions(String options) + { + this.options = options; + } + + public String getTreeCode() + { + return treeCode; + } + + public void setTreeCode(String treeCode) + { + this.treeCode = treeCode; + } + + public String getTreeParentCode() + { + return treeParentCode; + } + + public void setTreeParentCode(String treeParentCode) + { + this.treeParentCode = treeParentCode; + } + + public String getTreeName() + { + return treeName; + } + + public void setTreeName(String treeName) + { + this.treeName = treeName; + } + + public String getParentMenuId() + { + return parentMenuId; + } + + public void setParentMenuId(String parentMenuId) + { + this.parentMenuId = parentMenuId; + } + + public String getParentMenuName() + { + return parentMenuName; + } + + public void setParentMenuName(String parentMenuName) + { + this.parentMenuName = parentMenuName; + } + + public boolean isSub() + { + return isSub(this.tplCategory); + } + + public static boolean isSub(String tplCategory) + { + return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory); + } + + public boolean isTree() + { + return isTree(this.tplCategory); + } + + public static boolean isTree(String tplCategory) + { + return tplCategory != null && StringUtils.equals(GenConstants.TPL_TREE, tplCategory); + } + + public boolean isCrud() + { + return isCrud(this.tplCategory); + } + + public static boolean isCrud(String tplCategory) + { + return tplCategory != null && StringUtils.equals(GenConstants.TPL_CRUD, tplCategory); + } + + public boolean isSuperColumn(String javaField) + { + return isSuperColumn(this.tplCategory, javaField); + } + + public static boolean isSuperColumn(String tplCategory, String javaField) + { + if (isTree(tplCategory)) + { + return StringUtils.equalsAnyIgnoreCase(javaField, + ArrayUtils.addAll(GenConstants.TREE_ENTITY, GenConstants.BASE_ENTITY)); + } + return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY); + } +} \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java new file mode 100644 index 0000000000000000000000000000000000000000..d1733b645c7ed7c6285712189b3f53171d35858d --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java @@ -0,0 +1,373 @@ +package com.ruoyi.generator.domain; + +import javax.validation.constraints.NotBlank; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.utils.StringUtils; + +/** + * 代码生成业务字段表 gen_table_column + * + * @author ruoyi + */ +public class GenTableColumn extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 编号 */ + private Long columnId; + + /** 归属表编号 */ + private Long tableId; + + /** 列名称 */ + private String columnName; + + /** 列描述 */ + private String columnComment; + + /** 列类型 */ + private String columnType; + + /** JAVA类型 */ + private String javaType; + + /** JAVA字段名 */ + @NotBlank(message = "Java属性不能为空") + private String javaField; + + /** 是否主键(1是) */ + private String isPk; + + /** 是否自增(1是) */ + private String isIncrement; + + /** 是否必填(1是) */ + private String isRequired; + + /** 是否为插入字段(1是) */ + private String isInsert; + + /** 是否编辑字段(1是) */ + private String isEdit; + + /** 是否列表字段(1是) */ + private String isList; + + /** 是否查询字段(1是) */ + private String isQuery; + + /** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */ + private String queryType; + + /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) */ + private String htmlType; + + /** 字典类型 */ + private String dictType; + + /** 排序 */ + private Integer sort; + + public void setColumnId(Long columnId) + { + this.columnId = columnId; + } + + public Long getColumnId() + { + return columnId; + } + + public void setTableId(Long tableId) + { + this.tableId = tableId; + } + + public Long getTableId() + { + return tableId; + } + + public void setColumnName(String columnName) + { + this.columnName = columnName; + } + + public String getColumnName() + { + return columnName; + } + + public void setColumnComment(String columnComment) + { + this.columnComment = columnComment; + } + + public String getColumnComment() + { + return columnComment; + } + + public void setColumnType(String columnType) + { + this.columnType = columnType; + } + + public String getColumnType() + { + return columnType; + } + + public void setJavaType(String javaType) + { + this.javaType = javaType; + } + + public String getJavaType() + { + return javaType; + } + + public void setJavaField(String javaField) + { + this.javaField = javaField; + } + + public String getJavaField() + { + return javaField; + } + + public String getCapJavaField() + { + return StringUtils.capitalize(javaField); + } + + public void setIsPk(String isPk) + { + this.isPk = isPk; + } + + public String getIsPk() + { + return isPk; + } + + public boolean isPk() + { + return isPk(this.isPk); + } + + public boolean isPk(String isPk) + { + return isPk != null && StringUtils.equals("1", isPk); + } + + public String getIsIncrement() + { + return isIncrement; + } + + public void setIsIncrement(String isIncrement) + { + this.isIncrement = isIncrement; + } + + public boolean isIncrement() + { + return isIncrement(this.isIncrement); + } + + public boolean isIncrement(String isIncrement) + { + return isIncrement != null && StringUtils.equals("1", isIncrement); + } + + public void setIsRequired(String isRequired) + { + this.isRequired = isRequired; + } + + public String getIsRequired() + { + return isRequired; + } + + public boolean isRequired() + { + return isRequired(this.isRequired); + } + + public boolean isRequired(String isRequired) + { + return isRequired != null && StringUtils.equals("1", isRequired); + } + + public void setIsInsert(String isInsert) + { + this.isInsert = isInsert; + } + + public String getIsInsert() + { + return isInsert; + } + + public boolean isInsert() + { + return isInsert(this.isInsert); + } + + public boolean isInsert(String isInsert) + { + return isInsert != null && StringUtils.equals("1", isInsert); + } + + public void setIsEdit(String isEdit) + { + this.isEdit = isEdit; + } + + public String getIsEdit() + { + return isEdit; + } + + public boolean isEdit() + { + return isInsert(this.isEdit); + } + + public boolean isEdit(String isEdit) + { + return isEdit != null && StringUtils.equals("1", isEdit); + } + + public void setIsList(String isList) + { + this.isList = isList; + } + + public String getIsList() + { + return isList; + } + + public boolean isList() + { + return isList(this.isList); + } + + public boolean isList(String isList) + { + return isList != null && StringUtils.equals("1", isList); + } + + public void setIsQuery(String isQuery) + { + this.isQuery = isQuery; + } + + public String getIsQuery() + { + return isQuery; + } + + public boolean isQuery() + { + return isQuery(this.isQuery); + } + + public boolean isQuery(String isQuery) + { + return isQuery != null && StringUtils.equals("1", isQuery); + } + + public void setQueryType(String queryType) + { + this.queryType = queryType; + } + + public String getQueryType() + { + return queryType; + } + + public String getHtmlType() + { + return htmlType; + } + + public void setHtmlType(String htmlType) + { + this.htmlType = htmlType; + } + + public void setDictType(String dictType) + { + this.dictType = dictType; + } + + public String getDictType() + { + return dictType; + } + + public void setSort(Integer sort) + { + this.sort = sort; + } + + public Integer getSort() + { + return sort; + } + + public boolean isSuperColumn() + { + return isSuperColumn(this.javaField); + } + + public static boolean isSuperColumn(String javaField) + { + return StringUtils.equalsAnyIgnoreCase(javaField, + // BaseEntity + "createBy", "createTime", "updateBy", "updateTime", "remark", + // TreeEntity + "parentName", "parentId", "orderNum", "ancestors"); + } + + public boolean isUsableColumn() + { + return isUsableColumn(javaField); + } + + public static boolean isUsableColumn(String javaField) + { + // isSuperColumn()中的名单用于避免生成多余Domain属性,若某些属性在生成页面时需要用到不能忽略,则放在此处白名单 + return StringUtils.equalsAnyIgnoreCase(javaField, "parentId", "orderNum", "remark"); + } + + public String readConverterExp() + { + String remarks = StringUtils.substringBetween(this.columnComment, "(", ")"); + StringBuffer sb = new StringBuffer(); + if (StringUtils.isNotEmpty(remarks)) + { + for (String value : remarks.split(" ")) + { + if (StringUtils.isNotEmpty(value)) + { + Object startStr = value.subSequence(0, 1); + String endStr = value.substring(1); + sb.append("").append(startStr).append("=").append(endStr).append(","); + } + } + return sb.deleteCharAt(sb.length() - 1).toString(); + } + else + { + return this.columnComment; + } + } +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..951e16670f68a37dce4545cf9b94d6e4d0c4567e --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java @@ -0,0 +1,60 @@ +package com.ruoyi.generator.mapper; + +import java.util.List; +import com.ruoyi.generator.domain.GenTableColumn; + +/** + * 业务字段 数据层 + * + * @author ruoyi + */ +public interface GenTableColumnMapper +{ + /** + * 根据表名称查询列信息 + * + * @param tableName 表名称 + * @return 列信息 + */ + public List selectDbTableColumnsByName(String tableName); + + /** + * 查询业务字段列表 + * + * @param tableId 业务字段编号 + * @return 业务字段集合 + */ + public List selectGenTableColumnListByTableId(Long tableId); + + /** + * 新增业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + public int insertGenTableColumn(GenTableColumn genTableColumn); + + /** + * 修改业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + public int updateGenTableColumn(GenTableColumn genTableColumn); + + /** + * 删除业务字段 + * + * @param genTableColumns 列数据 + * @return 结果 + */ + public int deleteGenTableColumns(List genTableColumns); + + /** + * 批量删除业务字段 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteGenTableColumnByIds(Long[] ids); +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..9b330df805c2c021dfef0bbe9ef2306345359c2e --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java @@ -0,0 +1,83 @@ +package com.ruoyi.generator.mapper; + +import java.util.List; +import com.ruoyi.generator.domain.GenTable; + +/** + * 业务 数据层 + * + * @author ruoyi + */ +public interface GenTableMapper +{ + /** + * 查询业务列表 + * + * @param genTable 业务信息 + * @return 业务集合 + */ + public List selectGenTableList(GenTable genTable); + + /** + * 查询据库列表 + * + * @param genTable 业务信息 + * @return 数据库表集合 + */ + public List selectDbTableList(GenTable genTable); + + /** + * 查询据库列表 + * + * @param tableNames 表名称组 + * @return 数据库表集合 + */ + public List selectDbTableListByNames(String[] tableNames); + + /** + * 查询所有表信息 + * + * @return 表信息集合 + */ + public List selectGenTableAll(); + + /** + * 查询表ID业务信息 + * + * @param id 业务ID + * @return 业务信息 + */ + public GenTable selectGenTableById(Long id); + + /** + * 查询表名称业务信息 + * + * @param tableName 表名称 + * @return 业务信息 + */ + public GenTable selectGenTableByName(String tableName); + + /** + * 新增业务 + * + * @param genTable 业务信息 + * @return 结果 + */ + public int insertGenTable(GenTable genTable); + + /** + * 修改业务 + * + * @param genTable 业务信息 + * @return 结果 + */ + public int updateGenTable(GenTable genTable); + + /** + * 批量删除业务 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteGenTableByIds(Long[] ids); +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..0679689d2febdae8dfbdc7aff39fafbd0cd72e42 --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java @@ -0,0 +1,68 @@ +package com.ruoyi.generator.service; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.generator.domain.GenTableColumn; +import com.ruoyi.generator.mapper.GenTableColumnMapper; + +/** + * 业务字段 服务层实现 + * + * @author ruoyi + */ +@Service +public class GenTableColumnServiceImpl implements IGenTableColumnService +{ + @Autowired + private GenTableColumnMapper genTableColumnMapper; + + /** + * 查询业务字段列表 + * + * @param tableId 业务字段编号 + * @return 业务字段集合 + */ + @Override + public List selectGenTableColumnListByTableId(Long tableId) + { + return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); + } + + /** + * 新增业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + @Override + public int insertGenTableColumn(GenTableColumn genTableColumn) + { + return genTableColumnMapper.insertGenTableColumn(genTableColumn); + } + + /** + * 修改业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + @Override + public int updateGenTableColumn(GenTableColumn genTableColumn) + { + return genTableColumnMapper.updateGenTableColumn(genTableColumn); + } + + /** + * 删除业务字段对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteGenTableColumnByIds(String ids) + { + return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); + } +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4889f81518f31a0cf4b580105a9cf9b59261cc48 --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -0,0 +1,521 @@ +package com.ruoyi.generator.service; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.velocity.Template; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.GenConstants; +import com.ruoyi.common.core.text.CharsetKit; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.generator.domain.GenTable; +import com.ruoyi.generator.domain.GenTableColumn; +import com.ruoyi.generator.mapper.GenTableColumnMapper; +import com.ruoyi.generator.mapper.GenTableMapper; +import com.ruoyi.generator.util.GenUtils; +import com.ruoyi.generator.util.VelocityInitializer; +import com.ruoyi.generator.util.VelocityUtils; + +/** + * 业务 服务层实现 + * + * @author ruoyi + */ +@Service +public class GenTableServiceImpl implements IGenTableService +{ + private static final Logger log = LoggerFactory.getLogger(GenTableServiceImpl.class); + + @Autowired + private GenTableMapper genTableMapper; + + @Autowired + private GenTableColumnMapper genTableColumnMapper; + + /** + * 查询业务信息 + * + * @param id 业务ID + * @return 业务信息 + */ + @Override + public GenTable selectGenTableById(Long id) + { + GenTable genTable = genTableMapper.selectGenTableById(id); + setTableFromOptions(genTable); + return genTable; + } + + /** + * 查询业务列表 + * + * @param genTable 业务信息 + * @return 业务集合 + */ + @Override + public List selectGenTableList(GenTable genTable) + { + return genTableMapper.selectGenTableList(genTable); + } + + /** + * 查询据库列表 + * + * @param genTable 业务信息 + * @return 数据库表集合 + */ + @Override + public List selectDbTableList(GenTable genTable) + { + return genTableMapper.selectDbTableList(genTable); + } + + /** + * 查询据库列表 + * + * @param tableNames 表名称组 + * @return 数据库表集合 + */ + @Override + public List selectDbTableListByNames(String[] tableNames) + { + return genTableMapper.selectDbTableListByNames(tableNames); + } + + /** + * 查询所有表信息 + * + * @return 表信息集合 + */ + @Override + public List selectGenTableAll() + { + return genTableMapper.selectGenTableAll(); + } + + /** + * 修改业务 + * + * @param genTable 业务信息 + * @return 结果 + */ + @Override + @Transactional + public void updateGenTable(GenTable genTable) + { + String options = JSON.toJSONString(genTable.getParams()); + genTable.setOptions(options); + int row = genTableMapper.updateGenTable(genTable); + if (row > 0) + { + for (GenTableColumn cenTableColumn : genTable.getColumns()) + { + genTableColumnMapper.updateGenTableColumn(cenTableColumn); + } + } + } + + /** + * 删除业务对象 + * + * @param tableIds 需要删除的数据ID + * @return 结果 + */ + @Override + @Transactional + public void deleteGenTableByIds(Long[] tableIds) + { + genTableMapper.deleteGenTableByIds(tableIds); + genTableColumnMapper.deleteGenTableColumnByIds(tableIds); + } + + /** + * 导入表结构 + * + * @param tableList 导入表列表 + */ + @Override + @Transactional + public void importGenTable(List tableList) + { + String operName = SecurityUtils.getUsername(); + try + { + for (GenTable table : tableList) + { + String tableName = table.getTableName(); + GenUtils.initTable(table, operName); + int row = genTableMapper.insertGenTable(table); + if (row > 0) + { + // 保存列信息 + List genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); + for (GenTableColumn column : genTableColumns) + { + GenUtils.initColumnField(column, table); + genTableColumnMapper.insertGenTableColumn(column); + } + } + } + } + catch (Exception e) + { + throw new ServiceException("导入失败:" + e.getMessage()); + } + } + + /** + * 预览代码 + * + * @param tableId 表编号 + * @return 预览数据列表 + */ + @Override + public Map previewCode(Long tableId) + { + Map dataMap = new LinkedHashMap<>(); + // 查询表信息 + GenTable table = genTableMapper.selectGenTableById(tableId); + // 设置主子表信息 + setSubTable(table); + // 设置主键列信息 + setPkColumn(table); + VelocityInitializer.initVelocity(); + + VelocityContext context = VelocityUtils.prepareContext(table); + + // 获取模板列表 + List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + for (String template : templates) + { + // 渲染模板 + StringWriter sw = new StringWriter(); + Template tpl = Velocity.getTemplate(template, Constants.UTF8); + tpl.merge(context, sw); + dataMap.put(template, sw.toString()); + } + return dataMap; + } + + /** + * 生成代码(下载方式) + * + * @param tableName 表名称 + * @return 数据 + */ + @Override + public byte[] downloadCode(String tableName) + { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + ZipOutputStream zip = new ZipOutputStream(outputStream); + generatorCode(tableName, zip); + IOUtils.closeQuietly(zip); + return outputStream.toByteArray(); + } + + /** + * 生成代码(自定义路径) + * + * @param tableName 表名称 + */ + @Override + public void generatorCode(String tableName) + { + // 查询表信息 + GenTable table = genTableMapper.selectGenTableByName(tableName); + // 设置主子表信息 + setSubTable(table); + // 设置主键列信息 + setPkColumn(table); + + VelocityInitializer.initVelocity(); + + VelocityContext context = VelocityUtils.prepareContext(table); + + // 获取模板列表 + List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + for (String template : templates) + { + if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) + { + // 渲染模板 + StringWriter sw = new StringWriter(); + Template tpl = Velocity.getTemplate(template, Constants.UTF8); + tpl.merge(context, sw); + try + { + String path = getGenPath(table, template); + FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8); + } + catch (IOException e) + { + throw new ServiceException("渲染模板失败,表名:" + table.getTableName()); + } + } + } + } + + /** + * 同步数据库 + * + * @param tableName 表名称 + */ + @Override + @Transactional + public void synchDb(String tableName) + { + GenTable table = genTableMapper.selectGenTableByName(tableName); + List tableColumns = table.getColumns(); + Map tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity())); + + List dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); + if (StringUtils.isEmpty(dbTableColumns)) + { + throw new ServiceException("同步数据失败,原表结构不存在"); + } + List dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); + + dbTableColumns.forEach(column -> { + GenUtils.initColumnField(column, table); + if (tableColumnMap.containsKey(column.getColumnName())) + { + GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName()); + column.setColumnId(prevColumn.getColumnId()); + if (column.isList()) + { + // 如果是列表,继续保留查询方式/字典类型选项 + column.setDictType(prevColumn.getDictType()); + column.setQueryType(prevColumn.getQueryType()); + } + if (StringUtils.isNotEmpty(prevColumn.getIsRequired()) && !column.isPk() + && (column.isInsert() || column.isEdit()) + && ((column.isUsableColumn()) || (!column.isSuperColumn()))) + { + // 如果是(新增/修改&非主键/非忽略及父属性),继续保留必填/显示类型选项 + column.setIsRequired(prevColumn.getIsRequired()); + column.setHtmlType(prevColumn.getHtmlType()); + } + genTableColumnMapper.updateGenTableColumn(column); + } + else + { + genTableColumnMapper.insertGenTableColumn(column); + } + }); + + List delColumns = tableColumns.stream().filter(column -> !dbTableColumnNames.contains(column.getColumnName())).collect(Collectors.toList()); + if (StringUtils.isNotEmpty(delColumns)) + { + genTableColumnMapper.deleteGenTableColumns(delColumns); + } + } + + /** + * 批量生成代码(下载方式) + * + * @param tableNames 表数组 + * @return 数据 + */ + @Override + public byte[] downloadCode(String[] tableNames) + { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + ZipOutputStream zip = new ZipOutputStream(outputStream); + for (String tableName : tableNames) + { + generatorCode(tableName, zip); + } + IOUtils.closeQuietly(zip); + return outputStream.toByteArray(); + } + + /** + * 查询表信息并生成代码 + */ + private void generatorCode(String tableName, ZipOutputStream zip) + { + // 查询表信息 + GenTable table = genTableMapper.selectGenTableByName(tableName); + // 设置主子表信息 + setSubTable(table); + // 设置主键列信息 + setPkColumn(table); + + VelocityInitializer.initVelocity(); + + VelocityContext context = VelocityUtils.prepareContext(table); + + // 获取模板列表 + List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + for (String template : templates) + { + // 渲染模板 + StringWriter sw = new StringWriter(); + Template tpl = Velocity.getTemplate(template, Constants.UTF8); + tpl.merge(context, sw); + try + { + // 添加到zip + zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); + IOUtils.write(sw.toString(), zip, Constants.UTF8); + IOUtils.closeQuietly(sw); + zip.flush(); + zip.closeEntry(); + } + catch (IOException e) + { + log.error("渲染模板失败,表名:" + table.getTableName(), e); + } + } + } + + /** + * 修改保存参数校验 + * + * @param genTable 业务信息 + */ + @Override + public void validateEdit(GenTable genTable) + { + if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) + { + String options = JSON.toJSONString(genTable.getParams()); + JSONObject paramsObj = JSON.parseObject(options); + if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) + { + throw new ServiceException("树编码字段不能为空"); + } + else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) + { + throw new ServiceException("树父编码字段不能为空"); + } + else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) + { + throw new ServiceException("树名称字段不能为空"); + } + else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) + { + if (StringUtils.isEmpty(genTable.getSubTableName())) + { + throw new ServiceException("关联子表的表名不能为空"); + } + else if (StringUtils.isEmpty(genTable.getSubTableFkName())) + { + throw new ServiceException("子表关联的外键名不能为空"); + } + } + } + } + + /** + * 设置主键列信息 + * + * @param table 业务表信息 + */ + public void setPkColumn(GenTable table) + { + for (GenTableColumn column : table.getColumns()) + { + if (column.isPk()) + { + table.setPkColumn(column); + break; + } + } + if (StringUtils.isNull(table.getPkColumn())) + { + table.setPkColumn(table.getColumns().get(0)); + } + if (GenConstants.TPL_SUB.equals(table.getTplCategory())) + { + for (GenTableColumn column : table.getSubTable().getColumns()) + { + if (column.isPk()) + { + table.getSubTable().setPkColumn(column); + break; + } + } + if (StringUtils.isNull(table.getSubTable().getPkColumn())) + { + table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0)); + } + } + } + + /** + * 设置主子表信息 + * + * @param table 业务表信息 + */ + public void setSubTable(GenTable table) + { + String subTableName = table.getSubTableName(); + if (StringUtils.isNotEmpty(subTableName)) + { + table.setSubTable(genTableMapper.selectGenTableByName(subTableName)); + } + } + + /** + * 设置代码生成其他选项值 + * + * @param genTable 设置后的生成对象 + */ + public void setTableFromOptions(GenTable genTable) + { + JSONObject paramsObj = JSON.parseObject(genTable.getOptions()); + if (StringUtils.isNotNull(paramsObj)) + { + String treeCode = paramsObj.getString(GenConstants.TREE_CODE); + String treeParentCode = paramsObj.getString(GenConstants.TREE_PARENT_CODE); + String treeName = paramsObj.getString(GenConstants.TREE_NAME); + String parentMenuId = paramsObj.getString(GenConstants.PARENT_MENU_ID); + String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME); + + genTable.setTreeCode(treeCode); + genTable.setTreeParentCode(treeParentCode); + genTable.setTreeName(treeName); + genTable.setParentMenuId(parentMenuId); + genTable.setParentMenuName(parentMenuName); + } + } + + /** + * 获取代码生成地址 + * + * @param table 业务表信息 + * @param template 模板文件路径 + * @return 生成地址 + */ + public static String getGenPath(GenTable table, String template) + { + String genPath = table.getGenPath(); + if (StringUtils.equals(genPath, "/")) + { + return System.getProperty("user.dir") + File.separator + "src" + File.separator + VelocityUtils.getFileName(template, table); + } + return genPath + File.separator + VelocityUtils.getFileName(template, table); + } +} \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java new file mode 100644 index 0000000000000000000000000000000000000000..3037f707e485149668c2b415ac14a911c7f07f02 --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java @@ -0,0 +1,44 @@ +package com.ruoyi.generator.service; + +import java.util.List; +import com.ruoyi.generator.domain.GenTableColumn; + +/** + * 业务字段 服务层 + * + * @author ruoyi + */ +public interface IGenTableColumnService +{ + /** + * 查询业务字段列表 + * + * @param tableId 业务字段编号 + * @return 业务字段集合 + */ + public List selectGenTableColumnListByTableId(Long tableId); + + /** + * 新增业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + public int insertGenTableColumn(GenTableColumn genTableColumn); + + /** + * 修改业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + public int updateGenTableColumn(GenTableColumn genTableColumn); + + /** + * 删除业务字段信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteGenTableColumnByIds(String ids); +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java new file mode 100644 index 0000000000000000000000000000000000000000..9d53f95fbff6bad3bed40fdc0aa17a7663a72b10 --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java @@ -0,0 +1,121 @@ +package com.ruoyi.generator.service; + +import java.util.List; +import java.util.Map; +import com.ruoyi.generator.domain.GenTable; + +/** + * 业务 服务层 + * + * @author ruoyi + */ +public interface IGenTableService +{ + /** + * 查询业务列表 + * + * @param genTable 业务信息 + * @return 业务集合 + */ + public List selectGenTableList(GenTable genTable); + + /** + * 查询据库列表 + * + * @param genTable 业务信息 + * @return 数据库表集合 + */ + public List selectDbTableList(GenTable genTable); + + /** + * 查询据库列表 + * + * @param tableNames 表名称组 + * @return 数据库表集合 + */ + public List selectDbTableListByNames(String[] tableNames); + + /** + * 查询所有表信息 + * + * @return 表信息集合 + */ + public List selectGenTableAll(); + + /** + * 查询业务信息 + * + * @param id 业务ID + * @return 业务信息 + */ + public GenTable selectGenTableById(Long id); + + /** + * 修改业务 + * + * @param genTable 业务信息 + * @return 结果 + */ + public void updateGenTable(GenTable genTable); + + /** + * 删除业务信息 + * + * @param tableIds 需要删除的表数据ID + * @return 结果 + */ + public void deleteGenTableByIds(Long[] tableIds); + + /** + * 导入表结构 + * + * @param tableList 导入表列表 + */ + public void importGenTable(List tableList); + + /** + * 预览代码 + * + * @param tableId 表编号 + * @return 预览数据列表 + */ + public Map previewCode(Long tableId); + + /** + * 生成代码(下载方式) + * + * @param tableName 表名称 + * @return 数据 + */ + public byte[] downloadCode(String tableName); + + /** + * 生成代码(自定义路径) + * + * @param tableName 表名称 + * @return 数据 + */ + public void generatorCode(String tableName); + + /** + * 同步数据库 + * + * @param tableName 表名称 + */ + public void synchDb(String tableName); + + /** + * 批量生成代码(下载方式) + * + * @param tableNames 表数组 + * @return 数据 + */ + public byte[] downloadCode(String[] tableNames); + + /** + * 修改保存参数校验 + * + * @param genTable 业务信息 + */ + public void validateEdit(GenTable genTable); +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..e7ebc201570fa7b936286c88c8d5d11bf28b9f9e --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -0,0 +1,257 @@ +package com.ruoyi.generator.util; + +import java.util.Arrays; +import org.apache.commons.lang3.RegExUtils; +import com.ruoyi.common.constant.GenConstants; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.generator.config.GenConfig; +import com.ruoyi.generator.domain.GenTable; +import com.ruoyi.generator.domain.GenTableColumn; + +/** + * 代码生成器 工具类 + * + * @author ruoyi + */ +public class GenUtils +{ + /** + * 初始化表信息 + */ + public static void initTable(GenTable genTable, String operName) + { + genTable.setClassName(convertClassName(genTable.getTableName())); + genTable.setPackageName(GenConfig.getPackageName()); + genTable.setModuleName(getModuleName(GenConfig.getPackageName())); + genTable.setBusinessName(getBusinessName(genTable.getTableName())); + genTable.setFunctionName(replaceText(genTable.getTableComment())); + genTable.setFunctionAuthor(GenConfig.getAuthor()); + genTable.setCreateBy(operName); + } + + /** + * 初始化列属性字段 + */ + public static void initColumnField(GenTableColumn column, GenTable table) + { + String dataType = getDbType(column.getColumnType()); + String columnName = column.getColumnName(); + column.setTableId(table.getTableId()); + column.setCreateBy(table.getCreateBy()); + // 设置java字段名 + column.setJavaField(StringUtils.toCamelCase(columnName)); + // 设置默认类型 + column.setJavaType(GenConstants.TYPE_STRING); + column.setQueryType(GenConstants.QUERY_EQ); + + if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) + { + // 字符串长度超过500设置为文本域 + Integer columnLength = getColumnLength(column.getColumnType()); + String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; + column.setHtmlType(htmlType); + } + else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) + { + column.setJavaType(GenConstants.TYPE_DATE); + column.setHtmlType(GenConstants.HTML_DATETIME); + } + else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) + { + column.setHtmlType(GenConstants.HTML_INPUT); + + // 如果是浮点型 统一用BigDecimal + String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); + if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) + { + column.setJavaType(GenConstants.TYPE_BIGDECIMAL); + } + // 如果是整形 + else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) + { + column.setJavaType(GenConstants.TYPE_INTEGER); + } + // 长整形 + else + { + column.setJavaType(GenConstants.TYPE_LONG); + } + } + + // 插入字段(默认所有字段都需要插入) + column.setIsInsert(GenConstants.REQUIRE); + + // 编辑字段 + if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk()) + { + column.setIsEdit(GenConstants.REQUIRE); + } + // 列表字段 + if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk()) + { + column.setIsList(GenConstants.REQUIRE); + } + // 查询字段 + if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) + { + column.setIsQuery(GenConstants.REQUIRE); + } + + // 查询字段类型 + if (StringUtils.endsWithIgnoreCase(columnName, "name")) + { + column.setQueryType(GenConstants.QUERY_LIKE); + } + // 状态字段设置单选框 + if (StringUtils.endsWithIgnoreCase(columnName, "status")) + { + column.setHtmlType(GenConstants.HTML_RADIO); + } + // 类型&性别字段设置下拉框 + else if (StringUtils.endsWithIgnoreCase(columnName, "type") + || StringUtils.endsWithIgnoreCase(columnName, "sex")) + { + column.setHtmlType(GenConstants.HTML_SELECT); + } + // 图片字段设置图片上传控件 + else if (StringUtils.endsWithIgnoreCase(columnName, "image")) + { + column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); + } + // 文件字段设置文件上传控件 + else if (StringUtils.endsWithIgnoreCase(columnName, "file")) + { + column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); + } + // 内容字段设置富文本控件 + else if (StringUtils.endsWithIgnoreCase(columnName, "content")) + { + column.setHtmlType(GenConstants.HTML_EDITOR); + } + } + + /** + * 校验数组是否包含指定值 + * + * @param arr 数组 + * @param targetValue 值 + * @return 是否包含 + */ + public static boolean arraysContains(String[] arr, String targetValue) + { + return Arrays.asList(arr).contains(targetValue); + } + + /** + * 获取模块名 + * + * @param packageName 包名 + * @return 模块名 + */ + public static String getModuleName(String packageName) + { + int lastIndex = packageName.lastIndexOf("."); + int nameLength = packageName.length(); + return StringUtils.substring(packageName, lastIndex + 1, nameLength); + } + + /** + * 获取业务名 + * + * @param tableName 表名 + * @return 业务名 + */ + public static String getBusinessName(String tableName) + { + int lastIndex = tableName.lastIndexOf("_"); + int nameLength = tableName.length(); + return StringUtils.substring(tableName, lastIndex + 1, nameLength); + } + + /** + * 表名转换成Java类名 + * + * @param tableName 表名称 + * @return 类名 + */ + public static String convertClassName(String tableName) + { + boolean autoRemovePre = GenConfig.getAutoRemovePre(); + String tablePrefix = GenConfig.getTablePrefix(); + if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) + { + String[] searchList = StringUtils.split(tablePrefix, ","); + tableName = replaceFirst(tableName, searchList); + } + return StringUtils.convertToCamelCase(tableName); + } + + /** + * 批量替换前缀 + * + * @param replacementm 替换值 + * @param searchList 替换列表 + * @return + */ + public static String replaceFirst(String replacementm, String[] searchList) + { + String text = replacementm; + for (String searchString : searchList) + { + if (replacementm.startsWith(searchString)) + { + text = replacementm.replaceFirst(searchString, ""); + break; + } + } + return text; + } + + /** + * 关键字替换 + * + * @param text 需要被替换的名字 + * @return 替换后的名字 + */ + public static String replaceText(String text) + { + return RegExUtils.replaceAll(text, "(?:表|若依)", ""); + } + + /** + * 获取数据库类型字段 + * + * @param columnType 列类型 + * @return 截取后的列类型 + */ + public static String getDbType(String columnType) + { + if (StringUtils.indexOf(columnType, "(") > 0) + { + return StringUtils.substringBefore(columnType, "("); + } + else + { + return columnType; + } + } + + /** + * 获取字段长度 + * + * @param columnType 列类型 + * @return 截取后的列类型 + */ + public static Integer getColumnLength(String columnType) + { + if (StringUtils.indexOf(columnType, "(") > 0) + { + String length = StringUtils.substringBetween(columnType, "(", ")"); + return Integer.valueOf(length); + } + else + { + return 0; + } + } +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java new file mode 100644 index 0000000000000000000000000000000000000000..9f694038bda42791fda3cf479cff7ddc6a6be7ca --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityInitializer.java @@ -0,0 +1,34 @@ +package com.ruoyi.generator.util; + +import java.util.Properties; +import org.apache.velocity.app.Velocity; +import com.ruoyi.common.constant.Constants; + +/** + * VelocityEngine工厂 + * + * @author ruoyi + */ +public class VelocityInitializer +{ + /** + * 初始化vm方法 + */ + public static void initVelocity() + { + Properties p = new Properties(); + try + { + // 加载classpath目录下的vm文件 + p.setProperty("resource.loader.file.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); + // 定义字符集 + p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8); + // 初始化Velocity引擎,指定配置Properties + Velocity.init(p); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..7ede02d2e771c82cb8aad7f81b5171a1c1b395f7 --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java @@ -0,0 +1,402 @@ +package com.ruoyi.generator.util; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.velocity.VelocityContext; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.constant.GenConstants; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.generator.domain.GenTable; +import com.ruoyi.generator.domain.GenTableColumn; + +/** + * 模板处理工具类 + * + * @author ruoyi + */ +public class VelocityUtils +{ + /** 项目空间路径 */ + private static final String PROJECT_PATH = "main/java"; + + /** mybatis空间路径 */ + private static final String MYBATIS_PATH = "main/resources/mapper"; + + /** 默认上级菜单,系统工具 */ + private static final String DEFAULT_PARENT_MENU_ID = "3"; + + /** + * 设置模板变量信息 + * + * @return 模板列表 + */ + public static VelocityContext prepareContext(GenTable genTable) + { + String moduleName = genTable.getModuleName(); + String businessName = genTable.getBusinessName(); + String packageName = genTable.getPackageName(); + String tplCategory = genTable.getTplCategory(); + String functionName = genTable.getFunctionName(); + + VelocityContext velocityContext = new VelocityContext(); + velocityContext.put("tplCategory", genTable.getTplCategory()); + velocityContext.put("tableName", genTable.getTableName()); + velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】"); + velocityContext.put("ClassName", genTable.getClassName()); + velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); + velocityContext.put("moduleName", genTable.getModuleName()); + velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName())); + velocityContext.put("businessName", genTable.getBusinessName()); + velocityContext.put("basePackage", getPackagePrefix(packageName)); + velocityContext.put("packageName", packageName); + velocityContext.put("author", genTable.getFunctionAuthor()); + velocityContext.put("datetime", DateUtils.getDate()); + velocityContext.put("pkColumn", genTable.getPkColumn()); + velocityContext.put("importList", getImportList(genTable)); + velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); + velocityContext.put("columns", genTable.getColumns()); + velocityContext.put("table", genTable); + velocityContext.put("dicts", getDicts(genTable)); + setMenuVelocityContext(velocityContext, genTable); + if (GenConstants.TPL_TREE.equals(tplCategory)) + { + setTreeVelocityContext(velocityContext, genTable); + } + if (GenConstants.TPL_SUB.equals(tplCategory)) + { + setSubVelocityContext(velocityContext, genTable); + } + return velocityContext; + } + + public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) + { + String options = genTable.getOptions(); + JSONObject paramsObj = JSON.parseObject(options); + String parentMenuId = getParentMenuId(paramsObj); + context.put("parentMenuId", parentMenuId); + } + + public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) + { + String options = genTable.getOptions(); + JSONObject paramsObj = JSON.parseObject(options); + String treeCode = getTreecode(paramsObj); + String treeParentCode = getTreeParentCode(paramsObj); + String treeName = getTreeName(paramsObj); + + context.put("treeCode", treeCode); + context.put("treeParentCode", treeParentCode); + context.put("treeName", treeName); + context.put("expandColumn", getExpandColumn(genTable)); + if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) + { + context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE)); + } + if (paramsObj.containsKey(GenConstants.TREE_NAME)) + { + context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME)); + } + } + + public static void setSubVelocityContext(VelocityContext context, GenTable genTable) + { + GenTable subTable = genTable.getSubTable(); + String subTableName = genTable.getSubTableName(); + String subTableFkName = genTable.getSubTableFkName(); + String subClassName = genTable.getSubTable().getClassName(); + String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName); + + context.put("subTable", subTable); + context.put("subTableName", subTableName); + context.put("subTableFkName", subTableFkName); + context.put("subTableFkClassName", subTableFkClassName); + context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName)); + context.put("subClassName", subClassName); + context.put("subclassName", StringUtils.uncapitalize(subClassName)); + context.put("subImportList", getImportList(genTable.getSubTable())); + } + + /** + * 获取模板信息 + * + * @return 模板列表 + */ + public static List getTemplateList(String tplCategory) + { + List templates = new ArrayList(); + templates.add("vm/java/domain.java.vm"); + templates.add("vm/java/mapper.java.vm"); + templates.add("vm/java/service.java.vm"); + templates.add("vm/java/serviceImpl.java.vm"); + templates.add("vm/java/controller.java.vm"); + templates.add("vm/xml/mapper.xml.vm"); + templates.add("vm/sql/sql.vm"); + templates.add("vm/js/api.js.vm"); + if (GenConstants.TPL_CRUD.equals(tplCategory)) + { + templates.add("vm/vue/index.vue.vm"); + } + else if (GenConstants.TPL_TREE.equals(tplCategory)) + { + templates.add("vm/vue/index-tree.vue.vm"); + } + else if (GenConstants.TPL_SUB.equals(tplCategory)) + { + templates.add("vm/vue/index.vue.vm"); + templates.add("vm/java/sub-domain.java.vm"); + } + return templates; + } + + /** + * 获取文件名 + */ + public static String getFileName(String template, GenTable genTable) + { + // 文件名称 + String fileName = ""; + // 包路径 + String packageName = genTable.getPackageName(); + // 模块名 + String moduleName = genTable.getModuleName(); + // 大写类名 + String className = genTable.getClassName(); + // 业务名称 + String businessName = genTable.getBusinessName(); + + String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); + String mybatisPath = MYBATIS_PATH + "/" + moduleName; + String vuePath = "vue"; + + if (template.contains("domain.java.vm")) + { + fileName = StringUtils.format("{}/domain/{}.java", javaPath, className); + } + if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) + { + fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName()); + } + else if (template.contains("mapper.java.vm")) + { + fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className); + } + else if (template.contains("service.java.vm")) + { + fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className); + } + else if (template.contains("serviceImpl.java.vm")) + { + fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className); + } + else if (template.contains("controller.java.vm")) + { + fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className); + } + else if (template.contains("mapper.xml.vm")) + { + fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className); + } + else if (template.contains("sql.vm")) + { + fileName = businessName + "Menu.sql"; + } + else if (template.contains("api.js.vm")) + { + fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName); + } + else if (template.contains("index.vue.vm")) + { + fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); + } + else if (template.contains("index-tree.vue.vm")) + { + fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); + } + return fileName; + } + + /** + * 获取包前缀 + * + * @param packageName 包名称 + * @return 包前缀名称 + */ + public static String getPackagePrefix(String packageName) + { + int lastIndex = packageName.lastIndexOf("."); + return StringUtils.substring(packageName, 0, lastIndex); + } + + /** + * 根据列类型获取导入包 + * + * @param genTable 业务表对象 + * @return 返回需要导入的包列表 + */ + public static HashSet getImportList(GenTable genTable) + { + List columns = genTable.getColumns(); + GenTable subGenTable = genTable.getSubTable(); + HashSet importList = new HashSet(); + if (StringUtils.isNotNull(subGenTable)) + { + importList.add("java.util.List"); + } + for (GenTableColumn column : columns) + { + if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) + { + importList.add("java.util.Date"); + importList.add("com.fasterxml.jackson.annotation.JsonFormat"); + } + else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) + { + importList.add("java.math.BigDecimal"); + } + } + return importList; + } + + /** + * 根据列类型获取字典组 + * + * @param genTable 业务表对象 + * @return 返回字典组 + */ + public static String getDicts(GenTable genTable) + { + List columns = genTable.getColumns(); + Set dicts = new HashSet(); + addDicts(dicts, columns); + if (StringUtils.isNotNull(genTable.getSubTable())) + { + List subColumns = genTable.getSubTable().getColumns(); + addDicts(dicts, subColumns); + } + return StringUtils.join(dicts, ", "); + } + + /** + * 添加字典列表 + * + * @param dicts 字典列表 + * @param columns 列集合 + */ + public static void addDicts(Set dicts, List columns) + { + for (GenTableColumn column : columns) + { + if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( + column.getHtmlType(), + new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX })) + { + dicts.add("'" + column.getDictType() + "'"); + } + } + } + + /** + * 获取权限前缀 + * + * @param moduleName 模块名称 + * @param businessName 业务名称 + * @return 返回权限前缀 + */ + public static String getPermissionPrefix(String moduleName, String businessName) + { + return StringUtils.format("{}:{}", moduleName, businessName); + } + + /** + * 获取上级菜单ID字段 + * + * @param paramsObj 生成其他选项 + * @return 上级菜单ID字段 + */ + public static String getParentMenuId(JSONObject paramsObj) + { + if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID) + && StringUtils.isNotEmpty(paramsObj.getString(GenConstants.PARENT_MENU_ID))) + { + return paramsObj.getString(GenConstants.PARENT_MENU_ID); + } + return DEFAULT_PARENT_MENU_ID; + } + + /** + * 获取树编码 + * + * @param paramsObj 生成其他选项 + * @return 树编码 + */ + public static String getTreecode(JSONObject paramsObj) + { + if (paramsObj.containsKey(GenConstants.TREE_CODE)) + { + return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE)); + } + return StringUtils.EMPTY; + } + + /** + * 获取树父编码 + * + * @param paramsObj 生成其他选项 + * @return 树父编码 + */ + public static String getTreeParentCode(JSONObject paramsObj) + { + if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) + { + return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE)); + } + return StringUtils.EMPTY; + } + + /** + * 获取树名称 + * + * @param paramsObj 生成其他选项 + * @return 树名称 + */ + public static String getTreeName(JSONObject paramsObj) + { + if (paramsObj.containsKey(GenConstants.TREE_NAME)) + { + return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME)); + } + return StringUtils.EMPTY; + } + + /** + * 获取需要在哪一列上面显示展开按钮 + * + * @param genTable 业务表对象 + * @return 展开按钮列序号 + */ + public static int getExpandColumn(GenTable genTable) + { + String options = genTable.getOptions(); + JSONObject paramsObj = JSON.parseObject(options); + String treeName = paramsObj.getString(GenConstants.TREE_NAME); + int num = 0; + for (GenTableColumn column : genTable.getColumns()) + { + if (column.isList()) + { + num++; + String columnName = column.getColumnName(); + if (columnName.equals(treeName)) + { + break; + } + } + } + return num; + } +} diff --git a/ruoyi-generator/src/main/resources/generator.yml b/ruoyi-generator/src/main/resources/generator.yml new file mode 100644 index 0000000000000000000000000000000000000000..5bd3dd67b84fc8de893ebad2946f90ba41d27154 --- /dev/null +++ b/ruoyi-generator/src/main/resources/generator.yml @@ -0,0 +1,10 @@ +# 代码生成 +gen: + # 作者 + author: ruoyi + # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool + packageName: com.ruoyi.system + # 自动去除表前缀,默认是false + autoRemovePre: false + # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) + tablePrefix: sys_ \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..a79398a51e9162811e8c990c62795ec9011ac080 --- /dev/null +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column + + + + + + + + insert into gen_table_column ( + table_id, + column_name, + column_comment, + column_type, + java_type, + java_field, + is_pk, + is_increment, + is_required, + is_insert, + is_edit, + is_list, + is_query, + query_type, + html_type, + dict_type, + sort, + create_by, + create_time + )values( + #{tableId}, + #{columnName}, + #{columnComment}, + #{columnType}, + #{javaType}, + #{javaField}, + #{isPk}, + #{isIncrement}, + #{isRequired}, + #{isInsert}, + #{isEdit}, + #{isList}, + #{isQuery}, + #{queryType}, + #{htmlType}, + #{dictType}, + #{sort}, + #{createBy}, + now() + ) + + + + update gen_table_column + + column_comment = #{columnComment}, + java_type = #{javaType}, + java_field = #{javaField}, + is_insert = #{isInsert}, + is_edit = #{isEdit}, + is_list = #{isList}, + is_query = #{isQuery}, + is_required = #{isRequired}, + query_type = #{queryType}, + html_type = #{htmlType}, + dict_type = #{dictType}, + sort = #{sort}, + update_by = #{updateBy}, + update_time = now() + + where column_id = #{columnId} + + + + delete from gen_table_column where table_id in + + #{tableId} + + + + + delete from gen_table_column where column_id in + + #{item.columnId} + + + + \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..527fdac2bad50a819802dc36566413cb42a05470 --- /dev/null +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table + + + + + + + + + + + + + + + + + + insert into gen_table ( + table_name, + table_comment, + class_name, + tpl_category, + package_name, + module_name, + business_name, + function_name, + function_author, + gen_type, + gen_path, + remark, + create_by, + create_time + )values( + #{tableName}, + #{tableComment}, + #{className}, + #{tplCategory}, + #{packageName}, + #{moduleName}, + #{businessName}, + #{functionName}, + #{functionAuthor}, + #{genType}, + #{genPath}, + #{remark}, + #{createBy}, + now() + ) + + + + update gen_table + + table_name = #{tableName}, + table_comment = #{tableComment}, + sub_table_name = #{subTableName}, + sub_table_fk_name = #{subTableFkName}, + class_name = #{className}, + function_author = #{functionAuthor}, + gen_type = #{genType}, + gen_path = #{genPath}, + tpl_category = #{tplCategory}, + package_name = #{packageName}, + module_name = #{moduleName}, + business_name = #{businessName}, + function_name = #{functionName}, + options = #{options}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = now() + + where table_id = #{tableId} + + + + delete from gen_table where table_id in + + #{tableId} + + + + \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/controller.java.ftl b/ruoyi-generator/src/main/resources/templates/controller.java.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9c949dd00e9c8066e6b33865499415249bf5a027 --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/controller.java.ftl @@ -0,0 +1,137 @@ +package ${package.Controller}; + +import com.zyjc.base.annotation.log.SysLog; +import com.zyjc.base.enums.SysLogEnum; +import com.zyjc.base.web.response.ResultVO; +import ${package.Entity}.${entity}; +import ${package.Service}.${table.serviceName}; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +<#if restControllerStyle> +<#else> + import org.springframework.stereotype.Controller; + +<#if superControllerClassPackage??> + import ${superControllerClassPackage}; + + + +import javax.validation.Valid; +import java.util.List; + +/** +*

+ * ${table.comment} 前端控制器 + *

+* +* @author ${author} +* @since ${date} +*/ +@Api(tags = "${table.comment}") +@RestController +@RequestMapping("/eastcom_yw/${entity?uncap_first}") +@Slf4j +@RequiredArgsConstructor +<#if kotlin> + class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}() +<#else> + <#if superControllerClass??> +public class ${table.controllerName} extends ${superControllerClass} { + <#else> +public class ${table.controllerName} extends BaseController{ + + + private final ${entity}Service ${entity?uncap_first}Service; + + /** + * ${table.comment}列表 + */ + @ApiOperation(value = "${table.comment}列表", notes = "${table.comment}列表") + @RequestMapping(value = "list", method = RequestMethod.POST) + public TableDataInfo list(@RequestBody ${entity}QO qo) { + List<${entity}VO> list = ${entity?uncap_first}Service.getData(qo); + return getDataTable(list); + } + + + /** + * ${table.comment}分页列表 + */ + @ApiOperation(value = "${table.comment}分页列表", notes = "${table.comment}分页列表") + @RequestMapping(value = "pageList", method = RequestMethod.POST) + public TableDataInfo pageList(@RequestBody ${entity}QO qo) { + IPage<${entity}VO> page = ${entity?uncap_first}Service.getDataByPage(qo); + return getDataTable(page.getRecords(),page.getTotal()); + } + + /** + * 获取${table.comment}详情 + */ + @ApiOperation(value = "${table.comment}详情", notes = "${table.comment}详情") + @GetMapping(value = "/fetchById/{id}") + public AjaxResult fetchById(@PathVariable Long id) { + return AjaxResult.success(${entity?uncap_first}Service.fetchById(id)); + } + + /** + * 新增或修改${table.comment} + */ + @Log(title = "新增或修改${table.comment}", businessType = BusinessType.INSERT) + @ApiOperation(value = "新增或修改${table.comment}", notes = "新增或修改${table.comment}") + @PostMapping(value = "/saveOrUpdate") + public AjaxResult saveOrUpdate(@RequestBody @Validated ${entity}DTO dto) { + ${entity?uncap_first}Service.saveOrUpdate(dto); + return AjaxResult.success(); + } + + /** + * 根据id删除${table.comment} + */ + @Log(title = "根据id删除${table.comment}", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id删除${table.comment}", notes = "根据id删除${table.comment}") + @GetMapping(value = "/deleteById/{id}") + public AjaxResult deleteById(@PathVariable Long id) { + ${entity?uncap_first}Service.deleteById(id); + return AjaxResult.success(); + } + + /** + * 根据id批量删除${table.comment} + */ + @Log(title = "根据id批量删除${table.comment}", businessType = BusinessType.DELETE) + @ApiOperation(value = "根据id批量删除${table.comment}", notes = "根据id批量删除${table.comment}") + @PostMapping(value = "/deleteByIdBatch") + public AjaxResult deleteByIdBatch(@RequestBody List ids) { + ${entity?uncap_first}Service.deleteByIdBatch(ids); + return AjaxResult.success(); + } + + @Log(title = "${table.comment}导入", businessType = BusinessType.IMPORT) + @PostMapping("/import") + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { + ExcelUtil<${entity}> util = new ExcelUtil<>(${entity}.class); + List<${entity}> list = util.importExcel(file.getInputStream()); + ${entity?uncap_first}Service.importData(list, updateSupport); + return AjaxResult.success(); + } + + + /** + * ${table.comment}导出 + */ + @ApiOperation(value = "${table.comment}导出") + @PostMapping(value = "/export") + public void export(@RequestBody ${entity}QO qo){ + ${entity?uncap_first}Service.export(qo); + } + +} + \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/controller.java.vm b/ruoyi-generator/src/main/resources/templates/controller.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..f125d46006ae62472b1df97a6ebd5d13ec05c7d4 --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/controller.java.vm @@ -0,0 +1,44 @@ +package ${package.Controller}; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +#if(${restControllerStyle}) +import org.springframework.web.bind.annotation.RestController; +#else +import org.springframework.stereotype.Controller; +#end +#if(${superControllerClassPackage}) +import ${superControllerClassPackage}; +#end + +/** + *

+ * $!{table.comment} 前端控制器 + *

+ * + * @author ${author} + * @since ${date} + */ +#if(${restControllerStyle}) +@RestController +#else +@Controller +#end +@RequestMapping("#if(${package.ModuleName})/${package.ModuleName}#end/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end") +#if(${kotlin}) +class ${table.controllerName}#if(${superControllerClass}) : ${superControllerClass}()#end + +#else + #if(${superControllerClass}) + public class ${table.controllerName} extends ${superControllerClass} { + #else + public class ${table.controllerName} { + #end + + } + +#end \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/convert.java.ftl b/ruoyi-generator/src/main/resources/templates/convert.java.ftl new file mode 100644 index 0000000000000000000000000000000000000000..fea3864297521fabf1eb5ddab0c1cf6fa2fe971e --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/convert.java.ftl @@ -0,0 +1,22 @@ +package ${package.Entity}; + +import com.zyjc.happy.dto.${entity}DTO; +import com.zyjc.happy.entity.${entity}; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface ${entity}Convert { + +${entity}Convert INSTANCE = Mappers.getMapper(${entity}Convert.class); + +${entity} dtoToEntity(${entity}DTO dto); + +${entity}VO entityToVo(${entity} entity); + +List<${entity}VO> entityToVoList(List<${entity}> entityList); + +${entity}DTO entityToDto(${entity} entity); + +} + diff --git a/ruoyi-generator/src/main/resources/templates/dto.java.ftl b/ruoyi-generator/src/main/resources/templates/dto.java.ftl new file mode 100644 index 0000000000000000000000000000000000000000..bebf61dcbaad111ab656e25c20c087c759e065af --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/dto.java.ftl @@ -0,0 +1,117 @@ +package ${package.Entity}; + +import com.zyjc.base.web.request.Page; +<#list table.importPackages as pkg> +import ${pkg}; + +<#if springdoc> +import io.swagger.v3.oas.annotations.media.Schema; +<#elseif swagger> +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +<#if entityLombokModel> +import lombok.*; + <#if chainModel> +import lombok.experimental.Accessors; + + + +/** + *

+ * ${table.comment!}DTO + *

+ * + * @author ${author} + * @since ${date} + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ${entity}DTO { + +<#if entitySerialVersionUID> + + private static final long serialVersionUID = 1L; + +<#-- ---------- BEGIN 字段循环遍历 ----------> +<#list table.fields as field> + <#if field.keyFlag> + <#assign keyPropertyName="${field.propertyName}"/> + + + <#if field.comment!?length gt 0> + <#if springdoc> + @Schema(description = "${field.comment}") + <#elseif swagger> + @ApiModelProperty("${field.comment}") + <#else> + /** + * ${field.comment} + */ + + + <#if field.keyFlag> + <#-- 主键 --> + <#if field.keyIdentityFlag> + @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO) + <#elseif idType??> + @TableId(value = "${field.annotationColumnName}", type = IdType.${idType}) + <#elseif field.convert> + @TableId("${field.annotationColumnName}") + + <#-- 普通字段 --> + <#elseif field.fill??> + <#-- ----- 存在字段填充设置 -----> + <#if field.convert> + @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill}) + <#else> + @TableField(fill = FieldFill.${field.fill}) + + <#elseif field.convert> + @TableField("${field.annotationColumnName}") + + <#-- 乐观锁注解 --> + <#if field.versionField> + @Version + + <#-- 逻辑删除注解 --> + <#if field.logicDeleteField> + @TableLogic + + private ${field.propertyType} ${field.propertyName}; + +<#------------ END 字段循环遍历 ----------> +<#if !entityLombokModel> + <#list table.fields as field> + <#if field.propertyType == "boolean"> + <#assign getprefix="is"/> + <#else> + <#assign getprefix="get"/> + + + public ${field.propertyType} ${getprefix}${field.capitalName}() { + return ${field.propertyName}; + } + + <#if chainModel> + public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + <#else> + public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + + this.${field.propertyName} = ${field.propertyName}; + <#if chainModel> + return this; + + } + + +<#if entityColumnConstant> + <#list table.fields as field> + + public static final String ${field.name?upper_case} = "${field.name}"; + + + +} diff --git a/ruoyi-generator/src/main/resources/templates/entity.java.ftl b/ruoyi-generator/src/main/resources/templates/entity.java.ftl new file mode 100644 index 0000000000000000000000000000000000000000..83b8116dd22760f21f89b76ac1b0c9a645402b4b --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/entity.java.ftl @@ -0,0 +1,136 @@ +package ${package.Entity}; + +<#list table.importPackages as pkg> +import ${pkg}; + +<#if springdoc> +import io.swagger.v3.oas.annotations.media.Schema; +<#elseif swagger> +import com.zyjc.base.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +<#if entityLombokModel> +import lombok.Data; +import lombok.EqualsAndHashCode; + <#if chainModel> +import lombok.experimental.Accessors; + + + +/** + *

+ * ${table.comment!} + *

+ * + * @author ${author} + * @since ${date} + */ +<#if entityLombokModel> + <#if chainModel> +@Accessors(chain = true) + + +@Data +@EqualsAndHashCode(callSuper = true) +<#if table.convert> +@TableName("${schemaName}${table.name}") + +<#if springdoc> +@Schema(name = "${entity}", description = "$!{table.comment}") +<#elseif swagger> +@ApiModel(value = "${entity}对象", description = "${table.comment!}") + +<#if superEntityClass??> +public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}> { +<#elseif activeRecord> +public class ${entity} extends Model<${entity}> { +<#elseif entitySerialVersionUID> +public class ${entity} { +<#else> +public class ${entity} { + +<#if entitySerialVersionUID> + + private static final long serialVersionUID = 1L; + +<#-- ---------- BEGIN 字段循环遍历 ----------> +<#list table.fields as field> + <#if field.keyFlag> + <#assign keyPropertyName="${field.propertyName}"/> + + + <#if field.comment!?length gt 0> + <#if springdoc> + @Schema(description = "${field.comment}") + <#elseif swagger> + @ApiModelProperty("${field.comment}") + <#else> + /** + * ${field.comment} + */ + + + <#if field.keyFlag> + <#-- 主键 --> + <#if field.keyIdentityFlag> + @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO) + <#elseif idType??> + @TableId(value = "${field.annotationColumnName}", type = IdType.${idType}) + <#elseif field.convert> + @TableId("${field.annotationColumnName}") + + <#-- 普通字段 --> + <#elseif field.fill??> + <#-- ----- 存在字段填充设置 -----> + <#if field.convert> + @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill}) + <#else> + @TableField(fill = FieldFill.${field.fill}) + + <#elseif field.convert> + @TableField("${field.annotationColumnName}") + + <#-- 乐观锁注解 --> + <#if field.versionField> + @Version + + <#-- 逻辑删除注解 --> + <#if field.logicDeleteField> + @TableLogic + + private ${field.propertyType} ${field.propertyName}; + +<#------------ END 字段循环遍历 ----------> +<#if !entityLombokModel> + <#list table.fields as field> + <#if field.propertyType == "boolean"> + <#assign getprefix="is"/> + <#else> + <#assign getprefix="get"/> + + + public ${field.propertyType} ${getprefix}${field.capitalName}() { + return ${field.propertyName}; + } + + <#if chainModel> + public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + <#else> + public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + + this.${field.propertyName} = ${field.propertyName}; + <#if chainModel> + return this; + + } + + +<#if entityColumnConstant> + <#list table.fields as field> + + public static final String ${field.name?upper_case} = "${field.name}"; + + + +} diff --git a/ruoyi-generator/src/main/resources/templates/entity.java.vm b/ruoyi-generator/src/main/resources/templates/entity.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..e2b76d750d9751294cab3d3bbdc2302c97bf7cab --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/entity.java.vm @@ -0,0 +1,165 @@ +package ${package.Entity}; + +#foreach($pkg in ${table.importPackages}) +import ${pkg}; + #if(${pkg} == "java.time.LocalDateTime") + import com.fasterxml.jackson.annotation.JsonFormat; + #end +#end +#if(${swagger2}) +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +#end +#if(${entityLombokModel}) +import lombok.Data; +import lombok.EqualsAndHashCode; + #if(${chainModel}) + import lombok.experimental.Accessors; + #end +#end + +/** + *

+ * $!{table.comment} + *

+ * + * @author ${author} + * @since ${date} + */ +#if(${entityLombokModel}) +@Data + #if(${superEntityClass}) + @EqualsAndHashCode(callSuper = true) + #else + @EqualsAndHashCode(callSuper = false) + #end + #if(${chainModel}) + @Accessors(chain = true) + #end +#end +#if(${table.convert}) +@TableName("${table.name}") +#end +#if(${swagger2}) +@ApiModel(value="${entity}对象", description="$!{table.comment}") +#end +#if(${superEntityClass}) +public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end { +#elseif(${activeRecord}) +public class ${entity} extends Model<${entity}> { +#else +public class ${entity} implements Serializable { +#end + +#if(${entitySerialVersionUID}) +private static final long serialVersionUID=1L; +#end +## ---------- BEGIN 字段循环遍历 ---------- +#foreach($field in ${table.fields}) + + #if(${field.keyFlag}) + #set($keyPropertyName=${field.propertyName}) + #end + #if("$!field.comment" != "") + #if(${swagger2}) + @ApiModelProperty(value = "${field.comment}") + #else + /** + * ${field.comment} + */ + #end + #end + #if(${field.keyFlag}) + ## 主键 + #if(${field.keyIdentityFlag}) + @TableId(value = "${field.annotationColumnName}", type = IdType.ASSIGN_ID) + #elseif(!$null.isNull(${idType}) && "$!idType" != "") + @TableId(value = "${field.annotationColumnName}", type = IdType.${idType}) + #elseif(${field.convert}) + @TableId("${field.annotationColumnName}") + #end + ## 普通字段 + #elseif(${field.fill}) + ## ----- 存在字段填充设置 ----- + #if(${field.convert}) + @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill}) + #else + @TableField(fill = FieldFill.${field.fill}) + #end + #elseif(${field.convert}) + @TableField("${field.annotationColumnName}") + #end + ## 乐观锁注解 + #if(${versionFieldName}==${field.name}) + @Version + #end + ## 逻辑删除注解 + #if(${logicDeleteFieldName}==${field.name}) + @TableLogic + #end + #if(${field.propertyType} == "LocalDateTime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + #end +private ${field.propertyType} ${field.propertyName}; +#end +## ---------- END 字段循环遍历 ---------- + +#if(!${entityLombokModel}) + #foreach($field in ${table.fields}) + #if(${field.propertyType.equals("boolean")}) + #set($getprefix="is") + #else + #set($getprefix="get") + #end + + public ${field.propertyType} ${getprefix}${field.capitalName}() { + return ${field.propertyName}; + } + + #if(${chainModel}) + public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + #else + public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + #end + this.${field.propertyName} = ${field.propertyName}; + #if(${chainModel}) + return this; + #end + } + #end + ## --foreach end--- +#end +## --end of #if(!${entityLombokModel})-- + +#if(${entityColumnConstant}) + #foreach($field in ${table.fields}) + public static final String ${field.name.toUpperCase()} = "${field.name}"; + + #end +#end +#if(${activeRecord}) +@Override +protected Serializable pkVal() { + #if(${keyPropertyName}) + return this.${keyPropertyName}; + #else + return null; + #end + } + +#end +#if(!${entityLombokModel}) +@Override +public String toString() { + return "${entity}{" + + #foreach($field in ${table.fields}) + #if($!{foreach.index}==0) + "${field.propertyName}=" + ${field.propertyName} + + #else + ", ${field.propertyName}=" + ${field.propertyName} + + #end + #end + "}"; + } +#end +} \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/mapper.xml.ftl b/ruoyi-generator/src/main/resources/templates/mapper.xml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..851af12203feee8dc75e9966fa10b4f431c9a909 --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/mapper.xml.ftl @@ -0,0 +1,39 @@ + + + + +<#if enableCache> + + + + +<#if baseResultMap> + + +<#list table.fields as field> +<#if field.keyFlag><#--生成主键排在第一位--> + + + +<#list table.commonFields as field><#--生成公共字段 --> + + +<#list table.fields as field> +<#if !field.keyFlag><#--生成普通字段 --> + + + + + + +<#if baseColumnList> + + +<#list table.commonFields as field> + ${field.columnName}, + + ${table.fieldNames} + + + + diff --git a/ruoyi-generator/src/main/resources/templates/mapper.xml.vm b/ruoyi-generator/src/main/resources/templates/mapper.xml.vm new file mode 100644 index 0000000000000000000000000000000000000000..d07909a014adb9c79fa648e8cb5f8e2b8681cba3 --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/mapper.xml.vm @@ -0,0 +1,39 @@ + + + + + #if(${enableCache}) + + + + #end + #if(${baseResultMap}) + + + #foreach($field in ${table.fields}) + #if(${field.keyFlag})##生成主键排在第一位 + + #end + #end + #foreach($field in ${table.commonFields})##生成公共字段 + + #end + #foreach($field in ${table.fields}) + #if(!${field.keyFlag})##生成普通字段 + + #end + #end + + + #end + #if(${baseColumnList}) + + + #foreach($field in ${table.commonFields}) + ${field.columnName}, + #end + ${table.fieldNames} + + + #end + \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/qo.java.ftl b/ruoyi-generator/src/main/resources/templates/qo.java.ftl new file mode 100644 index 0000000000000000000000000000000000000000..69720a17f6ab498437ad2c663cf5b369c76cfefc --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/qo.java.ftl @@ -0,0 +1,116 @@ +package ${package.Entity}; + +import com.github.pagehelper.Page; +<#list table.importPackages as pkg> +import ${pkg}; + +<#if springdoc> +import io.swagger.v3.oas.annotations.media.Schema; +<#elseif swagger> +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +<#if entityLombokModel> +import lombok.*; + <#if chainModel> +import lombok.experimental.Accessors; + + + +/** + *

+ * ${table.comment!}QO + *

+ * + * @author ${author} + * @since ${date} + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ${entity}QO extends CommonDTO { + +<#if entitySerialVersionUID> + + private static final long serialVersionUID = 1L; + +<#-- ---------- BEGIN 字段循环遍历 ----------> +<#list table.fields as field> + <#if field.keyFlag> + <#assign keyPropertyName="${field.propertyName}"/> + + + <#if field.comment!?length gt 0> + <#if springdoc> + @Schema(description = "${field.comment}") + <#elseif swagger> + @ApiModelProperty("${field.comment}") + <#else> + /** + * ${field.comment} + */ + + + <#if field.keyFlag> + <#-- 主键 --> + <#if field.keyIdentityFlag> + @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO) + <#elseif idType??> + @TableId(value = "${field.annotationColumnName}", type = IdType.${idType}) + <#elseif field.convert> + @TableId("${field.annotationColumnName}") + + <#-- 普通字段 --> + <#elseif field.fill??> + <#-- ----- 存在字段填充设置 -----> + <#if field.convert> + @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill}) + <#else> + @TableField(fill = FieldFill.${field.fill}) + + <#elseif field.convert> + @TableField("${field.annotationColumnName}") + + <#-- 乐观锁注解 --> + <#if field.versionField> + @Version + + <#-- 逻辑删除注解 --> + <#if field.logicDeleteField> + @TableLogic + + private ${field.propertyType} ${field.propertyName}; + +<#------------ END 字段循环遍历 ----------> +<#if !entityLombokModel> + <#list table.fields as field> + <#if field.propertyType == "boolean"> + <#assign getprefix="is"/> + <#else> + <#assign getprefix="get"/> + + + public ${field.propertyType} ${getprefix}${field.capitalName}() { + return ${field.propertyName}; + } + + <#if chainModel> + public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + <#else> + public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + + this.${field.propertyName} = ${field.propertyName}; + <#if chainModel> + return this; + + } + + +<#if entityColumnConstant> + <#list table.fields as field> + + public static final String ${field.name?upper_case} = "${field.name}"; + + + +} diff --git a/ruoyi-generator/src/main/resources/templates/service.java.ftl b/ruoyi-generator/src/main/resources/templates/service.java.ftl new file mode 100644 index 0000000000000000000000000000000000000000..fb58864793da2faa7e041346f6eb92114b26cc3c --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/service.java.ftl @@ -0,0 +1,80 @@ +package ${package.Service}; + +import ${package.Entity}.${entity}; +import ${superServiceClassPackage}; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import java.util.List; + +/** +*

+ * ${table.comment!} 服务类 + *

+* +* @author ${author} +* @since ${date} +*/ +<#if kotlin> + interface ${entity}Service : ${superServiceClass}<${entity}> +<#else> +public interface ${entity}Service extends ${superServiceClass}<${entity}> { + + /** + * ${table.comment!}列表 + * @param qo 根据需要进行传值 + * @return + */ + List<${entity}VO> getData(${entity}QO qo); + + /** + * ${table.comment!}分页列表 + * @param qo 根据需要进行传值 + * @return + */ + IPage<${entity}VO> getDataByPage(${entity}QO qo); + + /** + * ${table.comment!}详情 + * @param id + * @return + */ + ${entity}VO fetchById(Long id); + + /** + * ${table.comment!}新增或修改 + * @param dto 根据需要进行传值 + * @return + */ + boolean saveOrUpdate(${entity}DTO dto); + + /** + * ${table.comment!}删除(单个条目) + * @param id + * @return + */ + boolean deleteById(Long id); + + /** + * ${table.comment!}批量删除(多个条目) + * + * @param ids + * @return + */ + boolean deleteByIdBatch(List ids); + + /** + * ${table.comment!}导出 + * @param qo + * @return + */ + void export(${entity}QO qo); + + /** + * ${table.comment!}导入 + * + * @param + * @return + */ + AjaxResult importData(List<${entity}> list, boolean updateSupport); +} + \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/service.java.vm b/ruoyi-generator/src/main/resources/templates/service.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..67e0de12b46fd6a8ca2e3d2b1d6eda43d9b6844b --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/service.java.vm @@ -0,0 +1,20 @@ +package ${package.Service}; + +import ${package.Entity}.${entity}; +import ${superServiceClassPackage}; + +/** + *

+ * $!{table.comment} 服务类 + *

+ * + * @author ${author} + * @since ${date} + */ +#if(${kotlin}) +interface ${table.serviceName} : ${superServiceClass}<${entity}> +#else +public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { + + } +#end \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/serviceImpl.java.ftl b/ruoyi-generator/src/main/resources/templates/serviceImpl.java.ftl new file mode 100644 index 0000000000000000000000000000000000000000..277fad943d661e6e337f8857b3f8c45018b564bb --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/serviceImpl.java.ftl @@ -0,0 +1,175 @@ +package ${package.ServiceImpl}; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.zyjc.base.util.ExcelUtils; +import com.zyjc.base.web.exception.BizException; +import ${package.Entity}.${entity}; +import ${package.Mapper}.${table.mapperName}; +import ${package.Service}.${table.serviceName}; +import ${superServiceImplClassPackage}; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.xuhong.blogs.core.component.GlobalException; +import com.xuhong.blogs.core.component.RetJson; +import com.xuhong.blogs.core.enums.RetCode; +import com.xuhong.blogs.core.utils.IDGeneratorUtils; +import com.xuhong.blogs.core.utils.PageUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.RequestContextHolder; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** +*

+ * ${table.comment!} 服务实现类 + *

+* +* @author ${author} +* @since ${date} +*/ +@Service +<#if kotlin> + open class ${entity}ServiceImpl : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${entity}Service { + + } +<#else> +public class ${entity}ServiceImpl extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${entity}Service { + + @Resource + private ${entity}Mapper ${entity?uncap_first}Mapper; + + /** + * ${table.comment!}列表 + * @param qo 根据需要进行传值 + * @return + */ + @Override + public List<${entity}VO> getData(${entity}QO qo) { + LambdaQueryWrapper<${entity}> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + <#list table.fields as field> + // ${field.comment} + <#if !entityLombokModel> + <#if field.propertyType == "Boolean"> + <#assign getprefix="is"/> + <#else> + <#assign getprefix="get"/> + + <#if field.propertyType == "String"> + .eq(StrUtil.isNotBlank(qo.${getprefix}${field.capitalName}()), ${entity}::${getprefix}${field.capitalName}, qo.${getprefix}${field.capitalName}()) + <#else> + .eq(qo.${getprefix}${field.capitalName}() != null, ${entity}::${getprefix}${field.capitalName}, qo.${getprefix}${field.capitalName}()) + + <#else> + <#if field.propertyType == "String"> + .eq(StrUtil.isNotBlank(qo.get${field.capitalName}()), ${entity}::get${field.capitalName}, qo.get${field.capitalName}()) + <#else> + .eq(qo.get${field.capitalName}() != null, ${entity}::get${field.capitalName}, qo.get${field.capitalName}()) + + + ; + List<${entity}> list = ${entity?uncap_first}Mapper.selectList(queryWrapper); + return ${entity}Convert.INSTANCE.entityToVoList(list); + } + + /** + * ${table.comment!}分页列表 + * @param qo 根据需要进行传值 + * @return + */ + @Override + public IPage<${entity}VO> getDataByPage(${entity}QO qo) { + LambdaQueryWrapper<${entity}> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper + <#list table.fields as field> + // ${field.comment} + <#if !entityLombokModel> + <#if field.propertyType == "Boolean"> + <#assign getprefix="is"/> + <#else> + <#assign getprefix="get"/> + + <#if field.propertyType == "String"> + .eq(StrUtil.isNotBlank(qo.${getprefix}${field.capitalName}()), ${entity}::${getprefix}${field.capitalName}, qo.${getprefix}${field.capitalName}()) + <#else> + .eq(qo.${getprefix}${field.capitalName}() != null, ${entity}::${getprefix}${field.capitalName}, qo.${getprefix}${field.capitalName}()) + + <#else> + <#if field.propertyType == "String"> + .eq(StrUtil.isNotBlank(qo.get${field.capitalName}()), ${entity}::get${field.capitalName}, qo.get${field.capitalName}()) + <#else> + .eq(qo.get${field.capitalName}() != null, ${entity}::get${field.capitalName}, qo.get${field.capitalName}()) + + + ; + + Page<${entity}> page = page(new Page<>(qo.getPageNum(), qo.getPageSize()), queryWrapper); + IPage<${entity}VO> voPage = page.convert(${entity}Convert.INSTANCE::entityToVo); + return voPage; + } + + @Override + public ${entity}VO fetchById(Long id) { + ${entity} entity = ${entity?uncap_first}Mapper.selectById(id); + return ${entity}Convert.INSTANCE.entityToVo(entity); + } + + @Override + public boolean saveOrUpdate(${entity}DTO dto) { + ${entity} entity = ${entity}Convert.INSTANCE.dtoToEntity(dto); + return saveOrUpdate(entity); + } + + @Override + public boolean deleteById(Long id) { + return removeById(id); + } + + @Override + public boolean deleteByIdBatch(List ids) { + return SqlHelper.retBool(${entity?uncap_first}Mapper.deleteBatchIds(ids)); + } + + @Override + public void export(${entity}QO qo) { + HttpServletResponse response = ((ServletRequestAttributes) (RequestContextHolder.getRequestAttributes())).getResponse(); + List<${entity}VO> data = this.getData(qo); + ExcelUtil<${entity}VO> util = new ExcelUtil<>(${entity}VO.class); + try { + util.exportExcel(response, data, "${table.comment!}信息"); + } catch (Exception e) { + throw new ServiceException("导出文件异常:" + e.getMessage()); + } + } + + @Override + public AjaxResult importData(List<${entity}> list, boolean updateSupport) { + // 核查模板 + if (CollUtil.isEmpty(list)) { + return AjaxResult.error("导入模板不正确。"); + } + + // 核查 + // boolean checkFlag; + // checkFlag = checkData(cs, ywSceneList); + // if (checkFlag) { + // checkFlag = checkUnique(cs); + // } + // if (!checkFlag) { + // ExcelUtil util = new ExcelUtil<>(YwSceneNetelementCs.class); + // String fileName = (String) util.exportExcel(cs, "网元传输导入结果").get(AjaxResult.MSG_TAG); + // return new AjaxResult(HttpStatus.ACCEPTED, "导入失败", fileName); + // } + // saveBatch(list); + return null; + } +} + \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/templates/serviceImpl.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..cc9432be1c4b7f11d995fbcdb6f076a622bc4670 --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/serviceImpl.java.vm @@ -0,0 +1,26 @@ +package ${package.ServiceImpl}; + +import ${package.Entity}.${entity}; +import ${package.Mapper}.${table.mapperName}; +import ${package.Service}.${table.serviceName}; +import ${superServiceImplClassPackage}; +import org.springframework.stereotype.Service; + +/** + *

+ * $!{table.comment} 服务实现类 + *

+ * + * @author ${author} + * @since ${date} + */ +@Service +#if(${kotlin}) +open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} { + + } +#else + public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} { + + } +#end \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/vo.java.ftl b/ruoyi-generator/src/main/resources/templates/vo.java.ftl new file mode 100644 index 0000000000000000000000000000000000000000..ffc2518edd27f0965727f6f2e8e099c90f2f133a --- /dev/null +++ b/ruoyi-generator/src/main/resources/templates/vo.java.ftl @@ -0,0 +1,116 @@ +package ${package.Entity}; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +<#list table.importPackages as pkg> +import ${pkg}; + +<#if springdoc> +import io.swagger.v3.oas.annotations.media.Schema; +<#elseif swagger> +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +<#if entityLombokModel> +import lombok.*; + <#if chainModel> +import lombok.experimental.Accessors; + + + +/** + *

+ * ${table.comment!}VO + *

+ * + * @author ${author} + * @since ${date} + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class ${entity}VO { + +<#if entitySerialVersionUID> + + private static final long serialVersionUID = 1L; + +<#-- ---------- BEGIN 字段循环遍历 ----------> +<#list table.fields as field> + <#if field.keyFlag> + <#assign keyPropertyName="${field.propertyName}"/> + + + <#if field.comment!?length gt 0> + <#if springdoc> + @Schema(description = "${field.comment}") + <#elseif swagger> + @ApiModelProperty("${field.comment}") + <#else> + /** + * ${field.comment} + */ + + + <#if field.keyFlag> + <#-- 主键 --> + <#if field.keyIdentityFlag> + @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO) + <#elseif idType??> + @TableId(value = "${field.annotationColumnName}", type = IdType.${idType}) + <#elseif field.convert> + @TableId("${field.annotationColumnName}") + + <#-- 普通字段 --> + <#elseif field.fill??> + <#-- ----- 存在字段填充设置 -----> + <#if field.convert> + @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill}) + <#else> + @TableField(fill = FieldFill.${field.fill}) + + <#elseif field.convert> + @TableField("${field.annotationColumnName}") + + <#-- 乐观锁注解 --> + <#if field.versionField> + @Version + + <#-- 逻辑删除注解 --> + <#if field.logicDeleteField> + @TableLogic + + private ${field.propertyType} ${field.propertyName}; + +<#------------ END 字段循环遍历 ----------> +<#if !entityLombokModel> + <#list table.fields as field> + <#if field.propertyType == "boolean"> + <#assign getprefix="is"/> + <#else> + <#assign getprefix="get"/> + + + public ${field.propertyType} ${getprefix}${field.capitalName}() { + return ${field.propertyName}; + } + + <#if chainModel> + public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + <#else> + public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { + + this.${field.propertyName} = ${field.propertyName}; + <#if chainModel> + return this; + + } + + +<#if entityColumnConstant> + <#list table.fields as field> + + public static final String ${field.name?upper_case} = "${field.name}"; + + + +} diff --git a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..bf8898879a90dfff108d6ddf0b0fe852d3db8f8a --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm @@ -0,0 +1,115 @@ +package ${packageName}.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import ${packageName}.domain.${ClassName}; +import ${packageName}.service.I${ClassName}Service; +import com.ruoyi.common.utils.poi.ExcelUtil; +#if($table.crud || $table.sub) +import com.ruoyi.common.core.page.TableDataInfo; +#elseif($table.tree) +#end + +/** + * ${functionName}Controller + * + * @author ${author} + * @date ${datetime} + */ +@RestController +@RequestMapping("/${moduleName}/${businessName}") +public class ${ClassName}Controller extends BaseController +{ + @Autowired + private I${ClassName}Service ${className}Service; + + /** + * 查询${functionName}列表 + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") + @GetMapping("/list") +#if($table.crud || $table.sub) + public TableDataInfo list(${ClassName} ${className}) + { + startPage(); + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); + return getDataTable(list); + } +#elseif($table.tree) + public AjaxResult list(${ClassName} ${className}) + { + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); + return success(list); + } +#end + + /** + * 导出${functionName}列表 + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") + @Log(title = "${functionName}", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ${ClassName} ${className}) + { + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); + ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); + util.exportExcel(response, list, "${functionName}数据"); + } + + /** + * 获取${functionName}详细信息 + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") + @GetMapping(value = "/{${pkColumn.javaField}}") + public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) + { + return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); + } + + /** + * 新增${functionName} + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") + @Log(title = "${functionName}", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ${ClassName} ${className}) + { + return toAjax(${className}Service.insert${ClassName}(${className})); + } + + /** + * 修改${functionName} + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") + @Log(title = "${functionName}", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ${ClassName} ${className}) + { + return toAjax(${className}Service.update${ClassName}(${className})); + } + + /** + * 删除${functionName} + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") + @Log(title = "${functionName}", businessType = BusinessType.DELETE) + @DeleteMapping("/{${pkColumn.javaField}s}") + public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) + { + return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s)); + } +} diff --git a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..bd51c177375a6318cb87dba6ad0d316547e5081c --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm @@ -0,0 +1,105 @@ +package ${packageName}.domain; + +#foreach ($import in $importList) +import ${import}; +#end +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +#if($table.crud || $table.sub) +import com.ruoyi.common.core.domain.BaseEntity; +#elseif($table.tree) +import com.ruoyi.common.core.domain.TreeEntity; +#end + +/** + * ${functionName}对象 ${tableName} + * + * @author ${author} + * @date ${datetime} + */ +#if($table.crud || $table.sub) +#set($Entity="BaseEntity") +#elseif($table.tree) +#set($Entity="TreeEntity") +#end +public class ${ClassName} extends ${Entity} +{ + private static final long serialVersionUID = 1L; + +#foreach ($column in $columns) +#if(!$table.isSuperColumn($column.javaField)) + /** $column.columnComment */ +#if($column.list) +#set($parentheseIndex=$column.columnComment.indexOf("(")) +#if($parentheseIndex != -1) +#set($comment=$column.columnComment.substring(0, $parentheseIndex)) +#else +#set($comment=$column.columnComment) +#end +#if($parentheseIndex != -1) + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") +#elseif($column.javaType == 'Date') + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") +#else + @Excel(name = "${comment}") +#end +#end + private $column.javaType $column.javaField; + +#end +#end +#if($table.sub) + /** $table.subTable.functionName信息 */ + private List<${subClassName}> ${subclassName}List; + +#end +#foreach ($column in $columns) +#if(!$table.isSuperColumn($column.javaField)) +#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) +#set($AttrName=$column.javaField) +#else +#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) +#end + public void set${AttrName}($column.javaType $column.javaField) + { + this.$column.javaField = $column.javaField; + } + + public $column.javaType get${AttrName}() + { + return $column.javaField; + } +#end +#end + +#if($table.sub) + public List<${subClassName}> get${subClassName}List() + { + return ${subclassName}List; + } + + public void set${subClassName}List(List<${subClassName}> ${subclassName}List) + { + this.${subclassName}List = ${subclassName}List; + } + +#end + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) +#foreach ($column in $columns) +#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) +#set($AttrName=$column.javaField) +#else +#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) +#end + .append("${column.javaField}", get${AttrName}()) +#end +#if($table.sub) + .append("${subclassName}List", get${subClassName}List()) +#end + .toString(); + } +} diff --git a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..7e7d7c26f4f967da6ff36ed9978e9798cdfeaeaa --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm @@ -0,0 +1,91 @@ +package ${packageName}.mapper; + +import java.util.List; +import ${packageName}.domain.${ClassName}; +#if($table.sub) +import ${packageName}.domain.${subClassName}; +#end + +/** + * ${functionName}Mapper接口 + * + * @author ${author} + * @date ${datetime} + */ +public interface ${ClassName}Mapper +{ + /** + * 查询${functionName} + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return ${functionName} + */ + public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); + + /** + * 查询${functionName}列表 + * + * @param ${className} ${functionName} + * @return ${functionName}集合 + */ + public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); + + /** + * 新增${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int insert${ClassName}(${ClassName} ${className}); + + /** + * 修改${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int update${ClassName}(${ClassName} ${className}); + + /** + * 删除${functionName} + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return 结果 + */ + public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); + + /** + * 批量删除${functionName} + * + * @param ${pkColumn.javaField}s 需要删除的数据主键集合 + * @return 结果 + */ + public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); +#if($table.sub) + + /** + * 批量删除${subTable.functionName} + * + * @param ${pkColumn.javaField}s 需要删除的数据主键集合 + * @return 结果 + */ + public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); + + /** + * 批量新增${subTable.functionName} + * + * @param ${subclassName}List ${subTable.functionName}列表 + * @return 结果 + */ + public int batch${subClassName}(List<${subClassName}> ${subclassName}List); + + + /** + * 通过${functionName}主键删除${subTable.functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}ID + * @return 结果 + */ + public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); +#end +} diff --git a/ruoyi-generator/src/main/resources/vm/java/service.java.vm b/ruoyi-generator/src/main/resources/vm/java/service.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..264882b270e84f00ff93a4619dfb5bc940f05dfb --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/java/service.java.vm @@ -0,0 +1,61 @@ +package ${packageName}.service; + +import java.util.List; +import ${packageName}.domain.${ClassName}; + +/** + * ${functionName}Service接口 + * + * @author ${author} + * @date ${datetime} + */ +public interface I${ClassName}Service +{ + /** + * 查询${functionName} + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return ${functionName} + */ + public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); + + /** + * 查询${functionName}列表 + * + * @param ${className} ${functionName} + * @return ${functionName}集合 + */ + public List<${ClassName}> select${ClassName}List(${ClassName} ${className}); + + /** + * 新增${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int insert${ClassName}(${ClassName} ${className}); + + /** + * 修改${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ + public int update${ClassName}(${ClassName} ${className}); + + /** + * 批量删除${functionName} + * + * @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合 + * @return 结果 + */ + public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); + + /** + * 删除${functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return 结果 + */ + public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); +} diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..14746e1a2c733b3169d3e51b634f6305853f9ff9 --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm @@ -0,0 +1,169 @@ +package ${packageName}.service.impl; + +import java.util.List; +#foreach ($column in $columns) +#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') +import com.ruoyi.common.utils.DateUtils; +#break +#end +#end +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +#if($table.sub) +import java.util.ArrayList; +import com.ruoyi.common.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; +import ${packageName}.domain.${subClassName}; +#end +import ${packageName}.mapper.${ClassName}Mapper; +import ${packageName}.domain.${ClassName}; +import ${packageName}.service.I${ClassName}Service; + +/** + * ${functionName}Service业务层处理 + * + * @author ${author} + * @date ${datetime} + */ +@Service +public class ${ClassName}ServiceImpl implements I${ClassName}Service +{ + @Autowired + private ${ClassName}Mapper ${className}Mapper; + + /** + * 查询${functionName} + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return ${functionName} + */ + @Override + public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) + { + return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); + } + + /** + * 查询${functionName}列表 + * + * @param ${className} ${functionName} + * @return ${functionName} + */ + @Override + public List<${ClassName}> select${ClassName}List(${ClassName} ${className}) + { + return ${className}Mapper.select${ClassName}List(${className}); + } + + /** + * 新增${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ +#if($table.sub) + @Transactional +#end + @Override + public int insert${ClassName}(${ClassName} ${className}) + { +#foreach ($column in $columns) +#if($column.javaField == 'createTime') + ${className}.setCreateTime(DateUtils.getNowDate()); +#end +#end +#if($table.sub) + int rows = ${className}Mapper.insert${ClassName}(${className}); + insert${subClassName}(${className}); + return rows; +#else + return ${className}Mapper.insert${ClassName}(${className}); +#end + } + + /** + * 修改${functionName} + * + * @param ${className} ${functionName} + * @return 结果 + */ +#if($table.sub) + @Transactional +#end + @Override + public int update${ClassName}(${ClassName} ${className}) + { +#foreach ($column in $columns) +#if($column.javaField == 'updateTime') + ${className}.setUpdateTime(DateUtils.getNowDate()); +#end +#end +#if($table.sub) + ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}()); + insert${subClassName}(${className}); +#end + return ${className}Mapper.update${ClassName}(${className}); + } + + /** + * 批量删除${functionName} + * + * @param ${pkColumn.javaField}s 需要删除的${functionName}主键 + * @return 结果 + */ +#if($table.sub) + @Transactional +#end + @Override + public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s) + { +#if($table.sub) + ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); +#end + return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s); + } + + /** + * 删除${functionName}信息 + * + * @param ${pkColumn.javaField} ${functionName}主键 + * @return 结果 + */ +#if($table.sub) + @Transactional +#end + @Override + public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) + { +#if($table.sub) + ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField}); +#end + return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); + } +#if($table.sub) + + /** + * 新增${subTable.functionName}信息 + * + * @param ${className} ${functionName}对象 + */ + public void insert${subClassName}(${ClassName} ${className}) + { + List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List(); + ${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}(); + if (StringUtils.isNotNull(${subclassName}List)) + { + List<${subClassName}> list = new ArrayList<${subClassName}>(); + for (${subClassName} ${subclassName} : ${subclassName}List) + { + ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField}); + list.add(${subclassName}); + } + if (list.size() > 0) + { + ${className}Mapper.batch${subClassName}(list); + } + } + } +#end +} diff --git a/ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm new file mode 100644 index 0000000000000000000000000000000000000000..a3f53ebab9896cd40de0fd40d80153c3d2ba812e --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm @@ -0,0 +1,76 @@ +package ${packageName}.domain; + +#foreach ($import in $subImportList) +import ${import}; +#end +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * ${subTable.functionName}对象 ${subTableName} + * + * @author ${author} + * @date ${datetime} + */ +public class ${subClassName} extends BaseEntity +{ + private static final long serialVersionUID = 1L; + +#foreach ($column in $subTable.columns) +#if(!$table.isSuperColumn($column.javaField)) + /** $column.columnComment */ +#if($column.list) +#set($parentheseIndex=$column.columnComment.indexOf("(")) +#if($parentheseIndex != -1) +#set($comment=$column.columnComment.substring(0, $parentheseIndex)) +#else +#set($comment=$column.columnComment) +#end +#if($parentheseIndex != -1) + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") +#elseif($column.javaType == 'Date') + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") +#else + @Excel(name = "${comment}") +#end +#end + private $column.javaType $column.javaField; + +#end +#end +#foreach ($column in $subTable.columns) +#if(!$table.isSuperColumn($column.javaField)) +#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) +#set($AttrName=$column.javaField) +#else +#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) +#end + public void set${AttrName}($column.javaType $column.javaField) + { + this.$column.javaField = $column.javaField; + } + + public $column.javaType get${AttrName}() + { + return $column.javaField; + } +#end +#end + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) +#foreach ($column in $subTable.columns) +#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) +#set($AttrName=$column.javaField) +#else +#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) +#end + .append("${column.javaField}", get${AttrName}()) +#end + .toString(); + } +} diff --git a/ruoyi-generator/src/main/resources/vm/js/api.js.vm b/ruoyi-generator/src/main/resources/vm/js/api.js.vm new file mode 100644 index 0000000000000000000000000000000000000000..9295524a4b77c5f99b6b7c3f94a90735b3c7c7ab --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/js/api.js.vm @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询${functionName}列表 +export function list${BusinessName}(query) { + return request({ + url: '/${moduleName}/${businessName}/list', + method: 'get', + params: query + }) +} + +// 查询${functionName}详细 +export function get${BusinessName}(${pkColumn.javaField}) { + return request({ + url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, + method: 'get' + }) +} + +// 新增${functionName} +export function add${BusinessName}(data) { + return request({ + url: '/${moduleName}/${businessName}', + method: 'post', + data: data + }) +} + +// 修改${functionName} +export function update${BusinessName}(data) { + return request({ + url: '/${moduleName}/${businessName}', + method: 'put', + data: data + }) +} + +// 删除${functionName} +export function del${BusinessName}(${pkColumn.javaField}) { + return request({ + url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, + method: 'delete' + }) +} diff --git a/ruoyi-generator/src/main/resources/vm/sql/sql.vm b/ruoyi-generator/src/main/resources/vm/sql/sql.vm new file mode 100644 index 0000000000000000000000000000000000000000..057558350ca33f70499732c336a93e0e2d14060d --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/sql/sql.vm @@ -0,0 +1,22 @@ +-- 菜单 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); + +-- 按钮父菜单ID +SELECT @parentId := LAST_INSERT_ID(); + +-- 按钮 SQL +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, ''); + +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, ''); \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm new file mode 100644 index 0000000000000000000000000000000000000000..a4c64a095ee5c805f7fdb52aa879f45661339144 --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -0,0 +1,505 @@ + + + diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm new file mode 100644 index 0000000000000000000000000000000000000000..6296014bced772c4a057c873556b11d8a34b781c --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -0,0 +1,602 @@ + + + diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm new file mode 100644 index 0000000000000000000000000000000000000000..405d7d6a48fa26771dca1be128a5114b545fd2c4 --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm @@ -0,0 +1,475 @@ + + + diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm new file mode 100644 index 0000000000000000000000000000000000000000..8b25665aabaef1300365404913511e8743fdcf97 --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm @@ -0,0 +1,590 @@ + + + diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/readme.txt b/ruoyi-generator/src/main/resources/vm/vue/v3/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..99239bb531458875ed74453d367cb0890b47667f --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/readme.txt @@ -0,0 +1 @@ +ʹõRuoYi-Vue3ǰˣôҪһ´Ŀ¼ģindex.vue.vmindex-tree.vue.vmļϼvueĿ¼ \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm new file mode 100644 index 0000000000000000000000000000000000000000..0ceb3d8592bb14fb5edc1fc0ad3c08fa61af9be6 --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm @@ -0,0 +1,135 @@ + + + + + +#foreach ($column in $columns) + +#end + +#if($table.sub) + + + + + + +#foreach ($column in $subTable.columns) + +#end + +#end + + + select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName} + + + + + + + + insert into ${tableName} + +#foreach($column in $columns) +#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) + $column.columnName, +#end +#end + + +#foreach($column in $columns) +#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) + #{$column.javaField}, +#end +#end + + + + + update ${tableName} + +#foreach($column in $columns) +#if($column.columnName != $pkColumn.columnName) + $column.columnName = #{$column.javaField}, +#end +#end + + where ${pkColumn.columnName} = #{${pkColumn.javaField}} + + + + delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} + + + + delete from ${tableName} where ${pkColumn.columnName} in + + #{${pkColumn.javaField}} + + +#if($table.sub) + + + delete from ${subTableName} where ${subTableFkName} in + + #{${subTableFkclassName}} + + + + + delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} + + + + insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values + + (#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end) + + +#end + \ No newline at end of file diff --git a/ruoyi-quartz/pom.xml b/ruoyi-quartz/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..28f47a0c7019edd48fce35bed9317218f1721238 --- /dev/null +++ b/ruoyi-quartz/pom.xml @@ -0,0 +1,58 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + 4.0.0 + + ruoyi-quartz + + + quartz定时任务 + + + + + + + org.quartz-scheduler + quartz + + + com.mchange + c3p0 + + + + + + + com.ruoyi + ruoyi-common + + + + com.ruoyi + eastcom_yw + + + + com.ruoyi + ruoyi-system + + + com.ruoyi + ruoyi-framework + + + com.ruoyi + ruoyi-sunlm + + + + + \ No newline at end of file diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..a558170c3cb6467e9b1154572b54f7a0fd27f85f --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java @@ -0,0 +1,57 @@ +//package com.ruoyi.quartz.config; +// +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.scheduling.quartz.SchedulerFactoryBean; +//import javax.sql.DataSource; +//import java.util.Properties; +// +///** +// * 定时任务配置(单机部署建议删除此类和qrtz数据库表,默认走内存会最高效) +// * +// * @author ruoyi +// */ +//@Configuration +//public class ScheduleConfig +//{ +// @Bean +// public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) +// { +// SchedulerFactoryBean factory = new SchedulerFactoryBean(); +// factory.setDataSource(dataSource); +// +// // quartz参数 +// Properties prop = new Properties(); +// prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler"); +// prop.put("org.quartz.scheduler.instanceId", "AUTO"); +// // 线程池配置 +// prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool"); +// prop.put("org.quartz.threadPool.threadCount", "20"); +// prop.put("org.quartz.threadPool.threadPriority", "5"); +// // JobStore配置 +// prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore"); +// // 集群配置 +// prop.put("org.quartz.jobStore.isClustered", "true"); +// prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000"); +// prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1"); +// prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true"); +// +// // sqlserver 启用 +// // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?"); +// prop.put("org.quartz.jobStore.misfireThreshold", "12000"); +// prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_"); +// factory.setQuartzProperties(prop); +// +// factory.setSchedulerName("RuoyiScheduler"); +// // 延时启动 +// factory.setStartupDelay(1); +// factory.setApplicationContextSchedulerContextKey("applicationContextKey"); +// // 可选,QuartzScheduler +// // 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 +// factory.setOverwriteExistingJobs(true); +// // 设置自动启动,默认为true +// factory.setAutoStartup(true); +// +// return factory; +// } +//} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java new file mode 100644 index 0000000000000000000000000000000000000000..139361bc600cfbc18c5bf456a7eeec828585ab57 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java @@ -0,0 +1,185 @@ +package com.ruoyi.quartz.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.job.TaskException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.quartz.domain.SysJob; +import com.ruoyi.quartz.service.ISysJobService; +import com.ruoyi.quartz.util.CronUtils; +import com.ruoyi.quartz.util.ScheduleUtils; + +/** + * 调度任务信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/job") +public class SysJobController extends BaseController +{ + @Autowired + private ISysJobService jobService; + + /** + * 查询定时任务列表 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:list')") + @GetMapping("/list") + public TableDataInfo list(SysJob sysJob) + { + startPage(); + List list = jobService.selectJobList(sysJob); + return getDataTable(list); + } + + /** + * 导出定时任务列表 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:export')") + @Log(title = "定时任务", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysJob sysJob) + { + List list = jobService.selectJobList(sysJob); + ExcelUtil util = new ExcelUtil(SysJob.class); + util.exportExcel(response, list, "定时任务"); + } + + /** + * 获取定时任务详细信息 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:query')") + @GetMapping(value = "/{jobId}") + public AjaxResult getInfo(@PathVariable("jobId") Long jobId) + { + return success(jobService.selectJobById(jobId)); + } + + /** + * 新增定时任务 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:add')") + @Log(title = "定时任务", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException + { + if (!CronUtils.isValid(job.getCronExpression())) + { + return error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确"); + } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS })) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规"); + } + else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) + { + return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内"); + } + job.setCreateBy(getUsername()); + return toAjax(jobService.insertJob(job)); + } + + /** + * 修改定时任务 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:edit')") + @Log(title = "定时任务", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException + { + if (!CronUtils.isValid(job.getCronExpression())) + { + return error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确"); + } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS })) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用"); + } + else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规"); + } + else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) + { + return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内"); + } + job.setUpdateBy(getUsername()); + return toAjax(jobService.updateJob(job)); + } + + /** + * 定时任务状态修改 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") + @Log(title = "定时任务", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException + { + SysJob newJob = jobService.selectJobById(job.getJobId()); + newJob.setStatus(job.getStatus()); + return toAjax(jobService.changeStatus(newJob)); + } + + /** + * 定时任务立即执行一次 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") + @Log(title = "定时任务", businessType = BusinessType.UPDATE) + @PutMapping("/run") + public AjaxResult run(@RequestBody SysJob job) throws SchedulerException + { + boolean result = jobService.run(job); + return result ? success() : error("任务不存在或已过期!"); + } + + /** + * 删除定时任务 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:remove')") + @Log(title = "定时任务", businessType = BusinessType.DELETE) + @DeleteMapping("/{jobIds}") + public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException + { + jobService.deleteJobByIds(jobIds); + return success(); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java new file mode 100644 index 0000000000000000000000000000000000000000..62ecbab219e46a824b23c3e40f690a4c4a90c8a4 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java @@ -0,0 +1,92 @@ +package com.ruoyi.quartz.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.quartz.domain.SysJobLog; +import com.ruoyi.quartz.service.ISysJobLogService; + +/** + * 调度日志操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/jobLog") +public class SysJobLogController extends BaseController +{ + @Autowired + private ISysJobLogService jobLogService; + + /** + * 查询定时任务调度日志列表 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:list')") + @GetMapping("/list") + public TableDataInfo list(SysJobLog sysJobLog) + { + startPage(); + List list = jobLogService.selectJobLogList(sysJobLog); + return getDataTable(list); + } + + /** + * 导出定时任务调度日志列表 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:export')") + @Log(title = "任务调度日志", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysJobLog sysJobLog) + { + List list = jobLogService.selectJobLogList(sysJobLog); + ExcelUtil util = new ExcelUtil(SysJobLog.class); + util.exportExcel(response, list, "调度日志"); + } + + /** + * 根据调度编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:query')") + @GetMapping(value = "/{jobLogId}") + public AjaxResult getInfo(@PathVariable Long jobLogId) + { + return success(jobLogService.selectJobLogById(jobLogId)); + } + + + /** + * 删除定时任务调度日志 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:remove')") + @Log(title = "定时任务调度日志", businessType = BusinessType.DELETE) + @DeleteMapping("/{jobLogIds}") + public AjaxResult remove(@PathVariable Long[] jobLogIds) + { + return toAjax(jobLogService.deleteJobLogByIds(jobLogIds)); + } + + /** + * 清空定时任务调度日志 + */ + @PreAuthorize("@ss.hasPermi('monitor:job:remove')") + @Log(title = "调度日志", businessType = BusinessType.CLEAN) + @DeleteMapping("/clean") + public AjaxResult clean() + { + jobLogService.cleanJobLog(); + return success(); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java new file mode 100644 index 0000000000000000000000000000000000000000..1f49695910001584573a48815365a05574861e13 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java @@ -0,0 +1,171 @@ +package com.ruoyi.quartz.domain; + +import java.util.Date; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.constant.ScheduleConstants; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.quartz.util.CronUtils; + +/** + * 定时任务调度表 sys_job + * + * @author ruoyi + */ +public class SysJob extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 任务ID */ + @Excel(name = "任务序号", cellType = ColumnType.NUMERIC) + private Long jobId; + + /** 任务名称 */ + @Excel(name = "任务名称") + private String jobName; + + /** 任务组名 */ + @Excel(name = "任务组名") + private String jobGroup; + + /** 调用目标字符串 */ + @Excel(name = "调用目标字符串") + private String invokeTarget; + + /** cron执行表达式 */ + @Excel(name = "执行表达式 ") + private String cronExpression; + + /** cron计划策略 */ + @Excel(name = "计划策略 ", readConverterExp = "0=默认,1=立即触发执行,2=触发一次执行,3=不触发立即执行") + private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT; + + /** 是否并发执行(0允许 1禁止) */ + @Excel(name = "并发执行", readConverterExp = "0=允许,1=禁止") + private String concurrent; + + /** 任务状态(0正常 1暂停) */ + @Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停") + private String status; + + public Long getJobId() + { + return jobId; + } + + public void setJobId(Long jobId) + { + this.jobId = jobId; + } + + @NotBlank(message = "任务名称不能为空") + @Size(min = 0, max = 64, message = "任务名称不能超过64个字符") + public String getJobName() + { + return jobName; + } + + public void setJobName(String jobName) + { + this.jobName = jobName; + } + + public String getJobGroup() + { + return jobGroup; + } + + public void setJobGroup(String jobGroup) + { + this.jobGroup = jobGroup; + } + + @NotBlank(message = "调用目标字符串不能为空") + @Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符") + public String getInvokeTarget() + { + return invokeTarget; + } + + public void setInvokeTarget(String invokeTarget) + { + this.invokeTarget = invokeTarget; + } + + @NotBlank(message = "Cron执行表达式不能为空") + @Size(min = 0, max = 255, message = "Cron执行表达式不能超过255个字符") + public String getCronExpression() + { + return cronExpression; + } + + public void setCronExpression(String cronExpression) + { + this.cronExpression = cronExpression; + } + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + public Date getNextValidTime() + { + if (StringUtils.isNotEmpty(cronExpression)) + { + return CronUtils.getNextExecution(cronExpression); + } + return null; + } + + public String getMisfirePolicy() + { + return misfirePolicy; + } + + public void setMisfirePolicy(String misfirePolicy) + { + this.misfirePolicy = misfirePolicy; + } + + public String getConcurrent() + { + return concurrent; + } + + public void setConcurrent(String concurrent) + { + this.concurrent = concurrent; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("jobId", getJobId()) + .append("jobName", getJobName()) + .append("jobGroup", getJobGroup()) + .append("cronExpression", getCronExpression()) + .append("nextValidTime", getNextValidTime()) + .append("misfirePolicy", getMisfirePolicy()) + .append("concurrent", getConcurrent()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java new file mode 100644 index 0000000000000000000000000000000000000000..121c03594e9f9e4de9012157f196411becb97645 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java @@ -0,0 +1,155 @@ +package com.ruoyi.quartz.domain; + +import java.util.Date; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 定时任务调度日志表 sys_job_log + * + * @author ruoyi + */ +public class SysJobLog extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + @Excel(name = "日志序号") + private Long jobLogId; + + /** 任务名称 */ + @Excel(name = "任务名称") + private String jobName; + + /** 任务组名 */ + @Excel(name = "任务组名") + private String jobGroup; + + /** 调用目标字符串 */ + @Excel(name = "调用目标字符串") + private String invokeTarget; + + /** 日志信息 */ + @Excel(name = "日志信息") + private String jobMessage; + + /** 执行状态(0正常 1失败) */ + @Excel(name = "执行状态", readConverterExp = "0=正常,1=失败") + private String status; + + /** 异常信息 */ + @Excel(name = "异常信息") + private String exceptionInfo; + + /** 开始时间 */ + private Date startTime; + + /** 停止时间 */ + private Date stopTime; + + public Long getJobLogId() + { + return jobLogId; + } + + public void setJobLogId(Long jobLogId) + { + this.jobLogId = jobLogId; + } + + public String getJobName() + { + return jobName; + } + + public void setJobName(String jobName) + { + this.jobName = jobName; + } + + public String getJobGroup() + { + return jobGroup; + } + + public void setJobGroup(String jobGroup) + { + this.jobGroup = jobGroup; + } + + public String getInvokeTarget() + { + return invokeTarget; + } + + public void setInvokeTarget(String invokeTarget) + { + this.invokeTarget = invokeTarget; + } + + public String getJobMessage() + { + return jobMessage; + } + + public void setJobMessage(String jobMessage) + { + this.jobMessage = jobMessage; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getExceptionInfo() + { + return exceptionInfo; + } + + public void setExceptionInfo(String exceptionInfo) + { + this.exceptionInfo = exceptionInfo; + } + + public Date getStartTime() + { + return startTime; + } + + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getStopTime() + { + return stopTime; + } + + public void setStopTime(Date stopTime) + { + this.stopTime = stopTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("jobLogId", getJobLogId()) + .append("jobName", getJobName()) + .append("jobGroup", getJobGroup()) + .append("jobMessage", getJobMessage()) + .append("status", getStatus()) + .append("exceptionInfo", getExceptionInfo()) + .append("startTime", getStartTime()) + .append("stopTime", getStopTime()) + .toString(); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..46d80c343adf280240bfe9a1c2520ed43f93ed06 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java @@ -0,0 +1,67 @@ +package com.ruoyi.quartz.mapper; + +import java.util.List; +import com.ruoyi.quartz.domain.SysJobLog; + +/** + * 调度任务日志信息 数据层 + * + * @author ruoyi + */ +public interface SysJobLogMapper +{ + /** + * 获取quartz调度器日志的计划任务 + * + * @param jobLog 调度日志信息 + * @return 调度任务日志集合 + */ + public List selectJobLogList(SysJobLog jobLog); + + /** + * 查询所有调度任务日志 + * + * @return 调度任务日志列表 + */ + public List selectJobLogAll(); + + /** + * 通过调度任务日志ID查询调度信息 + * + * @param jobLogId 调度任务日志ID + * @return 调度任务日志对象信息 + */ + public SysJobLog selectJobLogById(Long jobLogId); + + /** + * 新增任务日志 + * + * @param jobLog 调度日志信息 + * @return 结果 + */ + public int insertJobLog(SysJobLog jobLog); + + /** + * 批量删除调度日志信息 + * + * @param logIds 需要删除的数据ID + * @return 结果 + */ + public int deleteJobLogByIds(Long[] logIds); + + /** + * 删除任务日志 + * + * @param jobId 调度日志ID + * @return 结果 + */ + public int deleteJobLogById(Long jobId); + + + public int deleteJobLogSchedule(); + + /** + * 清空任务日志 + */ + public void cleanJobLog(); +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..20f45dbb6e9a51aee9af27a717f467a90c865490 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java @@ -0,0 +1,67 @@ +package com.ruoyi.quartz.mapper; + +import java.util.List; +import com.ruoyi.quartz.domain.SysJob; + +/** + * 调度任务信息 数据层 + * + * @author ruoyi + */ +public interface SysJobMapper +{ + /** + * 查询调度任务日志集合 + * + * @param job 调度信息 + * @return 操作日志集合 + */ + public List selectJobList(SysJob job); + + /** + * 查询所有调度任务 + * + * @return 调度任务列表 + */ + public List selectJobAll(); + + /** + * 通过调度ID查询调度任务信息 + * + * @param jobId 调度ID + * @return 角色对象信息 + */ + public SysJob selectJobById(Long jobId); + + /** + * 通过调度ID删除调度任务信息 + * + * @param jobId 调度ID + * @return 结果 + */ + public int deleteJobById(Long jobId); + + /** + * 批量删除调度任务信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteJobByIds(Long[] ids); + + /** + * 修改调度任务信息 + * + * @param job 调度任务信息 + * @return 结果 + */ + public int updateJob(SysJob job); + + /** + * 新增调度任务信息 + * + * @param job 调度任务信息 + * @return 结果 + */ + public int insertJob(SysJob job); +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..8546792a7a5daf711d9eab55c3e5341b9f351e04 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobLogService.java @@ -0,0 +1,56 @@ +package com.ruoyi.quartz.service; + +import java.util.List; +import com.ruoyi.quartz.domain.SysJobLog; + +/** + * 定时任务调度日志信息信息 服务层 + * + * @author ruoyi + */ +public interface ISysJobLogService +{ + /** + * 获取quartz调度器日志的计划任务 + * + * @param jobLog 调度日志信息 + * @return 调度任务日志集合 + */ + public List selectJobLogList(SysJobLog jobLog); + + /** + * 通过调度任务日志ID查询调度信息 + * + * @param jobLogId 调度任务日志ID + * @return 调度任务日志对象信息 + */ + public SysJobLog selectJobLogById(Long jobLogId); + + /** + * 新增任务日志 + * + * @param jobLog 调度日志信息 + */ + public void addJobLog(SysJobLog jobLog); + + /** + * 批量删除调度日志信息 + * + * @param logIds 需要删除的日志ID + * @return 结果 + */ + public int deleteJobLogByIds(Long[] logIds); + + /** + * 删除任务日志 + * + * @param jobId 调度日志ID + * @return 结果 + */ + public int deleteJobLogById(Long jobId); + + /** + * 清空任务日志 + */ + public void cleanJobLog(); +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java new file mode 100644 index 0000000000000000000000000000000000000000..437ade82b5c08d47a016c6fc2532719c03050a76 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java @@ -0,0 +1,102 @@ +package com.ruoyi.quartz.service; + +import java.util.List; +import org.quartz.SchedulerException; +import com.ruoyi.common.exception.job.TaskException; +import com.ruoyi.quartz.domain.SysJob; + +/** + * 定时任务调度信息信息 服务层 + * + * @author ruoyi + */ +public interface ISysJobService +{ + /** + * 获取quartz调度器的计划任务 + * + * @param job 调度信息 + * @return 调度任务集合 + */ + public List selectJobList(SysJob job); + + /** + * 通过调度任务ID查询调度信息 + * + * @param jobId 调度任务ID + * @return 调度任务对象信息 + */ + public SysJob selectJobById(Long jobId); + + /** + * 暂停任务 + * + * @param job 调度信息 + * @return 结果 + */ + public int pauseJob(SysJob job) throws SchedulerException; + + /** + * 恢复任务 + * + * @param job 调度信息 + * @return 结果 + */ + public int resumeJob(SysJob job) throws SchedulerException; + + /** + * 删除任务后,所对应的trigger也将被删除 + * + * @param job 调度信息 + * @return 结果 + */ + public int deleteJob(SysJob job) throws SchedulerException; + + /** + * 批量删除调度信息 + * + * @param jobIds 需要删除的任务ID + * @return 结果 + */ + public void deleteJobByIds(Long[] jobIds) throws SchedulerException; + + /** + * 任务调度状态修改 + * + * @param job 调度信息 + * @return 结果 + */ + public int changeStatus(SysJob job) throws SchedulerException; + + /** + * 立即运行任务 + * + * @param job 调度信息 + * @return 结果 + */ + public boolean run(SysJob job) throws SchedulerException; + + /** + * 新增任务 + * + * @param job 调度信息 + * @return 结果 + */ + public int insertJob(SysJob job) throws SchedulerException, TaskException; + + /** + * 更新任务 + * + * @param job 调度信息 + * @return 结果 + */ + public int updateJob(SysJob job) throws SchedulerException, TaskException; + + /** + * 校验cron表达式是否有效 + * + * @param cronExpression 表达式 + * @return 结果 + */ + public boolean checkCronExpressionIsValid(String cronExpression); +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..812eed77f3898b5fbd81414d60b954e3433f79a6 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java @@ -0,0 +1,87 @@ +package com.ruoyi.quartz.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.quartz.domain.SysJobLog; +import com.ruoyi.quartz.mapper.SysJobLogMapper; +import com.ruoyi.quartz.service.ISysJobLogService; + +/** + * 定时任务调度日志信息 服务层 + * + * @author ruoyi + */ +@Service +public class SysJobLogServiceImpl implements ISysJobLogService +{ + @Autowired + private SysJobLogMapper jobLogMapper; + + /** + * 获取quartz调度器日志的计划任务 + * + * @param jobLog 调度日志信息 + * @return 调度任务日志集合 + */ + @Override + public List selectJobLogList(SysJobLog jobLog) + { + return jobLogMapper.selectJobLogList(jobLog); + } + + /** + * 通过调度任务日志ID查询调度信息 + * + * @param jobLogId 调度任务日志ID + * @return 调度任务日志对象信息 + */ + @Override + public SysJobLog selectJobLogById(Long jobLogId) + { + return jobLogMapper.selectJobLogById(jobLogId); + } + + /** + * 新增任务日志 + * + * @param jobLog 调度日志信息 + */ + @Override + public void addJobLog(SysJobLog jobLog) + { + jobLogMapper.insertJobLog(jobLog); + } + + /** + * 批量删除调度日志信息 + * + * @param logIds 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteJobLogByIds(Long[] logIds) + { + return jobLogMapper.deleteJobLogByIds(logIds); + } + + /** + * 删除任务日志 + * + * @param jobId 调度日志ID + */ + @Override + public int deleteJobLogById(Long jobId) + { + return jobLogMapper.deleteJobLogById(jobId); + } + + /** + * 清空任务日志 + */ + @Override + public void cleanJobLog() + { + jobLogMapper.cleanJobLog(); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..55bfdae396cd8c20c0971e4ee8809c4929c064b3 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java @@ -0,0 +1,266 @@ +package com.ruoyi.quartz.service.impl; + +import java.util.List; +import javax.annotation.PostConstruct; +import org.quartz.JobDataMap; +import org.quartz.JobKey; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.ruoyi.common.constant.ScheduleConstants; +import com.ruoyi.common.exception.job.TaskException; +import com.ruoyi.quartz.domain.SysJob; +import com.ruoyi.quartz.mapper.SysJobMapper; +import com.ruoyi.quartz.service.ISysJobService; +import com.ruoyi.quartz.util.CronUtils; +import com.ruoyi.quartz.util.ScheduleUtils; + +/** + * 定时任务调度信息 服务层 + * + * @author ruoyi + */ +@Service +public class SysJobServiceImpl implements ISysJobService +{ + @Autowired + private Scheduler scheduler; + + @Autowired + private SysJobMapper jobMapper; + + @Value("${job.enabled}") + private boolean enabled; + + /** + * 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据) + */ + @PostConstruct + public void init() throws SchedulerException, TaskException + { + if(enabled) { + scheduler.clear(); + List jobList = jobMapper.selectJobAll(); + for (SysJob job : jobList) { + ScheduleUtils.createScheduleJob(scheduler, job); + } + } + } + + /** + * 获取quartz调度器的计划任务列表 + * + * @param job 调度信息 + * @return + */ + @Override + public List selectJobList(SysJob job) + { + return jobMapper.selectJobList(job); + } + + /** + * 通过调度任务ID查询调度信息 + * + * @param jobId 调度任务ID + * @return 调度任务对象信息 + */ + @Override + public SysJob selectJobById(Long jobId) + { + return jobMapper.selectJobById(jobId); + } + + /** + * 暂停任务 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int pauseJob(SysJob job) throws SchedulerException + { + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); + int rows = jobMapper.updateJob(job); + if (rows > 0) + { + scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); + } + return rows; + } + + /** + * 恢复任务 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int resumeJob(SysJob job) throws SchedulerException + { + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + job.setStatus(ScheduleConstants.Status.NORMAL.getValue()); + int rows = jobMapper.updateJob(job); + if (rows > 0) + { + scheduler.resumeJob(ScheduleUtils.getJobKey(jobId, jobGroup)); + } + return rows; + } + + /** + * 删除任务后,所对应的trigger也将被删除 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int deleteJob(SysJob job) throws SchedulerException + { + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + int rows = jobMapper.deleteJobById(jobId); + if (rows > 0) + { + scheduler.deleteJob(ScheduleUtils.getJobKey(jobId, jobGroup)); + } + return rows; + } + + /** + * 批量删除调度信息 + * + * @param jobIds 需要删除的任务ID + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteJobByIds(Long[] jobIds) throws SchedulerException + { + for (Long jobId : jobIds) + { + SysJob job = jobMapper.selectJobById(jobId); + deleteJob(job); + } + } + + /** + * 任务调度状态修改 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int changeStatus(SysJob job) throws SchedulerException + { + int rows = 0; + String status = job.getStatus(); + if (ScheduleConstants.Status.NORMAL.getValue().equals(status)) + { + rows = resumeJob(job); + } + else if (ScheduleConstants.Status.PAUSE.getValue().equals(status)) + { + rows = pauseJob(job); + } + return rows; + } + + /** + * 立即运行任务 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean run(SysJob job) throws SchedulerException + { + boolean result = false; + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + SysJob properties = selectJobById(job.getJobId()); + // 参数 + JobDataMap dataMap = new JobDataMap(); + dataMap.put(ScheduleConstants.TASK_PROPERTIES, properties); + JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup); + if (scheduler.checkExists(jobKey)) + { + result = true; + scheduler.triggerJob(jobKey, dataMap); + } + return result; + } + + /** + * 新增任务 + * + * @param job 调度信息 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertJob(SysJob job) throws SchedulerException, TaskException + { + job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); + int rows = jobMapper.insertJob(job); + if (rows > 0) + { + ScheduleUtils.createScheduleJob(scheduler, job); + } + return rows; + } + + /** + * 更新任务的时间表达式 + * + * @param job 调度信息 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int updateJob(SysJob job) throws SchedulerException, TaskException + { + SysJob properties = selectJobById(job.getJobId()); + int rows = jobMapper.updateJob(job); + if (rows > 0) + { + updateSchedulerJob(job, properties.getJobGroup()); + } + return rows; + } + + /** + * 更新任务 + * + * @param job 任务对象 + * @param jobGroup 任务组名 + */ + public void updateSchedulerJob(SysJob job, String jobGroup) throws SchedulerException, TaskException + { + Long jobId = job.getJobId(); + // 判断是否存在 + JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup); + if (scheduler.checkExists(jobKey)) + { + // 防止创建时存在数据问题 先移除,然后在执行创建操作 + scheduler.deleteJob(jobKey); + } + ScheduleUtils.createScheduleJob(scheduler, job); + } + + /** + * 校验cron表达式是否有效 + * + * @param cronExpression 表达式 + * @return 结果 + */ + @Override + public boolean checkCronExpressionIsValid(String cronExpression) + { + return CronUtils.isValid(cronExpression); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java new file mode 100644 index 0000000000000000000000000000000000000000..a05d702b0b47c0f7000de2118c7db1de93521728 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java @@ -0,0 +1,223 @@ +package com.ruoyi.quartz.task; + +import cn.hutool.core.date.LocalDateTimeUtil; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.mapper.YwSignLogMapper; +import com.ruoyi.eastcom_yw.mapper.YwSignPlanMapper; +import com.ruoyi.eastcom_yw.service.*; +import com.ruoyi.quartz.mapper.SysJobLogMapper; +import com.ruoyi.sunlm.service.YwDpNewYayunService; +import com.ruoyi.sunlm.service.dpAllMyServices; +import com.ruoyi.system.mapper.SysLogininforMapper; +import com.ruoyi.system.mapper.SysOperLogMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 定时任务调度测试 + * + * @author ruoyi + */ +@Component("ryTask") +//@Profile("other") +public class RyTask { + + @Autowired + private YwAlarmService ywAlarmService; + @Autowired + private YwAlarmViewService ywAlarmViewService; + + @Autowired + private YwRoutInspectPlanService ywRoutInspectPlanService; + + @Autowired + private yw_alarm_deal_logService alarm_deal_logService; + + @Autowired + private YwAlarmHangupLogService ywAlarmHangupLogService; + + @Autowired + private YwSignLogMapper ywSignLogMapper; + + @Autowired + private YwSignPlanMapper ywSignPlanMapper; + + @Autowired + private SysNoticeService sysNoticeService; + + @Autowired + private YwNoticeBriefingService noticeBriefingService; + + @Autowired + private YwNoticeHandworkService ywNoticeHandworkService; + + @Autowired + private YwScenePictureService ywScenePictureService; + + @Autowired + private YwSceneTestDataService ywSceneTestDataService; + + @Autowired + private YwDpNewYayunService ywDpNewYayunService; + + @Autowired + private dpAllMyServices DpAllMyServices; + + @Autowired + private SysJobLogMapper sysJobLogMapper; + + @Autowired + private SysOperLogMapper sysOperLogMapper; + + @Autowired + private SysLogininforMapper sysLogininforMapper; + + public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { + System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); + } + + public void ryParams(String params) { + System.out.println("执行有参方法:" + params); + } + + public void ryNoParams() { + System.out.println("执行无参方法"); + } + + public void eastcomYwAlarmSchedule() { + + ywAlarmViewService.insert_alarm_schedule(); + + ywAlarmViewService.insert_alarmNotice_schedule(); + + //定时器实现更新LOG表的恢复时间,但是新告警不会变成重新需要处理 + alarm_deal_logService.updateEndTime(); + } + + public void eastcomYwAlarmNoticeSchedule() { + ywAlarmService.YwAlarmAutoRecover(); + } + + public void eastcomYwAlarmStatisticsSchedule() { + ywScenePictureService.generateAlarmStatisticsEvery5Minutes(); + } + + public void eastcomYwSceneTestDataSchedule() { + ywSceneTestDataService.insertTestData(); + } + + public void eastcomYwSignLogSchedule() { + ywSignLogMapper.deleteSignLogToday(); + ywSignLogMapper.AssignSignLog(); + } + + public void eastcomYwAlarmRecoverSchedule() { + ywAlarmService.YwAlarmAutoRecover(); + } + + public void eastcomYwSignRemindSchedule() { + + ywSignPlanMapper.getSignRemindList().forEach( + + ywSignRemind -> { + + SysNotice notice = new SysNotice(); + notice.setNoticeType(ywSignRemind.getNoticeType()); + notice.setStatus("0"); + notice.setCreateBy("sys"); + notice.setNoticeTitle(ywSignRemind.getNoticeTitle()); + notice.setNoticeContent(ywSignRemind.getNoticeContent()); + notice.setReciveUser(ywSignRemind.getUserId()); + notice.setCreateTime(LocalDateTimeUtil.now()); + //notice.setSendTime(ywSignRemind.getRemindTime()); + notice.setReciveUserPhone(ywSignRemind.getPhoneNumber()); + //计划发送时间 当前时间立即发送 + notice.setExpSendTime(LocalDateTimeUtil.of(ywSignRemind.getRemindTime())); + //加入定时任务标记 初始0 + notice.setAddFlag("0"); + + sysNoticeService.saveOrUpdate(notice); + + } + ); + } + + + public void eastcomYwInspectPlanSchedule() { + ywRoutInspectPlanService.insetInspectSchedule(); + } + +// public void eastcomYwSendSMSSchedule() { +// sysNoticeService.eastcomYwSendSMSSchedule(); +// } + + public void newEastcomYwSendSMSSchedule() { + sysNoticeService.newEastcomYwSendSMSSchedule(); + } + + public void eastcomYwSendBriefingSchedule() { + noticeBriefingService.eastcomYwSendBriefingSchedule(); + } + + public void eastcomYwSendAlarmBriefingSchedule() { + ywAlarmService.eastcomYwSendAlarmBriefingSchedule(); + } + + public void eastcomYwUpdateBriefingSendTypeSchedule() { + noticeBriefingService.eastcomYwUpdateBriefingSendTypeSchedule(); + } + + public void eastcomSelectPassAndAddNoticeSchedule() { + ywNoticeHandworkService.eastcomSelectPassAndAddNoticeSchedule(); + } + + public void eastcomUpdateTransAlarmsSchedule() { + ywDpNewYayunService.eastcomUpdateTransAlarmsSchedule(); + } + + public void eastcomUpdateComprehensiveManageSchedule() { + ywDpNewYayunService.eastcomUpdateComprehensiveManageSchedule(); + } + + public void eastcomUpdateNetAlarmsSchedule() { + ywDpNewYayunService.eastcomUpdateNetAlarmsSchedule(); + } + + + //---------------------------------------------sunlm 2023-07-19, 定时计算后保存到缓存 + public void AutoStatisticsforDPSchedule_1min() { + + DpAllMyServices.get_wireless_outservice(); + DpAllMyServices.get_trans_counts(); + DpAllMyServices.get_dict_counts(); + DpAllMyServices.get_agis_internet_counts(); + DpAllMyServices.get_maps_all_alarms(); + DpAllMyServices.get_maps_wireless_kpi_min(); + DpAllMyServices.get_maps_all_alarms_popup(); + DpAllMyServices.get_maps_wireless_alarms_popup(); + DpAllMyServices.get_spot_wirelessalarms_popup(); + //---------------------------------------DICT + DpAllMyServices.get_dict_monitor_project_list(); + DpAllMyServices.get_dict_monitor_alarm_list(); + DpAllMyServices.get_dict_link_alarm_list(); + DpAllMyServices.get_dict_map_alarm_list(); + } + + public void AutoStatisticsforDPSchedule_5min() { + DpAllMyServices.get_gbflow_wireless(); + DpAllMyServices.get_manage_counts(); + DpAllMyServices.get_gbflow_huanlu(); + DpAllMyServices.get_maps_wireless_kpi_cell(); + } +//------------------------------------------------------------------------------ + + public void deleteLog() + { + sysJobLogMapper.deleteJobLogSchedule(); + sysLogininforMapper.deleteLogininforSchedule(); + sysOperLogMapper.deleteOperLogSchedule(); + } + + +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java new file mode 100644 index 0000000000000000000000000000000000000000..f11984d12c700290bdc0c47bbdd0143662ed1780 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java @@ -0,0 +1,145 @@ +package com.ruoyi.quartz.util; + +import cn.hutool.core.date.LocalDateTimeUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.ScheduleConstants; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ExceptionUtil; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.eastcom_yw.domain.SysNotice; +import com.ruoyi.eastcom_yw.service.SysNoticeService; +import com.ruoyi.quartz.domain.SysJob; +import com.ruoyi.quartz.domain.SysJobLog; +import com.ruoyi.quartz.service.ISysJobLogService; +import com.ruoyi.system.service.ISysUserService; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Date; +import java.util.List; + +/** + * 抽象quartz调用 + * + * @author ruoyi + */ +public abstract class AbstractQuartzJob implements Job +{ + private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class); + + /** + * 线程本地变量 + */ + private static ThreadLocal threadLocal = new ThreadLocal<>(); + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException + { + SysJob sysJob = new SysJob(); + BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES)); + try + { + before(context, sysJob); + if (sysJob != null) + { + doExecute(context, sysJob); + } + after(context, sysJob, null); + } + catch (Exception e) + { + log.error("任务执行异常 - :", e); + after(context, sysJob, e); + } + } + + /** + * 执行前 + * + * @param context 工作执行上下文对象 + * @param sysJob 系统计划任务 + */ + protected void before(JobExecutionContext context, SysJob sysJob) + { + threadLocal.set(new Date()); + } + + /** + * 执行后 + * + * @param context 工作执行上下文对象 + * @param sysJob 系统计划任务 + */ + protected void after(JobExecutionContext context, SysJob sysJob, Exception e) + { + Date startTime = threadLocal.get(); + threadLocal.remove(); + + final SysJobLog sysJobLog = new SysJobLog(); + sysJobLog.setJobName(sysJob.getJobName()); + sysJobLog.setJobGroup(sysJob.getJobGroup()); + sysJobLog.setInvokeTarget(sysJob.getInvokeTarget()); + sysJobLog.setStartTime(startTime); + sysJobLog.setStopTime(new Date()); + long runMs = sysJobLog.getStopTime().getTime() - sysJobLog.getStartTime().getTime(); + sysJobLog.setJobMessage(sysJobLog.getJobName() + " 总共耗时:" + runMs + "毫秒"); + if (e != null) + { + sysJobLog.setStatus(Constants.FAIL); + String errorMsg = StringUtils.substring(ExceptionUtil.getExceptionMessage(e), 0, 2000); + sysJobLog.setExceptionInfo(errorMsg); + + + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.ge(SysNotice::getCreateTime,LocalDateTimeUtil.of(DateUtils.getNowDate()).minusHours(1L)); + query.likeRight(SysNotice::getNoticeContent,sysJob.getJobName()); +// query.eq(SysNotice::getStatus,"0"); + //相同JOB异常1小时内是否已经发送过 + List list = SpringUtils.getBean(SysNoticeService.class).getBaseMapper().selectList(query); + if(list.isEmpty()) { + //发送管理员的手机号码 + SysUser user = SpringUtils.getBean(ISysUserService.class).selectUserById(1L); + if (user != null) { + //任务调度失败,发送到sys_notice提醒 + SysNotice notice = new SysNotice(); + notice.setNoticeType("3"); + notice.setStatus("0"); + notice.setCreateBy("sys"); + notice.setNoticeTitle("中小屏后端定时器监控"); + notice.setNoticeContent(sysJob.getJobName() + " 执行异常,异常原因:" + errorMsg); + notice.setReciveUser(1L); + notice.setCreateTime(LocalDateTimeUtil.now()); + notice.setReciveUserPhone(user.getPhonenumber()); + //计划发送时间 当前时间立即发送 + notice.setExpSendTime(LocalDateTimeUtil.of(DateUtils.getNowDate())); + //加入定时任务标记 初始0 + notice.setAddFlag("0"); + SpringUtils.getBean(SysNoticeService.class).saveOrUpdate(notice); + } + } + } + else + { + sysJobLog.setStatus(Constants.SUCCESS); + } + + // 写入数据库当中 + SpringUtils.getBean(ISysJobLogService.class).addJobLog(sysJobLog); + } + + /** + * 执行方法,由子类重载 + * + * @param context 工作执行上下文对象 + * @param sysJob 系统计划任务 + * @throws Exception 执行过程中的异常 + */ + protected abstract void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception; +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CronUtils.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CronUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..dd53839791b89b85a390c140ad84cc322043f87a --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/CronUtils.java @@ -0,0 +1,63 @@ +package com.ruoyi.quartz.util; + +import java.text.ParseException; +import java.util.Date; +import org.quartz.CronExpression; + +/** + * cron表达式工具类 + * + * @author ruoyi + * + */ +public class CronUtils +{ + /** + * 返回一个布尔值代表一个给定的Cron表达式的有效性 + * + * @param cronExpression Cron表达式 + * @return boolean 表达式是否有效 + */ + public static boolean isValid(String cronExpression) + { + return CronExpression.isValidExpression(cronExpression); + } + + /** + * 返回一个字符串值,表示该消息无效Cron表达式给出有效性 + * + * @param cronExpression Cron表达式 + * @return String 无效时返回表达式错误描述,如果有效返回null + */ + public static String getInvalidMessage(String cronExpression) + { + try + { + new CronExpression(cronExpression); + return null; + } + catch (ParseException pe) + { + return pe.getMessage(); + } + } + + /** + * 返回下一个执行时间根据给定的Cron表达式 + * + * @param cronExpression Cron表达式 + * @return Date 下次Cron表达式执行时间 + */ + public static Date getNextExecution(String cronExpression) + { + try + { + CronExpression cron = new CronExpression(cronExpression); + return cron.getNextValidTimeAfter(new Date(System.currentTimeMillis())); + } + catch (ParseException e) + { + throw new IllegalArgumentException(e.getMessage()); + } + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..3da377ad08510e8e8871c1e083604ed3dbee1611 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java @@ -0,0 +1,182 @@ +package com.ruoyi.quartz.util; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.LinkedList; +import java.util.List; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.quartz.domain.SysJob; + +/** + * 任务执行工具 + * + * @author ruoyi + */ +public class JobInvokeUtil +{ + /** + * 执行方法 + * + * @param sysJob 系统任务 + */ + public static void invokeMethod(SysJob sysJob) throws Exception + { + String invokeTarget = sysJob.getInvokeTarget(); + String beanName = getBeanName(invokeTarget); + String methodName = getMethodName(invokeTarget); + List methodParams = getMethodParams(invokeTarget); + + if (!isValidClassName(beanName)) + { + Object bean = SpringUtils.getBean(beanName); + invokeMethod(bean, methodName, methodParams); + } + else + { + Object bean = Class.forName(beanName).newInstance(); + invokeMethod(bean, methodName, methodParams); + } + } + + /** + * 调用任务方法 + * + * @param bean 目标对象 + * @param methodName 方法名称 + * @param methodParams 方法参数 + */ + private static void invokeMethod(Object bean, String methodName, List methodParams) + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException + { + if (StringUtils.isNotNull(methodParams) && methodParams.size() > 0) + { + Method method = bean.getClass().getMethod(methodName, getMethodParamsType(methodParams)); + method.invoke(bean, getMethodParamsValue(methodParams)); + } + else + { + Method method = bean.getClass().getMethod(methodName); + method.invoke(bean); + } + } + + /** + * 校验是否为为class包名 + * + * @param invokeTarget 名称 + * @return true是 false否 + */ + public static boolean isValidClassName(String invokeTarget) + { + return StringUtils.countMatches(invokeTarget, ".") > 1; + } + + /** + * 获取bean名称 + * + * @param invokeTarget 目标字符串 + * @return bean名称 + */ + public static String getBeanName(String invokeTarget) + { + String beanName = StringUtils.substringBefore(invokeTarget, "("); + return StringUtils.substringBeforeLast(beanName, "."); + } + + /** + * 获取bean方法 + * + * @param invokeTarget 目标字符串 + * @return method方法 + */ + public static String getMethodName(String invokeTarget) + { + String methodName = StringUtils.substringBefore(invokeTarget, "("); + return StringUtils.substringAfterLast(methodName, "."); + } + + /** + * 获取method方法参数相关列表 + * + * @param invokeTarget 目标字符串 + * @return method方法相关参数列表 + */ + public static List getMethodParams(String invokeTarget) + { + String methodStr = StringUtils.substringBetween(invokeTarget, "(", ")"); + if (StringUtils.isEmpty(methodStr)) + { + return null; + } + String[] methodParams = methodStr.split(",(?=([^\"']*[\"'][^\"']*[\"'])*[^\"']*$)"); + List classs = new LinkedList<>(); + for (int i = 0; i < methodParams.length; i++) + { + String str = StringUtils.trimToEmpty(methodParams[i]); + // String字符串类型,以'或"开头 + if (StringUtils.startsWithAny(str, "'", "\"")) + { + classs.add(new Object[] { StringUtils.substring(str, 1, str.length() - 1), String.class }); + } + // boolean布尔类型,等于true或者false + else if ("true".equalsIgnoreCase(str) || "false".equalsIgnoreCase(str)) + { + classs.add(new Object[] { Boolean.valueOf(str), Boolean.class }); + } + // long长整形,以L结尾 + else if (StringUtils.endsWith(str, "L")) + { + classs.add(new Object[] { Long.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Long.class }); + } + // double浮点类型,以D结尾 + else if (StringUtils.endsWith(str, "D")) + { + classs.add(new Object[] { Double.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Double.class }); + } + // 其他类型归类为整形 + else + { + classs.add(new Object[] { Integer.valueOf(str), Integer.class }); + } + } + return classs; + } + + /** + * 获取参数类型 + * + * @param methodParams 参数相关列表 + * @return 参数类型列表 + */ + public static Class[] getMethodParamsType(List methodParams) + { + Class[] classs = new Class[methodParams.size()]; + int index = 0; + for (Object[] os : methodParams) + { + classs[index] = (Class) os[1]; + index++; + } + return classs; + } + + /** + * 获取参数值 + * + * @param methodParams 参数相关列表 + * @return 参数值列表 + */ + public static Object[] getMethodParamsValue(List methodParams) + { + Object[] classs = new Object[methodParams.size()]; + int index = 0; + for (Object[] os : methodParams) + { + classs[index] = (Object) os[0]; + index++; + } + return classs; + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java new file mode 100644 index 0000000000000000000000000000000000000000..5e135580b6ba205ee217f74c4957494b95d62bc7 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java @@ -0,0 +1,21 @@ +package com.ruoyi.quartz.util; + +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import com.ruoyi.quartz.domain.SysJob; + +/** + * 定时任务处理(禁止并发执行) + * + * @author ruoyi + * + */ +@DisallowConcurrentExecution +public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob +{ + @Override + protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception + { + JobInvokeUtil.invokeMethod(sysJob); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java new file mode 100644 index 0000000000000000000000000000000000000000..e97532617c9228434f5816b1bcb4807e816ed70d --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java @@ -0,0 +1,19 @@ +package com.ruoyi.quartz.util; + +import org.quartz.JobExecutionContext; +import com.ruoyi.quartz.domain.SysJob; + +/** + * 定时任务处理(允许并发执行) + * + * @author ruoyi + * + */ +public class QuartzJobExecution extends AbstractQuartzJob +{ + @Override + protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception + { + JobInvokeUtil.invokeMethod(sysJob); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..f885d4220730abaecea95890dfd2e0a42a7d66f3 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java @@ -0,0 +1,139 @@ +package com.ruoyi.quartz.util; + +import org.quartz.CronScheduleBuilder; +import org.quartz.CronTrigger; +import org.quartz.Job; +import org.quartz.JobBuilder; +import org.quartz.JobDetail; +import org.quartz.JobKey; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.quartz.TriggerBuilder; +import org.quartz.TriggerKey; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.ScheduleConstants; +import com.ruoyi.common.exception.job.TaskException; +import com.ruoyi.common.exception.job.TaskException.Code; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.quartz.domain.SysJob; + +/** + * 定时任务工具类 + * + * @author ruoyi + * + */ +public class ScheduleUtils +{ + /** + * 得到quartz任务类 + * + * @param sysJob 执行计划 + * @return 具体执行任务类 + */ + private static Class getQuartzJobClass(SysJob sysJob) + { + boolean isConcurrent = "0".equals(sysJob.getConcurrent()); + return isConcurrent ? QuartzJobExecution.class : QuartzDisallowConcurrentExecution.class; + } + + /** + * 构建任务触发对象 + */ + public static TriggerKey getTriggerKey(Long jobId, String jobGroup) + { + return TriggerKey.triggerKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); + } + + /** + * 构建任务键对象 + */ + public static JobKey getJobKey(Long jobId, String jobGroup) + { + return JobKey.jobKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup); + } + + /** + * 创建定时任务 + */ + public static void createScheduleJob(Scheduler scheduler, SysJob job) throws SchedulerException, TaskException + { + Class jobClass = getQuartzJobClass(job); + // 构建job信息 + Long jobId = job.getJobId(); + String jobGroup = job.getJobGroup(); + JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(getJobKey(jobId, jobGroup)).build(); + + // 表达式调度构建器 + CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression()); + cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder); + + // 按新的cronExpression表达式构建一个新的trigger + CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(jobId, jobGroup)) + .withSchedule(cronScheduleBuilder).build(); + + // 放入参数,运行时的方法可以获取 + jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job); + + // 判断是否存在 + if (scheduler.checkExists(getJobKey(jobId, jobGroup))) + { + // 防止创建时存在数据问题 先移除,然后在执行创建操作 + scheduler.deleteJob(getJobKey(jobId, jobGroup)); + } + + // 判断任务是否过期 + if (StringUtils.isNotNull(CronUtils.getNextExecution(job.getCronExpression()))) + { + // 执行调度任务 + scheduler.scheduleJob(jobDetail, trigger); + } + + // 暂停任务 + if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) + { + scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup)); + } + } + + /** + * 设置定时任务策略 + */ + public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb) + throws TaskException + { + switch (job.getMisfirePolicy()) + { + case ScheduleConstants.MISFIRE_DEFAULT: + return cb; + case ScheduleConstants.MISFIRE_IGNORE_MISFIRES: + return cb.withMisfireHandlingInstructionIgnoreMisfires(); + case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED: + return cb.withMisfireHandlingInstructionFireAndProceed(); + case ScheduleConstants.MISFIRE_DO_NOTHING: + return cb.withMisfireHandlingInstructionDoNothing(); + default: + throw new TaskException("The task misfire policy '" + job.getMisfirePolicy() + + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR); + } + } + + /** + * 检查包名是否为白名单配置 + * + * @param invokeTarget 目标字符串 + * @return 结果 + */ + public static boolean whiteList(String invokeTarget) + { + String packageName = StringUtils.substringBefore(invokeTarget, "("); + int count = StringUtils.countMatches(packageName, "."); + if (count > 1) + { + return StringUtils.containsAnyIgnoreCase(invokeTarget, Constants.JOB_WHITELIST_STR); + } + Object obj = SpringUtils.getBean(StringUtils.split(invokeTarget, ".")[0]); + return StringUtils.containsAnyIgnoreCase(obj.getClass().getPackage().getName(), Constants.JOB_WHITELIST_STR); + } +} diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..75c1854d4222805c683ad78d17e86897f81a9917 --- /dev/null +++ b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + select job_log_id, job_name, job_group, invoke_target, job_message, status, exception_info, create_time + from sys_job_log + + + + + + + + + + delete from sys_job_log where job_log_id = #{jobLogId} + + + + delete from sys_job_log where job_log_id in + + #{jobLogId} + + + + + delete from sys_job_log where create_time < now() + '- 1 month' + + + + truncate table sys_job_log + + + + insert into sys_job_log( + job_log_id, + job_name, + job_group, + invoke_target, + job_message, + status, + exception_info, + create_time + )values( + #{jobLogId}, + #{jobName}, + #{jobGroup}, + #{invokeTarget}, + #{jobMessage}, + #{status}, + #{exceptionInfo}, + now() + ) + + + \ No newline at end of file diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..653b5a21fcce060dae6722f2e78927873f397e3a --- /dev/null +++ b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + select job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark + from sys_job + + + + + + + + + + delete from sys_job where job_id = #{jobId} + + + + delete from sys_job where job_id in + + #{jobId} + + + + + update sys_job + + job_name = #{jobName}, + job_group = #{jobGroup}, + invoke_target = #{invokeTarget}, + cron_expression = #{cronExpression}, + misfire_policy = #{misfirePolicy}, + concurrent = #{concurrent}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = now() + + where job_id = #{jobId} + + + + insert into sys_job( + job_id, + job_name, + job_group, + invoke_target, + cron_expression, + misfire_policy, + concurrent, + status, + remark, + create_by, + create_time + )values( + #{jobId}, + #{jobName}, + #{jobGroup}, + #{invokeTarget}, + #{cronExpression}, + #{misfirePolicy}, + #{concurrent}, + #{status}, + #{remark}, + #{createBy}, + now() + ) + + + \ No newline at end of file diff --git a/ruoyi-sunlm/pom.xml b/ruoyi-sunlm/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a5a2b01d47811be7ca59cd837a784b0b7f942d4e --- /dev/null +++ b/ruoyi-sunlm/pom.xml @@ -0,0 +1,44 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + 4.0.0 + + ruoyi-sunlm + + + sunlm大屏模块 + + + + + + + com.ruoyi + ruoyi-common + + + + com.baomidou + mybatis-plus-core + 3.5.1 + + + + + com.baomidou + mybatis-plus-boot-starter + + + com.ruoyi + eastcom_yw + + + + + \ No newline at end of file diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_cache_config.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_cache_config.java new file mode 100644 index 0000000000000000000000000000000000000000..653da6cbc32af313fbb2f7c9d574e5556486ea23 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_cache_config.java @@ -0,0 +1,9 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_1_cache_config { + public String kind ; + public int cachesecond; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_device_alarm_counts.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_device_alarm_counts.java new file mode 100644 index 0000000000000000000000000000000000000000..5c8c65f59751a23c960ddd3c4b26cda1b4dc2cdb --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_device_alarm_counts.java @@ -0,0 +1,9 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_1_device_alarm_counts { + public int 设备数; + public int 告警总数; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_device_alarms_counts_ext.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_device_alarms_counts_ext.java new file mode 100644 index 0000000000000000000000000000000000000000..aa345599db24743a2daa8464b3a8e35fd51dc2d3 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_device_alarms_counts_ext.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_1_device_alarms_counts_ext { + public int 设备数1; + public int 告警总数1; + public int 设备数2; + public int 告警总数2; + public int 设备数3; + public int 告警总数3; + public int 设备数4; + public int 告警总数4; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_gbflow_wireless.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_gbflow_wireless.java new file mode 100644 index 0000000000000000000000000000000000000000..276334791d483ff0bd66a72a26c618692fecf3d8 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_gbflow_wireless.java @@ -0,0 +1,47 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +/* + { +    "label": [ +        "昨天(2023年04月6日)", +        "今天(2023年04月7日)" +    ], +    "xAxis": [ +        "1时", +        "2时", +        "3时", +        "4时", +        "5时" +    ], +    "value": [ +        600, +        800, +        580, +        400, +        880, +        580, +        630 +    ] + "value2": [ +        600, +        800, +        580, +        400, +        880, +        580, +        630 +    ] +} +* */ + +@Data +public class class_dp_1_gbflow_wireless { //4/5G无线流量, 传输环路流量通用 + public List label; + public List xaxis; + public List value; //当日 + public List value2; //前日 +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_gbflow_wireless_compare.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_gbflow_wireless_compare.java new file mode 100644 index 0000000000000000000000000000000000000000..a314154f3c0de0d78738391a09005e83b7c31452 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_gbflow_wireless_compare.java @@ -0,0 +1,10 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_1_gbflow_wireless_compare { //4/5G无线流量, 传输环路流量通用 + public String adate; + public float gb; + public int sign; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_manage_counts.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_manage_counts.java new file mode 100644 index 0000000000000000000000000000000000000000..c6100a02028d1b8a2e73fc2f2e596f33244f8aee --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_manage_counts.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_1_manage_counts { //综合管理类统计值 + public int 应签到数量; + public int 实际签到数; + public float 人员签到率; + public int 巡检任务数; + public int 已巡检任务; + public float 巡检完成率; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_maps_alarms.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_maps_alarms.java new file mode 100644 index 0000000000000000000000000000000000000000..7fb01dc9447c95124eb0f22a725d6167d6cc36e4 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_maps_alarms.java @@ -0,0 +1,31 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_1_maps_alarms { //地图上显示告警图标, + public String areaname; + public String venueid; + public String venuetypeid; + public String venuetype; + public String venuename; + public int icontype; //图标类型,0,1,2,3,..... + public float longitude; + public float latitude; + public int wirelesscount; + public int powercount; + public int transcount; + public int agiscount; + public int alarmcount; + public float signRate; + public float inspectRate; + public int signResult; + public int inspectResult; + public String venuenmanager; + public String phonenumber; + public List lists; //告警列表 + public class_dp_2_kpi_spot kpi; //景区KPI,无线用 + public String sitecellinto; //基站,小区数统计 +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_outservice_wireless.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_outservice_wireless.java new file mode 100644 index 0000000000000000000000000000000000000000..4b9d82ff3f581a03f0d04c80b045ed2b677a489b --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_1_outservice_wireless.java @@ -0,0 +1,11 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_1_outservice_wireless { //无线退服数统计 + public int 退服数2G; + public int 退服数4G; + public int 退服数5G; + public int 基站总数; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_bts_wireless_alarms.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_bts_wireless_alarms.java new file mode 100644 index 0000000000000000000000000000000000000000..33ff938e30afa254878371a21490fa08570757a9 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_bts_wireless_alarms.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_2_bts_wireless_alarms { + public String btsname ; + public float longitude; + public float latitude; + public int alarmcount; + public List lists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_code_net_alarms.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_code_net_alarms.java new file mode 100644 index 0000000000000000000000000000000000000000..2ece5954e00afc4c65950b4c6a58b87b72962b60 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_code_net_alarms.java @@ -0,0 +1,17 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +/** + * @author yqf + * @date 2023/8/15 + */ +@Data +public class class_dp_2_code_net_alarms { + public String code ; + public int alarmcount; + public List lists; + public List kpilist; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_freq_statistics.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_freq_statistics.java new file mode 100644 index 0000000000000000000000000000000000000000..ead166405537517907f7ec06cf1761393b8c3398 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_freq_statistics.java @@ -0,0 +1,9 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_freq_statistics { + public String 小区频段 ; + public int cnt; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot.java new file mode 100644 index 0000000000000000000000000000000000000000..3ce5b473d00cebae8230ce493cf327b474e63b68 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_2_kpi_spot { + public String nettype; + public String datatype; + public String kpiname; + public int score; + public String color; + public List celllist; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot_cell.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot_cell.java new file mode 100644 index 0000000000000000000000000000000000000000..6a517ad62bdfe600b99b26a0d9c4d63faeb43d4f --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot_cell.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_kpi_spot_cell { + public String netttype ; + public String 时间 ; + public String 小区名称; + public class_dp_2_kpi_spot_kpi 上行prb利用率; + public class_dp_2_kpi_spot_kpi 下行prb利用率; + public class_dp_2_kpi_spot_kpi 最大用户数; + public class_dp_2_kpi_spot_kpi 上行平均干扰; + public class_dp_2_kpi_spot_kpi 综合得分; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot_celldetail.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot_celldetail.java new file mode 100644 index 0000000000000000000000000000000000000000..a26025ec961ffb318a1148be9f10fd48785af8f6 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot_celldetail.java @@ -0,0 +1,27 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_kpi_spot_celldetail { + public String 时间 ; + public String 小区名称 ; + public int 景区id ; + public float maxUser ; + public float prbUp ; + public float prbDown ; + public float avgDisturb ; + + public int kpiZhsf; + public String kpiclrPrbUp ; + public String kpiclrPrbDown ; + public String kpiclrMaxUser ; + public String kpiclrAvgDisturb ; + public String kpiclrKpiZhsf ; + + public int scoreZhsf; + public int scorePrbUp; + public int scorePrbDown; + public int scoreMaxUser; + public int scoreAvgDisturb; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot_kpi.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot_kpi.java new file mode 100644 index 0000000000000000000000000000000000000000..7bd44b3f9d9e17e3b9f9e34dec4c8a2378b9a6f2 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_kpi_spot_kpi.java @@ -0,0 +1,10 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_kpi_spot_kpi { + public float value; + public String color; + public int score; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_out_wireless_alarms.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_out_wireless_alarms.java new file mode 100644 index 0000000000000000000000000000000000000000..31f77f6c656f654aa180cdb6bb8c8185430bcbe6 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_out_wireless_alarms.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_2_out_wireless_alarms { //外场告警及列表 + public int sceneid ; + public String scenename ; + public float longitude; + public float latitude; + public int total ; + public List alarmlist; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_power_alarm.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_power_alarm.java new file mode 100644 index 0000000000000000000000000000000000000000..935026691ca7139424217d89f4f71b57157e5a95 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_power_alarm.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_power_alarm { + public String eventtime; + public String alarmname; + public String siteName; + public String owner; + public String 场馆id; + public String 区域id; + private String phonenumber; + private String 故障处理人; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_control.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_control.java new file mode 100644 index 0000000000000000000000000000000000000000..4bc212dc30e1952eec3607161f73fa18378d3002 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_control.java @@ -0,0 +1,17 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +public class class_dp_2_scene_control { + //----------------------------------added by sunlm , 指定场馆以1分钟或15分钟展示 + private int sceneid; + //--------------------------------- + private int mintype; + private String nettype; + private String kpiname; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_seat_detail.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_seat_detail.java new file mode 100644 index 0000000000000000000000000000000000000000..566f577308a2b9de12ad33bcb18782fbe99e30dd --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_seat_detail.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +public class class_dp_2_scene_seat_detail { + public String seatid; + public int seatnumber; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_seat_info.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_seat_info.java new file mode 100644 index 0000000000000000000000000000000000000000..2e407544822b2d8343f4218076ec5a029511828a --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_seat_info.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +public class class_dp_2_scene_seat_info { + public Integer length; + public Integer width; + public Integer angle; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_test_data.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_test_data.java new file mode 100644 index 0000000000000000000000000000000000000000..4fc077af2516bae72bdee0d7bef8c9b1ea44d4a1 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scene_test_data.java @@ -0,0 +1,21 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.Date; +@Data +public class class_dp_2_scene_test_data { + private Long id; + private String bzname; + private String scenename; + private String deviceoid; + private Float connectdelay; + private Float dlspeed; + private Float lat; + private Float lng; + private Float pagecomplete; + private Float ulspeed; + private Date updateTime; + private String nettype; + private Integer sceneId; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scenelist.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scenelist.java new file mode 100644 index 0000000000000000000000000000000000000000..68faab6bead761f9e04fa9687ce301869d5ff59b --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_scenelist.java @@ -0,0 +1,12 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_scenelist { //场馆信息 + public int venueId; + public String venueName; + public float longitude; + public float latitude; + public String venueCategory; //场或馆 +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_seat_chinesename.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_seat_chinesename.java new file mode 100644 index 0000000000000000000000000000000000000000..f10d59553c219ad60c62fa99214532bc86b96c90 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_seat_chinesename.java @@ -0,0 +1,10 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_seat_chinesename { + public int sceneid ; + public String seatid ; + public String chinesename ; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_seat_wireless_alarms.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_seat_wireless_alarms.java new file mode 100644 index 0000000000000000000000000000000000000000..16ba588ba9275836613d83433810719e7be85e3e --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_seat_wireless_alarms.java @@ -0,0 +1,12 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_2_seat_wireless_alarms { + public String seatid ; + public int alarmcount; + public List lists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_site_cell_info.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_site_cell_info.java new file mode 100644 index 0000000000000000000000000000000000000000..ea17fa9f025d06886d50696f8b134843dc1355e4 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_site_cell_info.java @@ -0,0 +1,16 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_site_cell_info { + public String 类型; + public int 编号; + public String 名称; + public String 基站数2g; + public String 小区数2g; + public String 基站数4g; + public String 小区数4g; + public String 基站数5g; + public String 小区数5g; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_spotdetail.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_spotdetail.java new file mode 100644 index 0000000000000000000000000000000000000000..bcba7645178cd16339d542fc0b6ab89e6e25ffa7 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_spotdetail.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.daping; + +import java.util.List; + +public class class_dp_2_spotdetail { + public int spotId; + public int spotTypeid; + public String spotType; + public String spotName; + public float longitude; + public float latitude; + public String spotDetail; + public int alarmcount; + public List lists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_spotlist.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_spotlist.java new file mode 100644 index 0000000000000000000000000000000000000000..1a583d8e2c2ec1e13eeb4af0c00ffed44fd3d55c --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_spotlist.java @@ -0,0 +1,11 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_2_spotlist { + public String spottype; + public List spotlist; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_top5.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_top5.java new file mode 100644 index 0000000000000000000000000000000000000000..91abe019487a59f46f18ffa50f22ce892e4b1f1d --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_top5.java @@ -0,0 +1,41 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * [ + *     { + *         "title": "1", + *         "name": "H517599-杭州萧山奥邸国际写字楼区电梯地下室-HLW-F601-地下室SF-1", + *         "value": 20.8 + *     }, + *     { + *         "title": "2", + *         "name": "萧山石岩老街西FDD1800_66", + *         "value": 19.15 + *     }, + *     { + *         "title": "3", + *         "name": "H518207-萧山亚运村运动员一村D区-HLH-FD18102-亚运村运动员一村D02LY-8", + *         "value": 16.517 + *     }, + *     { + *         "title": "4", + *         "name": "H417875-萧山奥体博览中心-HFX-FD18901-奥体博览中心移动小微站11LY-65", + *         "value": 13.583 + *     }, + *     { + *         "title": "5", + *         "name": "萧山宝盛大厦CRAN利二路博奥路口3DMIMO_196", + *         "value": 11.367 + *     } + * ] + * */ + +@Data +public class class_dp_2_top5 { + public int title; + public String name; + public float value; + public String color; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_top5_allspot.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_top5_allspot.java new file mode 100644 index 0000000000000000000000000000000000000000..0bb612b4df9a042433e8f38ba5d0fd42be32242a --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_top5_allspot.java @@ -0,0 +1,11 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_2_top5_allspot { //右侧小屏用 + public String spotname ; + public List lists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_top5_spot.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_top5_spot.java new file mode 100644 index 0000000000000000000000000000000000000000..a47970d07b349823c40855dc0b0be9f4db56d3b0 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_top5_spot.java @@ -0,0 +1,11 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_2_top5_spot { //每个指标的TOP5 + public String kpiname; + public List top5; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_usercounts.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_usercounts.java new file mode 100644 index 0000000000000000000000000000000000000000..5a46ee7cc8645292f9b176f6ff2304b14efcd97b --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_usercounts.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_2_usercounts { //区域用户数, 区域流量通用, 漫入漫出通用 + public List label; + public List xaxis; + public List value; + public List value2; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_usercounts_compare.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_usercounts_compare.java new file mode 100644 index 0000000000000000000000000000000000000000..c812988b5193313de2a9b52ba0ae94da15e13ab0 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_usercounts_compare.java @@ -0,0 +1,10 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_usercounts_compare { ////区域用户数, 区域流量通用,, 漫入漫出通用 + public String datetime; + public float value; + public int sign; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_wireless_alarm.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_wireless_alarm.java new file mode 100644 index 0000000000000000000000000000000000000000..1f224fcec1030512d8f0aee1d4da22894a091020 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_wireless_alarm.java @@ -0,0 +1,19 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_wireless_alarm { //无线告警清单 + public String eventtime; + public String alarmname; + public String area; + public String sitename; + public String sitetype; + public String cellname; + public String 场馆id; + public String 场馆名称; + public float longitude; + public float latitude; + public String 区域id; + public String 坐席编号 ; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_wireless_highload.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_wireless_highload.java new file mode 100644 index 0000000000000000000000000000000000000000..15a084df77fce0d4d5539b673ccff853597405c3 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_2_wireless_highload.java @@ -0,0 +1,17 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_2_wireless_highload { + public int title; + public String statTime; + public int sceneId; + public String venueName; + public String netName; + public String kpiname; + public float kpivalue; + public int kpiscore; + public int kpitype; + public String nettype; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_gb_top5.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_gb_top5.java new file mode 100644 index 0000000000000000000000000000000000000000..0ac5aa15e39dba746a01963553f371e55025bb7b --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_gb_top5.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/7/11 + */ +@Data +public class class_dp_3_gb_top5 { + + private String mename; + private String portname; + private float flow; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_maps_alarms.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_maps_alarms.java new file mode 100644 index 0000000000000000000000000000000000000000..9e4756f8f9334464ad26945ac8c01e484e8c3c88 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_maps_alarms.java @@ -0,0 +1,23 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_3_maps_alarms { //地图上显示告警图标, + public String areaname; + public String venueid; + public String venuetypeid; + public String venuetype; + public String venuename; + public float longitude; + public float latitude; + public int alarmcount; + public int agiscount; + public int wificount; + public int voipcount; + public List lists; + public List linklists; + public List devlists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_net_alarm.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_net_alarm.java new file mode 100644 index 0000000000000000000000000000000000000000..1ac4eb1f88b2dfc55f761a5b9884187607eba921 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_net_alarm.java @@ -0,0 +1,22 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_3_net_alarm { + public String eventtime; + public String recovertime; + public String alarmname; + public String netname; + public String areaname; + public String detaillocation; + public String alarmtype; + public String nettype; + public String porttype; + public String portnet; + public String port; + public String mark; + public Long sceneid; + public String scenename; + public int alarmscount; //告警数量 +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_opticalpower.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_opticalpower.java new file mode 100644 index 0000000000000000000000000000000000000000..7a4ffdc9ffa2e50f61821434cb2c07862bfffb56 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_opticalpower.java @@ -0,0 +1,18 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_3_opticalpower { + public String venue; + public String mename; + public String portame; + public float inOpticalpower; + public float outOpticalpower; + public float inMinvalue; + public float outMinvalue; + public String dateTime; + public String areaname; + public String 场馆id; + public String 区域id; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_trans_alarm.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_trans_alarm.java new file mode 100644 index 0000000000000000000000000000000000000000..1311750dff46be6ee8352a11c55013a0111e6215 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_3_trans_alarm.java @@ -0,0 +1,17 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_3_trans_alarm { + public String eventtime; + public String areaname; + public String alarmname; + public String netname; + public String alarmtype; + public String alarmlevel; + public String devicetype; + public String isportalarm; + public String 场馆id; + public String 区域id; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_4_maps_alarms.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_4_maps_alarms.java new file mode 100644 index 0000000000000000000000000000000000000000..8d90518317ed28ce3d60884b45e669fb92a2391d --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_4_maps_alarms.java @@ -0,0 +1,22 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_4_maps_alarms { //地图上显示告警图标, + public String areaname; + public String venueid; + public String venuetypeid; + public String venuetype; + public String venuename; + public float longitude; + public float latitude; + public int alarmcount; + public int loopcount; + public int devicecount; + public int hardwarecount; + public int powercount; + public List lists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_5_scenecontacts.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_5_scenecontacts.java new file mode 100644 index 0000000000000000000000000000000000000000..767c4c42339af0961f209b727717c1d175fce2e0 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_5_scenecontacts.java @@ -0,0 +1,17 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/7/17 + */ +@Data +public class class_dp_5_scenecontacts { + + public Long userid; + public String username; + public String nickname; + public String phonenumber; + public String venuename; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_5_scenesta.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_5_scenesta.java new file mode 100644 index 0000000000000000000000000000000000000000..caa5e4deac5a683ed30e26633bfb7a42473daaec --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_5_scenesta.java @@ -0,0 +1,30 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/7/17 + */ +@Data +public class class_dp_5_scenesta { + + public int scenemanager; + public int sceneassistant; + public int faulthandle; + public int inspectuser; + public int emergencycommunicationcar; + public int emergencyelectriccar; + public int emergencyrepaircar; + public int emergencywarehouse; + public int wifispare; + public int dredgespare; + public int transspare; + public int wxuser; + public int csuser; + public int zwuser; + public int dhuser; + public int gluser; + public int bxuser; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_alarm.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_alarm.java new file mode 100644 index 0000000000000000000000000000000000000000..216eea7a976d375c0e439419784375c6ac8a1e36 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_alarm.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_6_dict_alarm { + public String addressname ; + public String alarmreason ; + public String createtime ; + public String exploreid ; + public String yyalarm ; + public String quxian ; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_alarm_monitor.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_alarm_monitor.java new file mode 100644 index 0000000000000000000000000000000000000000..353df6ea450defd3aef746e0dafbba34a6282923 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_alarm_monitor.java @@ -0,0 +1,11 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_6_dict_alarm_monitor { + public int total; + public List lists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_kpi_monitor.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_kpi_monitor.java new file mode 100644 index 0000000000000000000000000000000000000000..18acdceca02aebfb14baa5479f9a1e9d800dc882 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_kpi_monitor.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_6_dict_kpi_monitor { //监控类项目 + public int projecttotal; + public int pointtotal; + public int guzhangtotal; + public float avgonlinerate; + public List lists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_link_alarm.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_link_alarm.java new file mode 100644 index 0000000000000000000000000000000000000000..221470f2c7895b6df6c4a6c268f1a3a0babae7e0 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_link_alarm.java @@ -0,0 +1,16 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_6_dict_link_alarm { + public String 告警时间; + public String 分公司; + public String 网元名称; + public String 端口; + public String 业务名称; + public String 专线名称; + public String 详细位置; + public String 告警名称; + public String 项目类型; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_links.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_links.java new file mode 100644 index 0000000000000000000000000000000000000000..7fd04f9bd88bac685b2b54921885feb16de7ba5c --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_links.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_6_dict_links { + public int zhizhengtotal ; + public int teqingtotal ; + public List zhizhenglists; + public List teqinglists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_maps.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_maps.java new file mode 100644 index 0000000000000000000000000000000000000000..bf17dd50c3874913f4bb6a92e95241839da81138 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_maps.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_6_dict_maps { + public String areaname ; + public float longitude ; + public float latitude ; + public int alarmcount; + public List lists; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_project.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_project.java new file mode 100644 index 0000000000000000000000000000000000000000..d63ccf4658de19422ad938bbc5384539d3e89667 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_project.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_6_dict_project { + public String projectname ; + public int pointnumber ; + public int guzhangshuliang ; + public float onlinerate; + public String ict; + public String projectnum; + public String quxian; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_project_statis.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_project_statis.java new file mode 100644 index 0000000000000000000000000000000000000000..92ff41b18d5f6cbc01111fb981003fe469cbe63a --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_6_dict_project_statis.java @@ -0,0 +1,11 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +@Data +public class class_dp_6_dict_project_statis { + public int projectnum; + public int pointnumber; + public int guzhangshuliang; + public float onlinerate; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_map_agis_dev_15mi.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_map_agis_dev_15mi.java new file mode 100644 index 0000000000000000000000000000000000000000..e5955944349884ea9c281488e7f572aee8d7310a --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_map_agis_dev_15mi.java @@ -0,0 +1,20 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/8/15 + */ +@Data +public class class_dp_map_agis_dev_15mi { + + private Long venueid; + private String venuename; + public String statdate; + private float cpuratio; + private float ramratio; + private String code; + private String devicename; + private String devicetype; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_map_agis_link_5mi.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_map_agis_link_5mi.java new file mode 100644 index 0000000000000000000000000000000000000000..6997f49b56fa06acb2876d1e7bd3b850e9894845 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_map_agis_link_5mi.java @@ -0,0 +1,21 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/8/15 + */ +@Data +public class class_dp_map_agis_link_5mi { + + private Long venueid; + public String statdate; + private float ulbandratio; + private float dlbandratio; + private float ulavg24hratio; + private float dlavg24hratio; + private String linkname; + private String linkvalue; + private String venuename; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_map_alarms.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_map_alarms.java new file mode 100644 index 0000000000000000000000000000000000000000..218bf503b78dc6e32c34b7504ca13dbec81d22a8 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/class_dp_map_alarms.java @@ -0,0 +1,22 @@ +package com.ruoyi.sunlm.daping; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/7/31 + */ +@Data +public class class_dp_map_alarms { + + private Long sceneid; + private String major; + private String netname; + private String alarmname; + private String eventtime; + private String handlepeople; + private String phonenumber; + //------------------------------ 保留字段 + private String reserved; + private String code; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewCommonDTO.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewCommonDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..566e4bb27023c5e89200004005f51d2a59f590d9 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewCommonDTO.java @@ -0,0 +1,16 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import lombok.Data; + +@Data +public class NewCommonDTO { + + private Integer pageNum = 1; + + private Integer pageSize = 10; + + private NewPageDTO pageSizes; + + private NewPageDTO pageNums; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewDpKpiMonitorQO.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewDpKpiMonitorQO.java new file mode 100644 index 0000000000000000000000000000000000000000..1afd38cc015b598e8fba1e026c90db0888515e50 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewDpKpiMonitorQO.java @@ -0,0 +1,59 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class NewDpKpiMonitorQO extends NewCommonDTO { + + @ApiModelProperty(value = "数据类型", required = true) + @NotBlank(message = "timetype不能为空") + private String datatype; + + @ApiModelProperty(value = "网络类型", required = true) + @NotBlank(message = "netType不能为空") + private String nettype; + + @ApiModelProperty(value = "场馆ids") + private Integer sceneid; + + @ApiModelProperty(value = "指标名称",required = true) + @NotBlank(message = "指标名称不能为空") + private String kpiname; + + + @ApiModelProperty(value = "开始时间") + @TableField("starttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private LocalDateTime starttime; + + @ApiModelProperty(value = "结束时间") + @TableField("endtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private LocalDateTime endtime; + + private String seatno; + + private String inorout; //added by sunlm 2023-07-18 + + @ApiModelProperty(value = "查询表方式,1-查询特定表") + private int sceneruntype; + + @ApiModelProperty(value = "最大时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + private LocalDateTime maxtime; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewDpSceneConfig.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewDpSceneConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..614374800211fa1c692f16eb817bcb74f52b9b9f --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewDpSceneConfig.java @@ -0,0 +1,74 @@ +package com.ruoyi.sunlm.daping.dp3d; + +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 java.io.Serializable; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("dp_scene_config") +@ApiModel(value = "DpSceneConfig对象", description = "") +public class NewDpSceneConfig { + + private static final long serialVersionUID = 1L; + @ApiModelProperty("自增id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty("颜色等级") + @TableField("level") + private Short level; + + @ApiModelProperty("指标名称") + @TableField("name") + private String name; + + @ApiModelProperty("最小值") + @TableField("range1") + private Object range1; + + @ApiModelProperty("最大值") + @TableField("range2") + private Object range2; + + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @ApiModelProperty("备注") + @TableField("content") + private String content; + + @ApiModelProperty("指标等级:cell、scene") + @TableField("type") + private String type; + + @ApiModelProperty("网络类型") + @TableField("nettype") + private String nettype; + + @ApiModelProperty("小区设备") + @TableField("celltype") + private String celltype; + + @ApiModelProperty("颜色分值") + @TableField("colorscore") + private Double colorscore; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewDpSceneConfigQO.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewDpSceneConfigQO.java new file mode 100644 index 0000000000000000000000000000000000000000..ffb801884039ede4d28b37994a4ea317391763f7 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewDpSceneConfigQO.java @@ -0,0 +1,80 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.github.pagehelper.Page; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; + +import com.ruoyi.sunlm.daping.dp3d.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + *

+ * QO + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class NewDpSceneConfigQO extends NewCommonDTO { + + + private static final long serialVersionUID = 1L; + @ApiModelProperty("自增id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + + @ApiModelProperty("颜色等级") + @TableField("level") + private Short level; + + @ApiModelProperty("指标名称") + @TableField("name") + private String name; + + @ApiModelProperty("最小值") + @TableField("range1") + private Double range1; + + @ApiModelProperty("最大值") + @TableField("range2") + private Double range2; + + @ApiModelProperty("颜色") + @TableField("color") + private String color; + + @ApiModelProperty("备注") + @TableField("content") + private String content; + + + @ApiModelProperty("指标等级:cell、scene") + @TableField("type") + private String type; + + @ApiModelProperty("网络类型") + @TableField("nettype") + private String nettype; + + @ApiModelProperty("设备类型") + @TableField("celltype") + private String celltype; + + @ApiModelProperty("颜色分值") + @TableField("colorscore") + private Double colorscore; + + private BigDecimal value; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewKpiConstants.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewKpiConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..a8d32d35e7dce719a043e661edf18da2be4e1d72 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewKpiConstants.java @@ -0,0 +1,45 @@ +package com.ruoyi.sunlm.daping.dp3d; + +/** + * @author yqf + * @date 2023/4/12 + */ +public class NewKpiConstants { + + public static final String YW_KPI_COLOR_DEFAULT = "#000000"; + + public static final String YW_NETTYPE_4G = "4G"; + + public static final String YW_FIELD_RPB_UP = "上行Prb利用率"; + public static final String YW_FIELD_RPB_DOWN = "下行Prb利用率"; + public static final String YW_FIELD_MAX_USER = "最大用户数"; + public static final String YW_FIELD_AVG_DIS = "平均干扰值"; + public static final String YW_FIELD_ALL = "综合算法"; + + public static final String YW_QUERY_ALL = "综合得分"; + + + public static final String YW_SORT_DESC = "desc"; + + public static final String YW_DATATYPE_15 = "15分钟"; + public static final String YW_DATATYPE_1 = "1分钟"; + + public static final int YW_MINTYPE_1 = 1; + + public static final String QUERYSEAT = "P"; + + public static final String FIELD_4G_GB = "上行流量mb"; + public static final String FIELD_4G_DISTURB = "上行平均干扰"; + public static final String FIELD_4G_MAXUSER = "最大用户数"; + public static final String FIELD_4G_PRBUP = "上行prb利用率"; + public static final String FIELD_4G_PRBDOWN = "下行prb利用率"; + + public static final String FIELD_5G_GB = "上行5g流量"; + public static final String FIELD_5G_DISTURB = "上行干扰值"; + public static final String FIELD_5G_MAXUSER = "最大用户数"; + public static final String FIELD_5G_PRBUP = "上行prb利用率"; + public static final String FIELD_5G_PRBDOWN = "下行prb利用率"; + + public static final String ORDER_DESC = "DESC"; + public static final String ORDER_ASC = "ASC"; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewMonitorCellVo.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewMonitorCellVo.java new file mode 100644 index 0000000000000000000000000000000000000000..98e925655392f025e1f489d6ffbca2764789417c --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewMonitorCellVo.java @@ -0,0 +1,79 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @author yqf + * @date 2023/4/13 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("MonitorCellVo实体类") //坐席 +public class NewMonitorCellVo { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "排序") + private Integer orderid; + + @ApiModelProperty(value = "数据类型") + private String datatype; + + @ApiModelProperty(value = "网络类型") + private String nettype; + + @TableField("venue_id") + private Integer venueid; + + @ApiModelProperty(value = "场馆名称") + @TableField("venue_name") + private String venuename; + + @ApiModelProperty(value = "坐席编号") + private String seatid; + + //---------------------------------------------added sunlm 2023-09-04 + @ApiModelProperty(value = "坐席中文名") + private String seatname; + + @ApiModelProperty(value = "一键优化") + private int onekey; + //------------------------------------------------------------------- + + @ApiModelProperty(value = "坐席颜色") + private String color; + + @ApiModelProperty(value = "坐席得分") + private Float score; + + @ApiModelProperty(value = "指标名") + private String kpiname; + + @ApiModelProperty(value = "小区类型") + private String celltype; + + @ApiModelProperty(value = "基站编号") + private Long stationno; + + @ApiModelProperty(value = "基站全称") + private String pointname; + + @ApiModelProperty(value = "坐席编号") + private String pointid; + + @ApiModelProperty(value = "经度") + private Double longitude; + + @ApiModelProperty(value = "纬度") + private Double latitude; + + private List celllist; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPageDTO.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPageDTO.java new file mode 100644 index 0000000000000000000000000000000000000000..75229f14ac9a1c3cf451ee80f1276fdf738ebd60 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPageDTO.java @@ -0,0 +1,16 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import lombok.Data; + +@Data +public class NewPageDTO { + + private Integer cs; + + private Integer dh; + + private Integer agis; + + private Integer wx; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi15CellMonitorVO.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi15CellMonitorVO.java new file mode 100644 index 0000000000000000000000000000000000000000..2a9b8297ad76a25827f498a84d11806b5a8b234a --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi15CellMonitorVO.java @@ -0,0 +1,109 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/14 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("PmKpi15CellMonitorVO实体类") //坐席的小区 +public class NewPmKpi15CellMonitorVO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "网络类型") + private String nettype; + + @TableField("venue_id") + private Integer venueid; + + @Excel(name = "场馆名称",width = 20) + @ApiModelProperty(value = "场馆名称") + @TableField("venue_name") + private String venuename; + + @Excel(name = "坐席编号",width = 20) + @ApiModelProperty(value = "坐席编号") + private String 坐席编号; + + @TableField("cellcodeci") + private String cellcodeci; + + @Excel(name = "开始时间",width = 20,dateFormat = "yyyy-MM-dd HH:mm:ss") + @TableField("starttime") + private LocalDateTime starttime; + + @Excel(name = "场馆名称",width = 20) + @TableField("小区名称") + @ApiModelProperty(value = "小区名称") + private String 小区名称; + + @Excel(name = "最大用户数",width = 20) + @ApiModelProperty(value = "最大用户数") + @TableField("最大用户数") + private NewPmKpiVO 最大用户数; + + @Excel(name = "上行prb利用率",width = 20) + @ApiModelProperty(value = "上行prb利用率") + @TableField("上行prb利用率") + private NewPmKpiVO 上行prb利用率; + + @Excel(name = "下行prb利用率",width = 20) + @ApiModelProperty(value = "下行prb利用率") + @TableField("下行prb利用率") + private NewPmKpiVO 下行prb利用率; + + @Excel(name = "上行平均干扰",width = 20) + @ApiModelProperty(value = "上行平均干扰") + @TableField("上行平均干扰") + private NewPmKpiVO 上行平均干扰; + + @Excel(name = "结束时间",width = 20,dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "结束时间") + @TableField("endtime") + private LocalDateTime endtime; + + @ApiModelProperty(value = "综合得分") + private NewPmKpiVO 综合得分; + + + + @ApiModelProperty(value = "基站编号") + private Long stationno; + + @ApiModelProperty(value = "基站全称") + private String pointname; + + @ApiModelProperty(value = "坐席编号") + private String pointid; + + @ApiModelProperty(value = "经度") + private Double longitude; + + @ApiModelProperty(value = "纬度") + private Double latitude; + + @ApiModelProperty(value = "小区频段") + private String 小区频段; + + @ApiModelProperty(value = "设备类型") + private String 设备类型; + + @ApiModelProperty(value = "带宽") + private Long 带宽; + + @ApiModelProperty(value = "方位角") + private Long 方位角; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi4gCell.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi4gCell.java new file mode 100644 index 0000000000000000000000000000000000000000..2d0757baf36668e7073c7500b8adb5824d617e4e --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi4gCell.java @@ -0,0 +1,200 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 场馆4G小区级15分钟指标 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi4g_cell") +@ApiModel(value = "PmKpi4gCell对象", description = "场馆4G小区级15分钟指标") +public class NewPmKpi4gCell { + + private static final long serialVersionUID = 1L; +// @ApiModelProperty("id") +// @TableField("id") +// private Long id; + + @TableField("venue_id") + private Integer venueId; + + @TableField("venue_name") + private String venueName; + + @TableField("cellcodeci") + private String cellcodeci; + + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("小区名称") + private String 小区名称; + + @TableField("上行流量mb") + private BigDecimal 上行流量mb; + + @TableField("下行流量mb") + private BigDecimal 下行流量mb; + + @TableField("有效rrc连接平均数") + private BigDecimal 有效rrc连接平均数; + + @TableField("有效rrc连接最大数") + private BigDecimal 有效rrc连接最大数; + + @TableField("平均用户数") + private BigDecimal 平均用户数; + + @TableField("最大用户数") + private BigDecimal 最大用户数; + + @TableField("volte话务量") + private BigDecimal volte话务量; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("上行平均干扰") + private BigDecimal 上行平均干扰; + + @TableField("rrc建立成功率") + private BigDecimal rrc建立成功率; + + @TableField("e_rab建立成功率") + private BigDecimal eRab建立成功率; + + @TableField("qci为1的e_rab建立成功率") + private BigDecimal qci为1的eRab建立成功率; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("掉线次数") + private BigDecimal 掉线次数; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("esrvcc切换成功率") + private BigDecimal esrvcc切换成功率; + + @TableField("esrvcc切换请求次数") + private BigDecimal esrvcc切换请求次数; + + @TableField("rrc重建成功率") + private BigDecimal rrc重建成功率; + + @TableField("rrc重建次数") + private BigDecimal rrc重建次数; + + @TableField("volte掉话率") + private BigDecimal volte掉话率; + + @TableField("volte掉话次数") + private BigDecimal volte掉话次数; + + @TableField("rru_puschprbassn") + private BigDecimal rruPuschprbassn; + + @TableField("rru_puschprbtot") + private BigDecimal rruPuschprbtot; + + @TableField("rru_pdschprbassn") + private BigDecimal rruPdschprbassn; + + @TableField("rru_pdschprbtot") + private BigDecimal rruPdschprbtot; + + @TableField("rrc_succconnestab") + private BigDecimal rrcSuccconnestab; + + @TableField("rrc_attconnestab") + private BigDecimal rrcAttconnestab; + + @TableField("erab_nbrsuccestab_1") + private BigDecimal erabNbrsuccestab1; + + @TableField("erab_nbrattestab") + private BigDecimal erabNbrattestab; + + @TableField("erab_nbrattestab_1") + private BigDecimal erabNbrattestab1; + + @TableField("切换成功率_分母") + private BigDecimal 切换成功率分母; + + @TableField("切换成功率_分子") + private BigDecimal 切换成功率分子; + + @TableField("掉线率_分母") + private BigDecimal 掉线率分母; + + @TableField("iratho_succoutgeran") + private BigDecimal irathoSuccoutgeran; + + @TableField("rrc_attconnreestab") + private BigDecimal rrcAttconnreestab; + + @TableField("volte掉话率_分母") + private BigDecimal volte掉话率分母; + + @TableField("erab_nbrsuccestab") + private BigDecimal erabNbrsuccestab; + + @TableField("omcname") + private String omcname; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("rrc_failconnestab") + private BigDecimal rrcFailconnestab; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("groupid") + private Long groupid; + + @TableField("endtime") + private LocalDateTime endtime; + + ///////////////////////////////// + @TableField(exist = false) + private Integer orderId; + + @TableField(exist = false) + private String 坐席编号; + + @TableField(exist = false) + private String 小区频段; + + @TableField(exist = false) + private String 设备类型; + + @TableField(exist = false) + private Long 带宽; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi4gMin.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi4gMin.java new file mode 100644 index 0000000000000000000000000000000000000000..58386c08e36fd006defdccdbe7ce0c5169aff00a --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi4gMin.java @@ -0,0 +1,126 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 场馆4G小区级1分钟指标 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi4g_min") +@ApiModel(value = "PmKpi4gMin对象", description = "场馆4G小区级1分钟指标") +public class NewPmKpi4gMin { + + private static final long serialVersionUID = 1L; + + @TableField("groupid") + private Integer groupid; + + @TableField("时间") + private LocalDateTime 时间; + + @TableField("小区名称") + private String 小区名称; + + @TableField("地市区号") + private String 地市区号; + + @TableField("厂商id") + private String 厂商id; + + @TableField("avg_user") + private BigDecimal avgUser; + + @TableField("max_user") + private Integer maxUser; + + @TableField("prb_up") + private BigDecimal prbUp; + + @TableField("prb_down") + private BigDecimal prbDown; + + @TableField("avg_disturb") + private Integer avgDisturb; + + @TableField("speed_up") + private BigDecimal speedUp; + + @TableField("speed_down") + private BigDecimal speedDown; + + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @TableField("call_drop_rate") + private BigDecimal callDropRate; + + @TableField("act_avg_user") + private BigDecimal actAvgUser; + + @TableField("act_max_user") + private Integer actMaxUser; + + @TableField("volte") + private BigDecimal volte; + + @TableField("volte_succ_rate") + private BigDecimal volteSuccRate; + + @TableField("volte_drop_rate") + private BigDecimal volteDropRate; + + @TableField("data_up") + private BigDecimal dataUp; + + @TableField("data_down") + private BigDecimal dataDown; + + @TableField("v1_max") + private BigDecimal v1Max; + + @TableField("v1_avg") + private String v1Avg; + + @TableField("update_time") + private LocalDateTime updateTime; + + ///////////////////////////////// + @TableField(exist = false) + private Integer orderId; + + @TableField(exist = false) + private String venueName; + + @TableField(exist = false) + private String venueId; + + @TableField(exist = false) + private String cellcodeci; + + @TableField(exist = false) + private String 小区频段; + + @TableField(exist = false) + private String 设备类型; + + @TableField(exist = false) + private Long 带宽; + + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi5gCell.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi5gCell.java new file mode 100644 index 0000000000000000000000000000000000000000..0cc725d6adfac3b5c47cf3551b8dcf885fa9eff6 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi5gCell.java @@ -0,0 +1,183 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 场馆5G小区级15分钟指标 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi5g_cell") +@ApiModel(value = "PmKpi5gCell对象", description = "场馆5G小区级15分钟指标") +public class NewPmKpi5gCell { + + private static final long serialVersionUID = 1L; +// @ApiModelProperty("id") +// @TableField("id") +// private Long id; + + @TableField("venue_id") + private Integer venueId; + + @TableField("venue_name") + private String venueName; + + @TableField("ci") + private String ci; + + @TableField("starttime") + private LocalDateTime starttime; + + @TableField("小区名称") + private String 小区名称; + + @TableField("nr流量") + private BigDecimal nr流量; + + @TableField("上行5g流量") + private BigDecimal 上行5g流量; + + @TableField("下行5g流量") + private BigDecimal 下行5g流量; + + @TableField("小区rlc层下行丢包率") + private BigDecimal 小区rlc层下行丢包率; + + @TableField("小区级rlc层sdu下行空口丢包数") + private BigDecimal 小区级rlc层sdu下行空口丢包数; + + @TableField("小区rlc层收到的下行sdu包数") + private BigDecimal 小区rlc层收到的下行sdu包数; + + @TableField("平均用户数") + private BigDecimal 平均用户数; + + @TableField("最大用户数") + private BigDecimal 最大用户数; + + @TableField("sn异常释放率") + private BigDecimal sn异常释放率; + + @TableField("sgnb释放总次数") + private BigDecimal sgnb释放总次数; + + @TableField("sgnb触发sgnb异常释放总次数") + private BigDecimal sgnb触发sgnb异常释放总次数; + + @TableField("nsa_sgnb添加成功率") + private BigDecimal nsaSgnb添加成功率; + + @TableField("dc场景下发送sgnb增加成功的次数") + private BigDecimal dc场景下发送sgnb增加成功的次数; + + @TableField("dc场景下收到sgnb增加尝试的次数") + private BigDecimal dc场景下收到sgnb增加尝试的次数; + + @TableField("无线接通率") + private BigDecimal 无线接通率; + + @TableField("rrc建立成功次数") + private BigDecimal rrc建立成功次数; + + @TableField("rrc建立请求消息次数") + private BigDecimal rrc建立请求消息次数; + + @TableField("小区中qos_flow建立成功次数") + private BigDecimal 小区中qosFlow建立成功次数; + + @TableField("小区中qos_flow建立尝试次数") + private BigDecimal 小区中qosFlow建立尝试次数; + + @TableField("小区中ng信令连接建立成功次数") + private BigDecimal 小区中ng信令连接建立成功次数; + + @TableField("小区中ng信令连接建立尝试次数") + private BigDecimal 小区中ng信令连接建立尝试次数; + + @TableField("无线掉线率") + private BigDecimal 无线掉线率; + + @TableField("小区中ue上下文异常释放的次数") + private BigDecimal 小区中ue上下文异常释放的次数; + + @TableField("小区中ue上下文正常释放的次数") + private BigDecimal 小区中ue上下文正常释放的次数; + + @TableField("无线掉线率分母") + private BigDecimal 无线掉线率分母; + + @TableField("切换成功率") + private BigDecimal 切换成功率; + + @TableField("切换成功率分子") + private BigDecimal 切换成功率分子; + + @TableField("切换成功率分母") + private BigDecimal 切换成功率分母; + + @TableField("下行平均使用的prb个数") + private BigDecimal 下行平均使用的prb个数; + + @TableField("下行平均可用prb个数") + private BigDecimal 下行平均可用prb个数; + + @TableField("上行平均使用的prb个数") + private BigDecimal 上行平均使用的prb个数; + + @TableField("上行平均可用prb个数") + private BigDecimal 上行平均可用prb个数; + + @TableField("上行prb利用率") + private BigDecimal 上行prb利用率; + + @TableField("下行prb利用率") + private BigDecimal 下行prb利用率; + + @TableField("input_datetime") + private LocalDateTime inputDatetime; + + @TableField("cell_name") + private String cellName; + + @TableField("pmsid") + private Long pmsid; + + @TableField("上行干扰值") + private Double 上行干扰值; + + @TableField("update_time") + private LocalDateTime updateTime; + + @TableField("endtime") + private LocalDateTime endtime; + + + ///////////////////////////////// + @TableField(exist = false) + private Integer orderId; + + @TableField(exist = false) + private String 小区频段; + + @TableField(exist = false) + private String 设备类型; + + @TableField(exist = false) + private Long 带宽; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi5gMin.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi5gMin.java new file mode 100644 index 0000000000000000000000000000000000000000..f82a19bb7d17d10df6ec28a8464a35c38c4ff250 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpi5gMin.java @@ -0,0 +1,109 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 场馆5G小区级1分钟指标 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pm_kpi5g_min") +@ApiModel(value = "PmKpi5gMin对象", description = "场馆5G小区级1分钟指标") +public class NewPmKpi5gMin { + + private static final long serialVersionUID = 1L; + + @TableField("groupid") + private Integer groupid; + + @TableField("时间") + private LocalDateTime 时间; + + @TableField("小区名称") + private String 小区名称; + + @TableField("地市区号") + private String 地市区号; + + @TableField("厂商id") + private String 厂商id; + + @TableField("prb_up") + private Double prbUp; + + @TableField("prb_down") + private Double prbDown; + + @TableField("up_disturb") + private Integer upDisturb; + + @TableField("speed_up") + private Double speedUp; + + @TableField("speed_down") + private Double speedDown; + + @TableField("act_max_user") + private Integer actMaxUser; + + @TableField("act_avg_user") + private Double actAvgUser; + + @TableField("rrc_avg_user") + private BigDecimal rrcAvgUser; + + @TableField("rrc_max_user") + private Integer rrcMaxUser; + + @TableField("call_succ_rate") + private BigDecimal callSuccRate; + + @TableField("drop_call_rate") + private BigDecimal dropCallRate; + + @TableField("data_down") + private BigDecimal dataDown; + + @TableField("data_up") + private BigDecimal dataUp; + + @TableField("update_time") + private LocalDateTime updateTime; + + ///////////////////////////////// + @TableField(exist = false) + private Integer orderId; + + @TableField(exist = false) + private String venueName; + + @TableField(exist = false) + private String venueId; + + @TableField(exist = false) + private String cellcodeci; + + @TableField(exist = false) + private String 小区频段; + + @TableField(exist = false) + private String 设备类型; + + @TableField(exist = false) + private Long 带宽; + + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiCellMonitorQO.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiCellMonitorQO.java new file mode 100644 index 0000000000000000000000000000000000000000..7f81412e80b6371dac31ead73c1ccd832ab36ba4 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiCellMonitorQO.java @@ -0,0 +1,92 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.sunlm.daping.dp3d.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/14 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class NewPmKpiCellMonitorQO extends NewCommonDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "数据类型", required = true) + @NotBlank(message = "timetype不能为空") + private String datatype; + + @ApiModelProperty(value = "网络类型", required = true) + @NotBlank(message = "netType不能为空") + private String nettype; + + @ApiModelProperty(value = "区县id") + private String regionid; + + @ApiModelProperty(value = "区县id") + private String regionIdv; + + @ApiModelProperty(value = "场馆ids") + private Integer[] sceneids; + + @ApiModelProperty(value = "场馆id") + private Integer sceneid; + + @ApiModelProperty(value = "小区id(多选)") + @TableField("小区id") + private String[] villageids; + + @ApiModelProperty(value = "小区名称(多选)") + @TableField("小区名称") + private String[] villagenames; + + @ApiModelProperty(value = "开始时间", required = true) + @TableField("starttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "starttime不能为空") + private LocalDateTime starttime; + + @ApiModelProperty(value = "结束时间", required = true) + @TableField("endtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "endtime不能为空") + private LocalDateTime endtime; + + @ApiModelProperty(value = "排序字段名") + @NotBlank(message = "排序字段名不能为空") + private String sortcol; + + @ApiModelProperty(value = "排序") + @NotBlank(message = "排序不能为空") + private String sort; + + @ApiModelProperty(value = "坐席区(多选)") + private String[] seat; + + @ApiModelProperty(value = "坐席区颜色") + private String seatcolor; + + @ApiModelProperty(value = "指标名称") + @NotBlank(message = "指标名称不能为空") + private String kpiname; + + @ApiModelProperty(value = "是否为缓存查询(是:true)",required = true) + @NotNull(message = "isCache参数不能为空") + private Boolean iscache; + + private String seatno; + + private String inorout; ///add by sunlm 2023-07-18 + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiCellQO.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiCellQO.java new file mode 100644 index 0000000000000000000000000000000000000000..303bdc6fb34a7b81d9bb7ccf657c271ff153a351 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiCellQO.java @@ -0,0 +1,82 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableField; + +import java.time.LocalDateTime; + +import com.ruoyi.sunlm.daping.dp3d.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import reactor.util.annotation.NonNull; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + *

+ * 场馆4G小区级15分钟指标QO + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class NewPmKpiCellQO extends NewCommonDTO { + + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "网络类型:0-4G,1-5G", required = true) + @NotBlank(message = "netType不能为空") + private String netType; + + @ApiModelProperty(value = "区县id") + private String regionId; + + @ApiModelProperty(value = "区县id") + private String regionIdv; + + @ApiModelProperty(value = "场馆ids") + private Integer[] venueIds; + + @ApiModelProperty(value = "场馆id") + private Integer venueid; + + + @ApiModelProperty(value = "小区id(多选)") + @TableField("小区id") + private String[] villageIds; + + @ApiModelProperty(value = "小区名称(多选)") + @TableField("小区名称") + private String[] villageNames; + + @ApiModelProperty(value = "开始时间", required = true) + @TableField("starttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "starttime不能为空") + private LocalDateTime starttime; + + @ApiModelProperty(value = "结束时间", required = true) + @TableField("endtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "endtime不能为空") + private LocalDateTime endtime; + + @ApiModelProperty(value = "排序字段名") + @NotBlank(message = "排序字段名不能为空") + private String sortcol; + + @ApiModelProperty(value = "排序") + @NotBlank(message = "排序不能为空") + private String sort; + + private LocalDateTime querystarttime; + + private Integer queryvenueid; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiColorQo.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiColorQo.java new file mode 100644 index 0000000000000000000000000000000000000000..68857fa325da0eb8ebd6e3df03a230b8ab54ac9b --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiColorQo.java @@ -0,0 +1,44 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +/** + * @author yqf + * @date 2023/4/26 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class NewPmKpiColorQo { + + + @ApiModelProperty(value = "网络类型") + private String nettype; + + @ApiModelProperty("最大用户数值") + private BigDecimal maxuservalue; + + @ApiModelProperty("上行prb利用率值") + private BigDecimal prbupvalue; + + @ApiModelProperty("下行prb利用率值") + private BigDecimal prbdownvalue; + + @ApiModelProperty("上行平均干扰值") + private BigDecimal avgdisvalue; + + @ApiModelProperty("小区频段") + private String freqtype; + + @ApiModelProperty("设备类型") + private String devicetype; + + @ApiModelProperty("带宽") + private Long bandwidth; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiMinQO.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiMinQO.java new file mode 100644 index 0000000000000000000000000000000000000000..0c53d8940641895fa55a615452647cd1a862edf2 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiMinQO.java @@ -0,0 +1,70 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.sunlm.daping.dp3d.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/12 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class NewPmKpiMinQO extends NewCommonDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "网络类型:0-4G,1-5G", required = true) + @NotBlank(message = "netType不能为空") + private String netType; + + @ApiModelProperty(value = "区县id") + private String regionId; + + @ApiModelProperty(value = "区县id") + private String regionIdv; + + @ApiModelProperty(value = "场馆ids") + private Integer[] venueIds; + + @ApiModelProperty(value = "场馆id") + private Integer venueid; + + @ApiModelProperty(value = "小区id(多选)") + @TableField("小区id") + private String[] villageIds; + + @ApiModelProperty(value = "小区名称(多选)") + @TableField("小区名称") + private String[] villageNames; + + @ApiModelProperty(value = "开始时间", required = true) + @TableField("starttime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "starttime不能为空") + private LocalDateTime starttime; + + @ApiModelProperty(value = "结束时间", required = true) + @TableField("endtime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @NotNull(message = "endtime不能为空") + private LocalDateTime endtime; + + @ApiModelProperty(value = "排序字段名") + @NotBlank(message = "排序字段名不能为空") + private String sortcol; + + @ApiModelProperty(value = "排序") + @NotBlank(message = "排序不能为空") + private String sort; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiMonitorEntity.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiMonitorEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..8a05ab1b896d48f3273fcd4a5c9e387d44863072 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiMonitorEntity.java @@ -0,0 +1,81 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "PmKpiMonitorEntity对象", description = "场馆4G小区级1分钟指标") +public class NewPmKpiMonitorEntity { + + private static final long serialVersionUID = 1L; + private Long id; + + private Integer venueid; + + private String venuename; + + private String cellcodeci; + + private LocalDateTime starttime; + + private String 小区名称; + + private BigDecimal 平均用户数; + + private BigDecimal 最大用户数; + + private BigDecimal 上行prb利用率; + + private BigDecimal 下行prb利用率; + + private BigDecimal 上行平均干扰; + + private BigDecimal 无线掉线率; + + private BigDecimal 无线接通率; + + private LocalDateTime endtime; + + private Integer orderId; + + private String 坐席编号; + + private LocalDateTime 时间; + + private Long stationno; + private String pointname; + private String pointid; + private Double longitude; + private Double latitude; + + private String maxuserColor; + private String prbupColor; + private String prbdownColor; + private String avgdisColor; + private Integer maxuserScore; + private Integer prbupScore; + private Integer prbdownScore; + private Integer avgdisScore; + + //----------------------------added by sunlm 2023 .07-25 + private Integer 综合得分值; //后续用于保存 value = maxuserScore+prbupScore+prbdownScore, 目前用于保存 score + private Integer 综合得分score; //后续增加这个字段,保存score + private String 综合得分颜色; + //------------------------------------------------------ + + private String 小区频段; + private String 设备类型; + private Long 带宽; + private Long 方位角; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiVO.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiVO.java new file mode 100644 index 0000000000000000000000000000000000000000..c8600e4a7718d7f4c7b8420d72ec9f1b5d086dea --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewPmKpiVO.java @@ -0,0 +1,52 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class NewPmKpiVO { + + @ApiModelProperty(value = "数值") + private BigDecimal value; + + @ApiModelProperty(value = "最大数值") + private BigDecimal maxvalue; + + @ApiModelProperty(value = "颜色") + private String color; + + @ApiModelProperty(value = "分数") + private float score; + + @ApiModelProperty(value = "data") + private List data; + + public NewPmKpiVO(BigDecimal maxvalue, String color) { + this.maxvalue = maxvalue; + this.color = color; + } + + public NewPmKpiVO(BigDecimal value, BigDecimal maxvalue, String color) { + this.value = value; + this.maxvalue = maxvalue; + this.color = color; + } + + public NewPmKpiVO(String color) { + this.color = color; + } + + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewRecordVo.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewRecordVo.java new file mode 100644 index 0000000000000000000000000000000000000000..bbf6d8421a57fb0e08eccb4458ac58b6d80c75b5 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/daping/dp3d/NewRecordVo.java @@ -0,0 +1,27 @@ +package com.ruoyi.sunlm.daping.dp3d; + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * @author yqf + * @date 2023/4/11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class NewRecordVo { + + private LocalDateTime time; + + private BigDecimal prbupcount; + private BigDecimal prbdowncount; + private BigDecimal maxusercount; + private BigDecimal avgdisturbcount; + private BigDecimal gbcount; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_btsinfo.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_btsinfo.java new file mode 100644 index 0000000000000000000000000000000000000000..a2c19460fc7b22637e99001a20142a3a628bec44 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_btsinfo.java @@ -0,0 +1,36 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + + + +/* { + "CI": "201692524", + "NAME": "H11665755-萧山奥体游泳馆-H5X", + "NAME2": "H417816-萧山奥体游泳馆-HFX-D902-奥体游泳馆体育馆移动小微站2LY-108CA68", + "TYPE": null, + "LONGTITUDE": "30.236615", + "LATITUDE": "120.228811", + "DIRECTION": "340", + "GD_LONG": "120.233309", + "GD_LAT": "30.234167", + "VALUE": "8" } +* */ +@Data +public class class_dp_btsinfo { + public String ci; + public String name; + public String name2; + public String type; + public String longitude; + public String latitude; + public String direction; + public String gdLong; + public String gdLat; + public String algoValue; + public String avgUsrValue; + public String uplnkPrbvalue; + public String downlnkPrbvalue; + public String level; + public String cellType; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_compare.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_compare.java new file mode 100644 index 0000000000000000000000000000000000000000..69b2cc28909d9e9f2b628d30bb7dda13623ef394 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_compare.java @@ -0,0 +1,10 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +@Data +public class class_dp_compare { + public String datetime; + public float value; + public int sign; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_left_1.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_left_1.java new file mode 100644 index 0000000000000000000000000000000000000000..87b98e426ba0861a8e2e748fe0ed5acf600e305c --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_left_1.java @@ -0,0 +1,47 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +import java.util.List; + +/* + { +    "label": [ +        "昨天(2023年04月6日)", +        "今天(2023年04月7日)" +    ], +    "xAxis": [ +        "1时", +        "2时", +        "3时", +        "4时", +        "5时" +    ], +    "value": [ +        600, +        800, +        580, +        400, +        880, +        580, +        630 +    ], +    "value2": [ +        420, +        405, +        780, +        630, +        600, +        900, +        570 +    ] +} +* */ +@Data +public class class_dp_left_1 { //大屏左侧1 + public List label; + public List xaxis; + public List value; + public List value2; +} + diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_left_2.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_left_2.java new file mode 100644 index 0000000000000000000000000000000000000000..ca38d969bfb93dfbf24c63e9da2d8a4b9ee45fb5 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_left_2.java @@ -0,0 +1,45 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +import java.util.List; +/* + { +    "label": [ +        "昨天(2023年04月6日)", +        "今天(2023年04月7日)" +    ], +    "xAxis": [ +        "1时", +        "2时", +        "3时", +        "4时", +        "5时" +    ], +    "value": [ +        600, +        800, +        580, +        400, +        880, +        580, +        630 +    ], +    "value2": [ +        420, +        405, +        780, +        630, +        600, +        900, +        570 +    ] +} +* */ +@Data +public class class_dp_left_2 { + public List label; + public List xaxis; + public List value; + public List value2; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_maps.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_maps.java new file mode 100644 index 0000000000000000000000000000000000000000..122a83e6ce1b599b43e0ac882da7e6f0c67bca9d --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_maps.java @@ -0,0 +1,34 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +import java.util.List; + +@Data + +/* +* { + "name":'杭州奥体中心', + “center”: “120,30” + "data":[ + { + "CI": "201692524", + "NAME": "H11665755-萧山奥体游泳馆-H5X", + "NAME2": "H417816-萧山奥体游泳馆-HFX-D902-奥体游泳馆体育馆移动小微站2LY-108CA68", + "TYPE": null, + "LONGTITUDE": "30.236615", + "LATITUDE": "120.228811", + "DIRECTION": "340", + "GD_LONG": "120.233309", + "GD_LAT": "30.234167", + "VALUE": "8" + }, + ...... + } +* */ + +public class class_dp_maps { + public String name; + public String center; + public List data; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_maps_topinfo.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_maps_topinfo.java new file mode 100644 index 0000000000000000000000000000000000000000..8a2db46777c507a4d78d323607d193909c07f2b0 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_maps_topinfo.java @@ -0,0 +1,71 @@ +package com.ruoyi.sunlm.domain; + +/* +* { +    "red": 123, +    "orange": 123, +    "yellow": 123, +    "green": 123 +} +* */ + +/* +* { + "name":'杭州奥体中心', + “center”: “120,30” + "data":[ + { + "CI": "201692524", + "NAME": "H11665755-萧山奥体游泳馆-H5X", + "NAME2": "H417816-萧山奥体游泳馆-HFX-D902-奥体游泳馆体育馆移动小微站2LY-108CA68", + "TYPE": null, + "LONGTITUDE": "30.236615", + "LATITUDE": "120.228811", + "DIRECTION": "340", + "GD_LONG": "120.233309", + "GD_LAT": "30.234167", + "VALUE": "8" + }, + ...... + } +* */ + +//------------------------------合二为一 +/* +{ + "red": 123, +    "orange": 123, +    "yellow": 123, +    "green": 123, + "name":'杭州奥体中心', + “center”: “120,30” + "data":[ + { + "CI": "201692524", + "NAME": "H11665755-萧山奥体游泳馆-H5X", + "NAME2": "H417816-萧山奥体游泳馆-HFX-D902-奥体游泳馆体育馆移动小微站2LY-108CA68", + "TYPE": null, + "LONGTITUDE": "30.236615", + "LATITUDE": "120.228811", + "DIRECTION": "340", + "GD_LONG": "120.233309", + "GD_LAT": "30.234167", + "VALUE": "8" + }, + ...... + } +*/ + + +import lombok.Data; + +import java.util.List; + +@Data +public class class_dp_maps_topinfo { + public class_dp_topinfo total; + public String name; + public String center; + public List data; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scene_control.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scene_control.java new file mode 100644 index 0000000000000000000000000000000000000000..e200b19dbc28e4e379909039039c50fdd580a3da --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scene_control.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +public class class_dp_scene_control { + private int mintype; + private String nettype; + private String kpiname; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scene_seat_detail.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scene_seat_detail.java new file mode 100644 index 0000000000000000000000000000000000000000..e10d587808d94c3544c676ebdc3a7f35e30bdf9e --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scene_seat_detail.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +public class class_dp_scene_seat_detail { + public String seatid; + public int seatnumber; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scene_seat_info.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scene_seat_info.java new file mode 100644 index 0000000000000000000000000000000000000000..5a55bd6e505a2657a2a84b96eae5c42ae3bd006a --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scene_seat_info.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +/** + * @author yqf + * @date 2023/4/17 + */ +@Data +public class class_dp_scene_seat_info { + public Integer length; + public Integer width; + public Integer angle; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scenelist.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scenelist.java new file mode 100644 index 0000000000000000000000000000000000000000..9a6aa9cca1fa83efed8bec499e0a1fec4bd39780 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_scenelist.java @@ -0,0 +1,9 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +@Data +public class class_dp_scenelist { + public int venueId; + public String venueName; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_top5.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_top5.java new file mode 100644 index 0000000000000000000000000000000000000000..5333b57d17c90552bcc2fee69729b66cba706f71 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_top5.java @@ -0,0 +1,41 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +/** + * [ + *     { + *         "title": "1", + *         "name": "H517599-杭州萧山奥邸国际写字楼区电梯地下室-HLW-F601-地下室SF-1", + *         "value": 20.8 + *     }, + *     { + *         "title": "2", + *         "name": "萧山石岩老街西FDD1800_66", + *         "value": 19.15 + *     }, + *     { + *         "title": "3", + *         "name": "H518207-萧山亚运村运动员一村D区-HLH-FD18102-亚运村运动员一村D02LY-8", + *         "value": 16.517 + *     }, + *     { + *         "title": "4", + *         "name": "H417875-萧山奥体博览中心-HFX-FD18901-奥体博览中心移动小微站11LY-65", + *         "value": 13.583 + *     }, + *     { + *         "title": "5", + *         "name": "萧山宝盛大厦CRAN利二路博奥路口3DMIMO_196", + *         "value": 11.367 + *     } + * ] + * */ + +@Data +public class class_dp_top5 { + public int title; + public String name; + public Float value; + public String color; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_topinfo.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_topinfo.java new file mode 100644 index 0000000000000000000000000000000000000000..2d8988012490f8c5d3a541201a33e9cfccd95db8 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_dp_topinfo.java @@ -0,0 +1,19 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +/* +* { +    "red": 123, +    "orange": 123, +    "yellow": 123, +    "green": 123 +} +* */ +@Data +public class class_dp_topinfo { + public int red; + public int orange; + public int yellow; + public int green; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_medal_stand.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_medal_stand.java new file mode 100644 index 0000000000000000000000000000000000000000..1e9f31cfeda221ef2e4b2b1a87ded05ce23b372e --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_medal_stand.java @@ -0,0 +1,43 @@ +package com.ruoyi.sunlm.domain; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +@Data +public class class_medal_stand { + public int id; + + @Excel(name = "国家或地区", cellType = Excel.ColumnType.STRING, prompt = "国家或地区") + public String areaName; + + @Excel(name = "金牌", cellType = Excel.ColumnType.STRING, prompt = "金牌数") + public int goldCount; + + @Excel(name = "银牌", cellType = Excel.ColumnType.STRING, prompt = "银牌数") + public int silverCount; + + @Excel(name = "铜牌", cellType = Excel.ColumnType.STRING, prompt = "铜牌数") + public int bronzeCount; + + @Excel(name = "奖牌数", cellType = Excel.ColumnType.STRING) + public int medalsCount; + + //@Excel(name = "更新人", cellType = Excel.ColumnType.STRING, prompt = "更新人") + public String updateBy; + + @Excel(name = "更新人", cellType = Excel.ColumnType.STRING) + public String updateByName; + + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT, prompt = "更新时间") + public Date updateTime; + + public int medalSort; + + public int sceneBigId; + + @Excel(name = "场景", cellType = Excel.ColumnType.STRING, prompt = "场景") + public String sceneBigName; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_public_news.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_public_news.java new file mode 100644 index 0000000000000000000000000000000000000000..cbbe3e846ac256f76a8855c5cb29a85cafc4f69d --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_public_news.java @@ -0,0 +1,33 @@ +package com.ruoyi.sunlm.domain; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +@Data +public class class_public_news { + public int id; + + @Excel(name = "标题", cellType = Excel.ColumnType.STRING,sort=1) + public String title; + + @Excel(name = "内容链接", cellType = Excel.ColumnType.STRING,sort=3) + public String contentUrl; + + @Excel(name = "内容", cellType = Excel.ColumnType.STRING,sort=2) + public String content; + + //@Excel(name = "更新人", cellType = Excel.ColumnType.STRING, prompt = "更新人") + public String updateBy; + + @Excel(name = "更新人", cellType = Excel.ColumnType.STRING,sort=4) + public String updateByName; + + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT,sort=5) + public Date updateTime; + + //@Excel(name = "场景", cellType = Excel.ColumnType.STRING, prompt = "场景") + public int sceneBigId; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_big_config.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_big_config.java new file mode 100644 index 0000000000000000000000000000000000000000..5d1e7380d53f96e88c213a3762616011c669b5fa --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_big_config.java @@ -0,0 +1,41 @@ +package com.ruoyi.sunlm.domain; + + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; //可以省去写类的GET和Set方法 + +import java.util.Date; +import java.util.List; + +@Data +//----------------------------大场馆 +//20230312 jkj 根据需求改 +//场景配置导出 +// 缺:ID、是否默认; +// 删除:备注、修改人、修改时间、创建人 +public class class_scene_big_config { + + @Excel(name = "ID") + public int id; + + @Excel(name = "主场景名称", cellType = Excel.ColumnType.STRING, prompt = "主场景名称") + public String name; + + @Excel(name = "状态", cellType = Excel.ColumnType.STRING, prompt = "状态", readConverterExp = "0=启用,1=停用,2=当前") + public String status; + +// @Excel(name = "创建人", cellType = Excel.ColumnType.STRING, prompt = "创建人") + public String createBy; + + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT, prompt = "创建时间") + public Date createTime; + +// @Excel(name = "修改人", cellType = Excel.ColumnType.STRING, prompt = "修改人") + public String updateBy; + +// @Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT, prompt = "修改时间") + public Date updateTime; + +// @Excel(name = "备注", cellType = Excel.ColumnType.STRING, prompt = "备注") + public String remark; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_calendar.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_calendar.java new file mode 100644 index 0000000000000000000000000000000000000000..07b10093f35203191dc0672e9cf033f4f97eee57 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_calendar.java @@ -0,0 +1,44 @@ +package com.ruoyi.sunlm.domain; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.sql.Time; +import java.util.Date; + +@Data +public class class_scene_calendar { //赛事 + + @Excel(name = "编号", cellType = Excel.ColumnType.STRING, sort = 1) + public int id; + + public int sceneId; + + @Excel(name = "比赛类型", cellType = Excel.ColumnType.STRING, sort = 3) + public String matchType; + + @Excel(name = "比赛名称", cellType = Excel.ColumnType.STRING, sort = 4) + public String matchName; + + @Excel(name = "备注", cellType = Excel.ColumnType.STRING, sort = 10) + public String matchRemark; + + @Excel(name = "开始时间", dateFormat = "HH:mm:ss", type = Excel.Type.EXPORT, sort = 6) + public Time beginTime; + + @Excel(name = "结束时间", dateFormat = "HH:mm:ss", type = Excel.Type.EXPORT, sort = 7) + public Time endTime; + + @Excel(name = "比赛日期", dateFormat = "yyyy-MM-dd", type = Excel.Type.EXPORT, sort = 5) + public Date matchDate; + + @Excel(name = "状态", cellType = Excel.ColumnType.STRING, sort = 8) + public String status; + + //----20230523 新增字段 + @Excel(name = "夺金点", cellType = Excel.ColumnType.STRING, readConverterExp = "0=否,1=是", sort = 9) + public String goldPoint; + + @Excel(name = "场馆", cellType = Excel.ColumnType.STRING, sort = 2) + public String venueName; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_match.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_match.java new file mode 100644 index 0000000000000000000000000000000000000000..4f07437414e6088e3168c4193345d4b29c23139d --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_match.java @@ -0,0 +1,44 @@ +package com.ruoyi.sunlm.domain; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.sql.Time; +import java.util.Date; + +@Data +public class class_scene_match { //赛程 + + @Excel(name = "编号", cellType = Excel.ColumnType.STRING, sort = 1) + public int id; + + public int sceneId; + + @Excel(name = "场馆名称", cellType = Excel.ColumnType.STRING, sort = 2) + public String venueName; + + @Excel(name = "赛程名称", cellType = Excel.ColumnType.STRING, sort = 4) + public String taskName; + + @Excel(name = "赛程状态", cellType = Excel.ColumnType.STRING, readConverterExp = "0=启用,1=停用", sort = 7) + public String taskStatus; + + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT, sort = 5) + public Date beginTime; + + @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT, sort = 6) + public Date endTime; + + @Excel(name = "赛程类型", width = 30, type = Excel.Type.EXPORT, sort = 3) + public String taskType; + + public String createBy; + + public Date createTime; + + public String updateBy; + + public Date updateTime; + + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_team.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_team.java new file mode 100644 index 0000000000000000000000000000000000000000..13dfb9e074115f95004c32bde2accdde8adca6fb --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_team.java @@ -0,0 +1,51 @@ +package com.ruoyi.sunlm.domain; + +import com.ruoyi.common.annotation.Excel; +import lombok.Data; + +import java.sql.Time; +import java.util.Date; +import java.util.List; + +@Data +public class class_scene_team { //施工队 + public int id; + + public String specialty; + + @Excel(name = "专业", cellType = Excel.ColumnType.STRING,sort=4) + public String specialtyname; + + public int sceneBigId; + + //@Excel(name = "场景名称", cellType = Excel.ColumnType.STRING, prompt = "场景名称") + public String sceneBigName; + + @Excel(name = "施工单位", cellType = Excel.ColumnType.STRING,sort=1) + public String venderName; + + @Excel(name = "状态", cellType = Excel.ColumnType.STRING,readConverterExp = "0=启用,1=停用",sort=7) + public String status; + + public String county; + + @Excel(name = "区县", cellType = Excel.ColumnType.STRING,sort=3) + public String countyname; + + public String city; + + @Excel(name = "地市", cellType = Excel.ColumnType.STRING,sort=2) + public String cityname; + + @Excel(name = "备注", cellType = Excel.ColumnType.STRING,sort=6) + public String remark; + + // @Excel(name = "施工队人员", cellType = Excel.ColumnType.STRING, prompt = "施工队人员") + public List user; + + // @Excel(name = "负责场馆", cellType = Excel.ColumnType.STRING) + public List dutyScene; + + @Excel(name = "负责场馆", cellType = Excel.ColumnType.STRING,sort=5) + public String dutySceneNames; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_team_scene.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_team_scene.java new file mode 100644 index 0000000000000000000000000000000000000000..8fa6c1d531128d580bf4458b362cb117bbc63f3a --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_team_scene.java @@ -0,0 +1,11 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +@Data +public class class_scene_team_scene { //施工队的场馆 + public int id; + public int construcTeamId; + public int dutySceneId; + public String venueName; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_team_user.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_team_user.java new file mode 100644 index 0000000000000000000000000000000000000000..b328b5e816c2cf956794f0893bfd739f9d5ebc61 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/domain/class_scene_team_user.java @@ -0,0 +1,11 @@ +package com.ruoyi.sunlm.domain; + +import lombok.Data; + +@Data +public class class_scene_team_user { //施工队人员 + public int id; + public int construcTeamId; + public int userId; + public String userName; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_medal_stand_list.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_medal_stand_list.java new file mode 100644 index 0000000000000000000000000000000000000000..e14f1172fedc81da5de0ceca40d702a863643e95 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_medal_stand_list.java @@ -0,0 +1,9 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +@Data +public class class_medal_stand_list extends publicEntity { // 查询用, 支持分页 + public String sceneBigId; + public String areaName; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_medal_stand_new.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_medal_stand_new.java new file mode 100644 index 0000000000000000000000000000000000000000..7e12fc4efaeba9af4c683c4ec1e3176a9d7cab4a --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_medal_stand_new.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +@Data +public class class_medal_stand_new { + public String sceneBigId; + public String areaName; + public String goldCount; + public String silverCount; + public String bronzeCount; + public String medalsCount; + public String updateBy; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_medal_stand_upt.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_medal_stand_upt.java new file mode 100644 index 0000000000000000000000000000000000000000..3d2c8746185e011f2a97d02155a702a9f3f99a51 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_medal_stand_upt.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +@Data +public class class_medal_stand_upt { + public int id; + public String sceneBigId; + public String areaName; + public String goldCount; + public String silverCount; + public String bronzeCount; + public String medalsCount; + public String updateBy; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_public_news_list.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_public_news_list.java new file mode 100644 index 0000000000000000000000000000000000000000..540a38a07324c40bc6c2c83df4513abcfb403e1e --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_public_news_list.java @@ -0,0 +1,12 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_public_news_list extends publicEntity { // 查询用, 支持分页 + public String sceneBigId; + public String title; + public String content; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_public_news_new.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_public_news_new.java new file mode 100644 index 0000000000000000000000000000000000000000..4fe20e2fd681b1fe630167c1fe74c166fc86756c --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_public_news_new.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_public_news_new { + public String sceneBigId; + public String title; + public String contentUrl; + public String content; + public String updateBy; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_public_news_upt.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_public_news_upt.java new file mode 100644 index 0000000000000000000000000000000000000000..1f7c5191c87d65c22bfe3642358b95b5512cee4d --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_public_news_upt.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +@Data +public class class_public_news_upt { + public int id; + public String sceneBigId; + public String title; + public String contentUrl; + public String content; + public String updateBy; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_scene_team_list.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_scene_team_list.java new file mode 100644 index 0000000000000000000000000000000000000000..1219bd87917e9128a49bae5dcdb70f40b8c7a0df --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_scene_team_list.java @@ -0,0 +1,16 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_scene_team_list extends publicEntity { //施工队,查询用, 支持分页 + public String sceneBigId; + public String specialty; + public String venderName; + public String county; + public String city; + public String status; + public List sceneIds; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_scene_team_new.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_scene_team_new.java new file mode 100644 index 0000000000000000000000000000000000000000..310d2242a28b86a81df1ddc36cd9eb1252b2450d --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_scene_team_new.java @@ -0,0 +1,18 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_scene_team_new { + public int sceneBigId; + public String specialty; + public String venderName; + public String county; + public String city; + public String status; + public String remark; + public List dutySceneIds; + // public List userIds; //不需要了 +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_scene_team_upt.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_scene_team_upt.java new file mode 100644 index 0000000000000000000000000000000000000000..9c3edc777c40b05c2c950019608f80bb972aa0b3 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/class_scene_team_upt.java @@ -0,0 +1,19 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class class_scene_team_upt { + public int id; + public int sceneBigId; + public String specialty; + public String venderName; + public String county; + public String city; + public String status; + public String remark; + public List dutySceneIds; + // public List userIds; //不需要了 +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/publicEntity.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/publicEntity.java new file mode 100644 index 0000000000000000000000000000000000000000..72e96d5a0d38edc4704da12e038945c86bd0c383 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/publicEntity.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +@Data +public class publicEntity { + public Integer pageNum; + public Integer pageSize; +} + + + + diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_big_entity_list.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_big_entity_list.java new file mode 100644 index 0000000000000000000000000000000000000000..6f2a3005a90a2e352d9b6d9a26b7aa18a1f62178 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_big_entity_list.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class scene_big_entity_list extends publicEntity { //场景,查询用, 支持分页 + public String name; + public List status; + public String remark; +} + + + diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_big_entity_new.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_big_entity_new.java new file mode 100644 index 0000000000000000000000000000000000000000..8526a1492fc2a819bb039f65cc5a147c2ef92093 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_big_entity_new.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +import java.util.Date; + +@Data +public class scene_big_entity_new { //用于新增 + public String name; + public String status; + public String createBy; + public String remark; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_big_entity_upt.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_big_entity_upt.java new file mode 100644 index 0000000000000000000000000000000000000000..19cfbe40007266295e84e29dea2616f7948b3aa3 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_big_entity_upt.java @@ -0,0 +1,13 @@ +package com.ruoyi.sunlm.entity; + + +import lombok.Data; + +@Data +public class scene_big_entity_upt { + public int id; + public String name; + public String updateBy; + public String status; + public String remark; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_calendar_entity_list.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_calendar_entity_list.java new file mode 100644 index 0000000000000000000000000000000000000000..fd42656cd1e6219f73ff249fca520ca2af813bfd --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_calendar_entity_list.java @@ -0,0 +1,17 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class scene_calendar_entity_list extends publicEntity { //赛事,查询用, 支持分页 + public String sceneBigId; + public List sceneIds; + public String matchType; + public String matchName; + public String matchRemark; + public String status; + public String matchDate; + public String goldPoint; +} \ No newline at end of file diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_calendar_entity_new.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_calendar_entity_new.java new file mode 100644 index 0000000000000000000000000000000000000000..665fc5877698926aa4049d82680d073b7394fc9e --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_calendar_entity_new.java @@ -0,0 +1,17 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + + +@Data +public class scene_calendar_entity_new { //用于新增 + public int sceneId; + public String matchType; + public String matchName; + public String matchRemark; + public String status; + public String beginTime; + public String endTime; + public String matchDate; + public String goldPoint; +} \ No newline at end of file diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_calendar_entity_upt.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_calendar_entity_upt.java new file mode 100644 index 0000000000000000000000000000000000000000..bcaef944b9c37c88c620d69bad5ed62e4490b858 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_calendar_entity_upt.java @@ -0,0 +1,17 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +@Data +public class scene_calendar_entity_upt { + public int id; + public int sceneId; + public String matchType; + public String matchName; + public String matchRemark; + public String status; + public String beginTime; + public String endTime; + public String matchDate; + public String goldPoint; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_match_entity_list.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_match_entity_list.java new file mode 100644 index 0000000000000000000000000000000000000000..42d59dcba236cd4b5dd647ca7c78a4d76e0778f6 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_match_entity_list.java @@ -0,0 +1,19 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +import java.util.List; + +@Data +public class scene_match_entity_list extends publicEntity { //赛程,查询用, 支持分页 + public String sceneBigId; + public List sceneIds; + public String taskName; + public String taskStatus; + public String taskType; + public String taskDate; +} + + + + diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_match_entity_new.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_match_entity_new.java new file mode 100644 index 0000000000000000000000000000000000000000..d1c378214787f459be882be6bfa6bf7fd0e7586b --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_match_entity_new.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +@Data +public class scene_match_entity_new { + public int sceneId; + public String taskName; + public String taskStatus; + public String taskType; + public String beginTime; + public String endTime; + public String createBy; + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_match_entity_upt.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_match_entity_upt.java new file mode 100644 index 0000000000000000000000000000000000000000..8f037a33b0b0e159ec0aaffb76cb725b12467f81 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/entity/scene_match_entity_upt.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.entity; + +import lombok.Data; + +@Data +public class scene_match_entity_upt { + public int id; + public int sceneId; + public String taskName; + public String taskStatus; + public String taskType; + public String beginTime; + public String endTime; + public String updateBy; +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/DpApiMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/DpApiMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..e64af2dfa6782b4234b59f584ae5d3167f1e6f85 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/DpApiMapper.java @@ -0,0 +1,65 @@ +package com.ruoyi.sunlm.mapper; + +import com.ruoyi.sunlm.domain.class_dp_scene_control; +import com.ruoyi.sunlm.domain.class_dp_scene_seat_detail; +import com.ruoyi.sunlm.domain.class_dp_scene_seat_info; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.SelectProvider; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + * @author yqf + * @date 2023/4/18 + */ +@Mapper +@Component +public interface DpApiMapper { + + //region------------------------------------------------------------------------------------获取席座数据 + + class class_get_seat_data + { + public String get_scene_seat_info_SQL(@Param("sceneid") int sceneid) + { + String SQL="SELECT length,width,angle FROM dp_scene_seat_info where scene_id = "+sceneid; + return SQL; + } + public String get_seat_detail_SQL(@Param("sceneid") int sceneid) + { + String SQL="SELECT seat_id seatid,seat_number FROM dp_scene_seat_detail where scene_id = "+sceneid; + return SQL; + } + public String get_scene_control_SQL(@Param("sceneid") int sceneid) + { + String SQL="SELECT seat_id seatid,seat_number FROM dp_scene_seat_detail where scene_id = "+sceneid; + return SQL; + } + + + } + @SelectProvider(type = class_get_seat_data.class,method = "get_scene_seat_info_SQL") + class_dp_scene_seat_info get_scene_seat_info(@Param("sceneid") int sceneid); + + @SelectProvider(type = class_get_seat_data.class,method = "get_seat_detail_SQL") + List get_seat_detail(@Param("sceneid") int sceneid); + + @Select("SELECT mintype,nettype,kpiname FROM dp_scene_control limit 1") + class_dp_scene_control get_scene_control(); + + @Select("select starttime,endtime from pm_kpi4g_cell ORDER BY starttime desc limit 1") + Map getLastTime(); + + @Select("SELECT runtype FROM dp_scene_runtype limit 1") + Integer getsceneruntype(); + + @Select("SELECT maxtime FROM dp_scene_currtime limit 1") + LocalDateTime getmaxtime(); + + //endregion +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewDpApiMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewDpApiMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..a82b466f7166dcbded0892240d5cfb97ac1b5c74 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewDpApiMapper.java @@ -0,0 +1,68 @@ +package com.ruoyi.sunlm.mapper; + +import com.ruoyi.sunlm.daping.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.SelectProvider; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + * @author yqf + * @date 2023/4/18 + */ +@Mapper +@Component +public interface NewDpApiMapper { + + //region------------------------------------------------------------------------------------获取席座数据 + + class class_get_seat_data + { + public String get_scene_seat_info_SQL(@Param("sceneid") int sceneid) + { + String SQL="SELECT length,width,angle FROM dp_scene_seat_info where scene_id = "+sceneid; + return SQL; + } + public String get_seat_detail_SQL(@Param("sceneid") int sceneid) + { + String SQL="SELECT seat_id seatid,seat_number FROM dp_scene_seat_detail where scene_id = "+sceneid; + return SQL; + } + public String get_scene_control_SQL(@Param("sceneid") int sceneid) + { + String SQL="SELECT seat_id seatid,seat_number FROM dp_scene_seat_detail where scene_id = "+sceneid; + return SQL; + } + + + } + @SelectProvider(type = class_get_seat_data.class,method = "get_scene_seat_info_SQL") + class_dp_2_scene_seat_info get_scene_seat_info(@Param("sceneid") int sceneid); + + @SelectProvider(type = class_get_seat_data.class,method = "get_seat_detail_SQL") + List get_seat_detail(@Param("sceneid") int sceneid); + + //@Select("SELECT mintype,nettype,kpiname FROM dp_scene_control limit 1") + //class_dp_2_scene_control get_scene_control(); + + //-------------------update by sunlm , 指定场馆展示1分钟或15分钟 + @Select("SELECT sceneid,mintype,'' nettype,'' kpiname FROM dp_2_scene_control where sceneid=#{sceneid} limit 1") + class_dp_2_scene_control get_scene_control(@Param("sceneid") int sceneid); + //---------------------------------------------------------- + + @Select("select starttime,endtime from pm_kpi4g_cell ORDER BY starttime desc limit 1") + Map getLastTime(); + + @Select("SELECT runtype FROM dp_scene_runtype limit 1") + Integer getsceneruntype(); + + @Select("SELECT maxtime FROM dp_scene_currtime limit 1") + LocalDateTime getmaxtime(); + + //endregion +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewDpSceneConfigMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewDpSceneConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..6cceea9925375be5c71c54da08d63770e04bb6fb --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewDpSceneConfigMapper.java @@ -0,0 +1,56 @@ +package com.ruoyi.sunlm.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.sunlm.daping.dp3d.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Mapper +public interface NewDpSceneConfigMapper extends BaseMapper { + + String getColorByQo(NewDpSceneConfigQO qo); + + Map getFourKpiColor(NewPmKpiColorQo qo); + + Map getkpiColorAndScore(@Param("kpiname") String kpiname, + @Param("kpivalue") Double kpivalue, + @Param("nettype") String nettype, + @Param("freqtype") String freqtype, + @Param("devicetype") String devicetype, + @Param("bandwidth") Long bandwidth); + + String getkpicolor(@Param("kpiname") String kpiname, + @Param("kpivalue") Double kpivalue, + @Param("nettype") String nettype, + @Param("freqtype") String freqtype, + @Param("devicetype") String devicetype, + @Param("bandwidth") Long bandwidth); + + Map getColor(List ids); + + int getkpicolorscore(@Param("kpiname") String kpiname, + @Param("kpivalue") Double kpivalue, + @Param("nettype") String nettype, + @Param("freqtype") String freqtype, + @Param("devicetype") String devicetype, + @Param("bandwidth") Long bandwidth); + + List listColor(); + + List listKpiName(); + + List getList(NewDpSceneConfigQO qo); + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi4gCellMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi4gCellMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..5a0a8d924f2852cd41ad407a4e8722106315a1ea --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi4gCellMapper.java @@ -0,0 +1,28 @@ +package com.ruoyi.sunlm.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.sunlm.daping.dp3d.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + *

+ * 场馆4G小区级15分钟指标 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Mapper +public interface NewPmKpi4gCellMapper extends BaseMapper { + + List getKpiList(NewPmKpiCellMonitorQO qo); + + Map getLastTime(@Param("sceneid") Integer sceneid,@Param("seatno") String seatno,@Param("inorout") String inorout); + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi4gMinMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi4gMinMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d199c627b88f54331167cc174762ea252ec1da53 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi4gMinMapper.java @@ -0,0 +1,28 @@ +package com.ruoyi.sunlm.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.sunlm.daping.dp3d.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 场馆4G小区级1分钟指标 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +@Mapper +public interface NewPmKpi4gMinMapper extends BaseMapper +{ + + List getKpiList(NewPmKpiCellMonitorQO qo); + + Map getLastTime(@Param("sceneid") Integer sceneid,@Param("seatno") String seatno,@Param("inorout") String inorout); + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi5gCellMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi5gCellMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..534b2e296a3ca9933242198612d653e21fb1c687 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi5gCellMapper.java @@ -0,0 +1,27 @@ +package com.ruoyi.sunlm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.sunlm.daping.dp3d.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +/** + *

+ * 场馆5G小区级15分钟指标 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-11 + */ +@Mapper +public interface NewPmKpi5gCellMapper extends BaseMapper { + + List getKpiList(NewPmKpiCellMonitorQO qo); + + Map getLastTime(@Param("sceneid") Integer sceneid,@Param("seatno") String seatno,@Param("inorout") String inorout); + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi5gMinMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi5gMinMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..1cb2f61c6317da0d77198b54dde0c358de4ac47e --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/NewPmKpi5gMinMapper.java @@ -0,0 +1,26 @@ +package com.ruoyi.sunlm.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.sunlm.daping.dp3d.*; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 场馆5G小区级1分钟指标 Mapper 接口 + *

+ * + * @author yqf + * @since 2023-04-12 + */ +public interface NewPmKpi5gMinMapper extends BaseMapper +{ + + List getKpiList(NewPmKpiCellMonitorQO qo); + + Map getLastTime(@Param("sceneid") Integer sceneid, @Param("seatno") String seatno,@Param("inorout") String inorout); + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpConfigMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..7b22b90c819cbb84aabc34c7d5c3e5caac4ad772 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpConfigMapper.java @@ -0,0 +1,1031 @@ +package com.ruoyi.sunlm.mapper; + +import java.util.List; +import com.ruoyi.sunlm.domain.*; +import org.apache.ibatis.annotations.*; +import org.springframework.stereotype.Component; + +/** + * 参数配置 数据层 + * + * @author ruoyi + */ +@Mapper +@Component +public interface dpConfigMapper +{ + //region --------------------------------------------------------------------------------------------场景增删改查接口 + //------------------------获取场景列表 + @Select("select * from yw_scene_big_config where id=#{id} order by id") + class_scene_big_config getscenebig(@Param("id") int id); + + class classscenebiglists + { + public String getscenebiglistsSQL(@Param("name") String name, + @Param("status") List status, + @Param("remark") String remark, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize) + { + String swhere="where 1=1 "; + if (!name.equals("")) { + swhere+=" and name like concat('%', #{name}, '%') "; + } + if (!remark.equals("")) { + swhere+=" and remark like concat('%', #{remark}, '%') "; + } + if (!status.isEmpty()) { + swhere+=" and status::integer in (" + status.toString().replace('[',' ').replace(']',' ') +")" ; + } + String SQL=" select * from ( select * from yw_scene_big_config "+swhere+" and status='2' "+ + " union all"+ + " (select * from yw_scene_big_config "+swhere+" and status<>'2' "+ + " order by id desc)) as atable limit "+ String.valueOf(pagesize)+" offset "+String.valueOf((pagenumber-1)*pagesize); + return SQL; + } + + public String getscenebiglistsCnt(@Param("name") String name, + @Param("status") List status, + @Param("remark") String remark) + { + String swhere="where 1=1 "; + if (!name.equals("")) { + swhere+=" and name like concat('%', #{name}, '%') "; + } + if (!remark.equals("")) { + swhere+=" and remark like concat('%', #{remark}, '%') "; + } + if (!status.isEmpty()) { + swhere+=" and status::integer in (" + status.toString().replace('[',' ').replace(']',' ') +")" ; + } + String SQL=" select count(*) from ( select * from yw_scene_big_config "+swhere+" and status='2' "+ + " union all"+ + " (select * from yw_scene_big_config "+swhere+" and status<>'2' "+ + " order by id desc)) as atable "; + return SQL; + } + } + + @SelectProvider(type = classscenebiglists.class,method = "getscenebiglistsCnt") + Long getscenebiglistscnt(@Param("name") String name, + @Param("status") List status, + @Param("remark") String remark); + + @SelectProvider(type = classscenebiglists.class,method = "getscenebiglistsSQL") + List getscenebiglists(@Param("name") String name, + @Param("status") List status, + @Param("remark") String remark, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize); + + //------------------------获取某个名称的场景数量 + @Select("select count(*) from yw_scene_big_config where name=#{name}") + int getscenebigbyName(@Param("name") String name); + + @Select("select count(*) from yw_scene_big_config where name=#{name} and id<>#{id}") + int getscenebigbyNameForUpdate(@Param("name") String name,@Param("id") int id); + + //------------------------新增大场馆 + class classInsertscenebig + { + public String InsertscenebigSQL(@Param("name") String name, + @Param("status") String status, + @Param("username") String username, + @Param("remark") String remark) + { + String SQL=""; + if (status.equals("2")) + { + SQL+="update yw_scene_big_config set status='0',update_by=#{username},update_time=LOCALTIMESTAMP(0) where status='2';"; + SQL+="insert into yw_scene_big_config(name,status,create_by,create_time,remark) values (#{name},#{status},#{username},LOCALTIMESTAMP(0),#{remark})"; + } + else + { + SQL+="insert into yw_scene_big_config(name,status,create_by,create_time,remark) values (#{name},#{status},#{username},LOCALTIMESTAMP(0),#{remark})"; + } + return SQL; + } + } + + @SelectProvider(type = classInsertscenebig.class,method = "InsertscenebigSQL") + void NewSceneBig(@Param("name") String name,@Param("status") String status,@Param("username") String username,@Param("remark") String remark); + + //------------------------修改大场馆状态 + class classupdatescenebig + { + public String updatescenebigSQL(@Param("id") int id, + @Param("name") String name, + @Param("status") String status, + @Param("username") String username, + @Param("remark") String remark) + { + String SQL=""; + if (status.equals("2")) + { + SQL+="update yw_scene_big_config set status='0',update_by=#{username},update_time=LOCALTIMESTAMP(0) where id!=#{id} and status='2';"; + SQL+="update yw_scene_big_config set name=#{name},status=#{status},update_by=#{username},update_time=LOCALTIMESTAMP(0),remark=#{remark} where id=#{id}"; + } + else + { + SQL+="update yw_scene_big_config set name=#{name},status=#{status},update_by=#{username},update_time=LOCALTIMESTAMP(0),remark=#{remark} where id=#{id}"; + } + return SQL; + } + } + + @SelectProvider(type = classupdatescenebig.class,method = "updatescenebigSQL") + void UpdateSceneBig(@Param("id") int id,@Param("name") String name,@Param("status") String status,@Param("username") String username,@Param("remark") String remark); + + //------------------------删除大场馆 + @Delete({"delete from yw_scene_big_config where id=#{id}"}) + void DeleteSceneBig(@Param("id") int id); + + //endregion + + //region-------------------------------------------------------------------------------------------赛事增删改查接口 + //------------------------获取场景列表 + @Select("select a.*,b.venue_name from yw_scene_calendar a left join yw_scene b on a.scene_id=b.id where a.id=#{matchid} order by a.id") + class_scene_calendar getscenecalendar(@Param("matchid") int matchid); + + class classscenecalendarlists + { + public String getscenecalendarlistsSQL(@Param("scenebigid") String scenebigid, + @Param("sceneid") List sceneids, + @Param("matchtype") String matchtype, + @Param("matchname") String matchname, + @Param("status") String status, + @Param("matchremark") String matchremark, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize, + @Param("matchdate") String matchdate, + @Param("goldpoint") String goldpoint) + { + String swhere="where 1=1 "; + + if (!scenebigid.equals("")) { + swhere+=" and scene_id in (select id from yw_scene where scene_big_id =" + scenebigid +") " ; + } + if (!sceneids.isEmpty()) { + swhere+=" and scene_id in (" + sceneids.toString().replace('[',' ').replace(']',' ')+")" ; + } + if (!matchtype.equals("")) { + swhere+=" and match_type =" + matchtype ; + } + if (!matchname.equals("")) { + swhere+=" and match_name like concat('%', #{matchname}, '%') "; + } + if (!status.equals("")) { + swhere+=" and a.status ='" + status + "'"; + } + if (!matchremark.equals("")) { + swhere+=" and match_remark like concat('%', #{matchremark}, '%') "; + } + if (!matchdate.equals("")) { + swhere+=" and to_char(match_date,'yyyy-mm-dd') = '" + matchdate + "' "; + } + if (!goldpoint.equals("")) { + swhere+=" and gold_point ='" + goldpoint + "'"; + } + + String SQL="select a.*,b.venue_name from yw_scene_calendar a left join yw_scene b on a.scene_id=b.id "+swhere+ + " order by match_date desc,begin_time limit "+ String.valueOf(pagesize)+" offset "+String.valueOf((pagenumber-1)*pagesize); + return SQL; + } + + public String getscenecalendarlistsCnt(@Param("scenebigid") String scenebigid, + @Param("sceneid") List sceneids, + @Param("matchtype") String matchtype, + @Param("matchname") String matchname, + @Param("status") String status, + @Param("matchremark") String matchremark, + @Param("matchdate") String matchdate, + @Param("goldpoint") String goldpoint) + { + String swhere="where 1=1 "; + if (!scenebigid.equals("")) { + swhere+=" and scene_id in (select id from yw_scene where scene_big_id =" + scenebigid +") "; + } + if (!sceneids.isEmpty()) { + swhere+=" and scene_id in (" + sceneids.toString().replace('[',' ').replace(']',' ')+")" ; + } + if (!matchtype.equals("")) { + swhere+=" and match_type =" + matchtype ; + } + if (!matchname.equals("")) { + swhere+=" and match_name like concat('%', #{matchname}, '%') "; + } + if (!status.equals("")) { + swhere+=" and status ='" + status + "'"; + } + if (!matchremark.equals("")) { + swhere+=" and match_remark like concat('%', #{matchremark}, '%') "; + } + if (!matchdate.equals("")) { + swhere+=" and to_char(match_date,'yyyy-mm-dd') = '" + matchdate + "' "; + } + if (!goldpoint.equals("")) { + swhere+=" and gold_point ='" + goldpoint + "'"; + } + + String SQL=" select count(*) from yw_scene_calendar "+swhere; + return SQL; + } + } + + @SelectProvider(type = classscenecalendarlists.class,method = "getscenecalendarlistsCnt") + Long getscenecalendarlistscnt(@Param("scenebigid") String scenebigid, + @Param("sceneid") List sceneids, + @Param("matchtype") String matchtype, + @Param("matchname") String matchname, + @Param("status") String status, + @Param("matchremark") String matchremark, + @Param("matchdate") String matchdate, + @Param("goldpoint") String goldpoint); + + @SelectProvider(type = classscenecalendarlists.class,method = "getscenecalendarlistsSQL") + List getscenecalendarlists(@Param("scenebigid") String scenebigid, + @Param("sceneid") List sceneids, + @Param("matchtype") String matchtype, + @Param("matchname") String matchname, + @Param("status") String status, + @Param("matchremark") String matchremark, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize, + @Param("matchdate") String matchdate, + @Param("goldpoint") String goldpoint); + + //------------------------获取某个名称的赛事数量 + @Select("select count(*) from yw_scene_calendar where match_name=#{matchname}") + int getscenecalendarbyName(@Param("sceneid") int sceneid,@Param("matchname") String matchname); + + @Select("select count(*) from yw_scene_calendar where match_name=#{matchname} and id <>#{id}") + int getscenecalendarbyNameForUpdate(@Param("sceneid") int sceneid,@Param("matchname") String matchname,@Param("id") int id ); + + + //------------------------新增赛事 + class classInsertscenecalendar + { + public String InsertscenecalendarSQL(@Param("sceneid") int sceneid, + @Param("matchtype") String matchtype, + @Param("matchname") String matchname, + @Param("status") String status, + @Param("matchremark") String matchremark, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, + @Param("matchDate") String matchDate, + @Param("goldpoint") String goldpoint + ) + { + String SQL="insert into yw_scene_calendar(scene_id,match_type,match_name,match_remark,begin_time,end_time,match_date,status,gold_point) "+ + "values (#{sceneid},#{matchtype},#{matchname},#{matchremark},to_timestamp(#{beginTime},'HH24:MI'),to_timestamp(#{endTime},'HH24:MI'),"+ + "to_date(#{matchDate},'yyyy-mm-dd'),#{status},#{goldpoint})"; + return SQL; + } + } + + @SelectProvider(type = classInsertscenecalendar.class,method = "InsertscenecalendarSQL") + void NewScenecalendar(@Param("sceneid") int sceneid, + @Param("matchtype") String matchtype, + @Param("matchname") String matchname, + @Param("status") String status, + @Param("matchremark") String matchremark, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, + @Param("matchDate") String matchDate, + @Param("goldpoint") String goldpoint); + + //------------------------修改赛事信息 + class classupdatescenecalendar + { + public String updatescenecalendarSQL(@Param("id") int id, + @Param("sceneid") int sceneid, + @Param("matchtype") String matchtype, + @Param("matchname") String matchname, + @Param("status") String status, + @Param("matchremark") String matchremark, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, + @Param("matchDate") String matchDate, + @Param("goldpoint") String goldpoint) + { + String SQL="update yw_scene_calendar set "+ + "scene_id=#{sceneid},match_type=#{matchtype},"+ + "match_name=#{matchname},match_remark=#{matchremark},"+ + "begin_time=to_timestamp(#{beginTime},'HH24:MI'),end_time=to_timestamp(#{endTime},'HH24:MI'),"+ + "match_date=to_date(#{matchDate},'yyyy-mm-dd'),status=#{status} ," + + "gold_point=#{goldpoint} " + + " where id=#{id}"; + return SQL; + } + } + + @SelectProvider(type = classupdatescenecalendar.class,method = "updatescenecalendarSQL") + void UpdateScenecalendar(@Param("id") int id, + @Param("sceneid") int sceneid, + @Param("matchtype") String matchtype, + @Param("matchname") String matchname, + @Param("status") String status, + @Param("matchremark") String matchremark, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, + @Param("matchDate") String matchDate, + @Param("goldpoint") String goldpoint); + + //------------------------删除赛事 + @Delete({"delete from yw_scene_calendar where id=#{id}"}) + void DeleteScenecalendar(@Param("id") int id); + //endregion + + //region-------------------------------------------------------------------------------------------施工队增删改查接口 + //region------------------------获取施工单位列表 + class classsceneteamidlists + { + public String getsceneteamSQL(@Param("teamid") int teamid) + { + String SQL="select a.*,b.name scene_big_name from yw_construc_team a left join yw_scene_big_config b on a.scene_big_id=b.id where a.id=#{teamid} "; + return SQL; + } + + public String getsceneteam_userSQL(@Param("teamid") int teamid) + { + String SQL="select a.*,b.nick_name userName from yw_construc_team_user a left join sys_user b on a.user_id=b.user_id where b.del_flag='0' and a.construc_team_id=#{teamid} "; + return SQL; + } + + public String getsceneteam_dutysceneSQL(@Param("teamid") int teamid) + { + String SQL="select a.*,b.venue_name from yw_construc_team_dutyscene a left join yw_scene b on a.duty_scene_id=b.id where a.construc_team_id=#{teamid} "; + return SQL; + } + + public String getsceneteamlistsSQL(@Param("scenebigid") String scenebigid, + @Param("specialty") String specialty, + @Param("venderName") String venderName, + @Param("status") String status, + @Param("county") String county, + @Param("city") String city, + @Param("sceneIds") List sceneIds, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize + ) + { + String swhere="where 1=1 "; + if (!scenebigid.equals("")) { + swhere+=" and scene_big_id =" + scenebigid ; + } + if (!specialty.equals("")) { + swhere+=" and specialty =" + specialty ; + } + if (!venderName.equals("")) { + swhere+=" and vender_Name like concat('%', #{venderName}, '%') "; + } + if (!status.equals("")) { + swhere+=" and a.status ='" + status + "'"; + } + if (!county.equals("")) { + swhere+=" and county like concat('%', #{county}, '%') "; + } + if (!city.equals("")) { + swhere+=" and city like concat('%', #{city}, '%') "; + } + + if (sceneIds.size()>0) { + swhere+=" and a.id in (select distinct construc_team_id from yw_construc_team_dutyscene where duty_scene_id in ( "+ + sceneIds.toString().replace('[',' ').replace(']',' ') +" )) "; + } + + String SQL="select a.*,b.name scene_big_name,c.dict_label specialtyname, d.dict_label countyname ,e.dict_label cityname " + + " from yw_construc_team a left join yw_scene_big_config b on a.scene_big_id=b.id " + + " left join sys_dict_data c on c.dict_value=a.specialty and c.dict_type='yw_specialty' " + + " left join sys_dict_data d on d.dict_value=a.county and d.dict_type='yw_county' " + + " left join sys_dict_data e on e.dict_value=a.city and e.dict_type='yw_city' " + + " " + + swhere+ + " order by a.id desc limit "+ String.valueOf(pagesize)+" offset "+String.valueOf((pagenumber-1)*pagesize); + return SQL; + } + + public String getsceneteamlistsCnt(@Param("scenebigid") String scenebigid, + @Param("specialty") String specialty, + @Param("venderName") String venderName, + @Param("status") String status, + @Param("county") String county, + @Param("city") String city, + @Param("sceneIds") List sceneIds) + { + String swhere="where 1=1 "; + if (!scenebigid.equals("")) { + swhere+=" and scene_big_id =" + scenebigid ; + } + if (!specialty.equals("")) { + swhere+=" and specialty =" + specialty ; + } + if (!venderName.equals("")) { + swhere+=" and vender_Name like concat('%', #{venderName}, '%') "; + } + if (!status.equals("")) { + swhere+=" and status ='" + status + "'"; + } + if (!county.equals("")) { + swhere+=" and county like concat('%', #{county}, '%') "; + } + if (!city.equals("")) { + swhere+=" and city like concat('%', #{city}, '%') "; + } + if (sceneIds.size()>0) { + swhere+=" and id in (select distinct construc_team_id from yw_construc_team_dutyscene where duty_scene_id in ( "+ + sceneIds.toString().replace('[',' ').replace(']',' ') +" )) "; + } + + String SQL=" select count(*) from yw_construc_team "+swhere; + return SQL; + } + } + + @SelectProvider(type = classsceneteamidlists.class,method = "getsceneteamSQL") + class_scene_team getsceneteam(@Param("teamid") int teamid); + + @SelectProvider(type = classsceneteamidlists.class,method = "getsceneteam_userSQL") //获取某个TEAM的人员列表 + List getsceneteam_user(@Param("teamid") int teamid); + + @SelectProvider(type = classsceneteamidlists.class,method = "getsceneteam_dutysceneSQL") ////获取某个TEAM的场馆列表 + List getsceneteam_dutyscene(@Param("teamid") int teamid); + + @SelectProvider(type = classsceneteamidlists.class,method = "getsceneteamlistsCnt") + Long getsceneteamlistscnt(@Param("scenebigid") String scenebigid, + @Param("specialty") String specialty, + @Param("venderName") String venderName, + @Param("status") String status, + @Param("county") String county, + @Param("city") String city, + @Param("sceneIds") List sceneIds); + + @SelectProvider(type = classsceneteamidlists.class,method = "getsceneteamlistsSQL") + List getsceneteamlists(@Param("scenebigid") String scenebigid, + @Param("specialty") String specialty, + @Param("venderName") String venderName, + @Param("status") String status, + @Param("county") String county, + @Param("city") String city, + @Param("sceneIds") List sceneIds, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize); + + //endregion + + //region----------------新增施工队 + //---------------------获取某个名称的施工队数量 + @Select("select count(*) from yw_construc_team where vender_name=#{vendername}") + int getsceneteambyName(@Param("vendername") String vendername); + + @Select("select id from yw_scene_big_config where status='2'") + String getSceneBigIs2(); + + //------------------------新增施工单位 //@Param("userIds") List userIds + class classInsertsceneteam + { + public String InsertsceneteamSQL(@Param("scenebigid") int scenebigid, + @Param("specialty") String specialty, + @Param("venderName") String venderName, + @Param("status") String status, + @Param("county") String county, + @Param("city") String city, + @Param("remark") String remark, + @Param("dutySceneIds") List dutySceneIds + ) + { + String SQL="insert into yw_construc_team(scene_big_id,specialty,vender_name,status,county,city,remark) "+ + "values (#{scenebigid},#{specialty},#{venderName},#{status},#{county},#{city},#{remark});"; + //-----------------------user + String ssql=""; + /* //用户不需要了 + for (int i=0;i0) + { + for (int i = 0; i < dutySceneIds.size(); i++) { + ssql += " (currval('yw_construc_team_id_seq'::regclass)," + dutySceneIds.get(i).replace('[', ' ').replace(']', ' ') + ") ,"; + } + if (ssql.substring(ssql.length() - 1).equals(",")) { + ssql = ssql.substring(0, ssql.length() - 1) + ";"; // 去掉最后一个逗号 + } + SQL += " insert into yw_construc_team_dutyscene(construc_team_id,duty_scene_id) values " + ssql; + } + + return SQL; + } + } + + // @Param("userIds") List userIds + @SelectProvider(type = classInsertsceneteam.class,method = "InsertsceneteamSQL") + void NewSceneteam(@Param("scenebigid") int scenebigid, + @Param("specialty") String specialty, + @Param("venderName") String venderName, + @Param("status") String status, + @Param("county") String county, + @Param("city") String city, + @Param("remark") String remark, + @Param("dutySceneIds") List dutySceneIds + ); + + //endregion + //region------------------------修改施工单位信息 //@Param("userIds") List userIds + class classupdatesceneteam + { + public String updatesceneteamSQL(@Param("id") int id, + @Param("scenebigid") int scenebigid, + @Param("specialty") String specialty, + @Param("venderName") String venderName, + @Param("status") String status, + @Param("county") String county, + @Param("city") String city, + @Param("remark") String remark, + @Param("dutySceneIds") List dutySceneIds + ) + { + String SQL="update yw_construc_team set "+ //scene_big_id,specialty,vender_name,status,county,remark + "scene_big_id=#{scenebigid},specialty=#{specialty},"+ + "vender_name=#{venderName},status=#{status},"+ + "county=#{county},city=#{city},remark=#{remark} where id=#{id};"; + //-----------------------user + + String ssql=""; + /* //不需要了 + for (int i=0;i0) { + for (int i = 0; i < dutySceneIds.size(); i++) { + ssql += " (" + String.valueOf(id) + "," + dutySceneIds.get(i).replace('[', ' ').replace(']', ' ') + ") ,"; + } + if (ssql.substring(ssql.length() - 1).equals(",")) { + ssql = ssql.substring(0, ssql.length() - 1) + ";"; // 去掉最后一个逗号 + } + + SQL += "delete from yw_construc_team_dutyscene where construc_team_id=" + String.valueOf(id) + ";"; + SQL += " insert into yw_construc_team_dutyscene(construc_team_id,duty_scene_id) values " + ssql; + } + else + { + SQL += "delete from yw_construc_team_dutyscene where construc_team_id=" + String.valueOf(id) + ";"; + } + + return SQL; + } + + } + + @Select("select count(*) from yw_construc_team where vender_name=#{vendername} and id<>#{id}") + int getsceneteambyNameForUpdate(@Param("vendername") String vendername,@Param("id") int id); + + //@Param("userIds") List userIds + @SelectProvider(type = classupdatesceneteam.class,method = "updatesceneteamSQL") + void UpdateSceneteam(@Param("id") int id, + @Param("scenebigid") int scenebigid, + @Param("specialty") String specialty, + @Param("venderName") String venderName, + @Param("status") String status, + @Param("county") String county, + @Param("city") String city, + @Param("remark") String remark, + @Param("dutySceneIds") List dutySceneIds + ); + + //endregion + //region------------------------删除施工单位 + @Delete({"delete from yw_construc_team where id=#{id};"+ + //"delete from yw_construc_team_user where construc_team_id=#{id};"+ + "delete from yw_construc_team_dutyscene where construc_team_id=#{id};"}) + void DeleteSceneteam(@Param("id") int id); + //endregion + + //endregion + + //region --------------------------------------------------------------------------------------------公众新闻增删改查接口 + //------------------------获取公众新闻列表 + @Select("select * from fm_public_inform_news where id=#{newsid} order by id") + class_public_news getpublicnews(@Param("newsid") int newsid); + + class classpublicnewslists + { + public String getpublicnewslistsSQL(@Param("sceneBigId") String sceneBigId, + @Param("title") String title, + @Param("content") String content, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize) + { + String swhere="where b.del_flag='0'"; + if (!sceneBigId.equals("")) { + swhere+=" and a.scene_big_id = " + sceneBigId ; + } + if (!title.equals("")) { + swhere+=" and title like concat('%', #{title}, '%') "; + } + if (!content.equals("")) { + swhere+=" and content like concat('%', #{content}, '%') "; + } + + String SQL=" select a.*,b.nick_name updatebyname from fm_public_inform_news a "+ + " left join sys_user b on a.update_by=b.user_name "+ + swhere+ + " order by update_time desc "+ + " limit "+ String.valueOf(pagesize)+" offset "+String.valueOf((pagenumber-1)*pagesize); + return SQL; + } + + public String getpublicnewslistsCnt(@Param("sceneBigId") String sceneBigId, + @Param("title") String title, + @Param("content") String content) + { + String swhere="where 1=1 "; + if (!sceneBigId.equals("")) { + swhere+=" and scene_big_id = " + sceneBigId ; + } + if (!title.equals("")) { + swhere+=" and title like concat('%', #{title}, '%') "; + } + if (!content.equals("")) { + swhere+=" and content like concat('%', #{content}, '%') "; + } + + String SQL=" select count(*) from fm_public_inform_news "+swhere; + return SQL; + } + } + + @SelectProvider(type = classpublicnewslists.class,method = "getpublicnewslistsCnt") + Long getpublicnewslistscnt(@Param("sceneBigId") String sceneBigId, + @Param("title") String title, + @Param("content") String content); + + @SelectProvider(type = classpublicnewslists.class,method = "getpublicnewslistsSQL") + List getpublicnewslists(@Param("sceneBigId") String sceneBigId, + @Param("title") String title, + @Param("content") String content, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize); + + //------------------------获取某个名称的数量 + @Select("select count(*) from fm_public_inform_news where scene_big_id=#{sceneBigId} and title=#{title}") + int getpublicnewsbyName(@Param("sceneBigId") int sceneBigId,@Param("title") String title); + + //------------------------新增大场馆 + class classInsertpublicnews + { + public String InsertpublicnewsSQL(@Param("sceneBigId") int sceneBigId, + @Param("title") String title, + @Param("contentUrl") String contentUrl, + @Param("content") String content, + @Param("username") String username) + { + String SQL=""; + SQL+="insert into fm_public_inform_news(scene_big_id,title,content_url,content,update_by,update_time) "+ + "values (#{sceneBigId},#{title},#{contentUrl},#{content},#{username},LOCALTIMESTAMP(0))"; + return SQL; + } + } + + @SelectProvider(type = classInsertpublicnews.class,method = "InsertpublicnewsSQL") + void Newpublicnews(@Param("sceneBigId") int sceneBigId, + @Param("title") String title, + @Param("contentUrl") String contentUrl, + @Param("content") String content, + @Param("username") String username); + + //------------------------修改 + @Select("select count(*) from fm_public_inform_news where scene_big_id=#{sceneBigId} and title=#{title} and id<>#{id}") + int getpublicnewsbyNameForUpdate(@Param("sceneBigId") int sceneBigId,@Param("title") String title,@Param("id") int id); + + class classupdatepublicnews + { + public String updatepublicnewsSQL(@Param("id") int id, + @Param("sceneBigId") int sceneBigId, + @Param("title") String title, + @Param("contentUrl") String contentUrl, + @Param("content") String content, + @Param("username") String username) + { + String SQL=""; + SQL+= "update fm_public_inform_news set scene_big_id=#{sceneBigId},title=#{title}," + + "content_url=#{contentUrl},update_by=#{username}," + + "update_time=LOCALTIMESTAMP(0),content=#{content} where id=#{id}"; + return SQL; + } + } + + @SelectProvider(type = classupdatepublicnews.class,method = "updatepublicnewsSQL") + void UpdatePublicNews(@Param("id") int id, + @Param("sceneBigId") int sceneBigId, + @Param("title") String title, + @Param("contentUrl") String contentUrl, + @Param("content") String content, + @Param("username") String username); + + //------------------------删除大场馆 + @Delete({"delete from fm_public_inform_news where id=#{id}"}) + void DeletePublicNews(@Param("id") int id); + + //endregion + + //region --------------------------------------------------------------------------------------------奖牌榜增删改查接口 + //------------------------获取奖牌榜列表 + @Select("select t1.*,t2.name scene_big_name from fm_medal_stand t1 left join yw_scene_big_config t2 on t1.scene_big_id=t2.id where t1.id=#{medalid} order by t1.id") + class_medal_stand getmedalstand(@Param("medalid") int medalid); + + class classmedalstandlists + { + public String getmedalstandlistsSQL(@Param("sceneBigId") String sceneBigId, + @Param("areaname") String areaname, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize) + { + String swhere="where t3.del_flag = '0'"; + if (!sceneBigId.equals("")) { + swhere+=" and t1.scene_big_id = " + sceneBigId ; + } + if (!areaname.equals("")) { + swhere+=" and t1.area_name like concat('%', #{areaname}, '%') "; + } + + String SQL=" select t1.*,t2.name scene_big_name, gold_count*3+silver_count*2+bronze_count as acount ,t3.nick_name updatebyname from fm_medal_stand t1 " + + " left join yw_scene_big_config t2 on t1.scene_big_id=t2.id "+ + " left join sys_user t3 on t1.update_by=t3.user_name "+ + swhere+ + " order by acount desc "+ + " limit "+ String.valueOf(pagesize)+" offset "+String.valueOf((pagenumber-1)*pagesize); + return SQL; + } + + public String getmedalstandlistsCnt(@Param("sceneBigId") String sceneBigId, + @Param("areaname") String areaname) + { + String swhere="where 1=1 "; + if (!sceneBigId.equals("")) { + swhere+=" and scene_big_id = " + sceneBigId ; + } + if (!areaname.equals("")) { + swhere+=" and area_name like concat('%', #{areaname}, '%') "; + } + + String SQL=" select count(*) from fm_medal_stand "+swhere; + return SQL; + } + } + + @SelectProvider(type = classmedalstandlists.class,method = "getmedalstandlistsCnt") + Long getmedalstandlistscnt(@Param("sceneBigId") String sceneBigId, + @Param("areaname") String areaname); + + @SelectProvider(type = classmedalstandlists.class,method = "getmedalstandlistsSQL") + List getmedalstandlists(@Param("sceneBigId") String sceneBigId, + @Param("areaname") String areaname, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize); + + //------------------------获取某个名称的数量 + @Select("select count(*) from fm_medal_stand where scene_big_id=#{scenebigid} and area_name=#{areaName}") + int getmedalstandbyName(@Param("scenebigid") int scenebigid,@Param("areaName") String areaName); + + @Select("select count(*) from fm_medal_stand where scene_big_id=#{scenebigid} and area_name=#{areaName} and id <>#{id}") + int getmedalstandbyNameForUpdate(@Param("scenebigid") int scenebigid,@Param("areaName") String areaName,@Param("id") int id); + + //------------------------新增大场馆 + class classInsertmedalstand + { + public String InsertmedalstandSQL(@Param("sceneBigId") int sceneBigId, + @Param("areaName") String areaName, + @Param("goldCount") int goldCount, + @Param("silverCount") int silverCount, + @Param("bronzeCount") int bronzeCount, + @Param("medalsCount") int medalsCount, + @Param("username") String username) + { + String SQL=""; + SQL+="insert into fm_medal_stand(scene_big_id,area_name,gold_count,silver_count,bronze_count,medals_count,update_time,update_by) "+ + "values (#{sceneBigId},#{areaName},#{goldCount},#{silverCount},#{bronzeCount},#{medalsCount},LOCALTIMESTAMP(0),#{username})"; + return SQL; + } + } + + @SelectProvider(type = classInsertmedalstand.class,method = "InsertmedalstandSQL") + void Newmedalstand(@Param("sceneBigId") int sceneBigId, + @Param("areaName") String areaName, + @Param("goldCount") int goldCount, + @Param("silverCount") int silverCount, + @Param("bronzeCount") int bronzeCount, + @Param("medalsCount") int medalsCount, + @Param("username") String username); + + //------------------------修改 + class classupdatemedalstand + { + public String updatemedalstandSQL(@Param("id") int id, + @Param("sceneBigId") int sceneBigId, + @Param("areaName") String areaName, + @Param("goldCount") int goldCount, + @Param("silverCount") int silverCount, + @Param("bronzeCount") int bronzeCount, + @Param("medalsCount") int medalsCount, + @Param("username") String username) + { + String SQL=""; + SQL+= "update fm_medal_stand set area_name=#{areaName},scene_big_id=#{sceneBigId}," + + "gold_count=#{goldCount},silver_count=#{silverCount}," + + "bronze_count=#{bronzeCount},medals_count=#{medalsCount}," + + "update_by=#{username},update_time=LOCALTIMESTAMP(0) where id=#{id}"; + return SQL; + } + } + + @SelectProvider(type = classupdatemedalstand.class,method = "updatemedalstandSQL") + void Updatemedalstand(@Param("id") int id, + @Param("sceneBigId") int sceneBigId, + @Param("areaName") String areaName, + @Param("goldCount") int goldCount, + @Param("silverCount") int silverCount, + @Param("bronzeCount") int bronzeCount, + @Param("medalsCount") int medalsCount, + @Param("username") String username); + + //------------------------删除大场馆 + @Delete({"delete from fm_medal_stand where id = #{id}"}) + void Deletemedalstand(@Param("id") int id); + + //endregion + + //region-------------------------------------------------------------------------------------------赛程增删改查接口 + //------------------------获取列表 + @Select("select a.*,b.venue_name from yw_scene_match a left join yw_scene b on a.scene_id=b.id where a.id=#{matchid} order by a.id") + class_scene_match getscenematch(@Param("matchid") int matchid); + + @Select("select a.*,b.venue_name from yw_scene_match a left join yw_scene b on a.scene_id=b.id where a.task_name=#{taskname} and a.scene_id = #{sceneid} order by a.id") + class_scene_match getscenematch2(@Param("taskname") String taskname,@Param("sceneid") Long sceneid); + + class classscenematchlists + { + public String getscenematchlistsSQL(@Param("scenebigid") String scenebigid, + @Param("sceneid") List sceneids, + @Param("taskname") String taskname, + @Param("taskstatus") String taskstatus, + @Param("taskdate") String taskdate, + @Param("tasktype") String tasktype, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize) + { + String swhere="where 1=1 "; + + if (!scenebigid.equals("")) { + swhere+=" and scene_id in (select id from yw_scene where scene_big_id =" + scenebigid +") " ; + } + if (!sceneids.isEmpty()) { + swhere+=" and scene_id in (" + sceneids.toString().replace('[',' ').replace(']',' ')+")" ; + } + if (!taskname.equals("")) { + swhere+=" and task_name like concat('%', #{taskname}, '%') "; + } + if (!taskstatus.equals("")) { + swhere+=" and a.task_status ='" + taskstatus + "'"; + } + if (!tasktype.equals("")) { + swhere+=" and task_type like concat('%', #{tasktype}, '%') "; + } + if (!taskdate.equals("")) { + swhere+=" and to_char(a.begin_time,'yyyy-mm-dd') ='" + taskdate + "'"; + } + + String SQL="select a.*,b.venue_name from yw_scene_match a left join yw_scene b on a.scene_id=b.id "+swhere+ + " order by scene_id,begin_time limit "+ String.valueOf(pagesize)+" offset "+String.valueOf((pagenumber-1)*pagesize); + return SQL; + } + + public String getscenematchlistsCnt(@Param("scenebigid") String scenebigid, + @Param("sceneid") List sceneids, + @Param("taskname") String taskname, + @Param("taskstatus") String taskstatus, + @Param("taskdate") String taskdate, + @Param("tasktype") String tasktype) + { + String swhere="where 1=1 "; + if (!scenebigid.equals("")) { + swhere+=" and scene_id in (select id from yw_scene where scene_big_id =" + scenebigid +") " ; + } + if (!sceneids.isEmpty()) { + swhere+=" and scene_id in (" + sceneids.toString().replace('[',' ').replace(']',' ')+")" ; + } + if (!taskname.equals("")) { + swhere+=" and task_name like concat('%', #{taskname}, '%') "; + } + if (!taskstatus.equals("")) { + swhere+=" and task_status ='" + taskstatus + "'"; + } + if (!tasktype.equals("")) { + swhere+=" and task_type like concat('%', #{tasktype}, '%') "; + } + if (!taskdate.equals("")) { + swhere+=" and to_char(begin_time,'yyyy-mm-dd') ='" + taskdate + "'"; + } + String SQL=" select count(*) from yw_scene_match "+swhere; + return SQL; + } + } + + @SelectProvider(type = classscenematchlists.class,method = "getscenematchlistsCnt") + Long getscenematchlistscnt(@Param("scenebigid") String scenebigid, + @Param("sceneid") List sceneids, + @Param("taskname") String taskname, + @Param("taskstatus") String taskstatus, + @Param("taskdate") String taskdate, + @Param("tasktype") String tasktype); + + @SelectProvider(type = classscenematchlists.class,method = "getscenematchlistsSQL") + List getscenematchlists(@Param("scenebigid") String scenebigid, + @Param("sceneid") List sceneids, + @Param("taskname") String taskname, + @Param("taskstatus") String taskstatus, + @Param("taskdate") String taskdate, + @Param("tasktype") String tasktype, + @Param("pagenumber") int pagenumber, + @Param("pagesize") int pagesize); + + //------------------------获取某个名称的赛事数量 + @Select("select count(*) from yw_scene_match where task_name=#{matchname} and scene_id=#{sceneid}") + int getscenematchbyName(@Param("sceneid") int sceneid,@Param("matchname") String matchname); + + @Select("select count(*) from yw_scene_match where task_name=#{matchname} and scene_id=#{sceneid} and id <>#{id}") + int getscenematchbyNameForUpdate(@Param("sceneid") int sceneid,@Param("matchname") String matchname,@Param("id") int id); + + //------------------------新增赛程 + class classInsertscenematch + { + public String InsertscenematchSQL(@Param("sceneid") int sceneid, + @Param("taskname") String taskname, + @Param("taskstatus") String taskstatus, + @Param("tasktype") String tasktype, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, + @Param("createby") String createby + ) + { + String SQL="insert into yw_scene_match(scene_id,task_name,task_status,begin_time,end_time,create_by,create_time,task_type) "+ + "values (#{sceneid},#{taskname},#{taskstatus},to_timestamp(#{beginTime},'yyyy-mm-dd hh24:mi:ss'),to_timestamp(#{endTime},'yyyy-mm-dd hh24:mi:ss'),"+ + "#{createby},LOCALTIMESTAMP(0),#{tasktype})"; + return SQL; + } + } + + @SelectProvider(type = classInsertscenematch.class,method = "InsertscenematchSQL") + void NewScenematch(@Param("sceneid") int sceneid, + @Param("taskname") String taskname, + @Param("taskstatus") String taskstatus, + @Param("tasktype") String tasktype, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, + @Param("createby") String createby); + + //------------------------修改赛程信息 + class classupdatescenematch + { + public String updatescenematchSQL(@Param("id") int id, + @Param("sceneid") int sceneid, + @Param("taskname") String taskname, + @Param("taskstatus") String taskstatus, + @Param("tasktype") String tasktype, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, + @Param("updateby") String updateby) + { + String SQL="update yw_scene_match set "+ + "scene_id=#{sceneid},task_name=#{taskname},"+ + "task_status=#{taskstatus},task_type=#{tasktype},"+ + "begin_time=to_timestamp(#{beginTime},'yyyy-mm-dd hh24:mi:ss'),end_time=to_timestamp(#{endTime},'yyyy-mm-dd hh24:mi:ss'),"+ + "update_by=#{updateby} ,update_time=LOCALTIMESTAMP(0) where id=#{id}"; + return SQL; + } + } + + @SelectProvider(type = classupdatescenematch.class,method = "updatescenematchSQL") + void UpdateScenematch(@Param("id") int id, + @Param("sceneid") int sceneid, + @Param("taskname") String taskname, + @Param("taskstatus") String taskstatus, + @Param("tasktype") String tasktype, + @Param("beginTime") String beginTime, + @Param("endTime") String endTime, + @Param("updateby") String updateby); + + //------------------------删除赛程 + @Delete({"delete from yw_scene_match where id=#{id}"}) + void DeleteScenematch(@Param("id") int id); + //endregion +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_ChuanDong_Mapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_ChuanDong_Mapper.java new file mode 100644 index 0000000000000000000000000000000000000000..45429b565e23b357191c91ba299509ecfc46c2f3 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_ChuanDong_Mapper.java @@ -0,0 +1,172 @@ +package com.ruoyi.sunlm.mapper; + +import java.util.List; + +import com.ruoyi.sunlm.daping.*; +import org.apache.ibatis.annotations.*; +import org.springframework.stereotype.Component; + +/** + * 数据层 + * + * @author ruoyi + */ +@Mapper +@Component +public interface dpNewYayun_ChuanDong_Mapper ////2023。5.10,新版大屏的接口 +{ + + //region------------------------------------------------------------------------------------传输告警接口 + class class_get_trans_alarms + { + public String get_trans_alarms_SQL(@Param("level") int level, + @Param("sceneid") int sceneid, + @Param("alarmtype") String alarmtype) + { + String SQL=" "; + if ((level==1) || (level==2)) //全域或城区的场馆的传输告警 + { + SQL = " select 告警时间 eventtime, " + + " 告警名称 alarmname, " + + " 场馆id ," + + " 区域id," + + " 网元名称 netname, " + + " 分公司 areaname, " + + " 告警类型 alarmtype, " + + " 告警等级 alarmlevel, " + + " 设备类型 devicetype, " + + " 是否端口告警 isportalarm from dp_2_view_trans_alarms " + + " where 恢复时间 is null " + + " and 告警类型 = #{alarmtype} order by 告警时间 desc limit 20"; + } + + return SQL; + } + + public String get_trans_alarms_all_SQL() + { + String SQL= " select 告警时间 eventtime, 告警名称 alarmname,场馆id ,区域id,网元名称 netname,分公司 areaname, " + + " 告警类型 alarmtype, 告警等级 alarmlevel,设备类型 devicetype,是否端口告警 isportalarm from dp_2_view_trans_alarms " + + " where 恢复时间 is null " + + " order by 告警时间 desc"; + return SQL; + } + + public String get_maps_all_alarms_SQL(){ + String SQL = "select 告警类型 major,告警时间 eventtime, 告警名称 alarmname, 网元名称 netname,场馆id sceneid,场馆名称 scenename,故障处理人 handlepeople,phonenumber " + + "from dp_2_view_trans_alarms where 恢复时间 is null order by 告警时间 desc"; + return SQL; + } + } + + + + @SelectProvider(type = dpNewYayun_ChuanDong_Mapper.class_get_trans_alarms.class,method = "get_trans_alarms_SQL") + List get_trans_alarms_list(@Param("level") int level, + @Param("sceneid") int sceneid, + @Param("alarmtype") String alarmtype); + + @SelectProvider(type = dpNewYayun_ChuanDong_Mapper.class_get_trans_alarms.class,method = "get_trans_alarms_all_SQL") + List get_trans_alarms_all_list(); + + @SelectProvider(type = dpNewYayun_ChuanDong_Mapper.class_get_trans_alarms.class,method = "get_maps_all_alarms_SQL") + List get_maps_alarms_all_alarms(); + //endregion + + + + + + //region------------------------------------------------------------------------------------机房环境告警清单 + class class_get_machineroom_alarms_list + { + public String get_machineroom_alarms_list_all_SQL() + { + return "select * from dp_2_view_power_alarm " + + "where 场馆id is not null order by eventtime desc limit 20 "; + } + } + + + + @SelectProvider(type = dpNewYayun_ChuanDong_Mapper.class_get_machineroom_alarms_list.class,method = "get_machineroom_alarms_list_all_SQL") + List get_machineroom_alarms_all_list(); + //endregion + + //region------------------------------------------------------------------------------------环路流量TOP5 + class class_get_huanlu_top5 + { + public String get_huanlu_top5_all_SQL() + { + return "select mename,portname,round(max(flow)::numeric, 2) flow from dp_2_view_view_flow " + + "GROUP BY mename,portname order by max(flow) desc limit 5"; + } + } + + @SelectProvider(type = dpNewYayun_ChuanDong_Mapper.class_get_huanlu_top5.class,method = "get_huanlu_top5_all_SQL") + List get_huanlu_top5_all(); + //endregion + + //region------------------------------------------------------------------------------------ 光功率清单 + class class_get_opticalpower_list + { + public String get_opticalpower_list_all_SQL() + { + // return " SELECT distinct on (mename) * FROM dp_2_view_view_opticalpower limit 20 "; // Mybatis 会报语法错误 + String sql=" select t.* from "+ + " ( "+ + " select *,row_number() OVER (PARTITION BY mename ORDER BY date_time DESC) rn FROM dp_2_view_view_opticalpower "+ + " ) t where t.rn =1 "; + return sql; + } + } + + @SelectProvider(type = dpNewYayun_ChuanDong_Mapper.class_get_opticalpower_list.class,method = "get_opticalpower_list_all_SQL") + List get_opticalpower_all_list(); + //endregion + + + //region------------------------------------------------------------------------------------中间地图告警显示接口 + class class_get_maps_all_trans_alarms + { + public String get_maps_all_alarms_SQL() + { + String SQL=" "; + String areanames= " ('上城','拱墅','西湖','滨江','萧山','余杭','临平','钱塘','富阳','临安','桐庐','淳安','建德') "; + SQL = " with t1 as " + + " ( select id venueid,'' venuetypeid,'' venuetype, " + + " case" + + " when length(COALESCE(maintain_type,''))=0 then venue_name " + + " else venue_name || '(' || maintain_type || ')' " + + " end venuename, " + + " longitude_dp longitude,latitude_dp latitude," + + "b.dict_label areaname from yw_scene a , sys_dict_data b where scene_big_id in " + + " (select id from yw_scene_big_config where status='2') and longitude<>0 and a.area_county_id=b.dict_value " + + " and a.venue_type ='比赛场馆' " + + " and b.dict_type= 'yw_county' and id not in (10000,10500,20000,20100,20200,20300,20400) and b.dict_label in " + areanames + " )," + + " t2 as " + + " ( select 场馆id,count(*) alarmcount from dp_2_view_trans_alarms group by 场馆id ) , " + + " t3 as " + + " ( select 场馆id,count(*) loopcount from dp_2_view_trans_alarms where 告警类型 = '开环类' group by 场馆id ) ," + + " t4 as " + + " ( select 场馆id,count(*) devicecount from dp_2_view_trans_alarms where 告警类型 = '设备托管' group by 场馆id ) ," + + " t5 as " + + " ( select 场馆id,count(*) hardwarecount from dp_2_view_trans_alarms where 告警类型 = '硬件故障' group by 场馆id ) " + + " select t1.*,COALESCE(t2.alarmcount,0) alarmcount,COALESCE(t3.loopcount,0) loopcount,COALESCE(t4.devicecount,0) devicecount," + + "COALESCE(t5.hardwarecount,0) hardwarecount" + + " from t1 " + + " left join t2 on t1.venueid=t2.场馆id" + + " left join t3 on t1.venueid=t3.场馆id" + + " left join t4 on t1.venueid=t4.场馆id" + + " left join t5 on t1.venueid=t5.场馆id"; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_ChuanDong_Mapper.class_get_maps_all_trans_alarms.class,method = "get_maps_all_alarms_SQL") + List get_maps_all_alarms(); + //endregion + + + + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_Dict_Mapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_Dict_Mapper.java new file mode 100644 index 0000000000000000000000000000000000000000..80b65d7ff7d06ed54efdf6bec26c1cbb2c02f6b0 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_Dict_Mapper.java @@ -0,0 +1,99 @@ +package com.ruoyi.sunlm.mapper; + +import java.util.List; + +import com.ruoyi.sunlm.daping.*; +import org.apache.ibatis.annotations.*; +import org.springframework.stereotype.Component; + +/** + * 数据层 + * + * @author ruoyi + */ +@Mapper +@Component +public interface dpNewYayun_Dict_Mapper ////2023。5.10,新版大屏的接口 +{ + + //region------------------------------------------------------------------------------------DICT:区县列表 + @Select("select * from dp_2_dict_config order by id ") + List get_dict_list(); + //endregion + + //region------------------------------------------------------------------------------------DICT:地图告警列表 + @Select(" (select '监控' major , projectname netname, " + + " '在线率低 ('|| onlinerate ||'%)' alarmname,LOCALTIMESTAMP(0)::text eventtime,null handlepeople,null phonenumber,quxian code from dp_2_dict_project "+ + " where onlinerate::float8<98 order by onlinerate asc)"+ + " union all "+ + " (select '制证' , 网元名称 , " + + " 告警名称 ,告警时间::text ,null,null,分公司 from dp_2_view_dict_link_alarm where 项目类型='制证验证' order by 告警时间 desc) "+ + " union all "+ + " (select '特勤' , 网元名称 , " + + " 告警名称 ,告警时间::text ,null,null,分公司 from dp_2_view_dict_link_alarm where 项目类型='TQ安保' order by 告警时间 desc) " + ) + List get_map_alarm_list(); + //endregion + + + //region------------------------------------------------------------------------------------DICT:监控类项目统计 + @Select("select * from dp_2_dict_project_stat where batchid=(select max(batchid) from dp_2_dict_project_stat) ") + class_dp_6_dict_project_statis get_dict_monitor_project_stat(); + //endregion + + //region------------------------------------------------------------------------------------DICT:监控类项目 + @Select("select * from dp_2_dict_project where batchid=(select max(batchid) from dp_2_dict_project) ") + List get_dict_monitor_project_list(); + //endregion + + //region------------------------------------------------------------------------------------DICT:监控类告警 + @Select("select * from dp_2_view_dict_alarm where batchid=(select max(batchid) from dp_2_view_dict_alarm) order by createtime desc limit 20 ") + List get_dict_monitor_alarm_list(); + //endregion + + //region------------------------------------------------------------------------------------DICT:链路类告警 + @Select("select * from dp_2_view_dict_link_alarm where batchid=(select max(batchid) from dp_2_view_dict_link_alarm) order by 告警时间 desc limit 20 ") + List get_dict_link_alarm_list(); + //endregion + + //region------------------------------------------------------------------------------------DICT:终端接入统计 + class class_get_dict_clientcount // X轴0-24点,15分钟一个间隔,昨日今日对比, + { + public String get_dict_clientcount_SQL() + { + String SQL= " select * from dp_2_dict_wbc_hisclientcountday_statis where batchid=(select max(batchid) from dp_2_dict_wbc_hisclientcountday_statis)"+ + " order by adate "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Dict_Mapper.class_get_dict_clientcount.class,method = "get_dict_clientcount_SQL") + List get_dict_clientcount(); + //endregion + + //region------------------------------------------------------------------------------------DICT:终端流量统计 + class class_get_dict_clientstream // X轴0-24点,15分钟一个间隔,昨日今日对比, + { + public String get_dict_clientstream_SQL() + { + String SQL= " select * from dp_2_dict_wbc_hisclientsteamday_statis where batchid=(select max(batchid) from dp_2_dict_wbc_hisclientsteamday_statis)"+ + " order by adate "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Dict_Mapper.class_get_dict_clientstream .class,method = "get_dict_clientstream_SQL") + List get_dict_clientstream (); + //endregion + + //region------------------------------------------------------------------------------------DICT: AP在线数和总数统计 + @Select(" select sum(设备数1) 设备数1,sum(设备数2) 设备数2 from " + + " (" + + " (select online_num 设备数1 , total_num 设备数2 from dp_2_dict_wifi_online order by eventtime desc limit 1) " + + " union all " + + " (select online 设备数1 , total 设备数2 from dp_2_dict_wbc_currentapcount order by inserttime desc limit 1) " + + " ) as x ") + List get_dict_ap_count(); + //endregion + + + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_Gailan_Mapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_Gailan_Mapper.java new file mode 100644 index 0000000000000000000000000000000000000000..3665baa9d0737983cd31691a4214b3e6b10fd5c7 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_Gailan_Mapper.java @@ -0,0 +1,260 @@ +package com.ruoyi.sunlm.mapper; + +import java.util.List; + +import com.ruoyi.sunlm.daping.*; +import org.apache.ibatis.annotations.*; +import org.springframework.stereotype.Component; + +/** + * 数据层 + * + * @author ruoyi + */ +@Mapper +@Component +public interface dpNewYayun_Gailan_Mapper ////2023。5.10,新版大屏的接口 +{ + + //region------------------------------------------------------------------------------------获取缓存配置 + @Select(" select * from dp_2_cache_config") + class_dp_1_cache_config get_cache_config(); + //endregion + + //region------------------------------------------------------------------------------------获取概览:无线退服统计 + ///@Select(" select * from dp_2_wireless_alarm_statistics where batchid=(select max(batchid) from dp_2_wireless_alarm_statistics) ") + //------------------为了保证和故障清单显示同步,改成直接取,从统计中取可能会有1分钟时间差。 + @Select(" with t1 as " + + " ( select 1 sign,count(*) 退服数2G from dp_2_view_wireless_alarm where sitetype like '2G%' " + + //" and to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " and (场馆id is not null or 区域id is not null ) ), " + + " t2 as " + + " (select 1 sign,count(*) 退服数4G from dp_2_view_wireless_alarm where sitetype like '4G%' " + + //" and to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " and (场馆id is not null or 区域id is not null)), " + + " t3 as " + + " (select 1 sign,count(*) 退服数5G from dp_2_view_wireless_alarm where sitetype like '5G%' " + + //" and to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " and (场馆id is not null or 区域id is not null)), " + + " t4 as " + + " (select 1 sign , (select count(distinct 基站全称) from dp_2_scene_spot_allcells)+" + + " (select count(distinct 基站全称) from dp_2_scene_spot_gsmcells) 基站总数 " + + " ) " + + " select t1.退服数2G,t2.退服数4G,t3.退服数5G,t4.基站总数,2 batchid from t1 " + + " left join t2 on t1.sign=t2.sign " + + " left join t3 on t1.sign=t3.sign " + + " left join t4 on t1.sign=t4.sign ") + List get_wireless_outservice(); + //endregion + + //region------------------------------------------------------------------------------------概览:4/5G无线流量 + class class_get_gbflow_wireless // X轴0-24点,15分钟一个间隔,昨日今日对比 + { + public String get_gbflow_wireless_SQL( + @Param("typeid") int typeid) + { + String SQL=" "; + if (typeid==1) //4G + { + SQL= " select * from dp_2_gbflow_4g_statistics where batchid=(select max(batchid) from dp_2_gbflow_4g_statistics) " + + " order by adate "; + + } + else //5G //(select max(结束时间) from pm_kpi5g_venue) + { + SQL= " select * from dp_2_gbflow_5g_statistics where batchid=(select max(batchid) from dp_2_gbflow_5g_statistics) "+ + " order by adate "; + + } + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Gailan_Mapper.class_get_gbflow_wireless.class,method = "get_gbflow_wireless_SQL") + List get_gbflow_wireless(@Param("typeid") int typeid); + //endregion + + //region------------------------------------------------------------------------------------概览:综合管理统计 + //20230822 签到和巡检做个过滤,只要杭州的,修改了日期为当天当前时间之前 + //inspect_date::Date=current_date + @Select(" with t1 as " + + " (select 1 sign, count(*) 应签到数量 from v_yw_sign_log where " + + //" sign_date::Date=current_date " + + " begin_time between CURRENT_DATE::TIMESTAMP and now() "+ + " and city='杭州' )," + + " t2 as " + + " (select 1 sign,count(*) 实际签到数 from v_yw_sign_log " + + "where begin_time between CURRENT_DATE::TIMESTAMP and now() " + + "and sign_in_time is not null and city = '杭州'), " + + " t3 as " + + " (select 1 sign ,count(*) 巡检任务数 from v_yw_rout_inspect_log y where " + + " begin_time between CURRENT_DATE::TIMESTAMP and now() +'-2 hour' and city = '杭州'), " + + " t4 as " + + " (select 1 sign ,count(*) 已巡检任务 from v_yw_rout_inspect_log where feed_back_time is not null and " + + // " inspect_date::Date=current_date " + + " begin_time between CURRENT_DATE::TIMESTAMP and now() +'-2 hour' "+ + " and city='杭州') " + + + " select t1.应签到数量,t2.实际签到数 ," + + " case " + + " when t1.应签到数量::numeric=0 then 0" + + " else round(t2.实际签到数/t1.应签到数量::numeric*100,2) " + + " end 人员签到率," + + " t3.巡检任务数,t4.已巡检任务, " + + " case " + + " when t3.巡检任务数::numeric=0 then 0" + + " else round(t4.已巡检任务/t3.巡检任务数::numeric*100,2) " + + " end 巡检完成率 " + + " from t1 " + + " left join t2 on t1.sign=t2.sign " + + " left join t3 on t1.sign=t3.sign " + + " left join t4 on t1.sign=t4.sign " + ) + List get_manage_counts(); + //endregion + + //region------------------------------------------------------------------------------------概览:DICT统计 + @Select(" with t1 as" + + " (select dict_equip_num 设备数,1 sign from yw_scene_noticeinfo where id=1), "+ + " t2 as " + + " (select count(*) 告警总数,1 sign from dp_2_dict_link_alarm ), "+ + " t3 as " + + " (select count(*) 告警总数,1 sign from dp_2_dict_alarm ) "+ + " select COALESCE(t1.设备数,0) 设备数, COALESCE(t2.告警总数,0)+COALESCE(t3.告警总数,0) 告警总数 from "+ + " t1 " + + " left join t2 on t1.sign=t2.sign "+ + " left join t3 on t1.sign=t3.sign " + ) + List get_dict_counts(); + //endregion + + //region------------------------------------------------------------------------------------概览:动力传输统计 + @Select(" with t1 as " + + " (select 1 sign,COALESCE(public_transport_equip_num+private_transport_equip_num,0) 设备数1 from yw_scene_noticeinfo where id =1)," + + " t2 as " + + " (select 1 sign , COALESCE(dh_net_num,0) 设备数2 from yw_scene_noticeinfo where id=1 )," + + " t3 as " + + " (select 1 sign,count(*) 告警总数1 from dp_2_view_trans_alarms " + + //" where to_char(告警时间,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " where 1=1 " + + " and 场馆id is not null) ," + + " t4 as " + + " (select 1 sign,count(*) 告警总数2 from dp_2_view_power_alarm " + + //" where to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " where 1=1 " + + //" and (场馆id is not null or 区域id is not null) ) " + //只显示场馆的 + " and (场馆id is not null ) ) " + + " select t1.设备数1,t2.设备数2 ,t3.告警总数1,t4.告警总数2 " + + " from t1 " + + " left join t2 on t1.sign=t2.sign " + + " left join t3 on t1.sign=t3.sign " + + " left join t4 on t1.sign=t4.sign " //传输只有场馆告警 + ) + List get_trans_counts(); + //endregion + + //region------------------------------------------------------------------------------------概览:全网保障传输环路流量 + class class_get_gbflow_huanlu // X轴0-24点,15分钟一个间隔,昨日今日对比, + { + public String get_gbflow_huanlu_SQL() + { + String SQL= " select * from dp_2_view_flow_statistics where batchid=(select max(batchid) from dp_2_view_flow_statistics)"+ + " order by adate "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Gailan_Mapper.class_get_gbflow_huanlu.class,method = "get_gbflow_huanlu_SQL") + List get_gbflow_huanlu(); + //endregion + + //region------------------------------------------------------------------------------------概览:AGIS和互联网统计接口 + class class_get_agis_internet_counts // X轴0-24点,15分钟一个间隔,昨日今日对比, + { + public String get_agis_internet_counts_SQL() + { + String SQL = " with t1 as " + + " (select 1 sign,COALESCE(agis_num,0) 设备数1 from yw_scene_noticeinfo where id=1 )," + + " t2 as " + + " (select 1 sign ,COALESCE(wifi_net_num,0) 设备数2 from yw_scene_noticeinfo where id=1)," + + " t3 as " + + " (select 1 sign , count(*) 告警总数1 from dp_2_view_agis_alarms_combine " + + //" where to_char(告警时间,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " where 1=1 " + + " and 专业='AGIS') ," + + " t4 as " + + " (select 1 sign ,count(*) 告警总数2 from dp_2_view_agis_alarms_combine " + + //" where to_char(告警时间,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " where 1=1 " + + " and 专业='WIFI') " + + " select t1.设备数1,t2.设备数2 ,t3.告警总数1,t4.告警总数2 " + + " from t1 " + + " left join t2 on t1.sign=t2.sign " + + " left join t3 on t1.sign=t3.sign " + + " left join t4 on t1.sign=t4.sign "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Gailan_Mapper.class_get_agis_internet_counts.class,method = "get_agis_internet_counts_SQL") + List get_agis_internet_counts(); + //endregion + + //region------------------------------------------------------------------------------------概览:中间地图告警显示接口 + class class_get_maps_all_alarms + { + public String get_maps_all_alarms_SQL(@Param("level") int level) + { + String SQL=" "; + String areanames=" "; + if (level==0) //所有,不会用 + { + areanames = " ('上城','拱墅','西湖','滨江','萧山','余杭','临平','钱塘','富阳','临安','桐庐','淳安','建德') "; + } + else if (level==1) //1 : 全域(除了 上城区 、拱墅区、西湖区、滨江区 ,'萧山','钱塘'之外的区域), + { + //areanames = " ('余杭','临平','富阳','临安','桐庐','淳安','建德') "; + areanames = " ('上城','拱墅','西湖','滨江','萧山','余杭','临平','钱塘','富阳','临安','桐庐','淳安','建德') "; + } + else if (level==2) { //城区 上城区 、拱墅区、西湖区、滨江区,'萧山','钱塘' + areanames = " ('上城','拱墅','西湖','滨江','萧山','钱塘') "; + } + SQL =" select * from dp_2_maps_allalarms_statistics where batchid=(select max(batchid) from dp_2_maps_allalarms_statistics) " + + " and areaname in " +areanames; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Gailan_Mapper.class_get_maps_all_alarms.class,method = "get_maps_all_alarms_SQL") + List get_maps_all_alarms(@Param("level") int level); + //endregion + + //region------------------------------------------------------------------------------------概览:中间地图告警弹出列表 + class class_get_maps_all_alarms_popup + { + public String get_maps_all_alarms_popup_SQL() + { + String SQL=" "; + /* + SQL =" select '无线' major , case when cell_name is null then site_name else cell_name end netname, " + + " alarmname alarmname,eventtime eventtime,故障处理人 handlepeople,phonenumber,场馆id sceneid from dp_2_view_wireless_alarm where 场馆id is not null "+ + " and to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') "+ + " union all "+ + " select '动环' , site_name , " + + " alarmname ,eventtime ,故障处理人,phonenumber,场馆id sceneid from dp_2_view_power_alarm where 场馆id is not null "+ + " and to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') "+ + " union all "+ + " select '传输' , 网元名称 , " + + " 告警名称, 告警时间,故障处理人,phonenumber ,场馆id sceneid from dp_2_view_trans_alarms where 场馆id is not null "+ + " and to_char(告警时间,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') "+ + " union all "+ + " select '专网' , 网元名称 , " + + " 告警名称, 告警时间,故障处理人,phonenumber ,场馆id sceneid from dp_2_view_agis_alarms where 场馆id is not null "+ + " and to_char(告警时间,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') ";*/ + SQL =" select * from dp_2_maps_allalarms_list where batchid=(select max(batchid) from dp_2_maps_allalarms_list) "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Gailan_Mapper.class_get_maps_all_alarms_popup.class,method = "get_maps_all_alarms_popup_SQL") + List get_maps_all_alarms_popup(); + //endregion + + + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_Wuxian_Mapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_Wuxian_Mapper.java new file mode 100644 index 0000000000000000000000000000000000000000..dff3d0a019da0eb06934a2d544d1d1bd2bcc6f6e --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_Wuxian_Mapper.java @@ -0,0 +1,1394 @@ +package com.ruoyi.sunlm.mapper; + +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateTime; +import com.github.pagehelper.PageInfo; +import com.ruoyi.sunlm.daping.*; + +import org.apache.ibatis.annotations.*; +import org.springframework.stereotype.Component; + +/** + * 数据层 + * + * @author ruoyi + */ +@Mapper +@Component +public interface dpNewYayun_Wuxian_Mapper ////2023。5.10,新版大屏的接口 +{ + //region--------------------------------------------------------------------------------------公共方法 + class class_getmincontroltype { + public String getmincontroltype_SQL(@Param("areaid") int areaid, + @Param("sceneid") int sceneid + ) + { + String swhere = " where 1=2 "; + if (areaid>0) swhere =" where areaid=#{areaid} "; + else if (sceneid>0) swhere =" where sceneid=#{sceneid} "; + String SQL=" select COALESCE((select mintype from dp_2_scene_control "+swhere+" limit 1),15) "; //没有配置的,都以15分钟展示 + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_getmincontroltype.class,method = "getmincontroltype_SQL") + int getmincontroltype(@Param("areaid") int areaid, + @Param("sceneid") int sceneid); + //endregion + + //region------------------------------------------------------------------------------------获取场馆列表 + @Select("select * from dp_2_view_otherscene") + List getvenuelists(); + //endregion + + //region------------------------------------------------------------------------------------获取某个场馆的信息 + @Select(" select id venueId,venue_name venueName , longitude,latitude from yw_scene " + + " where id=#{sceneid} order by id") + class_dp_2_scenelist getonevenue(@Param("sceneid") int sceneid); + //endregion + + //region------------------------------------------------------------------------------------获取某个场馆的坐席中文名 + @Select(" select * from dp_2_seat_chinesename") + List get_seat_chinesename(); + //endregion + + //region------------------------------------------------------------------------------------获取景区列表,是否有告警 + @Select(" select distinct 景区大类 from dp_2_spot_config ") + List getspottypes(); + + class class_spot_wirelessalarms_lists + { + public String get_spot_wirelessalarms_lists_SQL(@Param("spottypeid") int spottypeid) + { + String swhere=""; + if (spottypeid!=0) swhere=" where 景区大类id=#{spottypeid} "; + String SQL="with t1 as " + + "( select 景区id spotId,景区大类id spotTypeid,景区大类 spotType,景区名称 spotName,中心经度 longitude,中心纬度 latitude ,景区介绍 spotDetail " + + " from dp_2_spot_config "+swhere+" )," + + "t2 as " + + "(" + + " select count(*) cnt,区域id from dp_2_view_wireless_alarm " + + //" where to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " where 1=1 " + + " and 区域id is not null group by 区域id " + + ")" + + "select t1.*,COALESCE(t2.cnt,0) alarmcount from t1 left join t2 on t1.spotId=t2.区域id "; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_spot_wirelessalarms_lists.class,method = "get_spot_wirelessalarms_lists_SQL") + List getspotlist(@Param("spottypeid") int spottypeid); + //endregion + + //region------------------------------------------------------------------------------------景区无线告警清单 + class class_spot_wirelessalarms_popup + { + public String get_spot_wirelessalarms_popup_SQL() + { + //String swhere="where to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') and 区域id is not null "; //今天的告警 + /* + String swhere="where 区域id is not null "; + String SQL =" select '无线' major , case when cell_name is null then site_name else cell_name end netname, " + + " alarmname alarmname,eventtime eventtime,'' handlepeople,区域id sceneid from dp_2_view_wireless_alarm "+swhere;*/ + String SQL =" select * from dp_2_maps_spotalarms_list where batchid=(select max(batchid) from dp_2_maps_spotalarms_list) "; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_spot_wirelessalarms_popup.class,method = "get_spot_wirelessalarms_popup_SQL") + List get_spot_wirelessalarms_popup(); + //endregion + + //region------------------------------------------------------------------------------------无线告警清单 + class classwirelessalarmslists + { + public String getwirelessalarmslistsSQL(@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid + ) + { + //String swhere="where to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') "; //今天的告警 + String swhere="where 1=1 "; + if (level==1) //全域 场馆+景点 + { + swhere+=" and (区域id is not null or 场馆id is not null) "; + } + else if (level==2 ) { //区域(场馆+景点)+景区 + if (areaid!=0) + swhere+=" and 区域id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; //传入的是大类 + else + swhere+= " and (区域id is not null or 场馆id is not null) "; + } + else if (level==3 ) { // 场馆 + if (sceneid!=0) { + swhere+=" and 场馆id = #{sceneid} " ; + } + } + String SQL="select * from dp_2_view_wireless_alarm " + swhere + " order by eventtime desc limit 20 "; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.classwirelessalarmslists.class,method = "getwirelessalarmslistsSQL") + List get_wireless_alarms_list(@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid); + //endregion + + //region------------------------------------------------------------------------------------动环告警清单 + class classpoweralarmslists + { + public String getpoweralarmslistsSQL(@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid + ) + { + //String swhere="where to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') "; //看今天的? + String swhere="where 1=1 "; + if (level==1) //全域 + { + swhere+= " and (区域id is not null or 场馆id is not null) " ; + } + else if (level==2) { //区域 + if (areaid!=0) //景点 + swhere+=" and 区域id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; //传入的是大类 + else + swhere+=" and (区域id is not null or 场馆id is not null) "; + } + else if (level==3 ) { // 场馆 + if (sceneid!=0) { + swhere+=" and 场馆id= #{sceneid} " ; + } + } + String SQL="select * from dp_2_view_power_alarm " + swhere + " order by eventtime desc limit 20 "; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.classpoweralarmslists.class,method = "getpoweralarmslistsSQL") + List get_power_alarms_list(@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid); + //endregion + + //region------------------------------------------------------------------------------------国际漫入漫出统计 + class class_get_roam_national + { + public String get_roam_national_SQL( + @Param("typeid") int typeid) + { + String SQL=" "; + String skind=" "; + if (typeid == 1) //漫入 + { + skind = "国际漫入"; + } + else { + skind = "国际漫出"; //待定 + } + String sTime = " (select max(stat_time) from dp_2_roams_statistics where position('"+skind+"' in kind)>0 ) "; + String swhere = " where position('"+skind+"' in kind)>0 "; + SQL = " select row_number() over(order by usercount::numeric desc) title,from_area name,usercount value " + + " from dp_2_roams_statistics "+ swhere+" and stat_time="+sTime+ + " order by usercount::numeric desc limit 5 "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_roam_national.class,method = "get_roam_national_SQL") + List get_roam_national(@Param("typeid") int typeid); + //endregion + + //region------------------------------------------------------------------------------------省内漫入漫出统计 + class class_get_roam_inner + { + public String get_roam_inner_SQL( + @Param("typeid") int typeid) + { + String SQL=" "; + String skind=" "; + if (typeid == 1) //漫入 + { + skind = "国内漫入"; + } + else { + skind = "国内漫出"; //待定 + } + String sTime = " (select max(stat_time) from dp_2_roams_statistics where position('"+skind+"' in kind)>0 ) "; + String swhere = " where position('"+skind+"' in kind)>0 "; + SQL = " select row_number() over(order by usercount::numeric desc) title,from_area name,usercount value " + + " from dp_2_roams_statistics "+ swhere+" and stat_time="+sTime+ + " order by usercount::numeric desc limit 5 "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_roam_inner.class,method = "get_roam_inner_SQL") + List get_roam_inner(@Param("typeid") int typeid); + //endregion + + //region ------------------------------------------------------------------------------------区域用户数 + class class_get_area_usercounts // 区域用户数,15分钟,X轴0-24点,15分钟一个间隔,昨日今日对比 + { + public String get_area_usercounts_SQL( + @Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid) + { + String SQL=" "; + + if (typeid==1) //4G //(select max(结束时间) from pm_kpi4g_venue) + { + if ((level==1) || (level==2) ) //区域,默认为全域,AREAID>0 时,景区 + { + String sTime = " LOCALTIMESTAMP(0) "; + String swhere=" where 1=1 "; + if ((areaid!=0) && (level==2)) swhere=" where 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi4g_spot "+swhere+" ), '15 min' ) AS b " + //where 景区id=#{areaid} + " group by time ORDER BY time ASC )," + + /* + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,sum(round(最大用户数::numeric, 2)) value , 1 sign from pm_kpi4g_spot " + swhere + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd') group by datetime" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,sum(round(最大用户数::numeric, 2)) value , 2 sign from pm_kpi4g_spot " +swhere + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') group by datetime" + + " ) " + + */ + + " t2 as " + + " (select datetime, sum(value1) value , sign from dp_2_kpi4g_allspots_statistics " +swhere+ + " and sign=1 and batchid=(select max(batchid) from dp_2_kpi4g_allspots_statistics) group by sign,datetime " + + " )," + + + " t3 as " + + " (select datetime, sum(value1) value, sign from dp_2_kpi4g_allspots_statistics " +swhere+ + " and sign=2 and batchid=(select max(batchid) from dp_2_kpi4g_allspots_statistics) group by sign,datetime " + + " ) " + + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + else if (level==3) //场馆 + { + String sTime = " LOCALTIMESTAMP(0) "; + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi4g_venue where 场馆id =#{sceneid}), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + /* + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi4g_venue where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd')" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi4g_venue where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + */ + + " t2 as " + + " (select datetime, value1 value , sign from dp_2_kpi4g_allvenue_statistics where 场馆id=#{sceneid} " + + " and sign=1 and batchid=(select max(batchid) from dp_2_kpi4g_allvenue_statistics) " + + " )," + + + " t3 as " + + " (select datetime, value1 value , sign from dp_2_kpi4g_allvenue_statistics where 场馆id=#{sceneid} " + + " and sign=2 and batchid=(select max(batchid) from dp_2_kpi4g_allvenue_statistics) " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + } + else //5G //(select max(结束时间) from pm_kpi5g_venue) + { + if ((level==2) || (level==1)) //区域,默认为全域,AREAID>0 时,景区 + { + String sTime = " LOCALTIMESTAMP(0) "; + String swhere=" where 1=1 "; + if ((areaid!=0) && (level==2)) swhere=" where 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi5g_spot "+swhere+"), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + /* + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,sum(round(最大用户数::numeric, 2)) value , 1 sign from pm_kpi5g_spot " +swhere+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd') group by datetime " + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,sum(round(最大用户数::numeric, 2)) value , 2 sign from pm_kpi5g_spot " +swhere+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') group by datetime " + + " ) " + + */ + " t2 as " + + " (select datetime, sum(value1) value, sign from dp_2_kpi5g_allspots_statistics " +swhere+ ////where 景区id=#{areaid} + " and sign=1 and batchid=(select max(batchid) from dp_2_kpi5g_allspots_statistics) group by sign,datetime " + + " )," + + + " t3 as " + + " (select datetime, sum(value1) value, sign from dp_2_kpi5g_allspots_statistics " +swhere+ ////where 景区id=#{areaid} + " and sign=2 and batchid=(select max(batchid) from dp_2_kpi5g_allspots_statistics) group by sign,datetime " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + else if (level==3) //场馆 + { + String sTime = " LOCALTIMESTAMP(0) "; + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi5g_venue where 场馆id =#{sceneid}), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + /* + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi5g_venue where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd')" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi5g_venue where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + */ + " t2 as " + + " (select datetime, value1 value , sign from dp_2_kpi5g_allvenue_statistics where 场馆id=#{sceneid} " + + " and sign=1 and batchid=(select max(batchid) from dp_2_kpi5g_allvenue_statistics) " + + " )," + + + " t3 as " + + " (select datetime, value1 value, sign from dp_2_kpi5g_allvenue_statistics where 场馆id=#{sceneid} " + + " and sign=2 and batchid=(select max(batchid) from dp_2_kpi5g_allvenue_statistics) " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + } + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_area_usercounts.class,method = "get_area_usercounts_SQL") + List get_area_usercounts(@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid); + //endregion + + //region -----------------------------------------------------------------------------------区域流量 + class class_get_area_gbflow // 区域流量,15分钟,,X轴0-24点,15分钟一个间隔,昨日今日对比 + { + public String get_area_gbflow_SQL( + @Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid) + { + String SQL=" "; + if (typeid==1) //4G//(select max(结束时间) from pm_kpi4g_venue) + { + if ((level==1) || (level==2)) //区域,景区 + { + String sTime = " LOCALTIMESTAMP(0) "; + String swhere=" where 1=1 "; + if ((areaid!=0) && (level==2)) swhere=" where 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi4g_spot "+swhere+" ), '15 min' ) AS b " + //where 景区id=#{areaid} + " group by time ORDER BY time ASC )," + + /* + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,sum(round(\"流量GB\"::numeric, 2)) value , 1 sign from pm_kpi4g_spot " +swhere+ ////where 景区id=#{areaid} + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd') group by datetime" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,sum(round(\"流量GB\"::numeric, 2)) value , 2 sign from pm_kpi4g_spot " +swhere + //where 景区id=#{areaid} + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') group by datetime" + + " ) " + + */ + + " t2 as " + + " (select datetime, sum(value2) value, sign from dp_2_kpi4g_allspots_statistics " +swhere+ ////where 景区id=#{areaid} + " and sign=1 and batchid=(select max(batchid) from dp_2_kpi4g_allspots_statistics) group by sign,datetime " + + " )," + + + " t3 as " + + " (select datetime, sum(value2) value, sign from dp_2_kpi4g_allspots_statistics " +swhere+ ////where 景区id=#{areaid} + " and sign=2 and batchid=(select max(batchid) from dp_2_kpi4g_allspots_statistics) group by sign,datetime " + + " ) " + + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + else if (level==3) //场馆 + { + String sTime = " LOCALTIMESTAMP(0) "; + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi4g_venue where 场馆id =#{sceneid}), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + /* + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi4g_venue where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd')" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi4g_venue where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + */ + " t2 as " + + " (select datetime, value2 value, sign from dp_2_kpi4g_allvenue_statistics where 场馆id=#{sceneid} " + + " and sign=1 and batchid=(select max(batchid) from dp_2_kpi4g_allvenue_statistics) " + + " )," + + + " t3 as " + + " (select datetime, value2 value, sign from dp_2_kpi4g_allvenue_statistics where 场馆id=#{sceneid} " + + " and sign=2 and batchid=(select max(batchid) from dp_2_kpi4g_allvenue_statistics) " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + } + else //5G /(select max(结束时间) from pm_kpi4g_venue) + { + if ((level==1) || (level==2)) //区域 + { + String sTime = " LOCALTIMESTAMP(0) "; + String swhere=" where 1=1 "; + if ((areaid!=0) && (level==2)) swhere=" where 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi5g_spot "+swhere+"), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + /* + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,sum(round(\"流量GB\"::numeric, 2)) value , 1 sign from pm_kpi5g_spot " +swhere+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd') group by datetime " + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,sum(round(\"流量GB\"::numeric, 2)) value , 2 sign from pm_kpi5g_spot " +swhere+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') group by datetime " + + " ) " + + */ + + " t2 as " + + " (select datetime, sum(value2) value, sign from dp_2_kpi5g_allspots_statistics " +swhere+ ////where 景区id=#{areaid} + " and sign=1 and batchid=(select max(batchid) from dp_2_kpi5g_allspots_statistics) group by sign,datetime " + + " )," + + + " t3 as " + + " (select datetime, sum(value2) value, sign from dp_2_kpi5g_allspots_statistics " +swhere+ ////where 景区id=#{areaid} + " and sign=2 and batchid=(select max(batchid) from dp_2_kpi5g_allspots_statistics) group by sign,datetime " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + else if (level==3) //场馆 + { + String sTime = " LOCALTIMESTAMP(0) "; + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi5g_venue where 场馆id =#{sceneid}), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + /* + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi5g_venue where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd')" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi5g_venue where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + */ + + " t2 as " + + " (select datetime, value2 value, sign from dp_2_kpi5g_allvenue_statistics where 场馆id=#{sceneid} " + + " and sign=1 and batchid=(select max(batchid) from dp_2_kpi5g_allvenue_statistics) " + + " )," + + + " t3 as " + + " (select datetime, value2 value, sign from dp_2_kpi5g_allvenue_statistics where 场馆id=#{sceneid} " + + " and sign=2 and batchid=(select max(batchid) from dp_2_kpi5g_allvenue_statistics) " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + } + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_area_gbflow.class,method = "get_area_gbflow_SQL") + List get_area_gbflow( + @Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid); + //endregion + + //region --------------------------------------------------------------------------------------上行Prb利用率 + class class_get_prb_uplink // 上行Prb利用率TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_prb_uplink_SQL( + @Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype, + @Param("inorout") int inorout) + { + String SQL=" "; + String sTable=" "; + String swhere = " "; + String swhere2=" "; + if ((level==1) || (level==2) ) //全域,区域显示一致 + { + if (mintype == 1) { //1分钟 // 一分钟的数据需要OMC控制输出,为全量的。 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + sTable=" dp_2_kpi4g_min_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G //(select max(时间) from pm_kpi5g_min) + { + sTable=" dp_2_kpi5g_min_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } else //15分钟 // 15分钟的数据需要为全量输送, 采集帅选出景区的小区的数据。//待定 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell_fordp) + { + sTable=" dp_2_kpi4g_cell_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G //(select max(endtime) from pm_kpi5g_cell_fordp) + { + sTable=" dp_2_kpi5g_cell_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } + } + else if (level==3) //场馆 + { + if (mintype == 1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + sTable=" dp_2_kpi4g_min_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + } else //5G //(select max(时间) from pm_kpi5g_min) + { + sTable=" dp_2_kpi5g_min_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + } + } else //15分钟 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell_fordp) + { + sTable=" dp_2_kpi4g_cell_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + + } else //5G //(select max(endtime) from pm_kpi5g_cell_fordp) + { + sTable=" dp_2_kpi5g_cell_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + + } + } + } + String subTable=" (select distinct 小区名称,prb_up,kpiclr_prb_up from "+sTable+" where 1=1 " +swhere2+swhere+ + " and batchid=(select max(batchid) from "+sTable+" ) ) as a "; + SQL =" select row_number() over(order by prb_up desc) title,小区名称 name,round(prb_up::numeric, 2) value, " + + " kpiclr_prb_up color from "+subTable+" where prb_up is not null "+ + " order by prb_up desc limit 5"; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_prb_uplink.class,method = "get_prb_uplink_SQL") + List get_prb_uplink( + @Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype, + @Param("inorout") int inorout); + //endregion + + //region -----------------------------------------------------------------------------------下行Prb利用率 + class class_get_prb_downlink // 下行Prb利用率TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_prb_downlink_SQL( + @Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype, + @Param("inorout") int inorout) + { + String SQL=" "; + String sTable=" "; + String swhere = " "; + String swhere2=" "; + if ((level==1) || (level==2)) //全域,区域显示一致 + { + if (mintype == 1) { //1分钟 // 一分钟的数据需要OMC控制输出,为全量的。 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + sTable=" dp_2_kpi4g_min_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G //(select max(时间) from pm_kpi5g_min) + { + sTable=" dp_2_kpi5g_min_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } else //15分钟 // 15分钟的数据需要为全量输送, 采集帅选出景区的小区的数据。//待定 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell_fordp) + { + sTable=" dp_2_kpi4g_cell_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G //(select max(endtime) from pm_kpi5g_cell_fordp) + { + sTable=" dp_2_kpi5g_cell_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } + } + else if (level==3) //场馆 + { + if (mintype == 1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + sTable=" dp_2_kpi4g_min_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + } else //5G //(select max(时间) from pm_kpi5g_min) + { + sTable=" dp_2_kpi5g_min_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + } + } else //15分钟 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell_fordp) + { + sTable=" dp_2_kpi4g_cell_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + + } else //5G //(select max(endtime) from pm_kpi5g_cell_fordp) + { + sTable=" dp_2_kpi5g_cell_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + + } + } + } + String subTable=" (select distinct 小区名称,prb_down,kpiclr_prb_down from "+sTable+" where 1=1 " +swhere2+swhere+ + " and batchid=(select max(batchid) from "+sTable+" ) ) as a "; + SQL =" select row_number() over(order by prb_down desc) title,小区名称 name,round(prb_down::numeric, 2) value, " + + " kpiclr_prb_down color from "+subTable+" where prb_down is not null "+ + " order by prb_down desc limit 5"; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_prb_downlink.class,method = "get_prb_downlink_SQL") + List get_prb_downlink (@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype, + @Param("inorout") int inorout); + //endregion + + //region ---------------------------------------------------------------------------------------平均干扰 + class class_get_avg_disturb // 最大干扰值TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_avg_disturb_SQL( + @Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype, + @Param("inorout") int inorout) + { + String SQL=" "; + String sTable=" "; + String swhere = " "; + String swhere2=" "; + if ((level==1) || (level==2)) //全域,区域显示一致 + { + if (mintype == 1) { //1分钟 // 一分钟的数据需要OMC控制输出,为全量的。 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + sTable=" dp_2_kpi4g_min_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G //(select max(时间) from pm_kpi5g_min) + { + sTable=" dp_2_kpi5g_min_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } else //15分钟 // 15分钟的数据需要为全量输送, 采集帅选出景区的小区的数据。//待定 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell_fordp) + { + sTable=" dp_2_kpi4g_cell_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G //(select max(endtime) from pm_kpi5g_cell_fordp) + { + sTable=" dp_2_kpi5g_cell_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } + } + else if (level==3) //场馆 + { + if (mintype == 1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + sTable=" dp_2_kpi4g_min_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + } else //5G //(select max(时间) from pm_kpi5g_min) + { + sTable=" dp_2_kpi5g_min_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + } + } else //15分钟 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell_fordp) + { + sTable=" dp_2_kpi4g_cell_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + + } else //5G //(select max(endtime) from pm_kpi5g_cell_fordp) + { + sTable=" dp_2_kpi5g_cell_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + + } + } + } + String subTable=" (select distinct 小区名称,avg_disturb,kpiclr_avg_disturb from "+sTable+" where 1=1 " +swhere2+swhere+ + " and batchid=(select max(batchid) from "+sTable+" ) ) as a "; + SQL =" select row_number() over(order by avg_disturb desc) title,小区名称 name,round(avg_disturb::numeric, 2) value, " + + " kpiclr_avg_disturb color from "+subTable+" where avg_disturb is not null "+ + " order by avg_disturb desc limit 5"; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_avg_disturb.class,method = "get_avg_disturb_SQL") + List get_avg_disturb (@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype, + @Param("inorout") int inorout); + //endregion + + //region ---------------------------------------------------------------------------------------最大用户数 + class class_get_user_data // 最大用户数TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_user_data_SQL( + @Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype, + @Param("inorout") int inorout) + { + String SQL=" "; + String sTable=" "; + String swhere = " "; + String swhere2=" "; + if ((level==1) || (level==2)) //全域,区域显示一致 + { + if (mintype == 1) { //1分钟 // 一分钟的数据需要OMC控制输出,为全量的。 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + sTable=" dp_2_kpi4g_min_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G //(select max(时间) from pm_kpi5g_min) + { + sTable=" dp_2_kpi5g_min_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } else //15分钟 // 15分钟的数据需要为全量输送, 采集帅选出景区的小区的数据。//待定 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell_fordp) + { + sTable=" dp_2_kpi4g_cell_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G //(select max(endtime) from pm_kpi5g_cell_fordp) + { + sTable=" dp_2_kpi5g_cell_statistics "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } + } + else if (level==3) //场馆 + { + if (mintype == 1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + sTable=" dp_2_kpi4g_min_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + } else //5G //(select max(时间) from pm_kpi5g_min) + { + sTable=" dp_2_kpi5g_min_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + } + } else //15分钟 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell_fordp) + { + sTable=" dp_2_kpi4g_cell_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + + } else //5G //(select max(endtime) from pm_kpi5g_cell_fordp) + { + sTable=" dp_2_kpi5g_cell_statistics "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + if (inorout > 0) swhere = " and 场内场外='" + inorout + "' "; //1:场内,2:场外,0:默认全部 + + } + } + } + String subTable=" (select distinct 小区名称,max_user,kpiclr_max_user from "+sTable+" where 1=1 " +swhere2+swhere+ + " and batchid=(select max(batchid) from "+sTable+" ) ) as a "; + SQL =" select row_number() over(order by x.colorscore desc,max_user desc) title,小区名称 name,round(max_user::numeric, 2) value, " + + " kpiclr_max_user color from "+subTable+ + " left join (select distinct upper(color) color,colorscore from dp_scene_config) x on upper(a.kpiclr_max_user)=x.color "+ + " where max_user is not null "+ + " order by x.colorscore desc,max_user desc limit 5"; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_user_data.class,method = "get_user_data_SQL") + List get_user_data(@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype, + @Param("inorout") int inorout); + //endregion + + //region------------------------------------------------------------------------------------3D大屏外场保障(牌子显示) + class class_scene_test_data + { + public String get_scene_test_dataSQL(@Param("sceneid") int sceneid, + @Param("typeid") int typeid + ) + { + String swhere=" where 1=1 "; + if (sceneid!=0) { + swhere+=" and scene_id = #{sceneid} " ; //外场的小区 + } + if (typeid!=0) { + String nettype=""; + if (typeid==1) nettype="4G" ; else nettype="5G"; + swhere+=" and nettype ='"+nettype+"' " ; //外场的小区 + } + String SQL=" select * from yw_scene_test_data " + swhere ; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_scene_test_data.class,method = "get_scene_test_dataSQL") + List get_test_data(@Param("sceneid") int sceneid, + @Param("typeid") int typeid); + //endregion + + //region------------------------------------------------------------------------------------外场基站无线告警清单 + class class_bts_wirelessalarmslists + { + public String get_bts_wirelessalarmslistsSQL(@Param("sceneid") int sceneid) + { + String sTable=" dp_2_view_wireless_alarm "; //dp_2_view_wireless_alarm_debug + String SQL=" select site_name btsname ,longitude,latitude,count(*) alarmcount from " +sTable+ + //" where to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " where 1=1 " + + " and 场馆id = #{sceneid} and 场内场外='2' group by site_name,longitude,latitude "; + return SQL; + } + + public String get_alarmslist_by_site_SQL(@Param("sceneid") int sceneid) + { + String sTable=" dp_2_view_wireless_alarm "; //dp_2_view_wireless_alarm_debug + String SQL=" select 场馆id sceneid,'无线' major,site_name reserved," + + " case when cell_name is null then site_name else cell_name end netname, " + + " alarmname,eventtime,故障处理人 handlepeople,phonenumber "+ + " from "+sTable+ + //" where to_char(eventtime,'YYYY-MM-DD')=to_char(now() ,'YYYY-MM-DD') "+ + " where 1=1 "+ + " and 场馆id = #{sceneid} and 场内场外='2' " + + " order by eventtime desc "; + return SQL; + } + + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_bts_wirelessalarmslists.class,method = "get_bts_wirelessalarmslistsSQL") + List get_bts_wireless_alarms_list(@Param("sceneid") int sceneid); + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_bts_wirelessalarmslists.class,method = "get_alarmslist_by_site_SQL") + List get_wireless_alarms_by_site(@Param("sceneid") int sceneid); + //endregion + + //region------------------------------------------------------------------------------------内外场坐席无线告警清单 + class class_seat_wirelessalarmslists + { + public String get_seat_wirelessalarmslistsSQL(@Param("sceneid") int sceneid, + @Param("inorout") int inorout + ) + { + String swhere=""; + String sTable=" dp_2_view_wireless_alarm "; // dp_2_view_wireless_alarm_debug + if (inorout>0) swhere =" and 场内场外='"+inorout+ "' "; + String SQL=" select unnest(string_to_array(坐席编号::text, '/'::text)) as seatid, count(*) alarmcount " + + " from " +sTable+ + //" where to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " where 1=1 " + + " and 场馆id = #{sceneid} "+ swhere+" group by seatid "; + return SQL; + } + + public String get_alarmslist_by_seat_SQL(@Param("sceneid") int sceneid) + { + String sTable=" dp_2_view_wireless_alarm "; // dp_2_view_wireless_alarm_debug + String SQL=" select id, 场馆id sceneid,'无线' major,unnest(string_to_array(坐席编号::text, '/'::text)) reserved , " + + " case when cell_name is null then site_name else cell_name end netname, " + + " alarmname,eventtime,故障处理人 handlepeople,phonenumber "+ + " from "+sTable+ + //" where to_char(eventtime,'YYYY-MM-DD')=to_char(now() ,'YYYY-MM-DD') "+ + " where 1=1 "+ + " and 场馆id = #{sceneid} order by eventtime desc "; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_seat_wirelessalarmslists.class,method = "get_seat_wirelessalarmslistsSQL") + List get_seat_wireless_alarms_list(@Param("sceneid") int sceneid, + @Param("inorout") int inorout); + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_seat_wirelessalarmslists.class,method = "get_alarmslist_by_seat_SQL") + List get_wireless_alarms_by_seat(@Param("sceneid") int sceneid); + //endregion + + //region------------------------------------------------------------------------------------中间地图告警显示接口 + class class_get_maps_wireless_alarms + { + public String get_maps_wireless_alarms_SQL( + @Param("level") int level, + @Param("areaid") int areaid) + { + String SQL=" "; + String areanames=" "; + if (level==0) //不会用到,场馆小区级告警统计,测试用 + { + areanames = " ('上城','拱墅','西湖','滨江','萧山','余杭','临平','钱塘','富阳','临安','桐庐','淳安','建德') "; + } + else if (level==1) //1 : 全域 (除了 上城区 、拱墅区、西湖区、滨江区 ,'萧山','钱塘'之外的区域),场馆小区级告警统计 + { + //areanames = " ('余杭','临平','富阳','临安','桐庐','淳安','建德') "; + areanames = " ('上城','拱墅','西湖','滨江','萧山','余杭','临平','钱塘','富阳','临安','桐庐','淳安','建德') "; + } + else if (level==2) //2: 区域 '上城','拱墅','西湖','滨江','萧山','钱塘',场馆小区级告警统计 + { + areanames = " ('上城','拱墅','西湖','滨江','萧山','钱塘') "; + } + //------------------------------------ + if ((level==0) || (level==1) || ((level==2) && (areaid==0)) ) //城区,未指定区域, 显示的是场馆的数据 + { + SQL =" select venueid,venuetypeid,venuetype,venuename,longitude,latitude,areaname,wirelesscount,0,0,0,wirelesscount alarmcount " + + " from dp_2_maps_allalarms_statistics where batchid=(select max(batchid) from dp_2_maps_allalarms_statistics) " + + " and areaname in " +areanames; + } + else if ((level==2) && (areaid>0)) { // 景区, 只有逻辑站退服告警和整站退服, 需要单独处理 + String swhere1=" "; + String swhere2=" "; + if (areaid!=0) { + //swhere1 = " where 景区大类id=#{areaid} "; //传入的是大类 + //swhere2 = " and 区域id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; //传入的是大类 + swhere2 = " and venueid in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; //传入的是大类 + } + /* + SQL = " with t1 as" + + " (" + + " select 景区id venueid,景区大类id venuetypeid, 景区大类 venuetype, 景区介绍 icontype ,景区名称 venuename ,中心经度 longitude,中心纬度 latitude,行政区域 areaname " + + " from dp_2_spot_config " + + swhere1+ + " ), " + + " t2 as" + + " (" + + " select 区域id,count(*) cnt from dp_2_view_wireless_alarm " + + //" where to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') " + + " where 1=1 " + + swhere2+ + " group by 区域id "+ + " ) " + + + " select t1.*,COALESCE(t2.cnt,0) wirelesscount,0,0,0,COALESCE(t2.cnt,0) alarmcount from t1 " + + " left join t2 on t1.venueid=t2.区域id " ; */ + SQL =" select * from dp_2_maps_spotalarms_statistics where batchid=(select max(batchid) from dp_2_maps_spotalarms_statistics) " + swhere2; + } + + + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_maps_wireless_alarms.class,method = "get_maps_wireless_alarms_SQL") + List get_maps_wireless_alarms(@Param("level") int level, + @Param("areaid") int areaid); + //endregion + + //region------------------------------------------------------------------------------------中间地图性能数据,所有景区的取取到缓存 + class class_get_maps_wireless_kpi_cells + { + public String get_maps_wireless_kpi_cells_SQL( + @Param("nettype") String nettype, + @Param("datatype") int datatype) + { + String sTable =""; + if (nettype.equals("4G") && (datatype==1)) //1分钟4G + sTable=" dp_2_kpi4g_min_statistics "; + else if (nettype.equals("5G") && (datatype==1)) //1分钟5G + sTable=" dp_2_kpi5g_min_statistics "; + else if (nettype.equals("4G") && (datatype==15)) //15分钟4G + sTable=" dp_2_kpi4g_cell_statistics "; + else if (nettype.equals("5G") && (datatype==15)) //15分钟5G + sTable=" dp_2_kpi5g_cell_statistics "; + //------------------------------------------------------ + String SQL=" select * from " +sTable+" where 景区id is not null order by 景区id "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_maps_wireless_kpi_cells.class,method = "get_maps_wireless_kpi_cells_SQL") + List get_maps_wireless_kpi_cells(@Param("nettype") String nettype, + @Param("datatype") int datatype); + //endregion + + //region------------------------------------------------------------------------------------中间地图告警弹出列表 + class class_get_maps_wireless_alarms_popup //场馆的 + { + public String get_maps_wireless_alarms_popup_SQL() + { + String SQL=" "; + /* + SQL =" select '无线' major , case when cell_name is null then site_name else cell_name end netname, " + + " alarmname alarmname,eventtime eventtime,故障处理人 handlepeople,场馆id sceneid from dp_2_view_wireless_alarm where 场馆id is not null "+ + " and to_char(eventtime,'YYYY-MM-DD')=to_char(now(),'YYYY-MM-DD') ";*/ + SQL =" select * from dp_2_maps_allalarms_list where batchid=(select max(batchid) from dp_2_maps_allalarms_list) " + + " and major='无线' "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_maps_wireless_alarms_popup.class,method = "get_maps_wireless_alarms_popup_SQL") + List get_maps_wireless_alarms_popup(); + //endregion + + //region --------------------------------------------------------------------------------------西湖十景TOP5 + + + class class_get_all_spot_top5 // 四个指标同时输出 + { + public String get_all_spot_top5_SQL( + @Param("spotid") int spotid, + @Param("kpiname") String kpiname, + @Param("typeid") int typeid, + @Param("mintype") int mintype) + { + String SQL=" "; + String nettype=" "; + String timetype=" "; + if (mintype == 1) { //1分钟 // 一分钟的数据需要OMC控制输出,为全量的。 + if (typeid == 1) //4G + { + nettype="4G"; + timetype="1min"; + } else //5G + { + nettype="5G"; + timetype="1min"; + } + } else //15分钟 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell_fordp) + { + nettype="4G"; + timetype="15min"; + } else //5G + { + nettype="5G"; + timetype="15min"; + } + } + String batchid = " (select min(batchid) from dp_2_kpi_spot_statistics) "; + SQL = " select row_number() over(order by kpicolor desc,kpivalue::numeric desc) title, " + + " cellname name, round(kpivalue::numeric, 2) value,kpicolor color from dp_2_kpi_spot_statistics "+ + " where batchid="+batchid+" and nettype='"+nettype+"' and timetype='"+timetype+"' and spotid=#{spotid} and kpiname=#{kpiname} " + + " order by kpicolor desc , kpivalue desc "; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_all_spot_top5.class,method = "get_all_spot_top5_SQL") + List get_all_spot_top5( + @Param("spotid") int spotid, + @Param("kpiname") String kpiname, + @Param("typeid") int typeid, + @Param("mintype") int mintype); + //endregion + + //region------------------------------------------------------------------------------------记录下降功率指令 + + class class_mml_info + { + public String insert_mml_info_SQL(@Param("cellname") String cellname, + @Param("prbup") float prbup, + @Param("prbdown") float prbdown, + @Param("maxuser") float maxuser, + @Param("zhscore") float zhscore, + @Param("avgdisturb") float avgdisturb, + @Param("batchno") int batchno, + @Param("sceneid") int sceneid, + @Param("stattime") String stattime, + @Param("seatid") String seatid, + @Param("nettype") String nettype) + { + String SQL=" select dp_2_insert_mml_info(#{cellname},#{prbup},#{prbdown},#{maxuser},#{zhscore}," + + " #{avgdisturb},#{batchno},#{sceneid},#{stattime},#{seatid},#{nettype})"; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_mml_info.class,method = "insert_mml_info_SQL") + String insert_mml_info(@Param("cellname") String cellname, + @Param("prbup") float prbup, + @Param("prbdown") float prbdown, + @Param("maxuser") float maxuser, + @Param("zhscore") float zhscore, + @Param("avgdisturb") float avgdisturb, + @Param("batchno") int batchno, + @Param("sceneid") int sceneid, + @Param("stattime") String stattime, + @Param("seatid") String seatid, + @Param("nettype") String nettype ); + //endregion + + //region------------------------------------------------------------------------------------获取基站小区信息 + class class_get_site_cell_info + { + public String get_get_site_cell_info_SQL() + { + String swhere=""; + String SQL=""; + SQL="select * from dp_2_site_cell_statistics "; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_site_cell_info.class,method = "get_get_site_cell_info_SQL") + List getsitecellinfo(); + //endregion + + //region------------------------------------------------------------------------------------高负荷小区TOP5 + class class_get_wireless_highload + { + public String get_get_wireless_highload_SQL( + @Param("typeid") int typeid) + { + String SQL=" "; + String stable=" "; + if (typeid == 1) + { + stable = "dp_2_wireless_highload_4g"; + } + else { + stable = "dp_2_wireless_highload_5g"; + } + SQL = " select * from "+stable + " where batchid= (select max(batchid) from "+stable+" ) "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_wireless_highload.class,method = "get_get_wireless_highload_SQL") + List get_wireless_highload(@Param("typeid") int typeid); + //endregion + + //region------------------------------------------------------------------------------------获取频段统计 + class class_get_freq_cnt + { + public String get_freq_cnt_SQL(@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype) + { + String SQL=" "; + String sTable=" "; + String swhere2=" "; + if ((level==1) || (level==2) ) //全域,区域显示一致 + { + if (mintype == 1) { //1 min + if (typeid == 1) //4g + { + sTable=" dp_2_view_freq_statistics_min_4g "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G + { + sTable=" dp_2_view_freq_statistics_min_5g "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } else //15分钟 + { + if (typeid == 1) //4G + { + sTable=" dp_2_view_freq_statistics_cell_4g "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } else //5G + { + sTable=" dp_2_view_freq_statistics_cell_5g "; + if ((areaid!=0) && (level==2)) swhere2=" and 景区id in (select 景区id from dp_2_spot_config where 景区大类id=#{areaid}) "; + } + } + } + else if (level==3) //场馆 + { + if (mintype == 1) { //1分钟 + if (typeid == 1) //4G + { + sTable=" dp_2_view_freq_statistics_min_4g "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + } else //5G + { + sTable=" dp_2_view_freq_statistics_min_5g "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + } + } else //15分钟 + { + if (typeid == 1) //4G + { + sTable=" dp_2_view_freq_statistics_cell_4g "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + + } else //5G + { + sTable=" dp_2_view_freq_statistics_cell_5g "; + if (sceneid!=0) swhere2=" and 场馆id=#{sceneid} "; + + } + } + } + SQL=" select 小区频段 , sum(cnt) cnt from "+sTable+" where 1=1 " + swhere2 +" group by 小区频段"; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_Wuxian_Mapper.class_get_freq_cnt.class,method = "get_freq_cnt_SQL") + List get_freq_cnt(@Param("level") int level, + @Param("areaid") int areaid, + @Param("sceneid") int sceneid, + @Param("typeid") int typeid, + @Param("mintype") int mintype); + //endregion + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_ZhuanWang_Mapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_ZhuanWang_Mapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d6c7f079f6836cd8f417cd936d7b7674c2a145bf --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_ZhuanWang_Mapper.java @@ -0,0 +1,358 @@ +package com.ruoyi.sunlm.mapper; + +import com.ruoyi.sunlm.daping.*; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.SelectProvider; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author yqf + * @date 2023/7/13 + */ +@Mapper +@Component +public interface dpNewYayun_ZhuanWang_Mapper { + + + + //region------------------------------------------------------------------------------------专网告警接口 + class class_get_net_alarms + { + /* + public String get_net_alarms_SQL(@Param("level") int level, + @Param("sceneid") int sceneid, + @Param("alarmtype") String alarmtype) + { + String SQL=" "; + if ((level==1) || (level==2)) //全域或城区的场馆的传输告警 + { + SQL = " select 告警时间 eventtime, " + + " 告警名称 alarmname, " + + " 场馆id ," + + " 区域id," + + " 网元名称 netname, " + + " 分公司 areaname, " + + " 告警类型 alarmtype, " + + " 告警等级 alarmlevel, " + + " 设备类型 devicetype, " + + " 是否端口告警 isportalarm from dp_2_view_trans_alarms " + + " where 恢复时间 is null " + + " and 告警类型 = #{alarmtype} order by 告警时间 desc"; + } + else if (level==3) { ////具体某个场馆的传输告警, 地图上的展示形式和本接口待定 + SQL = " select 告警时间 eventtime, " + + " 告警名称 alarmname, " + + " 场馆id ," + + " 区域id," + + " 网元名称 netname, " + + " 分公司 areaname, " + + " 告警类型 alarmtype, " + + " 告警等级 alarmlevel, " + + " 设备类型 devicetype, " + + " 是否端口告警 isportalarm from dp_2_view_trans_alarms " + + " and 场馆id = #{sceneid} and 告警类型 = #{alarmtype} order by 告警时间 desc limit 20"; + } + + return SQL; + } */ + + public String get_net_alarms_all_SQL() + { + /* + String SQL= " select 告警时间 eventtime, 告警名称 alarmname,恢复时间 recovertime,场馆id sceneid,场馆名称 scenename," + + " 网元名称 netname, 分公司 areaname,详细位置 detaillocation, 专业 alarmtype,网元属性 nettype, 端口类型 porttype, 对端网元 portnet, " + + " 对端网元端口 port, mark from dp_2_view_agis_alarms where 恢复时间 is null " + + " order by 告警时间 desc "; */ + //----------------------------------------------要求对告警5分钟内相同告警进行合并,20230916 sunlm + String SQL= " select 告警时间 eventtime, 告警名称 alarmname,场馆id sceneid,场馆名称 scenename," + + " 网元名称 netname, 分公司 areaname, 专业 alarmtype ,告警数量 alarmscount from dp_2_view_agis_alarms_combine " + + " order by 告警时间 desc "; + return SQL; + } + + public String get_map_alarms_all_SQL() + { + String SQL= "select 专业 major,告警时间 eventtime, 告警名称 alarmname, 网元名称 netname,场馆id sceneid,故障处理人 handlepeople,phonenumber from dp_2_view_agis_alarms " + + "where 恢复时间 is null order by 告警时间 desc "; + return SQL; + } + + public String get_code_alarms_all_SQL(){ + String SQL ="select 专业 major,告警时间 eventtime, 告警名称 alarmname, 网元名称 netname,场馆id sceneid,故障处理人 handlepeople,phonenumber,编码 code\n" + + "from dp_2_view_agis_alarms where 编码 is not null and 专业 in ('WIFI','AGIS') and 场馆id = 2"; + return SQL; + } + + } + + + /* + @SelectProvider(type = dpNewYayun_ZhuanWang_Mapper.class_get_net_alarms.class,method = "get_net_alarms_SQL") + List get_net_alarms_list(@Param("level") int level, + @Param("sceneid") int sceneid, + @Param("alarmtype") String alarmtype);*/ + + @SelectProvider(type = dpNewYayun_ZhuanWang_Mapper.class_get_net_alarms.class,method = "get_net_alarms_all_SQL") + List get_net_alarms_all_list(); + + @SelectProvider(type = dpNewYayun_ZhuanWang_Mapper.class_get_net_alarms.class,method = "get_map_alarms_all_SQL") + List get_map_alarms_all_list(); + + @Select("select stat_date,venueid,场馆名称 venuename,链路名称 linkname,链路属性 linkvalue,上行带宽利用率 ulbandratio," + + "下行带宽利用率 dlbandratio,上行链路利用率 ulavg24hratio,下行链路利用率 dlavg24hratio " + + "from dp_2_view_agis_link_5mi order by stat_date desc ") + List get_map_agis_link_all_list(); + + @Select("select stat_date,venueid,场馆名称,设备名称 devicename,设备类型 devicetype,cpu利用率 cpuratio,内存利用率 ramratio,编码 code " + + "from dp_2_view_agis_dev_15mi order by stat_date desc ") + List get_map_agis_dev_all_list(); + + + @Select("select 编码 code from dp_2_agis_config") + List get_code_all_list(); + + + @SelectProvider(type = dpNewYayun_ZhuanWang_Mapper.class_get_net_alarms.class,method = "get_code_alarms_all_SQL") + List get_code_alarms_all_list(); + + @Select("select stat_date,venueid,场馆名称 venuename,设备名称 devicename,设备类型 devicetype,cpu利用率 cpuratio," + + "内存利用率 ramratio,编码 code from dp_2_view_agis_dev_15mi where 编码 is not null") + List get_code_agis_dev_all_list(); + + //endregion + + + + //region------------------------------------------------------------------------------------中间地图告警显示接口 + class class_get_maps_all_net_alarms + { + public String get_maps_all_alarms_SQL() + { + + String SQL=" "; + String areanames= " ('上城','拱墅','西湖','滨江','萧山','余杭','临平','钱塘','富阳','临安','桐庐','淳安','建德') "; + SQL = " with t1 as \n" + + " ( select id venueid,'' venuetypeid,'' venuetype, " + + " case" + + " when length(COALESCE(maintain_type,''))=0 then venue_name " + + " else venue_name || '(' || maintain_type || ')' " + + " end venuename, " + + " longitude_dp longitude,latitude_dp latitude," + + " b.dict_label areaname from yw_scene a , sys_dict_data b where scene_big_id in " + + " (select id from yw_scene_big_config where status='2') and longitude<>0 and a.area_county_id=b.dict_value " + + " and a.venue_type ='比赛场馆' " + + " and b.dict_type= 'yw_county' and id not in (10000,10500,20000,20100,20300,20400,20200) and b.dict_label in " + areanames + " )," + + " t2 as \n" + + " ( select 场馆id,count(*) alarmcount from dp_2_view_agis_alarms group by 场馆id ) , \n" + + " t3 as \n" + + " ( select 场馆id,count(*) agiscount from dp_2_view_agis_alarms where 专业 = 'AGIS' group by 场馆id ) ,\n" + + " t4 as \n" + + " ( select 场馆id,count(*) wificount from dp_2_view_agis_alarms where 专业 = 'WIFI' group by 场馆id ) ,\n" + + " t5 as \n" + + " ( select 场馆id,count(*) voipcount from dp_2_view_agis_alarms where 专业 = 'VOIP' group by 场馆id ) \n" + + " select t1.*,COALESCE(t2.alarmcount,0) alarmcount,COALESCE(t3.agiscount,0) agiscount,COALESCE(t4.wificount,0) wificount," + + "COALESCE(t5.voipcount,0) voipcount\n" + + " from t1 \n" + + " left join t2 on t1.venueid=t2.场馆id\n" + + " left join t3 on t1.venueid=t3.场馆id\n" + + " left join t4 on t1.venueid=t4.场馆id\n" + + " left join t5 on t1.venueid=t5.场馆id "; + return SQL; + } + } + @SelectProvider(type = dpNewYayun_ZhuanWang_Mapper.class_get_maps_all_net_alarms.class,method = "get_maps_all_alarms_SQL") + List get_maps_all_alarms(); + //endregion + + //region --------------------------------------------------------------------------------------AGIS交换机TOP5 + class class_get_agis_switch + { + public String get_get_agis_switch_SQL( + @Param("level") int level, + @Param("typeid") int typeid, + @Param("sceneid") int sceneid) + { + String SQL=" "; + String sTable=" "; + String sKpi="" ; + String swhere = " "; + if ((level==1) || (level==2) ) //全域,区域显示一致 + { + if (typeid==1) { //cpu + sTable=" dp_2_view_agis_dev_15mi "; + sKpi=" cpu利用率 "; + swhere=" "; + } + else //ram + { + sTable=" dp_2_view_agis_dev_15mi "; + sKpi=" 内存利用率 "; + swhere=" "; + } + } + else if (level==3) //场馆 + { + if (typeid==1) { //cpu + sTable=" dp_2_view_agis_dev_15mi "; + sKpi=" cpu利用率 "; + swhere=" where venueid=#{sceneid} "; + } + else + { + sTable=" dp_2_view_agis_dev_15mi "; + sKpi=" 内存利用率 "; + swhere=" where venueid=#{sceneid} "; + } + } + + SQL = " select row_number() over(order by "+sKpi+" desc) title,设备名称 || '[' || substring(设备类型,1,2) || ']' name,round("+sKpi+"::numeric, 2) value, " + + " '' color from "+sTable + swhere+ + " order by "+sKpi+" desc limit 5"; + + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_ZhuanWang_Mapper.class_get_agis_switch.class,method = "get_get_agis_switch_SQL") + List get_agis_switch( + @Param("level") int level, + @Param("typeid") int typeid, + @Param("sceneid") int sceneid); + //endregion + + //region --------------------------------------------------------------------------------------AGIS带宽利用率TOP5 + class class_get_agis_bandwidth + { + public String get_get_agis_bandwidth_SQL( + @Param("level") int level, + @Param("typeid") int typeid, + @Param("sceneid") int sceneid) + { + String SQL=" "; + String sTable=" "; + String sKpi="" ; + String swhere = " "; + if ((level==1) || (level==2) ) //全域,区域显示一致 + { + if (typeid==1) { //cpu + sTable=" dp_2_view_agis_link_5mi "; + sKpi=" 上行带宽利用率 "; + swhere=" "; + } + else //ram + { + sTable=" dp_2_view_agis_link_5mi "; + sKpi=" 下行带宽利用率 "; + swhere=" "; + } + } + else if (level==3) //场馆 + { + if (typeid==1) { //cpu + sTable=" dp_2_view_agis_link_5mi "; + sKpi=" 上行带宽利用率 "; + swhere=" where venueid=#{sceneid} "; + } + else + { + sTable=" dp_2_view_agis_link_5mi "; + sKpi=" 下行带宽利用率 "; + swhere=" where venueid=#{sceneid} "; + } + } + + SQL = " select row_number() over(order by "+sKpi+" desc) title,链路名称 name,round("+sKpi+"::numeric, 2) value, " + + " '' color from "+sTable + swhere+ + " order by "+sKpi+" desc limit 5"; + + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_ZhuanWang_Mapper.class_get_agis_bandwidth.class,method = "get_get_agis_bandwidth_SQL") + List get_agis_bandwidth( + @Param("level") int level, + @Param("typeid") int typeid, + @Param("sceneid") int sceneid); + //endregion + + //region --------------------------------------------------------------------------------------AGIS带宽利用率TOP5 + class class_get_agis_link + { + public String get_get_agis_link_SQL( + @Param("level") int level, + @Param("typeid") int typeid, + @Param("sceneid") int sceneid) + { + String SQL=" "; + String sTable=" "; + String sKpi="" ; + String swhere = " "; + if ((level==1) || (level==2) ) //全域,区域显示一致 + { + if (typeid==1) { //cpu + sTable=" dp_2_view_agis_link_5mi "; + sKpi=" 上行链路利用率 "; + swhere=" "; + } + else //ram + { + sTable=" dp_2_view_agis_link_5mi "; + sKpi=" 下行链路利用率 "; + swhere=" "; + } + } + else if (level==3) //场馆 + { + if (typeid==1) { //cpu + sTable=" dp_2_view_agis_link_5mi "; + sKpi=" 上行链路利用率 "; + swhere=" where venueid=#{sceneid} "; + } + else + { + sTable=" dp_2_view_agis_link_5mi "; + sKpi=" 下行链路利用率 "; + swhere=" where venueid=#{sceneid} "; + } + } + + SQL = " select row_number() over(order by "+sKpi+" desc) title,链路名称 name,round("+sKpi+"::numeric, 2) value, " + + " '' color from "+sTable + swhere+ + " order by "+sKpi+" desc limit 5"; + + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_ZhuanWang_Mapper.class_get_agis_link.class,method = "get_get_agis_link_SQL") + List get_agis_link( + @Param("level") int level, + @Param("typeid") int typeid, + @Param("sceneid") int sceneid); + //endregion + + //region --------------------------------------------------------------------------------------互联网用户数TOP5 + class class_get_internet_usercount + { + public String get_get_internet_usercount_SQL( + @Param("level") int level) + { + String SQL = " select row_number() over(order by 在线用户数 desc) title ,场馆名称 name,round(在线用户数::numeric, 2) value, " + + " '' color from dp_2_view_ph_net_venue_5mi " + + " order by 在线用户数 desc limit 5"; + + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_ZhuanWang_Mapper.class_get_internet_usercount.class,method = "get_get_internet_usercount_SQL") + List get_internet_usercount( + @Param("level") int level); + //endregion + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_ZongHe_Mapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_ZongHe_Mapper.java new file mode 100644 index 0000000000000000000000000000000000000000..65a626ac7a716a54c3af026a0eee256a4cea7a35 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpNewYayun_ZongHe_Mapper.java @@ -0,0 +1,79 @@ +package com.ruoyi.sunlm.mapper; + +import com.ruoyi.eastcom_yw.domain.dto.YwInspectStatDTO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogStaticVo; +import com.ruoyi.sunlm.daping.class_dp_3_maps_alarms; +import com.ruoyi.sunlm.daping.class_dp_3_net_alarm; +import com.ruoyi.sunlm.daping.class_dp_5_scenecontacts; +import com.ruoyi.sunlm.daping.class_dp_5_scenesta; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.SelectProvider; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author yqf + * @date 2023/7/14 + */ +@Mapper +@Component +public interface dpNewYayun_ZongHe_Mapper { + + class class_get_statistics + { + public String get_scene_sta_SQL(){ + String addSql = "(select id FROM yw_scene where venue_type='比赛场馆' and match_type is not null and area_county_id like '0571%')"; + + return "with t1 as (select count(*) wxuser FROM sys_user a join yw_scene_user b on a.user_id = b.user_id where a.user_type = 'wx' and b.scene_id in " + addSql + " ),\n" + + " t2 as (select count(*) csuser FROM sys_user a join yw_scene_user b on a.user_id = b.user_id where a.user_type = 'cs' and b.scene_id in " + addSql + " ),\n" + + " t3 as (select count(*) zwuser FROM sys_user a join yw_scene_user b on a.user_id = b.user_id where a.user_type = 'zw' and b.scene_id in " + addSql + " ),\n" + + " t4 as (select count(*) dhuser FROM sys_user a join yw_scene_user b on a.user_id = b.user_id where a.user_type = 'dh' and b.scene_id in " + addSql + " ),\n" + + " t5 as (select count(*) gluser FROM sys_user a join yw_scene_user b on a.user_id = b.user_id where a.user_type = 'gl' and b.scene_id in " + addSql + " ),\n" + + " t6 as (select count(*) bxuser FROM sys_user a join yw_scene_user b on a.user_id = b.user_id where a.user_type = 'bx' and b.scene_id in " + addSql + " ),\n" + + " t7 as (select emergency_warehouse emergencywarehouse,emergency_communication_car emergencycommunicationcar,emergency_electric_car emergencyelectriccar," + + "emergency_repair_car emergencyrepaircar ,wifi_spare wifispare,dredge_spare dredgespare,trans_spare transspare from yw_scene_noticeinfo where id = 1)\n" + + "select wxuser,csuser,zwuser,dhuser,gluser,bxuser,emergencywarehouse,emergencycommunicationcar,emergencyelectriccar,emergencyrepaircar,wifispare,dredgespare,transspare" + + " from t1,t2,t3,t4,t5,t6,t7"; + + } + public String get_scene_contacts_SQL(){ + return "select a.user_id userid,a.user_name username,a.nick_name nickname,phonenumber,e.venue_name venuename\n" + + "from sys_user a \n" + + "join sys_user_role b on a.user_id = b.user_id\n" + + "join sys_role c on b.role_id = c.role_id\n" + + "join yw_scene_user d on a.user_id = d.user_id\n" + + "join yw_scene e on d.scene_id = e.id\n" + + "where c.role_name = '场馆经理' and e.venue_type='比赛场馆' and e.match_type is not null and e.area_county_id like '0571%' "; + + } + + public String get_sign_top5_SQL(){ + String SQL = " select venueid sceneId,venuename venueName,sign_rate finishRate,sign_rate||'%' strFinishRate " + + " from dp_2_maps_allalarms_statistics " + + " where batchid=(select max(batchid) from dp_2_maps_allalarms_statistics) and sign_rate<200 "+ + " ORDER BY sign_rate limit 5"; + return SQL; + } + public String get_inspect_top5_SQL(){ + String SQL = "select venueid sceneId,venuename venueName,inspect_rate rate,inspect_rate||'%' rateStr " + + " from dp_2_maps_allalarms_statistics " + + " where batchid=(select max(batchid) from dp_2_maps_allalarms_statistics) and inspect_rate<200 "+ + " ORDER BY inspect_rate limit 5"; + return SQL; + } + } + + @SelectProvider(type = dpNewYayun_ZongHe_Mapper.class_get_statistics.class,method = "get_scene_sta_SQL") + class_dp_5_scenesta get_scene_sta(); + + @SelectProvider(type = dpNewYayun_ZongHe_Mapper.class_get_statistics.class,method = "get_scene_contacts_SQL") + List get_scene_contacts_list(); + + @SelectProvider(type = dpNewYayun_ZongHe_Mapper.class_get_statistics.class,method = "get_sign_top5_SQL") + List get_sign_top5(); + + @SelectProvider(type = dpNewYayun_ZongHe_Mapper.class_get_statistics.class,method = "get_inspect_top5_SQL") + List get_inspect_top5(); +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpYayunMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpYayunMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..c36229794ee8e4ce55f7223b48c408fbbdaa2217 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpYayunMapper.java @@ -0,0 +1,1089 @@ +package com.ruoyi.sunlm.mapper; + +import java.util.List; +import com.ruoyi.sunlm.domain.*; +import org.apache.ibatis.annotations.*; +import org.springframework.stereotype.Component; + +/** + * 参数配置 数据层 + * + * @author ruoyi + */ +@Mapper +@Component +public interface dpYayunMapper +{ + @Select("select runtype from dp_scene_runtype") //1:正式, 0:演示 + int getruntype(); + + //region------------------------------------------------------------------------------------调用存储过程测试 + @Select("select getkpivalue(300,98,99,-115,'4G','FDD-1800','',20)") + String calldbfunction(); + //endregion + + //region------------------------------------------------------------------------------------获取场馆列表 + @Select("select id venueId,venue_name venueName from yw_scene where scene_big_id in (select id from yw_scene_big_config where status='2') order by id") + List getvenuelists(); + //endregion + + //region --------------------------------------------------------------------------------------------左侧列表1 + class class_get_left_1_data // 区域用户数,15分钟,X轴0-24点,15分钟一个间隔,昨日今日对比 + { + public String get_left_1_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("jobtype") String jobtype) + { + String SQL=" "; + if (typeid==1) //4G //(select max(结束时间) from pm_kpi4g_venue) + { + String sTime=" (select max(结束时间) from pm_kpi4g_venue where 场馆id=#{sceneid}) +'-10 min' "; //TEST + if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) "; + /* + SQL=" select distinct * from ((select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi4g_venue where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+",'yyyy-mm-dd') order by 结束时间)"+ + " union all " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi4g_venue where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') order by 结束时间)) a"; */ + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi4g_venue where 场馆id =#{sceneid}), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi4g_venue where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd')" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi4g_venue where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + + } + else //5G //(select max(结束时间) from pm_kpi5g_venue) + { + String sTime=" (select max(结束时间) from pm_kpi5g_venue where 场馆id =#{sceneid}) +'-10 min' "; + if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) "; + /* + SQL=" select distinct * from ((select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi5g_venue where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+",'yyyy-mm-dd') order by 结束时间)"+ + " union all " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi5g_venue where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') order by 结束时间)) a"; */ + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi5g_venue where 场馆id =#{sceneid}), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi5g_venue where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd')" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi5g_venue where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + return SQL; + } + } + @SelectProvider(type = class_get_left_1_data.class,method = "get_left_1_data_SQL") + List get_left_1_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------左侧列表2 + class class_get_left_2_data // 区域流量,15分钟,,X轴0-24点,15分钟一个间隔,昨日今日对比 + { + public String get_left_2_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("jobtype") String jobtype) + { + String SQL=" "; + if (typeid==1) //4G//(select max(结束时间) from pm_kpi4g_venue) + { + String sTime=" (select max(结束时间) from pm_kpi4g_venue where 场馆id=#{sceneid}) +'-10 min' "; + if (jobtype.equals("WORK")) sTime= " LOCALTIMESTAMP(0) "; + /* + SQL="select distinct * from ((select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi4g_venue where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+",'yyyy-mm-dd') order by 结束时间)"+ + " union all " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi4g_venue where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') order by 结束时间)) a"; */ + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi4g_venue where 场馆id =#{sceneid}), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi4g_venue where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd')" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi4g_venue where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + else //5G /(select max(结束时间) from pm_kpi4g_venue) + { + String sTime=" (select max(结束时间) from pm_kpi5g_venue where 场馆id=#{sceneid}) +'-10 min' "; + if (jobtype.equals("WORK")) sTime= " LOCALTIMESTAMP(0) "; + /* + SQL=" select distinct * from ((select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi5g_venue where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+",'yyyy-mm-dd') order by 结束时间)"+ + " union all " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi5g_venue where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') order by 结束时间)) a ";*/ + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), (select max(结束时间) from pm_kpi5g_venue where 场馆id =#{sceneid}), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi5g_venue where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd')" + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi5g_venue where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + return SQL; + } + } + + @SelectProvider(type = class_get_left_2_data.class,method = "get_left_2_data_SQL") + List get_left_2_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------左侧TOP5 + @Select("select mintype from dp_scene_control") + int getmincontroltype(); + + class class_get_left_3_data // 最大用户数TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_left_3_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype) + { + String SQL=" "; + if (mintype==1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + //String sTime=" (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' " ; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi4g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 and max_user is not null order by max_user desc) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) + '-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + // sTime=" (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by level ) title,name,value,color,level from (" + + " select row_number() over(order by max_user desc) title,t.小区名称 name,round(max_user::numeric,2) value," + + " getkpicolor('最大用户数', max_user,'4G',t2.小区频段,t2.设备类型,t2.带宽) color, " + + " getkpilevel('最大用户数', max_user,'4G',t2.小区频段,t2.设备类型,t2.带宽) level " + + //" from pm_kpi4g_min t" + " from "+sTable+" t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 " + + " where max_user is not null " + + //" and 时间>="+sTime+ + " and t2.场馆id=" +sceneid+swhere+ + " order by level asc,t.max_user desc limit 5) a "; + } + else //5G //(select max(时间) from pm_kpi5g_min) + { + //String sTime=" (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' " ; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi5g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 and rrc_max_user is not null order by rrc_max_user desc) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) + '-3 min' " ; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + // sTime=" (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by level ) title,name,value,color,level from (" + + " select row_number() over(order by rrc_max_user desc) title,t.小区名称 name,round(rrc_max_user::numeric,2) value," + + " getkpicolor('最大用户数', rrc_max_user,'5G',t2.小区频段,t2.设备类型,t2.带宽) color ," + + " getkpilevel('最大用户数', rrc_max_user,'5G',t2.小区频段,t2.设备类型,t2.带宽) level " + + //" from pm_kpi5g_min t " + + " from "+sTable+" t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 where rrc_max_user is not null " + + //" and 时间>="+sTime+ + " and t2.场馆id=" +sceneid+swhere + + " order by level asc,t.rrc_max_user desc limit 5 ) a "; + } + } + else //15分钟 + { + if (typeid == 1) //4G//(select max(endtime) from pm_kpi4g_cell) + { + String sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id=#{sceneid}) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-60 min' "; + //if (jobtype.equals("WORK")) sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_cell' ) " ; + if (jobtype.equals("WORK")) sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id = #{sceneid}) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by level ) title,name,value,color,level from (" + + " select row_number() over(order by 最大用户数 desc) title,t.小区名称 name,最大用户数 value," + + " getkpicolor('最大用户数', 最大用户数,'4G',t2.小区频段,t2.设备类型,t2.带宽) color, " + + " getkpilevel('最大用户数', 最大用户数,'4G',t2.小区频段,t2.设备类型,t2.带宽) level " + + " from pm_kpi4g_cell t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 最大用户数 is not null " + + " and endtime>="+sTime+" and venue_id="+sceneid +swhere + + " order by level asc,t.最大用户数 desc limit 5) a "; + } + else //5G //(select max(endtime) from pm_kpi5g_cell) + { + String sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id =#{sceneid}) +'-10 min' " ; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-60 min' "; + //if (jobtype.equals("WORK")) sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_cell') " ; + if (jobtype.equals("WORK")) sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id = #{sceneid}) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by level ) title,name,value,color,level from (" + + " select row_number() over(order by 最大用户数 desc) title,t.小区名称 name,最大用户数 value," + + " getkpicolor('最大用户数', 最大用户数,'5G',t2.小区频段,t2.设备类型,t2.带宽) color ," + + " getkpilevel('最大用户数', 最大用户数,'5G',t2.小区频段,t2.设备类型,t2.带宽) level " + + " from pm_kpi5g_cell t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 最大用户数 is not null " + + " and endtime>="+sTime+" and venue_id="+sceneid +swhere+ + " order by level asc ,t.最大用户数 desc limit 5) a "; + } + } + return SQL; + } + } + + @SelectProvider(type = class_get_left_3_data.class,method = "get_left_3_data_SQL") + List get_left_3_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------右侧TOP5图表1 + class class_get_right_1_data // 上行Prb利用率TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_right_1_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype) + { + String SQL=" "; + if (mintype==1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + //String sTime=" (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi4g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 and prb_up is not null order by prb_up desc) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + // sTime=" (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by prb_up desc) title,t.小区名称 name,round(prb_up::numeric, 2) value," + + " getkpicolor('上行Prb利用率', prb_up,'4G',t2.小区频段,t2.设备类型,t2.带宽) color " + + //" from pm_kpi4g_min t " + + " from "+sTable+" t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 where prb_up is not null " + + //" and 时间>="+sTime + + " and t2.场馆id=" +sceneid+swhere+ + " order by t.prb_up desc limit 5 "; + } + else //5G //(select max(时间) from pm_kpi5g_min) + { + //String sTime=" (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi5g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 and prb_up is not null order by prb_up desc) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + // sTime=" (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by prb_up desc) title,t.小区名称 name,round(prb_up::numeric, 2) value," + + " getkpicolor('上行Prb利用率', prb_up,'5G',t2.小区频段,t2.设备类型,t2.带宽) color " + + //" from pm_kpi5g_min t " + + " from "+sTable+" t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 where prb_up is not null " + + //" and 时间>="+sTime + + " and t2.场馆id=" +sceneid+swhere+ + " order by t.prb_up desc limit 5 "; + } + } + else //15分钟 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell) + { + String sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id=#{sceneid}) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-60 min' "; + //if (jobtype.equals("WORK")) sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_cell') " ; + if (jobtype.equals("WORK")) sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id = #{sceneid}) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 上行Prb利用率 desc) title,t.小区名称 name,上行Prb利用率 value," + + " getkpicolor('上行Prb利用率', 上行Prb利用率,'4G','','',20) color from pm_kpi4g_cell t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 上行Prb利用率 is not null " + + " and endtime>="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.上行Prb利用率 desc limit 5 "; + } + else //5G //(select max(endtime) from pm_kpi5g_cell) + { + String sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id =#{sceneid}) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-60 min' "; + //if (jobtype.equals("WORK")) sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_cell') " ; + if (jobtype.equals("WORK")) sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id = #{sceneid}) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 上行Prb利用率 desc) title,t.小区名称 name,上行Prb利用率 value ," + + " getkpicolor('上行Prb利用率', 上行Prb利用率,'5G','','',20) color from pm_kpi5g_cell t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 上行Prb利用率 is not null " + + " and endtime>="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.上行Prb利用率 desc limit 5 "; + } + } + return SQL; + } + } + + @SelectProvider(type = class_get_right_1_data.class,method = "get_right_1_data_SQL") + List get_right_1_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------右侧TOP5图表2 + class class_get_right_2_data // 下行Prb利用率TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_right_2_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype) + { + String SQL=" "; + if (mintype==1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + //String sTime=" (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi4g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 and prb_down is not null order by prb_down desc) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) + '-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + // sTime=" (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by prb_down desc) title,t.小区名称 name,round(prb_down::numeric, 2) value," + + " getkpicolor('下行Prb利用率', prb_down,'4G',t2.小区频段,t2.设备类型,t2.带宽) color " + + //" from pm_kpi4g_min t " + + " from "+sTable+" t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 where prb_down is not null " + + //" and 时间>="+sTime + + " and t2.场馆id=" +sceneid+swhere+ + " order by t.prb_down desc limit 5 "; + } + else //5G //(select max(时间) from pm_kpi5g_min) + { + //String sTime= " (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi5g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 and prb_down is not null order by prb_down desc) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) + '-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + // sTime=" (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by prb_down desc) title,t.小区名称 name,round(prb_down::numeric, 2) value," + + " getkpicolor('下行Prb利用率', prb_down,'5G',t2.小区频段,t2.设备类型,t2.带宽) color " + + //" from pm_kpi5g_min t " + + " from "+sTable+" t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 where prb_down is not null " + + //" and 时间>="+sTime+ + " and t2.场馆id=" +sceneid+swhere+ + " order by t.prb_down desc limit 5 "; + } + } + else //15分钟 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell) + { + String sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id=#{sceneid}) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-60 min' "; + //if (jobtype.equals("WORK")) sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_cell' ) " ; + if (jobtype.equals("WORK")) sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id = #{sceneid}) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 下行Prb利用率 desc) title,t.小区名称 name,下行Prb利用率 value," + + " getkpicolor('下行Prb利用率', 下行Prb利用率,'4G','','',20) color from pm_kpi4g_cell t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 下行Prb利用率 is not null " + + " and endtime>="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.下行Prb利用率 desc limit 5 "; + } + else //5G //(select max(endtime) from pm_kpi5g_cell) + { + String sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id=#{sceneid}) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-60 min' "; + //if (jobtype.equals("WORK")) sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_cell' ) " ; + if (jobtype.equals("WORK")) sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id = #{sceneid}) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 下行Prb利用率 desc) title,t.小区名称 name,下行Prb利用率 value," + + " getkpicolor('下行Prb利用率', 下行Prb利用率,'5G','','',20) color from pm_kpi5g_cell t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 下行Prb利用率 is not null " + + " and endtime>="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.下行Prb利用率 desc limit 5 "; + } + } + return SQL; + } + } + + @SelectProvider(type = class_get_right_2_data.class,method = "get_right_2_data_SQL") + List get_right_2_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------右侧TOP5图表3 + class class_get_right_3_data // 最大干扰值TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_right_3_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype) + { + String SQL=" "; + if (mintype==1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + //String sTime=" (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi4g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 and avg_disturb is not null order by avg_disturb desc) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) + '-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + // sTime=" (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by avg_disturb desc) title,t.小区名称 name,round(avg_disturb::numeric, 2) value," + + " getkpicolor('平均干扰值', avg_disturb,'4G',t2.小区频段,t2.设备类型,t2.带宽) color " + + //" from pm_kpi4g_min t " + + " from "+sTable+" t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 where avg_disturb is not null " + + //" and 时间>="+sTime + + " and t2.场馆id=" +sceneid+swhere+ + " order by t.avg_disturb desc limit 5 "; + } + else //5G //(select max(时间) from pm_kpi5g_min) + { + //String sTime=" (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi5g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 and up_disturb is not null order by up_disturb desc) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) + '-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + // sTime=" (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by up_disturb desc) title,t.小区名称 name,round(up_disturb::numeric, 2) value," + + " getkpicolor('平均干扰值', up_disturb,'5G',t2.小区频段,t2.设备类型,t2.带宽) color " + + //" from pm_kpi5g_min t " + + " from "+sTable+" t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 where up_disturb is not null " + + //" and 时间>="+sTime + + " and t2.场馆id=" +sceneid+swhere+ + " order by t.up_disturb desc limit 5 "; + } + } + else //15分钟 + { + if (typeid == 1) //4G //(select max(endtime) from pm_kpi4g_cell) + { + String sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id =#{sceneid}) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-60 min' "; + //if (jobtype.equals("WORK")) sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_cell' ) " ; + if (jobtype.equals("WORK")) sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id = #{sceneid}) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 上行平均干扰 desc) title,t.小区名称 name,上行平均干扰 value," + + " getkpicolor('平均干扰值', 上行平均干扰,'4G','','',20) color from pm_kpi4g_cell t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 上行平均干扰 is not null " + + " and endtime>="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.上行平均干扰 desc limit 5 "; + } + else //5G //(select max(endtime) from pm_kpi5g_cell) + { + String sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id=#{sceneid}) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-60 min' "; + //if (jobtype.equals("WORK")) sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_cell' ) " ; + if (jobtype.equals("WORK")) sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id = #{sceneid}) " ; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 上行干扰值 desc) title,t.小区名称 name,上行干扰值 value," + + " getkpicolor('平均干扰值', 上行干扰值,'5G','','',20) color from pm_kpi5g_cell t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 上行干扰值 is not null " + + " and endtime>="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.上行干扰值 desc limit 5 "; + } + } + return SQL; + } + } + + @SelectProvider(type = class_get_right_3_data.class,method = "get_right_3_data_SQL") + List get_right_3_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype); + //endregion + + //region -------------------------------------------------------------------------------------------地图, 用新接口替换 + class class_get_maps_data + { + public String get_maps_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid) + { + String SQL=" select venue_name name," + + " cast(wgs84togcj02(longitude::numeric,latitude::numeric,'lng') as VARCHAR)||','||" + + " cast(wgs84togcj02(longitude::numeric,latitude::numeric,'lat') as VARCHAR) center" + + " from yw_scene where id= "+sceneid; + return SQL; + } + + public String get_bts_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid, + @Param("kpiname") String kpiname,@Param("mintype") int mintype,@Param("jobtype") String jobtype) + { + StringBuilder SQL = new StringBuilder(); + if (mintype==1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + //String sTime = " (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi4g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 ) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + // sTime = " (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) "; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.max_user,b.prb_up,b.prb_down,b.avg_disturb,'4G',小区频段,设备类型,带宽) algoValue," + + " b.max_user avgUsrValue," + + " b.prb_up uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.prb_down downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.max_user,b.prb_up,b.prb_down,b.avg_disturb,'4G',小区频段,设备类型,带宽)) ,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.max_user,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.prb_up,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.prb_down,'4G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a" + + //" left join pm_kpi4g_min b " + + " left join "+sTable+" b " + + " on a.小区名称=b.小区名称 " + + //" and b.时间>=" + sTime + + " where 网络='LTE' and 场馆id=" + sceneid + " order by level desc"); + } + else if (typeid == 2) //5G ////(select max(时间) from pm_kpi5g_min) + { + //String sTime = " (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi5g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 ) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + // sTime = " (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) "; + SQL.append(" select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.rrc_max_user,b.prb_up,b.prb_down,b.up_disturb,'5G',小区频段,设备类型,带宽) algoValue," + + " b.rrc_max_user avgUsrValue," + + " b.prb_up uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.prb_down downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.rrc_max_user,b.prb_up,b.prb_down,b.up_disturb,'5G',小区频段,设备类型,带宽)),'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.rrc_max_user,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.prb_up,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.prb_down,'5G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a " + + //" left join pm_kpi5g_min b " + + " left join "+sTable+" b " + + " on a.小区名称=b.小区名称 " + + //" and b.时间>=" + sTime + + " where 网络='NR' and 场馆id=" + sceneid + " order by level desc"); + } + } + else //15分钟 + { + if (typeid == 1) //4G + { + String sTime = " (select max(endtime) from pm_kpi4g_cell where venue_id in (select distinct 场馆id from dp_scene_cell)) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id = #{sceneid}) " ; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.上行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽)) ,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a" + + " left join pm_kpi4g_cell b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime>=" + sTime + + " where 网络='LTE' and 场馆id=" + sceneid + " order by level desc"); + } + else if (typeid == 2) //5G + { + String sTime = " (select max(endtime) from pm_kpi5g_cell where venue_id in (select distinct 场馆id from dp_scene_cell)) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id = #{sceneid}) " ; + SQL.append("select a.ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽)),'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a " + + " left join pm_kpi5g_cell b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime>=" + sTime + + " where 网络='NR' and 场馆id=" + sceneid + " order by level desc"); + } + } + return SQL.toString(); + } + } + + @SelectProvider(type = class_get_maps_data.class,method = "get_maps_SQL") + class_dp_maps get_maps_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid); + + @SelectProvider(type = class_get_maps_data.class,method = "get_bts_SQL") + List get_bts_data(@Param("sceneid") int sceneid, @Param("typeid") int typeid, @Param("kpiname") String kpiname, + @Param("mintype") int mintype,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------顶部统计值,用新接口替换 + class class_get_top_data + { + public String get_top_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("kpiname") String kpiname, + @Param("mintype") int mintype,@Param("jobtype") String jobtype) + { + StringBuilder SQL = new StringBuilder(); + if (mintype==1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + //String sTime = " (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi4g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 ) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + // sTime = " (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) "; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.max_user,b.prb_up,b.prb_down,b.avg_disturb,'4G',小区频段,设备类型,带宽) algoValue," + //综合算法 + " b.max_user avgUsrValue," + + " b.prb_up uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.prb_down downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.max_user,b.prb_up,b.prb_down,b.avg_disturb,'4G',小区频段,设备类型,带宽)),'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.max_user,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.prb_up,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.prb_down,'4G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a" + + //" left join pm_kpi4g_min b " + + " left join "+sTable+" b " + + " on a.小区名称=b.小区名称 " + + //" and b.时间>=" + sTime + + " where 网络='LTE' and 场馆id=" + sceneid + " order by level desc"); + } + else if (typeid == 2) //5G ////(select max(时间) from pm_kpi5g_min) + { + //String sTime = " (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi5g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 ) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + // sTime = " (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) "; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.rrc_max_user,b.prb_up,b.prb_down,b.up_disturb,'5G',小区频段,设备类型,带宽) algoValue," + + " b.rrc_max_user avgUsrValue," + + " b.prb_up uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.prb_down downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.rrc_max_user,b.prb_up,b.prb_down,b.up_disturb,'5G',小区频段,设备类型,带宽)),'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.rrc_max_user,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.prb_up,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.prb_down,'5G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a " + + //" left join pm_kpi5g_min b " + + " left join "+sTable+" b " + + " on a.小区名称=b.小区名称 " + + //" and b.时间>=" + sTime + + " where 网络='NR' and 场馆id=" + sceneid + " order by level desc"); + } + } + else //15分钟 + { + if (typeid == 1) //4G + { + String sTime = " (select max(endtime) from pm_kpi4g_cell where venue_id in (select distinct 场馆id from dp_scene_cell)) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id = #{sceneid}) " ; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽)) ,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a" + + " left join pm_kpi4g_cell b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime>=" + sTime + + " where 网络='LTE' and 场馆id=" + sceneid + " order by level desc"); + } + else if (typeid == 2) //5G + { + String sTime = " (select max(endtime) from pm_kpi5g_cell where venue_id in (select distinct 场馆id from dp_scene_cell)) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id = #{sceneid}) " ; + SQL.append("select a.ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽)),'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a " + + " left join pm_kpi5g_cell b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime>=" + sTime + + " where 网络='NR' and 场馆id=" + sceneid + " order by level desc"); + } + } + return SQL.toString(); + } + } + + @SelectProvider(type = class_get_top_data.class,method = "get_top_data_SQL") + List get_top_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("kpiname") String kpiname, + @Param("mintype") int mintype,@Param("jobtype") String jobtype); + //endregion + + //region -------------------------------------------------------------------------------------------地图和统计值统一接口 + class class_get_maps_top_data + { + public String get_maps_top_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid) + { + String SQL=" select venue_name name," + + " cast(wgs84togcj02(longitude::numeric,latitude::numeric,'lng') as VARCHAR)||','||" + + " cast(wgs84togcj02(longitude::numeric,latitude::numeric,'lat') as VARCHAR) center" + + " from yw_scene where id= "+sceneid; + return SQL; + } + + public String get_bts_1to2_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid, + @Param("kpiname") String kpiname,@Param("mintype") int mintype,@Param("jobtype") String jobtype) + { + StringBuilder SQL = new StringBuilder(); + if (mintype==1) { //1分钟 + if (typeid == 1) //4G //(select max(时间) from pm_kpi4g_min) + { + //String sTime = " (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi4g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 ) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + // sTime = " (select max(时间) from pm_kpi4g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) "; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.max_user,b.prb_up,b.prb_down,b.avg_disturb,'4G',小区频段,设备类型,带宽) algoValue," + + " b.max_user avgUsrValue," + + " b.prb_up uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.prb_down downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.max_user,b.prb_up,b.prb_down,b.avg_disturb,'4G',小区频段,设备类型,带宽)) ,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.max_user,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.prb_up,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.prb_down,'4G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a" + + //" left join pm_kpi4g_min b " + + " left join "+sTable+" b " + + " on a.小区名称=b.小区名称 " + + //" and b.时间>=" + sTime + + " where 网络='LTE' and 场馆id=" + sceneid + " order by level desc"); + } + else if (typeid == 2) //5G ////(select max(时间) from pm_kpi5g_min) + { + //String sTime = " (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell)) +'-10 min' "; + String sTable=" (SELECT * " + + " FROM ( SELECT *, " + + " row_number() OVER (PARTITION BY t.小区名称) AS group_idx " + + " FROM ( SELECT * from pm_kpi5g_min " + + " WHERE 时间 >LOCALTIMESTAMP(0)+'-10 min' order by 小区名称, 时间 desc ) t) s " + + " WHERE s.group_idx = 1 ) "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + //if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + // sTime = " (select max(时间) from pm_kpi5g_min where 小区名称 in (select distinct 小区名称 from dp_scene_cell where 场馆id = #{sceneid})) "; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.rrc_max_user,b.prb_up,b.prb_down,b.up_disturb,'5G',小区频段,设备类型,带宽) algoValue," + + " b.rrc_max_user avgUsrValue," + + " b.prb_up uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.prb_down downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.rrc_max_user,b.prb_up,b.prb_down,b.up_disturb,'5G',小区频段,设备类型,带宽)),'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.rrc_max_user,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.prb_up,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.prb_down,'5G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a " + + //" left join pm_kpi5g_min b " + + " left join "+sTable+" b " + + " on a.小区名称=b.小区名称 " + + //" and b.时间>=" + sTime + + " where 网络='NR' and 场馆id=" + sceneid + " order by level desc"); + } + } + else //15分钟 + { + if (typeid == 1) //4G + { + String sTime = " (select max(endtime) from pm_kpi4g_cell where venue_id in (select distinct 场馆id from dp_scene_cell)) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi4g_min') " ; + sTime=" (select max(endtime) from pm_kpi4g_cell where venue_id = #{sceneid}) " ; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.上行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽)) ,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a" + + " left join pm_kpi4g_cell b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime>=" + sTime + + " where 网络='LTE' and 场馆id=" + sceneid + " order by level desc"); + } + else if (typeid == 2) //5G + { + String sTime = " (select max(endtime) from pm_kpi5g_cell where venue_id in (select distinct 场馆id from dp_scene_cell)) +'-10 min' "; + //if (jobtype.equals("WORK")) sTime=" LOCALTIMESTAMP(0) +'-3 min' "; + if (jobtype.equals("WORK")) + //sTime=" (select maxtime from dp_scene_maxtime where tablename = 'pm_kpi5g_min') " ; + sTime=" (select max(endtime) from pm_kpi5g_cell where venue_id = #{sceneid}) " ; + SQL.append("select a.ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽)),'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a " + + " left join pm_kpi5g_cell b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime>=" + sTime + + " where 网络='NR' and 场馆id=" + sceneid + " order by level desc"); + } + } + return SQL.toString(); + } + } + + @SelectProvider(type = class_get_maps_top_data.class,method = "get_maps_top_SQL") + class_dp_maps_topinfo get_maps_top_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid); + + @SelectProvider(type = class_get_maps_top_data.class,method = "get_bts_1to2_SQL") + List get_bts_1to2_data(@Param("sceneid") int sceneid, @Param("typeid") int typeid, @Param("kpiname") String kpiname, + @Param("mintype") int mintype,@Param("jobtype") String jobtype); + //endregion + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpYayunReplayMapper.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpYayunReplayMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..ab016abbed36bd79e143010b703d503f77a12690 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/mapper/dpYayunReplayMapper.java @@ -0,0 +1,618 @@ +package com.ruoyi.sunlm.mapper; + +import java.util.List; +import com.ruoyi.sunlm.domain.*; +import org.apache.ibatis.annotations.*; +import org.springframework.stereotype.Component; + +/** + * 参数配置 数据层 + * + * @author ruoyi + */ +@Mapper +@Component +public interface dpYayunReplayMapper +{ + + //region------------------------------------------------------------------------------------回放复位控制 + @Update({"update dp_scene_currtime set maxtime=inittime,\"reset\"='1' where tablename='all' "}) //Mybatis 不允许全表 UPDATE + void resetreplay(); + //endregion + + //region --------------------------------------------------------------------------------------------左侧列表1 + class class_get_left_1_data // 区域用户数,15分钟,X轴0-24点,15分钟一个间隔,昨日今日对比 + { + public String get_left_1_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("jobtype") String jobtype) + { + String SQL=" "; + if (typeid==1) //4G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + /* + SQL=" select distinct * from ((select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi4g_venue_replay where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+",'yyyy-mm-dd') and 结束时间<="+sTime+" order by 结束时间)"+ + " union all " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi4g_venue_replay where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') order by 结束时间)) a";*/ + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), "+sTime+"), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi4g_venue_replay where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd') and 结束时间<="+sTime + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi4g_venue_replay where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + else //5G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + /* + SQL=" select distinct * from ((select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi5g_venue_replay where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+",'yyyy-mm-dd') and 结束时间<="+sTime+" order by 结束时间)"+ + " union all " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi5g_venue_replay where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') order by 结束时间)) a";*/ + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), "+sTime+"), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 1 sign from pm_kpi5g_venue_replay where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd') and 结束时间<="+sTime + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(最大用户数::numeric, 2) value , 2 sign from pm_kpi5g_venue_replay where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + return SQL; + } + } + @SelectProvider(type = class_get_left_1_data.class,method = "get_left_1_data_SQL") + List get_left_1_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------左侧列表2 + class class_get_left_2_data // 区域流量,15分钟,,X轴0-24点,15分钟一个间隔,昨日今日对比 + { + public String get_left_2_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("jobtype") String jobtype) + { + String SQL=" "; + if (typeid==1) //4G/ + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime= " ( select maxtime from dp_scene_currtime ) "; + /* + SQL="select distinct * from ((select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi4g_venue_replay where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+",'yyyy-mm-dd') and 结束时间<="+sTime+" order by 结束时间)"+ + " union all " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi4g_venue_replay where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') order by 结束时间)) a";*/ + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), "+sTime+"), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi4g_venue_replay where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd') and 结束时间<="+sTime + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi4g_venue_replay where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + else //5G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime= " ( select maxtime from dp_scene_currtime ) "; + /* + SQL=" select distinct * from ((select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi5g_venue_replay where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+",'yyyy-mm-dd') and 结束时间<="+sTime+" order by 结束时间)"+ + " union all " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi5g_venue_replay where 场馆id="+sceneid+ + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') order by 结束时间)) a ";*/ + SQL= " with t1 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), to_timestamp ( to_char(now(),'yyyy-mm-dd') ||' 23:59:59', 'YYYY-MM-DD hh24:mi:ss' ), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t4 as " + + " ( SELECT to_char ( b, 'hh24:mi' ) AS time FROM " + + " generate_series ( to_timestamp (to_char(now(),'yyyy-mm-dd') ||' 00:00:00', 'YYYY-MM-DD hh24:mi:ss' ), "+sTime+"), '15 min' ) AS b " + + " group by time ORDER BY time ASC )," + + + " t2 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 1 sign from pm_kpi5g_venue_replay where 场馆id=#{sceneid}" + + " and to_char(结束时间,'yyyy-mm-dd')=to_char( "+sTime+",'yyyy-mm-dd') and 结束时间<="+sTime + + " )," + + + " t3 as " + + " (select to_char(结束时间,'hh24:mi') datetime,round(\"流量GB\"::numeric, 2) value , 2 sign from pm_kpi5g_venue_replay where 场馆id=#{sceneid} " + + " and to_char(结束时间,'yyyy-mm-dd')=to_char("+sTime+"+ '-1 day','yyyy-mm-dd') " + + " ) " + + + " select * from " + + " (select t4.time datetime,COALESCE(t2.value,-1) value,COALESCE(t2.sign,1) sign from t4 left join t2 on t4.time = t2 .datetime " + + " union all" + + " select t1.time datetime,COALESCE(t3.value,-1) value,COALESCE(t3.sign,2) sign from t1 left join t3 on t1.time = t3 .datetime " + + " ) t ORDER BY t.datetime ASC"; + } + return SQL; + } + } + + @SelectProvider(type = class_get_left_2_data.class,method = "get_left_2_data_SQL") + List get_left_2_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------左侧TOP5 + class class_get_left_3_data // 最大用户数TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_left_3_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype) + { + String SQL=" "; + + if (1==1) //15分钟 + { + if (typeid == 1) //4G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by level ) title,name,value,color,level from (" + + " select row_number() over(order by 最大用户数 desc) title,t.小区名称 name,最大用户数 value," + + " getkpicolor('最大用户数', 最大用户数,'4G',t2.小区频段,t2.设备类型,t2.带宽) color, " + + " getkpilevel('最大用户数', 最大用户数,'4G',t2.小区频段,t2.设备类型,t2.带宽) level " + + " from pm_kpi4g_cell_replay t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 最大用户数 is not null " + + " and endtime="+sTime+" and venue_id="+sceneid +swhere+ + " order by level asc,t.最大用户数 desc limit 5) a "; + } + else //5G / + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by level ) title,name,value,color,level from (" + + " select row_number() over(order by 最大用户数 desc) title,t.小区名称 name,最大用户数 value," + + " getkpicolor('最大用户数', 最大用户数,'5G',t2.小区频段,t2.设备类型,t2.带宽) color ," + + " getkpilevel('最大用户数', 最大用户数,'5G',t2.小区频段,t2.设备类型,t2.带宽) level " + + " from pm_kpi5g_cell_replay t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 最大用户数 is not null " + + " and endtime="+sTime+" and venue_id="+sceneid +swhere+ + " order by level asc ,t.最大用户数 desc limit 5) a "; + } + } + return SQL; + } + } + + @SelectProvider(type = class_get_left_3_data.class,method = "get_left_3_data_SQL") + List get_left_3_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------右侧TOP5图表1 + class class_get_right_1_data // 上行Prb利用率TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_right_1_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype) + { + String SQL=" "; + + if(1==1) //15分钟 + { + if (typeid == 1) //4G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 上行Prb利用率 desc) title,t.小区名称 name,上行Prb利用率 value," + + " getkpicolor('上行Prb利用率', 上行Prb利用率,'4G','','',20) color from pm_kpi4g_cell_replay t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 上行Prb利用率 is not null " + + " and endtime="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.上行Prb利用率 desc limit 5 "; + } + else //5G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 上行Prb利用率 desc) title,t.小区名称 name,上行Prb利用率 value ," + + " getkpicolor('上行Prb利用率', 上行Prb利用率,'5G','','',20) color from pm_kpi5g_cell_replay t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 上行Prb利用率 is not null " + + " and endtime="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.上行Prb利用率 desc limit 5 "; + } + } + return SQL; + } + } + + @SelectProvider(type = class_get_right_1_data.class,method = "get_right_1_data_SQL") + List get_right_1_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------右侧TOP5图表2 + class class_get_right_2_data // 下行Prb利用率TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_right_2_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype) + { + String SQL=" "; + + if (1==1) //15分钟 + { + if (typeid == 1) //4G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 下行Prb利用率 desc) title,t.小区名称 name,下行Prb利用率 value," + + " getkpicolor('下行Prb利用率', 下行Prb利用率,'4G','','',20) color from pm_kpi4g_cell_replay t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 下行Prb利用率 is not null " + + " and endtime="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.下行Prb利用率 desc limit 5 "; + } + else //5G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 下行Prb利用率 desc) title,t.小区名称 name,下行Prb利用率 value," + + " getkpicolor('下行Prb利用率', 下行Prb利用率,'5G','','',20) color from pm_kpi5g_cell_replay t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 下行Prb利用率 is not null " + + " and endtime="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.下行Prb利用率 desc limit 5 "; + } + } + return SQL; + } + } + + @SelectProvider(type = class_get_right_2_data.class,method = "get_right_2_data_SQL") + List get_right_2_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------右侧TOP5图表3 + class class_get_right_3_data // 最大干扰值TOP5,15分钟/1分钟(中台控制),最终值TOP5降序排列,文本白色,指标值彩色(叠加颜色指示) + { + public String get_right_3_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype) + { + String SQL=" "; + + if (1==1) //15分钟 + { + if (typeid == 1) //4G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 上行平均干扰 desc) title,t,小区名称 name,上行平均干扰 value," + + " getkpicolor('平均干扰值', 上行平均干扰,'4G','','',20) color from pm_kpi4g_cell_replay t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 上行平均干扰 is not null " + + " and endtime="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.上行平均干扰 desc limit 5 "; + } + else //5G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + String swhere=" "; + if (areaid>0) swhere=" and t2.场内场外='"+areaid+"' "; //1:场内,2:场外,0:默认全部 + SQL = " select row_number() over(order by 上行干扰值 desc) title,t.小区名称 name,上行干扰值 value," + + " getkpicolor('平均干扰值', 上行干扰值,'5G','','',20) color from pm_kpi5g_cell_replay t " + + " left join dp_scene_cell t2 on t.小区名称=t2.小区名称 "+ + " where 上行干扰值 is not null " + + " and endtime="+sTime+" and venue_id="+sceneid +swhere+ + " order by t.上行干扰值 desc limit 5 "; + } + } + return SQL; + } + } + + @SelectProvider(type = class_get_right_3_data.class,method = "get_right_3_data_SQL") + List get_right_3_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("mintype") int mintype, + @Param("areaid") int areaid,@Param("jobtype") String jobtype); + //endregion + + //region -------------------------------------------------------------------------------------------地图, 用新接口替换 + class class_get_maps_data + { + public String get_maps_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid) + { + String SQL=" select venue_name name," + + " cast(wgs84togcj02(longitude::numeric,latitude::numeric,'lng') as VARCHAR)||','||" + + " cast(wgs84togcj02(longitude::numeric,latitude::numeric,'lat') as VARCHAR) center" + + " from yw_scene where id= "+sceneid; + return SQL; + } + + public String get_bts_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid, + @Param("kpiname") String kpiname,@Param("mintype") int mintype,@Param("jobtype") String jobtype) + { + StringBuilder SQL = new StringBuilder(); + + if (1==1) //15分钟 + { + if (typeid == 1) //4G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.上行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽)) ,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a" + + " left join pm_kpi4g_cell_replay b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime=" + sTime + + " where 网络='LTE' and 场馆id=" + sceneid + " order by level desc"); + } + else if (typeid == 2) //5G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + SQL.append("select a.ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽)),'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a " + + " left join pm_kpi5g_cell_replay b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime=" + sTime + + " where 网络='NR' and 场馆id=" + sceneid + " order by level desc"); + } + } + return SQL.toString(); + } + } + + @SelectProvider(type = class_get_maps_data.class,method = "get_maps_SQL") + class_dp_maps get_maps_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid); + + @SelectProvider(type = class_get_maps_data.class,method = "get_bts_SQL") + List get_bts_data(@Param("sceneid") int sceneid, @Param("typeid") int typeid, @Param("kpiname") String kpiname, + @Param("mintype") int mintype,@Param("jobtype") String jobtype); + //endregion + + //region --------------------------------------------------------------------------------------------顶部统计值,用新接口替换 + class class_get_top_data + { + public String get_top_data_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("kpiname") String kpiname, + @Param("mintype") int mintype,@Param("jobtype") String jobtype) + { + StringBuilder SQL = new StringBuilder(); + + if(1==1) //15分钟 + { + if (typeid == 1) //4G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽)) ,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a" + + " left join pm_kpi4g_cell_replay b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime=" + sTime + + " where 网络='LTE' and 场馆id=" + sceneid + " order by level desc"); + } + else if (typeid == 2) //5G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + SQL.append("select a.ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽)),'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a " + + " left join pm_kpi5g_cell_replay b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime=" + sTime + + " where 网络='NR' and 场馆id=" + sceneid + " order by level desc"); + } + } + return SQL.toString(); + } + } + + @SelectProvider(type = class_get_top_data.class,method = "get_top_data_SQL") + List get_top_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid,@Param("kpiname") String kpiname, + @Param("mintype") int mintype,@Param("jobtype") String jobtype); + //endregion + + //region -------------------------------------------------------------------------------------------地图和统计值统一接口 + class class_get_maps_top_data + { + public String get_maps_top_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid) + { + String SQL=" select venue_name name," + + " cast(wgs84togcj02(longitude::numeric,latitude::numeric,'lng') as VARCHAR)||','||" + + " cast(wgs84togcj02(longitude::numeric,latitude::numeric,'lat') as VARCHAR) center" + + " from yw_scene where id= "+sceneid; + return SQL; + } + + public String get_bts_1to2_SQL(@Param("sceneid") int sceneid,@Param("typeid") int typeid, + @Param("kpiname") String kpiname,@Param("mintype") int mintype,@Param("jobtype") String jobtype) + { + StringBuilder SQL = new StringBuilder(); + + if (1==1) //15分钟 + { + if (typeid == 1) //4G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + SQL.append("select ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.上行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行平均干扰,'4G',小区频段,设备类型,带宽)) ,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'4G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a" + + " left join pm_kpi4g_cell_replay b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime=" + sTime + + " where 网络='LTE' and 场馆id=" + sceneid + " order by level desc"); + } + else if (typeid == 2) //5G + { + String sTime=" ( select maxtime from dp_scene_currtime ) "; + if (jobtype.equals("WORK")) sTime=" ( select maxtime from dp_scene_currtime ) "; + SQL.append("select a.ci,基站全称 name,a.小区名称 name2,小区频段 \"type\",经度 longitude,纬度 latitude," + + " 方位角 direction,wgs84togcj02(经度::numeric,纬度::numeric,'lng') gdLong," + + " wgs84togcj02(经度::numeric,纬度::numeric,'lat') gdLat," + + " getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽) algoValue," + + " b.最大用户数 avgUsrValue," + + " b.上行prb利用率 uplnkPrbvalue," + + " a.室内室外 as cellType," + + " b.下行prb利用率 downlnkPrbvalue "); + if ("综合算法".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('综合算法',(getkpivalue(b.最大用户数,b.上行prb利用率,b.下行prb利用率,b.上行干扰值,'5G',小区频段,设备类型,带宽)),'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("最大用户数".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('最大用户数',b.最大用户数,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("上行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('上行Prb利用率',b.上行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } else if ("下行Prb利用率".equalsIgnoreCase(kpiname)) { + SQL.append(" ,getkpilevel('下行Prb利用率',b.下行prb利用率,'5G',小区频段,设备类型,带宽)::numeric level "); + } + SQL.append(" from dp_scene_cell a " + + " left join pm_kpi5g_cell_replay b on a.小区名称=b.小区名称 and venue_id = #{sceneid} and b.endtime=" + sTime + + " where 网络='NR' and 场馆id=" + sceneid + " order by level desc"); + } + } + return SQL.toString(); + } + } + + @SelectProvider(type = class_get_maps_top_data.class,method = "get_maps_top_SQL") + class_dp_maps_topinfo get_maps_top_data(@Param("sceneid") int sceneid,@Param("typeid") int typeid); + + @SelectProvider(type = class_get_maps_top_data.class,method = "get_bts_1to2_SQL") + List get_bts_1to2_data(@Param("sceneid") int sceneid, @Param("typeid") int typeid, @Param("kpiname") String kpiname, + @Param("mintype") int mintype,@Param("jobtype") String jobtype); + //endregion + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/NewPmKpiMonitorCellService.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/NewPmKpiMonitorCellService.java new file mode 100644 index 0000000000000000000000000000000000000000..2f600509d0fa6c2b6e4b02b2b1c8718232447b45 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/NewPmKpiMonitorCellService.java @@ -0,0 +1,15 @@ +package com.ruoyi.sunlm.service; + +import com.github.pagehelper.PageInfo; +import com.ruoyi.sunlm.daping.dp3d.*; + +/** + * @author yqf + * @date 2023/4/13 + */ +public interface NewPmKpiMonitorCellService { + + PageInfo getMonitorCellList(NewPmKpiCellMonitorQO qo); + + PageInfo getDpMonitorCellList(NewDpKpiMonitorQO qo); +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/YwDpNewYayunService.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/YwDpNewYayunService.java new file mode 100644 index 0000000000000000000000000000000000000000..ade80c0bc7e62c0e979f62d7da3179adedb9110d --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/YwDpNewYayunService.java @@ -0,0 +1,14 @@ +package com.ruoyi.sunlm.service; + +/** + * @author yqf + * @date 2023/7/11 + */ +public interface YwDpNewYayunService { + + public void eastcomUpdateComprehensiveManageSchedule(); + + public void eastcomUpdateTransAlarmsSchedule(); + + public void eastcomUpdateNetAlarmsSchedule(); +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/dpAllMyServices.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/dpAllMyServices.java new file mode 100644 index 0000000000000000000000000000000000000000..63e4d72db853f3b54f80899066b247461e500341 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/dpAllMyServices.java @@ -0,0 +1,27 @@ +package com.ruoyi.sunlm.service; + +/** + * @date 2023/4/13 + */ +public interface dpAllMyServices { + void get_wireless_outservice(); + void get_gbflow_wireless(); + void get_manage_counts(); + void get_dict_counts(); + void get_trans_counts(); + void get_gbflow_huanlu(); + void get_agis_internet_counts(); + void get_maps_all_alarms(); + void get_maps_wireless_kpi_min(); + void get_maps_wireless_kpi_cell(); + //-------------------------------------- + void get_maps_all_alarms_popup(); + void get_spot_wirelessalarms_popup(); + void get_maps_wireless_alarms_popup(); + //-------------------------------------DICT + void get_dict_monitor_project_list(); + void get_dict_monitor_alarm_list(); + void get_dict_link_alarm_list(); + void get_dict_map_alarm_list(); + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/impl/NewPmKpiMonitorCellServiceImpl.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/impl/NewPmKpiMonitorCellServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..93af4603953c2b05f40c2bc3a820aa35c7841815 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/impl/NewPmKpiMonitorCellServiceImpl.java @@ -0,0 +1,505 @@ +package com.ruoyi.sunlm.service.impl; + +import cn.hutool.core.bean.BeanUtil; + +import com.github.pagehelper.Page; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.redis.RedisCache; + + +import com.ruoyi.sunlm.daping.class_dp_2_kpi_spot_celldetail; +import com.ruoyi.sunlm.daping.class_dp_2_seat_chinesename; +import com.ruoyi.sunlm.daping.class_dp_2_wireless_alarm; +import com.ruoyi.sunlm.daping.dp3d.*; +import com.ruoyi.sunlm.mapper.*; +import com.ruoyi.sunlm.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + + +/** + * @author yqf + * @date 2023/4/13 + */ +@Service +public class NewPmKpiMonitorCellServiceImpl implements NewPmKpiMonitorCellService { + + @Autowired + private NewPmKpi4gCellMapper pmKpi4gCellMapper; + + @Autowired + private NewPmKpi5gCellMapper pmKpi5gCellMapper; + + @Autowired + private NewPmKpi4gMinMapper pmKpi4gMinMapper; + + @Autowired + private NewPmKpi5gMinMapper pmKpi5gMinMapper; + + @Autowired + private NewDpSceneConfigMapper dpSceneConfigMapper; + + @Autowired + private dpNewYayun_Wuxian_Mapper MydpNewYayun_Wuxian_Mapper; + + + @Autowired + private RedisCache redisCache; + + private String cell_key = CacheConstants.YW_KPIMONITORCELL_INFO; + private String min_key = CacheConstants.YW_KPIMONITORMIN_INFO; + + private List getMonitorVoList(NewPmKpiCellMonitorQO qo) { + List voList = new ArrayList<>(); + List kpiList = new ArrayList<>(); + if (qo.getDatatype().equals(NewKpiConstants.YW_DATATYPE_15)) { //15分钟 + if (qo.getNettype().equals(NewKpiConstants.YW_NETTYPE_4G)) { //4G + qo.setPageSize(0); + kpiList = pmKpi4gCellMapper.getKpiList(qo); + } else { //5G + qo.setPageSize(0); + kpiList = pmKpi5gCellMapper.getKpiList(qo); + } + } else { //1分钟 + if (qo.getNettype().equals(NewKpiConstants.YW_NETTYPE_4G)) { //4G + qo.setPageSize(0); + kpiList = pmKpi4gMinMapper.getKpiList(qo); + } else { //5G + qo.setPageSize(0); + kpiList = pmKpi5gMinMapper.getKpiList(qo); + } + } + kpiList = kpiList.stream().filter(e -> null != e.get坐席编号()).collect(Collectors.toList()); + //-------------------------------过滤掉空值和值为0的记录,综合得分是可能为0的,不能过滤掉 + //-------------------------------这个过滤掉可能导致某个坐席下的列表为空, 如果需要,注释这段代码 + /* + try { + if (qo.getKpiname().equals(NewKpiConstants.YW_FIELD_RPB_UP)) { + kpiList = kpiList.stream().filter(e -> null != e.get上行prb利用率() && !e.get上行prb利用率().equals(new BigDecimal("0.00"))).collect(Collectors.toList()); + } else if (qo.getKpiname().equals(NewKpiConstants.YW_FIELD_RPB_DOWN)) { + kpiList = kpiList.stream().filter(e -> null != e.get下行prb利用率() && !e.get下行prb利用率().equals(new BigDecimal("0.00"))).collect(Collectors.toList()); + } else if (qo.getKpiname().equals(NewKpiConstants.YW_FIELD_AVG_DIS)) { + kpiList = kpiList.stream().filter(e -> null != e.get上行平均干扰() && !e.get上行平均干扰().equals(new BigDecimal("0.00"))).collect(Collectors.toList()); + } else if (qo.getKpiname().equals(NewKpiConstants.YW_FIELD_MAX_USER)) { + kpiList = kpiList.stream().filter(e -> null != e.get最大用户数() && !e.get最大用户数().equals(BigDecimal.ZERO)).collect(Collectors.toList()); + } + } + catch(Exception e) + { + } */ + //-------------------------------- + for (NewPmKpiMonitorEntity monitorEntity : kpiList) { //循环算分数和颜色 + NewPmKpi15CellMonitorVO vo = new NewPmKpi15CellMonitorVO(); + BeanUtil.copyProperties(monitorEntity, vo); + + //NewDpSceneConfigQO configQO = new NewDpSceneConfigQO(); + //configQO.setNettype(qo.getNettype()); + + //根据各指标值查出对应的颜色 + //上行prb利用率 + NewPmKpiVO prbUp = new NewPmKpiVO(NewKpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != monitorEntity.get上行prb利用率()) { + prbUp.setValue(monitorEntity.get上行prb利用率()); + prbUp.setColor(monitorEntity.getPrbupColor()); + prbUp.setScore(monitorEntity.getPrbupScore()); + } + vo.set上行prb利用率(prbUp); + + //下行prb利用率 + NewPmKpiVO prbDown = new NewPmKpiVO(NewKpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != monitorEntity.get下行prb利用率()) { + prbDown.setValue(monitorEntity.get下行prb利用率()); + prbDown.setColor(monitorEntity.getPrbdownColor()); + prbDown.setScore(monitorEntity.getPrbdownScore()); + } + vo.set下行prb利用率(prbDown); + + //上行平均干扰 + NewPmKpiVO avgDisturb = new NewPmKpiVO(NewKpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != monitorEntity.get上行平均干扰()) { + avgDisturb.setValue(monitorEntity.get上行平均干扰()); + avgDisturb.setColor(monitorEntity.getAvgdisColor()); + avgDisturb.setScore(monitorEntity.getAvgdisScore()); + } + vo.set上行平均干扰(avgDisturb); + + //最大用户数 + NewPmKpiVO maxUser = new NewPmKpiVO(NewKpiConstants.YW_KPI_COLOR_DEFAULT); + if (null != monitorEntity.get最大用户数()) { + maxUser.setValue(monitorEntity.get最大用户数()); + maxUser.setColor(monitorEntity.getMaxuserColor()); + maxUser.setScore(monitorEntity.getMaxuserScore()); + } + vo.set最大用户数(maxUser); + + + ////综合得分 + NewPmKpiVO allkpi = new NewPmKpiVO(NewKpiConstants.YW_KPI_COLOR_DEFAULT); + + //--###########################################################################--------added by sunlm 20230724 + //-先预先算好每个场馆的每个小区的分值和颜色。包括四个指标和一个综合得分指标 + // 改成将 上行Prb利用率得分, 下行Prb利用率得分 ,最大用户数得分 的综合 作为综合得分 ,2023-06-18 sunlm + //取指标中的最大值作为综合得分,这个废除了 + //allkpi.setValue(BigDecimal.valueOf(getMaxScore(prbUp.getScore(), prbDown.getScore(), avgDisturb.getScore(), maxUser.getScore()))); + + //---##########-----allkpi.setValue(BigDecimal.valueOf(prbUp.getScore() + prbDown.getScore() + maxUser.getScore())); + /* + Map colorAndScore = dpSceneConfigMapper.getkpiColorAndScore(NewKpiConstants.YW_FIELD_ALL, + allkpi.getValue().doubleValue(), qo.getNettype(), null, null, null); + allkpi.setColor(colorAndScore.get("color").toString()); + allkpi.setScore(Float.parseFloat(colorAndScore.get("score").toString())); + */ + + allkpi.setValue(BigDecimal.valueOf(monitorEntity.get综合得分值())); //正式启用20230728 + allkpi.setColor(monitorEntity.get综合得分颜色()); + allkpi.setScore(Float.parseFloat(String.valueOf(monitorEntity.get综合得分score()))); //get综合得分score(), 后续增加这个。 + //--###########################################################################------------------------------ + + //configQO.setName(NewKpiConstants.YW_FIELD_ALL); + //configQO.setValue(allkpi.getValue()); + + vo.set综合得分(allkpi); + + vo.setNettype(qo.getNettype()); + voList.add(vo); + } + + //--------------------------------------根据指标进行排序,大的排在最前面, 嵌套类中的属性进行排序,sunlm 2023-08-27 + try { + if (qo.getKpiname().equals("综合算法")) + voList = voList.stream().sorted(Comparator.comparing((NewPmKpi15CellMonitorVO x) -> x.get综合得分().getValue()).reversed()).collect(Collectors.toList()); + else if (qo.getKpiname().equals("上行Prb利用率")) + voList = voList.stream().sorted(Comparator.comparing((NewPmKpi15CellMonitorVO x) -> x.get上行prb利用率().getValue()).reversed()).collect(Collectors.toList()); + else if (qo.getKpiname().equals("下行Prb利用率")) + voList = voList.stream().sorted(Comparator.comparing((NewPmKpi15CellMonitorVO x) -> x.get下行prb利用率().getValue()).reversed()).collect(Collectors.toList()); + else if (qo.getKpiname().equals("最大用户数")) + voList = voList.stream().sorted(Comparator.comparing((NewPmKpi15CellMonitorVO x) -> x.get最大用户数().getValue()).reversed()).collect(Collectors.toList()); + else if (qo.getKpiname().equals("平均干扰值")) + voList = voList.stream().sorted(Comparator.comparing((NewPmKpi15CellMonitorVO x) -> x.get上行平均干扰().getValue()).reversed()).collect(Collectors.toList()); + } + catch(Exception e) + { + } + //-------------------------------------- + + return voList; + } + + private float getMaxScore(float prbUp, float prbDown, float avgDisturb, float maxUser) { // 取指标的最大值,不用了 + float score = 0; + if (prbUp > score) { + score = prbUp; + } + if (prbDown > score) { + score = prbDown; + } + if (avgDisturb > score) { + score = avgDisturb; + } + if (maxUser > score) { + score = maxUser; + } + return score; + } + + public static PageInfo getPageInfo(int currentPage, int pageSize, List list) { + int total = list.size(); + if (total > pageSize) { + int toIndex = pageSize * currentPage; + if (toIndex > total) { + toIndex = total; + } + int totalPage = total % pageSize == 0 ? (total / pageSize) : (total / pageSize) + 1; + if (totalPage < currentPage) { + list = new ArrayList<>(); + } else { + list = list.subList(pageSize * (currentPage - 1), toIndex); + } + } + Page page = new Page<>(currentPage, pageSize); + page.addAll(list); + page.setPages((total + pageSize - 1) / pageSize); + page.setTotal(total); + return new PageInfo<>(page); + } + + @Override + public PageInfo getMonitorCellList(NewPmKpiCellMonitorQO qo) { + PageInfo pageInfo = new PageInfo(); + Integer pageNum = qo.getPageNum(); + Integer pageSize = qo.getPageSize(); + List allList = new ArrayList<>(); + //----------------------------------------------------------------------------获取坐席的中文名,20230904 sunlm + String keyname="dp_2_seat_chinesename_lists"; + List seatinfolists=new ArrayList(); + if (redisCache.hasKey(keyname)) { + seatinfolists = redisCache.getCacheObject(keyname); + } + else { + seatinfolists = MydpNewYayun_Wuxian_Mapper.get_seat_chinesename(); + redisCache.setCacheObject(keyname, seatinfolists,5, TimeUnit.MINUTES); //缓存保留分钟 + } + //------------------------------------------------------------------------------------------------------- + if (qo.getIscache()) { + if (qo.getDatatype().equals(NewKpiConstants.YW_DATATYPE_15)) { + allList = redisCache.getCacheObject(cell_key); + } else { + allList = redisCache.getCacheObject(min_key); + } + } else { + List voList = getMonitorVoList(qo); + + Map> map = voList.stream().collect(Collectors.groupingBy(e -> e.get坐席编号() + "|" + e.getVenueid())); + for (String key : map.keySet()) { //每个坐席 + List list = map.get(key); //坐席的小区列表 + BigDecimal num = new BigDecimal("0.00"); + float score = 0; + + //----##########################################-------added by sunlm 20230725 + String color=""; + //----##########################################------------------------------ + + NewMonitorCellVo monitorCellVo = new NewMonitorCellVo(); + monitorCellVo.setSeatid(key.substring(0, key.indexOf("|"))); + /* + monitorCellVo.setCelllist(map.get(key)); + monitorCellVo.setVenuename(map.get(key).get(0).getVenuename()); + monitorCellVo.setVenueid(map.get(key).get(0).getVenueid()); + monitorCellVo.setPointid(map.get(key).get(0).getPointid()); + monitorCellVo.setStationno(map.get(key).get(0).getStationno()); + monitorCellVo.setPointname(map.get(key).get(0).getPointname()); + monitorCellVo.setLongitude(map.get(key).get(0).getLongitude()); + monitorCellVo.setLatitude(map.get(key).get(0).getLatitude()); */ + + monitorCellVo.setCelllist(list); + monitorCellVo.setVenuename(list.get(0).getVenuename()); + monitorCellVo.setVenueid(list.get(0).getVenueid()); + monitorCellVo.setPointid(list.get(0).getPointid()); + monitorCellVo.setStationno(list.get(0).getStationno()); + monitorCellVo.setPointname(list.get(0).getPointname()); + monitorCellVo.setLongitude(list.get(0).getLongitude()); + monitorCellVo.setLatitude(list.get(0).getLatitude()); + + //根据坐席分值判断颜色 + //NewDpSceneConfigQO sceneConfigQO = new NewDpSceneConfigQO(); + //sceneConfigQO.setNettype(qo.getNettype()); + + String seatcolor = ""; + int seatscore = 0; + String frequency = null; + String devicetype = null; + Long bandwidth = null; + + if (qo.getKpiname().equals(NewKpiConstants.YW_FIELD_ALL)) { + for (NewPmKpi15CellMonitorVO vo : map.get(key)) { //坐席的每个小区遍历 + //------------##############################################------------------by sunlm + //if (null != vo.get综合得分().getValue()) { + // if (vo.get综合得分().getValue().compareTo(num) > 0) { //整个坐席的分数。坐席指标值按所有小区最差的 + if (null != vo.get综合得分().getValue()) { + if (score <= vo.get综合得分().getScore()) { //整个坐席的分数。坐席指标值按所有小区最差的 + //------------####################################################################### + num = vo.get综合得分().getValue(); + //----------########################################-----------------added by sunlm 20230725 + score = vo.get综合得分().getScore(); + color=vo.get综合得分().getColor(); + //---------#########################################---------------------------------------- + } +// num = num.add(vo.get综合得分().getValue()); + } + } + + } else if (qo.getKpiname().equals(NewKpiConstants.YW_FIELD_RPB_UP)) { + //坐席指标值按所有小区最差的,上行prb利用率越大越差 +// num = list.stream().map(s -> s.get上行prb利用率().getValue().intValue()).max(Integer::compareTo).get(); + for (NewPmKpi15CellMonitorVO vo : map.get(key)) { + if (null != vo.get上行prb利用率().getValue()) { + if (score <= vo.get上行prb利用率().getScore()) { + score = vo.get上行prb利用率().getScore(); + num = vo.get上行prb利用率().getValue(); + //----------########################################-----------------added by sunlm 20230725 + color=vo.get上行prb利用率().getColor(); + //---------#########################################---------------------------------------- + } + } + } + + + } else if (qo.getKpiname().equals(NewKpiConstants.YW_FIELD_RPB_DOWN)) { +// num = list.stream().map(s -> s.get下行prb利用率().getValue().intValue()).max(Integer::compareTo).get(); + for (NewPmKpi15CellMonitorVO vo : map.get(key)) { + if (null != vo.get下行prb利用率().getValue()) { + if (score <= vo.get下行prb利用率().getScore()) { + score = vo.get下行prb利用率().getScore(); + num = vo.get下行prb利用率().getValue(); + //----------########################################-----------------added by sunlm 20230725 + color=vo.get下行prb利用率().getColor(); + //---------#########################################---------------------------------------- + } + } + } + + } else if (qo.getKpiname().equals(NewKpiConstants.YW_FIELD_MAX_USER)) { + //分设备类型 +// num = list.stream().map(s -> s.get最大用户数().getValue().intValue()).max(Integer::compareTo).get(); + for (NewPmKpi15CellMonitorVO vo : map.get(key)) { + if (null != vo.get最大用户数().getValue()) { + if (score <= vo.get最大用户数().getScore()) { + score = vo.get最大用户数().getScore(); + num = vo.get最大用户数().getValue(); + frequency = vo.get小区频段(); + devicetype = vo.get设备类型(); + bandwidth = vo.get带宽(); + //----------########################################-----------------added by sunlm 20230725 + color=vo.get最大用户数().getColor(); + //---------#########################################---------------------------------------- + } + } + } + + } else if (qo.getKpiname().equals(NewKpiConstants.YW_FIELD_AVG_DIS)) { +// num = list.stream().map(s -> s.get上行平均干扰().getValue().intValue()).max(Integer::compareTo).get(); + for (NewPmKpi15CellMonitorVO vo : map.get(key)) { + if (null != vo.get上行平均干扰().getValue()) { + if (score <= vo.get上行平均干扰().getScore()) { + score = vo.get上行平均干扰().getScore(); + num = vo.get上行平均干扰().getValue(); + //----------########################################-----------------added by sunlm 20230725 + color=vo.get上行平均干扰().getColor(); + //---------#########################################---------------------------------------- + } + } + } + } + + //sceneConfigQO.setName(qo.getKpiname()); + //sceneConfigQO.setValue(num); + + //----------########################################-----------------added by sunlm 20230725 + /* + Map colorAndScore = dpSceneConfigMapper.getkpiColorAndScore(qo.getKpiname(), num.doubleValue(), qo.getNettype(), + frequency, devicetype, bandwidth); + + monitorCellVo.setColor(colorAndScore.get("color").toString()); + monitorCellVo.setScore(Float.valueOf(colorAndScore.get("score").toString())); + */ + monitorCellVo.setColor(color); + monitorCellVo.setScore(score); + //---------#########################################---------------------------------------- + + monitorCellVo.setKpiname(qo.getKpiname()); + monitorCellVo.setDatatype(qo.getDatatype()); + monitorCellVo.setNettype(qo.getNettype()); + + //-----------------------------------------------------获取坐席的中文名,sunlm 2023-09-04 + String seatname = ""; + try { + seatname = seatinfolists.stream().filter(e -> e.getSceneid() == monitorCellVo.getVenueid()). + filter(e -> e.getSeatid().equals(monitorCellVo.getSeatid())).collect(Collectors.toList()).get(0).chinesename; + } + catch(Exception e) + { + } + monitorCellVo.setSeatname(seatname); + + //---------------------------------------------------------增加一键优化功能 2023-09-11 + BigDecimal zhdfvalue = new BigDecimal("0.00"); + BigDecimal zhdf4 = new BigDecimal("4.00"); + for (NewPmKpi15CellMonitorVO vo : map.get(key)) { //坐席的每个小区遍历, 综合得分 >= 4的 触发一键优化 + if (null != vo.get综合得分().getValue()) { + if (zhdfvalue.compareTo(vo.get综合得分().getValue())<=0) { + zhdfvalue = vo.get综合得分().getValue(); + } + } + } + if (zhdfvalue.compareTo(zhdf4)>=0) ///// >=4 + monitorCellVo.setOnekey(1); + else + monitorCellVo.setOnekey(0); + //------------------------------------------------------------------ + + allList.add(monitorCellVo); + } + + //把多次查询组装查询 + + /* /////无用代码 + if (null != qo.getSeatcolor() && !qo.getSeatcolor().equals("")) { + allList = allList.stream().filter(e -> e.getColor().equals(qo.getSeatcolor())).collect(Collectors.toList()); + } + */ + + if (null != qo.getSortcol() && null != qo.getSort()) { //不会进入 + if (qo.getSort().equals(NewKpiConstants.YW_SORT_DESC)) { + allList = allList.stream().sorted(Comparator.comparing(NewMonitorCellVo::getScore).reversed()).collect(Collectors.toList()); + } else { + allList = allList.stream().sorted(Comparator.comparing(NewMonitorCellVo::getScore)).collect(Collectors.toList()); + } + + } + + int orderid = 1; + for (NewMonitorCellVo monitorCellVo : allList) { + monitorCellVo.setOrderid(orderid); + orderid++; + } + + + if (qo.getDatatype().equals(NewKpiConstants.YW_DATATYPE_15)) { + redisCache.deleteObject(cell_key); + redisCache.setCacheObject(cell_key, allList); + } else { + redisCache.deleteObject(min_key); + redisCache.setCacheObject(min_key, allList); + } + + } + pageInfo = getPageInfo(pageNum, pageSize, allList); + return pageInfo; + } + + @Override + public PageInfo getDpMonitorCellList(NewDpKpiMonitorQO qo) { //qo.getSeatno() 这个参数没用 + Map map = new HashMap<>(); + if (qo.getDatatype().equals(NewKpiConstants.YW_DATATYPE_15)) { + if (qo.getNettype().equals(NewKpiConstants.YW_NETTYPE_4G)) { + map = pmKpi4gCellMapper.getLastTime(qo.getSceneid(), qo.getSeatno(),qo.getInorout()); + } else { + map = pmKpi5gCellMapper.getLastTime(qo.getSceneid(), qo.getSeatno(),qo.getInorout()); + } + } else { + if (qo.getNettype().equals(NewKpiConstants.YW_NETTYPE_4G)) { + map = pmKpi4gMinMapper.getLastTime(qo.getSceneid(), qo.getSeatno(),qo.getInorout()); + } else { + map = pmKpi5gMinMapper.getLastTime(qo.getSceneid(), qo.getSeatno(),qo.getInorout()); + } + } + + PageInfo pageInfo = new PageInfo(); + if (null != map && map.size() > 0) { + LocalDateTime starttime = ((Timestamp) map.get("starttime")).toLocalDateTime(); + LocalDateTime endtime = ((Timestamp) map.get("endtime")).toLocalDateTime(); + qo.setStarttime(starttime); + qo.setEndtime(endtime); + NewPmKpiCellMonitorQO monitorQO = new NewPmKpiCellMonitorQO(); + monitorQO.setIscache(false); + BeanUtil.copyProperties(qo, monitorQO); + monitorQO.setPageNum(1); + monitorQO.setPageSize(20000); + //------------------------------------------------- + pageInfo = getMonitorCellList(monitorQO); + } + + return pageInfo; + } + + + +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/impl/YwDpNewYayunServiceImpl.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/impl/YwDpNewYayunServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1e5302ce59ea0e79228c6c6865fc3db2d57294c1 --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/impl/YwDpNewYayunServiceImpl.java @@ -0,0 +1,291 @@ +package com.ruoyi.sunlm.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.eastcom_yw.domain.dto.YwInspectStatDTO; +import com.ruoyi.eastcom_yw.domain.dto.YwSignLogDTO; +import com.ruoyi.eastcom_yw.domain.param.YwRoutInspectStatParam; +import com.ruoyi.eastcom_yw.domain.vo.YwDrsTempTaskVO; +import com.ruoyi.eastcom_yw.domain.vo.YwSignLogStaticVo; +import com.ruoyi.eastcom_yw.service.YwDrsTempTaskService; +import com.ruoyi.eastcom_yw.service.YwRoutInspectPlanService; +import com.ruoyi.eastcom_yw.service.YwScenePictureService; +import com.ruoyi.eastcom_yw.service.YwSignLogViewService; +import com.ruoyi.sunlm.daping.*; +import com.ruoyi.sunlm.mapper.dpNewYayun_ChuanDong_Mapper; +import com.ruoyi.sunlm.mapper.dpNewYayun_ZhuanWang_Mapper; +import com.ruoyi.sunlm.mapper.dpNewYayun_ZongHe_Mapper; +import com.ruoyi.sunlm.mapper.dpNewYayun_Gailan_Mapper; +import com.ruoyi.sunlm.service.YwDpNewYayunService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * @author yqf + * @date 2023/7/11 + */ +@Service +@Slf4j +public class YwDpNewYayunServiceImpl implements YwDpNewYayunService { + + @Resource + private RedisCache redisCache; + + @Resource + private dpNewYayun_ChuanDong_Mapper dpNewYayunChuanDongMapper; + + @Resource + private dpNewYayun_ZhuanWang_Mapper dpNewYayunZhuanWangMapper; + + @Resource + private dpNewYayun_ZongHe_Mapper dpNewYayunZongHeMapper; + + @Resource + private dpNewYayun_Gailan_Mapper MydpNewYayun_Gailan_Mapper; + + @Resource + YwScenePictureService ywScenePictureService; + + @Resource + YwDrsTempTaskService ywDrsTempTaskService; + + + @Resource + private YwSignLogViewService ywSignLogViewService; + + @Resource + YwRoutInspectPlanService ywRoutInspectPlanService; + + //---------------------------------------获取缓存配置 + public int getcachesecond() + { + String keyname="dp_1_cache_config"; + if (redisCache.hasKey(keyname)) { + int iret=1; + try + { + iret= redisCache.getCacheObject(keyname); + } + catch(Exception ee) { + } + return iret; + } + else { + class_dp_1_cache_config cache=MydpNewYayun_Gailan_Mapper.get_cache_config(); + int iret=1; + try + { + iret=cache.cachesecond; + } + catch(Exception ee) + { + } + redisCache.setCacheObject(keyname, iret,58, TimeUnit.SECONDS); //缓存 + return iret; + } + } + //---------------------------------------- + + + public void eastcomUpdateComprehensiveManageSchedule() { + Map allMap = new HashMap<>(); + //签到top5 +// YwSignLogDTO signLogDTO = new YwSignLogDTO(); +// String today = DateUtils.getDate(); +// signLogDTO.setStartDate(today); +// signLogDTO.setEndDate(today); +// signLogDTO.setTaskFlag(true); +// List signLogStatic = ywSignLogViewService.getSignLogStatic(signLogDTO); +// if (CollectionUtil.isNotEmpty(signLogStatic)) { +// if (signLogStatic.size() > 6) { +// signLogStatic = signLogStatic.subList(1, 6); +// } else { +// signLogStatic = signLogStatic.subList(1, signLogStatic.size()); +// } +// +// } + List sign_top5 = dpNewYayunZongHeMapper.get_sign_top5(); + allMap.put("signrateTop5", sign_top5); + //巡检top5 +// YwRoutInspectStatParam param = new YwRoutInspectStatParam(); +// param.setBeginDate(today); +// param.setEndDate(today + " 23:59:59"); +// param.setTaskFlag(true); +// Map statListData = ywRoutInspectPlanService.getStatListData(param); +// List statList = (List) statListData.get("list"); +// if (CollectionUtil.isNotEmpty(statList)) { +// if (statList.size() > 5) { +// statList = statList.subList(0, 5); +// } +// +// } + List inspect_top5 = dpNewYayunZongHeMapper.get_inspect_top5(); + allMap.put("inspectrateTop5", inspect_top5); + //场馆联系人清单 + List contacts = dpNewYayunZongHeMapper.get_scene_contacts_list(); + allMap.put("contacts", contacts); + //统计数据 + class_dp_5_scenesta scenesta = dpNewYayunZongHeMapper.get_scene_sta(); + allMap.put("scenesta", scenesta); + //int cachesecond=getcachesecond(); + redisCache.setCacheObject(CacheConstants.YW_COM_MANAGE_ALL, allMap,58, TimeUnit.SECONDS); + //场馆级别数据 + Map result = new HashMap<>(); + Long[] ids = new Long[]{2L, 25L, 42L}; + for (int i = 0; i < ids.length; i++) { + Map map = new HashMap<>(); + Long id = ids[i]; + LocalDate date = LocalDate.now(); + //场馆基本信息 + JSONObject baseinfo = ywScenePictureService.listMatchTop3(id); + map.put("baseinfo", baseinfo); + //任务管理统计 + JSONObject task = ywScenePictureService.listTaskManage2(id,true); + map.put("task", task); + //人员签到统计 + JSONObject sign = ywScenePictureService.listSign(id); + map.put("sign", sign); + //drs管理 + List drs = ywDrsTempTaskService.drsPreview(id, date); + map.put("drs", drs); + result.put("scene_" + id, map); + } + redisCache.setCacheObject(CacheConstants.YW_COM_MANAGE_SCENE, result,58, TimeUnit.SECONDS); + } + + public void eastcomUpdateTransAlarmsSchedule() { + //告警数据 + int cachesecond=getcachesecond(); + List alarmlist = dpNewYayunChuanDongMapper.get_trans_alarms_all_list(); + redisCache.setCacheObject(CacheConstants.YW_TRANS_ALARM, alarmlist,cachesecond, TimeUnit.SECONDS); + //机房环境数据 + List powerlists = dpNewYayunChuanDongMapper.get_machineroom_alarms_all_list(); + redisCache.setCacheObject(CacheConstants.YW_MACHINEROOM_ALARM, powerlists,cachesecond, TimeUnit.SECONDS); + //流量top5 + List gblist = dpNewYayunChuanDongMapper.get_huanlu_top5_all(); + redisCache.setCacheObject(CacheConstants.YW_GB_TOP5, gblist,58, TimeUnit.SECONDS); + //光功率数据 + List list = dpNewYayunChuanDongMapper.get_opticalpower_all_list(); + redisCache.setCacheObject(CacheConstants.YW_OPTICALPOWER, list,58, TimeUnit.SECONDS); + //地图 + List dpdata = dpNewYayunChuanDongMapper.get_maps_all_alarms(); + List alarmsList = dpNewYayunChuanDongMapper.get_maps_alarms_all_alarms(); + List poweralarmlist = dpNewYayunChuanDongMapper.get_machineroom_alarms_all_list(); + Map> map = new HashMap<>(); + Map> powermap = new HashMap<>(); + if(CollectionUtil.isNotEmpty(alarmsList)){ + map = alarmsList.stream().collect(Collectors.groupingBy(class_dp_map_alarms::getSceneid)); + } + if (CollectionUtil.isNotEmpty(poweralarmlist)) { + powermap = poweralarmlist.stream().collect(Collectors.groupingBy(class_dp_2_power_alarm::get场馆id)); + } + + for (class_dp_4_maps_alarms dpdatum : dpdata) { + List alarms = new ArrayList<>(); + if (dpdatum.getAlarmcount() > 0) { + List sceneList = map.get(Long.valueOf(dpdatum.getVenueid())); + alarms.addAll(sceneList); + } + + if (CollectionUtil.isNotEmpty(powermap)) { + List powerlist = powermap.get(dpdatum.getVenueid() + ""); + if (CollectionUtil.isNotEmpty(powerlist)) { + for (class_dp_2_power_alarm powerAlarm : powerlist) { + class_dp_map_alarms alarm = new class_dp_map_alarms(); + BeanUtil.copyProperties(powerAlarm, alarm); + alarm.setMajor("动环"); + alarm.setHandlepeople(powerAlarm.get故障处理人()); + alarm.setSceneid(Long.valueOf(powerAlarm.get场馆id())); + alarm.setNetname(powerAlarm.getSiteName()); + alarms.add(alarm); + + } + dpdatum.setAlarmcount(dpdatum.getAlarmcount() + powerlist.size()); + dpdatum.setPowercount(powerlist.size()); + } + + } + dpdatum.setLists(alarms); + } + redisCache.setCacheObject(CacheConstants.YW_TRANS_MAP, dpdata,cachesecond, TimeUnit.SECONDS); + } + + + public void eastcomUpdateNetAlarmsSchedule() { + int cachesecond=getcachesecond(); + List list = dpNewYayunZhuanWangMapper.get_net_alarms_all_list(); + redisCache.setCacheObject(CacheConstants.YW_NET_ALARM, list,cachesecond, TimeUnit.SECONDS); + //地图 + List dpdata = dpNewYayunZhuanWangMapper.get_maps_all_alarms(); + List alarmsList = dpNewYayunZhuanWangMapper.get_map_alarms_all_list(); + List linkAllList = dpNewYayunZhuanWangMapper.get_map_agis_link_all_list(); + List devAllList = dpNewYayunZhuanWangMapper.get_map_agis_dev_all_list(); + Map> map = new HashMap<>(); + Map> linkmap = new HashMap<>(); + Map> devmap = new HashMap<>(); + if(CollectionUtil.isNotEmpty(alarmsList)){ + map = alarmsList.stream().collect(Collectors.groupingBy(class_dp_map_alarms::getSceneid)); + } + if (CollectionUtil.isNotEmpty(linkAllList)) { + linkmap = linkAllList.stream().collect(Collectors.groupingBy(class_dp_map_agis_link_5mi::getVenueid)); + } + if (CollectionUtil.isNotEmpty(devAllList)) { + devmap = devAllList.stream().collect(Collectors.groupingBy(class_dp_map_agis_dev_15mi::getVenueid)); + } + for (class_dp_3_maps_alarms dpdatum : dpdata) { + if (dpdatum.getAlarmcount() > 0) { + List sceneList = map.get(Long.valueOf(dpdatum.getVenueid())); + dpdatum.setLists(sceneList); + } + if (CollectionUtil.isNotEmpty(linkmap)) { + dpdatum.setLinklists(linkmap.get(Long.valueOf(dpdatum.getVenueid()))); + } + if (CollectionUtil.isNotEmpty(devmap)) { + dpdatum.setDevlists(devmap.get(Long.valueOf(dpdatum.getVenueid()))); + } + } + redisCache.setCacheObject(CacheConstants.YW_NET_MAP, dpdata,cachesecond, TimeUnit.SECONDS); + + //功能区的告警和性能输出 + List codeList = dpNewYayunZhuanWangMapper.get_code_all_list(); + List alarmList = dpNewYayunZhuanWangMapper.get_code_alarms_all_list(); + List codedevAllList = dpNewYayunZhuanWangMapper.get_code_agis_dev_all_list(); + Map> codemap = new HashMap<>(); + Map> codedevmap = new HashMap<>(); + + if (CollectionUtil.isNotEmpty(alarmList)) { + codemap = alarmList.stream().collect(Collectors.groupingBy(class_dp_map_alarms::getCode)); + } + + if (CollectionUtil.isNotEmpty(codedevAllList)) { + codedevmap = codedevAllList.stream().collect(Collectors.groupingBy(class_dp_map_agis_dev_15mi::getCode)); + } + + for (class_dp_2_code_net_alarms codeNetAlarm : codeList) { + if (CollectionUtil.isNotEmpty(codemap)) { + codeNetAlarm.setLists(codemap.get(codeNetAlarm.getCode())); + if(CollectionUtil.isNotEmpty(codemap.get(codeNetAlarm.getCode()))){ + codeNetAlarm.setAlarmcount(codemap.get(codeNetAlarm.getCode()).size()); + } + } + if (CollectionUtil.isNotEmpty(codedevmap)) { + codeNetAlarm.setKpilist(codedevmap.get(codeNetAlarm.getCode())); + } + } + redisCache.setCacheObject(CacheConstants.YW_NET_CODE_AGIS, codeList,cachesecond, TimeUnit.SECONDS); + + } +} diff --git a/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/impl/dpAllMyServicesImpl.java b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/impl/dpAllMyServicesImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..50ebd43f55a620bdef875b840d2448b05f1a039d --- /dev/null +++ b/ruoyi-sunlm/src/main/java/com/ruoyi/sunlm/service/impl/dpAllMyServicesImpl.java @@ -0,0 +1,218 @@ +package com.ruoyi.sunlm.service.impl; + + +import com.ruoyi.common.core.redis.RedisCache; + +import com.ruoyi.sunlm.daping.*; +import com.ruoyi.sunlm.mapper.*; +import com.ruoyi.sunlm.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * @date 2023/4/13 + */ +@Service +public class dpAllMyServicesImpl implements dpAllMyServices { + + @Autowired + dpNewYayun_Gailan_Mapper MydpNewYayun_Gailan_Mapper; + + @Autowired + dpNewYayun_Wuxian_Mapper MydpNewYayun_Wuxian_Mapper; + + @Autowired + dpNewYayun_Dict_Mapper MydpNewYayun_Dict_Mapper; + + @Autowired + private RedisCache redisCache; + + //---------------------------------------获取缓存配置 + public int getcachesecond() + { + String keyname="dp_1_cache_config"; + if (redisCache.hasKey(keyname)) { + int iret=1; + try + { + iret= redisCache.getCacheObject(keyname); + } + catch(Exception ee) { + } + return iret; + } + else { + class_dp_1_cache_config cache=MydpNewYayun_Gailan_Mapper.get_cache_config(); + int iret=1; + try + { + iret=cache.cachesecond; + } + catch(Exception ee) + { + } + redisCache.setCacheObject(keyname, iret,58, TimeUnit.SECONDS); //缓存 + return iret; + } + } + //---------------------------------------- + + @Override + public void get_wireless_outservice() { //设备告警 + String keyname="dp_1_wireless_outservice_list"; + int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Gailan_Mapper.get_wireless_outservice(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_gbflow_wireless() { //4/5G流量 + String keyname="dp_1_gbflow_wireless_list_1"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Gailan_Mapper.get_gbflow_wireless(1); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58,TimeUnit.SECONDS); //缓存 + //----------------------------------- + keyname="dp_1_gbflow_wireless_list_2"; + dpData=MydpNewYayun_Gailan_Mapper.get_gbflow_wireless(2); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58,TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_manage_counts() { //综合管理 + String keyname="dp_1_manage_counts_list"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Gailan_Mapper.get_manage_counts(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58,TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_dict_counts() { //DICT + String keyname="dp_1_dict_counts_list"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Gailan_Mapper.get_dict_counts(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_trans_counts() { //传输动力 + String keyname="dp_1_trans_counts_list"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Gailan_Mapper.get_trans_counts(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_gbflow_huanlu() { //环路流量 + String keyname="dp_1_gbflow_huanlu_list"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Gailan_Mapper.get_gbflow_huanlu(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_agis_internet_counts() { //专网 + String keyname="dp_1_agis_internet_counts_list"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Gailan_Mapper.get_agis_internet_counts(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_maps_all_alarms() { //中间地图 + String keyname="dp_1_maps_all_alarms_list_1"; + int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Gailan_Mapper.get_maps_all_alarms(1); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + //----------------------------------- + keyname="dp_1_maps_all_alarms_list_2"; + dpData=MydpNewYayun_Gailan_Mapper.get_maps_all_alarms(2); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + } + //----------------------------------------------------------------------------------- + @Override + public void get_maps_wireless_kpi_min() { //中间地图无线KPI,1min + String keyname="dp_2_maps_wireless_kpicells_list_4G_1"; + int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Wuxian_Mapper.get_maps_wireless_kpi_cells("4G",1); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + //----------------------------------- + keyname="dp_2_maps_wireless_kpicells_list_5G_1"; + dpData=MydpNewYayun_Wuxian_Mapper.get_maps_wireless_kpi_cells("5G",1); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_maps_wireless_kpi_cell() { //中间地图无线KPI,15min + String keyname="dp_2_maps_wireless_kpicells_list_4G_15"; + int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Wuxian_Mapper.get_maps_wireless_kpi_cells("4G",15); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + //----------------------------------- + keyname="dp_2_maps_wireless_kpicells_list_5G_15"; + dpData=MydpNewYayun_Wuxian_Mapper.get_maps_wireless_kpi_cells("5G",15); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_maps_all_alarms_popup() { + String keyname="dp_1_maps_all_alarms_popup_list"; + int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Gailan_Mapper.get_maps_all_alarms_popup(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_spot_wirelessalarms_popup() { + String keyname="dp_2_spot_wireless_alarms_popup_list"; + int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Wuxian_Mapper.get_spot_wirelessalarms_popup(); //景区的告警 + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_maps_wireless_alarms_popup() { + String keyname="dp_2_maps_wireless_alarms_popup_list"; + int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Wuxian_Mapper.get_maps_wireless_alarms_popup(); //场馆的告警 + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,cachesecond, TimeUnit.SECONDS); //缓存 + } + + //--------------------------------- + + @Override + public void get_dict_monitor_project_list() { + String keyname="dp_6_dict_monitor_project_list"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Dict_Mapper.get_dict_monitor_project_list(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_dict_monitor_alarm_list() { + String keyname="dp_6_dict_monitor_alarm_list"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Dict_Mapper.get_dict_monitor_alarm_list(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_dict_link_alarm_list() { + String keyname="dp_6_dict_link_alarm_list"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Dict_Mapper.get_dict_link_alarm_list(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存 + } + + @Override + public void get_dict_map_alarm_list() { + String keyname="dp_6_dict_map_alarm_list"; + //int cachesecond=getcachesecond(); + List dpData=MydpNewYayun_Dict_Mapper.get_map_alarm_list(); + if (dpData!=null) redisCache.setCacheObject(keyname, dpData,58, TimeUnit.SECONDS); //缓存 + } + + +} diff --git a/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewDpSceneConfigMapper.xml b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewDpSceneConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..e9aa824274ce0cdb69864c16dac72bfefe825817 --- /dev/null +++ b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewDpSceneConfigMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + diff --git a/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi4gCellMapper.xml b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi4gCellMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..85c937500501d2ae21968bbf8e87e8d140cf5883 --- /dev/null +++ b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi4gCellMapper.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + diff --git a/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi4gMinMapper.xml b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi4gMinMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..2135f31fa4cf1008a56388b2d5693762c0bfde0f --- /dev/null +++ b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi4gMinMapper.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + diff --git a/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi5gCellMapper.xml b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi5gCellMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..9ed5992fa071af18247432eef81b102c4e0f08c6 --- /dev/null +++ b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi5gCellMapper.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + diff --git a/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi5gMinMapper.xml b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi5gMinMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..19fc695015a1043a63a83d0435ab1469fc4a753d --- /dev/null +++ b/ruoyi-sunlm/src/main/resources/mapper/sunlm/NewPmKpi5gMinMapper.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..f5a2114e1c0344947f2fe7d528950d0606cec990 --- /dev/null +++ b/ruoyi-system/pom.xml @@ -0,0 +1,28 @@ + + + + ruoyi + com.ruoyi + 3.8.4 + + 4.0.0 + + ruoyi-system + + + system系统模块 + + + + + + + com.ruoyi + ruoyi-common + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysAppRoleMenu.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysAppRoleMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..f3a3703b1ea0b9968a878ab19d1bbfd2f88c980c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysAppRoleMenu.java @@ -0,0 +1,51 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 角色和菜单关联 sys_app_role_menu app + * + * @author ruoyi + */ +@TableName("sys_app_role_menu") +public class SysAppRoleMenu +{ + /** 角色ID */ + @TableField(value = "role_id") + private Long roleId; + + /** 菜单ID */ + @TableField(value = "menu_id") + private Long menuId; + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + public Long getMenuId() + { + return menuId; + } + + public void setMenuId(Long menuId) + { + this.menuId = menuId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("menuId", getMenuId()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysAppUserMenu.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysAppUserMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..89e7c2f285cd2c395a3b3aaf6c873b7b215fe161 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysAppUserMenu.java @@ -0,0 +1,51 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 用户和菜单关联 sys_app_user_menu + * + * @author ruoyi + */ +@TableName("sys_app_user_menu") +public class SysAppUserMenu +{ + /** 用户ID */ + @TableField(value = "user_id") + private Long userId; + + /** 菜单ID */ + @TableField(value = "menu_id") + private Long menuId; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getMenuId() + { + return menuId; + } + + public void setMenuId(Long menuId) + { + this.menuId = menuId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("menuId", getMenuId()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysCache.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysCache.java new file mode 100644 index 0000000000000000000000000000000000000000..83f0703a0fc23882cf9dc9167ac75d71da471d9e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysCache.java @@ -0,0 +1,81 @@ +package com.ruoyi.system.domain; + +import com.ruoyi.common.utils.StringUtils; + +/** + * 缓存信息 + * + * @author ruoyi + */ +public class SysCache +{ + /** 缓存名称 */ + private String cacheName = ""; + + /** 缓存键名 */ + private String cacheKey = ""; + + /** 缓存内容 */ + private String cacheValue = ""; + + /** 备注 */ + private String remark = ""; + + public SysCache() + { + + } + + public SysCache(String cacheName, String remark) + { + this.cacheName = cacheName; + this.remark = remark; + } + + public SysCache(String cacheName, String cacheKey, String cacheValue) + { + this.cacheName = StringUtils.replace(cacheName, ":", ""); + this.cacheKey = StringUtils.replace(cacheKey, cacheName, ""); + this.cacheValue = cacheValue; + } + + public String getCacheName() + { + return cacheName; + } + + public void setCacheName(String cacheName) + { + this.cacheName = cacheName; + } + + public String getCacheKey() + { + return cacheKey; + } + + public void setCacheKey(String cacheKey) + { + this.cacheKey = cacheKey; + } + + public String getCacheValue() + { + return cacheValue; + } + + public void setCacheValue(String cacheValue) + { + this.cacheValue = cacheValue; + } + + public String getRemark() + { + return remark; + } + + public void setRemark(String remark) + { + this.remark = remark; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..784d68637849aff6221a839324ca259407c1f80b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java @@ -0,0 +1,121 @@ +package com.ruoyi.system.domain; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 参数配置表 sys_config + * + * @author ruoyi + */ +@TableName("sys_config") +public class SysConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 参数主键 */ + @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) + @TableId(value = "config_id") + private Long configId; + + /** 参数名称 */ + @Excel(name = "参数名称") + @TableField(value = "config_name") + private String configName; + + /** 参数键名 */ + @Excel(name = "参数键名") + @TableField(value = "config_key") + private String configKey; + + /** 参数键值 */ + @Excel(name = "参数键值") + @TableField(value = "config_value") + private String configValue; + + /** 系统内置(Y是 N否) */ + @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") + @TableField(value = "config_type") + private String configType; + + public Long getConfigId() + { + return configId; + } + + public void setConfigId(Long configId) + { + this.configId = configId; + } + + @NotBlank(message = "参数名称不能为空") + @Size(min = 0, max = 100, message = "参数名称不能超过100个字符") + public String getConfigName() + { + return configName; + } + + public void setConfigName(String configName) + { + this.configName = configName; + } + + @NotBlank(message = "参数键名长度不能为空") + @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") + public String getConfigKey() + { + return configKey; + } + + public void setConfigKey(String configKey) + { + this.configKey = configKey; + } + + @NotBlank(message = "参数键值不能为空") + @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") + public String getConfigValue() + { + return configValue; + } + + public void setConfigValue(String configValue) + { + this.configValue = configValue; + } + + public String getConfigType() + { + return configType; + } + + public void setConfigType(String configType) + { + this.configType = configType; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("configId", getConfigId()) + .append("configName", getConfigName()) + .append("configKey", getConfigKey()) + .append("configValue", getConfigValue()) + .append("configType", getConfigType()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java new file mode 100644 index 0000000000000000000000000000000000000000..70657ccf9400d0463d1a0bd7620b6b3b70f55f23 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java @@ -0,0 +1,156 @@ +package com.ruoyi.system.domain; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 系统访问记录表 sys_logininfor + * + * @author ruoyi + */ +@TableName("sys_logininfor") +public class SysLogininfor extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + @Excel(name = "序号", cellType = ColumnType.NUMERIC) + @TableId(value = "info_id") + private Long infoId; + + /** 用户账号 */ + @Excel(name = "用户账号") + @TableField(value = "user_name") + private String userName; + + /** 登录状态 0成功 1失败 */ + @Excel(name = "登录状态", readConverterExp = "0=成功,1=失败") + private String status; + + /** 登录IP地址 */ + @Excel(name = "登录地址") + private String ipaddr; + + /** 登录地点 */ + @Excel(name = "登录地点") + @TableField(value = "login_location") + private String loginLocation; + + /** 浏览器类型 */ + @Excel(name = "浏览器") + private String browser; + + /** 操作系统 */ + @Excel(name = "操作系统") + private String os; + + + + /** 提示消息 */ + @Excel(name = "提示消息") + private String msg; + + + /** 访问时间 */ +// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @TableField(value = "login_time") + private Date loginTime; + + public Long getInfoId() + { + return infoId; + } + + public void setInfoId(Long infoId) + { + this.infoId = infoId; + } + + public String getUserName() + { + return userName; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getIpaddr() + { + return ipaddr; + } + + public void setIpaddr(String ipaddr) + { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() + { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) + { + this.loginLocation = loginLocation; + } + + public String getBrowser() + { + return browser; + } + + public void setBrowser(String browser) + { + this.browser = browser; + } + + public String getOs() + { + return os; + } + + public void setOs(String os) + { + this.os = os; + } + + public String getMsg() + { + return msg; + } + + public void setMsg(String msg) + { + this.msg = msg; + } + + public Date getLoginTime() + { + return loginTime; + } + + public void setLoginTime(Date loginTime) + { + this.loginTime = loginTime; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java new file mode 100644 index 0000000000000000000000000000000000000000..348d526621a4b53e5fa863193d9e182e631b8b9d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java @@ -0,0 +1,273 @@ +package com.ruoyi.system.domain; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 操作日志记录表 oper_log + * + * @author ruoyi + */ +@TableName("sys_oper_log") +public class SysOperLog extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 日志主键 */ + @Excel(name = "操作序号", cellType = ColumnType.NUMERIC) + @TableId(value = "oper_id") + private Long operId; + + /** 操作模块 */ + @Excel(name = "操作模块") + private String title; + + /** 业务类型(0其它 1新增 2修改 3删除) */ + @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据") + @TableField(value = "business_type") + private Integer businessType; + + /** 业务类型数组 */ + private Integer[] businessTypes; + + /** 请求方法 */ + @Excel(name = "请求方法") + private String method; + + /** 请求方式 */ + @Excel(name = "请求方式") + @TableField(value = "request_method") + private String requestMethod; + + /** 操作类别(0其它 1后台用户 2手机端用户) */ + @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户") + @TableField(value = "operator_type") + private Integer operatorType; + + /** 操作人员 */ + @Excel(name = "操作人员") + @TableField(value = "oper_name") + private String operName; + + /** 部门名称 */ + @Excel(name = "部门名称") + @TableField(value = "dept_name") + private String deptName; + + /** 请求url */ + @Excel(name = "请求地址") + @TableField(value = "oper_url") + private String operUrl; + + /** 操作地址 */ + @Excel(name = "操作地址") + @TableField(value = "oper_ip") + private String operIp; + + /** 操作地点 */ + @Excel(name = "操作地点") + @TableField(value = "oper_location") + private String operLocation; + + /** 请求参数 */ + @Excel(name = "请求参数") + @TableField(value = "oper_param") + private String operParam; + + /** 返回参数 */ + @Excel(name = "返回参数") + @TableField(value = "json_result") + private String jsonResult; + + /** 操作状态(0正常 1异常) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=异常") + private Integer status; + + /** 错误消息 */ + @Excel(name = "错误消息") + @TableField(value = "error_msg") + private String errorMsg; + + /** 操作时间 */ +// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh") + @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @TableField(value = "oper_time") + private Date operTime; + + public Long getOperId() + { + return operId; + } + + public void setOperId(Long operId) + { + this.operId = operId; + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + public Integer getBusinessType() + { + return businessType; + } + + public void setBusinessType(Integer businessType) + { + this.businessType = businessType; + } + + public Integer[] getBusinessTypes() + { + return businessTypes; + } + + public void setBusinessTypes(Integer[] businessTypes) + { + this.businessTypes = businessTypes; + } + + public String getMethod() + { + return method; + } + + public void setMethod(String method) + { + this.method = method; + } + + public String getRequestMethod() + { + return requestMethod; + } + + public void setRequestMethod(String requestMethod) + { + this.requestMethod = requestMethod; + } + + public Integer getOperatorType() + { + return operatorType; + } + + public void setOperatorType(Integer operatorType) + { + this.operatorType = operatorType; + } + + public String getOperName() + { + return operName; + } + + public void setOperName(String operName) + { + this.operName = operName; + } + + public String getDeptName() + { + return deptName; + } + + public void setDeptName(String deptName) + { + this.deptName = deptName; + } + + public String getOperUrl() + { + return operUrl; + } + + public void setOperUrl(String operUrl) + { + this.operUrl = operUrl; + } + + public String getOperIp() + { + return operIp; + } + + public void setOperIp(String operIp) + { + this.operIp = operIp; + } + + public String getOperLocation() + { + return operLocation; + } + + public void setOperLocation(String operLocation) + { + this.operLocation = operLocation; + } + + public String getOperParam() + { + return operParam; + } + + public void setOperParam(String operParam) + { + this.operParam = operParam; + } + + public String getJsonResult() + { + return jsonResult; + } + + public void setJsonResult(String jsonResult) + { + this.jsonResult = jsonResult; + } + + public Integer getStatus() + { + return status; + } + + public void setStatus(Integer status) + { + this.status = status; + } + + public String getErrorMsg() + { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) + { + this.errorMsg = errorMsg; + } + + public Date getOperTime() + { + return operTime; + } + + public void setOperTime(Date operTime) + { + this.operTime = operTime; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java new file mode 100644 index 0000000000000000000000000000000000000000..2c8eb4f81fdf1502f4858964103671b8cefdb065 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java @@ -0,0 +1,133 @@ +package com.ruoyi.system.domain; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.Excel.ColumnType; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 岗位表 sys_post + * + * @author ruoyi + */ +@TableName("sys_post") +public class SysPost extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 岗位序号 */ + @Excel(name = "岗位序号", cellType = ColumnType.NUMERIC) + @TableId(value = "post_id") + private Long postId; + + /** 岗位编码 */ + @Excel(name = "岗位编码") + @TableField(value = "post_code") + private String postCode; + + /** 岗位名称 */ + @Excel(name = "岗位名称") + @TableField(value = "post_name") + private String postName; + + /** 岗位排序 */ + @Excel(name = "岗位排序") + @TableField(value = "post_sort") + private Integer postSort; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** 用户是否存在此岗位标识 默认不存在 */ + private boolean flag = false; + + public Long getPostId() + { + return postId; + } + + public void setPostId(Long postId) + { + this.postId = postId; + } + + @NotBlank(message = "岗位编码不能为空") + @Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符") + public String getPostCode() + { + return postCode; + } + + public void setPostCode(String postCode) + { + this.postCode = postCode; + } + + @NotBlank(message = "岗位名称不能为空") + @Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符") + public String getPostName() + { + return postName; + } + + public void setPostName(String postName) + { + this.postName = postName; + } + + @NotNull(message = "显示顺序不能为空") + public Integer getPostSort() + { + return postSort; + } + + public void setPostSort(Integer postSort) + { + this.postSort = postSort; + } + + public String getStatus() + { + return status; + } + + public void setStatus(String status) + { + this.status = status; + } + + public boolean isFlag() + { + return flag; + } + + public void setFlag(boolean flag) + { + this.flag = flag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("postId", getPostId()) + .append("postCode", getPostCode()) + .append("postName", getPostName()) + .append("postSort", getPostSort()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java new file mode 100644 index 0000000000000000000000000000000000000000..97b5974636334d4911b690a8b9b3e5437d360d38 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleDept.java @@ -0,0 +1,48 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 角色和部门关联 sys_role_dept + * + * @author ruoyi + */ +@TableName("sys_dept") +public class SysRoleDept +{ + /** 角色ID */ + private Long roleId; + + /** 部门ID */ + private Long deptId; + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("deptId", getDeptId()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..1b2c83167beab9cbd3ba9f8b7f3edaef70c51bfd --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java @@ -0,0 +1,51 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 角色和菜单关联 sys_role_menu + * + * @author ruoyi + */ +@TableName("sys_role_menu") +public class SysRoleMenu +{ + /** 角色ID */ + @TableField(value = "role_id") + private Long roleId; + + /** 菜单ID */ + @TableField(value = "menu_id") + private Long menuId; + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + public Long getMenuId() + { + return menuId; + } + + public void setMenuId(Long menuId) + { + this.menuId = menuId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("menuId", getMenuId()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java new file mode 100644 index 0000000000000000000000000000000000000000..32bd22704d52bd07b2dda40b8982c8124b4b5851 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java @@ -0,0 +1,123 @@ +package com.ruoyi.system.domain; + +/** + * 当前在线会话 + * + * @author ruoyi + */ +public class SysUserOnline +{ + /** 会话编号 */ + private String tokenId; + + /** 部门名称 */ + private String deptName; + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + private Long userId; + + /** 用户名称 */ + private String userName; + + /** 登录IP地址 */ + private String ipaddr; + + /** 登录地址 */ + private String loginLocation; + + /** 浏览器类型 */ + private String browser; + + /** 操作系统 */ + private String os; + + /** 登录时间 */ + private Long loginTime; + + public String getTokenId() + { + return tokenId; + } + + public void setTokenId(String tokenId) + { + this.tokenId = tokenId; + } + + public String getDeptName() + { + return deptName; + } + + public void setDeptName(String deptName) + { + this.deptName = deptName; + } + + public String getUserName() + { + return userName; + } + + public void setUserName(String userName) + { + this.userName = userName; + } + + public String getIpaddr() + { + return ipaddr; + } + + public void setIpaddr(String ipaddr) + { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() + { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) + { + this.loginLocation = loginLocation; + } + + public String getBrowser() + { + return browser; + } + + public void setBrowser(String browser) + { + this.browser = browser; + } + + public String getOs() + { + return os; + } + + public void setOs(String os) + { + this.os = os; + } + + public Long getLoginTime() + { + return loginTime; + } + + public void setLoginTime(Long loginTime) + { + this.loginTime = loginTime; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java new file mode 100644 index 0000000000000000000000000000000000000000..9e024e35736b785486b0bfb43a86282ebc8a72a0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserPost.java @@ -0,0 +1,51 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 用户和岗位关联 sys_user_post + * + * @author ruoyi + */ +@TableName("sys_user_post") +public class SysUserPost +{ + /** 用户ID */ + @TableField(value = "user_id") + private Long userId; + + /** 岗位ID */ + @TableField(value = "post_id") + private Long postId; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getPostId() + { + return postId; + } + + public void setPostId(Long postId) + { + this.postId = postId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("postId", getPostId()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java new file mode 100644 index 0000000000000000000000000000000000000000..bde9e6f23b1e14aa8aa544820571f3150018c346 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserRole.java @@ -0,0 +1,62 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 用户和角色关联 sys_user_role + * + * @author ruoyi + */ +@TableName("sys_user_role") +public class SysUserRole +{ + /** 用户ID */ + @TableField(value = "user_id") + private Long userId; + + /** 角色ID */ + @TableField(value = "role_id") + private Long roleId; + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + @TableField(value = "role_name") + private String roleName; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("roleId", getRoleId()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/YwUserVenue.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/YwUserVenue.java new file mode 100644 index 0000000000000000000000000000000000000000..03b39394d66ea8a3e952798bcd61cc25c5605b7f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/YwUserVenue.java @@ -0,0 +1,12 @@ +package com.ruoyi.system.domain; + +import lombok.Data; + +@Data +public class YwUserVenue { + + private Long venueId; + + private String venueName; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java new file mode 100644 index 0000000000000000000000000000000000000000..a5d5fdccb82c6686ffed52f4318f9ef5f6a1a427 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java @@ -0,0 +1,106 @@ +package com.ruoyi.system.domain.vo; + +import com.ruoyi.common.utils.StringUtils; + +/** + * 路由显示信息 + * + * @author ruoyi + */ +public class MetaVo +{ + /** + * 设置该路由在侧边栏和面包屑中展示的名字 + */ + private String title; + + /** + * 设置该路由的图标,对应路径src/assets/icons/svg + */ + private String icon; + + /** + * 设置为true,则不会被 缓存 + */ + private boolean noCache; + + /** + * 内链地址(http(s)://开头) + */ + private String link; + + public MetaVo() + { + } + + public MetaVo(String title, String icon) + { + this.title = title; + this.icon = icon; + } + + public MetaVo(String title, String icon, boolean noCache) + { + this.title = title; + this.icon = icon; + this.noCache = noCache; + } + + public MetaVo(String title, String icon, String link) + { + this.title = title; + this.icon = icon; + this.link = link; + } + + public MetaVo(String title, String icon, boolean noCache, String link) + { + this.title = title; + this.icon = icon; + this.noCache = noCache; + if (StringUtils.ishttp(link)) + { + this.link = link; + } + } + + public boolean isNoCache() + { + return noCache; + } + + public void setNoCache(boolean noCache) + { + this.noCache = noCache; + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + public String getIcon() + { + return icon; + } + + public void setIcon(String icon) + { + this.icon = icon; + } + + public String getLink() + { + return link; + } + + public void setLink(String link) + { + this.link = link; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java new file mode 100644 index 0000000000000000000000000000000000000000..afff8c9c5e42c6aed9cbf2246bd27400089b3591 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java @@ -0,0 +1,148 @@ +package com.ruoyi.system.domain.vo; + +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; + +/** + * 路由配置信息 + * + * @author ruoyi + */ +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class RouterVo +{ + /** + * 路由名字 + */ + private String name; + + /** + * 路由地址 + */ + private String path; + + /** + * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现 + */ + private boolean hidden; + + /** + * 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 + */ + private String redirect; + + /** + * 组件地址 + */ + private String component; + + /** + * 路由参数:如 {"id": 1, "name": "ry"} + */ + private String query; + + /** + * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 + */ + private Boolean alwaysShow; + + /** + * 其他元素 + */ + private MetaVo meta; + + /** + * 子路由 + */ + private List children; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getPath() + { + return path; + } + + public void setPath(String path) + { + this.path = path; + } + + public boolean getHidden() + { + return hidden; + } + + public void setHidden(boolean hidden) + { + this.hidden = hidden; + } + + public String getRedirect() + { + return redirect; + } + + public void setRedirect(String redirect) + { + this.redirect = redirect; + } + + public String getComponent() + { + return component; + } + + public void setComponent(String component) + { + this.component = component; + } + + public String getQuery() + { + return query; + } + + public void setQuery(String query) + { + this.query = query; + } + + public Boolean getAlwaysShow() + { + return alwaysShow; + } + + public void setAlwaysShow(Boolean alwaysShow) + { + this.alwaysShow = alwaysShow; + } + + public MetaVo getMeta() + { + return meta; + } + + public void setMeta(MetaVo meta) + { + this.meta = meta; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserInfoVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserInfoVo.java new file mode 100644 index 0000000000000000000000000000000000000000..c9224966aaa3b7d2f8cae36b96865f9178a8a2e4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserInfoVo.java @@ -0,0 +1,10 @@ +package com.ruoyi.system.domain.vo; + +import lombok.Data; + +@Data +public class SysUserInfoVo { + + private String logoutTime; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserTypeInfoVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserTypeInfoVO.java new file mode 100644 index 0000000000000000000000000000000000000000..0c94578fd3a0236a3105d5ce785e5108d9b1d2da --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserTypeInfoVO.java @@ -0,0 +1,11 @@ +package com.ruoyi.system.domain.vo; + +import lombok.Data; + +@Data +public class UserTypeInfoVO { + + private String userType; + + private Integer num; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysAppMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysAppMenuMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..c94ab15766da1727706b53dccb19359306a4ff7b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysAppMenuMapper.java @@ -0,0 +1,127 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.domain.entity.SysAppMenu; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 菜单表 数据层 + * + * @author ruoyi + */ +public interface SysAppMenuMapper { + /** + * 查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + public List selectMenuList(SysAppMenu menu); + + /** + * 根据用户所有权限 + * + * @return 权限列表 + */ + public List selectMenuPerms(); + + /** + * 根据用户查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + public List selectMenuListByUserId(SysAppMenu menu); + + /** + * 根据角色ID查询权限 + * + * @param roleId 角色ID + * @return 权限列表 + */ + public List selectMenuPermsByRoleId(Long roleId); + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + public List selectMenuPermsByUserId(Long userId); + + /** + * 根据用户ID查询菜单 + * + * @return 菜单列表 + */ + public List selectMenuTreeAll(); + + /** + * 根据用户ID查询菜单 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuTreeByUserId(Long userId); + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @param menuCheckStrictly 菜单树选择项是否关联显示 + * @return 选中菜单列表 + */ + public List selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); + + /** + * 根据菜单ID查询信息 + * + * @param menuId 菜单ID + * @return 菜单信息 + */ + public SysAppMenu selectMenuById(Long menuId); + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int hasChildByMenuId(Long menuId); + + /** + * 新增菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int insertMenu(SysAppMenu menu); + + /** + * 修改菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int updateMenu(SysAppMenu menu); + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int deleteMenuById(Long menuId); + + /** + * 校验菜单名称是否唯一 + * + * @param menuName 菜单名称 + * @param parentId 父菜单ID + * @return 结果 + */ + public SysAppMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId); + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysAppRoleMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysAppRoleMenuMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..be2066d9474a287b15e06eb8fce0416df536fdc7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysAppRoleMenuMapper.java @@ -0,0 +1,47 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.system.domain.SysAppRoleMenu; +import com.ruoyi.system.domain.SysRoleMenu; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 角色与菜单关联表 数据层 + * + * @author ruoyi + */ +public interface SysAppRoleMenuMapper { + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int checkMenuExistRole(Long menuId); + + /** + * 通过角色ID删除角色和菜单关联 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteAppRoleMenuByRoleId(Long roleId); + + /** + * 批量删除角色菜单关联信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteAppRoleMenu(Long[] ids); + + + /** + * 批量新增角色菜单信息 + * + * @param appRoleMenuList 角色菜单列表 + * @return 结果 + */ + public int batchAppRoleMenu(List appRoleMenuList); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysAppUserMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysAppUserMenuMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..8936d619244fdb76979660a206030a8ac0b4a622 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysAppUserMenuMapper.java @@ -0,0 +1,50 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.domain.entity.SysAppMenu; +import com.ruoyi.system.domain.SysAppUserMenu; + +import java.util.List; + +/** + * 用户与菜单关联表 数据层 + * + * @author ruoyi + */ +public interface SysAppUserMenuMapper { + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int checkMenuExistUser(Long menuId); + + /** + * 通过用户ID删除角色和菜单关联 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteAppUserMenuByUserId(Long userId); + + /** + * 批量删除用户菜单关联信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteAppUserMenu(Long[] ids); + + /** + * 批量新增用户菜单信息 + * + * @param roleMenuList 用户菜单列表 + * @return 结果 + */ + public int batchAppUserMenu(List userMenuList); + + /** + * 获取个人定制菜单列表(sys_app_user_menu) + */ + List selectCustomList(Long userId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..0ed0c0af95450a6a992b20af3523b12ada1ee706 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java @@ -0,0 +1,68 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysConfig; + +/** + * 参数配置 数据层 + * + * @author ruoyi + */ +public interface SysConfigMapper +{ + /** + * 查询参数配置信息 + * + * @param config 参数配置信息 + * @return 参数配置信息 + */ + public SysConfig selectConfig(SysConfig config); + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + public List selectConfigList(SysConfig config); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数配置信息 + */ + public SysConfig checkConfigKeyUnique(String configKey); + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int insertConfig(SysConfig config); + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int updateConfig(SysConfig config); + + /** + * 删除参数配置 + * + * @param configId 参数ID + * @return 结果 + */ + public int deleteConfigById(Long configId); + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + * @return 结果 + */ + public int deleteConfigByIds(Long[] configIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..384a9b6cf999bd072fefff4f8aafab1c8a7ad42f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -0,0 +1,118 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.ruoyi.common.core.domain.entity.SysDept; + +/** + * 部门管理 数据层 + * + * @author ruoyi + */ +public interface SysDeptMapper +{ + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(SysDept dept); + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @param deptCheckStrictly 部门树选择项是否关联显示 + * @return 选中部门列表 + */ + public List selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public SysDept selectDeptById(Long deptId); + + /** + * 根据ID查询所有子部门 + * + * @param deptId 部门ID + * @return 部门列表 + */ + public List selectChildrenDeptById(Long deptId); + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + public int selectNormalChildrenDeptById(Long deptId); + + /** + * 是否存在子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + public int hasChildByDeptId(Long deptId); + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 + */ + public int checkDeptExistUser(Long deptId); + + /** + * 校验部门名称是否唯一 + * + * @param deptName 部门名称 + * @param parentId 父部门ID + * @return 结果 + */ + public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); + + /** + * 新增部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int insertDept(SysDept dept); + + /** + * 修改部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int updateDept(SysDept dept); + + /** + * 修改所在部门正常状态 + * + * @param deptIds 部门ID组 + */ + public void updateDeptStatusNormal(Long[] deptIds); + + /** + * 修改子元素关系 + * + * @param depts 子元素 + * @return 结果 + */ + public int updateDeptChildren(@Param("depts") List depts); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..52282be34b7552a6cfad54b418343d5896dfb874 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java @@ -0,0 +1,116 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.domain.entity.SysDictData; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 字典表 数据层 + * + * @author ruoyi + */ +public interface SysDictDataMapper +{ + /** + * 根据条件分页查询字典数据 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + public List selectDictDataList(SysDictData dictData); + + /** + * 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + public List selectDictDataByType(String dictType); + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue); + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValues 字典键值数组(null或空时查出所有) + * @return 字典标签 + */ + List selectDictLabelByValues(@Param("dictType")String dictType, @Param("dictValues")List dictValues); + + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + public SysDictData selectDictDataById(Long dictCode); + + /** + * 查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据 + */ + public int countDictDataByType(String dictType); + + /** + * 通过字典ID删除字典数据信息 + * + * @param dictCode 字典数据ID + * @return 结果 + */ + public int deleteDictDataById(Long dictCode); + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + * @return 结果 + */ + public int deleteDictDataByIds(Long[] dictCodes); + + /** + * 新增字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int insertDictData(SysDictData dictData); + + /** + * 修改字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int updateDictData(SysDictData dictData); + + /** + * 同步修改字典类型 + * + * @param oldDictType 旧字典类型 + * @param newDictType 新旧字典类型 + * @return 结果 + */ + public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType); + + /** + * 根据字典类型城市查询下属区域 + * + * @param cityValue 城市 + * @return 结果 + */ + List selectCountyByCity(@Param("cityValue")String cityValue); + + + String selectDictValue(@Param("dictType")String dictType,@Param("dictLable") String dictLable); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..5fb48fb63f0806fadcb0e6f6c3b0ded3a52d5321 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java @@ -0,0 +1,83 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.common.core.domain.entity.SysDictType; + +/** + * 字典表 数据层 + * + * @author ruoyi + */ +public interface SysDictTypeMapper +{ + /** + * 根据条件分页查询字典类型 + * + * @param dictType 字典类型信息 + * @return 字典类型集合信息 + */ + public List selectDictTypeList(SysDictType dictType); + + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + public List selectDictTypeAll(); + + /** + * 根据字典类型ID查询信息 + * + * @param dictId 字典类型ID + * @return 字典类型 + */ + public SysDictType selectDictTypeById(Long dictId); + + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + public SysDictType selectDictTypeByType(String dictType); + + /** + * 通过字典ID删除字典信息 + * + * @param dictId 字典ID + * @return 结果 + */ + public int deleteDictTypeById(Long dictId); + + /** + * 批量删除字典类型信息 + * + * @param dictIds 需要删除的字典ID + * @return 结果 + */ + public int deleteDictTypeByIds(Long[] dictIds); + + /** + * 新增字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + public int insertDictType(SysDictType dictType); + + /** + * 修改字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + public int updateDictType(SysDictType dictType); + + /** + * 校验字典类型称是否唯一 + * + * @param dictType 字典类型 + * @return 结果 + */ + public SysDictType checkDictTypeUnique(String dictType); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..6333d0a5b12296e21d966b9bec7c6a371caae9ed --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java @@ -0,0 +1,46 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysLogininfor; + +/** + * 系统访问日志情况信息 数据层 + * + * @author ruoyi + */ +public interface SysLogininforMapper +{ + /** + * 新增系统登录日志 + * + * @param logininfor 访问日志对象 + */ + public void insertLogininfor(SysLogininfor logininfor); + + /** + * 查询系统登录日志集合 + * + * @param logininfor 访问日志对象 + * @return 登录记录集合 + */ + public List selectLogininforList(SysLogininfor logininfor); + + /** + * 批量删除系统登录日志 + * + * @param infoIds 需要删除的登录日志ID + * @return 结果 + */ + public int deleteLogininforByIds(Long[] infoIds); + + /** + * 清空系统登录日志 + * + * @return 结果 + */ + public int cleanLogininfor(); + + public int deleteLogininforSchedule(); + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..60d6a7958397af8066cf1ad7963fcd041e32423d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java @@ -0,0 +1,127 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import org.apache.ibatis.annotations.Param; +import com.ruoyi.common.core.domain.entity.SysMenu; + +/** + * 菜单表 数据层 + * + * @author ruoyi + */ +public interface SysMenuMapper +{ + /** + * 查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + public List selectMenuList(SysMenu menu); + + /** + * 根据用户所有权限 + * + * @return 权限列表 + */ + public List selectMenuPerms(); + + /** + * 根据用户查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + public List selectMenuListByUserId(SysMenu menu); + + /** + * 根据角色ID查询权限 + * + * @param roleId 角色ID + * @return 权限列表 + */ + public List selectMenuPermsByRoleId(Long roleId); + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + public List selectMenuPermsByUserId(Long userId); + + /** + * 根据用户ID查询菜单 + * + * @return 菜单列表 + */ + public List selectMenuTreeAll(); + + /** + * 根据用户ID查询菜单 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuTreeByUserId(Long userId); + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @param menuCheckStrictly 菜单树选择项是否关联显示 + * @return 选中菜单列表 + */ + public List selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); + + public List selectMenuNameListByRoleId(@Param("roleId") Long roleId); + + /** + * 根据菜单ID查询信息 + * + * @param menuId 菜单ID + * @return 菜单信息 + */ + public SysMenu selectMenuById(Long menuId); + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int hasChildByMenuId(Long menuId); + + /** + * 新增菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int insertMenu(SysMenu menu); + + /** + * 修改菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int updateMenu(SysMenu menu); + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int deleteMenuById(Long menuId); + + /** + * 校验菜单名称是否唯一 + * + * @param menuName 菜单名称 + * @param parentId 父菜单ID + * @return 结果 + */ + public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..80f3359bda65fc2048c1e805237c36f107e78ed8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java @@ -0,0 +1,52 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysOperLog; + +/** + * 操作日志 数据层 + * + * @author ruoyi + */ +public interface SysOperLogMapper +{ + /** + * 新增操作日志 + * + * @param operLog 操作日志对象 + */ + public void insertOperlog(SysOperLog operLog); + + /** + * 查询系统操作日志集合 + * + * @param operLog 操作日志对象 + * @return 操作日志集合 + */ + public List selectOperLogList(SysOperLog operLog); + + /** + * 批量删除系统操作日志 + * + * @param operIds 需要删除的操作日志ID + * @return 结果 + */ + public int deleteOperLogByIds(Long[] operIds); + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + public SysOperLog selectOperLogById(Long operId); + + /** + * 清空操作日志 + */ + public void cleanOperLog(); + + + public int deleteOperLogSchedule(); + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..19be2274ad994fd8189d307881f62380c46260bf --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java @@ -0,0 +1,99 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysPost; + +/** + * 岗位信息 数据层 + * + * @author ruoyi + */ +public interface SysPostMapper +{ + /** + * 查询岗位数据集合 + * + * @param post 岗位信息 + * @return 岗位数据集合 + */ + public List selectPostList(SysPost post); + + /** + * 查询所有岗位 + * + * @return 岗位列表 + */ + public List selectPostAll(); + + /** + * 通过岗位ID查询岗位信息 + * + * @param postId 岗位ID + * @return 角色对象信息 + */ + public SysPost selectPostById(Long postId); + + /** + * 根据用户ID获取岗位选择框列表 + * + * @param userId 用户ID + * @return 选中岗位ID列表 + */ + public List selectPostListByUserId(Long userId); + + /** + * 查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + public List selectPostsByUserName(String userName); + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + public int deletePostById(Long postId); + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + */ + public int deletePostByIds(Long[] postIds); + + /** + * 修改岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int updatePost(SysPost post); + + /** + * 新增岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int insertPost(SysPost post); + + /** + * 校验岗位名称 + * + * @param postName 岗位名称 + * @return 结果 + */ + public SysPost checkPostNameUnique(String postName); + + /** + * 校验岗位编码 + * + * @param postCode 岗位编码 + * @return 结果 + */ + public SysPost checkPostCodeUnique(String postCode); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f9d3a2f39a84472b426175046cdffa9e8c167737 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleDeptMapper.java @@ -0,0 +1,44 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysRoleDept; + +/** + * 角色与部门关联表 数据层 + * + * @author ruoyi + */ +public interface SysRoleDeptMapper +{ + /** + * 通过角色ID删除角色和部门关联 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleDeptByRoleId(Long roleId); + + /** + * 批量删除角色部门关联信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteRoleDept(Long[] ids); + + /** + * 查询部门使用数量 + * + * @param deptId 部门ID + * @return 结果 + */ + public int selectCountRoleDeptByDeptId(Long deptId); + + /** + * 批量新增角色部门信息 + * + * @param roleDeptList 角色部门列表 + * @return 结果 + */ + public int batchRoleDept(List roleDeptList); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..3cb7238d6923da4fa8f20827c8d71e98b391ee27 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java @@ -0,0 +1,114 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import org.apache.ibatis.annotations.Param; + +/** + * 角色表 数据层 + * + * @author ruoyi + */ +public interface SysRoleMapper +{ + /** + * 根据条件分页查询角色数据 + * + * @param role 角色信息 + * @return 角色数据集合信息 + */ + public List selectRoleList(SysRole role); + + /** + * 根据用户ID查询角色 + * + * @param userId 用户ID + * @return 角色列表 + */ + public List selectRolePermissionByUserId(Long userId); + + /** + * 查询所有角色 + * + * @return 角色列表 + */ + public List selectRoleAll(); + + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + public List selectRoleListByUserId(Long userId); + + /** + * 通过角色ID查询角色 + * + * @param roleId 角色ID + * @return 角色对象信息 + */ + public SysRole selectRoleById(Long roleId); + + /** + * 根据用户ID查询角色 + * + * @param userName 用户名 + * @return 角色列表 + */ + public List selectRolesByUserName(String userName); + + /** + * 校验角色名称是否唯一 + * + * @param roleName 角色名称 + * @return 角色信息 + */ + public SysRole checkRoleNameUnique(String roleName); + + /** + * 校验角色权限是否唯一 + * + * @param roleKey 角色权限 + * @return 角色信息 + */ + public SysRole checkRoleKeyUnique(String roleKey); + + /** + * 修改角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int updateRole(SysRole role); + + /** + * 新增角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int insertRole(SysRole role); + + /** + * 通过角色ID删除角色 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleById(Long roleId); + + /** + * 批量删除角色信息 + * + * @param roleIds 需要删除的角色ID + * @return 结果 + */ + public int deleteRoleByIds(Long[] roleIds); + + /** + * 根据角色ID查询用户 + */ + List selectNameByUserId(Long userId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..af50e56d37d2a0df90dae71b9360845681b869ac --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java @@ -0,0 +1,45 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysRoleMenu; +import org.apache.ibatis.annotations.Param; + +/** + * 角色与菜单关联表 数据层 + * + * @author ruoyi + */ +public interface SysRoleMenuMapper +{ + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int checkMenuExistRole(Long menuId); + + /** + * 通过角色ID删除角色和菜单关联 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleMenuByRoleId(Long roleId); + + /** + * 批量删除角色菜单关联信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteRoleMenu(Long[] ids); + + /** + * 批量新增角色菜单信息 + * + * @param roleMenuList 角色菜单列表 + * @return 结果 + */ + public int batchRoleMenu(List roleMenuList); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..aa4eeef6ab11aa635389cc8db2a7d9b4dd5bce49 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java @@ -0,0 +1,191 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.system.domain.vo.SysUserInfoVo; +import com.ruoyi.system.domain.vo.UserTypeInfoVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户表 数据层 + * + * @author ruoyi + */ +@Mapper +public interface SysUserMapper +{ + /** + * 根据条件分页查询用户列表 + * + * @param sysUser 用户信息 + * @return 用户信息集合信息 + */ + public List selectUserList(SysUser sysUser); + + public List selectUserALL(SysUser sysUser); + + /** + * 根据条件分页查询用户列表 + * + * @param sysUser 用户信息 + * @return 用户信息集合信息 + */ + public List selectNoSceneUserList(SysUser sysUser); + + /** + * 查询没有专业的用户 + * + * @return 用户信息集合信息 + */ + public List selectNoSpecUserList(SysUser sysUser); + + /** + * 根据条件分页查询已配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectAllocatedList(SysUser user); + + /** + * 根据条件分页查询未分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUnallocatedList(SysUser user); + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public SysUser selectUserByUserName(String userName); + + /** + * 通过用户昵称查询用户 + * + * @param nickName 用户名 + * @return 用户对象信息 + */ + public List selectUserByNickName(String nickName); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + public SysUser selectUserById(Long userId); + + public SysUser selectAllUserById(Long userId); + + public SysUser selectUserByPhone(String phone); + + public List selectUserListByPhones(@Param("phones") String[] phones); + + /** + * 新增用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int insertUser(SysUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(SysUser user); + + /** + * 修改用户登录信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserLogin(SysUser user); + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + public int resetUserPwd(@Param("userName") String userName, @Param("password") String password); + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserById(Long userId); + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + public int deleteUserByIds(Long[] userIds); + + /** + * 校验用户名称是否唯一 + * + * @param userName 用户名称 + * @return 结果 + */ + public SysUser checkUserNameUnique(String userName); + + /** + * 校验手机号码是否唯一 + * + * @param phonenumber 手机号码 + * @return 结果 + */ + public SysUser checkPhoneUnique(String phonenumber); + + /** + * 校验email是否唯一 + * + * @param email 用户邮箱 + * @return 结果 + */ + public SysUser checkEmailUnique(String email); + + + public SysUserInfoVo getUserInfo(String userName); + + List selectUserByUserNameAndPhone(@Param("phone") String phone); + + List selectUserByIds(@Param("userIds") List userIds); + + List selectUserByRoleIdsAndSceneId(@Param("roleIds") Long[] roleIds,@Param("sceneId") Long sceneId); + + + List selectCheckUserIdList(); + + SysUser selectUserByNickNameAndPhone(@Param("nickName")String nickName,@Param("phone") String phone); + + List selectUserByRoleKey(@Param("roleKey")String roleKey); + + List selectUserByUserType(); + + List selectUserByKeywords(@Param("keywords")String keywords,@Param("sceneId")Long sceneId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..e08991deef03ed58d9dc50e5c5344332abe91fe0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java @@ -0,0 +1,44 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysUserPost; + +/** + * 用户与岗位关联表 数据层 + * + * @author ruoyi + */ +public interface SysUserPostMapper +{ + /** + * 通过用户ID删除用户和岗位关联 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserPostByUserId(Long userId); + + /** + * 通过岗位ID查询岗位使用数量 + * + * @param postId 岗位ID + * @return 结果 + */ + public int countUserPostById(Long postId); + + /** + * 批量删除用户和岗位关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteUserPost(Long[] ids); + + /** + * 批量新增用户岗位信息 + * + * @param userPostList 用户角色列表 + * @return 结果 + */ + public int batchUserPost(List userPostList); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..d0e3fc9314da16b97a7b9b7f1040883ec781f0cf --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java @@ -0,0 +1,77 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.system.domain.SysUserRole; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户与角色关联表 数据层 + * + * @author ruoyi + */ +public interface SysUserRoleMapper +{ + /** + * 通过用户ID删除用户和角色关联 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserRoleByUserId(Long userId); + + /** + * 批量删除用户和角色关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteUserRole(Long[] ids); + + /** + * 通过角色ID查询角色使用数量 + * + * @param roleId 角色ID + * @return 结果 + */ + public int countUserRoleByRoleId(Long roleId); + + /** + * 批量新增用户角色信息 + * + * @param userRoleList 用户角色列表 + * @return 结果 + */ + public int batchUserRole(List userRoleList); + + /** + * 删除用户和角色关联信息 + * + * @param userRole 用户和角色关联信息 + * @return 结果 + */ + public int deleteUserRoleInfo(SysUserRole userRole); + + /** + * 批量取消授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要删除的用户数据ID + * @return 结果 + */ + public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds); + + /** + * 查询用户是否有某一角色 + * + * @param userId 用户ID + * @param roleKey 角色key + * @return 结果 + */ + public SysUserRole hasRole(@Param("userId") Long userId,@Param("roleKey")String roleKey); + + public List selectRolePermissionByUserIds(@Param("userIds") List userIds); + + public List selectRoleByUserId(@Param("userId") Long userId); + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserVenueMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserVenueMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..745895b3d42108d1f93955f4d86331500cc854ac --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserVenueMapper.java @@ -0,0 +1,17 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.system.domain.SysUserRole; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户与角色关联表 数据层 + * + * @author ruoyi + */ +public interface SysUserVenueMapper +{ + public int deleteUserVenue(Long[] userId); + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysAppMenuService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysAppMenuService.java new file mode 100644 index 0000000000000000000000000000000000000000..1037fb75f799c2c8e7bc4714bb6f872468ceac75 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysAppMenuService.java @@ -0,0 +1,154 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.TreeSelect; +import com.ruoyi.common.core.domain.entity.SysAppMenu; +import com.ruoyi.system.domain.vo.RouterVo; + +import java.util.List; +import java.util.Set; + +/** + * 菜单 业务层 app + * + * @author ruoyi + */ +public interface ISysAppMenuService { + /** + * 根据用户查询系统菜单列表 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuList(Long userId); + + /** + * 根据用户查询系统菜单列表 + * + * @param menu 菜单信息 + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuList(SysAppMenu menu, Long userId); + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + public Set selectMenuPermsByUserId(Long userId); + + /** + * 根据角色ID查询权限 + * + * @param roleId 角色ID + * @return 权限列表 + */ + public Set selectMenuPermsByRoleId(Long roleId); + + /** + * 根据用户ID查询菜单树信息 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuTreeByUserId(Long userId); + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @return 选中菜单列表 + */ + public List selectMenuListByRoleId(Long roleId,Boolean menuCheckStrictly); + + /** + * 构建前端路由所需要的菜单 + * + * @param menus 菜单列表 + * @return 路由列表 + */ + public List buildMenus(List menus); + + /** + * 构建前端所需要树结构 + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + public List buildMenuTree(List menus); + + /** + * 构建前端所需要下拉树结构 + * + * @param menus 菜单列表 + * @return 下拉树结构列表 + */ + public List buildMenuTreeSelect(List menus); + + /** + * 根据菜单ID查询信息 + * + * @param menuId 菜单ID + * @return 菜单信息 + */ + public SysAppMenu selectMenuById(Long menuId); + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 true 存在 false 不存在 + */ + public boolean hasChildByMenuId(Long menuId); + + /** + * 查询菜单是否存在角色 + * + * @param menuId 菜单ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkMenuExistRole(Long menuId); + + /** + * 新增保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int insertMenu(SysAppMenu menu); + + /** + * 修改保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int updateMenu(SysAppMenu menu); + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int deleteMenuById(Long menuId); + + /** + * 校验菜单名称是否唯一 + * + * @param menu 菜单信息 + * @return 结果 + */ + public String checkMenuNameUnique(SysAppMenu menu); + + /** + * 获取个人定制菜单列表(sys_app_user_menu) + */ + List selectCustomList(Long userId); + + /** + * 更改个人定制菜单列表(sys_app_user_menu) + */ + Boolean updateCustomList(Long userId,List menuIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..f6af7b02d49b3a16d2560a74556cb16abcc8a837 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java @@ -0,0 +1,92 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.SysConfig; + +/** + * 参数配置 服务层 + * + * @author ruoyi + */ +public interface ISysConfigService +{ + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + public SysConfig selectConfigById(Long configId); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数键值 + */ + public String selectConfigByKey(String configKey); + + /** + * 获取验证码开关 + * + * @return true开启,false关闭 + */ + public boolean selectCaptchaEnabled(); + + + public boolean selectDistinctEnabled(); + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + public List selectConfigList(SysConfig config); + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int insertConfig(SysConfig config); + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int updateConfig(SysConfig config); + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + */ + public void deleteConfigByIds(Long[] configIds); + + /** + * 加载参数缓存数据 + */ + public void loadingConfigCache(); + + /** + * 清空参数缓存数据 + */ + public void clearConfigCache(); + + /** + * 重置参数缓存数据 + */ + public void resetConfigCache(); + + /** + * 校验参数键名是否唯一 + * + * @param config 参数信息 + * @return 结果 + */ + public String checkConfigKeyUnique(SysConfig config); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java new file mode 100644 index 0000000000000000000000000000000000000000..166ba1689200959a72d93910ad401b1195aac636 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java @@ -0,0 +1,124 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.common.core.domain.TreeSelect; +import com.ruoyi.common.core.domain.entity.SysDept; + +/** + * 部门管理 服务层 + * + * @author ruoyi + */ +public interface ISysDeptService +{ + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(SysDept dept); + + /** + * 查询部门树结构信息 + * + * @param dept 部门信息 + * @return 部门树信息集合 + */ + public List selectDeptTreeList(SysDept dept); + + /** + * 构建前端所需要树结构 + * + * @param depts 部门列表 + * @return 树结构列表 + */ + public List buildDeptTree(List depts); + + /** + * 构建前端所需要下拉树结构 + * + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + public List buildDeptTreeSelect(List depts); + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @return 选中部门列表 + */ + public List selectDeptListByRoleId(Long roleId); + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public SysDept selectDeptById(Long deptId); + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + public int selectNormalChildrenDeptById(Long deptId); + + /** + * 是否存在部门子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + public boolean hasChildByDeptId(Long deptId); + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkDeptExistUser(Long deptId); + + /** + * 校验部门名称是否唯一 + * + * @param dept 部门信息 + * @return 结果 + */ + public String checkDeptNameUnique(SysDept dept); + + /** + * 校验部门是否有数据权限 + * + * @param deptId 部门id + */ + public void checkDeptDataScope(Long deptId); + + /** + * 新增保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int insertDept(SysDept dept); + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int updateDept(SysDept dept); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java new file mode 100644 index 0000000000000000000000000000000000000000..65a16d93f4eaf7be8bdd2ef5ca0958bdc6fb079e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java @@ -0,0 +1,78 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.common.core.domain.entity.SysDictData; + +/** + * 字典 业务层 + * + * @author ruoyi + */ +public interface ISysDictDataService +{ + /** + * 根据条件分页查询字典数据 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + public List selectDictDataList(SysDictData dictData); + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + public String selectDictLabel(String dictType, String dictValue); + + /** + * 根据字典类型和字典标签查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictLable 字典键值 + * @return 字典标签 + */ + public String selectDictValue(String dictType, String dictLable); + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValues 字典键值数组(null或空时查出所有) + * @return 字典标签 + */ + public List selectDictLabelByValues(String dictType, List dictValues); + + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + public SysDictData selectDictDataById(Long dictCode); + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + */ + public void deleteDictDataByIds(Long[] dictCodes); + + /** + * 新增保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int insertDictData(SysDictData dictData); + + /** + * 修改保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + public int updateDictData(SysDictData dictData); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java new file mode 100644 index 0000000000000000000000000000000000000000..267bcf9c2be701692b32cadb2b8593efd9c54ad4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java @@ -0,0 +1,106 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysDictType; + +/** + * 字典 业务层 + * + * @author ruoyi + */ +public interface ISysDictTypeService +{ + /** + * 根据条件分页查询字典类型 + * + * @param dictType 字典类型信息 + * @return 字典类型集合信息 + */ + public List selectDictTypeList(SysDictType dictType); + + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + public List selectDictTypeAll(); + + /** + * 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + public List selectDictDataByType(String dictType); + + /** + * 根据字典类型ID查询信息 + * + * @param dictId 字典类型ID + * @return 字典类型 + */ + public SysDictType selectDictTypeById(Long dictId); + + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + public SysDictType selectDictTypeByType(String dictType); + + /** + * 批量删除字典信息 + * + * @param dictIds 需要删除的字典ID + */ + public void deleteDictTypeByIds(Long[] dictIds); + + /** + * 加载字典缓存数据 + */ + public void loadingDictCache(); + + /** + * 清空字典缓存数据 + */ + public void clearDictCache(); + + /** + * 重置字典缓存数据 + */ + public void resetDictCache(); + + /** + * 新增保存字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + public int insertDictType(SysDictType dictType); + + /** + * 修改保存字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + public int updateDictType(SysDictType dictType); + + /** + * 校验字典类型称是否唯一 + * + * @param dictType 字典类型 + * @return 结果 + */ + public String checkDictTypeUnique(SysDictType dictType); + + /** + * 根据字典类型城市查询下属区域 + * + * @param cityValue 城市 + * @return 结果 + */ + List selectCountyByCity(String cityValue); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java new file mode 100644 index 0000000000000000000000000000000000000000..ce3151d3d9f9a0a3d5476dee1ae7bac4d808e63e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java @@ -0,0 +1,40 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.SysLogininfor; + +/** + * 系统访问日志情况信息 服务层 + * + * @author ruoyi + */ +public interface ISysLogininforService +{ + /** + * 新增系统登录日志 + * + * @param logininfor 访问日志对象 + */ + public void insertLogininfor(SysLogininfor logininfor); + + /** + * 查询系统登录日志集合 + * + * @param logininfor 访问日志对象 + * @return 登录记录集合 + */ + public List selectLogininforList(SysLogininfor logininfor); + + /** + * 批量删除系统登录日志 + * + * @param infoIds 需要删除的登录日志ID + * @return 结果 + */ + public int deleteLogininforByIds(Long[] infoIds); + + /** + * 清空系统登录日志 + */ + public void cleanLogininfor(); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java new file mode 100644 index 0000000000000000000000000000000000000000..5a59bcb5d36f3640f02bffc9da09dbfdb353cb18 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java @@ -0,0 +1,146 @@ +package com.ruoyi.system.service; + +import java.util.List; +import java.util.Set; +import com.ruoyi.common.core.domain.TreeSelect; +import com.ruoyi.common.core.domain.entity.SysMenu; +import com.ruoyi.system.domain.vo.RouterVo; + +/** + * 菜单 业务层 + * + * @author ruoyi + */ +public interface ISysMenuService +{ + /** + * 根据用户查询系统菜单列表 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuList(Long userId); + + /** + * 根据用户查询系统菜单列表 + * + * @param menu 菜单信息 + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuList(SysMenu menu, Long userId); + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + public Set selectMenuPermsByUserId(Long userId); + + /** + * 根据角色ID查询权限 + * + * @param roleId 角色ID + * @return 权限列表 + */ + public Set selectMenuPermsByRoleId(Long roleId); + + /** + * 根据用户ID查询菜单树信息 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuTreeByUserId(Long userId); + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @return 选中菜单列表 + */ + public List selectMenuListByRoleId(Long roleId,Boolean menuCheckStrictly); + + public List selectMenuNameListByRoleId(Long roleId); + + /** + * 构建前端路由所需要的菜单 + * + * @param menus 菜单列表 + * @return 路由列表 + */ + public List buildMenus(List menus); + + /** + * 构建前端所需要树结构 + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + public List buildMenuTree(List menus); + + /** + * 构建前端所需要下拉树结构 + * + * @param menus 菜单列表 + * @return 下拉树结构列表 + */ + public List buildMenuTreeSelect(List menus); + + /** + * 根据菜单ID查询信息 + * + * @param menuId 菜单ID + * @return 菜单信息 + */ + public SysMenu selectMenuById(Long menuId); + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 true 存在 false 不存在 + */ + public boolean hasChildByMenuId(Long menuId); + + /** + * 查询菜单是否存在角色 + * + * @param menuId 菜单ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkMenuExistRole(Long menuId); + + /** + * 新增保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int insertMenu(SysMenu menu); + + /** + * 修改保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public int updateMenu(SysMenu menu); + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int deleteMenuById(Long menuId); + + /** + * 校验菜单名称是否唯一 + * + * @param menu 菜单信息 + * @return 结果 + */ + public String checkMenuNameUnique(SysMenu menu); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..4fd8e5a851cbfe51b6536bb9e90068223f382bdc --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java @@ -0,0 +1,48 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.SysOperLog; + +/** + * 操作日志 服务层 + * + * @author ruoyi + */ +public interface ISysOperLogService +{ + /** + * 新增操作日志 + * + * @param operLog 操作日志对象 + */ + public void insertOperlog(SysOperLog operLog); + + /** + * 查询系统操作日志集合 + * + * @param operLog 操作日志对象 + * @return 操作日志集合 + */ + public List selectOperLogList(SysOperLog operLog); + + /** + * 批量删除系统操作日志 + * + * @param operIds 需要删除的操作日志ID + * @return 结果 + */ + public int deleteOperLogByIds(Long[] operIds); + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + public SysOperLog selectOperLogById(Long operId); + + /** + * 清空操作日志 + */ + public void cleanOperLog(); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java new file mode 100644 index 0000000000000000000000000000000000000000..4ffee397021d3909e79be8a0ca770fed047b6712 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java @@ -0,0 +1,99 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.SysPost; + +/** + * 岗位信息 服务层 + * + * @author ruoyi + */ +public interface ISysPostService +{ + /** + * 查询岗位信息集合 + * + * @param post 岗位信息 + * @return 岗位列表 + */ + public List selectPostList(SysPost post); + + /** + * 查询所有岗位 + * + * @return 岗位列表 + */ + public List selectPostAll(); + + /** + * 通过岗位ID查询岗位信息 + * + * @param postId 岗位ID + * @return 角色对象信息 + */ + public SysPost selectPostById(Long postId); + + /** + * 根据用户ID获取岗位选择框列表 + * + * @param userId 用户ID + * @return 选中岗位ID列表 + */ + public List selectPostListByUserId(Long userId); + + /** + * 校验岗位名称 + * + * @param post 岗位信息 + * @return 结果 + */ + public String checkPostNameUnique(SysPost post); + + /** + * 校验岗位编码 + * + * @param post 岗位信息 + * @return 结果 + */ + public String checkPostCodeUnique(SysPost post); + + /** + * 通过岗位ID查询岗位使用数量 + * + * @param postId 岗位ID + * @return 结果 + */ + public int countUserPostById(Long postId); + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + public int deletePostById(Long postId); + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + */ + public int deletePostByIds(Long[] postIds); + + /** + * 新增保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int insertPost(SysPost post); + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int updatePost(SysPost post); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java new file mode 100644 index 0000000000000000000000000000000000000000..0bc73ce6fdd18a90ca5fb2032da8c338ad43c435 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java @@ -0,0 +1,195 @@ +package com.ruoyi.system.service; + +import java.util.List; +import java.util.Set; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.system.domain.SysUserRole; + +/** + * 角色业务层 + * + * @author ruoyi + */ +public interface ISysRoleService +{ + /** + * 根据条件分页查询角色数据 + * + * @param role 角色信息 + * @return 角色数据集合信息 + */ + public List selectRoleList(SysRole role); + + /** + * 根据用户ID查询角色列表 + * + * @param userId 用户ID + * @return 角色列表 + */ + public List selectRolesByUserId(Long userId); + + /** + * 根据用户ID查询同场馆拥有相同角色人员姓名 + */ + public List selectNameByUserId(Long userId); + + //RUOYI的原生方法不符合需求,没有改,另外加一个 + public List selectRolesByUserId2(Long userId); + + + public List selectRolesByUserIds(List userIds); + + /** + * 根据用户ID查询角色权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + public Set selectRolePermissionByUserId(Long userId); + + /** + * 查询所有角色 + * + * @return 角色列表 + */ + public List selectRoleAll(); + + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + public List selectRoleListByUserId(Long userId); + + /** + * 通过角色ID查询角色 + * + * @param roleId 角色ID + * @return 角色对象信息 + */ + public SysRole selectRoleById(Long roleId); + + /** + * 校验角色名称是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + public String checkRoleNameUnique(SysRole role); + + /** + * 校验角色权限是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + public String checkRoleKeyUnique(SysRole role); + + /** + * 校验角色是否允许操作 + * + * @param role 角色信息 + */ + public void checkRoleAllowed(SysRole role); + + /** + * 校验角色是否有数据权限 + * + * @param roleId 角色id + */ + public void checkRoleDataScope(Long roleId); + + /** + * 通过角色ID查询角色使用数量 + * + * @param roleId 角色ID + * @return 结果 + */ + public int countUserRoleByRoleId(Long roleId); + + /** + * 新增保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int insertRole(SysRole role); + + /** + * 修改保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int updateRole(SysRole role); + + /** + * 修改保存角色信息 app + * + * @param role 角色信息 + * @return 结果 + */ + public int updateAppRole(SysRole role); + + /** + * 修改角色状态 + * + * @param role 角色信息 + * @return 结果 + */ + public int updateRoleStatus(SysRole role); + + /** + * 修改数据权限信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int authDataScope(SysRole role); + + /** + * 通过角色ID删除角色 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleById(Long roleId); + + /** + * 批量删除角色信息 + * + * @param roleIds 需要删除的角色ID + * @return 结果 + */ + public int deleteRoleByIds(Long[] roleIds); + + /** + * 取消授权用户角色 + * + * @param userRole 用户和角色关联信息 + * @return 结果 + */ + public int deleteAuthUser(SysUserRole userRole); + + /** + * 批量取消授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要取消授权的用户数据ID + * @return 结果 + */ + public int deleteAuthUsers(Long roleId, Long[] userIds); + + /** + * 批量选择授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要删除的用户数据ID + * @return 结果 + */ + public int insertAuthUsers(Long roleId, Long[] userIds); + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java new file mode 100644 index 0000000000000000000000000000000000000000..8eb5448cdeacc288d9d2efec79a7395739ed285b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java @@ -0,0 +1,48 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.system.domain.SysUserOnline; + +/** + * 在线用户 服务层 + * + * @author ruoyi + */ +public interface ISysUserOnlineService +{ + /** + * 通过登录地址查询信息 + * + * @param ipaddr 登录地址 + * @param user 用户信息 + * @return 在线用户信息 + */ + public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); + + /** + * 通过用户名称查询信息 + * + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + public SysUserOnline selectOnlineByUserName(String userName, LoginUser user); + + /** + * 通过登录地址/用户名称查询信息 + * + * @param ipaddr 登录地址 + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); + + /** + * 设置在线用户信息 + * + * @param user 用户信息 + * @return 在线用户 + */ + public SysUserOnline loginUserToUserOnline(LoginUser user); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java new file mode 100644 index 0000000000000000000000000000000000000000..e6a0d0d538db38ea6af705f1761bd4020191aaf4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java @@ -0,0 +1,267 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.system.domain.vo.SysUserInfoVo; +import com.ruoyi.system.domain.vo.UserTypeInfoVO; + +import java.util.HashMap; +import java.util.List; + +/** + * 用户 业务层 + * + * @author ruoyi + */ +public interface ISysUserService +{ + + public List selectUserListALL(SysUser sysUser); + + + /** + * 根据条件分页查询用户列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUserList(SysUser user); + + /** + * 根据条件分页查询用户列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public HashMap> selectUserSpecList(SysUser user); + + /** + * 根据条件分页查询已分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectAllocatedList(SysUser user); + + /** + * 根据条件分页查询未分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + public List selectUnallocatedList(SysUser user); + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public SysUser selectUserByUserName(String userName); + + /** + * 通过用户昵称查询用户 + * + * @param nickName 昵称 + * @return 用户对象信息 + */ + public List selectUserByNickName(String nickName); + + /** + * 通过用户昵称和手机号查询用户 + * + * @param nickName 昵称 + * @return 用户对象信息 + */ + public SysUser selectUserByNickNameAndPhone(String nickName,String phone); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + public SysUser selectUserById(Long userId); + + + public SysUser selectAllUserById(Long userId); + + /** + * 通过用户IDs查询用户 + * + * @param userIds 用户ID + * @return 用户对象信息 + */ + public List selectUserByIds(List userIds); + + /** + * 通过角色ids与场馆id查询用户 + */ + public List selectUserByRoleIdsAndSceneId(Long[] roleIds,Long sceneId); + + + public SysUser selectUserByPhone(String phone); + + public List selectUserListByPhones(String[] phones); + + /** + * 根据用户ID查询用户所属角色组 + * + * @param userName 用户名 + * @return 结果 + */ + public String selectUserRoleGroup(String userName); + + /** + * 根据用户ID查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + public String selectUserPostGroup(String userName); + + /** + * 校验用户名称是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + public String checkUserNameUnique(SysUser user); + + /** + * 校验手机号码是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + public String checkPhoneUnique(SysUser user); + + /** + * 校验email是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + public String checkEmailUnique(SysUser user); + + /** + * 校验用户是否允许操作 + * + * @param user 用户信息 + */ + public void checkUserAllowed(SysUser user); + + /** + * 校验用户是否有数据权限 + * + * @param userId 用户id + */ + public void checkUserDataScope(Long userId); + + /** + * 新增用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int insertUser(SysUser user); + + /** + * 注册用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public boolean registerUser(SysUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(SysUser user); + + /** + * 用户授权角色 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + public void insertUserAuth(Long userId, Long[] roleIds); + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserStatus(SysUser user); + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserProfile(SysUser user); + + + public int updateUserLogin(SysUser user); + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + public boolean updateUserAvatar(String userName, String avatar); + + /** + * 重置用户密码 + * + * @param user 用户信息 + * @return 结果 + */ + public int resetPwd(SysUser user); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + public int resetUserPwd(String userName, String password); + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserById(Long userId); + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + public int deleteUserByIds(Long[] userIds); + + /** + * 导入用户数据 + * + * @param userList 用户数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + public String importUser(List userList, Boolean isUpdateSupport, String operName); + + + public SysUserInfoVo getUserInfo(String userName); + + List selectUserByUserType(); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysAppMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysAppMenuServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..8ac4596d2ed2ea1247d805913fbb313ae2c40da7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysAppMenuServiceImpl.java @@ -0,0 +1,549 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.TreeSelect; +import com.ruoyi.common.core.domain.entity.SysAppMenu; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysAppUserMenu; +import com.ruoyi.system.domain.vo.MetaVo; +import com.ruoyi.system.domain.vo.RouterVo; +import com.ruoyi.system.mapper.*; +import com.ruoyi.system.service.ISysAppMenuService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 菜单 业务层处理 + * + * @author ruoyi + */ +@Service +@Slf4j +public class SysAppMenuServiceImpl implements ISysAppMenuService { + public static final String PREMISSION_STRING = "perms[\"{0}\"]"; + + @Autowired + private SysAppMenuMapper appMenuMapper; + + @Autowired + private SysRoleMapper roleMapper; + + @Autowired + private SysAppRoleMenuMapper appRoleMenuMapper; + + @Autowired + private SysAppUserMenuMapper appUserMenuMapper; + + @Autowired + private SysUserMapper sysUserMapper; + + /** 文件访问地址前缀 */ + @Value("${file.visitpath}") + private String visitpath; + + /** + * 根据用户查询系统菜单列表 + * + * @param userId 用户ID + * @return 菜单列表 + */ + @Override + public List selectMenuList(Long userId) { + return selectMenuList(new SysAppMenu(), userId); + } + + /** + * 查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + @Override + public List selectMenuList(SysAppMenu menu, Long userId) { + List menuList = null; + + //根据专业去除告警菜单 + SysUser user = sysUserMapper.selectUserById(userId); + + // 管理员显示所有菜单信息 + if (SysUser.isAdmin(userId)) { + menuList = appMenuMapper.selectMenuList(menu); + } else { + menu.getParams().put("userId", userId); + menuList = appMenuMapper.selectMenuListByUserId(menu); + } + //拼接Url +// for (SysAppMenu sysAppMenu : menuList) { +// sysAppMenu.setIcon(visitpath+sysAppMenu.getIcon()); +// } + String userType = user.getUserType(); + List alarmMenus = menuList.stream().filter(l -> l.getParentId() == 101 && !"挂起".equals(l.getMenuName()) && !"亚运事件".equals(l.getMenuName()) && !"告警闭环".equals(l.getMenuName())).collect(Collectors.toList()); + if ("wx".equals(userType)) { + alarmMenus.removeIf(l -> "无线告警".equals(l.getMenuName())); + menuList.removeAll(alarmMenus); + } + if ("cs".equals(userType)) { + alarmMenus.removeIf(l -> "传输告警".equals(l.getMenuName())); + menuList.removeAll(alarmMenus); + } + if ("dh".equals(userType)) { + alarmMenus.removeIf(l -> "动环告警".equals(l.getMenuName())); + menuList.removeAll(alarmMenus); + } + if ("zw".equals(userType)) { + alarmMenus.removeIf(l -> "AGIS告警".equals(l.getMenuName()) || "互联网告警".equals(l.getMenuName()) || "固话告警".equals(l.getMenuName())); + menuList.removeAll(alarmMenus); + } + return menuList; + } + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + @Override + public Set selectMenuPermsByUserId(Long userId) { + List perms = appMenuMapper.selectMenuPermsByUserId(userId); + Set permsSet = new HashSet<>(); + for (String perm : perms) { + if (StringUtils.isNotEmpty(perm)) { + permsSet.addAll(Arrays.asList(perm.trim().split(","))); + } + } + return permsSet; + } + + /** + * 根据角色ID查询权限 + * + * @param roleId 角色ID + * @return 权限列表 + */ + @Override + public Set selectMenuPermsByRoleId(Long roleId) { + List perms = appMenuMapper.selectMenuPermsByRoleId(roleId); + Set permsSet = new HashSet<>(); + for (String perm : perms) { + if (StringUtils.isNotEmpty(perm)) { + permsSet.addAll(Arrays.asList(perm.trim().split(","))); + } + } + return permsSet; + } + + /** + * 根据用户ID查询菜单 + * + * @param userId 用户名称 + * @return 菜单列表 + */ + @Override + public List selectMenuTreeByUserId(Long userId) { + List menus = null; + if (SecurityUtils.isAdmin(userId)) { + menus = appMenuMapper.selectMenuTreeAll(); + } else { + menus = appMenuMapper.selectMenuTreeByUserId(userId); + } + return getChildPerms(menus, 0); + } + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @return 选中菜单列表 + */ + @Override + public List selectMenuListByRoleId(Long roleId,Boolean menuCheckStrictly) { + SysRole role = roleMapper.selectRoleById(roleId); + return appMenuMapper.selectMenuListByRoleId(roleId, menuCheckStrictly); + } + + /** + * 构建前端路由所需要的菜单 + * + * @param menus 菜单列表 + * @return 路由列表 + */ + @Override + public List buildMenus(List menus) { + List routers = new LinkedList(); + for (SysAppMenu menu : menus) { + RouterVo router = new RouterVo(); + router.setHidden("1".equals(menu.getVisible())); + router.setName(getRouteName(menu)); + router.setPath(getRouterPath(menu)); + router.setComponent(getComponent(menu)); + router.setQuery(menu.getQuery()); + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + List cMenus = menu.getChildren(); + if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { + router.setAlwaysShow(true); + router.setRedirect("noRedirect"); + router.setChildren(buildMenus(cMenus)); + } else if (isMenuFrame(menu)) { + router.setMeta(null); + List childrenList = new ArrayList(); + RouterVo children = new RouterVo(); + children.setPath(menu.getPath()); + children.setComponent(menu.getComponent()); + children.setName(StringUtils.capitalize(menu.getPath())); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + children.setQuery(menu.getQuery()); + childrenList.add(children); + router.setChildren(childrenList); + } else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) { + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); + router.setPath("/"); + List childrenList = new ArrayList(); + RouterVo children = new RouterVo(); + String routerPath = innerLinkReplaceEach(menu.getPath()); + children.setPath(routerPath); + children.setComponent(UserConstants.INNER_LINK); + children.setName(StringUtils.capitalize(routerPath)); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); + childrenList.add(children); + router.setChildren(childrenList); + } + routers.add(router); + } + return routers; + } + + /** + * 构建前端所需要树结构 + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + @Override + public List buildMenuTree(List menus) { + List returnList = new ArrayList(); + List tempList = menus.stream().map(SysAppMenu::getMenuId).collect(Collectors.toList()); + for (Iterator iterator = menus.iterator(); iterator.hasNext(); ) { + SysAppMenu menu = (SysAppMenu) iterator.next(); + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(menu.getParentId())) { + recursionFn(menus, menu); + returnList.add(menu); + } + } + if (returnList.isEmpty()) { + returnList = menus; + } + return returnList; + } + + /** + * 构建前端所需要下拉树结构 + * + * @param menus 菜单列表 + * @return 下拉树结构列表 + */ + @Override + public List buildMenuTreeSelect(List menus) { + List menuTrees = buildMenuTree(menus); + return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + /** + * 根据菜单ID查询信息 + * + * @param menuId 菜单ID + * @return 菜单信息 + */ + @Override + public SysAppMenu selectMenuById(Long menuId) { + return appMenuMapper.selectMenuById(menuId); + } + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public boolean hasChildByMenuId(Long menuId) { + int result = appMenuMapper.hasChildByMenuId(menuId); + return result > 0; + } + + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public boolean checkMenuExistRole(Long menuId) { + int result = appRoleMenuMapper.checkMenuExistRole(menuId); + return result > 0; + } + + /** + * 新增保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public int insertMenu(SysAppMenu menu) { + return appMenuMapper.insertMenu(menu); + } + + /** + * 修改保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public int updateMenu(SysAppMenu menu) { + return appMenuMapper.updateMenu(menu); + } + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public int deleteMenuById(Long menuId) { + return appMenuMapper.deleteMenuById(menuId); + } + + /** + * 校验菜单名称是否唯一 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public String checkMenuNameUnique(SysAppMenu menu) { + Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); + SysAppMenu info = appMenuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId()); + if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public List selectCustomList(Long userId) { + SysAppMenu sysAppMenu = new SysAppMenu(); + List allAppMenus = selectMenuList(sysAppMenu,userId); + List customAppMenus = appUserMenuMapper.selectCustomList(userId); + //为空时新增一次 + if(CollUtil.isEmpty(customAppMenus)){ + ArrayList userMenus = new ArrayList<>(); +// 签到打卡10302 我的待办10201 无线告警10101 巡检任务10402 + long[] menuIds={10302,10201,10402}; + for (long menuId : menuIds) { + SysAppUserMenu userMenu = new SysAppUserMenu(); + userMenu.setMenuId(menuId); + userMenu.setUserId(userId); + userMenus.add(userMenu); + } + log.info("新增一次首页默认展示应用"); + appUserMenuMapper.batchAppUserMenu(userMenus); + } + List customAppMenuList = appUserMenuMapper.selectCustomList(userId); + List res = allAppMenus.stream().filter(item -> customAppMenuList.stream() + .anyMatch(l -> l.getMenuId().equals(item.getMenuId()))).collect(Collectors.toList()); +// //拼接Url +// for (SysAppMenu menu : res) { +// sysAppMenu.setIcon(visitpath+menu.getIcon()); +// } + return res; + } + + @Override + public Boolean updateCustomList(Long userId, List menuIds) { + // 删除用户与菜单关联 + appUserMenuMapper.deleteAppUserMenuByUserId(userId); + // 新增用户与菜单管理 + if(CollUtil.isNotEmpty(menuIds)) { + ArrayList menus = new ArrayList<>(); + for (Long menuId : menuIds) { + SysAppUserMenu menu = new SysAppUserMenu(); + menu.setUserId(userId); + menu.setMenuId(menuId); + menus.add(menu); + } + appUserMenuMapper.batchAppUserMenu(menus); + } + return true; + } + + /** + * 获取路由名称 + * + * @param menu 菜单信息 + * @return 路由名称 + */ + public String getRouteName(SysAppMenu menu) { + String routerName = StringUtils.capitalize(menu.getPath()); + // 非外链并且是一级目录(类型为目录) + if (isMenuFrame(menu)) { + routerName = StringUtils.EMPTY; + } + return routerName; + } + + /** + * 获取路由地址 + * + * @param menu 菜单信息 + * @return 路由地址 + */ + public String getRouterPath(SysAppMenu menu) { + String routerPath = menu.getPath(); + // 内链打开外网方式 + if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) { + routerPath = innerLinkReplaceEach(routerPath); + } + // 非外链并且是一级目录(类型为目录) + if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) + && UserConstants.NO_FRAME.equals(menu.getIsFrame())) { + routerPath = "/" + menu.getPath(); + } + // 非外链并且是一级目录(类型为菜单) + else if (isMenuFrame(menu)) { + routerPath = "/"; + } + return routerPath; + } + + /** + * 获取组件信息 + * + * @param menu 菜单信息 + * @return 组件信息 + */ + public String getComponent(SysAppMenu menu) { + String component = UserConstants.LAYOUT; + if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) { + component = menu.getComponent(); + } else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) { + component = UserConstants.INNER_LINK; + } else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { + component = UserConstants.PARENT_VIEW; + } + return component; + } + + /** + * 是否为菜单内部跳转 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isMenuFrame(SysAppMenu menu) { + return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType()) + && menu.getIsFrame().equals(UserConstants.NO_FRAME); + } + + /** + * 是否为内链组件 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isInnerLink(SysAppMenu menu) { + return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath()); + } + + /** + * 是否为parent_view组件 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isParentView(SysAppMenu menu) { + return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()); + } + + /** + * 根据父节点的ID获取所有子节点 + * + * @param list 分类表 + * @param parentId 传入的父节点ID + * @return String + */ + public List getChildPerms(List list, int parentId) { + List returnList = new ArrayList(); + for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { + SysAppMenu t = (SysAppMenu) iterator.next(); + // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 + if (t.getParentId() == parentId) { + recursionFn(list, t); + returnList.add(t); + } + } + return returnList; + } + + /** + * 递归列表 + * + * @param list 分类表 + * @param t 子节点 + */ + private void recursionFn(List list, SysAppMenu t) { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (SysAppMenu tChild : childList) { + if (hasChild(list, tChild)) { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, SysAppMenu t) { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) { + SysAppMenu n = (SysAppMenu) it.next(); + if (n.getParentId().longValue() == t.getMenuId().longValue()) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, SysAppMenu t) { + return getChildList(list, t).size() > 0; + } + + /** + * 内链域名特殊字符替换 + * + * @return 替换后的内链域名 + */ + public String innerLinkReplaceEach(String path) { + return StringUtils.replaceEach(path, new String[]{Constants.HTTP, Constants.HTTPS, Constants.WWW, "."}, + new String[]{"", "", "", "/"}); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7b6d566d326e78ac4bdabc98e659f8f1c214429f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -0,0 +1,236 @@ +package com.ruoyi.system.service.impl; + +import java.util.Collection; +import java.util.List; +import javax.annotation.PostConstruct; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.enums.DataSourceType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysConfig; +import com.ruoyi.system.mapper.SysConfigMapper; +import com.ruoyi.system.service.ISysConfigService; + +/** + * 参数配置 服务层实现 + * + * @author ruoyi + */ +@Service +public class SysConfigServiceImpl implements ISysConfigService +{ + @Autowired + private SysConfigMapper configMapper; + + @Autowired + private RedisCache redisCache; + + /** + * 项目启动时,初始化参数到缓存 + */ + @PostConstruct + public void init() + { + loadingConfigCache(); + } + + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + @Override + @DataSource(DataSourceType.MASTER) + public SysConfig selectConfigById(Long configId) + { + SysConfig config = new SysConfig(); + config.setConfigId(configId); + return configMapper.selectConfig(config); + } + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数key + * @return 参数键值 + */ + @Override + public String selectConfigByKey(String configKey) + { + String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey))); + if (StringUtils.isNotEmpty(configValue)) + { + return configValue; + } + SysConfig config = new SysConfig(); + config.setConfigKey(configKey); + SysConfig retConfig = configMapper.selectConfig(config); + if (StringUtils.isNotNull(retConfig)) + { + redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); + return retConfig.getConfigValue(); + } + return StringUtils.EMPTY; + } + + /** + * 获取验证码开关 + * + * @return true开启,false关闭 + */ + @Override + public boolean selectCaptchaEnabled() + { + String captchaEnabled = selectConfigByKey("sys.account.captchaEnabled"); + if (StringUtils.isEmpty(captchaEnabled)) + { + return true; + } + return Convert.toBool(captchaEnabled); + } + + @Override + public boolean selectDistinctEnabled() { + String captchaEnabled = selectConfigByKey("sys.account.distinctEnabled"); + if (StringUtils.isEmpty(captchaEnabled)) + { + return true; + } + return Convert.toBool(captchaEnabled); + } + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + @Override + public List selectConfigList(SysConfig config) + { + return configMapper.selectConfigList(config); + } + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int insertConfig(SysConfig config) + { + int row = configMapper.insertConfig(config); + if (row > 0) + { + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int updateConfig(SysConfig config) + { + int row = configMapper.updateConfig(config); + if (row > 0) + { + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + */ + @Override + public void deleteConfigByIds(Long[] configIds) + { + for (Long configId : configIds) + { + SysConfig config = selectConfigById(configId); + if (StringUtils.equals(UserConstants.YES, config.getConfigType())) + { + throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); + } + configMapper.deleteConfigById(configId); + redisCache.deleteObject(getCacheKey(config.getConfigKey())); + } + } + + /** + * 加载参数缓存数据 + */ + @Override + public void loadingConfigCache() + { + List configsList = configMapper.selectConfigList(new SysConfig()); + for (SysConfig config : configsList) + { + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + } + + /** + * 清空参数缓存数据 + */ + @Override + public void clearConfigCache() + { + Collection keys = redisCache.keys(CacheConstants.SYS_CONFIG_KEY + "*"); + redisCache.deleteObject(keys); + } + + /** + * 重置参数缓存数据 + */ + @Override + public void resetConfigCache() + { + clearConfigCache(); + loadingConfigCache(); + } + + /** + * 校验参数键名是否唯一 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public String checkConfigKeyUnique(SysConfig config) + { + Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); + SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); + if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 设置cache key + * + * @param configKey 参数键 + * @return 缓存键key + */ + private String getCacheKey(String configKey) + { + return CacheConstants.SYS_CONFIG_KEY + configKey; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..bdd0df736ffcae956a52f352b64042a74f63429b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -0,0 +1,338 @@ +package com.ruoyi.system.service.impl; + +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; +import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.TreeSelect; +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.system.mapper.SysDeptMapper; +import com.ruoyi.system.mapper.SysRoleMapper; +import com.ruoyi.system.service.ISysDeptService; + +/** + * 部门管理 服务实现 + * + * @author ruoyi + */ +@Service +public class SysDeptServiceImpl implements ISysDeptService +{ + @Autowired + private SysDeptMapper deptMapper; + + @Autowired + private SysRoleMapper roleMapper; + + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + @Override + @DataScope(deptAlias = "d") + public List selectDeptList(SysDept dept) + { + return deptMapper.selectDeptList(dept); + } + + /** + * 查询部门树结构信息 + * + * @param dept 部门信息 + * @return 部门树信息集合 + */ + @Override + public List selectDeptTreeList(SysDept dept) + { + List depts = SpringUtils.getAopProxy(this).selectDeptList(dept); + return buildDeptTreeSelect(depts); + } + + /** + * 构建前端所需要树结构 + * + * @param depts 部门列表 + * @return 树结构列表 + */ + @Override + public List buildDeptTree(List depts) + { + List returnList = new ArrayList(); + List tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList()); + for (SysDept dept : depts) + { + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(dept.getParentId())) + { + recursionFn(depts, dept); + returnList.add(dept); + } + } + if (returnList.isEmpty()) + { + returnList = depts; + } + return returnList; + } + + /** + * 构建前端所需要下拉树结构 + * + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + @Override + public List buildDeptTreeSelect(List depts) + { + List deptTrees = buildDeptTree(depts); + return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @return 选中部门列表 + */ + @Override + public List 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) + { + return deptMapper.selectDeptById(deptId); + } + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + @Override + public int selectNormalChildrenDeptById(Long deptId) + { + return deptMapper.selectNormalChildrenDeptById(deptId); + } + + /** + * 是否存在子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + @Override + 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) + { + int result = deptMapper.checkDeptExistUser(deptId); + return result > 0; + } + + /** + * 校验部门名称是否唯一 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public String 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()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验部门是否有数据权限 + * + * @param deptId 部门id + */ + @Override + public void checkDeptDataScope(Long deptId) + { + if (!SysUser.isAdmin(SecurityUtils.getUserId())) + { + SysDept dept = new SysDept(); + dept.setDeptId(deptId); + List depts = SpringUtils.getAopProxy(this).selectDeptList(dept); + if (StringUtils.isEmpty(depts)) + { + throw new ServiceException("没有权限访问部门数据!"); + } + } + } + + /** + * 新增保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public int insertDept(SysDept dept) + { + SysDept info = deptMapper.selectDeptById(dept.getParentId()); + // 如果父节点不为正常状态,则不允许新增子节点 + if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) + { + throw new ServiceException("部门停用,不允许新增"); + } + dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); + return deptMapper.insertDept(dept); + } + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public int updateDept(SysDept dept) + { + SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId()); + SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId()); + 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())) + { + // 如果该部门是启用状态,则启用该部门的所有上级部门 + updateParentDeptStatusNormal(dept); + } + return result; + } + + /** + * 修改该部门的父级部门状态 + * + * @param dept 当前部门 + */ + private void updateParentDeptStatusNormal(SysDept dept) + { + String ancestors = dept.getAncestors(); + Long[] deptIds = Convert.toLongArray(ancestors); + deptMapper.updateDeptStatusNormal(deptIds); + } + + /** + * 修改子元素关系 + * + * @param deptId 被修改的部门ID + * @param newAncestors 新的父ID集合 + * @param oldAncestors 旧的父ID集合 + */ + public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) + { + List children = deptMapper.selectChildrenDeptById(deptId); + for (SysDept child : children) + { + child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); + } + if (children.size() > 0) + { + deptMapper.updateDeptChildren(children); + } + } + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + @Override + public int deleteDeptById(Long deptId) + { + return deptMapper.deleteDeptById(deptId); + } + + /** + * 递归列表 + */ + private void recursionFn(List list, SysDept t) + { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (SysDept tChild : childList) + { + if (hasChild(list, tChild)) + { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, SysDept t) + { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) + { + SysDept n = (SysDept) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) + { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, SysDept t) + { + return getChildList(list, t).size() > 0; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..212ea5af988deca405dba34c17bc80c942d7c0ee --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java @@ -0,0 +1,123 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; + +import com.ruoyi.common.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.system.mapper.SysDictDataMapper; +import com.ruoyi.system.service.ISysDictDataService; + +/** + * 字典 业务层处理 + * + * @author ruoyi + */ +@Service +public class SysDictDataServiceImpl implements ISysDictDataService +{ + @Autowired + private SysDictDataMapper dictDataMapper; + + /** + * 根据条件分页查询字典数据 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + @Override + public List selectDictDataList(SysDictData dictData) + { + return dictDataMapper.selectDictDataList(dictData); + } + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + @Override + public String selectDictLabel(String dictType, String dictValue) + { + return dictDataMapper.selectDictLabel(dictType, dictValue); + } + + @Override + public String selectDictValue(String dictType, String dictLable) { + return dictDataMapper.selectDictValue(dictType, dictLable); + } + + @Override + public List selectDictLabelByValues(String dictType, List dictValues) { + return dictDataMapper.selectDictLabelByValues(dictType, dictValues); + } + + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + @Override + public SysDictData selectDictDataById(Long dictCode) + { + return dictDataMapper.selectDictDataById(dictCode); + } + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + */ + @Override + public void deleteDictDataByIds(Long[] dictCodes) + { + for (Long dictCode : dictCodes) + { + SysDictData data = selectDictDataById(dictCode); + dictDataMapper.deleteDictDataById(dictCode); + List dictDatas = dictDataMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + } + + /** + * 新增保存字典数据信息 + * + * @param data 字典数据信息 + * @return 结果 + */ + @Override + public int insertDictData(SysDictData data) + { + int row = dictDataMapper.insertDictData(data); + if (row > 0) + { + List dictDatas = dictDataMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } + + /** + * 修改保存字典数据信息 + * + * @param data 字典数据信息 + * @return 结果 + */ + @Override + public int updateDictData(SysDictData data) + { + int row = dictDataMapper.updateDictData(data); + if (row > 0) + { + List dictDatas = dictDataMapper.selectDictDataByType(data.getDictType()); + DictUtils.setDictCache(data.getDictType(), dictDatas); + } + return row; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..605beed0a6e9f20fd15351405794edc5d6c1d573 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -0,0 +1,234 @@ +package com.ruoyi.system.service.impl; + +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import javax.annotation.PostConstruct; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysDictType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.mapper.SysDictDataMapper; +import com.ruoyi.system.mapper.SysDictTypeMapper; +import com.ruoyi.system.service.ISysDictTypeService; + +/** + * 字典 业务层处理 + * + * @author ruoyi + */ +@Service +public class SysDictTypeServiceImpl implements ISysDictTypeService +{ + @Autowired + private SysDictTypeMapper dictTypeMapper; + + @Autowired + private SysDictDataMapper dictDataMapper; + + /** + * 项目启动时,初始化字典到缓存 + */ + @PostConstruct + public void init() + { + loadingDictCache(); + } + + /** + * 根据条件分页查询字典类型 + * + * @param dictType 字典类型信息 + * @return 字典类型集合信息 + */ + @Override + public List selectDictTypeList(SysDictType dictType) + { + return dictTypeMapper.selectDictTypeList(dictType); + } + + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + @Override + public List selectDictTypeAll() + { + return dictTypeMapper.selectDictTypeAll(); + } + + /** + * 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + @Override + public List selectDictDataByType(String dictType) + { + List dictDatas = DictUtils.getDictCache(dictType); + if (StringUtils.isNotEmpty(dictDatas)) + { + return dictDatas; + } + dictDatas = dictDataMapper.selectDictDataByType(dictType); + if (StringUtils.isNotEmpty(dictDatas)) + { + DictUtils.setDictCache(dictType, dictDatas); + return dictDatas; + } + return null; + } + + /** + * 根据字典类型ID查询信息 + * + * @param dictId 字典类型ID + * @return 字典类型 + */ + @Override + public SysDictType selectDictTypeById(Long dictId) + { + return dictTypeMapper.selectDictTypeById(dictId); + } + + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + @Override + public SysDictType selectDictTypeByType(String dictType) + { + return dictTypeMapper.selectDictTypeByType(dictType); + } + + /** + * 批量删除字典类型信息 + * + * @param dictIds 需要删除的字典ID + */ + @Override + public void deleteDictTypeByIds(Long[] dictIds) + { + for (Long dictId : dictIds) + { + SysDictType dictType = selectDictTypeById(dictId); + if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) + { + throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName())); + } + dictTypeMapper.deleteDictTypeById(dictId); + DictUtils.removeDictCache(dictType.getDictType()); + } + } + + /** + * 加载字典缓存数据 + */ + @Override + public void loadingDictCache() + { + SysDictData dictData = new SysDictData(); + dictData.setStatus("0"); + Map> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType)); + for (Map.Entry> entry : dictDataMap.entrySet()) + { + DictUtils.setDictCache(entry.getKey(), entry.getValue().stream().sorted(Comparator.comparing(SysDictData::getDictSort)).collect(Collectors.toList())); + } + } + + /** + * 清空字典缓存数据 + */ + @Override + public void clearDictCache() + { + DictUtils.clearDictCache(); + } + + /** + * 重置字典缓存数据 + */ + @Override + public void resetDictCache() + { + clearDictCache(); + loadingDictCache(); + } + + /** + * 新增保存字典类型信息 + * + * @param dict 字典类型信息 + * @return 结果 + */ + @Override + public int insertDictType(SysDictType dict) + { + int row = dictTypeMapper.insertDictType(dict); + if (row > 0) + { + DictUtils.setDictCache(dict.getDictType(), null); + } + return row; + } + + /** + * 修改保存字典类型信息 + * + * @param dict 字典类型信息 + * @return 结果 + */ + @Override + @Transactional + public int updateDictType(SysDictType dict) + { + SysDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId()); + dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType()); + int row = dictTypeMapper.updateDictType(dict); + if (row > 0) + { + List dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType()); + DictUtils.setDictCache(dict.getDictType(), dictDatas); + } + return row; + } + + /** + * 校验字典类型称是否唯一 + * + * @param dict 字典类型 + * @return 结果 + */ + @Override + public String checkDictTypeUnique(SysDictType dict) + { + Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); + SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType()); + if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 根据字典类型城市查询下属区域 + * + * @param cityValue 城市 + * @return 结果 + */ + @Override + public List selectCountyByCity(String cityValue) { + return dictDataMapper.selectCountyByCity(cityValue); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..216aecb2855b992e06e4ed16ed82f39c907fcfaf --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java @@ -0,0 +1,65 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.domain.SysLogininfor; +import com.ruoyi.system.mapper.SysLogininforMapper; +import com.ruoyi.system.service.ISysLogininforService; + +/** + * 系统访问日志情况信息 服务层处理 + * + * @author ruoyi + */ +@Service +public class SysLogininforServiceImpl implements ISysLogininforService +{ + + @Autowired + private SysLogininforMapper logininforMapper; + + /** + * 新增系统登录日志 + * + * @param logininfor 访问日志对象 + */ + @Override + public void insertLogininfor(SysLogininfor logininfor) + { + logininforMapper.insertLogininfor(logininfor); + } + + /** + * 查询系统登录日志集合 + * + * @param logininfor 访问日志对象 + * @return 登录记录集合 + */ + @Override + public List selectLogininforList(SysLogininfor logininfor) + { + return logininforMapper.selectLogininforList(logininfor); + } + + /** + * 批量删除系统登录日志 + * + * @param infoIds 需要删除的登录日志ID + * @return 结果 + */ + @Override + public int deleteLogininforByIds(Long[] infoIds) + { + return logininforMapper.deleteLogininforByIds(infoIds); + } + + /** + * 清空系统登录日志 + */ + @Override + public void cleanLogininfor() + { + logininforMapper.cleanLogininfor(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7c59a618409924ca46e44a563f63de6f735f6493 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -0,0 +1,536 @@ +package com.ruoyi.system.service.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.TreeSelect; +import com.ruoyi.common.core.domain.entity.SysMenu; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.vo.MetaVo; +import com.ruoyi.system.domain.vo.RouterVo; +import com.ruoyi.system.mapper.SysMenuMapper; +import com.ruoyi.system.mapper.SysRoleMapper; +import com.ruoyi.system.mapper.SysRoleMenuMapper; +import com.ruoyi.system.service.ISysMenuService; + +/** + * 菜单 业务层处理 + * + * @author ruoyi + */ +@Service +public class SysMenuServiceImpl implements ISysMenuService +{ + public static final String PREMISSION_STRING = "perms[\"{0}\"]"; + + @Autowired + private SysMenuMapper menuMapper; + + @Autowired + private SysRoleMapper roleMapper; + + @Autowired + private SysRoleMenuMapper roleMenuMapper; + + /** + * 根据用户查询系统菜单列表 + * + * @param userId 用户ID + * @return 菜单列表 + */ + @Override + public List selectMenuList(Long userId) + { + return selectMenuList(new SysMenu(), userId); + } + + /** + * 查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + @Override + public List selectMenuList(SysMenu menu, Long userId) + { + List menuList = null; + // 管理员显示所有菜单信息 + if (SysUser.isAdmin(userId)) + { + menuList = menuMapper.selectMenuList(menu); + } + else + { + menu.getParams().put("userId", userId); + menuList = menuMapper.selectMenuListByUserId(menu); + } + return menuList; + } + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + @Override + public Set selectMenuPermsByUserId(Long userId) + { + List perms = menuMapper.selectMenuPermsByUserId(userId); + Set permsSet = new HashSet<>(); + for (String perm : perms) + { + if (StringUtils.isNotEmpty(perm)) + { + permsSet.addAll(Arrays.asList(perm.trim().split(","))); + } + } + return permsSet; + } + + /** + * 根据角色ID查询权限 + * + * @param roleId 角色ID + * @return 权限列表 + */ + @Override + public Set selectMenuPermsByRoleId(Long roleId) + { + List perms = menuMapper.selectMenuPermsByRoleId(roleId); + Set permsSet = new HashSet<>(); + for (String perm : perms) + { + if (StringUtils.isNotEmpty(perm)) + { + permsSet.addAll(Arrays.asList(perm.trim().split(","))); + } + } + return permsSet; + } + + /** + * 根据用户ID查询菜单 + * + * @param userId 用户名称 + * @return 菜单列表 + */ + @Override + public List selectMenuTreeByUserId(Long userId) + { + List menus = null; + if (SecurityUtils.isAdmin(userId)) + { + menus = menuMapper.selectMenuTreeAll(); + } + else + { + menus = menuMapper.selectMenuTreeByUserId(userId); + } + return getChildPerms(menus, 0); + } + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @return 选中菜单列表 + */ + @Override + public List selectMenuListByRoleId(Long roleId,Boolean menuCheckStrictly) + { + SysRole role = roleMapper.selectRoleById(roleId); + return menuMapper.selectMenuListByRoleId(roleId, menuCheckStrictly); + } + + @Override + public List selectMenuNameListByRoleId(Long roleId) { + return menuMapper.selectMenuNameListByRoleId(roleId); + } + + /** + * 构建前端路由所需要的菜单 + * + * @param menus 菜单列表 + * @return 路由列表 + */ + @Override + public List buildMenus(List menus) + { + List routers = new LinkedList(); + for (SysMenu menu : menus) + { + RouterVo router = new RouterVo(); + router.setHidden("1".equals(menu.getVisible())); + router.setName(getRouteName(menu)); + router.setPath(getRouterPath(menu)); + router.setComponent(getComponent(menu)); + router.setQuery(menu.getQuery()); + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + List cMenus = menu.getChildren(); + if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType())) + { + router.setAlwaysShow(true); + router.setRedirect("noRedirect"); + router.setChildren(buildMenus(cMenus)); + } + else if (isMenuFrame(menu)) + { + router.setMeta(null); + List childrenList = new ArrayList(); + RouterVo children = new RouterVo(); + children.setPath(menu.getPath()); + children.setComponent(menu.getComponent()); + children.setName(StringUtils.capitalize(menu.getPath())); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + children.setQuery(menu.getQuery()); + childrenList.add(children); + router.setChildren(childrenList); + } + else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) + { + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); + router.setPath("/"); + List childrenList = new ArrayList(); + RouterVo children = new RouterVo(); + String routerPath = innerLinkReplaceEach(menu.getPath()); + children.setPath(routerPath); + children.setComponent(UserConstants.INNER_LINK); + children.setName(StringUtils.capitalize(routerPath)); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); + childrenList.add(children); + router.setChildren(childrenList); + } + routers.add(router); + } + return routers; + } + + /** + * 构建前端所需要树结构 + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + @Override + public List buildMenuTree(List menus) + { + List returnList = new ArrayList(); + List tempList = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList()); + for (Iterator iterator = menus.iterator(); iterator.hasNext();) + { + SysMenu menu = (SysMenu) iterator.next(); + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(menu.getParentId())) + { + recursionFn(menus, menu); + returnList.add(menu); + } + } + if (returnList.isEmpty()) + { + returnList = menus; + } + return returnList; + } + + /** + * 构建前端所需要下拉树结构 + * + * @param menus 菜单列表 + * @return 下拉树结构列表 + */ + @Override + public List buildMenuTreeSelect(List menus) + { + List menuTrees = buildMenuTree(menus); + return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + /** + * 根据菜单ID查询信息 + * + * @param menuId 菜单ID + * @return 菜单信息 + */ + @Override + public SysMenu selectMenuById(Long menuId) + { + return menuMapper.selectMenuById(menuId); + } + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public boolean hasChildByMenuId(Long menuId) + { + int result = menuMapper.hasChildByMenuId(menuId); + return result > 0; + } + + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public boolean checkMenuExistRole(Long menuId) + { + int result = roleMenuMapper.checkMenuExistRole(menuId); + return result > 0; + } + + /** + * 新增保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public int insertMenu(SysMenu menu) + { + return menuMapper.insertMenu(menu); + } + + /** + * 修改保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public int updateMenu(SysMenu menu) + { + return menuMapper.updateMenu(menu); + } + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public int deleteMenuById(Long menuId) + { + return menuMapper.deleteMenuById(menuId); + } + + /** + * 校验菜单名称是否唯一 + * + * @param menu 菜单信息 + * @return 结果 + */ + @Override + public String checkMenuNameUnique(SysMenu menu) + { + Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); + SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId()); + if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 获取路由名称 + * + * @param menu 菜单信息 + * @return 路由名称 + */ + public String getRouteName(SysMenu menu) + { + String routerName = StringUtils.capitalize(menu.getPath()); + // 非外链并且是一级目录(类型为目录) + if (isMenuFrame(menu)) + { + routerName = StringUtils.EMPTY; + } + return routerName; + } + + /** + * 获取路由地址 + * + * @param menu 菜单信息 + * @return 路由地址 + */ + public String getRouterPath(SysMenu menu) + { + String routerPath = menu.getPath(); + // 内链打开外网方式 + if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) + { + routerPath = innerLinkReplaceEach(routerPath); + } + // 非外链并且是一级目录(类型为目录) + if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) + && UserConstants.NO_FRAME.equals(menu.getIsFrame())) + { + routerPath = "/" + menu.getPath(); + } + // 非外链并且是一级目录(类型为菜单) + else if (isMenuFrame(menu)) + { + routerPath = "/"; + } + return routerPath; + } + + /** + * 获取组件信息 + * + * @param menu 菜单信息 + * @return 组件信息 + */ + public String getComponent(SysMenu menu) + { + String component = UserConstants.LAYOUT; + if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) + { + component = menu.getComponent(); + } + else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) + { + component = UserConstants.INNER_LINK; + } + else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) + { + component = UserConstants.PARENT_VIEW; + } + return component; + } + + /** + * 是否为菜单内部跳转 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isMenuFrame(SysMenu menu) + { + return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType()) + && menu.getIsFrame().equals(UserConstants.NO_FRAME); + } + + /** + * 是否为内链组件 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isInnerLink(SysMenu menu) + { + return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath()); + } + + /** + * 是否为parent_view组件 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isParentView(SysMenu menu) + { + return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()); + } + + /** + * 根据父节点的ID获取所有子节点 + * + * @param list 分类表 + * @param parentId 传入的父节点ID + * @return String + */ + public List getChildPerms(List list, int parentId) + { + List returnList = new ArrayList(); + for (Iterator iterator = list.iterator(); iterator.hasNext();) + { + SysMenu t = (SysMenu) iterator.next(); + // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 + if (t.getParentId() == parentId) + { + recursionFn(list, t); + returnList.add(t); + } + } + return returnList; + } + + /** + * 递归列表 + * + * @param list 分类表 + * @param t 子节点 + */ + private void recursionFn(List list, SysMenu t) + { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (SysMenu tChild : childList) + { + if (hasChild(list, tChild)) + { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, SysMenu t) + { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) + { + SysMenu n = (SysMenu) it.next(); + if (n.getParentId().longValue() == t.getMenuId().longValue()) + { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, SysMenu t) + { + return getChildList(list, t).size() > 0; + } + + /** + * 内链域名特殊字符替换 + * + * @return 替换后的内链域名 + */ + public String innerLinkReplaceEach(String path) + { + return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, "." }, + new String[] { "", "", "", "/" }); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..54898152e3dc4557121e3b1044f662853f9ea701 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java @@ -0,0 +1,76 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.domain.SysOperLog; +import com.ruoyi.system.mapper.SysOperLogMapper; +import com.ruoyi.system.service.ISysOperLogService; + +/** + * 操作日志 服务层处理 + * + * @author ruoyi + */ +@Service +public class SysOperLogServiceImpl implements ISysOperLogService +{ + @Autowired + private SysOperLogMapper operLogMapper; + + /** + * 新增操作日志 + * + * @param operLog 操作日志对象 + */ + @Override + public void insertOperlog(SysOperLog operLog) + { + operLogMapper.insertOperlog(operLog); + } + + /** + * 查询系统操作日志集合 + * + * @param operLog 操作日志对象 + * @return 操作日志集合 + */ + @Override + public List selectOperLogList(SysOperLog operLog) + { + return operLogMapper.selectOperLogList(operLog); + } + + /** + * 批量删除系统操作日志 + * + * @param operIds 需要删除的操作日志ID + * @return 结果 + */ + @Override + public int deleteOperLogByIds(Long[] operIds) + { + return operLogMapper.deleteOperLogByIds(operIds); + } + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + @Override + public SysOperLog selectOperLogById(Long operId) + { + return operLogMapper.selectOperLogById(operId); + } + + /** + * 清空操作日志 + */ + @Override + public void cleanOperLog() + { + operLogMapper.cleanOperLog(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..78f1cb723c27f7f06ad04b002f3fab6e50f1a475 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java @@ -0,0 +1,178 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysPost; +import com.ruoyi.system.mapper.SysPostMapper; +import com.ruoyi.system.mapper.SysUserPostMapper; +import com.ruoyi.system.service.ISysPostService; + +/** + * 岗位信息 服务层处理 + * + * @author ruoyi + */ +@Service +public class SysPostServiceImpl implements ISysPostService +{ + @Autowired + private SysPostMapper postMapper; + + @Autowired + private SysUserPostMapper userPostMapper; + + /** + * 查询岗位信息集合 + * + * @param post 岗位信息 + * @return 岗位信息集合 + */ + @Override + public List selectPostList(SysPost post) + { + return postMapper.selectPostList(post); + } + + /** + * 查询所有岗位 + * + * @return 岗位列表 + */ + @Override + public List selectPostAll() + { + return postMapper.selectPostAll(); + } + + /** + * 通过岗位ID查询岗位信息 + * + * @param postId 岗位ID + * @return 角色对象信息 + */ + @Override + public SysPost selectPostById(Long postId) + { + return postMapper.selectPostById(postId); + } + + /** + * 根据用户ID获取岗位选择框列表 + * + * @param userId 用户ID + * @return 选中岗位ID列表 + */ + @Override + public List selectPostListByUserId(Long userId) + { + return postMapper.selectPostListByUserId(userId); + } + + /** + * 校验岗位名称是否唯一 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public String checkPostNameUnique(SysPost post) + { + Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); + SysPost info = postMapper.checkPostNameUnique(post.getPostName()); + if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验岗位编码是否唯一 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public String checkPostCodeUnique(SysPost post) + { + Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); + SysPost info = postMapper.checkPostCodeUnique(post.getPostCode()); + if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 通过岗位ID查询岗位使用数量 + * + * @param postId 岗位ID + * @return 结果 + */ + @Override + public int countUserPostById(Long postId) + { + return userPostMapper.countUserPostById(postId); + } + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + @Override + public int deletePostById(Long postId) + { + return postMapper.deletePostById(postId); + } + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + */ + @Override + public int deletePostByIds(Long[] postIds) + { + for (Long postId : postIds) + { + SysPost post = selectPostById(postId); + if (countUserPostById(postId) > 0) + { + throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName())); + } + } + return postMapper.deletePostByIds(postIds); + } + + /** + * 新增保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public int insertPost(SysPost post) + { + return postMapper.insertPost(post); + } + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public int updatePost(SysPost post) + { + return postMapper.updatePost(post); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..f8f41dbcdd8d46898f87dc7101e1bcb069a6d2aa --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,508 @@ +package com.ruoyi.system.service.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import cn.hutool.core.util.ArrayUtil; +import com.ruoyi.system.domain.SysAppRoleMenu; +import com.ruoyi.system.mapper.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.ruoyi.common.annotation.DataScope; +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.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.system.domain.SysRoleDept; +import com.ruoyi.system.domain.SysRoleMenu; +import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.service.ISysRoleService; + +/** + * 角色 业务层处理 + * + * @author ruoyi + */ +@Service +@Slf4j +public class SysRoleServiceImpl implements ISysRoleService +{ + @Autowired + private SysRoleMapper roleMapper; + + @Autowired + private SysRoleMenuMapper roleMenuMapper; + + @Autowired + private SysAppRoleMenuMapper appRoleMenuMapper; + + @Autowired + private SysUserRoleMapper userRoleMapper; + + @Autowired + private SysRoleDeptMapper roleDeptMapper; + + /** + * 根据条件分页查询角色数据 + * + * @param role 角色信息 + * @return 角色数据集合信息 + */ + @Override + @DataScope(deptAlias = "d") + public List selectRoleList(SysRole role) + { + return roleMapper.selectRoleList(role); + } + + /** + * 根据用户ID查询角色 + * + * @param userId 用户ID + * @return 角色列表 + */ + @Override + public List selectRolesByUserId(Long userId) + { + List userRoles = roleMapper.selectRolePermissionByUserId(userId); + List roles = selectRoleAll(); + for (SysRole role : roles) + { + for (SysRole userRole : userRoles) + { + if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) + { + role.setFlag(true); + break; + } + } + } + return roles; + } + + @Override + public List selectNameByUserId(Long userId) { + return roleMapper.selectNameByUserId(userId); + } + + @Override + public List selectRolesByUserId2(Long userId) { + List userRoles = roleMapper.selectRolePermissionByUserId(userId); + return userRoles; + } + + @Override + public List selectRolesByUserIds(List userIds) { + return userRoleMapper.selectRolePermissionByUserIds(userIds); + } + + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + @Override + public Set selectRolePermissionByUserId(Long userId) + { + List perms = roleMapper.selectRolePermissionByUserId(userId); + Set permsSet = new HashSet<>(); + for (SysRole perm : perms) + { + if (StringUtils.isNotNull(perm)) + { + permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); + } + } + return permsSet; + } + + /** + * 查询所有角色 + * + * @return 角色列表 + */ + @Override + public List selectRoleAll() + { + return SpringUtils.getAopProxy(this).selectRoleList(new SysRole()); + } + + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + @Override + public List selectRoleListByUserId(Long userId) + { + return roleMapper.selectRoleListByUserId(userId); + } + + /** + * 通过角色ID查询角色 + * + * @param roleId 角色ID + * @return 角色对象信息 + */ + @Override + public SysRole selectRoleById(Long roleId) + { + return roleMapper.selectRoleById(roleId); + } + + /** + * 校验角色名称是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public String checkRoleNameUnique(SysRole role) + { + Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName()); + if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验角色权限是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public String checkRoleKeyUnique(SysRole role) + { + Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey()); + if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验角色是否允许操作 + * + * @param role 角色信息 + */ + @Override + public void checkRoleAllowed(SysRole role) + { + if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) + { + throw new ServiceException("不允许操作超级管理员角色"); + } + } + + /** + * 校验角色是否有数据权限 + * + * @param roleId 角色id + */ + @Override + public void checkRoleDataScope(Long roleId) + { + if (!SysUser.isAdmin(SecurityUtils.getUserId())) + { + SysRole role = new SysRole(); + role.setRoleId(roleId); + List roles = SpringUtils.getAopProxy(this).selectRoleList(role); + if (StringUtils.isEmpty(roles)) + { + throw new ServiceException("没有权限访问角色数据!"); + } + } + } + + /** + * 通过角色ID查询角色使用数量 + * + * @param roleId 角色ID + * @return 结果 + */ + @Override + public int countUserRoleByRoleId(Long roleId) + { + return userRoleMapper.countUserRoleByRoleId(roleId); + } + + /** + * 新增保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + @Transactional + public int insertRole(SysRole role) + { + // 新增角色信息 + roleMapper.insertRole(role); + return insertRoleMenu(role); + } + + /** + * 修改保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + @Transactional + public int updateRole(SysRole role) + { + // 修改角色信息 + roleMapper.updateRole(role); + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId()); + // 删除角色与app菜单关联 + appRoleMenuMapper.deleteAppRoleMenuByRoleId(role.getRoleId()); + return insertRoleMenu(role); + } + + /** + * app修改保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + @Transactional + public int updateAppRole(SysRole role) + { + // 修改角色信息 + roleMapper.updateRole(role); + // 删除角色与菜单关联 + appRoleMenuMapper.deleteAppRoleMenuByRoleId(role.getRoleId()); + return insertAppRoleMenu(role); + } + + /** + * 修改角色状态 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public int updateRoleStatus(SysRole role) + { + return roleMapper.updateRole(role); + } + + /** + * 修改数据权限信息 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + @Transactional + public int authDataScope(SysRole role) + { + // 修改角色信息 + roleMapper.updateRole(role); + // 删除角色与部门关联 + roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId()); + // 新增角色和部门信息(数据权限) + return insertRoleDept(role); + } + + /** + * 新增角色菜单信息 + * + * @param role 角色对象 + */ + public int insertRoleMenu(SysRole role) + { + int rows = 1; + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long menuId : role.getMenuIds()) + { + SysRoleMenu rm = new SysRoleMenu(); + rm.setRoleId(role.getRoleId()); + rm.setMenuId(menuId); + list.add(rm); + } + if (list.size() > 0) + { + rows = roleMenuMapper.batchRoleMenu(list); + } + + // 新增app菜单与角色管理 + if(ArrayUtil.isNotEmpty(role.getAppMenuIds())) { + List appList = new ArrayList(); + for (Long appMenuId : role.getAppMenuIds()) { + SysAppRoleMenu rm = new SysAppRoleMenu(); + rm.setRoleId(role.getRoleId()); + rm.setMenuId(appMenuId); + appList.add(rm); + } + if (appList.size() > 0) { + rows = appRoleMenuMapper.batchAppRoleMenu(appList); + } + } + return rows; + } + + /** + * 新增角色菜单信息 app + * + * @param role 角色对象 + */ + public int insertAppRoleMenu(SysRole role) + { + int rows = 1; + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long menuId : role.getMenuIds()) + { + SysAppRoleMenu rm = new SysAppRoleMenu(); + rm.setRoleId(role.getRoleId()); + rm.setMenuId(menuId); + list.add(rm); + } + if (list.size() > 0) + { + rows = appRoleMenuMapper.batchAppRoleMenu(list); + } + return rows; + } + + /** + * 新增角色部门信息(数据权限) + * + * @param role 角色对象 + */ + public int insertRoleDept(SysRole role) + { + int rows = 1; + // 新增角色与部门(数据权限)管理 + List list = new ArrayList(); + for (Long deptId : role.getDeptIds()) + { + SysRoleDept rd = new SysRoleDept(); + rd.setRoleId(role.getRoleId()); + rd.setDeptId(deptId); + list.add(rd); + } + if (list.size() > 0) + { + rows = roleDeptMapper.batchRoleDept(list); + } + return rows; + } + + /** + * 通过角色ID删除角色 + * + * @param roleId 角色ID + * @return 结果 + */ + @Override + @Transactional + public int deleteRoleById(Long roleId) + { + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenuByRoleId(roleId); + // 删除角色与部门关联 + roleDeptMapper.deleteRoleDeptByRoleId(roleId); + return roleMapper.deleteRoleById(roleId); + } + + /** + * 批量删除角色信息 + * + * @param roleIds 需要删除的角色ID + * @return 结果 + */ + @Override + @Transactional + public int deleteRoleByIds(Long[] roleIds) + { + for (Long roleId : roleIds) + { + checkRoleAllowed(new SysRole(roleId)); + checkRoleDataScope(roleId); + SysRole role = selectRoleById(roleId); + if (countUserRoleByRoleId(roleId) > 0) + { + throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); + } + } + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenu(roleIds); + // 删除角色与app菜单关联 + appRoleMenuMapper.deleteAppRoleMenu(roleIds); + // 删除角色与部门关联 + roleDeptMapper.deleteRoleDept(roleIds); + return roleMapper.deleteRoleByIds(roleIds); + } + + /** + * 取消授权用户角色 + * + * @param userRole 用户和角色关联信息 + * @return 结果 + */ + @Override + public int deleteAuthUser(SysUserRole userRole) + { + String userName = SecurityUtils.getUsername(); + log.info(userName + "删除用户角色,参数:" + userRole); + return userRoleMapper.deleteUserRoleInfo(userRole); + } + + /** + * 批量取消授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要取消授权的用户数据ID + * @return 结果 + */ + @Override + public int deleteAuthUsers(Long roleId, Long[] userIds) + { + String userName = SecurityUtils.getUsername(); + log.info(userName + "删除用户角色,参数:" + roleId + ", " + userIds); + return userRoleMapper.deleteUserRoleInfos(roleId, userIds); + } + + /** + * 批量选择授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要授权的用户数据ID + * @return 结果 + */ + @Override + public int insertAuthUsers(Long roleId, Long[] userIds) + { + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long userId : userIds) + { + SysUserRole ur = new SysUserRole(); + ur.setUserId(userId); + ur.setRoleId(roleId); + list.add(ur); + } + return userRoleMapper.batchUserRole(list); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..aaa10ce15948302f744d714782222ab1feac5516 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java @@ -0,0 +1,97 @@ +package com.ruoyi.system.service.impl; + +import org.springframework.stereotype.Service; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysUserOnline; +import com.ruoyi.system.service.ISysUserOnlineService; + +/** + * 在线用户 服务层处理 + * + * @author ruoyi + */ +@Service +public class SysUserOnlineServiceImpl implements ISysUserOnlineService +{ + /** + * 通过登录地址查询信息 + * + * @param ipaddr 登录地址 + * @param user 用户信息 + * @return 在线用户信息 + */ + @Override + public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user) + { + if (StringUtils.equals(ipaddr, user.getIpaddr())) + { + return loginUserToUserOnline(user); + } + return null; + } + + /** + * 通过用户名称查询信息 + * + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + @Override + public SysUserOnline selectOnlineByUserName(String userName, LoginUser user) + { + if (StringUtils.equals(userName, user.getUsername())) + { + return loginUserToUserOnline(user); + } + return null; + } + + /** + * 通过登录地址/用户名称查询信息 + * + * @param ipaddr 登录地址 + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + @Override + public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user) + { + if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) + { + return loginUserToUserOnline(user); + } + return null; + } + + /** + * 设置在线用户信息 + * + * @param user 用户信息 + * @return 在线用户 + */ + @Override + public SysUserOnline loginUserToUserOnline(LoginUser user) + { + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUser())) + { + return null; + } + SysUserOnline sysUserOnline = new SysUserOnline(); + sysUserOnline.setTokenId(user.getToken()); + sysUserOnline.setUserId(user.getUserId()); + sysUserOnline.setUserName(user.getUsername()); + sysUserOnline.setIpaddr(user.getIpaddr()); + sysUserOnline.setLoginLocation(user.getLoginLocation()); + sysUserOnline.setBrowser(user.getBrowser()); + sysUserOnline.setOs(user.getOs()); + sysUserOnline.setLoginTime(user.getLoginTime()); + if (StringUtils.isNotNull(user.getUser().getDept())) + { + sysUserOnline.setDeptName(user.getUser().getDept().getDeptName()); + } + return sysUserOnline; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..7f64ff78a8491d1c568dc29119b4e7b1e80fef83 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -0,0 +1,780 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.util.PhoneUtil; +import com.github.pagehelper.util.StringUtil; +import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DictUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanValidators; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.system.domain.SysPost; +import com.ruoyi.system.domain.SysUserPost; +import com.ruoyi.system.domain.SysUserRole; +import com.ruoyi.system.domain.vo.SysUserInfoVo; +import com.ruoyi.system.domain.vo.UserTypeInfoVO; +import com.ruoyi.system.mapper.*; +import com.ruoyi.system.service.ISysConfigService; +import com.ruoyi.system.service.ISysUserService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.validation.Validator; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 用户 业务层处理 + * + * @author ruoyi + */ +@Service +public class SysUserServiceImpl implements ISysUserService +{ + private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); + + @Autowired + private SysUserMapper userMapper; + + @Autowired + private SysRoleMapper roleMapper; + + @Autowired + private SysPostMapper postMapper; + + @Autowired + private SysUserRoleMapper userRoleMapper; + + @Autowired + private SysUserPostMapper userPostMapper; + + @Autowired + private SysUserVenueMapper userVenueMapper; + + @Autowired + private ISysConfigService configService; + + @Autowired + private SysDictDataMapper dictData; + + @Autowired + protected Validator validator; + + @Autowired + private RedisCache redisCache; + + + @Override + public List selectUserListALL(SysUser sysUser) { + return userMapper.selectUserALL(sysUser); + } + + /** + * 根据条件分页查询用户列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectUserList(SysUser user) + { + return userMapper.selectUserList(user); + } + + @Override + public HashMap> selectUserSpecList(SysUser user) { + + if(StringUtils.isNotEmpty(user.getUserVenueId())) { + if (!StringUtils.isNum(user.getUserVenueId())) { + throw new ServiceException("传入的场馆ID有问题"); + } + } + HashMap> mapSysUser=new HashMap>(); + + List lstDict = dictData.selectDictDataByType("yw_specialty"); + + for(SysDictData dict : lstDict) + { + if(!mapSysUser.containsKey(dict.getDictValue())) + { + mapSysUser.put(dict.getDictValue(),new ArrayList()); + } + +// SysUser user=new SysUser(); + + user.setUserType(dict.getDictValue()); + + List lstUser = userMapper.selectUserList(user); + + for(SysUser sysUser : lstUser) + { + //不要显示冻结的 + if("2".equals(sysUser.getStatus())) + { + continue; + } + mapSysUser.get(dict.getDictValue()).add(sysUser); + } + + } + + //把没有专业的用户加上 + mapSysUser.put("noSpec",new ArrayList()); + mapSysUser.put("noSpec",userMapper.selectNoSpecUserList(user)); + + return mapSysUser; + } + + /** + * 根据条件分页查询已分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectAllocatedList(SysUser user) + { + return userMapper.selectAllocatedList(user); + } + + /** + * 根据条件分页查询未分配用户角色列表 + * + * @param user 用户信息 + * @return 用户信息集合信息 + */ + @Override + @DataScope(deptAlias = "d", userAlias = "u") + public List selectUnallocatedList(SysUser user) + { + return userMapper.selectUnallocatedList(user); + } + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + @Override + public SysUser selectUserByUserName(String userName) + { + return userMapper.selectUserByUserName(userName); + } + + @Override + public List selectUserByNickName(String nickName) { + return userMapper.selectUserByNickName(nickName); + } + + @Override + public SysUser selectUserByNickNameAndPhone(String nickName, String phone) { + return userMapper.selectUserByNickNameAndPhone(nickName,phone); + } + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + @Override + public SysUser selectUserById(Long userId) + { + return userMapper.selectUserById(userId); + } + + @Override + public SysUser selectAllUserById(Long userId) { + return userMapper.selectAllUserById(userId); + } + + @Override + public List selectUserByIds(List userIds) { + return userMapper.selectUserByIds(userIds); + } + + @Override + public List selectUserByRoleIdsAndSceneId(Long[] roleIds, Long sceneId) { + return userMapper.selectUserByRoleIdsAndSceneId(roleIds,sceneId); + } + + @Override + public SysUser selectUserByPhone(String phone) { + return userMapper.selectUserByPhone(phone); + } + + @Override + public List selectUserListByPhones(String[] phones) { + return userMapper.selectUserListByPhones(phones); + } + + /** + * 查询用户所属角色组 + * + * @param userName 用户名 + * @return 结果 + */ + @Override + public String selectUserRoleGroup(String userName) + { + List list = roleMapper.selectRolesByUserName(userName); + 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) + { + List list = postMapper.selectPostsByUserName(userName); + if (CollectionUtils.isEmpty(list)) + { + return StringUtils.EMPTY; + } + return list.stream().map(SysPost::getPostName).collect(Collectors.joining(",")); + } + + /** + * 校验用户名称是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public String 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()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验手机号码是否唯一 + * + * @param user 用户信息 + * @return + */ + @Override + public String 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()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验email是否唯一 + * + * @param user 用户信息 + * @return + */ + @Override + public String 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()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验用户是否允许操作 + * + * @param user 用户信息 + */ + @Override + 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())) + { + SysUser user = new SysUser(); + user.setUserId(userId); + List users = SpringUtils.getAopProxy(this).selectUserList(user); + if (StringUtils.isEmpty(users)) + { + throw new ServiceException("没有权限访问用户数据!"); + } + } + } + + /** + * 新增保存用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + @Transactional + public int insertUser(SysUser user) + { + // 新增用户信息 + int rows = userMapper.insertUser(user); + // 新增用户岗位关联 + insertUserPost(user); + // 新增用户与角色管理 + insertUserRole(user); + return rows; + } + + /** + * 注册用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public boolean registerUser(SysUser user) + { + return userMapper.insertUser(user) > 0; + } + + /** + * 修改保存用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + @Transactional + public int updateUser(SysUser user) + { + Long userId = user.getUserId(); + String userName = SecurityUtils.getUsername(); + log.info(userName + "删除用户角色,参数:" + user); + + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 新增用户与角色管理 + insertUserRole(user); + // 删除用户与岗位关联 + userPostMapper.deleteUserPostByUserId(userId); + // 新增用户与岗位管理 + insertUserPost(user); + return userMapper.updateUser(user); + } + + /** + * 用户授权角色 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + @Override + @Transactional + public void insertUserAuth(Long userId, Long[] roleIds) + { + String userName = SecurityUtils.getUsername(); + log.info(userName + "删除用户角色,参数:" + userId + ", " + roleIds); + + userRoleMapper.deleteUserRoleByUserId(userId); + insertUserRole(userId, roleIds); + } + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int updateUserStatus(SysUser user) + { + return userMapper.updateUser(user); + } + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int updateUserProfile(SysUser user) + { + return userMapper.updateUser(user); + } + + @Override + public int updateUserLogin(SysUser user) + { + return userMapper.updateUserLogin(user); + } + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + @Override + public boolean updateUserAvatar(String userName, String avatar) + { + return userMapper.updateUserAvatar(userName, avatar) > 0; + } + + /** + * 重置用户密码 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int resetPwd(SysUser user) + { + return userMapper.updateUser(user); + } + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + @Override + public int resetUserPwd(String userName, String password) + { + return userMapper.resetUserPwd(userName, password); + } + + /** + * 新增用户角色信息 + * + * @param user 用户对象 + */ + public void insertUserRole(SysUser user) + { + this.insertUserRole(user.getUserId(), user.getRoleIds()); + } + + /** + * 新增用户岗位信息 + * + * @param user 用户对象 + */ + public void insertUserPost(SysUser user) + { + Long[] posts = user.getPostIds(); + if (StringUtils.isNotEmpty(posts)) + { + // 新增用户与岗位管理 + List list = new ArrayList(posts.length); + for (Long postId : posts) + { + SysUserPost up = new SysUserPost(); + up.setUserId(user.getUserId()); + up.setPostId(postId); + list.add(up); + } + userPostMapper.batchUserPost(list); + } + } + + /** + * 新增用户角色信息 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + public void insertUserRole(Long userId, Long[] roleIds) + { + if (StringUtils.isNotEmpty(roleIds)) + { + // 新增用户与角色管理 + List list = new ArrayList(roleIds.length); + for (Long roleId : roleIds) + { + SysUserRole ur = new SysUserRole(); + ur.setUserId(userId); + ur.setRoleId(roleId); + list.add(ur); + } + userRoleMapper.batchUserRole(list); + } + } + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + @Override + @Transactional + public int deleteUserById(Long userId) + { + String userName = SecurityUtils.getUsername(); + log.info(userName + "删除用户角色,参数:" + userId); + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 删除用户与岗位表 + userPostMapper.deleteUserPostByUserId(userId); + return userMapper.deleteUserById(userId); + } + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + @Override + @Transactional + public int deleteUserByIds(Long[] userIds) + { + for (Long userId : userIds) + { + checkUserAllowed(new SysUser(userId)); + checkUserDataScope(userId); + } + String userName = SecurityUtils.getUsername(); + log.info(userName + "删除用户角色,参数:" + userIds); + // 删除用户与角色关联 + userRoleMapper.deleteUserRole(userIds); + // 删除用户与岗位关联 + userPostMapper.deleteUserPost(userIds); + // 删除用户与场馆关联 + userVenueMapper.deleteUserVenue(userIds); + + //删除处理用户登录的缓存 + Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); + //找到登录用户 + for (Long userId : userIds) { + for (String key : keys) { + LoginUser redisUser = redisCache.getCacheObject(key); + if (redisUser.getUserId().equals(userId)) { + redisCache.deleteObject(key); + } + } + } + return userMapper.deleteUserByIds(userIds); + } + + /** + * 导入用户数据 + * + * @param userList 用户数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + @Override + public String importUser(List userList, Boolean isUpdateSupport, String operName) + { + if (StringUtils.isNull(userList) || userList.size() == 0) + { + throw new ServiceException("导入用户数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + int userNum=0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + String password = configService.selectConfigByKey("sys.user.initPassword"); + for (SysUser user : userList) + { + try + { + if ( StringUtil.isEmpty(user.getPhonenumber()) ) { + throw new ServiceException("手机号码不能为空"); + } + + if ( StringUtil.isEmpty(user.getNickName()) ) { + throw new ServiceException("姓名不能为空"); + } + + if (!PhoneUtil.isMobile(user.getPhonenumber())) { + throw new ServiceException("手机号码格式不正确"); + } + + //设置登录用户名为手机号码 + if(StringUtils.isEmpty(user.getUserName())) + { + user.setUserName(user.getPhonenumber()); + } + + if(StringUtils.isNotEmpty(user.getUserType())) + { + //转用户专业 + String value = DictUtils.getDictValue("yw_specialty", user.getUserType()); + if(StringUtils.isNotEmpty(value)) + { + user.setUserType(value); + } + else + { + throw new ServiceException("专业匹配不正确!"); + } + } + else { + throw new ServiceException("专业不能为空!"); + } + + if(StringUtils.isNotEmpty(user.getCity())) + { + //转用户city + String value = DictUtils.getDictValue("yw_city", user.getCity()); + if(StringUtils.isNotEmpty(value)) + { + user.setCity(value); + } + else + { + throw new ServiceException("地市匹配不正确!"); + } + } + + if(StringUtils.isNotEmpty(user.getCounty())) + { + //转用户county + String value = DictUtils.getDictValue("yw_county", user.getCounty()); + if(StringUtils.isNotEmpty(value)) + { + user.setCounty(value); + } + else + { + throw new ServiceException("县区匹配不正确!"); + } + } + if(StringUtils.isNotEmpty(user.getDistinctArea())) + { + //转用户场馆分区 + String value = DictUtils.getDictValue("yw_belong_area", user.getDistinctArea()); + if(StringUtils.isNotEmpty(value)) + { + user.setDistinctArea(value); + } + else + { + throw new ServiceException("场馆分区匹配不正确!"); + } + } + + // 验证是否存在这个用户 +// SysUser u = userMapper.selectUserByUserName(user.getUserName()); + SysUser u = userMapper.selectUserByPhone(user.getPhonenumber()); + + if (StringUtils.isNull(u)) + { + + if(!"0".equals(user.getStatus())) + { + throw new ServiceException("用户状态必须为正常"); + } + + BeanValidators.validateWithException(validator, user); + user.setPassword(SecurityUtils.encryptPassword(password)); + user.setCreateBy(operName); + this.insertUser(user); + successNum++; + successMsg.append("
" + successNum + "、手机号码 " + user.getPhonenumber() + " 导入成功"); + } + else if (isUpdateSupport) + { + if("1".equals(user.getStatus())) + { + throw new ServiceException("不允许将用户状态修改为锁定"); + } + + //设置用户ID,现在用户ID不一定正确,看存在用户手机号码 + user.setUserId(u.getUserId()); + BeanValidators.validateWithException(validator, user); + checkUserAllowed(user); + checkUserDataScope(user.getUserId()); + user.setUpdateBy(operName); + this.updateUser(user); + successNum++; + successMsg.append("
" + successNum + "、手机号码 " + user.getPhonenumber() + " 更新成功"); + } + else + { + failureNum++; + failureMsg.append("
" + failureNum + "、手机号码 " + user.getPhonenumber() + " 已存在"); + } + } + catch (Exception e) + { + failureNum++; + String msg = "
" + failureNum + "、第 " + userNum + "列 导入失败:"; + failureMsg.append(msg + e.getMessage()); + log.error(msg, e); + } + finally { + userNum++; + } + } + if (failureNum > 0) + { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new ServiceException(failureMsg.toString()); + } + else + { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + } + return successMsg.toString(); + } + + @Override + public SysUserInfoVo getUserInfo(String userName) { + return userMapper.getUserInfo(userName); + } + + @Override + public List selectUserByUserType() { + return userMapper.selectUserByUserType(); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysAppMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysAppMenuMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..3ee40627c5dc47ba6fc6edfdd68e94bf8d73dcb3 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysAppMenuMapper.xml @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select menu_id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, coalesce(perms,'') as perms, icon,icon2, create_time + from sys_app_menu + + + + + + + + + + + + + + + + + + + + + + + + + + + update sys_app_menu + + menu_name = #{menuName}, + parent_id = #{parentId}, + order_num = #{orderNum}, + path = #{path}, + component = #{component}, + query = #{query}, + is_frame = #{isFrame}, + is_cache = #{isCache}, + menu_type = #{menuType}, + visible = #{visible}, + status = #{status}, + perms = #{perms}, + icon = #{icon}, + icon2 = #{icon2}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = now() + + where menu_id = #{menuId} + + + + insert into sys_app_menu( + + parent_id, + menu_name, + order_num, + path, + component, + query, + is_frame, + is_cache, + menu_type, + visible, + status, + perms, + icon, + icon2, + remark, + create_by, + create_time + )values( + + #{parentId}, + #{menuName}, + #{orderNum}, + #{path}, + #{component}, + #{query}, + #{isFrame}, + #{isCache}, + #{menuType}, + #{visible}, + #{status}, + #{perms}, + #{icon}, + #{icon2}, + #{remark}, + #{createBy}, + now() + ) + + + + delete from sys_app_menu where menu_id = #{menuId} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysAppRoleMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysAppRoleMenuMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..cf74a0378e78a798ab0e12bf05f6fa5233cb8fd5 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysAppRoleMenuMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + delete from sys_app_role_menu where role_id=#{roleId} + + + + delete from sys_app_role_menu where role_id in + + #{roleId} + + + + + insert into sys_app_role_menu(role_id, menu_id) values + + (#{item.roleId},#{item.menuId}) + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysAppUserMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysAppUserMenuMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..bc9036d85d56735229fd0de9da00be3ea67c3577 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysAppUserMenuMapper.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + delete from sys_app_user_menu where user_id=#{userId} + + + + delete from sys_app_user_menu where user_id in + + #{ids} + + + + + insert into sys_app_user_menu(user_id, menu_id) values + + (#{item.userId},#{item.menuId}) + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..4763eaed8cf5812694ea5d5158df8ad9099ec7bd --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark + from sys_config + + + + + + + and config_id = #{configId} + + + and config_key = #{configKey} + + + + + + + + + + + + insert into sys_config ( + config_name, + config_key, + config_value, + config_type, + create_by, + remark, + create_time + )values( + #{configName}, + #{configKey}, + #{configValue}, + #{configType}, + #{createBy}, + #{remark}, + now() + ) + + + + update sys_config + + config_name = #{configName}, + config_key = #{configKey}, + config_value = #{configValue}, + config_type = #{configType}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = now() + + where config_id = #{configId} + + + + delete from sys_config where config_id = #{configId} + + + + delete from sys_config where config_id in + + #{configId} + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..53dfe57f23007e84e11b30a529553fd5c5274510 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time + from sys_dept d + + + + + + + + + + + + + + + + + + + + insert into sys_dept( + + parent_id, + dept_name, + ancestors, + order_num, + leader, + phone, + email, + status, + create_by, + create_time + )values( + + #{parentId}, + #{deptName}, + #{ancestors}, + #{orderNum}, + #{leader}, + #{phone}, + #{email}, + #{status}, + #{createBy}, + now() + ) + + + + update sys_dept + + parent_id = #{parentId}, + dept_name = #{deptName}, + ancestors = #{ancestors}, + order_num = #{orderNum}, + leader = #{leader}, + phone = #{phone}, + email = #{email}, + status = #{status}, + update_by = #{updateBy}, + update_time = now() + + where dept_id = #{deptId} + + + + update sys_dept set ancestors = + + when #{item.deptId} then #{item.ancestors} + + where dept_id in + + #{item.deptId} + + + + + update sys_dept set status = '0' where dept_id in + + #{deptId} + + + + + update sys_dept set del_flag = '2' where dept_id = #{deptId} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..8b1bb762bfe4b696e3a25d88af8819afb6625eb6 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark + from sys_dict_data + + + + + + + + + + + + + + + + + + + + delete from sys_dict_data where dict_code = #{dictCode} + + + + delete from sys_dict_data where dict_code in + + #{dictCode} + + + + + update sys_dict_data + + dict_sort = #{dictSort}, + dict_label = #{dictLabel}, + dict_value = #{dictValue}, + dict_type = #{dictType}, + css_class = #{cssClass}, + list_class = #{listClass}, + is_default = #{isDefault}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = now() + + where dict_code = #{dictCode} + + + + update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType} + + + + insert into sys_dict_data( + dict_sort, + dict_label, + dict_value, + dict_type, + css_class, + list_class, + is_default, + status, + remark, + create_by, + create_time + )values( + #{dictSort}, + #{dictLabel}, + #{dictValue}, + #{dictType}, + #{cssClass}, + #{listClass}, + #{isDefault}, + #{status}, + #{remark}, + #{createBy}, + now() + ) + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..9425800f2752e88a426e325a42bd335adff4de90 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + select dict_id, dict_name, dict_type, status, create_by, create_time, remark + from sys_dict_type + + + + + + + + + + + + + + delete from sys_dict_type where dict_id = #{dictId} + + + + delete from sys_dict_type where dict_id in + + #{dictId} + + + + + update sys_dict_type + + dict_name = #{dictName}, + dict_type = #{dictType}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = now() + + where dict_id = #{dictId} + + + + insert into sys_dict_type( + dict_name, + dict_type, + status, + remark, + create_by, + create_time + )values( + #{dictName}, + #{dictType}, + #{status}, + #{remark}, + #{createBy}, + now() + ) + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..11da0f5423e5ff98bff7ac7720455cb20d5ce586 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time) + values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, now()) + + + + + + delete from sys_logininfor where info_id in + + #{infoId} + + + + + delete from sys_logininfor where login_time < now() + '- 6 month' + + + + truncate table sys_logininfor + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..a5d4321fc39333a920aa0488b1ea449e35f69b54 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select menu_id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, coalesce(perms,'') as perms, icon, create_time + from sys_menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + update sys_menu + + menu_name = #{menuName}, + parent_id = #{parentId}, + order_num = #{orderNum}, + path = #{path}, + component = #{component}, + query = #{query}, + is_frame = #{isFrame}, + is_cache = #{isCache}, + menu_type = #{menuType}, + visible = #{visible}, + status = #{status}, + perms = #{perms}, + icon = #{icon}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = now() + + where menu_id = #{menuId} + + + + insert into sys_menu( + + parent_id, + menu_name, + order_num, + path, + component, + query, + is_frame, + is_cache, + menu_type, + visible, + status, + perms, + icon, + remark, + create_by, + create_time + )values( + + #{parentId}, + #{menuName}, + #{orderNum}, + #{path}, + #{component}, + #{query}, + #{isFrame}, + #{isCache}, + #{menuType}, + #{visible}, + #{status}, + #{perms}, + #{icon}, + #{remark}, + #{createBy}, + now() + ) + + + + delete from sys_menu where menu_id = #{menuId} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..f1598d09abcef4fc90eb6d688dbf8c666c78ee18 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 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 + from sys_oper_log + + + + 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, oper_time) + values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, now()) + + + + + + delete from sys_oper_log where oper_id in + + #{operId} + + + + + delete from sys_oper_log where oper_time < now() + '- 6 month' + + + + + + truncate table sys_oper_log + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..d9bd120d36e03346843429917fae0e8b35305856 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark + from sys_post + + + + + + + + + + + + + + + + + + update sys_post + + post_code = #{postCode}, + post_name = #{postName}, + post_sort = #{postSort}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = now() + + where post_id = #{postId} + + + + insert into sys_post( + + post_code, + post_name, + post_sort, + status, + remark, + create_by, + create_time + )values( + + #{postCode}, + #{postName}, + #{postSort}, + #{status}, + #{remark}, + #{createBy}, + now() + ) + + + + delete from sys_post where post_id = #{postId} + + + + delete from sys_post where post_id in + + #{postId} + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..7c4139bce277c8792d6fbd92bb9b4c67504cd4dd --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + delete from sys_role_dept where role_id=#{roleId} + + + + + + delete from sys_role_dept where role_id in + + #{roleId} + + + + + insert into sys_role_dept(role_id, dept_id) values + + (#{item.roleId},#{item.deptId}) + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..0c1f445bd2ac1156d68f3b9bd69efe50d6deb0d4 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + select distinct r.role_id, + r.role_name, + r.role_key, + r.role_sort, + r.data_scope, + r.menu_check_strictly, + r.dept_check_strictly, + r.status, + r.del_flag, + r.create_time, + r.update_time, + r.remark + from sys_role r + left join sys_user_role ur on ur.role_id = r.role_id + left join sys_user u on u.user_id = ur.user_id + left join sys_dept d on u.dept_id = d.dept_id + + + + + + + + + + + + + + + + + + + + + insert into sys_role( + + role_name, + role_key, + role_sort, + data_scope, + menu_check_strictly, + dept_check_strictly, + status, + remark, + create_by, + create_time + )values( + + #{roleName}, + #{roleKey}, + #{roleSort}, + #{dataScope}, + #{menuCheckStrictly}, + #{deptCheckStrictly}, + #{status}, + #{remark}, + #{createBy}, + now() + ) + + + + update sys_role + + role_name = #{roleName}, + role_key = #{roleKey}, + role_sort = #{roleSort}, + data_scope = #{dataScope}, + menu_check_strictly = #{menuCheckStrictly}, + dept_check_strictly = #{deptCheckStrictly}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = now() + + where role_id = #{roleId} + + + + update sys_role + set del_flag = '2' + where role_id = #{roleId} + + + + update sys_role set del_flag = '2' where role_id in + + #{roleId} + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..cb60a852941ef1a28bee93383bc65ee678d2bde4 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + delete from sys_role_menu where role_id=#{roleId} + + + + delete from sys_role_menu where role_id in + + #{roleId} + + + + + insert into sys_role_menu(role_id, menu_id) values + + (#{item.roleId},#{item.menuId}) + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..adc2b5552b1999e5fb4f6e2b013e05d238c781fd --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -0,0 +1,539 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select u.user_id, + u.dept_id, + u.user_name, + u.nick_name, + u.user_type, + u.email, + u.avatar, + u.phonenumber, + u.password, + u.sex, + u.status, + u.del_flag, + u.login_ip, + u.login_date, + u.create_by, + u.create_time, + u.remark, + u.first_page, + u.city, + u.county, + u.distinct_area, + u.yw_user_belong, + d.dept_id, + d.parent_id, + d.ancestors, + d.dept_name, + d.order_num, + d.leader, + d.status as dept_status, + r.role_id, + r.role_name, + r.role_key, + r.role_sort, + r.data_scope, + r.status as role_status, + dic.dict_label as belong_area + from sys_user u + left join sys_dept d on u.dept_id = d.dept_id + 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 + left join (SELECT sys_dict_data.dict_label, + sys_dict_data.dict_value + FROM sys_dict_data + WHERE sys_dict_data.dict_type::text = 'yw_belong_area'::text) dic + on u.distinct_area = dic.dict_value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into sys_user( + + dept_id, + user_name, + nick_name, + user_type, + email, + avatar, + phonenumber, + sex, + password, + status, + create_by, + remark, + first_page, + city, + county, + distinct_area, + yw_user_belong, + login_date, + login_ip, + update_time, + update_by, + create_time + )values( + + #{deptId}, + #{userName}, + #{nickName}, + #{userType}, + #{email}, + #{avatar}, + #{phonenumber}, + #{sex}, + #{password}, + #{status}, + #{createBy}, + #{remark}, + #{firstPage}, + #{city}, + #{county}, + #{distinctArea}, + #{ywUserBelong}, + #{loginDate}, + #{loginIp}, + #{updateTime}, + #{updateBy}, + now() + ) + + + + update sys_user + + dept_id = #{deptId}, + user_name = #{userName}, + nick_name = #{nickName}, + user_type = #{userType}, + email = #{email}, + phonenumber = #{phonenumber}, + sex = #{sex}, + avatar = #{avatar}, + password = #{password}, + status = #{status}, + login_ip = #{loginIp}, + login_date = #{loginDate}, + update_by = #{updateBy}, + remark = #{remark}, + first_page =#{firstPage}, + city = #{city}, + county = #{county}, + distinct_area = #{distinctArea}, + yw_user_belong=#{ywUserBelong}, + update_time = now() + + where user_id = #{userId} + + + + update sys_user + + + login_ip = #{loginIp}, + login_date = #{loginDate}, + + + where user_id = #{userId} + + + + update sys_user + set status = #{status} + where user_id = #{userId} + + + + update sys_user + set avatar = #{avatar} + where user_name = #{userName} + + + + update sys_user + set password = #{password} + where user_name = #{userName} + + + + update sys_user + set del_flag = '2' + where user_id = #{userId} + + + + update sys_user set del_flag = '2' where user_id in + + #{userId} + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..2b90bc40b67418a0e2493683f7af2f27f3ddabbe --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + delete from sys_user_post where user_id=#{userId} + + + + + + delete from sys_user_post where user_id in + + #{userId} + + + + + insert into sys_user_post(user_id, post_id) values + + (#{item.userId},#{item.postId}) + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..40c0d32f6d18b03844f8abc6a3fe9889715d8cb4 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + delete from sys_user_role where user_id=#{userId} + + + + + + + + + + + delete from sys_user_role where user_id in + + #{userId} + + + + + insert into sys_user_role(user_id, role_id) values + + (#{item.userId},#{item.roleId}) + + + + + delete from sys_user_role where user_id=#{userId} and role_id=#{roleId} + + + + delete from sys_user_role where role_id=#{roleId} + + and user_id in + + #{userId} + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserVenueMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserVenueMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..be173c5568438127a40e0370dd81edb0c512277b --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserVenueMapper.xml @@ -0,0 +1,16 @@ + + + + + + + delete from yw_scene_user where user_id in + + #{userId} + + + + + \ No newline at end of file diff --git a/ry.bat b/ry.bat new file mode 100644 index 0000000000000000000000000000000000000000..ac1e4373973fab87700f666b13abf9de9e8000c9 --- /dev/null +++ b/ry.bat @@ -0,0 +1,67 @@ +@echo off + +rem jarƽĿ¼ +set AppName=ruoyi-admin.jar + +rem JVM +set JVM_OPTS="-Dname=%AppName% -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC" + + +ECHO. + ECHO. [1] %AppName% + ECHO. [2] ر%AppName% + ECHO. [3] %AppName% + ECHO. [4] ״̬ %AppName% + ECHO. [5] +ECHO. + +ECHO.ѡĿ: +set /p ID= + IF "%id%"=="1" GOTO start + IF "%id%"=="2" GOTO stop + IF "%id%"=="3" GOTO restart + IF "%id%"=="4" GOTO status + IF "%id%"=="5" EXIT +PAUSE +:start + for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( + set pid=%%a + set image_name=%%b + ) + if defined pid ( + echo %%is running + PAUSE + ) + +start javaw %JVM_OPTS% -jar %AppName% + +echo starting +echo Start %AppName% success... +goto:eof + +rem stopͨjpspid +:stop + for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( + set pid=%%a + set image_name=%%b + ) + if not defined pid (echo process %AppName% does not exists) else ( + echo prepare to kill %image_name% + echo start kill %pid% ... + rem ݽIDkill + taskkill /f /pid %pid% + ) +goto:eof +:restart + call :stop + call :start +goto:eof +:status + for /f "usebackq tokens=1-2" %%a in (`jps -l ^| findstr %AppName%`) do ( + set pid=%%a + set image_name=%%b + ) + if not defined pid (echo process %AppName% is dead ) else ( + echo %image_name% is running + ) +goto:eof diff --git a/ry.sh b/ry.sh new file mode 100644 index 0000000000000000000000000000000000000000..d6a9cf33ac732f9744f573139e8502ef049c0745 --- /dev/null +++ b/ry.sh @@ -0,0 +1,86 @@ +#!/bin/sh +# ./ry.sh start 启动 stop 停止 restart 重启 status 状态 +AppName=ruoyi-admin.jar + +# JVM参数 +JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC" +APP_HOME=`pwd` +LOG_PATH=$APP_HOME/logs/$AppName.log + +if [ "$1" = "" ]; +then + echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m" + exit 1 +fi + +if [ "$AppName" = "" ]; +then + echo -e "\033[0;31m 未输入应用名 \033[0m" + exit 1 +fi + +function start() +{ + PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'` + + if [ x"$PID" != x"" ]; then + echo "$AppName is running..." + else + nohup java $JVM_OPTS -jar $AppName > /dev/null 2>&1 & + echo "Start $AppName success..." + fi +} + +function stop() +{ + echo "Stop $AppName" + + PID="" + query(){ + PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'` + } + + query + if [ x"$PID" != x"" ]; then + kill -TERM $PID + echo "$AppName (pid:$PID) exiting..." + while [ x"$PID" != x"" ] + do + sleep 1 + query + done + echo "$AppName exited." + else + echo "$AppName already stopped." + fi +} + +function restart() +{ + stop + sleep 2 + start +} + +function status() +{ + PID=`ps -ef |grep java|grep $AppName|grep -v grep|wc -l` + if [ $PID != 0 ];then + echo "$AppName is running..." + else + echo "$AppName is not running..." + fi +} + +case $1 in + start) + start;; + stop) + stop;; + restart) + restart;; + status) + status;; + *) + +esac diff --git a/sql/quartz.sql b/sql/quartz.sql new file mode 100644 index 0000000000000000000000000000000000000000..cee613b7bb879cdf12b6b90ce04fbd73c237e430 --- /dev/null +++ b/sql/quartz.sql @@ -0,0 +1,174 @@ +DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS; +DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE; +DROP TABLE IF EXISTS QRTZ_LOCKS; +DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_TRIGGERS; +DROP TABLE IF EXISTS QRTZ_JOB_DETAILS; +DROP TABLE IF EXISTS QRTZ_CALENDARS; + +-- ---------------------------- +-- 1、存储每一个已配置的 jobDetail 的详细信息 +-- ---------------------------- +create table QRTZ_JOB_DETAILS ( + sched_name varchar(120) not null comment '调度名称', + job_name varchar(200) not null comment '任务名称', + job_group varchar(200) not null comment '任务组名', + description varchar(250) null comment '相关介绍', + job_class_name varchar(250) not null comment '执行任务类名称', + is_durable varchar(1) not null comment '是否持久化', + is_nonconcurrent varchar(1) not null comment '是否并发', + is_update_data varchar(1) not null comment '是否更新数据', + requests_recovery varchar(1) not null comment '是否接受恢复执行', + job_data blob null comment '存放持久化job对象', + primary key (sched_name, job_name, job_group) +) engine=innodb comment = '任务详细信息表'; + +-- ---------------------------- +-- 2、 存储已配置的 Trigger 的信息 +-- ---------------------------- +create table QRTZ_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment '触发器的名字', + trigger_group varchar(200) not null comment '触发器所属组的名字', + job_name varchar(200) not null comment 'qrtz_job_details表job_name的外键', + job_group varchar(200) not null comment 'qrtz_job_details表job_group的外键', + description varchar(250) null comment '相关介绍', + next_fire_time bigint(13) null comment '上一次触发时间(毫秒)', + prev_fire_time bigint(13) null comment '下一次触发时间(默认为-1表示不触发)', + priority integer null comment '优先级', + trigger_state varchar(16) not null comment '触发器状态', + trigger_type varchar(8) not null comment '触发器的类型', + start_time bigint(13) not null comment '开始时间', + end_time bigint(13) null comment '结束时间', + calendar_name varchar(200) null comment '日程表名称', + misfire_instr smallint(2) null comment '补偿执行的策略', + job_data blob null comment '存放持久化job对象', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, job_name, job_group) references QRTZ_JOB_DETAILS(sched_name, job_name, job_group) +) engine=innodb comment = '触发器详细信息表'; + +-- ---------------------------- +-- 3、 存储简单的 Trigger,包括重复次数,间隔,以及已触发的次数 +-- ---------------------------- +create table QRTZ_SIMPLE_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + repeat_count bigint(7) not null comment '重复的次数统计', + repeat_interval bigint(12) not null comment '重复的间隔时间', + times_triggered bigint(10) not null comment '已经触发的次数', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) +) engine=innodb comment = '简单触发器的信息表'; + +-- ---------------------------- +-- 4、 存储 Cron Trigger,包括 Cron 表达式和时区信息 +-- ---------------------------- +create table QRTZ_CRON_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + cron_expression varchar(200) not null comment 'cron表达式', + time_zone_id varchar(80) comment '时区', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) +) engine=innodb comment = 'Cron类型的触发器表'; + +-- ---------------------------- +-- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型,JobStore 并不知道如何存储实例的时候) +-- ---------------------------- +create table QRTZ_BLOB_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + blob_data blob null comment '存放持久化Trigger对象', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) +) engine=innodb comment = 'Blob类型的触发器表'; + +-- ---------------------------- +-- 6、 以 Blob 类型存储存放日历信息, quartz可配置一个日历来指定一个时间范围 +-- ---------------------------- +create table QRTZ_CALENDARS ( + sched_name varchar(120) not null comment '调度名称', + calendar_name varchar(200) not null comment '日历名称', + calendar blob not null comment '存放持久化calendar对象', + primary key (sched_name, calendar_name) +) engine=innodb comment = '日历信息表'; + +-- ---------------------------- +-- 7、 存储已暂停的 Trigger 组的信息 +-- ---------------------------- +create table QRTZ_PAUSED_TRIGGER_GRPS ( + sched_name varchar(120) not null comment '调度名称', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + primary key (sched_name, trigger_group) +) engine=innodb comment = '暂停的触发器表'; + +-- ---------------------------- +-- 8、 存储与已触发的 Trigger 相关的状态信息,以及相联 Job 的执行信息 +-- ---------------------------- +create table QRTZ_FIRED_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + entry_id varchar(95) not null comment '调度器实例id', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + instance_name varchar(200) not null comment '调度器实例名', + fired_time bigint(13) not null comment '触发的时间', + sched_time bigint(13) not null comment '定时器制定的时间', + priority integer not null comment '优先级', + state varchar(16) not null comment '状态', + job_name varchar(200) null comment '任务名称', + job_group varchar(200) null comment '任务组名', + is_nonconcurrent varchar(1) null comment '是否并发', + requests_recovery varchar(1) null comment '是否接受恢复执行', + primary key (sched_name, entry_id) +) engine=innodb comment = '已触发的触发器表'; + +-- ---------------------------- +-- 9、 存储少量的有关 Scheduler 的状态信息,假如是用于集群中,可以看到其他的 Scheduler 实例 +-- ---------------------------- +create table QRTZ_SCHEDULER_STATE ( + sched_name varchar(120) not null comment '调度名称', + instance_name varchar(200) not null comment '实例名称', + last_checkin_time bigint(13) not null comment '上次检查时间', + checkin_interval bigint(13) not null comment '检查间隔时间', + primary key (sched_name, instance_name) +) engine=innodb comment = '调度器状态表'; + +-- ---------------------------- +-- 10、 存储程序的悲观锁的信息(假如使用了悲观锁) +-- ---------------------------- +create table QRTZ_LOCKS ( + sched_name varchar(120) not null comment '调度名称', + lock_name varchar(40) not null comment '悲观锁名称', + primary key (sched_name, lock_name) +) engine=innodb comment = '存储的悲观锁信息表'; + +-- ---------------------------- +-- 11、 Quartz集群实现同步机制的行锁表 +-- ---------------------------- +create table QRTZ_SIMPROP_TRIGGERS ( + sched_name varchar(120) not null comment '调度名称', + trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', + trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', + str_prop_1 varchar(512) null comment 'String类型的trigger的第一个参数', + str_prop_2 varchar(512) null comment 'String类型的trigger的第二个参数', + str_prop_3 varchar(512) null comment 'String类型的trigger的第三个参数', + int_prop_1 int null comment 'int类型的trigger的第一个参数', + int_prop_2 int null comment 'int类型的trigger的第二个参数', + long_prop_1 bigint null comment 'long类型的trigger的第一个参数', + long_prop_2 bigint null comment 'long类型的trigger的第二个参数', + dec_prop_1 numeric(13,4) null comment 'decimal类型的trigger的第一个参数', + dec_prop_2 numeric(13,4) null comment 'decimal类型的trigger的第二个参数', + bool_prop_1 varchar(1) null comment 'Boolean类型的trigger的第一个参数', + bool_prop_2 varchar(1) null comment 'Boolean类型的trigger的第二个参数', + primary key (sched_name, trigger_name, trigger_group), + foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) +) engine=innodb comment = '同步机制的行锁表'; + +commit; \ No newline at end of file diff --git a/sql/ry_20220822.sql b/sql/ry_20220822.sql new file mode 100644 index 0000000000000000000000000000000000000000..f58841697f3f443b38a53d339225b748df4fb7d1 --- /dev/null +++ b/sql/ry_20220822.sql @@ -0,0 +1,692 @@ +-- ---------------------------- +-- 1、部门表 +-- ---------------------------- +drop table if exists sys_dept; +create table sys_dept ( + dept_id bigint(20) not null auto_increment comment '部门id', + parent_id bigint(20) default 0 comment '父部门id', + ancestors varchar(50) default '' comment '祖级列表', + dept_name varchar(30) default '' comment '部门名称', + order_num int(4) default 0 comment '显示顺序', + leader varchar(20) default null comment '负责人', + phone varchar(11) default null comment '联系电话', + email varchar(50) default null comment '邮箱', + status char(1) default '0' comment '部门状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (dept_id) +) engine=innodb auto_increment=200 comment = '部门表'; + +-- ---------------------------- +-- 初始化-部门表数据 +-- ---------------------------- +insert into sys_dept values(100, 0, '0', '若依科技', 0, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(101, 100, '0,100', '深圳总公司', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(102, 100, '0,100', '长沙分公司', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(103, 101, '0,100,101', '研发部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(104, 101, '0,100,101', '市场部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(105, 101, '0,100,101', '测试部门', 3, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(106, 101, '0,100,101', '财务部门', 4, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(107, 101, '0,100,101', '运维部门', 5, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(108, 102, '0,100,102', '市场部门', 1, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); +insert into sys_dept values(109, 102, '0,100,102', '财务部门', 2, '若依', '15888888888', 'ry@qq.com', '0', '0', 'admin', sysdate(), '', null); + + +-- ---------------------------- +-- 2、用户信息表 +-- ---------------------------- +drop table if exists sys_user; +create table sys_user ( + user_id bigint(20) not null auto_increment comment '用户ID', + dept_id bigint(20) default null comment '部门ID', + user_name varchar(30) not null comment '用户账号', + nick_name varchar(30) not null comment '用户昵称', + user_type varchar(2) default '00' comment '用户类型(00系统用户)', + email varchar(50) default '' comment '用户邮箱', + phonenumber varchar(11) default '' comment '手机号码', + sex char(1) default '0' comment '用户性别(0男 1女 2未知)', + avatar varchar(100) default '' comment '头像地址', + password varchar(100) default '' comment '密码', + status char(1) default '0' comment '帐号状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', + login_ip varchar(128) default '' comment '最后登录IP', + login_date datetime comment '最后登录时间', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (user_id) +) engine=innodb auto_increment=100 comment = '用户信息表'; + +-- ---------------------------- +-- 初始化-用户信息表数据 +-- ---------------------------- +insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '管理员'); +insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '测试员'); + + +-- ---------------------------- +-- 3、岗位信息表 +-- ---------------------------- +drop table if exists sys_post; +create table sys_post +( + post_id bigint(20) not null auto_increment comment '岗位ID', + post_code varchar(64) not null comment '岗位编码', + post_name varchar(50) not null comment '岗位名称', + post_sort int(4) not null comment '显示顺序', + status char(1) not null comment '状态(0正常 1停用)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (post_id) +) engine=innodb comment = '岗位信息表'; + +-- ---------------------------- +-- 初始化-岗位信息表数据 +-- ---------------------------- +insert into sys_post values(1, 'ceo', '董事长', 1, '0', 'admin', sysdate(), '', null, ''); +insert into sys_post values(2, 'se', '项目经理', 2, '0', 'admin', sysdate(), '', null, ''); +insert into sys_post values(3, 'hr', '人力资源', 3, '0', 'admin', sysdate(), '', null, ''); +insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', sysdate(), '', null, ''); + + +-- ---------------------------- +-- 4、角色信息表 +-- ---------------------------- +drop table if exists sys_role; +create table sys_role ( + role_id bigint(20) not null auto_increment comment '角色ID', + role_name varchar(30) not null comment '角色名称', + role_key varchar(100) not null comment '角色权限字符串', + role_sort int(4) not null comment '显示顺序', + data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', + menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示', + dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示', + status char(1) not null comment '角色状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (role_id) +) engine=innodb auto_increment=100 comment = '角色信息表'; + +-- ---------------------------- +-- 初始化-角色信息表数据 +-- ---------------------------- +insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员'); +insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色'); + + +-- ---------------------------- +-- 5、菜单权限表 +-- ---------------------------- +drop table if exists sys_menu; +create table sys_menu ( + menu_id bigint(20) not null auto_increment comment '菜单ID', + menu_name varchar(50) not null comment '菜单名称', + parent_id bigint(20) default 0 comment '父菜单ID', + order_num int(4) default 0 comment '显示顺序', + path varchar(200) default '' comment '路由地址', + component varchar(255) default null comment '组件路径', + query varchar(255) default null comment '路由参数', + is_frame int(1) default 1 comment '是否为外链(0是 1否)', + is_cache int(1) default 0 comment '是否缓存(0缓存 1不缓存)', + menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)', + visible char(1) default 0 comment '菜单状态(0显示 1隐藏)', + status char(1) default 0 comment '菜单状态(0正常 1停用)', + perms varchar(100) default null comment '权限标识', + icon varchar(100) default '#' comment '菜单图标', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default '' comment '备注', + primary key (menu_id) +) engine=innodb auto_increment=2000 comment = '菜单权限表'; + +-- ---------------------------- +-- 初始化-菜单信息表数据 +-- ---------------------------- +-- 一级菜单 +insert into sys_menu values('1', '系统管理', '0', '1', 'system', null, '', 1, 0, 'M', '0', '0', '', 'system', 'admin', sysdate(), '', null, '系统管理目录'); +insert into sys_menu values('2', '系统监控', '0', '2', 'monitor', null, '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', sysdate(), '', null, '系统监控目录'); +insert into sys_menu values('3', '系统工具', '0', '3', 'tool', null, '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', sysdate(), '', null, '系统工具目录'); +insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', null, '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', sysdate(), '', null, '若依官网地址'); +-- 二级菜单 +insert into sys_menu values('100', '用户管理', '1', '1', 'user', 'system/user/index', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', sysdate(), '', null, '用户管理菜单'); +insert into sys_menu values('101', '角色管理', '1', '2', 'role', 'system/role/index', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', sysdate(), '', null, '角色管理菜单'); +insert into sys_menu values('102', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', sysdate(), '', null, '菜单管理菜单'); +insert into sys_menu values('103', '部门管理', '1', '4', 'dept', 'system/dept/index', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', sysdate(), '', null, '部门管理菜单'); +insert into sys_menu values('104', '岗位管理', '1', '5', 'post', 'system/post/index', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', sysdate(), '', null, '岗位管理菜单'); +insert into sys_menu values('105', '字典管理', '1', '6', 'dict', 'system/dict/index', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate(), '', null, '字典管理菜单'); +insert into sys_menu values('106', '参数设置', '1', '7', 'config', 'system/config/index', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate(), '', null, '参数设置菜单'); +insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单'); +insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单'); +insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单'); +insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单'); +insert into sys_menu values('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, '数据监控菜单'); +insert into sys_menu values('112', '服务监控', '2', '4', 'server', 'monitor/server/index', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单'); +insert into sys_menu values('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', sysdate(), '', null, '缓存监控菜单'); +insert into sys_menu values('114', '缓存列表', '2', '6', 'cacheList', 'monitor/cache/list', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis-list', 'admin', sysdate(), '', null, '缓存列表菜单'); +insert into sys_menu values('115', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单'); +insert into sys_menu values('116', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单'); +insert into sys_menu values('117', '系统接口', '3', '3', 'swagger', 'tool/swagger/index', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单'); +-- 三级菜单 +insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'monitor/operlog/index', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单'); +insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'monitor/logininfor/index', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单'); +-- 用户管理按钮 +insert into sys_menu values('1000', '用户查询', '100', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1001', '用户新增', '100', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1002', '用户修改', '100', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1003', '用户删除', '100', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1004', '用户导出', '100', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1005', '用户导入', '100', '6', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1006', '重置密码', '100', '7', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', sysdate(), '', null, ''); +-- 角色管理按钮 +insert into sys_menu values('1007', '角色查询', '101', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1008', '角色新增', '101', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1009', '角色修改', '101', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1010', '角色删除', '101', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1011', '角色导出', '101', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', sysdate(), '', null, ''); +-- 菜单管理按钮 +insert into sys_menu values('1012', '菜单查询', '102', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1013', '菜单新增', '102', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1014', '菜单修改', '102', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1015', '菜单删除', '102', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', sysdate(), '', null, ''); +-- 部门管理按钮 +insert into sys_menu values('1016', '部门查询', '103', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1017', '部门新增', '103', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1018', '部门修改', '103', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1019', '部门删除', '103', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', sysdate(), '', null, ''); +-- 岗位管理按钮 +insert into sys_menu values('1020', '岗位查询', '104', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1021', '岗位新增', '104', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1022', '岗位修改', '104', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1023', '岗位删除', '104', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1024', '岗位导出', '104', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', sysdate(), '', null, ''); +-- 字典管理按钮 +insert into sys_menu values('1025', '字典查询', '105', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1026', '字典新增', '105', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1027', '字典修改', '105', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1028', '字典删除', '105', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1029', '字典导出', '105', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', sysdate(), '', null, ''); +-- 参数设置按钮 +insert into sys_menu values('1030', '参数查询', '106', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1031', '参数新增', '106', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1032', '参数修改', '106', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1033', '参数删除', '106', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1034', '参数导出', '106', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', sysdate(), '', null, ''); +-- 通知公告按钮 +insert into sys_menu values('1035', '公告查询', '107', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1036', '公告新增', '107', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1037', '公告修改', '107', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', sysdate(), '', null, ''); +-- 操作日志按钮 +insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1041', '日志导出', '500', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', sysdate(), '', null, ''); +-- 登录日志按钮 +insert into sys_menu values('1042', '登录查询', '501', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1043', '登录删除', '501', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1044', '日志导出', '501', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1045', '账户解锁', '501', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock', '#', 'admin', sysdate(), '', null, ''); +-- 在线用户按钮 +insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, ''); +-- 定时任务按钮 +insert into sys_menu values('1049', '任务查询', '110', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1050', '任务新增', '110', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1051', '任务修改', '110', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1052', '任务删除', '110', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1053', '状态修改', '110', '5', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1054', '任务导出', '110', '6', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, ''); +-- 代码生成按钮 +insert into sys_menu values('1055', '生成查询', '116', '1', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1056', '生成修改', '116', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1057', '生成删除', '116', '3', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1058', '导入代码', '116', '4', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1059', '预览代码', '116', '5', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1060', '生成代码', '116', '6', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, ''); + + +-- ---------------------------- +-- 6、用户和角色关联表 用户N-1角色 +-- ---------------------------- +drop table if exists sys_user_role; +create table sys_user_role ( + user_id bigint(20) not null comment '用户ID', + role_id bigint(20) not null comment '角色ID', + primary key(user_id, role_id) +) engine=innodb comment = '用户和角色关联表'; + +-- ---------------------------- +-- 初始化-用户和角色关联表数据 +-- ---------------------------- +insert into sys_user_role values ('1', '1'); +insert into sys_user_role values ('2', '2'); + + +-- ---------------------------- +-- 7、角色和菜单关联表 角色1-N菜单 +-- ---------------------------- +drop table if exists sys_role_menu; +create table sys_role_menu ( + role_id bigint(20) not null comment '角色ID', + menu_id bigint(20) not null comment '菜单ID', + primary key(role_id, menu_id) +) engine=innodb comment = '角色和菜单关联表'; + +-- ---------------------------- +-- 初始化-角色和菜单关联表数据 +-- ---------------------------- +insert into sys_role_menu values ('2', '1'); +insert into sys_role_menu values ('2', '2'); +insert into sys_role_menu values ('2', '3'); +insert into sys_role_menu values ('2', '4'); +insert into sys_role_menu values ('2', '100'); +insert into sys_role_menu values ('2', '101'); +insert into sys_role_menu values ('2', '102'); +insert into sys_role_menu values ('2', '103'); +insert into sys_role_menu values ('2', '104'); +insert into sys_role_menu values ('2', '105'); +insert into sys_role_menu values ('2', '106'); +insert into sys_role_menu values ('2', '107'); +insert into sys_role_menu values ('2', '108'); +insert into sys_role_menu values ('2', '109'); +insert into sys_role_menu values ('2', '110'); +insert into sys_role_menu values ('2', '111'); +insert into sys_role_menu values ('2', '112'); +insert into sys_role_menu values ('2', '113'); +insert into sys_role_menu values ('2', '114'); +insert into sys_role_menu values ('2', '115'); +insert into sys_role_menu values ('2', '116'); +insert into sys_role_menu values ('2', '117'); +insert into sys_role_menu values ('2', '500'); +insert into sys_role_menu values ('2', '501'); +insert into sys_role_menu values ('2', '1000'); +insert into sys_role_menu values ('2', '1001'); +insert into sys_role_menu values ('2', '1002'); +insert into sys_role_menu values ('2', '1003'); +insert into sys_role_menu values ('2', '1004'); +insert into sys_role_menu values ('2', '1005'); +insert into sys_role_menu values ('2', '1006'); +insert into sys_role_menu values ('2', '1007'); +insert into sys_role_menu values ('2', '1008'); +insert into sys_role_menu values ('2', '1009'); +insert into sys_role_menu values ('2', '1010'); +insert into sys_role_menu values ('2', '1011'); +insert into sys_role_menu values ('2', '1012'); +insert into sys_role_menu values ('2', '1013'); +insert into sys_role_menu values ('2', '1014'); +insert into sys_role_menu values ('2', '1015'); +insert into sys_role_menu values ('2', '1016'); +insert into sys_role_menu values ('2', '1017'); +insert into sys_role_menu values ('2', '1018'); +insert into sys_role_menu values ('2', '1019'); +insert into sys_role_menu values ('2', '1020'); +insert into sys_role_menu values ('2', '1021'); +insert into sys_role_menu values ('2', '1022'); +insert into sys_role_menu values ('2', '1023'); +insert into sys_role_menu values ('2', '1024'); +insert into sys_role_menu values ('2', '1025'); +insert into sys_role_menu values ('2', '1026'); +insert into sys_role_menu values ('2', '1027'); +insert into sys_role_menu values ('2', '1028'); +insert into sys_role_menu values ('2', '1029'); +insert into sys_role_menu values ('2', '1030'); +insert into sys_role_menu values ('2', '1031'); +insert into sys_role_menu values ('2', '1032'); +insert into sys_role_menu values ('2', '1033'); +insert into sys_role_menu values ('2', '1034'); +insert into sys_role_menu values ('2', '1035'); +insert into sys_role_menu values ('2', '1036'); +insert into sys_role_menu values ('2', '1037'); +insert into sys_role_menu values ('2', '1038'); +insert into sys_role_menu values ('2', '1039'); +insert into sys_role_menu values ('2', '1040'); +insert into sys_role_menu values ('2', '1041'); +insert into sys_role_menu values ('2', '1042'); +insert into sys_role_menu values ('2', '1043'); +insert into sys_role_menu values ('2', '1044'); +insert into sys_role_menu values ('2', '1045'); +insert into sys_role_menu values ('2', '1046'); +insert into sys_role_menu values ('2', '1047'); +insert into sys_role_menu values ('2', '1048'); +insert into sys_role_menu values ('2', '1049'); +insert into sys_role_menu values ('2', '1050'); +insert into sys_role_menu values ('2', '1051'); +insert into sys_role_menu values ('2', '1052'); +insert into sys_role_menu values ('2', '1053'); +insert into sys_role_menu values ('2', '1054'); +insert into sys_role_menu values ('2', '1055'); +insert into sys_role_menu values ('2', '1056'); +insert into sys_role_menu values ('2', '1057'); +insert into sys_role_menu values ('2', '1058'); +insert into sys_role_menu values ('2', '1059'); +insert into sys_role_menu values ('2', '1060'); + +-- ---------------------------- +-- 8、角色和部门关联表 角色1-N部门 +-- ---------------------------- +drop table if exists sys_role_dept; +create table sys_role_dept ( + role_id bigint(20) not null comment '角色ID', + dept_id bigint(20) not null comment '部门ID', + primary key(role_id, dept_id) +) engine=innodb comment = '角色和部门关联表'; + +-- ---------------------------- +-- 初始化-角色和部门关联表数据 +-- ---------------------------- +insert into sys_role_dept values ('2', '100'); +insert into sys_role_dept values ('2', '101'); +insert into sys_role_dept values ('2', '105'); + + +-- ---------------------------- +-- 9、用户与岗位关联表 用户1-N岗位 +-- ---------------------------- +drop table if exists sys_user_post; +create table sys_user_post +( + user_id bigint(20) not null comment '用户ID', + post_id bigint(20) not null comment '岗位ID', + primary key (user_id, post_id) +) engine=innodb comment = '用户与岗位关联表'; + +-- ---------------------------- +-- 初始化-用户与岗位关联表数据 +-- ---------------------------- +insert into sys_user_post values ('1', '1'); +insert into sys_user_post values ('2', '2'); + + +-- ---------------------------- +-- 10、操作日志记录 +-- ---------------------------- +drop table if exists sys_oper_log; +create table sys_oper_log ( + oper_id bigint(20) not null auto_increment comment '日志主键', + title varchar(50) default '' comment '模块标题', + business_type int(2) default 0 comment '业务类型(0其它 1新增 2修改 3删除)', + method varchar(100) default '' comment '方法名称', + request_method varchar(10) default '' comment '请求方式', + operator_type int(1) default 0 comment '操作类别(0其它 1后台用户 2手机端用户)', + oper_name varchar(50) default '' comment '操作人员', + dept_name varchar(50) default '' comment '部门名称', + oper_url varchar(255) default '' comment '请求URL', + oper_ip varchar(128) default '' comment '主机地址', + oper_location varchar(255) default '' comment '操作地点', + oper_param varchar(2000) default '' comment '请求参数', + json_result varchar(2000) default '' comment '返回参数', + status int(1) default 0 comment '操作状态(0正常 1异常)', + error_msg varchar(2000) default '' comment '错误消息', + oper_time datetime comment '操作时间', + primary key (oper_id) +) engine=innodb auto_increment=100 comment = '操作日志记录'; + + +-- ---------------------------- +-- 11、字典类型表 +-- ---------------------------- +drop table if exists sys_dict_type; +create table sys_dict_type +( + dict_id bigint(20) not null auto_increment comment '字典主键', + dict_name varchar(100) default '' comment '字典名称', + dict_type varchar(100) default '' comment '字典类型', + status char(1) default '0' comment '状态(0正常 1停用)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (dict_id), + unique (dict_type) +) engine=innodb auto_increment=100 comment = '字典类型表'; + +insert into sys_dict_type values(1, '用户性别', 'sys_user_sex', '0', 'admin', sysdate(), '', null, '用户性别列表'); +insert into sys_dict_type values(2, '菜单状态', 'sys_show_hide', '0', 'admin', sysdate(), '', null, '菜单状态列表'); +insert into sys_dict_type values(3, '系统开关', 'sys_normal_disable', '0', 'admin', sysdate(), '', null, '系统开关列表'); +insert into sys_dict_type values(4, '任务状态', 'sys_job_status', '0', 'admin', sysdate(), '', null, '任务状态列表'); +insert into sys_dict_type values(5, '任务分组', 'sys_job_group', '0', 'admin', sysdate(), '', null, '任务分组列表'); +insert into sys_dict_type values(6, '系统是否', 'sys_yes_no', '0', 'admin', sysdate(), '', null, '系统是否列表'); +insert into sys_dict_type values(7, '通知类型', 'sys_notice_type', '0', 'admin', sysdate(), '', null, '通知类型列表'); +insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0', 'admin', sysdate(), '', null, '通知状态列表'); +insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', sysdate(), '', null, '操作类型列表'); +insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', sysdate(), '', null, '登录状态列表'); + + +-- ---------------------------- +-- 12、字典数据表 +-- ---------------------------- +drop table if exists sys_dict_data; +create table sys_dict_data +( + dict_code bigint(20) not null auto_increment comment '字典编码', + dict_sort int(4) default 0 comment '字典排序', + dict_label varchar(100) default '' comment '字典标签', + dict_value varchar(100) default '' comment '字典键值', + dict_type varchar(100) default '' comment '字典类型', + css_class varchar(100) default null comment '样式属性(其他样式扩展)', + list_class varchar(100) default null comment '表格回显样式', + is_default char(1) default 'N' comment '是否默认(Y是 N否)', + status char(1) default '0' comment '状态(0正常 1停用)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (dict_code) +) engine=innodb auto_increment=100 comment = '字典数据表'; + +insert into sys_dict_data values(1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', sysdate(), '', null, '性别男'); +insert into sys_dict_data values(2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别女'); +insert into sys_dict_data values(3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', sysdate(), '', null, '性别未知'); +insert into sys_dict_data values(4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '显示菜单'); +insert into sys_dict_data values(5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '隐藏菜单'); +insert into sys_dict_data values(6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态'); +insert into sys_dict_data values(7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态'); +insert into sys_dict_data values(8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态'); +insert into sys_dict_data values(9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态'); +insert into sys_dict_data values(10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', sysdate(), '', null, '默认分组'); +insert into sys_dict_data values(11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', sysdate(), '', null, '系统分组'); +insert into sys_dict_data values(12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '系统默认是'); +insert into sys_dict_data values(13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '系统默认否'); +insert into sys_dict_data values(14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', sysdate(), '', null, '通知'); +insert into sys_dict_data values(15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', sysdate(), '', null, '公告'); +insert into sys_dict_data values(16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态'); +insert into sys_dict_data values(17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '关闭状态'); +insert into sys_dict_data values(18, 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '其他操作'); +insert into sys_dict_data values(19, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '新增操作'); +insert into sys_dict_data values(20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '修改操作'); +insert into sys_dict_data values(21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '删除操作'); +insert into sys_dict_data values(22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '授权操作'); +insert into sys_dict_data values(23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导出操作'); +insert into sys_dict_data values(24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导入操作'); +insert into sys_dict_data values(25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '强退操作'); +insert into sys_dict_data values(26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '生成操作'); +insert into sys_dict_data values(27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '清空操作'); +insert into sys_dict_data values(28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '正常状态'); +insert into sys_dict_data values(29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态'); + + +-- ---------------------------- +-- 13、参数配置表 +-- ---------------------------- +drop table if exists sys_config; +create table sys_config ( + config_id int(5) not null auto_increment comment '参数主键', + config_name varchar(100) default '' comment '参数名称', + config_key varchar(100) default '' comment '参数键名', + config_value varchar(500) default '' comment '参数键值', + config_type char(1) default 'N' comment '系统内置(Y是 N否)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (config_id) +) engine=innodb auto_increment=100 comment = '参数配置表'; + +insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', sysdate(), '', null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' ); +insert into sys_config values(2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate(), '', null, '初始化密码 123456' ); +insert into sys_config values(3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', sysdate(), '', null, '深色主题theme-dark,浅色主题theme-light' ); +insert into sys_config values(4, '账号自助-验证码开关', 'sys.account.captchaEnabled', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启验证码功能(true开启,false关闭)'); +insert into sys_config values(5, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate(), '', null, '是否开启注册用户功能(true开启,false关闭)'); + + +-- ---------------------------- +-- 14、系统访问记录 +-- ---------------------------- +drop table if exists sys_logininfor; +create table sys_logininfor ( + info_id bigint(20) not null auto_increment comment '访问ID', + user_name varchar(50) default '' comment '用户账号', + ipaddr varchar(128) default '' comment '登录IP地址', + login_location varchar(255) default '' comment '登录地点', + browser varchar(50) default '' comment '浏览器类型', + os varchar(50) default '' comment '操作系统', + status char(1) default '0' comment '登录状态(0成功 1失败)', + msg varchar(255) default '' comment '提示消息', + login_time datetime comment '访问时间', + primary key (info_id) +) engine=innodb auto_increment=100 comment = '系统访问记录'; + + +-- ---------------------------- +-- 15、定时任务调度表 +-- ---------------------------- +drop table if exists sys_job; +create table sys_job ( + job_id bigint(20) not null auto_increment comment '任务ID', + job_name varchar(64) default '' comment '任务名称', + job_group varchar(64) default 'DEFAULT' comment '任务组名', + invoke_target varchar(500) not null comment '调用目标字符串', + cron_expression varchar(255) default '' comment 'cron执行表达式', + misfire_policy varchar(20) default '3' comment '计划执行错误策略(1立即执行 2执行一次 3放弃执行)', + concurrent char(1) default '1' comment '是否并发执行(0允许 1禁止)', + status char(1) default '0' comment '状态(0正常 1暂停)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default '' comment '备注信息', + primary key (job_id, job_name, job_group) +) engine=innodb auto_increment=100 comment = '定时任务调度表'; + +insert into sys_job values(1, '系统默认(无参)', 'DEFAULT', 'ryTask.ryNoParams', '0/10 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); +insert into sys_job values(2, '系统默认(有参)', 'DEFAULT', 'ryTask.ryParams(\'ry\')', '0/15 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); +insert into sys_job values(3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryMultipleParams(\'ry\', true, 2000L, 316.50D, 100)', '0/20 * * * * ?', '3', '1', '1', 'admin', sysdate(), '', null, ''); + + +-- ---------------------------- +-- 16、定时任务调度日志表 +-- ---------------------------- +drop table if exists sys_job_log; +create table sys_job_log ( + job_log_id bigint(20) not null auto_increment comment '任务日志ID', + job_name varchar(64) not null comment '任务名称', + job_group varchar(64) not null comment '任务组名', + invoke_target varchar(500) not null comment '调用目标字符串', + job_message varchar(500) comment '日志信息', + status char(1) default '0' comment '执行状态(0正常 1失败)', + exception_info varchar(2000) default '' comment '异常信息', + create_time datetime comment '创建时间', + primary key (job_log_id) +) engine=innodb comment = '定时任务调度日志表'; + + +-- ---------------------------- +-- 17、通知公告表 +-- ---------------------------- +drop table if exists sys_notice; +create table sys_notice ( + notice_id int(4) not null auto_increment comment '公告ID', + notice_title varchar(50) not null comment '公告标题', + notice_type char(1) not null comment '公告类型(1通知 2公告)', + notice_content longblob default null comment '公告内容', + status char(1) default '0' comment '公告状态(0正常 1关闭)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(255) default null comment '备注', + primary key (notice_id) +) engine=innodb auto_increment=10 comment = '通知公告表'; + +-- ---------------------------- +-- 初始化-公告信息表数据 +-- ---------------------------- +insert into sys_notice values('1', '温馨提醒:2018-07-01 若依新版本发布啦', '2', '新版本内容', '0', 'admin', sysdate(), '', null, '管理员'); +insert into sys_notice values('2', '维护通知:2018-07-01 若依系统凌晨维护', '1', '维护内容', '0', 'admin', sysdate(), '', null, '管理员'); + + +-- ---------------------------- +-- 18、代码生成业务表 +-- ---------------------------- +drop table if exists gen_table; +create table gen_table ( + table_id bigint(20) not null auto_increment comment '编号', + table_name varchar(200) default '' comment '表名称', + table_comment varchar(500) default '' comment '表描述', + sub_table_name varchar(64) default null comment '关联子表的表名', + sub_table_fk_name varchar(64) default null comment '子表关联的外键名', + class_name varchar(100) default '' comment '实体类名称', + tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作)', + package_name varchar(100) comment '生成包路径', + module_name varchar(30) comment '生成模块名', + business_name varchar(30) comment '生成业务名', + function_name varchar(50) comment '生成功能名', + function_author varchar(50) comment '生成功能作者', + gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)', + gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)', + options varchar(1000) comment '其它生成选项', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (table_id) +) engine=innodb auto_increment=1 comment = '代码生成业务表'; + + +-- ---------------------------- +-- 19、代码生成业务表字段 +-- ---------------------------- +drop table if exists gen_table_column; +create table gen_table_column ( + column_id bigint(20) not null auto_increment comment '编号', + table_id varchar(64) comment '归属表编号', + column_name varchar(200) comment '列名称', + column_comment varchar(500) comment '列描述', + column_type varchar(100) comment '列类型', + java_type varchar(500) comment 'JAVA类型', + java_field varchar(200) comment 'JAVA字段名', + is_pk char(1) comment '是否主键(1是)', + is_increment char(1) comment '是否自增(1是)', + is_required char(1) comment '是否必填(1是)', + is_insert char(1) comment '是否为插入字段(1是)', + is_edit char(1) comment '是否编辑字段(1是)', + is_list char(1) comment '是否列表字段(1是)', + is_query char(1) comment '是否查询字段(1是)', + query_type varchar(200) default 'EQ' comment '查询方式(等于、不等于、大于、小于、范围)', + html_type varchar(200) comment '显示类型(文本框、文本域、下拉框、复选框、单选框、日期控件)', + dict_type varchar(200) default '' comment '字典类型', + sort int comment '排序', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + primary key (column_id) +) engine=innodb auto_increment=1 comment = '代码生成业务表字段'; \ No newline at end of file